code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Socket(Evented): <NEW_LINE> <INDENT> packet_id = 0 <NEW_LINE> def __init__(self, addresses): <NEW_LINE> <INDENT> super(Socket, self).__init__() <NEW_LINE> self.connected = False <NEW_LINE> self.ws = None <NEW_LINE> self.addresses = addresses <NEW_LINE> self._connect() <NEW_LINE> <DEDENT> def _get_address(self): <... | Socket Class | 62598eed71ff763f4b5e5ee1 |
class NPGPE(object): <NEW_LINE> <INDENT> alphaMu = 0.1 <NEW_LINE> alphaC = 0.05 <NEW_LINE> epsilon = 1.0 <NEW_LINE> gamma = 0.90 <NEW_LINE> def __init__(self, controller): <NEW_LINE> <INDENT> self.controller = controller <NEW_LINE> self.nParameters = self.controller.nParameters <NEW_LINE> self.mu = np.zeros(self.nParam... | NPGPE is a gradient estimator technique proposed by Miyamae et Al. in
"Natural Policy Gradient Methods with Parameter-based Exploration for
Control Tasks" (2010). This method improves the standard PGPE algorithm
by using a natural gradient update and is well-suited to infinite
horizon tasks. It uses optimal baseline an... | 62598eedd486a94d0ba2a750 |
class TestremoveCopyNotification(WebServiceTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestremoveCopyNotification, self).setUp() <NEW_LINE> self.ws_version = 'devel' <NEW_LINE> self.person = self.factory.makePerson() <NEW_LINE> self.archive = self.factory.makeArchive(owner=self.person) <NE... | Test removeCopyNotification. | 62598eed56b00c62f0fb1056 |
class BaseSwissParser(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> _ftype = None <NEW_LINE> def __init__(self, data_file): <NEW_LINE> <INDENT> if not data_file: <NEW_LINE> <INDENT> raise ValueError('File must not be empty') <NEW_LINE> <DEDENT> self.data_file = data_file <NEW_LINE> self.currency_code ... | Base parser class for every Swiss file format.
It provides a base abstraction for every parser
of swiss localisation | 62598eed7d847024c075ab51 |
class Error(Model): <NEW_LINE> <INDENT> def __init__(self, detail: str=None, status: int=None, title: str=None, type: str=None): <NEW_LINE> <INDENT> self.swagger_types = { 'detail': str, 'status': int, 'title': str, 'type': str } <NEW_LINE> self.attribute_map = { 'detail': 'detail', 'status': 'status', 'title': 'title'... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598eed3d592f4c4edb967b |
class MetricValueMC(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Time = None <NEW_LINE> self.Val = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Time = params.get("Time") <NEW_LINE> self.Val = params.get("Val") <NEW_LINE> memeber_set = set(params.k... | GetMonitorMetricResponse
| 62598eedd58c6744b42db677 |
class ConcreteProductB2(AbstractProductB): <NEW_LINE> <INDENT> def interface_b(self): <NEW_LINE> <INDENT> print("ProductB2") | Define a product object to be created by the corresponding concrete
factory.
Implement the AbstractProduct interface. | 62598eed3cc13d1c6d463ef6 |
class Authentication(object): <NEW_LINE> <INDENT> def __init__(self, headers): <NEW_LINE> <INDENT> self.username = None <NEW_LINE> self.password = None <NEW_LINE> auth_schemes = {"Basic": self.decode_basic} <NEW_LINE> if "authorization" in headers: <NEW_LINE> <INDENT> header = headers.get("authorization") <NEW_LINE> au... | Object for dealing with HTTP Authentication
.. attribute:: username
The username supplied in the HTTP Authorization
header, or None
.. attribute:: password
The password supplied in the HTTP Authorization
header, or None | 62598eed5fcc89381b2654e9 |
class LibraryNewsListSeriailzer(serializers.ModelSerializer): <NEW_LINE> <INDENT> show_cover_pic = serializers.SerializerMethodField('get_show_cover_pic') <NEW_LINE> picurl = serializers.SerializerMethodField('get_picurl') <NEW_LINE> content_url = serializers.SerializerMethodField('get_content_url') <NEW_LINE> storage_... | 系统素材库 - 图文库 序列化类 (仅限获取列表信息[GET]) | 62598eed9c8ee8231303f51c |
class TaskDetail(generics.RetrieveUpdateDestroyAPIView, generics.CreateAPIView): <NEW_LINE> <INDENT> queryset = Task.objects.all() <NEW_LINE> serializer_class = TaskSerializer <NEW_LINE> permission_classes = (permissions.IsAuthenticatedOrReadOnly,) | View to assign points to exam task | 62598eed2ae34c7f260a986b |
class RegistrationRequest(models.Model): <NEW_LINE> <INDENT> event_registration_item = models.ForeignKey( EventRegistrationItem, on_delete=models.CASCADE ) <NEW_LINE> player = models.ForeignKey(Player, on_delete=models.CASCADE) <NEW_LINE> mealplan_flag = models.BooleanField(default=False) <NEW_LINE> vehicle_make = mode... | This is the request that a user has to register and is used to link the
player to an eventRegistrationItem, which binds up different order
possibiilities.
Once the paypal transaction comes back, it will be used to produce
the actual registrations. | 62598eed32920d7e50bc47b1 |
class WebCamImporter(AbstractImporter): <NEW_LINE> <INDENT> sigDataEmited = QtCore.pyqtSignal(dict) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.setEnabled(back=False, refresh=False, play=True, step=False) <NEW_LINE> self.label = QtWidgets.QLabel('WebCam Importer', self) <NEW_L... | This is USB WebCam Importer | 62598eed7047854f4633db58 |
class FileStateCache(object): <NEW_LINE> <INDENT> def __init__(self, mtimer, app): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> self.mtimer = mtimer <NEW_LINE> <DEDENT> def update(self, source_file): <NEW_LINE> <INDENT> if not hasattr(self.app.env, "breathe_file_state"): <NEW_LINE> <INDENT> self.app.env.breathe_file_s... | Stores the modified time of the various doxygen xml files against the
reStructuredText file that they are referenced from so that we know which
reStructuredText files to rebuild if the doxygen xml is modified.
We store the information in the environment object so that it is pickled
down and stored between builds as Sp... | 62598eedf548e778e5969d0f |
class table(type(helper.table())): <NEW_LINE> <INDENT> def __init__(self, *args, **kw): <NEW_LINE> <INDENT> super(self.__class__, self).__init__(*args, **kw) <NEW_LINE> <DEDENT> def addCaption(self, caption, **kw): <NEW_LINE> <INDENT> if 'caption' not in self.__dict__: <NEW_LINE> <INDENT> self.__dict__['caption'] = hel... | Extend base table tag class | 62598eed7b25080760ed5c1f |
class IndexView(TemplateView): <NEW_LINE> <INDENT> template_name = 'pages/index.html' <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> contexto = super().get_context_data(**kwargs) <NEW_LINE> contexto['titulo_pagina'] = 'restaurUCS' <NEW_LINE> contexto['estabelecimentos'] = Estabelecimento.objects.a... | Retorna a renderização da tela inicial do aplicativo. | 62598eedcb5e8a47e493b53b |
class GitConf(TextConf): <NEW_LINE> <INDENT> _keys = None <NEW_LINE> """ Git Configuration File (simple) reader """ <NEW_LINE> def __init__(self, data:str, fname:str=""): <NEW_LINE> <INDENT> self._data = data <NEW_LINE> self._name = fname <NEW_LINE> self._code = self._parse(data) <NEW_LINE> <DEDENT> def get_items(self,... | GitConf class handles text config files from .git/... | 62598eedcc0a2c111447978a |
class TestIsIntPalindrome(unittest.TestCase): <NEW_LINE> <INDENT> def test_1(self): <NEW_LINE> <INDENT> self.assertEqual(True, solution.is_int_palindrome(1)) <NEW_LINE> <DEDENT> def test_2(self): <NEW_LINE> <INDENT> self.assertEqual(False, solution.is_int_palindrome(42)) <NEW_LINE> <DEDENT> def test_3(self): <NEW_LINE>... | docstring for TestIsIntPalindrome | 62598eed2eb69b55b15a074d |
class Post(models.Model): <NEW_LINE> <INDENT> name = CharField(unique=True, max_length=255) <NEW_LINE> title = CharField(max_length=255) <NEW_LINE> subtitle = CharField(max_length=255) <NEW_LINE> timestamp = DateTimeField() <NEW_LINE> content = CharField(max_length=16384) <NEW_LINE> comments = ForeignRelatedObjectsDesc... | Object model representing a blog post | 62598eed460517430c430c0d |
class ListAttachments(grok.Viewlet): <NEW_LINE> <INDENT> grok.context(IAttachments) <NEW_LINE> grok.viewletmanager(Content) <NEW_LINE> def update(self): <NEW_LINE> <INDENT> popups.need() | Displays a list of attachments and allows edit/delete on each item
| 62598eed92d797404e387f3d |
class CommandAction(Action): <NEW_LINE> <INDENT> type = "command" <NEW_LINE> command = "" <NEW_LINE> def on_init(self): <NEW_LINE> <INDENT> super().on_init() <NEW_LINE> if "command" not in self.configuration: <NEW_LINE> <INDENT> raise ValueError(str.format("The command action {0} is not properly configured:" "The comma... | CommandAction Class | 62598eed442bda511e95abe8 |
class ForgetPwdView(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> forget_form = ForgetForm() <NEW_LINE> return render(request, "forgetpwd.html", {"forget_form": forget_form}) <NEW_LINE> <DEDENT> def post(self, request): <NEW_LINE> <INDENT> forget_form = ForgetForm(request.POST) <NEW_LINE> if fo... | 忘记密码 | 62598eedd6c5a102081e08b7 |
class FileProjectsLocationsSnapshotsDeleteRequest(_messages.Message): <NEW_LINE> <INDENT> name = _messages.StringField(1, required=True) | A FileProjectsLocationsSnapshotsDeleteRequest object.
Fields:
name: The snapshot resource name, in the format
projects/{project_id}/locations/{location}/snapshots/{snapshot_id} | 62598eed63b5f9789fe838e3 |
class LennardJonesium(Model): <NEW_LINE> <INDENT> def __init__(self, box, particles, cells, max_interactions, interaction_energy, interaction_range): <NEW_LINE> <INDENT> Model.__init__(self, box, particles, cells, max_interactions, interaction_energy, interaction_range) <NEW_LINE> self.potential_shift = math.pow(1/inte... | Derived class for implementing the Lennard-Jones potential. | 62598eedff9c53063f518dea |
class MemoryTester(MemoryElement): <NEW_LINE> <INDENT> def __init__(self, id, type, size, mem_handler): <NEW_LINE> <INDENT> super(MemoryTester, self).__init__(id=id, type=type, size=size, mem_handler=mem_handler) <NEW_LINE> self._update_finished_cb = None <NEW_LINE> self._write_finished_cb = None <NEW_LINE> self.readVa... | Memory interface for testing the memory sub system, end to end.
Usage
1. To verify reading:
* Call read_data()
* Wait for the callback to be called
* Verify that readValidationSucess is True
2. To verify writing:
* Set the parameter 'memTst.resetW' in the ed
* call write_data()
* Wait for the callback
*... | 62598eedd7e4931a7ef3a826 |
class GitUserNotFound(HTTPException): <NEW_LINE> <INDENT> code = 404 <NEW_LINE> description = ( "Failed to found corresponding Git user. " "Please check Git user name and try again" ) | *404* CUSTOM `Not Found`
Raise if a git user does not exist. | 62598eed851cf427c66b6a4f |
class PBClientFactory(protocol.ClientFactory): <NEW_LINE> <INDENT> protocol = Broker <NEW_LINE> unsafeTracebacks = False <NEW_LINE> def __init__(self, unsafeTracebacks=False, security=globalSecurity): <NEW_LINE> <INDENT> self.unsafeTracebacks = unsafeTracebacks <NEW_LINE> self.security = security <NEW_LINE> self._reset... | Client factory for PB brokers.
As with all client factories, use with reactor.connectTCP/SSL/etc..
getPerspective and getRootObject can be called either before or
after the connect. | 62598eed090684286d592aa5 |
class IpamOperatingRegion(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "RegionName": (str, True), } | `IpamOperatingRegion <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ipam-ipamoperatingregion.html>`__ | 62598eed9c8ee8231303f51d |
class ExampleGeneratorCli(GeneratorCli): <NEW_LINE> <INDENT> def build_parser(self, parser): <NEW_LINE> <INDENT> self._add_module_args(parser) <NEW_LINE> self._add_prefix_args(parser) <NEW_LINE> <DEDENT> def create_generator(self, out, args): <NEW_LINE> <INDENT> module_names = self._parse_module_args(args) <NEW_LINE> p... | Generator command-line interface which adds command to the compiler arg parser. | 62598eedbe7bc26dc9251225 |
class DistributionBuilderTestBase(StructureAssertingMixin, TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.rootDir = FilePath(self.mktemp()) <NEW_LINE> self.rootDir.createDirectory() <NEW_LINE> self.outputDir = FilePath(self.mktemp()) <NEW_LINE> self.outputDir.createDirectory() <NEW_LINE> self.... | Base for tests of L{DistributionBuilder}. | 62598eedf548e778e5969d11 |
class FlickPricingSensor(Entity): <NEW_LINE> <INDENT> def __init__(self, api: FlickAPI): <NEW_LINE> <INDENT> self._api: FlickAPI = api <NEW_LINE> self._price: FlickPrice = None <NEW_LINE> self._attributes = { ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_FRIENDLY_NAME: FRIENDLY_NAME, } <NEW_LINE> <DEDENT> @property <NEW_LINE> de... | Entity object for Flick Electric sensor. | 62598eed16aa5153ce3fec87 |
class TestAirportAtlas(unittest.TestCase): <NEW_LINE> <INDENT> test_csv = '/home/alan/PycharmProjects/routeCalc/data/test_data.csv' <NEW_LINE> airport_atlas = AirportAtlas(test_csv) <NEW_LINE> def test1(self): <NEW_LINE> <INDENT> lat1 = 53.421333 <NEW_LINE> long1 = -6.270075 <NEW_LINE> lat2 = 51.4775 <NEW_LINE> long2 =... | class to test Aircraft methods | 62598eed435de62698e9a559 |
class Stack(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.cards = [] <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> rep = "" <NEW_LINE> for card in self.cards: <NEW_LINE> <INDENT> rep += str(card) + "\n" <NEW_LINE> <DEDENT> return rep <NEW_LINE> <DEDENT> def add(self, card): <NEW... | A stack of cards | 62598eed4527f215b58e8685 |
class AbstractProductRecord(models.Model): <NEW_LINE> <INDENT> product = models.OneToOneField( 'catalogue.Product', verbose_name=_("Product")) <NEW_LINE> num_views = models.PositiveIntegerField(_('Views'), default=0) <NEW_LINE> num_basket_additions = models.PositiveIntegerField( _('Basket Additions'), default=0) <NEW_L... | A record of a how popular a product is.
This used be auto-merchandising to display the most popular
products. | 62598eed91f36d47f2230267 |
class InvalidConsoleLogPathError(Exception): <NEW_LINE> <INDENT> def __init__(self, path, message): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.message = message | Raised when an invalid path was specified in the path.dat. | 62598eed44b2445a339b5d2e |
class Lives(Enum): <NEW_LINE> <INDENT> ALIVE = 1 <NEW_LINE> DECEASED = 2 | The enum indicating the status of being alive or deceased.
| 62598eed97e22403b3839677 |
class GunInterface: <NEW_LINE> <INDENT> def __init__(self, gun): <NEW_LINE> <INDENT> self.is_preparing = gun.is_preparing <NEW_LINE> self.is_reloading = gun.is_reloading <NEW_LINE> self.prepare_fire = gun.prepare_fire_robot | Restricted access gun interface. | 62598eed3cc13d1c6d463efa |
class PEResourceCreationFormatter(PEEventFormatter): <NEW_LINE> <INDENT> DATA_TYPE = u'pe:resource:creation_time' <NEW_LINE> SOURCE_LONG = u'PE Resource Creation Time' | Formatter for a PE resource creation event. | 62598eed7047854f4633db5b |
class MeshLinePlot(Plot): <NEW_LINE> <INDENT> def _set_mode(self, value): <NEW_LINE> <INDENT> if hasattr(self, '_mesh'): <NEW_LINE> <INDENT> self._mesh.mode = value <NEW_LINE> <DEDENT> <DEDENT> mode = AliasProperty(lambda self: self._mesh.mode, _set_mode) <NEW_LINE> def create_drawings(self): <NEW_LINE> <INDENT> self._... | MeshLinePlot class which displays a set of points similar to a mesh.
| 62598eedd7e4931a7ef3a828 |
class ManagerService: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_all_managers(): <NEW_LINE> <INDENT> return User.query.filter(User.role != roles.RESIDENT).all() <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def get_admin_count(): <NEW_LINE> <INDENT> return User.query.filter_by(role=roles.ADMIN).count() | DB and utility functions for Managers | 62598eed7047854f4633db5c |
class TradeStrategy1(TradeStrategyBase): <NEW_LINE> <INDENT> s_keep_stock_threshold = 20 <NEW_LINE> def __init__ (self): <NEW_LINE> <INDENT> self.keep_stock_day = 0 <NEW_LINE> self.__buy_change_threshold = 0.07 <NEW_LINE> <DEDENT> def buy_strategy(self, trade_ind, trade_day, trade_days): <NEW_LINE> <INDENT> if self.kee... | 交易策略1: 追涨策略, 当股价上涨一个阀值默认为7%时
买入股票并持有s_keep_stock_threshold(20)天 | 62598eed1f037a2d8b9e2891 |
class List(ListWidget): <NEW_LINE> <INDENT> admin = site.get_action('bans') <NEW_LINE> id = 'list' <NEW_LINE> columns = ( ('ban', _("Ban"), 50), ('expires', _("Expires")), ) <NEW_LINE> default_sorting = 'expires' <NEW_LINE> sortables = { 'ban': 1, 'expires': 0, } <NEW_LINE> pagination = 20 <NEW_LINE> search_form = Sear... | List Bans | 62598eedbd1bec0571e1448e |
class Density(object) : <NEW_LINE> <INDENT> def __init__(self, distr, bandwidth = None, adjust = None) : <NEW_LINE> <INDENT> _set_density_fields(self, distr, bandwidth, adjust) <NEW_LINE> <DEDENT> def eval(self, x) : <NEW_LINE> <INDENT> return _density_eval(self, x) <NEW_LINE> <DEDENT> __call__ = eval <NEW_LINE> @stati... | Class for representing the PDF (probability density function) for a distribution.
Warning: For performance reasons, Distribution approximates a set of close points
as a single point with a weight. When this is passed to the R density function
it estimates a different bandwidth from what it would get if it were ... | 62598eed283ffb24f3cf2039 |
class UbuntuOpenStackHorizon(OpenStackHorizon, UbuntuPlugin): <NEW_LINE> <INDENT> packages = ('python-django-horizon', 'openstack-dashboard', 'openstack-dashboard-ubuntu-theme') <NEW_LINE> def setup(self): <NEW_LINE> <INDENT> super(UbuntuOpenStackHorizon, self).setup() <NEW_LINE> self.add_copy_specs(["/etc/apache2/conf... | OpenStack Horizon related information for Ubuntu based distributions
| 62598eed7b25080760ed5c23 |
class InvalidVarcetNames(PlanPrepareException): <NEW_LINE> <INDENT> def __init__(self, invalid_names): <NEW_LINE> <INDENT> PlanPrepareException.__init__(self) <NEW_LINE> self.names = invalid_names <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return _(", ".join(self.names) + " are not valid variant/facet "... | Used to indicate that image plan evaluation or execution failed due
to illegal characters in variant/facet names. | 62598eed7c178a314d78bc1d |
class AddSkipNotifications(CleanupHistoryAndSpecials): <NEW_LINE> <INDENT> def test(self): <NEW_LINE> <INDENT> return self.checkDBVersion() >= 17 <NEW_LINE> <DEDENT> def execute(self): <NEW_LINE> <INDENT> backupDatabase(17) <NEW_LINE> logger.log(u"Adding column skip_notices to tvshows") <NEW_LINE> if not self.hasColumn... | Adding column skip_notices to tv_shows | 62598eed460517430c430c11 |
class DatabaseSyncModelField(models.Model): <NEW_LINE> <INDENT> _name = 'database.sync.model.field' <NEW_LINE> _description = "Fields to sync" <NEW_LINE> model_id = fields.Many2one( comodel_name='database.sync.model', string='Model', ondelete='restrict') <NEW_LINE> field_id = fields.Many2one(comodel_name='ir.model.fiel... | Fields Models to sync | 62598eed26068e7796d4b0e5 |
class Source(File): <NEW_LINE> <INDENT> COLOR = 'YELLOW' <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.output_extension = kwargs.pop('output_extension', None) <NEW_LINE> super(Source, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> @property <NEW_LINE> def destination(self): <NEW_LINE> <I... | Node for content that is being converted (e.g., Markdown files). | 62598eedbe383301e0251f61 |
class im(Function): <NEW_LINE> <INDENT> is_real = True <NEW_LINE> unbranched = True <NEW_LINE> @classmethod <NEW_LINE> def eval(cls, arg): <NEW_LINE> <INDENT> if arg is S.NaN: <NEW_LINE> <INDENT> return S.NaN <NEW_LINE> <DEDENT> elif arg.is_real: <NEW_LINE> <INDENT> return S.Zero <NEW_LINE> <DEDENT> elif arg.is_imagina... | Returns imaginary part of expression. This function performs only
elementary analysis and so it will fail to decompose properly more
complicated expressions. If completely simplified result is needed then
use Basic.as_real_imag() or perform complex expansion on instance of
this function.
Examples
========
>>> from sy... | 62598eedfff4ab517ebcbf60 |
@registered <NEW_LINE> class CTRLTable(Table): <NEW_LINE> <INDENT> pass | Table
| 62598eed4a966d76dd5ed664 |
class ImportFileError(RbdBaseException): <NEW_LINE> <INDENT> pass | Raised when import_file function call fails | 62598eed67a9b606de544757 |
class TestTransformAttrs(object): <NEW_LINE> <INDENT> def test_normal(self): <NEW_LINE> <INDENT> C = make_tc() <NEW_LINE> _transform_attrs(C, None) <NEW_LINE> assert ["z", "y", "x"] == [a.name for a in C.__attrs_attrs__] <NEW_LINE> <DEDENT> def test_empty(self): <NEW_LINE> <INDENT> @attributes <NEW_LINE> class C(object... | Tests for `_transform_attrs`. | 62598eed3539df3088ecaa3b |
class _PoolWrapper: <NEW_LINE> <INDENT> def __init__(self, context, pool): <NEW_LINE> <INDENT> self._context = context <NEW_LINE> self._pool = pool <NEW_LINE> <DEDENT> def apply(self, func, args=None, kwds=None): <NEW_LINE> <INDENT> args = args or () <NEW_LINE> kwds = kwds or {} <NEW_LINE> if func is not None: <NEW_LIN... | Wrapper for multiprocessing Pool that wraps function. | 62598eed23849d37ff84f841 |
class CachingObjectStore(ObjectStore): <NEW_LINE> <INDENT> def __init__(self, path, backend): <NEW_LINE> <INDENT> super(CachingObjectStore, self).__init__(self, path, backend) | Object store that uses a directory for caching files, but defers and writes
back to another object store. | 62598eede1aae11d1e7cdc04 |
class Snipper: <NEW_LINE> <INDENT> def __init__( self, wf_to_chks: Chunker = DFLT_CHUNKER, chk_to_fv: Featurizer = DFLT_FEATURIZER, fv_to_snip: Quantizer = DFLT_QUANTIZER, ): <NEW_LINE> <INDENT> self.wf_to_chks = wf_to_chks <NEW_LINE> self.chk_to_fv = chk_to_fv <NEW_LINE> self.fv_to_snip = fv_to_snip <NEW_LINE> <DEDENT... | A base class that implements the wf->chk->fv->snip pipeline.
Default functions for wf_to_chk (a.k.a. chunker), chk_to_fv (a.k.a. featurizer) and fv_to_snip (a.k.a. nipper)
are given, but usually the user should specify these, and usually these are learned from data. | 62598eed7d847024c075ab57 |
class Quicksilver(Bitcoin): <NEW_LINE> <INDENT> name = 'quicksilver' <NEW_LINE> symbols = ('QSLV', ) <NEW_LINE> nodes = ("104.207.149.190", "45.32.246.198", "45.63.12.231") <NEW_LINE> port = 21333 <NEW_LINE> message_start = b'\xa1\xa0\xa2\xa3' <NEW_LINE> base58_prefixes = { 'PUBKEY_ADDR': 58, 'SCRIPT_ADDR': 28, 'SECRET... | Class with all the necessary Quicksilver network information based on
https://github.com/Quicksilvercoin/quicksilver/blob/master/src/net.cpp
(date of access: 02/17/2018) | 62598eeda219f33f346c4fc5 |
class ScaledValuation_generic(DiscreteValuation): <NEW_LINE> <INDENT> def __init__(self, parent, base_valuation, s): <NEW_LINE> <INDENT> DiscreteValuation.__init__(self, parent) <NEW_LINE> self._base_valuation = base_valuation <NEW_LINE> self._scale = s <NEW_LINE> <DEDENT> def _repr_(self): <NEW_LINE> <INDENT> return "... | A valuation which scales another ``base_valuation`` by a finite positive factor ``s``.
EXAMPLES::
sage: v = 3*ZZ.valuation(3); v
3 * 3-adic valuation
TESTS::
sage: TestSuite(v).run() # long time | 62598eedd6c5a102081e08bb |
class ControllerApi(object): <NEW_LINE> <INDENT> notify_widget = None <NEW_LINE> lyric_widget = None <NEW_LINE> desktop_mini = None <NEW_LINE> current_playlist_widget = None <NEW_LINE> player = None <NEW_LINE> network_manager = None <NEW_LINE> api = None <NEW_LINE> state = {"is_login": False, "current_mid": 0, "current... | 暴露给plugin或者其他外部模块的接口和数据 | 62598eedff9c53063f518dee |
class Enemy(pygame.sprite.Sprite): <NEW_LINE> <INDENT> def __init__(self, pos): <NEW_LINE> <INDENT> pygame.sprite.Sprite.__init__(self) <NEW_LINE> self.image = pygame.image.load(os.path.join(ASSETS_DIR, "gfx/enemy.png")) <NEW_LINE> self.image = pygame.transform.scale(self.image, (32, 32)) <NEW_LINE> self.rect = pygame.... | Class Enemy
:returns any enemy | 62598eedbaa26c4b54d4da57 |
class BookInstance(models.Model): <NEW_LINE> <INDENT> id = models.UUIDField(primary_key=True, default=uuid.uuid4, help_text="Unique ID for this particular book across whole library.") <NEW_LINE> book = models.ForeignKey(Book, on_delete=models.SET_NULL, null=True) <NEW_LINE> imprint = models.CharField(max_length=200) <N... | Mode representing a specific copy of a book (i.e. that can be borrowed from the library). | 62598eed99fddb7c1ca621c9 |
class Firewall (object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> log.debug("Firewall initialized.") <NEW_LINE> <DEDENT> def _handle_ConnectionIn (self, event, flow, packet): <NEW_LINE> <INDENT> log.debug("Allowed connection [" + str(flow.src) + ":" + str(flow.srcport) + "," + str(flow.dst) + ":" + s... | Firewall class.
Extend this to implement some firewall functionality.
Don't change the name or anything -- the eecore component
expects it to be firewall.Firewall. | 62598eedfff4ab517ebcbf61 |
class ImagesExport(TaskExport): <NEW_LINE> <INDENT> pallet = None <NEW_LINE> mask_label = '_mask' <NEW_LINE> blend_label = '_blend' <NEW_LINE> image_suffix = '.png' <NEW_LINE> def handle_model(self, data_model): <NEW_LINE> <INDENT> self.dump(data_model) <NEW_LINE> self.draw(data_model) <NEW_LINE> <DEDENT> def d... | Downloads source files meanwhile draws mask and blended pictures | 62598eed851cf427c66b6a54 |
class DateValidator(PatternValidator): <NEW_LINE> <INDENT> pattern = re.compile(r'^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$') <NEW_LINE> messages = {'format':'MM/DD/YYYY'} <NEW_LINE> __slots__ = () | Validates that a date matches the standard MM/DD/YYYY format. | 62598eedf7d966606f74677c |
class TestXRotorConcurrently(unittest.TestCase): <NEW_LINE> <INDENT> def test_concurrently(self): <NEW_LINE> <INDENT> test_xrotor = TestXRotor() <NEW_LINE> ps = [multiprocessing.Process(target=test_xrotor.test_solve_for_thrust), multiprocessing.Process(target=test_xrotor.test_solve_for_torque), multiprocessing.Process(... | Test whether the tests can be run properly in parallel. | 62598eeda79ad161977687a9 |
class JieBaTokenizer(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.tokenizer = jieba <NEW_LINE> <DEDENT> def word_tokenizer(self, doc): <NEW_LINE> <INDENT> tokens = self.tokenizer.cut(doc) <NEW_LINE> tokens = '<split>'.join(tokens).split('<split>') <NEW_LINE> start = 0 <NEW_LINE> token_spans... | only for chinese tokenize,no pos/ner feature function | 62598eed7047854f4633db5e |
class cross(object): <NEW_LINE> <INDENT> min = lambda *args : crossoperator(min,*args) <NEW_LINE> max = lambda *args : crossoperator(max,*args) <NEW_LINE> def __init__(self, elem): <NEW_LINE> <INDENT> self.elem = asarray(elem) <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return iter(self.elem) <NEW_LINE>... | Cross section wrapper class | 62598eed66673b3332c2eb33 |
class ThresholdUpdateForm(forms.Form): <NEW_LINE> <INDENT> threshold_type = forms.CharField(widget=forms.HiddenInput) <NEW_LINE> threshold_name = forms.CharField(max_length=50, required=True) <NEW_LINE> warning_value = forms.IntegerField(required=True) <NEW_LINE> critical_value = forms.IntegerField(required=True) <NEW_... | Update form for update.html | 62598eedcc0a2c111447978f |
class SDBNSatMLE(ParamMLE): <NEW_LINE> <INDENT> def update(self, search_session, rank): <NEW_LINE> <INDENT> if search_session.web_results[rank].click: <NEW_LINE> <INDENT> if rank == search_session.get_last_click_rank(): <NEW_LINE> <INDENT> self._numerator += 1 <NEW_LINE> <DEDENT> self._denominator += 1 | The satisfactoriness parameter of the DBN model.
The value of the parameter is inferred using the MLE algorithm. | 62598eed7c178a314d78bc1f |
class RequiredIfNot(Optional): <NEW_LINE> <INDENT> field_flags = ('requiredifnot',) <NEW_LINE> def __init__(self, other_field_name, message=None, *args, **kwargs): <NEW_LINE> <INDENT> super(RequiredIfNot, self).__init__(*args, **kwargs) <NEW_LINE> self.other_field_name = other_field_name <NEW_LINE> self.message = messa... | Validator which makes a field required if another field is set and has a falsey value.
Sources:
- http://wtforms.simplecodes.com/docs/1.0.1/validators.html
- http://stackoverflow.com/questions/8463209/how-to-make-a-field-conditionally-optional-in-wtforms | 62598eed56ac1b37e6300976 |
class TensorflowPrinter(LambdaPrinter): <NEW_LINE> <INDENT> def _print_And(self, expr): <NEW_LINE> <INDENT> return '{0}({1})'.format('logical_and', ','.join(self._print(i) for i in expr.args)) <NEW_LINE> <DEDENT> def _print_Or(self, expr): <NEW_LINE> <INDENT> return '{0}({1})'.format('logical_or', ','.join(self._print(... | Tensorflow printer which handles vectorized piecewise functions,
logical operators, etc. | 62598eeda8370b77170eeb6f |
class Log_History(Plugin): <NEW_LINE> <INDENT> icon_chr = chr(0xEC10) <NEW_LINE> icon_font = "pupil_icons" <NEW_LINE> def __init__(self, g_pool): <NEW_LINE> <INDENT> super().__init__(g_pool) <NEW_LINE> self.menu = None <NEW_LINE> self.num_messages = 50 <NEW_LINE> self.formatter = logging.Formatter( "%(processName)s - [... | Simple logging GUI that displays the last N messages from the logger | 62598eed4a966d76dd5ed665 |
class IdClip(object): <NEW_LINE> <INDENT> def __init__(self, nodeName, clipName, clipIndex, coord): <NEW_LINE> <INDENT> super(IdClip, self).__init__() <NEW_LINE> self._id = nodeName + clipName <NEW_LINE> self._nodeName = nodeName <NEW_LINE> self._clipName = clipName <NEW_LINE> self._clipIndex = clipIndex <NEW_LINE> sel... | Class usefull to identify a clip with :
- _id : the clipId
- _nodeName : the node name
- _clipName : the clipName
- _clipNumber : the clip number
- _coord : the clip's coords | 62598eed4a966d76dd5ed666 |
class TestBase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.numbers = range(5) <NEW_LINE> self.benchmark = [0, 6, 12, 18, 24] <NEW_LINE> self.sqbenchmark = [0, 1, 4, 9, 16] <NEW_LINE> <DEDENT> def test_map_easy_1job(self): <NEW_LINE> <INDENT> result = parallel_easy.map_easy(abfunc, ... | Tests the parallel_easy module. | 62598eedf9cc0f698b1c4694 |
class LogFormatterSciNotation(LogFormatterMathtext): <NEW_LINE> <INDENT> def _non_decade_format(self, sign_string, base, fx, usetex): <NEW_LINE> <INDENT> b = float(base) <NEW_LINE> exponent = math.floor(fx) <NEW_LINE> coeff = b ** fx / b ** exponent <NEW_LINE> if is_close_to_int(coeff): <NEW_LINE> <INDENT> coeff = roun... | Format values following scientific notation in a logarithmic axis. | 62598eed71ff763f4b5e5ee8 |
class HandleRequestStateChain(AbstractChain): <NEW_LINE> <INDENT> def handle_request(self, request_name, pk): <NEW_LINE> <INDENT> if request_name=='CANCEL': <NEW_LINE> <INDENT> CancelTemplateState(pk=pk).handle_state() <NEW_LINE> <DEDENT> elif request_name=='UPDATE': <NEW_LINE> <INDENT> UpdateChain().handle_request(pk=... | Chain of responsability for Cancel and Update State | 62598eed44b2445a339b5d30 |
class ExtendedPaddle(Paddle): <NEW_LINE> <INDENT> def __init__(self, cpos): <NEW_LINE> <INDENT> super().__init__(cpos) <NEW_LINE> self._width = 100 | class for extended paddle that inherits from Paddle | 62598eed8a43f66fc4bf08ff |
class ESStatsTest(StatsTest, amo.tests.ESTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(ESStatsTest, self).setUp() <NEW_LINE> self.empty_index('stats') <NEW_LINE> self.index() <NEW_LINE> <DEDENT> def index(self): <NEW_LINE> <INDENT> updates = UpdateCount.objects.values_list('id', flat=True) <... | Test class with some ES setup. | 62598eedd268445f26638f54 |
class SenderAction: <NEW_LINE> <INDENT> def __init__(self, action): <NEW_LINE> <INDENT> self.action = action <NEW_LINE> <DEDENT> def to_json(self): <NEW_LINE> <INDENT> return {'sender_action': self.action} | "
Return a sender action:
mark_seen, typing_on , typing_off | 62598eed63b5f9789fe838e9 |
class Iris(BuildOnInit): <NEW_LINE> <INDENT> def build_meta(self): <NEW_LINE> <INDENT> module_path = os.path.dirname(__file__) <NEW_LINE> data_file = csv.reader(open(os.path.join( module_path, 'data', 'iris.csv'))) <NEW_LINE> fdescr = open(os.path.join(module_path, 'descr', 'iris.rst')) <NEW_LINE> temp = data_file.next... | Dataset of flower properties (classification)
self.meta has elements with following structure:
meta[i] = dict
sepal_length: float
sepal_width: float
petal_length: float
petal_width: float
name: one of 'setosa', 'versicolor', 'virginica' | 62598eed5fdd1c0f98e5c72c |
class TestUpdateSwitchMachine(BaseTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestUpdateSwitchMachine, self).setUp() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> super(TestUpdateSwitchMachine, self).tearDown() <NEW_LINE> <DEDENT> def test_update_switch_machine(self): <NEW_LINE> ... | Test update switch machine. | 62598eed4f6381625f198881 |
class CornerTStub(RawTStub): <NEW_LINE> <INDENT> def __init__(self, t, fyd, bolt, e, m1, m2, rp): <NEW_LINE> <INDENT> self.type = "Corner T-Stub" <NEW_LINE> self.thickness = t <NEW_LINE> self.fyd = fyd <NEW_LINE> self.bolt = bolt <NEW_LINE> self.e = e <NEW_LINE> self.m1 = m1 <NEW_LINE> self.m2 = m2 <NEW_LINE> self.m = ... | This is a one bolt tstub. Having 2 sides with
plate to resist forces | 62598eed3346ee7daa336a2d |
class Ticker(PlotObject): <NEW_LINE> <INDENT> num_minor_ticks = Int(5) | Base class for all ticker types. | 62598eed2ae34c7f260a9873 |
class TracingConfig(object): <NEW_LINE> <INDENT> def __init__(self, tracing_options, tracing_category_filter): <NEW_LINE> <INDENT> self._tracing_options = tracing_options <NEW_LINE> self._tracing_category_filter = tracing_category_filter <NEW_LINE> <DEDENT> @property <NEW_LINE> def tracing_options(self): <NEW_LINE> <IN... | Tracing config is the configuration for Chrome tracing.
This produces the trace config JSON string for Chrome tracing. For the details
about the JSON string format, see base/trace_event/trace_config.h. | 62598eeda79ad161977687ab |
class VectorVelocityDataParticleKey(BaseEnum): <NEW_LINE> <INDENT> ANALOG_INPUT2 = "analog_input2" <NEW_LINE> COUNT = "ensemble_counter" <NEW_LINE> PRESSURE = "seawater_pressure" <NEW_LINE> ANALOG_INPUT1 = "analog_input1" <NEW_LINE> VELOCITY_BEAM1 = "turbulent_velocity_east" <NEW_LINE> VELOCITY_BEAM2 = "turbulent_veloc... | Velocity Data Paticles | 62598eed091ae356687033a4 |
class FemWorkbench (Workbench): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/Fem/Resources/icons/FemWorkbench.svg" <NEW_LINE> self.__class__.MenuText = "FEM" <NEW_LINE> self.__class__.ToolTip = "FEM workbench" <NEW_LINE> <DEDENT> def Initialize(self):... | Fem workbench object | 62598eed99cbb53fe682f639 |
class PaddingMixin(configurable.Configurable): <NEW_LINE> <INDENT> defaults = [ ("padding", 3, "Padding inside the box"), ("padding_x", None, "X Padding. Overrides 'padding' if set"), ("padding_y", None, "Y Padding. Overrides 'padding' if set"), ] <NEW_LINE> padding_x = configurable.ExtraFallback("padding_x", "padding"... | Mixin that provides padding(_x|_y|)
To use it, subclass and add this to __init__:
self.add_defaults(base.PaddingMixin.defaults) | 62598eed66673b3332c2eb35 |
class TagNamespace(BaseContent): <NEW_LINE> <INDENT> security = ClassSecurityInfo() <NEW_LINE> __implements__ = (getattr(BaseContent,'__implements__',()),) <NEW_LINE> archetype_name = 'Tag Vocabulary' <NEW_LINE> meta_type = 'TagNamespace' <NEW_LINE> portal_type = 'TagNamespace' <NEW_LINE> allowed_content_types = [] <NE... | TagNamespace content type | 62598eed1f037a2d8b9e2895 |
class WebDriver(SaunterWebDriver): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(WebDriver, self).__init__(**kwargs) <NEW_LINE> <DEDENT> def find_elements_by_locator(self, locator): <NEW_LINE> <INDENT> locator_type = locator[:locator.find("=")] <NEW_LINE> if locator_type == "": <NEW_LINE> ... | Modifications to the core WebDriver API are done in this class | 62598eed3317a56b869bd92c |
class OcTree(OcNode): <NEW_LINE> <INDENT> def __init__(self, max_capacity, max_depth, position, size, impl): <NEW_LINE> <INDENT> super(OcTree, self).__init__(self, None, position, size, 0) <NEW_LINE> self.impl = impl <NEW_LINE> self.max_capacity = int(max_capacity) <NEW_LINE> self.max_depth = int(max_depth) <NEW_LINE> ... | Represents the full Octree. Note that elements that are large
enough to fully contain the root node can not be added to it. | 62598eed2eb69b55b15a0751 |
class TestCocoNuts(unittest.TestCase): <NEW_LINE> <INDENT> def test_weight(self): <NEW_LINE> <INDENT> basket = Inventory() <NEW_LINE> drsim = SouthAsian() <NEW_LINE> hadji = MiddleEastern() <NEW_LINE> jonny = American() <NEW_LINE> for n in range(2): basket.add_coconut(drsim) <NEW_LINE> for n in range(1): basket.add_coc... | Tests add_coconut(), total_weight() methods and tests that weights
for each coconut type are different | 62598eeda8370b77170eeb72 |
class IPv4(object): <NEW_LINE> <INDENT> _ip = None <NEW_LINE> _ip_tuple = None <NEW_LINE> _ip_string = None <NEW_LINE> def __init__(self, address): <NEW_LINE> <INDENT> if isinstance(address, IntegerTypes): <NEW_LINE> <INDENT> if not 0 <= address <= 4294967295: <NEW_LINE> <INDENT> raise ValueError("'%(ip)i' is not a val... | Evaluates and encodes an IPv4 for use as part of a DHCP packet. | 62598eed2ae34c7f260a9874 |
class TreeQuerySet(MP_NodeQuerySet): <NEW_LINE> <INDENT> def descendant_of_q(self, other, inclusive=False): <NEW_LINE> <INDENT> q = Q(path__startswith=other.path) & Q(depth__gte=other.depth) <NEW_LINE> if not inclusive: <NEW_LINE> <INDENT> q &= ~Q(pk=other.pk) <NEW_LINE> <DEDENT> return q <NEW_LINE> <DEDENT> def descen... | Extends Treebeard's MP_NodeQuerySet with additional useful tree-related operations. | 62598eed30bbd722464683c2 |
class IngressList(_kuber_definitions.Collection): <NEW_LINE> <INDENT> def __init__( self, items: typing.List["Ingress"] = None, metadata: "ListMeta" = None, ): <NEW_LINE> <INDENT> super(IngressList, self).__init__( api_version="networking/v1", kind="IngressList" ) <NEW_LINE> self._properties = { "items": items if items... | IngressList is a collection of Ingress. | 62598eed56b00c62f0fb1060 |
class Mete: <NEW_LINE> <INDENT> title = _('Weather') <NEW_LINE> config = { 'location_id':'1832', 'display_to_user':True, 'providers':['apps.weather.providers.BBCWeatherProvider', ] } | 定义此应用程序的附加信息,诸如应用程序名 | 62598eedd7e4931a7ef3a82d |
class AsyncPipe(PyPipe): <NEW_LINE> <INDENT> def __init__(self, name=None, context=None, **kwargs): <NEW_LINE> <INDENT> super(AsyncPipe, self).__init__(name, context) <NEW_LINE> self.pipe_input = kwargs.pop('input', asyncPipeForever()) <NEW_LINE> self.pipeline = getattr(self.module, 'asyncPipe%s' % self.name.title()) <... | An asynchronous PyPipe object | 62598eedd486a94d0ba2a75a |
class BoxLeastSquaresResults(TimeseriesBoxLeastSquaresResults): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> warnings.warn('Importing BoxLeastSquaresResults from astropy.stats has been ' 'deprecated and will no longer be supported in future. ' 'Please import this class from the astropy.t... | The results of a BoxLeastSquares search.
This class has been deprecated and will be removed in a future version.
Use `astropy.timeseries.BoxLeastSquaresResults` instead. | 62598eed6e29344779afedc4 |
class FilterRejectFailed(object): <NEW_LINE> <INDENT> def validator(self): <NEW_LINE> <INDENT> from flexget import validator <NEW_LINE> root = validator.factory() <NEW_LINE> root.accept('integer') <NEW_LINE> root.accept('boolean') <NEW_LINE> return root <NEW_LINE> <DEDENT> @priority(255) <NEW_LINE> def on_feed_filter(s... | Rejects entries that have failed X or more times in the past. | 62598eed63d6d428bbee0f5b |
class DataTypeFilter(GlobalConfigurable): <NEW_LINE> <INDENT> display_data_priority = ['html', 'pdf', 'svg', 'latex', 'png', 'jpg', 'jpeg' , 'text'] <NEW_LINE> def __call__(self, output): <NEW_LINE> <INDENT> for fmt in self.display_data_priority: <NEW_LINE> <INDENT> if fmt in output: <NEW_LINE> <INDENT> return [fmt] <N... | Returns the preferred display format | 62598eeee5267d203ee6a095 |
class IndexView(view.View): <NEW_LINE> <INDENT> def get_content(self): <NEW_LINE> <INDENT> return '500 Server error. There was an internal error in the application.' | View to render a 500 error | 62598eee090684286d592aa9 |
class Input03(PiFacePin): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> PiFacePin.__init__(self) <NEW_LINE> <DEDENT> value = 1008 <NEW_LINE> name = "Input 4 (SWITCH 4)" | Input pin 4 (switch 4). | 62598eee4f88993c371ef8af |
class Spec(Bitcoin): <NEW_LINE> <INDENT> name = 'spec' <NEW_LINE> symbols = ('SPEC', ) <NEW_LINE> seeds = ('node.speccoin.com', 'node2.speccoin.com') <NEW_LINE> port = 4319 <NEW_LINE> message_start = b'\xc3\xd2\xd1\xbd' <NEW_LINE> base58_prefixes = { 'PUBKEY_ADDR': 10, 'SCRIPT_ADDR': 5, 'SECRET_KEY': 138 } | Class with all the necessary SPEC (SPEC) network information based on
https://github.com/SpecDevelopment/spec-wallet/blob/master/src/net.cpp
(date of access: 02/19/2018) | 62598eee2ae34c7f260a9875 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.