code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class DistributedReadWriteLock(readWriteLock.ReadWriteLock): <NEW_LINE> <INDENT> def __init__(self, distributed_lock): <NEW_LINE> <INDENT> readWriteLock.ReadWriteLock.__init__(self) <NEW_LINE> self.distributed_lock = distributed_lock <NEW_LINE> self.global_lock = threading.Lock() <NEW_LINE> <DEDENT> def write_acquire(s... | Distributed version of ReadWriteLock. | 625990517d847024c075d894 |
class ProductListView(generics.ListAPIView): <NEW_LINE> <INDENT> renderer_classes = (CMSPageRenderer, JSONRenderer, BrowsableAPIRenderer) <NEW_LINE> product_model = ProductModel <NEW_LINE> serializer_class = app_settings.PRODUCT_SUMMARY_SERIALIZER <NEW_LINE> limit_choices_to = models.Q() <NEW_LINE> filter_class = None ... | This view is used to list all products which shall be visible below a certain URL.
Usage: Add it to the urlpatterns responsible for rendering the catalog's views. The
file containing this patterns can be referenced by the CMS apphook used by the CMS pages
responsible for rendering the catalog's list view.
```
urlpatte... | 62599051d99f1b3c44d06b5a |
class InputRequest(metaclass=ABCMeta): <NEW_LINE> <INDENT> def __init__(self, source, requester_source=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._source = source <NEW_LINE> self._requester_source = requester_source <NEW_LINE> self.thread = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def source(sel... | Base input request class.
This should be overloaded for every InputHandler class. Purpose of this class is to print
prompt and get input from user.
The `run_input` method is the entry point for this class. Output from this method must be
a user input.
The `text_prompt` method is used to get textual representation of ... | 6259905129b78933be26ab22 |
class Oden(Linter): <NEW_LINE> <INDENT> syntax = ('oden') <NEW_LINE> cmd = ('oden', 'lint') <NEW_LINE> version_args = '--version' <NEW_LINE> version_re = r'(?P<version>\d+\.\d+\.\d+)' <NEW_LINE> version_requirement = '>= 0.3.0' <NEW_LINE> regex = r'[^:]*:(?P<line>\d+):(?P<col>\d+):\s*(?P<error>error:)?\s+(?P<message>.*... | Provides an interface to oden. | 62599051462c4b4f79dbcebf |
class FRAM: <NEW_LINE> <INDENT> def __init__(self, max_size, write_protect=False, wp_pin=None): <NEW_LINE> <INDENT> self._max_size = max_size <NEW_LINE> self._wp = write_protect <NEW_LINE> self._wraparound = False <NEW_LINE> if not wp_pin is None: <NEW_LINE> <INDENT> self._wp_pin = wp_pin <NEW_LINE> self._wp_pin.switch... | Driver base for the FRAM Breakout. | 6259905123849d37ff85257e |
class Color(object): <NEW_LINE> <INDENT> def __init__(self, *args): <NEW_LINE> <INDENT> self.__alpha = colorAttribute(255) <NEW_LINE> self.__red = colorAttribute(255) <NEW_LINE> self.__green = colorAttribute(255) <NEW_LINE> self.__blue = colorAttribute(255) <NEW_LINE> self.__setup(*args) <NEW_LINE> logging.debug('Color... | Represents a color as a complete attribute with alpha, red, green and blue.
Color attribute can be expressed as an 8 byte value in the format of aabbggrr:
aa = Alpha
bb = Blue
gg = Green
rr = Red
Syntax:
x = Color('FF0000FF') # gives RED
x = Color(255, 0, 0, 255') # ... | 6259905191af0d3eaad3b2e4 |
@attr.s(auto_attribs=True, init=False) <NEW_LINE> class CredentialsGoogle(model.Model): <NEW_LINE> <INDENT> can: Optional[MutableMapping[str, bool]] = None <NEW_LINE> created_at: Optional[str] = None <NEW_LINE> domain: Optional[str] = None <NEW_LINE> email: Optional[str] = None <NEW_LINE> google_user_id: Optional[str] ... | Attributes:
can: Operations the current user is able to perform on this object
created_at: Timestamp for the creation of this credential
domain: Google domain
email: EMail address
google_user_id: Google's Unique ID for this user
is_disabled: Has this credential been disabled?
logged_in_at: T... | 62599051e5267d203ee6cdaa |
class ToolPaletteManager ( ActionManager ): <NEW_LINE> <INDENT> image_size = Tuple( ( 16, 16 ) ) <NEW_LINE> show_tool_names = Bool( True ) <NEW_LINE> _image_cache = Instance( ImageCache ) <NEW_LINE> def __init__ ( self, *args, **facets ): <NEW_LINE> <INDENT> super( ToolPaletteManager, self ).__init__( *args, **facets )... | A tool bar manager realizes itself in a tool palette bar control.
| 6259905182261d6c52730927 |
class Friend(models.Model): <NEW_LINE> <INDENT> to_user = models.ForeignKey(AUTH_USER_MODEL, related_name='friends') <NEW_LINE> from_user = models.ForeignKey(AUTH_USER_MODEL, related_name='_unused_friend_relation') <NEW_LINE> created = models.DateTimeField(default=datetime.datetime.now()) <NEW_LINE> notify = models.Int... | Model to represent Friendships | 6259905163b5f9789fe8662e |
class PathOverflow(Exception): <NEW_LINE> <INDENT> pass | Raised when trying to add or move a node to a position where no more nodes
can be added (see :attr:`~treebeard.MP_Node.path` and
:attr:`~treebeard.MP_Node.alphabet` for more info) | 62599051cb5e8a47e493cbe6 |
class MusicaMP3(object): <NEW_LINE> <INDENT> def __init__(self, nome='', autor='', ano=0, estrelas=0): <NEW_LINE> <INDENT> self.nome = nome <NEW_LINE> self.autor = autor <NEW_LINE> self.ano = ano <NEW_LINE> self.estrelas = estrelas | Música MP3 | 6259905130c21e258be99cc6 |
class LinkOutBamStepPart(BaseStepPart): <NEW_LINE> <INDENT> name = "link_out_bam" <NEW_LINE> def __init__(self, parent): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> self.base_path_in = ( "work/{wildcards.mapper}.{wildcards.library_name}/out/" "{wildcards.mapper}.{wildcards.library_name}{{postproc}}{{ext}}" ... | Link out the read mapping results
Depending on the configuration, the files are linked out after
postprocessing | 625990513c8af77a43b6899e |
class TestSalesEndpoints(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.app = create_app(config_name="testing") <NEW_LINE> self.client = self.app.test_client <NEW_LINE> self.product_item = {"name": "Table", "description": "The product description here", "quantity": 12, "category": "Fu... | class to test the sales endpoints | 62599051e76e3b2f99fd9eba |
class Profile(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(User, verbose_name=_("User"), on_delete=models.CASCADE) <NEW_LINE> picture = models.ImageField(_("Picture"), upload_to=upload_location, default="avatar.jpeg", height_field=None, width_field=None, max_length=None, blank=True, null=True ) <NEW_L... | Model definition for Profile. | 62599051b830903b9686eedb |
class Node(object): <NEW_LINE> <INDENT> def __init__(self, value=None, depth=None): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self.depth = depth | Base node to be inherited. | 625990514e4d5625663738cb |
class Rent(): <NEW_LINE> <INDENT> def __init__(self, idc, idf): <NEW_LINE> <INDENT> self.__idc = idc <NEW_LINE> self.__idf = idf <NEW_LINE> self.__isRented = True <NEW_LINE> <DEDENT> def getIDC(self): <NEW_LINE> <INDENT> return self.__idc <NEW_LINE> <DEDENT> def getIDF(self): <NEW_LINE> <INDENT> return self.__idf <NEW_... | Store a rent
A rent consists of a client id and a film id
The film with the ID is rented to the client with the ID | 62599051d486a94d0ba2d485 |
class upgrade_result(object): <NEW_LINE> <INDENT> def __init__(self, success=None, err=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> self.err = err <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) ... | Attributes:
- success
- err | 62599051379a373c97d9a4e7 |
class GameStats: <NEW_LINE> <INDENT> def __init__(self, sets): <NEW_LINE> <INDENT> self.sets = sets <NEW_LINE> self.reset_stats() <NEW_LINE> self.game_active = True <NEW_LINE> <DEDENT> def reset_stats(self): <NEW_LINE> <INDENT> self.bird_left = self.sets.bird_limit | 跟踪游戏统计信息 | 6259905116aa5153ce4019af |
class TrackerEvent(object): <NEW_LINE> <INDENT> def __init__(self, frame, frames_per_second, supply=None, clock_position=None): <NEW_LINE> <INDENT> self.frame = frame <NEW_LINE> self.supply = supply <NEW_LINE> self.clock_position = clock_position <NEW_LINE> self.frames_per_second = frames_per_second <NEW_LINE> <DEDENT>... | not necesarily a trackerevent, but event was too generic | 625990518e7ae83300eea554 |
class TestItem(): <NEW_LINE> <INDENT> def __init__(self, test_function): <NEW_LINE> <INDENT> self._test_data = self.parse_data(test_function) <NEW_LINE> self.done = False <NEW_LINE> <DEDENT> def finish(self, test_report): <NEW_LINE> <INDENT> self._test_data["duration"] = test_report.duration <NEW_LINE> self._test_data[... | Holds data about one test item. | 625990517b25080760ed873e |
class ObjectsToLayer(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "blayers.objects_to_layer" <NEW_LINE> bl_label = "Objects To Layer" <NEW_LINE> layer_index = bpy.props.IntProperty() <NEW_LINE> @classmethod <NEW_LINE> def poll(self,context) : <NEW_LINE> <INDENT> layers_from,BLayers,BLayersSettings,layers,object... | Move objects to layers | 6259905107d97122c4218166 |
class SearchForm(forms.Form): <NEW_LINE> <INDENT> search_item = forms.CharField(label="Search", max_length=256) | Define the search form | 6259905124f1403a9268632e |
class DijkstraTowardsVisitor(DijkstraVisitor): <NEW_LINE> <INDENT> def __init__(self, t :int): <NEW_LINE> <INDENT> self.t = t <NEW_LINE> <DEDENT> def examine_vertex(self, u :int, g :DirectedGraph): <NEW_LINE> <INDENT> if u == self.t: <NEW_LINE> <INDENT> raise DijkstraStopException(self.t) | `DijkstraTowardsVisitor` can be passed to `dijkstra_shortest_paths`
to abort computation once the cost of the shortest path to `t` is
known.
Important notes:
- stopping when discovering t does not guarantee that we have find
the shortest path.
- stopping when discovering a vertex u farther than t from s always
occur a... | 625990518e71fb1e983bcf87 |
class Flaggable(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> abstract = True <NEW_LINE> <DEDENT> flags = generic.GenericRelation('Flag') <NEW_LINE> def flag(self, user, reason=''): <NEW_LINE> <INDENT> if not user.is_authenticated(): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> flag_model = ... | Interface for any model that can be flagged as objectionable or
inappropriate by a user of the system. Generally used for user created
content. | 62599051004d5f362081fa4a |
class SignalEvent(Event): <NEW_LINE> <INDENT> def __init__(self, inst, datetime, signal_type): <NEW_LINE> <INDENT> self.type = 'SIGNAL' <NEW_LINE> self.inst = inst <NEW_LINE> self.datetime = datetime <NEW_LINE> self.signal_type = signal_type | Handles the event of sending a Signal from a Strategy object.
This is received by a Portfolio object and acted upon. | 6259905171ff763f4b5e8c6b |
class Experiment051(object): <NEW_LINE> <INDENT> def __init__(p): <NEW_LINE> <INDENT> p.name = 'e051' <NEW_LINE> p.num_images = None <NEW_LINE> p.train_pct = 80 <NEW_LINE> p.valid_pct = 15 <NEW_LINE> p.test_pct = 5 <NEW_LINE> p.num_submission_images = None <NEW_LINE> p.batch_size = 237 <NEW_LINE> p.epochs = 10000 <NEW_... | comments: same as e037 except:
(1) batch normalization
(2) prelu (recommended not to use with l1/l2 reg but last experiment did)
(3) higher learning rate
(4) shape input comes before dropout
(5) lower patience (given that rotations are regularizing even when training
is not improving this might be a bad idea)
(6) ... | 625990514e696a045264e881 |
class LRRMessage(BaseMessage): <NEW_LINE> <INDENT> event_data_type = None <NEW_LINE> event_data = None <NEW_LINE> partition = -1 <NEW_LINE> event_type = None <NEW_LINE> version = 0 <NEW_LINE> report_code = 0xFF <NEW_LINE> event_prefix = '' <NEW_LINE> event_source = LRR_EVENT_TYPE.UNKNOWN <NEW_LINE> event_status = 0 <NE... | Represent a message from a Long Range Radio or emulated Long Range Radio. | 625990514428ac0f6e6599f6 |
class Package(object): <NEW_LINE> <INDENT> name = '' <NEW_LINE> max_length = 0 <NEW_LINE> max_breadth = 0 <NEW_LINE> max_height = 0 <NEW_LINE> max_weight = 0 <NEW_LINE> cost = 0 <NEW_LINE> def __init__(self, name, length, breadth, height, weight, cost): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.max_length = ... | Represents the requirements of a shipping package | 62599051b830903b9686eedc |
class RAWreader(object): <NEW_LINE> <INDENT> def __init__(self, path, extension): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.extension = extension <NEW_LINE> self.list_files = [f for f in listdir(path) if isfile(join(path, f))] <NEW_LINE> <DEDENT> def check_width(self, image): <NEW_LINE> <INDENT> ini_len = le... | Read raw files from dataset.
Example
-------
>>> array_converted = RAWreader(
>>> "databases/caltech/Faces_easy",".raw.rescale")
>>> imgs = array_converted.get_array_of_images() | 62599051a79ad1619776b51d |
class TypeAxis(SimpleAxis): <NEW_LINE> <INDENT> def get_keys(self, obj): <NEW_LINE> <INDENT> return type(obj).mro() | An axis which matches the class and super classes of an object in
method resolution order. | 62599051d486a94d0ba2d487 |
class NoLocationError(Error): <NEW_LINE> <INDENT> def __init__(self, message=None, address=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.__message = message <NEW_LINE> self.__address = address <NEW_LINE> <DEDENT> @property <NEW_LINE> def message(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return... | Returned when requesting market update without a postcode | 625990510fa83653e46f63a2 |
class QListPrinter: <NEW_LINE> <INDENT> class Iter: <NEW_LINE> <INDENT> def __init__(self, array, begin, end, typ): <NEW_LINE> <INDENT> self.array = array <NEW_LINE> self.end = end <NEW_LINE> self.begin = begin <NEW_LINE> self.offset = 0 <NEW_LINE> if typ.name == 'QStringList': <NEW_LINE> <INDENT> self.el_type = gdb.lo... | Print a Qt5 QList | 6259905194891a1f408ba156 |
class HostPortCreateRequest(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { 'type': 'str', 'port': 'str', 'label': 'str', 'iscsi_chap_secret': 'str' } <NEW_LINE> self.attribute_map = { 'type': 'type', 'port': 'port', 'label': 'label', 'iscsi_chap_secret': 'iscsiChapSecret' } ... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62599051fff4ab517ebcece1 |
class SpawnDeleteFilesJob(CommandMessage): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SpawnDeleteFilesJob, self).__init__('spawn_delete_files_job') <NEW_LINE> self.job_id = None <NEW_LINE> self.trigger_id = None <NEW_LINE> self.source_file_id = None <NEW_LINE> self.purge = False <NEW_LINE> <DEDEN... | Command message that spawns a delete files system job
| 625990518e7ae83300eea556 |
class AddressForm(forms.ModelForm): <NEW_LINE> <INDENT> u <NEW_LINE> zip_code = BRZipCodeField( label=_(u'Zip Code'), help_text=_(u'Enter a zip code in the format XXXXX-XXX.'), max_length=9, required=True ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Address <NEW_LINE> exclude = ['created', 'modified'] | Class of model form Adress | 6259905123e79379d538d9ba |
@args_kwargs <NEW_LINE> @Stream.register_api() <NEW_LINE> class combine_latest(Stream): <NEW_LINE> <INDENT> _graphviz_orientation = 270 <NEW_LINE> _graphviz_shape = "triangle" <NEW_LINE> def __init__(self, *upstreams, **kwargs): <NEW_LINE> <INDENT> emit_on = kwargs.pop("emit_on", None) <NEW_LINE> first = kwargs.pop("fi... | Combine multiple streams together to a stream of tuples
This will emit a new tuple of all of the most recent elements seen from
any stream.
Parameters
----------
emit_on : stream or list of streams or None
only emit upon update of the streams listed.
If None, emit on update from any stream
See Also
--------
... | 6259905199cbb53fe68323a9 |
class CryptoInvalidKeyException(Exception): <NEW_LINE> <INDENT> pass | Exception raised when an invalid key is supplied for encryption or decryption | 625990513eb6a72ae038bb1f |
class DynamicFilter(eventfilter.EventObjectFilter): <NEW_LINE> <INDENT> @property <NEW_LINE> def fields(self): <NEW_LINE> <INDENT> return self._fields <NEW_LINE> <DEDENT> @property <NEW_LINE> def limit(self): <NEW_LINE> <INDENT> return self._limit <NEW_LINE> <DEDENT> @property <NEW_LINE> def separator(self): <NEW_LINE>... | A twist to the EventObjectFilter allowing output fields to be selected.
This filter is essentially the same as the EventObjectFilter except it wraps
it in a selection of which fields should be included by an output module that
has support for selective fields. That is to say the filter:
SELECT field_a, field_b WHER... | 6259905145492302aabfd998 |
class FunctionNotFoundError(SoftboxenError): <NEW_LINE> <INDENT> message = 'Invalid function: %(error)s' | Raise when base function not initialized | 62599051d53ae8145f919921 |
class KaaNode(object): <NEW_LINE> <INDENT> def __init__(self, host, port): <NEW_LINE> <INDENT> self.host = str(host) <NEW_LINE> self.port = str(port) <NEW_LINE> <DEDENT> def download_sdk(self, profile_id, language, kaauser, ofile): <NEW_LINE> <INDENT> url = 'http://{}:{}/kaaAdmin/rest/api/sdk?sdkProfileId={}' '&... | Allows to communicate with Kaa node via REST API | 6259905107f4c71912bb08f9 |
class TestCompareXLSXFiles(ExcelComparisonTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.set_filename('simple01.xlsx') <NEW_LINE> <DEDENT> def test_create_file(self): <NEW_LINE> <INDENT> workbook = Workbook(self.got_filename) <NEW_LINE> worksheet = workbook.add_worksheet() <NEW_LINE> worksheet.wri... | Test file created by XlsxWriter against a file created by Excel. | 62599051e64d504609df9e30 |
class NullPrior(Prior): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def loglikelihood(self, net): <NEW_LINE> <INDENT> return 0.0 | A null prior which returns 0.0 for the loglikelihood.
The name for this object is a bit confusing because the UniformPrior is
often considered the null prior in that it doesn't favor any edge more than
another. It still favors smaller networks and takes time to calculate the
loglikelihood. This class provides an imple... | 62599051097d151d1a2c2536 |
class _NoMessage(object): <NEW_LINE> <INDENT> def __init__(self, message_type): <NEW_LINE> <INDENT> self.message_type = message_type <NEW_LINE> <DEDENT> def message_hook(self, *args, **kwargs): <NEW_LINE> <INDENT> warn( f'Message type "{self.message_type}" not supported for ' f'game "{GAME_NAME}".' ) | Class used to hook non-supported message types. | 62599051a8ecb033258726d7 |
class InvalidActionException(Exception): <NEW_LINE> <INDENT> pass | Raised when an action is impossible to execute | 625990510fa83653e46f63a4 |
class IpynbCasper(Template): <NEW_LINE> <INDENT> aliases = ['ipynbcasper'] | ipynb casper | 62599051498bea3a75a58fe6 |
class TestPlanioIntegration(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testPlanioIntegration(self): <NEW_LINE> <INDENT> pass | PlanioIntegration unit test stubs | 625990510c0af96317c577c2 |
class Investment(Base): <NEW_LINE> <INDENT> __tablename__ = 'interinvest' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> dt = Column(DateTime, default=datetime.utcnow) <NEW_LINE> freq = Column(String(1), default='Q') <NEW_LINE> assets = Column(Float) <NEW_LINE> net_inv_pos = Column(Float) <NEW_LINE> direc... | https://bank.gov.ua/NBUStatService/v1/statdirectory/interinvestpos?date=200301&s181=Total&json | 6259905130dc7b76659a0cdf |
class TestGenPartitionsPair(TestGenPartitionsBase): <NEW_LINE> <INDENT> attrib="quick" <NEW_LINE> def setup(self): <NEW_LINE> <INDENT> self.par = Par(N=4, m_q=1) <NEW_LINE> self.model = SinglePair(self.par) <NEW_LINE> <DEDENT> def test_one(self): <NEW_LINE> <INDENT> assert self._generate_partitions_1() == ... | Test generate_partitions: SinglePair model. | 6259905171ff763f4b5e8c6f |
class CartItem(models.Model): <NEW_LINE> <INDENT> pass <NEW_LINE> m = models.ForeignKey(Product, on_delete=models.SET_NULL, null=True) <NEW_LINE> user_id = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) <NEW_LINE> quantity = models.IntegerField(default=1) <NEW_LINE> order_id = models.ForeignKey('TestCar... | eeew | 62599051462c4b4f79dbcec5 |
class ExpectedImprovementInterface(with_metaclass(ABCMeta, object)): <NEW_LINE> <INDENT> @abstractproperty <NEW_LINE> def dim(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractproperty <NEW_LINE> def num_to_sample(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractproperty <NEW_LINE> def num_being_... | Interface for Expected Improvement computation: EI and its gradient at specified point(s) sampled from a GaussianProcess.
A class to encapsulate the computation of expected improvement and its spatial gradient using points sampled from an
associated GaussianProcess. The general EI computation requires monte-carlo inte... | 6259905145492302aabfd99a |
class BaseTestCase(TestCase): <NEW_LINE> <INDENT> def create_app(self): <NEW_LINE> <INDENT> app.config.from_object('config.TestConfig') <NEW_LINE> return app <NEW_LINE> <DEDENT> def setUp(self): <NEW_LINE> <INDENT> create_db() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> db.session.remove() <NEW_LINE> db... | A base test case. | 6259905107d97122c421816b |
class Result(ffn.GroupStats): <NEW_LINE> <INDENT> def __init__(self, *backtests): <NEW_LINE> <INDENT> tmp = [pd.DataFrame({x.name: x.strategy.prices}) for x in backtests] <NEW_LINE> super(Result, self).__init__(*tmp) <NEW_LINE> self.backtest_list = backtests <NEW_LINE> self.backtests = {x.name: x for x in backtests} <N... | Based on ffn's GroupStats with a few extra helper methods.
Args:
* backtests (list): List of backtests
Attributes:
* backtest_list (list): List of bactests in the same order as provided
* backtests (dict): Dict of backtests by name | 62599051e5267d203ee6cdb0 |
class HTTPServerWithEvents(http_server.HTTPServer): <NEW_LINE> <INDENT> def __init__(self, addr, handler, worker_id): <NEW_LINE> <INDENT> http_server.HTTPServer.__init__(self, addr, handler, False) <NEW_LINE> self.worker_id = worker_id <NEW_LINE> self.events = [] <NEW_LINE> <DEDENT> def append(self, event): <NEW_LINE> ... | HTTP server used by the handler to store events | 625990512ae34c7f260ac5a8 |
class IsOwnerOrReadOnly(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self, request, view, obj): <NEW_LINE> <INDENT> if request.method in permissions.SAFE_METHODS: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return obj.author == request.user | Determine if object belongs to owner, otherwise allow safe methods | 62599051b830903b9686eede |
class Wrapper(BaseWrapper): <NEW_LINE> <INDENT> def wrap(self, entry: PluginEntry): <NEW_LINE> <INDENT> return Environment(entry.plugin, self._get_registry(entry)) | Wraps a plugin into environment | 625990518e71fb1e983bcf8c |
class Preferences(UsersModel, db.Model): <NEW_LINE> <INDENT> __tablename__ = 'preferences' <NEW_LINE> id = db.Column(db.Integer, primary_key=True,autoincrement=True) <NEW_LINE> preferences = db.Column(db.Text, default='') <NEW_LINE> description = db.Column(db.Text, default='') <NEW_LINE> user = db.Column(db.Integer, db... | User preferences, such as columns selection | 6259905145492302aabfd99b |
class RecipeSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> ingredients = serializers.PrimaryKeyRelatedField( many=True, queryset=Ingredient.objects.all() ) <NEW_LINE> tags = serializers.PrimaryKeyRelatedField( many=True, queryset=Tag.objects.all() ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Recip... | Serializer for recipe objects | 62599051dc8b845886d54a85 |
class ISIdNumberField(RegexField): <NEW_LINE> <INDENT> default_error_messages = { 'invalid': ugettext('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'), 'checksum': ugettext(u'The Icelandic identification number is not valid.'), } <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <IN... | Icelandic identification number (kennitala). This is a number every citizen
of Iceland has. | 625990513539df3088ecd768 |
class CategoryViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Category.objects.all() <NEW_LINE> serializer_class = CategorySerializer | API endpoint that allows donations to be viewed and edited. | 62599051d486a94d0ba2d48b |
class LimitsController(Controller): <NEW_LINE> <INDENT> _serialization_metadata = { "application/xml": { "attributes": { "limit": ["verb", "URI", "regex", "value", "unit", "resetTime", "remaining", "name"], }, "plurals": { "rate": "limit", }, }, } <NEW_LINE> def index(self, req): <NEW_LINE> <INDENT> abs_limits = {} <NE... | Controller for accessing limits in the OpenStack API. | 6259905115baa72349463454 |
class SmartClassParameters(ForemanObjects): <NEW_LINE> <INDENT> objName = 'smart_class_parameters' <NEW_LINE> payloadObj = 'smart_class_parameter' <NEW_LINE> itemType = ItemSmartClassParameter <NEW_LINE> index = 'id' | SmartClassParameters class | 62599051009cb60464d02a01 |
class CorpusDocument (dict): <NEW_LINE> <INDENT> def __init__(self, id = None): <NEW_LINE> <INDENT> self._docid = id <NEW_LINE> <DEDENT> def get_id(self): <NEW_LINE> <INDENT> return self._docid <NEW_LINE> <DEDENT> def _set_id(self, id): <NEW_LINE> <INDENT> self._docid = deepcopy(id) | Class for documents apearing in the corpus. | 625990517cff6e4e811b6f04 |
class WaveletPacket2D(Node2D): <NEW_LINE> <INDENT> def __init__(self, data, wavelet, mode='sp1', maxlevel=None): <NEW_LINE> <INDENT> super(WaveletPacket2D, self).__init__(None, data, "") <NEW_LINE> if not isinstance(wavelet, Wavelet): <NEW_LINE> <INDENT> wavelet = Wavelet(wavelet) <NEW_LINE> <DEDENT> self.wavelet = wav... | Data structure representing 2D Wavelet Packet decomposition of signal.
data - original data (signal)
wavelet - wavelet used in DWT decomposition and reconstruction
mode - signal extension mode - see MODES
maxlevel - maximum level of decomposition (will be computed if not
specified) | 62599051d6c5a102081e35df |
class AccessFromEmpty(Exception): <NEW_LINE> <INDENT> pass | Error attempting to access an element from an empty container. | 6259905124f1403a92686331 |
class SplitTimeDeltaWidget(NamedMultiWidget): <NEW_LINE> <INDENT> def __init__(self, attrs=None): <NEW_LINE> <INDENT> widgets = OrderedDict() <NEW_LINE> widgets['unit'] = forms.widgets.Select( attrs={'style': 'width: 8em;'}, choices=TIME_DELTA_UNIT_CHOICES ) <NEW_LINE> widgets['amount'] = forms.widgets.NumberInput( att... | A Widget that splits a timedelta input into two field: one for unit of
time and another for the amount of units. | 6259905130dc7b76659a0ce0 |
class PassageIndex(models.Model): <NEW_LINE> <INDENT> start_verse = VerseField() <NEW_LINE> end_verse = VerseField() <NEW_LINE> task = models.ForeignKey(Task, blank=True, null=True) <NEW_LINE> book = models.ForeignKey(Book, blank=True, null=True) <NEW_LINE> def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance... | Describes a passage index.
This is used to index passages associated with different things for searching. | 6259905107f4c71912bb08fc |
class Selection(Accumulator): <NEW_LINE> <INDENT> def __init__(self, child): <NEW_LINE> <INDENT> self._skipped = 0 <NEW_LINE> self._child = child <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def create(cls, child): <NEW_LINE> <INDENT> return cls(child=child) <NEW_LINE> <DEDENT> def update(self, datum): <NEW_LINE> <INDEN... | Select data based on the "select" tag in each datum.
| 62599051fff4ab517ebcece5 |
class CreateCounterexample(object): <NEW_LINE> <INDENT> def __init__(self, text): <NEW_LINE> <INDENT> self.text = text <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def _from_dict(cls, _dict): <NEW_LINE> <INDENT> args = {} <NEW_LINE> if 'text' in _dict: <NEW_LINE> <INDENT> args['text'] = _dict.get('text') <NEW_LINE> <DED... | CreateCounterexample.
:attr str text: The text of a user input marked as irrelevant input. This string must
conform to the following restrictions:
- It cannot contain carriage return, newline, or tab characters
- It cannot consist of only whitespace characters
- It must be no longer than 1024 characters. | 6259905107d97122c421816d |
class TwitterClient(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> consumer_key = 'XXXXXXXXXXXXXXXXXXXXXXXX' <NEW_LINE> consumer_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX' <NEW_LINE> access_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX' <NEW_LINE> access_token_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXX' <NEW_LINE> ... | Generic Twitter Class for sentiment analysis. | 62599051d53ae8145f919925 |
class ProfileServicer(object): <NEW_LINE> <INDENT> def Insert(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') <NEW_LINE> <DEDENT> def Update(self, reques... | Missing associated documentation comment in .proto file. | 6259905110dbd63aa1c720a7 |
class SaMsgQueueGroupNotificationBufferT(Structure): <NEW_LINE> <INDENT> _fields_ = [('numberOfItems', SaUint32T), ('notification', POINTER(SaMsgQueueGroupNotificationT)), ('queueGroupPolicy', SaMsgQueueGroupPolicyT)] | Contain array of queue group notifications.
| 625990511f037a2d8b9e52cf |
class EmptyTestResultFactory(ITestResultFactory): <NEW_LINE> <INDENT> def __init__(self, result_factory_func=None): <NEW_LINE> <INDENT> self._result_factory_func = result_factory_func <NEW_LINE> <DEDENT> def create(self, testcase): <NEW_LINE> <INDENT> if self._result_factory_func is None: <NEW_LINE> <INDENT> return tes... | 测试结果工厂 | 62599051e5267d203ee6cdb2 |
class BertSquadLogitsLayer(tf.keras.layers.Layer): <NEW_LINE> <INDENT> def __init__(self, initializer=None, float_type=tf.float32, **kwargs): <NEW_LINE> <INDENT> super(BertSquadLogitsLayer, self).__init__(**kwargs) <NEW_LINE> self.initializer = initializer <NEW_LINE> self.float_type = float_type <NEW_LINE> <DEDENT> def... | Returns a layer that computes custom logits for BERT squad model. | 62599051dd821e528d6da3a3 |
class ScreenRecord(AbstractTimestampTrashBinModel): <NEW_LINE> <INDENT> case = models.ForeignKey(Case, related_name='screens', on_delete=models.CASCADE) <NEW_LINE> name = models.CharField("screen name", max_length=40) <NEW_LINE> start_time = models.DateTimeField(default=now) <NEW_LINE> end_time = models.DateTimeField(n... | A record of each screen that was visited during the call,
and the operator's input. | 62599051dc8b845886d54a87 |
class GetConfig(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.conf=configparser.ConfigParser() <NEW_LINE> self.conf.read('./Config.ini', encoding='UTF-8') <NEW_LINE> <DEDENT> @LazyProperty <NEW_LINE> def crawl_isdownload(self): <NEW_LINE> <INDENT> return self.conf.get('crawl','isDownloadFile... | to get config from config.ini | 62599051cb5e8a47e493cbea |
class CmdDumpSimap(gdb.Command): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(CmdDumpSimap, self).__init__("ovs_dump_simap", gdb.COMMAND_DATA) <NEW_LINE> <DEDENT> def invoke(self, arg, from_tty): <NEW_LINE> <INDENT> arg_list = gdb.string_to_argv(arg) <NEW_LINE> if len(arg_list) != 1: <NEW_LINE> <IN... | Dump all key, value entries of a simap
Usage: ovs_dump_simap <struct simap *> | 62599051baa26c4b54d50773 |
class Client(object): <NEW_LINE> <INDENT> def __init__(self, key, trk_host=KISSmetrics.TRACKING_HOSTNAME, trk_scheme=KISSmetrics.TRACKING_SCHEME): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> if trk_scheme not in ('http', 'https'): <NEW_LINE> <INDENT> raise ValueError('trk_scheme must be one of (http, https)') <NEW_LI... | Interface to KISSmetrics tracking service | 6259905107d97122c421816e |
class IndexSet(object): <NEW_LINE> <INDENT> def __init__(self, impl): <NEW_LINE> <INDENT> self._impl = impl <NEW_LINE> <DEDENT> def entity_index(self, entity): <NEW_LINE> <INDENT> return self._impl.entity_index(entity._impl) <NEW_LINE> <DEDENT> def sub_entity_index(self, element, i, codim): <NEW_LINE> <INDENT> if eleme... | Query the index set of a grid view. | 62599051b5575c28eb71372e |
class WhoisBr(WhoisEntry): <NEW_LINE> <INDENT> regex = { 'domain': 'domain:\s*(.+)\n', 'owner': 'owner:\s*([\S ]+)', 'ownerid': 'ownerid:\s*(.+)', 'country': 'country:\s*(.+)', 'owner_c': 'owner-c:\s*(.+)', ... | Whois parser for .br domains
| 625990518e71fb1e983bcf8f |
class OneOf(Validator): <NEW_LINE> <INDENT> def __init__(self, iterable): <NEW_LINE> <INDENT> self.iterable = iterable <NEW_LINE> self.values_text = ', '.join(str(each) for each in self.iterable) <NEW_LINE> <DEDENT> def _repr_args(self): <NEW_LINE> <INDENT> return 'iterable={0!r}'.format(self.iterable) <NEW_LINE> <DEDE... | Validator which if ``value`` is a member of ``iterable``.
:param iterable iterable: A sequence of invalid values. | 62599051287bf620b62730b4 |
class SentiSynsetTools(object): <NEW_LINE> <INDENT> def load_senti_synsets_for_word(self, word): <NEW_LINE> <INDENT> return list(swn.senti_synsets('slow')) <NEW_LINE> <DEDENT> def get_scores_from_senti_synset(self, string_name_of_synset, return_format=tuple): <NEW_LINE> <INDENT> breakdown = swn.senti_synset(string_name... | Tools for loading and working with SentiWordNet stuff | 62599051d53ae8145f919926 |
class ConstrainedLayer(nn.Module): <NEW_LINE> <INDENT> def __init__(self, module, equalized=True, lr_mul=1.0, init_bias_to_zero=True): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.module = module <NEW_LINE> self.equalized = equalized <NEW_LINE> if init_bias_to_zero and self.module.bias is not None: <NEW_LINE>... | A handy refactor that allows the user to:
- initialize one layer's bias to zero
- apply He's initialization at runtime | 6259905191af0d3eaad3b2ee |
class JVM(Subsystem): <NEW_LINE> <INDENT> options_scope = 'jvm' <NEW_LINE> @classmethod <NEW_LINE> def register_options(cls, register): <NEW_LINE> <INDENT> super(JVM, cls).register_options(register) <NEW_LINE> register('--options', action='append', metavar='<option>...', help='Run with these extra JVM options.') <NEW_L... | A JVM invocation. | 625990512ae34c7f260ac5ab |
class ConfigureDialog(QtGui.QDialog): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> QtGui.QDialog.__init__(self, parent) <NEW_LINE> self._ui = Ui_ConfigureDialog() <NEW_LINE> self._ui.setupUi(self) <NEW_LINE> self._previousIdentifier = '' <NEW_LINE> self.identifierOccursCount = None <NEW_LINE... | Configure dialog to present the user with the options to configure this step. | 62599051a219f33f346c7ccb |
class Target(ConfigSerializable): <NEW_LINE> <INDENT> type = None <NEW_LINE> value = None | Target Config. | 62599051dc8b845886d54a89 |
class c_double(ctypes.c_double, _ConvertMixin, _CompareMixin, _NumberMixin, _StringMixin): <NEW_LINE> <INDENT> pass | Ctypes wrapper with additional functionality | 62599051a8ecb033258726dd |
class FieldMeta( namedtuple( "FieldMeta", ( "id", "module", "sign", "type", "label", "is_sys", "see_permission", "edit_permission", "is_required", "is_lock", "is_show_edit", "sort_id", ), ) ): <NEW_LINE> <INDENT> fields = ( "#id", "module", "sign", "type", "field_str", "is_sys", "see_permission", "edit_permission", "is... | Field information. | 625990518e71fb1e983bcf90 |
class Visitor(object): <NEW_LINE> <INDENT> log = None <NEW_LINE> def default(self, node, *args): <NEW_LINE> <INDENT> for child in node.getChildNodes(): <NEW_LINE> <INDENT> self.visit(child, *args) | This class implements a Visitor pattern. It has to be used with compiler.walk
usage: result = compiler.walk(ast, Visitor()).result | 6259905176d4e153a661dcde |
class BranchGenerator: <NEW_LINE> <INDENT> def __init__(self, instr, op, python_op=None): <NEW_LINE> <INDENT> self.instr = instr <NEW_LINE> self.op = op <NEW_LINE> self.python_op = python_op <NEW_LINE> <DEDENT> def generate(self, code, srcs, true_label, negate): <NEW_LINE> <INDENT> if all(isinstance(src, Constant) for ... | Generator for all branch ops. | 62599051435de62698e9d2ca |
class User(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'users' <NEW_LINE> id = db.Column(db.Integer, primary_key = True ) <NEW_LINE> username = db.Column(db.String(64), unique = True, index=True ) <NEW_LINE> role_id = db.Column(db.Integer, db.ForeignKey( 'roles.id' ) ) <NEW_LINE> def __repr__(self): <NEW_LINE> <INDE... | database table class User | 62599051462c4b4f79dbcecb |
class py34FileType(object): <NEW_LINE> <INDENT> def __init__(self, mode='r', bufsize=-1, encoding=None, errors=None): <NEW_LINE> <INDENT> self._mode = mode <NEW_LINE> self._bufsize = bufsize <NEW_LINE> self._encoding = encoding <NEW_LINE> self._errors = errors <NEW_LINE> <DEDENT> def __call__(self, string): <NEW_LINE> ... | Factory for creating file object types
Instances of FileType are typically passed as type= arguments to the
ArgumentParser add_argument() method.
Keyword Arguments:
- mode -- A string indicating how the file is to be opened. Accepts the
same values as the builtin open() function.
- bufsize -- The file... | 6259905123e79379d538d9c2 |
class DiffBotRequest(models.Model): <NEW_LINE> <INDENT> type = models.CharField(max_length=100) <NEW_LINE> created = models.DateTimeField(auto_now_add=True) <NEW_LINE> attempted = models.DateTimeField(blank=True, null=True) <NEW_LINE> completed = models.DateTimeField(blank=True, null=True) <NEW_LINE> parameters = ListF... | A job for the DiffBot! | 6259905163b5f9789fe8663a |
class FileChooserListView(FileChooserController): <NEW_LINE> <INDENT> _ENTRY_TEMPLATE = 'FileListEntry' | Implementation of :class:`FileChooserController` using a list view.
| 62599051dd821e528d6da3a7 |
class RestoredTrainer(TensorFlowTrainer): <NEW_LINE> <INDENT> def __init__(self, loss, global_step, trainer): <NEW_LINE> <INDENT> self.global_step = global_step <NEW_LINE> self.loss = loss <NEW_LINE> self.trainer = trainer | Trainer class that takes already existing graph. | 6259905163d6d428bbee3c99 |
class TestTestValidateQuery(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testTestValidateQuery(self): <NEW_LINE> <INDENT> pass | TestValidateQuery unit test stubs | 62599051dc8b845886d54a8b |
class ModifySnapshotByTimeOffsetTemplateRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Definition = None <NEW_LINE> self.Name = None <NEW_LINE> self.Width = None <NEW_LINE> self.Height = None <NEW_LINE> self.ResolutionAdaptive = None <NEW_LINE> self.Format = None <NEW_LINE> sel... | ModifySnapshotByTimeOffsetTemplate请求参数结构体
| 625990513539df3088ecd76e |
class ComputePixelToDistortedPixelTestCase(BaseTestCase): <NEW_LINE> <INDENT> def testNoDistortion(self): <NEW_LINE> <INDENT> focalPlaneToFieldAngle = self.makeAffineTransform(scale=self.radPerMm) <NEW_LINE> pixelToDistortedPixel = computePixelToDistortedPixel( pixelToFocalPlane=self.pixelToFocalPlane, focalPlaneToFiel... | Test lsst.afw.geom.computePixelToDistortedPixel
| 625990518da39b475be046b3 |
class Vocabulary(Tokenizer): <NEW_LINE> <INDENT> def __init__(self, text): <NEW_LINE> <INDENT> print('Start init Vocabulary.__init__()') <NEW_LINE> super().__init__(text) <NEW_LINE> self.vocab = set(self.tokens) <NEW_LINE> print('End init Vocabulary.__init__()') | Find unique words in text | 62599051b7558d589546498e |
@attr.s <NEW_LINE> class ThrottleDecorator: <NEW_LINE> <INDENT> throttle: _throttle.Throttle = attr.ib() <NEW_LINE> def _check(self, key: str) -> result.RateLimitResult: <NEW_LINE> <INDENT> result = self.throttle.check(key=key, quantity=1) <NEW_LINE> if result.limited: <NEW_LINE> <INDENT> raise ThrottleExceeded("Rate-l... | The class that acts as a decorator used to throttle function calls.
This class requires an intantiated throttle with which to limit function
invocations.
.. attribute:: throttle
The :class:`~rush.throttle.Throttle` which should be used to limit
decorated functions. | 6259905130dc7b76659a0ce3 |
class RebaseHelperError(Exception): <NEW_LINE> <INDENT> pass | Class representing Error raised inside rebase-helper after intentionally
catching some expected and well known exception/error. | 6259905124f1403a92686334 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.