code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class catalogSpider(Spider): <NEW_LINE> <INDENT> name = "catalog" <NEW_LINE> start_urls =["http://www.qincai.net/iohohoioh/index.html"] <NEW_LINE> _pipelines = set([ pipelines.ContentmanagementPipeline, ]) <NEW_LINE> def parse(self,response): <NEW_LINE> <INDENT> sels = response.xpath("//div[@class='rightbox']/div/ul/li...
Crawl catalog information
6259908f55399d3f056281c1
class TempDirectory(File): <NEW_LINE> <INDENT> def __new__(cls): <NEW_LINE> <INDENT> return object.__new__(cls) <NEW_LINE> <DEDENT> def __init__(self): <NEW_LINE> <INDENT> File.__init__(self, mkdtemp()) <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def __exit__(self, exc_t...
A CONTEXT MANAGER FOR AN ALLOCATED, BUT UNOPENED TEMPORARY DIRECTORY WILL BE DELETED WHEN EXITED
6259908f8a349b6b43687f0d
class LoginForm(FlaskForm): <NEW_LINE> <INDENT> email = StringField('Email', validators = [DataRequired()]) <NEW_LINE> password = PasswordField('Password', validators = [DataRequired()]) <NEW_LINE> submit = SubmitField('Login')
Login Form
6259908fad47b63b2c5a94ff
@python_2_unicode_compatible <NEW_LINE> class Category(MPTTModel): <NEW_LINE> <INDENT> name = models.CharField(max_length=64, unique=True) <NEW_LINE> description = models.TextField(null=True, blank=True) <NEW_LINE> parent = TreeForeignKey('self', null=True, blank=True, related_name='subcategories') <NEW_LINE> class MPT...
Nested category model.
6259908fd8ef3951e32c8cb4
class MLP(nn.Module): <NEW_LINE> <INDENT> def __init__(self, n_inputs, n_hidden, n_classes): <NEW_LINE> <INDENT> super(MLP, self).__init__() <NEW_LINE> modules = [] <NEW_LINE> for h in n_hidden: <NEW_LINE> <INDENT> lin = nn.Linear(n_inputs, h) <NEW_LINE> nn.init.normal_(lin.weight, mean=0, std=0.0001) <NEW_LINE> module...
This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.
6259908f099cdd3c63676251
class BBoxOutput(BasicIO, BasicBoundingBox, SimpleHandler): <NEW_LINE> <INDENT> def __init__(self, identifier, title=None, abstract=None, crss=None, dimensions=None, mode=MODE.NONE): <NEW_LINE> <INDENT> BasicIO.__init__(self, identifier, title, abstract) <NEW_LINE> BasicBoundingBox.__init__(self, crss, dimensions) <NEW...
Basic BoundingBox output class
6259908fad47b63b2c5a9501
class Branch(models.Model): <NEW_LINE> <INDENT> name_full = models.CharField( help_text="The full name of the branch", max_length=255, ) <NEW_LINE> name_short = models.CharField( help_text="The abbreviated name of the branch", max_length=255, ) <NEW_LINE> contact_name = models.CharField( help_text="The main contact for...
Details on the branch
6259908f656771135c48ae89
class QueryBody(Model): <NEW_LINE> <INDENT> _validation = { 'query': {'required': True}, } <NEW_LINE> _attribute_map = { 'query': {'key': 'query', 'type': 'str'}, 'timespan': {'key': 'timespan', 'type': 'str'}, 'applications': {'key': 'applications', 'type': '[str]'}, } <NEW_LINE> def __init__(self, *, query: str, time...
The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/). All required parameters must be populated in order to send to Azure. :param query: Required. The query to execute. :type query: str :param timespan: Optional. The t...
6259908f099cdd3c63676252
class Lossable(interfaces.Lossable): <NEW_LINE> <INDENT> def loss(self, outputs, targets): <NEW_LINE> <INDENT> return 'loss(' + outputs + ', ' + targets + ')'
Implements the `Lossable` interface, to be inherited by test classes as a mock dependency. >>> lossable = Lossable() >>> lossable.loss('outputs', 'targets') 'loss(outputs, targets)'
6259908f283ffb24f3cf5551
class GroupViewset(SimpleHyperlinkedModelViewSet): <NEW_LINE> <INDENT> queryset = Group.objects.all() <NEW_LINE> serializer_class = SimpleGroupSerializer <NEW_LINE> model = Group
group viewset for api
6259908fbe7bc26dc9252caf
class User(UserMixin, db.Model): <NEW_LINE> <INDENT> __tablename__ = 'users' <NEW_LINE> id = db.Column(db.Integer, primary_key=True, autoincrement=True) <NEW_LINE> username = db.Column(db.String(50), nullable=False, unique=True) <NEW_LINE> email = db.Column(db.String(100), nullable=False, unique=True) <NEW_LINE> passwo...
Create a User table
625990907cff6e4e811b76f7
class Benchmark(FunkLoadTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.server_url = self.conf_get('main', 'url') <NEW_LINE> <DEDENT> def test_simple(self): <NEW_LINE> <INDENT> server_url = self.server_url <NEW_LINE> if not re.match('https?://', server_url): <NEW_LINE> <INDENT> raise Exception(...
This test uses a configuration file Benchmark.conf.
62599090656771135c48ae8b
class GameObject_MapObject(Structure): <NEW_LINE> <INDENT> fields = Skeleton()
GAMEOBJECT_TYPE_MAPOBJECT (14)
62599090f9cc0f698b1c6126
class UserInfo(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(User, on_delete=models.CASCADE) <NEW_LINE> slack_id = models.CharField(max_length=16) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return f'Username: {self.user} Slack ID: {self.slack_id}'
Model used to extend Django's base User model
62599090283ffb24f3cf5558
class TimeAxis(AbstractAxis): <NEW_LINE> <INDENT> def __init__(self, begin, end, styles=[]): <NEW_LINE> <INDENT> super(TimeAxis, self).__init__( begin=begin, end=end, styles=styles) <NEW_LINE> <DEDENT> def count(self, receive): <NEW_LINE> <INDENT> foo, style = list(self._styles.items())[0] <NEW_LINE> receive(style, sel...
Abstract time axis
62599090ec188e330fdfa568
class ClumperError(Exception): <NEW_LINE> <INDENT> pass
Base Exception for Clumper errors
62599090283ffb24f3cf5559
class TipoDeAtributo(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'TipoDeAtributo' <NEW_LINE> idTipoDeAtributo = db.Column(db.Integer, primary_key=True, nullable=False) <NEW_LINE> nombre = db.Column(db.String(45), unique=True, nullable=False) <NEW_LINE> tipoDeDato = db.Column(db.String(20), nullable=False) <NEW_LINE>...
Modelo de Tipo de Atributo
6259909097e22403b383cbb1
class Square: <NEW_LINE> <INDENT> def __init__(self, size=0): <NEW_LINE> <INDENT> self.__size = size <NEW_LINE> if not isinstance(size, int): <NEW_LINE> <INDENT> raise TypeError('size must be an integer') <NEW_LINE> <DEDENT> if size < 0: <NEW_LINE> <INDENT> raise ValueError('size must be >= 0') <NEW_LINE> <DEDENT> <DED...
defines a square by size
62599090dc8b845886d55273
class GetUserTablesMySqlTaskProperties(ProjectTaskProperties): <NEW_LINE> <INDENT> _validation = { 'task_type': {'required': True}, 'errors': {'readonly': True}, 'state': {'readonly': True}, 'commands': {'readonly': True}, 'output': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'task_type': {'key': 'taskType', 't...
Properties for the task that collects user tables for the given list of databases. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param task_type: Required. Task type.Constant filled by server. :type task_t...
62599090d8ef3951e32c8cba
class Provider(BaseProvider): <NEW_LINE> <INDENT> vat_id_formats = ( 'LU########', ) <NEW_LINE> def vat_id(self): <NEW_LINE> <INDENT> return self.bothify(self.random_element(self.vat_id_formats))
A Faker provider for the Luxembourgish VAT IDs
62599090656771135c48ae8e
class AlphaComputerPlayer(ComputerPlayer): <NEW_LINE> <INDENT> def __init__(self, name="", level=1): <NEW_LINE> <INDENT> super().__init__(name, level) <NEW_LINE> <DEDENT> def play(self, plateau): <NEW_LINE> <INDENT> score, column = self.max_c(plateau, self.level, inf) <NEW_LINE> return column <NEW_LINE> <DEDENT> def mi...
This class implements the alpha-beta pruning algorithm to make mini-max computationally more efficient
6259909060cbc95b06365bc5
class AvailableServicesDataUpdater: <NEW_LINE> <INDENT> def perform_update(self,entities_type, content): <NEW_LINE> <INDENT> AvailableService.clean() <NEW_LINE> for s in content: <NEW_LINE> <INDENT> service = AvailableService(s) <NEW_LINE> service.save()
The AvailableServicesDataUpdater class implements the operations for updating the available service collection
6259909055399d3f056281cf
class Renderer(object): <NEW_LINE> <INDENT> __metaclass__ = abc.ABCMeta <NEW_LINE> def __init__(self, out=None, title=None, width=80): <NEW_LINE> <INDENT> self._font = 0 <NEW_LINE> self._out = out or log.out <NEW_LINE> self._title = title <NEW_LINE> self._width = width <NEW_LINE> <DEDENT> def Entities(self, buf): <NEW_...
Markdown renderer base class. The member functions provide an abstract document model that matches markdown entities to output document renderings. Attributes: _font: The font attribute bitmask. _out: The output stream. _title: The document tile. _width: The output width in characters.
625990903617ad0b5ee07e0c
class ExportTrack(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "wm.export_track_pos_only" <NEW_LINE> bl_label = "export track" <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> export_track(context) <NEW_LINE> return {'FINISHED'}
Tooltip
62599090be7bc26dc9252cb3
class Cuirass(item.Equippable): <NEW_LINE> <INDENT> pass
whoops I forgot the target
62599090dc8b845886d55277
class Piece: <NEW_LINE> <INDENT> def __init__(self, position, color): <NEW_LINE> <INDENT> self.posn = position <NEW_LINE> self.color = color <NEW_LINE> <DEDENT> def move(self, posn_2): <NEW_LINE> <INDENT> print("Invalid move.")
Piece Superclass. All piece objects inherit the Piece class
62599090d8ef3951e32c8cbc
class Cabinet(models.Model): <NEW_LINE> <INDENT> idc = models.ForeignKey(IDC, verbose_name='所在机房') <NEW_LINE> name = models.CharField(max_length=255, null=False, verbose_name='机柜名称') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> db_table = 'resources_cabint' <NEW_LINE> ordering = ['id'] <NEW_LINE> <DEDENT> def __str__(sel...
机柜.
62599090adb09d7d5dc0c219
class RequestTestResponse(BaseResponse): <NEW_LINE> <INDENT> def __init__(self, response, status, headers): <NEW_LINE> <INDENT> BaseResponse.__init__(self, response, status, headers) <NEW_LINE> self.body_data = pickle.loads(self.get_data()) <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> return self...
Subclass of the normal response class we use to test response and base classes. Has some methods to test if things in the response match.
6259909060cbc95b06365bc7
class ordering(enum.IntEnum): <NEW_LINE> <INDENT> forwards = 0 <NEW_LINE> backwards = 1
ordering for compounded_ex
62599090283ffb24f3cf555f
class LSM303(object): <NEW_LINE> <INDENT> def __init__(self, hires=True, accel_address=LSM303_ADDRESS_ACCEL, mag_address=LSM303_ADDRESS_MAG, i2c=None, **kwargs): <NEW_LINE> <INDENT> if i2c is None: <NEW_LINE> <INDENT> import libraries.Adafruit_GPIO.I2C as I2C <NEW_LINE> i2c = I2C <NEW_LINE> <DEDENT> self._accel = i2c.g...
LSM303 accelerometer & magnetometer.
625990903617ad0b5ee07e10
class PreferencesModule(PgAdminModule): <NEW_LINE> <INDENT> def get_own_javascripts(self): <NEW_LINE> <INDENT> return [{ 'name': 'pgadmin.preferences', 'path': url_for('preferences.index') + 'preferences', 'when': None }] <NEW_LINE> <DEDENT> def get_own_stylesheets(self): <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDEN...
PreferenceModule represets the preferences of different modules to the user in UI. And, allows the user to modify (not add/remove) as per their requirement.
62599090dc8b845886d55279
class Description(pygame.sprite.Sprite): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pygame.sprite.Sprite.__init__(self) <NEW_LINE> self.dart = pygame.image.load("sprites/descriptions/dart.png").convert() <NEW_LINE> self.tack = pygame.image.load("sprites/descriptions/tack.png").convert() <NEW_LINE> self...
This class defines the sprite for the tower description class.
62599090099cdd3c6367625a
class RogueBoxOptions: <NEW_LINE> <INDENT> def __init__(self, game_exe_path=None, rogue_options=RogueOptions(), max_step_count=500, episodes_for_evaluation=200, evaluator=None, state_generator="Dummy_StateGenerator", reward_generator="Dummy_RewardGenerator", transform_descent_action=False, refresh_after_commands=True, ...
RogueBox options class
62599090f9cc0f698b1c612c
class BetaHelloServiceStub(object): <NEW_LINE> <INDENT> def SayHello(self, request, timeout, metadata=None, with_call=False, protocol_options=None): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> SayHello.future = None <NEW_LINE> def SayHelloStrict(self, request, timeout, metadata=None, with_call=F...
The Beta API is deprecated for 0.15.0 and later. It is recommended to use the GA API (classes and functions in this file not marked beta) for all further purposes. This class was generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.
625990904a966d76dd5f0ba7
class URL_Fuzzer: <NEW_LINE> <INDENT> def __init__(self, host): <NEW_LINE> <INDENT> if type(host) is Host: <NEW_LINE> <INDENT> self.host = host <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError("wrong type for attribute host!") <NEW_LINE> <DEDENT> Logger.info("fuzzing url", self.host.getURL()) <NEW_LINE> <...
class to perform spidering and fuzzing tasks
6259909097e22403b383cbbb
@attr.s(slots=True, auto_attribs=True, kw_only=True) <NEW_LINE> class PopupMenu(): <NEW_LINE> <INDENT> title: str <NEW_LINE> contents: List[PopupChoice] = attr.Factory(list) <NEW_LINE> x: int = 10 <NEW_LINE> y: int = 5 <NEW_LINE> w: int = map.w - 20 <NEW_LINE> h: int = map.h - 10 <NEW_LINE> auto_close: bool = True <NEW...
This contains the input and render information for a popup menu.
6259909060cbc95b06365bca
class CommonTests: <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.backend = None <NEW_LINE> raise NotImplementedError() <NEW_LINE> <DEDENT> def test_check_backend(self): <NEW_LINE> <INDENT> self.assertTrue(self.backend.check_backend()) <NEW_LINE> <DEDENT> @pytest.mark.usefixtures("mac") <NEW_LINE> def te...
Base class for integration tests
625990905fdd1c0f98e5fc3c
class ShowcaseDownloadPolicy(bb.Union): <NEW_LINE> <INDENT> _catch_all = 'other' <NEW_LINE> disabled = None <NEW_LINE> enabled = None <NEW_LINE> other = None <NEW_LINE> def is_disabled(self): <NEW_LINE> <INDENT> return self._tag == 'disabled' <NEW_LINE> <DEDENT> def is_enabled(self): <NEW_LINE> <INDENT> return self._ta...
This class acts as a tagged union. Only one of the ``is_*`` methods will return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. :ivar disabled: Do not allow files to be downloaded from Showcases. :ivar enabled: Allow files to be downloaded from Showcases.
6259909050812a4eaa621a29
class Player: <NEW_LINE> <INDENT> def __init__(self, name, hand): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.hand = hand <NEW_LINE> <DEDENT> def play_card(self): <NEW_LINE> <INDENT> drawn_card = self.hand.remove_cards() <NEW_LINE> print("{} has placed: {}".format(self.name, drawn_card)) <NEW_LINE> print("\n")...
This is the Player class, which takes in a name and an instance of a Hand class object. The Player can play cards and check if they still have cards.
625990907cff6e4e811b7709
class set_hadoop_config_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRING, 'request', None, None, ), ) <NEW_LINE> def __init__(self, request=None,): <NEW_LINE> <INDENT> self.request = request <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtocol.TBinaryProto...
Attributes: - request
62599090656771135c48ae94
class EmailValidation(models.Model): <NEW_LINE> <INDENT> username = models.CharField(max_length=30, unique=True) <NEW_LINE> email = models.EmailField(verbose_name=_('E-mail')) <NEW_LINE> password = models.CharField(max_length=30) <NEW_LINE> key = models.CharField(max_length=70, unique=True, db_index=True) <NEW_LINE> cr...
Email Validation model
62599090adb09d7d5dc0c221
class ProfileForms(messages.Message): <NEW_LINE> <INDENT> items = messages.MessageField(ProfileForm, 1, repeated=True)
ProfileForms -- multiple Profile outbound form messages
625990903617ad0b5ee07e18
class DocumentReference(Base): <NEW_LINE> <INDENT> __tablename__ = 'document_reference' <NEW_LINE> __table_args__ = {'schema': 'forest_distance_lines'} <NEW_LINE> id = sa.Column(sa.String, primary_key=True, autoincrement=False) <NEW_LINE> document_id = sa.Column( sa.String, sa.ForeignKey(Document.id), nullable=False ) ...
Meta bucket (join table) for the relationship between documents. Attributes: id (int): The identifier. This is used in the database only and must not be set manually. If you don't like it - don't care about. document_id (int): The foreign key to the document which references to another document. r...
62599090a05bb46b3848bf88
class PySmear2D(object): <NEW_LINE> <INDENT> def __init__(self, data=None, model=None): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.model = model <NEW_LINE> self.accuracy = 'Low' <NEW_LINE> self.limit = 3.0 <NEW_LINE> self.index = None <NEW_LINE> self.coords = 'polar' <NEW_LINE> self.smearer = True <NEW_LINE> ...
Q smearing class for SAS 2d pinhole data
62599090bf627c535bcb319b
class PolicyGradient(object): <NEW_LINE> <INDENT> def __init__(self, lr=None): <NEW_LINE> <INDENT> self.lr = lr <NEW_LINE> <DEDENT> def learn(self, act_prob, action, reward, length=None): <NEW_LINE> <INDENT> self.reward = fluid.layers.py_func( func=reward_func, x=[action, length], out=reward) <NEW_LINE> neg_log_prob = ...
policy gradient
6259909050812a4eaa621a2a
class _Data(object): <NEW_LINE> <INDENT> def __init__(self, workspace): <NEW_LINE> <INDENT> self.workspace = workspace <NEW_LINE> self.settings = {"title" : "Test Report", "summary" : "",} <NEW_LINE> self.data_testsuites = {} <NEW_LINE> for dut in self.workspace.duts(): <NEW_LINE> <INDENT> dut_info = {} <NEW_LINE> dut_...
extract information from workspace testsuites with same name in different dut will be merged
62599090283ffb24f3cf5569
class AlignmentSetMetadataType (DataSetMetadataType): <NEW_LINE> <INDENT> _TypeDefinition = None <NEW_LINE> _ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY <NEW_LINE> _Abstract = False <NEW_LINE> _ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'AlignmentSetMetadataType') <NEW_LINE> _X...
Complex type {http://pacificbiosciences.com/PacBioDatasets.xsd}AlignmentSetMetadataType with content type ELEMENT_ONLY
6259909055399d3f056281dd
class Controller(object): <NEW_LINE> <INDENT> def __init__(self, baseurl: str, username: str = None, password: str = None) -> None: <NEW_LINE> <INDENT> self._session = Session() <NEW_LINE> self._session.auth = (username, password) <NEW_LINE> self._prefix = baseurl + "/ZAutomation/api/v1" <NEW_LINE> self.devices = self....
Z-way Controller class.
62599090f9cc0f698b1c6130
class SMPacketServerNSCGON(SMPacket): <NEW_LINE> <INDENT> command = smcommand.SMServerCommand.NSCGON <NEW_LINE> _payload = [ (smencoder.SMPayloadType.INT, "nb_players", 1), (smencoder.SMPayloadType.INTLIST, "ids", (1, "nb_players")), (smencoder.SMPayloadType.INTLIST, "score", (4, "nb_players")), (smencoder.SMPayloadTyp...
Server command 132 (Game over stats) This packet is send in response to the game over packet. It contains information regarding how well each player did. :param int nb_players: NB of players stats in this packet (size of the next list) :param list ids: Player's ID (calculate from the SMPacketServerNSCUUL) :param list...
62599090283ffb24f3cf556a
class WindowsSystemRegistryPathTest(test_lib.PreprocessPluginTest): <NEW_LINE> <INDENT> _FILE_DATA = 'regf' <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self._fake_file_system = self._BuildSingleFileFakeFileSystem( u'/Windows/System32/config/SYSTEM', self._FILE_DATA) <NEW_LINE> mount_point = fake_path_spec.FakePathS...
Tests for the Windows system Registry path preprocess plug-in object.
62599090ad47b63b2c5a951b
class linear_layer: <NEW_LINE> <INDENT> def __init__(self, input_D, output_D): <NEW_LINE> <INDENT> self.params = dict() <NEW_LINE> self.params['W']=np.random.normal(0,0.1,(input_D,output_D)) <NEW_LINE> self.params['b']=np.random.normal(0,0.1,(1,output_D)) <NEW_LINE> self.gradient = dict() <NEW_LINE> self.gradient['W']=...
The linear (affine/fully-connected) module. It is built up with two arguments: - input_D: the dimensionality of the input example/instance of the forward pass - output_D: the dimensionality of the output example/instance of the forward pass It has two learnable parameters: - self.params['W']: the W matrix (numpy arra...
625990908a349b6b43687f2b
class ShowTaskList(gdb.Command): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ShowTaskList, self).__init__( "show Task-List", gdb.COMMAND_SUPPORT ) <NEW_LINE> <DEDENT> def invoke(self, arg, from_tty): <NEW_LINE> <INDENT> sched = Scheduler() <NEW_LINE> sched.ShowTaskList()
Generate a print out of the current tasks and their states.
62599090283ffb24f3cf556c
class ChartCacheHelper: <NEW_LINE> <INDENT> prefix = "bc:chart:cache" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.crh = RedisHelper(prefix=ChartCacheHelper.prefix) <NEW_LINE> <DEDENT> def put(self, chart_id, data): <NEW_LINE> <INDENT> self.crh.put(chart_id, data) <NEW_LINE> <DEDENT> def get(self, chart_id):...
图表数据缓存
62599090d8ef3951e32c8cc3
class SMSTotalSensor(LTESensor): <NEW_LINE> <INDENT> @property <NEW_LINE> def state(self): <NEW_LINE> <INDENT> return len(self.modem_data.data.sms)
Total SMS sensor entity.
62599090656771135c48ae97
class UIHost(UINode): <NEW_LINE> <INDENT> def __init__(self, parent, host, name): <NEW_LINE> <INDENT> UINode.__init__(self, name, parent) <NEW_LINE> self._host = host <NEW_LINE> self._parent = parent <NEW_LINE> self.refresh() <NEW_LINE> <DEDENT> def refresh(self): <NEW_LINE> <INDENT> self._children = set([]) <NEW_LINE>...
A single host object UI.
62599090283ffb24f3cf556d
class ProcessOperation(Operation.Operation): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> description = [ { "name": _("Point Example"), "property": "point_example", "type": "point", "default": (0.25, 0.25) }, { "name": _("Scalar Example"), "property": "scalar_example", "type": "scalar", "default": 0.3 },...
A Swift plugin for you to use.
625990904a966d76dd5f0bb1
class Processor: <NEW_LINE> <INDENT> def __init__(self, context): <NEW_LINE> <INDENT> self.__handlers = {} <NEW_LINE> self.__context = context <NEW_LINE> <DEDENT> @property <NEW_LINE> def context(self): <NEW_LINE> <INDENT> return self.__context <NEW_LINE> <DEDENT> def register(self, command, handler): <NEW_LINE> <INDEN...
Commands processor to manipulate meeting state.
62599090bf627c535bcb31a1
class OpenHumansMember(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(User, on_delete=models.CASCADE) <NEW_LINE> oh_id = models.CharField(max_length=16, primary_key=True, unique=True) <NEW_LINE> access_token = models.CharField(max_length=256) <NEW_LINE> refresh_token = models.CharField(max_length=256) <...
Store OAuth2 data for Open Humans member. A User account is created for this Open Humans member.
62599090dc8b845886d55287
@compat.python_2_unicode_compatible <NEW_LINE> class BaseNgramModel(object): <NEW_LINE> <INDENT> def __init__(self, ngram_counter): <NEW_LINE> <INDENT> self.ngram_counter = ngram_counter <NEW_LINE> self.ngrams = ngram_counter.ngrams[ngram_counter.order] <NEW_LINE> self._ngrams = ngram_counter.ngrams <NEW_LINE> self._or...
An example of how to consume NgramCounter to create a language model. This class isn't intended to be used directly, folks should inherit from it when writing their own ngram models.
62599090d8ef3951e32c8cc4
class BotCategory(commands.Cog): <NEW_LINE> <INDENT> @commands.command(pass_context=True) <NEW_LINE> async def ping(self, ctx): <NEW_LINE> <INDENT> await ctx.send(":ping_pong: Pong!") <NEW_LINE> print("user has pinged")
Category documentations
62599090adb09d7d5dc0c229
class Collection(object): <NEW_LINE> <INDENT> def __init__(self, database, name): <NEW_LINE> <INDENT> self.__database = database <NEW_LINE> self.name = name <NEW_LINE> <DEDENT> @property <NEW_LINE> def database(self): <NEW_LINE> <INDENT> return self.__database <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <IN...
For instance this class, you needs an instance of :class:`pymongolab.database.Database` and the name of your collection. Example usage: .. code-block:: python >>> from pymongolab import Connection, database, collection >>> con = Connection("MongoLabAPIKey") >>> db = database.Database(con, "database") >>>...
6259909055399d3f056281e4
class OrderPizza(): <NEW_LINE> <INDENT> def __init__(self, order): <NEW_LINE> <INDENT> self.order = order <NEW_LINE> <DEDENT> def take_order(self, name, price): <NEW_LINE> <INDENT> new_price = float(price) <NEW_LINE> for item in self.order: <NEW_LINE> <INDENT> if name in item: <NEW_LINE> <INDENT> new_price += item[1] <...
docstring for OrderPizza
62599090ad47b63b2c5a9521
class InputFileUnknownReference(Exception): <NEW_LINE> <INDENT> def __init__(self, line_number, message): <NEW_LINE> <INDENT> self.line_number = line_number <NEW_LINE> self.message = message <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return ('InputFileUnknownReference (Line ' + str(self.line_number) + '...
InputFileUnknownReference is an `Exception` thrown when a link or host makes reference to an unknown object (Host/Router/Link) :param int line_number: erroneous line of input file :param str message: error message
6259909097e22403b383cbc9
class EV1Data(ESD1Data): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> ESD1Data.__init__(self) <NEW_LINE> self.pmn = NumParam(default=-999.0, info='minimum power limit', tex_name='p_{mn}', power=True, unit='pu', )
Data for electric vehicle model.
625990904a966d76dd5f0bb5
class Inference(object): <NEW_LINE> <INDENT> def __init__(self, parameters, output_layer=None, fileobj=None): <NEW_LINE> <INDENT> import py_paddle.swig_paddle as api <NEW_LINE> if output_layer is not None: <NEW_LINE> <INDENT> topo = topology.Topology(output_layer) <NEW_LINE> gm = api.GradientMachine.createFromConfigPro...
Inference combines neural network output and parameters together to do inference. .. code-block:: python inferer = Inference(output_layer=prediction, parameters=parameters) for data_batch in batches: print inferer.infer(data_batch) :param output_layer: The neural network that should be inferenced. ...
62599090a05bb46b3848bf8d
class UnformattedLines(Line): <NEW_LINE> <INDENT> def append(self, leaf: Leaf, preformatted: bool = True) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> list(generate_comments(leaf)) <NEW_LINE> <DEDENT> except FormatOn as f_on: <NEW_LINE> <INDENT> self.leaves.append(f_on.leaf_from_consumed(leaf)) <NEW_LINE> rais...
Just like :class:`Line` but stores lines which aren't reformatted.
62599090099cdd3c63676263
class FileNamespaceManager(OpenResourceNamespaceManager): <NEW_LINE> <INDENT> def __init__(self, namespace, data_dir=None, file_dir=None, lock_dir=None, digest_filenames=True, **kwargs): <NEW_LINE> <INDENT> self.digest_filenames = digest_filenames <NEW_LINE> if not file_dir and not data_dir: <NEW_LINE> <INDENT> raise M...
:class:`.NamespaceManager` that uses binary files for storage. Each namespace is implemented as a single file storing a dictionary of key/value pairs, serialized using the Python ``pickle`` module.
62599090adb09d7d5dc0c22d
class ClusterAlgebraElement(ElementWrapper): <NEW_LINE> <INDENT> def _add_(self, other): <NEW_LINE> <INDENT> return self.parent().retract(self.lift() + other.lift()) <NEW_LINE> <DEDENT> def _neg_(self): <NEW_LINE> <INDENT> return self.parent().retract(-self.lift()) <NEW_LINE> <DEDENT> def _div_(self, other): <NEW_LINE>...
An element of a cluster algebra.
62599090283ffb24f3cf5573
class Item(BaseModel): <NEW_LINE> <INDENT> uuid = UUIDField(unique=True) <NEW_LINE> name = CharField() <NEW_LINE> price = DecimalField(auto_round=True) <NEW_LINE> description = TextField() <NEW_LINE> availability = IntegerField() <NEW_LINE> category = TextField() <NEW_LINE> _schema = ItemSchema <NEW_LINE> _search_attri...
Item describes a product for the e-commerce platform. Attributes: uuid (UUID): Item UUID name (str): Name for the product price (decimal.Decimal): Price for a single product description (str): Product description availability (int): Quantity of items available category (str): Category group of ...
62599090be7bc26dc9252cbf
class AuthenticatedView(View): <NEW_LINE> <INDENT> @method_decorator(login_required) <NEW_LINE> def dispatch(self, *args, **kwargs): <NEW_LINE> <INDENT> return super(AuthenticatedView, self).dispatch(*args, **kwargs)
A view that when inherited requires a login for both GET and POST methods of a view class
62599090ad47b63b2c5a9525
class NeuralNetBuilder(AspectBuilder): <NEW_LINE> <INDENT> def __init__(self, spec): <NEW_LINE> <INDENT> self.spec = spec <NEW_LINE> <DEDENT> def build(self, robot, model, plugin, analyzer_mode): <NEW_LINE> <INDENT> self._process_brain(plugin, robot.brain) <NEW_LINE> <DEDENT> def _process_brain(self, plugin, brain): <N...
Default neural network builder. Assumes the neural net construction as specified in the example protobuf message.
625990917cff6e4e811b7717
class EntityVisitor(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> @abstractmethod <NEW_LINE> def visit_rule(self, rule, depth=0): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def visit_literal(self, literal, depth=0): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmet...
Our visitor base class. Each visitor implementation defines an operation for our CGA entities (conditions, rules, etc). The main one here is serialization (see writer.py). The various _visit_x methods define the operation implemented by this visitor for each Entity subclass. Add a new EntityVisitor subclass to define...
62599091656771135c48ae9b
@attr.s <NEW_LINE> class GlobalNovaImageCollection(object): <NEW_LINE> <INDENT> tenant_id = attr.ib() <NEW_LINE> clock = attr.ib() <NEW_LINE> regional_collections = attr.ib(default=attr.Factory(dict)) <NEW_LINE> def collection_for_region(self, region_name, image_store): <NEW_LINE> <INDENT> if region_name not in self.re...
A :obj:`GlobalNovaImageCollection` is a set of all the :obj:`RegionalNovaImageCollection` objects owned by a given tenant. In other words, all the image objects that a single tenant owns globally.
6259909197e22403b383cbcd
class PadLayer(Layer): <NEW_LINE> <INDENT> def __init__( self, layer = None, paddings = None, mode = 'CONSTANT', name = 'pad_layer', ): <NEW_LINE> <INDENT> Layer.__init__(self, name=name) <NEW_LINE> assert paddings is not None, "paddings should be a Tensor of type int32. see https://www.tensorflow.org/api_docs/python/t...
The :class:`PadLayer` class is a Padding layer for any modes and dimensions. Please see `tf.pad <https://www.tensorflow.org/api_docs/python/tf/pad>`_ for usage. Parameters ---------- layer : a :class:`Layer` instance The `Layer` class feeding into this layer. padding : a Tensor of type int32. mode : one of "CONSTA...
625990917cff6e4e811b7719
class ComputeTargetVpnGatewaysInsertRequest(_messages.Message): <NEW_LINE> <INDENT> project = _messages.StringField(1, required=True) <NEW_LINE> region = _messages.StringField(2, required=True) <NEW_LINE> targetVpnGateway = _messages.MessageField('TargetVpnGateway', 3)
A ComputeTargetVpnGatewaysInsertRequest object. Fields: project: Project ID for this request. region: The name of the region for this request. targetVpnGateway: A TargetVpnGateway resource to be passed as the request body.
6259909160cbc95b06365bd3
class DoublePatcher(TweakPatcher,ListPatcher): <NEW_LINE> <INDENT> listLabel = _(u'Source Mods/Files') <NEW_LINE> def GetConfigPanel(self,parent,gConfigSizer,gTipText): <NEW_LINE> <INDENT> if self.gConfigPanel: return self.gConfigPanel <NEW_LINE> self.gTipText = gTipText <NEW_LINE> gConfigPanel = self.gConfigPanel = wx...
Patcher panel with option to select source elements.
625990913617ad0b5ee07e28
class _ASoulTrapTweak(_AGmstCCTweak): <NEW_LINE> <INDENT> tweak_choices = [(u'4', 4), (u'16', 16), (u'28', 28), (u'38', 38)]
Base class for Soul Trap tweaks.
6259909197e22403b383cbcf
class H5Data(Data): <NEW_LINE> <INDENT> def __init__(self, batch_size, cache=None, preloading=0, features_name='features', labels_name='labels', spectators_name = None): <NEW_LINE> <INDENT> super(H5Data, self).__init__(batch_size,cache,(spectators_name is not None)) <NEW_LINE> self.features_name = features_name <NEW_LI...
Loads data stored in hdf5 files Attributes: features_name, labels_name, spectators_name: names of the datasets containing the features, labels, and spectators respectively
625990918a349b6b43687f37
class Meta: <NEW_LINE> <INDENT> verbose_name_plural = "hypotheses"
Hypothesis Model meta options. For more information, please see: https://docs.djangoproject.com/en/1.10/topics/db/models/#meta-options
62599091656771135c48ae9d
class RequestLogger(wsgi.Middleware): <NEW_LINE> <INDENT> @webob.dec.wsgify(RequestClass=wsgi.Request) <NEW_LINE> def __call__(self, req): <NEW_LINE> <INDENT> req_id = req.headers.get('x-qonos-request-id') <NEW_LINE> if req_id is not None: <NEW_LINE> <INDENT> LOG.info('Processing Qonos request: %s' % req_id) <NEW_LINE>...
Logs qonos request id, if present, before and after processing a request The request id is determined by looking for the header 'x-qonos-request-id'.
6259909155399d3f056281ee
class OnSolarScheduleConstraint(SolarScheduleConstraint): <NEW_LINE> <INDENT> pass
Constraint between a Unit and on-SolarSchedules.
62599091a05bb46b3848bf91
class BERTModel(nn.Block): <NEW_LINE> <INDENT> def __init__(self, center_hiddens, center_ffn_hiddens, center_heads, center_layers, reg_encode_ffn_hiddens, reg_encode_layers, reg_hiddens, cls_hiddens, dropout): <NEW_LINE> <INDENT> super(BERTModel, self).__init__() <NEW_LINE> self.center = BERTEncoder(center_hiddens, cen...
Define a BERT model.
6259909197e22403b383cbd3
class MockTelnet(StatefulTelnet): <NEW_LINE> <INDENT> def __init__(self, prompt, commands): <NEW_LINE> <INDENT> self._password_input = False <NEW_LINE> super(MockTelnet, self).__init__() <NEW_LINE> self.prompt = prompt <NEW_LINE> self.commands = {c.name: c for c in commands} <NEW_LINE> self.cmdstack = [] <NEW_LINE> sel...
This aims to act as a telent server over the SAME contract as MockSSH Taking the same commands and making them work the same ensure the same test code can be applied to SSH and Telnet
625990918a349b6b43687f3b
class RequestList(ProtectedListView): <NEW_LINE> <INDENT> template_name = 'requests/list.html' <NEW_LINE> context_object_name = 'users_request_list' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return Request.objects.filter(ideal_time__gte=timezone.now(), user = self.request.user.id)
Front page after user login. Displays their requests.
62599091bf627c535bcb31af
@needs_mesos <NEW_LINE> class MesosPromisedRequirementsTest(hidden.AbstractPromisedRequirementsTest, MesosTestSupport): <NEW_LINE> <INDENT> def getBatchSystemName(self): <NEW_LINE> <INDENT> self._startMesos(self.cpuCount) <NEW_LINE> return "mesos" <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self._stopMe...
Tests against the Mesos batch system
6259909160cbc95b06365bd6
class InterpolationException(AocUtilsException): <NEW_LINE> <INDENT> pass
Something went wrong with an interpolation
6259909197e22403b383cbd5
class UploadImageHandler(BaseHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> pid = self.get_argument("pid", None) <NEW_LINE> self.render('upload_image.html', pid=pid) <NEW_LINE> <DEDENT> @session <NEW_LINE> def post(self): <NEW_LINE> <INDENT> uid = self.SESSION['uid'] <NEW_LINE> p=AvatarProcessor(uid) ...
图片上传
62599091283ffb24f3cf557e
@common.register_class_methods <NEW_LINE> class CMP(CheckConfig): <NEW_LINE> <INDENT> built_in_policies = [ "ns_cmp_content_type", "ns_cmp_msapp", "ns_cmp_mscss", "ns_nocmp_mozilla_47", "ns_nocmp_xml_ie" ] <NEW_LINE> @common.register_for_cmd("set", "cmp", "parameter") <NEW_LINE> def set_cmp_parameter(self, cmp_param_tr...
Checks CMP feature commands.
625990917cff6e4e811b7723
class PriceProfileAdmin(SimpleHistoryAdmin): <NEW_LINE> <INDENT> list_display = ('name', 'a', 'b', 'c', 'alpha', 'use_for_draft') <NEW_LINE> ordering = ('name',) <NEW_LINE> search_fields = ('name',) <NEW_LINE> list_filter = ('use_for_draft',)
The admin class for :class:`Consumptions <preferences.models.PriceProfile>`.
62599091099cdd3c6367626a
class Post(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'post' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> title = db.Column(db.String(50)) <NEW_LINE> excerpt = db.Column(db.String(200)) <NEW_LINE> description = db.Column(db.Text()) <NEW_LINE> image = db.Column(db.String(100)) <NEW_LINE> create...
Creates the post model Functions: dump_datetime -- Deserialize datetime object into string form for JSON processing. serialize -- Creates a dict from post object serialize2 -- Creates a dict from post object
6259909150812a4eaa621a37
class EndPointWrapper(object): <NEW_LINE> <INDENT> def __init__(self, tty, switchEventQueue): <NEW_LINE> <INDENT> self.id = None <NEW_LINE> self.log = logging.getLogger("EndPoint[{}]".format(self.id)) <NEW_LINE> self.switchEventQueue = switchEventQueue <NEW_LINE> escapingSink = EscapingSink(TtySink(tty)) <NEW_LINE> esc...
classdocs
62599091dc8b845886d5529b
class PositionCommand(Command): <NEW_LINE> <INDENT> NAME = "POSITION" <NEW_LINE> def __init__( self, stream_name: str, instance_name: str, prev_token: int, new_token: int ): <NEW_LINE> <INDENT> self.stream_name = stream_name <NEW_LINE> self.instance_name = instance_name <NEW_LINE> self.prev_token = prev_token <NEW_LINE...
Sent by an instance to tell others the stream position without needing to send an RDATA. Two tokens are sent, the new position and the last position sent by the instance (in an RDATA or other POSITION). The tokens are chosen so that *no* rows were written by the instance between the `prev_token` and `new_token`. (If a...
625990915fdd1c0f98e5fc5a
class BrowserDetectionError(Exception): <NEW_LINE> <INDENT> def __init__(self, message, cause): <NEW_LINE> <INDENT> super().__init__(message) <NEW_LINE> self.cause = cause
BrowserDetectionError
62599091a05bb46b3848bf96
class CallbacksRegistry: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.callbacks = {BEFORE_APPLY: [], AFTER_APPLY: []} <NEW_LINE> <DEDENT> def add(self, trigger, callable, actions=ACTIONS, resources=SUPPORTED_RESOURCES): <NEW_LINE> <INDENT> assert trigger in self.callbacks, "{} is not a supported tri...
A named registry collects (async) callbacks for a specific action during the apply workflow.
625990917cff6e4e811b7727
class ExcHandlerError(RuntimeError): <NEW_LINE> <INDENT> def __init__(self, badExcListenerID, topicObj, origExc=None): <NEW_LINE> <INDENT> self.badExcListenerID = badExcListenerID <NEW_LINE> import traceback <NEW_LINE> self.exc = traceback.format_exc() <NEW_LINE> msg = 'The exception handler registered with pubsub rais...
When an exception gets raised within some listener during a sendMessage(), the registered handler (see pub.setListenerExcHandler()) gets called (via its __call__ method) and the send operation can resume on remaining listeners. However, if the handler itself raises an exception while it is being called, the send opera...
6259909160cbc95b06365bda
class MyAlgorithm(object): <NEW_LINE> <INDENT> def __init__(self, datasetdir): <NEW_LINE> <INDENT> self.datasetdir = datasetdir <NEW_LINE> trained_file = "./model2.pkl" <NEW_LINE> self.classifier = keras.models.load_model(trained_file) <NEW_LINE> self.classes = joblib.load("./model.pkl") <NEW_LINE> <DEDENT> def predict...
アルゴリズム
62599091f9cc0f698b1c613e
class TestHomotopy(SimulationTest): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> SimulationTest.setup_class_base('OperatorTests.mo', 'OperatorTests.HomotopyTest') <NEW_LINE> <DEDENT> @testattr(stddist_full = True) <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.setup_base(st...
Basic test of Modelica operators.
6259909155399d3f056281fa
class BiosVfProcessorC3Report(ManagedObject): <NEW_LINE> <INDENT> consts = BiosVfProcessorC3ReportConsts() <NEW_LINE> naming_props = set([]) <NEW_LINE> mo_meta = MoMeta("BiosVfProcessorC3Report", "biosVfProcessorC3Report", "Processor-C3-Report", VersionMeta.Version151f, "InputOutput", 0x1f, [], ["admin", "read-only", "...
This is BiosVfProcessorC3Report class.
6259909150812a4eaa621a39
class TagsCanonicalize(command.Command): <NEW_LINE> <INDENT> log = logging.getLogger(__name__) <NEW_LINE> def take_action(self, parsed_args): <NEW_LINE> <INDENT> import pinboard <NEW_LINE> pinboard._debug = 1 <NEW_LINE> client = self.app.get_client() <NEW_LINE> all_tags = client.tags() <NEW_LINE> self.log.info('Found %...
Combine tags that are the same except for capitalization.
62599091ad47b63b2c5a9538
class GeoWatchClient(object): <NEW_LINE> <INDENT> backend = None <NEW_LINE> templates = None <NEW_LINE> def close(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __init__(self, backend="", templates=None): <NEW_LINE> <INDENT> self.backend = backend <NEW_LINE> self.templates = templates <NEW_LINE> <DEDENT> def _...
Base GeoWatch Client class. Extended by others.
62599091bf627c535bcb31bb