code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Thing(JsonObject): <NEW_LINE> <INDENT> def __init__(self, _dict: Dict[str, Any]): <NEW_LINE> <INDENT> self.id = None <NEW_LINE> self.thumbnail = None <NEW_LINE> self.name = None <NEW_LINE> self.url = None <NEW_LINE> self.description = None <NEW_LINE> super().__init__(_dict) | Class representing a thing. | 62599012d18da76e235b77ac |
class tag_embedded(EmbeddedDocument): <NEW_LINE> <INDENT> tagsDoc = ListField(StringField(min_length=0,max_length=30, regex='^[A-ZÁÉÍÓÚÑÜ][a-z A-Z À-ÿ / & ,]*[a-záéíóúñü]$'), required=False, max_length=10) <NEW_LINE> def to_json(self): <NEW_LINE> <INDENT> return self.tagsDoc | EmbeddedDocument Class for Tags.
This embedded document makes sure that the values of each tag follow the regex pattern in the database.
List of attributes:
- tagsDoc: <List> All the tags belonging to a document.
Methods
-------
to_json()
Returns the json equivalent of the object. | 62599012bf627c535bcb216e |
class ColorInputField(InputField): <NEW_LINE> <INDENT> def __init__(self, id, value): <NEW_LINE> <INDENT> super(ColorInputField, self).__init__(id, value) <NEW_LINE> self.html_script = '%s=%s' % (IsSafari() and not IsMobile() and 'onclick' or 'onchange', '"ralStep(\'%s\', this.value, 0);"' % id) <NEW_LINE> self.default... | Поле ввода кода RAL (цвет) | 625990125166f23b2e24408f |
class Bounds(SlaveAllocatorTestMixin, unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> return super(Bounds, self).setUp(slaves=10, maxRequestsPerSec=1) <NEW_LINE> <DEDENT> def test_LowerBounds(self): <NEW_LINE> <INDENT> deferredList = [] <NEW_LINE> for i in range(1, 11): <NEW_LINE> <INDENT> ... | Allocation boundary checks. | 6259901221a7993f00c66c3a |
class DynamicsInterfaceInferer(ComponentClassInterfaceInferer, BaseDynamicsVisitor): <NEW_LINE> <INDENT> def __init__(self, dynamics): <NEW_LINE> <INDENT> self.state_variable_names = set() <NEW_LINE> super(DynamicsInterfaceInferer, self).__init__(dynamics) <NEW_LINE> <DEDENT> def action_statevariable(self, state_variab... | Used to infer output |EventPorts|, |StateVariables| & |Parameters|. | 6259901215fb5d323ce7f9fd |
class ProcessHandle(object): <NEW_LINE> <INDENT> def __init__(self, handle, kind): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def get_output(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDEN... | ProcessHandle is a superclass for what a handle to a process
should include. Examples of processes are SLURM scripts or
running straight on the command line.
Each subclass of ProcessHandle should be able to provide a single
handle, and describe what kind of handle it is. The subclass
must also be able ... | 625990128c3a8732951f7224 |
class CmdlineParser(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.port = DEFAULT_PORT <NEW_LINE> self.autosave_directory = DEFAULT_AUTOSAVE_DIRECTORY <NEW_LINE> self.autosave_interval = DEFAULT_AUTOSAVE_INTERVAL <NEW_LINE> self.save_hook = None <NEW_LINE> <DEDENT> def parse(self): <NEW_LINE> <INDE... | Parse commandline options. Results are available as attributes of this class | 6259901215fb5d323ce7f9ff |
class Service(): <NEW_LINE> <INDENT> def get_configuration(self, node_fqdn): <NEW_LINE> <INDENT> node = utils.get_or_create_node(node_fqdn) <NEW_LINE> all_role_assignments = node.get_role_assignments() <NEW_LINE> config_classes = get_config_classes(all_role_assignments) <NEW_LINE> settings = get_default_settings(config... | Service used by the Puppet External Node Classifier | 62599012d164cc6175821c40 |
class OptimizedCachedRequireJsStorage(OptimizedFilesMixin, PipelineForgivingStorage): <NEW_LINE> <INDENT> pass | Custom storage backend that is used by Django-require. | 62599012bf627c535bcb2174 |
class HitAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> form = HitAdminForm <NEW_LINE> list_display = ('src_path', 'event_type', 'yara_tags', 'vTotal', 'filesize', 'short_fileType', 'watcher', 'wasSeenBefore', 'is_malicious', 'created') <NEW_LINE> list_filter = ('is_malicious', 'watcher__server_name', 'event_type', 'file... | Admin View for Hit | 625990126fece00bbaccc67a |
class RdioOAuth1(BaseRdio, BaseOAuth1): <NEW_LINE> <INDENT> name = 'rdio-oauth1' <NEW_LINE> REQUEST_TOKEN_URL = 'http://api.rdio.com/oauth/request_token' <NEW_LINE> AUTHORIZATION_URL = 'https://www.rdio.com/oauth/authorize' <NEW_LINE> ACCESS_TOKEN_URL = 'http://api.rdio.com/oauth/access_token' <NEW_LINE> EXTRA_DATA = [... | Rdio OAuth authentication backend | 62599012be8e80087fbbfd38 |
class LayoutCell(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def pos(self): <NEW_LINE> <INDENT> raise NotImplementedError("pos property has to be overridden") <NEW_LINE> <DEDENT> @property <NEW_LINE> def size(self): <NEW_LINE> <INDENT> raise NotImplementedError("size property has to be overridden") | Base Layout Cell.
Not to be used directly. Usually subclasses of this class are returned by layouts.
Instances can be passed to Widgets as the ``pos`` argument. The ``size`` argument will
be automatically overridden.
Note that manually setting ``size`` will override the size set by the layout cell,
though the positi... | 62599012bf627c535bcb2178 |
class OriginDeleteView(PermissionRequiredMixin, DeleteView): <NEW_LINE> <INDENT> model = Origin <NEW_LINE> permission_required = ('origins.delete_origin', ) <NEW_LINE> success_url = reverse_lazy('origins:origin_list') | Removes an origin permanantly.
Removing an origin may have strange effects on characters with that origin. | 6259901256b00c62f0fb3586 |
class TemplatedPAComponentUpdateParameters(ModelNormal): <NEW_LINE> <INDENT> allowed_values = { } <NEW_LINE> validations = { } <NEW_LINE> additional_properties_type = None <NEW_LINE> _nullable = False <NEW_LINE> @cached_property <NEW_LINE> def openapi_types(): <NEW_LINE> <INDENT> lazy_import() <NEW_LINE> return { 'pare... | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the a... | 62599012925a0f43d25e8d08 |
class OctagonTarget(PolygonTarget): <NEW_LINE> <INDENT> def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> super(OctagonTarget, self).__init__(n=8, *args, **kwds) | A target in the form of a 8-sided polygon. | 625990126fece00bbaccc67e |
class UnaryOp(Node): <NEW_LINE> <INDENT> __slots__ = 'op', 'right_node' | A unary operation (e.g. ``-x``, ``not x``).
Attributes:
op: the operator (an enum from ``Node.OPS``).
right_node: the operand at the right of the operator. | 62599012462c4b4f79dbc6d1 |
class Target(object): <NEW_LINE> <INDENT> def __init__(self,host,port): <NEW_LINE> <INDENT> self.host = host <NEW_LINE> self.port = port | Contains hostname, portnumber and a dict
of protocols that should be enabled/disabled. | 62599012be8e80087fbbfd3a |
class BiosVfNUMAOptimized(ManagedObject): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> ManagedObject.__init__(self, "BiosVfNUMAOptimized") <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def class_id(): <NEW_LINE> <INDENT> return "biosVfNUMAOptimized" <NEW_LINE> <DEDENT> DN = "Dn" <NEW_LINE> RN = "Rn" <NEW_... | This class contains the relevant properties and constant supported by this MO. | 62599012925a0f43d25e8d0a |
class PelotonWorkoutAchievement(PelotonObject): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.slug = kwargs.get('slug') <NEW_LINE> self.description = kwargs.get('description') <NEW_LINE> self.image_url = kwargs.get('image_url') <NEW_LINE> self.id = kwargs.get('id') <NEW_LINE> self.name = kw... | Class that represents a single achievement that a user
earned during the workout | 625990120a366e3fb87dd6bd |
class GenericParser(object): <NEW_LINE> <INDENT> def __init__(self, filename, parser, mime, backup, is_writable, **kwargs): <NEW_LINE> <INDENT> self.filename = '' <NEW_LINE> self.parser = parser <NEW_LINE> self.mime = mime <NEW_LINE> self.backup = backup <NEW_LINE> self.is_writable = is_writable <NEW_LINE> self.editor ... | Parent class of all parsers
| 62599012462c4b4f79dbc6d3 |
class TitleRule(HeadingRule): <NEW_LINE> <INDENT> type = 'title' <NEW_LINE> first = True <NEW_LINE> def condition(self, block): <NEW_LINE> <INDENT> if not self.first: return False <NEW_LINE> self.first = False <NEW_LINE> return HeadingRule.condition(self, block) | 题目时文档的第一个块,但前提时它是大标题。 | 6259901221a7993f00c66c47 |
class IntervalReloadFileContents(FileContents): <NEW_LINE> <INDENT> def __init__(self, path, interval = 1): <NEW_LINE> <INDENT> self._last_check = 0 <NEW_LINE> self._last_mtime = 0 <NEW_LINE> self._interval = interval <NEW_LINE> super(IntervalReloadFileContents, self).__init__(path) <NEW_LINE> <DEDENT> @property <NEW_L... | Loads the contents of a file and holds it in memory. Each time the
file contents are requested, checks to see if the file has been modified
since last checked.
:param path: Path to the file to load.
:keyword interval: The interval (in seconds) between modification checks. | 62599012bf627c535bcb217c |
class Algorithm(object): <NEW_LINE> <INDENT> def __init__(self, dpid_to_switch, mintravcap, topochangeupdate): <NEW_LINE> <INDENT> self.dpid_to_switch = dpid_to_switch <NEW_LINE> self.topology_last_update = time.time() <NEW_LINE> self.min_trasverse_capacity = mintravcap <NEW_LINE> self.update_forwarding_only_on_topolog... | Algorithm base class | 6259901215fb5d323ce7fa0a |
class PrestagePackagesState(PrestageState): <NEW_LINE> <INDENT> def __init__(self, region_name): <NEW_LINE> <INDENT> super(PrestagePackagesState, self).__init__( next_state=consts.STRATEGY_STATE_PRESTAGE_IMAGES, region_name=region_name) <NEW_LINE> <DEDENT> def _do_state_action(self, strategy_step): <NEW_LINE> <INDENT> ... | Perform prestage packages operation | 62599012d164cc6175821c4a |
class TokenRefresh(Resource): <NEW_LINE> <INDENT> @jwt_refresh_token_required <NEW_LINE> def post(self): <NEW_LINE> <INDENT> current_user_id = get_jwt_identity() <NEW_LINE> new_token = create_access_token(identity=current_user_id) <NEW_LINE> response, status = { 'message': 'Access token was successfully refreshed', 'ac... | Refresh token handler | 625990126fece00bbaccc683 |
class Controller(object): <NEW_LINE> <INDENT> def __init__(self, model): <NEW_LINE> <INDENT> self.model = model <NEW_LINE> <DEDENT> def add_malt_view(self,malt): <NEW_LINE> <INDENT> self.model.add_malt_view(malt) <NEW_LINE> self.model.announce_model_updated() <NEW_LINE> <DEDENT> def remove_malt(self,malt): <NEW_LINE> <... | classdocs | 625990128c3a8732951f7230 |
class UrrySelector(Selector): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "Urry Selector" <NEW_LINE> <DEDENT> def select( self, index: int = None, items: numpy.ndarray = None, administered_items: List[int] = None, est_t... | Selector that returns the item whose difficulty parameter is closest to the examinee's ability | 62599012d164cc6175821c4c |
class GroupAccessDict(Dict): <NEW_LINE> <INDENT> def from_json(self, value): <NEW_LINE> <INDENT> if value is not None: <NEW_LINE> <INDENT> return {int(k): value[k] for k in value} <NEW_LINE> <DEDENT> <DEDENT> def to_json(self, value): <NEW_LINE> <INDENT> if value is not None: <NEW_LINE> <INDENT> return {unicode(k): val... | Special Dict class for serializing the group_access field. | 625990136fece00bbaccc685 |
class findAdGroupById_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.I32, 'group_id', None, None, ), ) <NEW_LINE> def __init__(self, group_id=None,): <NEW_LINE> <INDENT> self.group_id = group_id <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtocol.TBinaryProtoc... | Attributes:
- group_id | 6259901321a7993f00c66c4b |
class BoundedTestGenerator(TestGenerationEngine): <NEW_LINE> <INDENT> def __init__(self, features, possible_args, num_tests): <NEW_LINE> <INDENT> super().__init__(features, possible_args) <NEW_LINE> self.num_tests = num_tests <NEW_LINE> <DEDENT> def generate(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def next_... | Test generator which randomly assigns parameter values from the boundary value space.
Corresponds to bounded Metha in the Metha paper. | 6259901315fb5d323ce7fa0e |
class res_partner_server(orm.Model): <NEW_LINE> <INDENT> _name = 'res.partner.server' <NEW_LINE> _description = 'Server' <NEW_LINE> _columns={ 'name': fields.char('Nome', size=30, required=True), 'domain': fields.char('Dominio', size=60), 'ip': fields.char('IP', size=15, required=True), 'note': fields.text('Note'), 'pa... | Server per partner
| 6259901321a7993f00c66c4d |
class BadSignatureError(ValueError): <NEW_LINE> <INDENT> pass | Raised when the signature was forged or otherwise corrupt. | 6259901356b00c62f0fb3590 |
class IsOfferJoinedFilter(filters.BaseFilterBackend): <NEW_LINE> <INDENT> def filter_queryset(self, request, queryset, view): <NEW_LINE> <INDENT> if request.query_params.get('joined') == 'true': <NEW_LINE> <INDENT> if request.user.is_authenticated(): <NEW_LINE> <INDENT> return queryset.filter(volunteers__in=[request.us... | Filter offers based on if user joined an offer. | 6259901321a7993f00c66c4f |
class BaseSwap(object): <NEW_LINE> <INDENT> def test_simple(self): <NEW_LINE> <INDENT> x = arange(3.,dtype=self.dtype) <NEW_LINE> y = zeros(shape(x),x.dtype) <NEW_LINE> desired_x = y.copy() <NEW_LINE> desired_y = x.copy() <NEW_LINE> x, y = self.blas_func(x,y) <NEW_LINE> assert_array_equal(desired_x,x) <NEW_LINE> assert... | Mixin class for swap tests | 6259901356b00c62f0fb3592 |
class HelloApiView(APIView): <NEW_LINE> <INDENT> serializer_class = serializers.HelloSerializer <NEW_LINE> def get(self, request, format=None): <NEW_LINE> <INDENT> an_apiview = [ 'Uses HTTP methods as functions (get, post, patch, push, delete)', 'Is similar to a traditional Django View', 'Gives you the most control ove... | Test API View | 62599013507cdc57c63a5a76 |
class ReadResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'page': {'required': True, 'minimum': 1}, 'angle': {'required': True, 'maximum': 180, 'minimum_ex': -180}, 'width': {'required': True, 'minimum': 0}, 'height': {'required': True, 'minimum': 0}, 'unit': {'required': True}, } <NEW_LINE> _at... | Text extracted from a page in the input document.
All required parameters must be populated in order to send to Azure.
:ivar page: Required. The 1-based page number in the input document.
:vartype page: int
:ivar angle: Required. The general orientation of the text in clockwise direction, measured in
degrees between... | 62599013925a0f43d25e8d16 |
class FillArrayData(object): <NEW_LINE> <INDENT> def __init__(self, buff): <NEW_LINE> <INDENT> self.notes = [] <NEW_LINE> self.format_general_size = calcsize("=HHI") <NEW_LINE> self.ident = unpack("=H", buff[0:2])[0] <NEW_LINE> self.element_width = unpack("=H", buff[2:4])[0] <NEW_LINE> self.size = unpack("=I", buff[4:8... | This class can parse a FillArrayData instruction
:param buff: a Buff object which represents a buffer where the instruction is stored | 6259901356b00c62f0fb3594 |
class _BaseElementOptions(_BaseOptions): <NEW_LINE> <INDENT> visible = properties.Boolean( 'Visibility of resource on/off', default=True, ) <NEW_LINE> opacity = properties.Instance( 'Default opacity options on the element', OptionsOpacity, default=OptionsOpacity, ) <NEW_LINE> color = properties.Instance( 'Default color... | Base class for various element options | 625990130a366e3fb87dd6c9 |
class OverdueFilter(TestCase): <NEW_LINE> <INDENT> fixtures = ['gtd-test.json', 'test-users.json', 'gtd-env.json'] <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.node = Node.objects.get(pk=1) <NEW_LINE> <DEDENT> def test_filter_exists(self): <NEW_LINE> <INDENT> self.assertTrue(self.node.overdue, '__call__') <NEW_... | Tests the `overdue` node method that makes dates into
prettier "in 1 day" strings, etc. | 6259901321a7993f00c66c53 |
class GridHeaderMouseLeftUp(GridEvent, MouseEvent): <NEW_LINE> <INDENT> pass | Occurs when the left mouse button goes up in the header region. | 62599013bf627c535bcb2188 |
class MouseButton: <NEW_LINE> <INDENT> def __init__(self, mouse): <NEW_LINE> <INDENT> self.mouse: Mouse = mouse <NEW_LINE> self.primed = False <NEW_LINE> self.primed_position = None <NEW_LINE> <DEDENT> def prime(self, position): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.mouse.active_object = self.mouse.mouse_in... | class that holds mouse button states, detects object collisions and handles clicks | 62599013507cdc57c63a5a7a |
class InvalidateChildTest(unittest.TestCase): <NEW_LINE> <INDENT> def testInvalidateChild(self): <NEW_LINE> <INDENT> parent = ObjectType() <NEW_LINE> child1 = ObjectType(parent) <NEW_LINE> child1.setObjectName('child1') <NEW_LINE> child2 = ObjectType.create() <NEW_LINE> child2.setParent(parent) <NEW_LINE> child2.setObj... | Tests for invalidating a C++ created child that was already on the care of a parent. | 625990138c3a8732951f723c |
class HydraClassOp(): <NEW_LINE> <INDENT> def __init__(self, title, method, expects, returns, status): <NEW_LINE> <INDENT> self.title = title <NEW_LINE> self.method = method <NEW_LINE> self.expects = expects <NEW_LINE> self.returns = returns <NEW_LINE> self.status = status <NEW_LINE> <DEDENT> def get_type(self, method)... | Template for a new supportedOperation. | 62599013507cdc57c63a5a82 |
class TestLoggingConfig(NamedModelTestCase): <NEW_LINE> <INDENT> def test_name_not_found(self): <NEW_LINE> <INDENT> logger.warning('Verify logger filtering') <NEW_LINE> name = 'myname' <NEW_LINE> with self.assertRaises(Category.DoesNotExist): <NEW_LINE> <INDENT> Category.objects.named_instance(name=name) <NEW_LINE> <DE... | Logging configuration testcase class.
| 62599013462c4b4f79dbc6eb |
class ImageOps: <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def resize_image(cls, image_body, size, fit_to_size=False): <NEW_LINE> <INDENT> image_file = StringIO(image_body) <NEW_LINE> try: <NEW_LINE> <INDENT> image = Image.open(image_file) <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> return False <NEW_LINE>... | Module that holds all image operations. Since there's no state,
everything is a classmethod. | 6259901315fb5d323ce7fa22 |
class AllPosts(Feed): <NEW_LINE> <INDENT> title = 'Glader.ru: последние сообщения' <NEW_LINE> link = 'http://%s' % settings.DOMAIN <NEW_LINE> description = 'Свежие сообщения на сайте сноуборд-энциклопедии Glader.ru' <NEW_LINE> title_template = 'feeds/all_title.html' <NEW_LINE> description_template = 'feeds/all_descript... | Свежие сообщения в блоге | 62599013d164cc6175821c64 |
class StartupPagesRecordPageSet(story.StorySet): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(StartupPagesRecordPageSet, self).__init__( archive_data_file='data/startup_pages.json') <NEW_LINE> urls_list = [ 'http://bbc.co.uk', 'http://kapook.com', ] <NEW_LINE> for url in urls_list: <NEW_LINE> <INDE... | Pages to record data for testing starting Chrome with a URL.
We can't use startup_pages.json with record_wpr, since record_wpr
requires a default navigate step, which we don't want for startup
testing; but we do want to record the pages it uses. Also, record_wpr
fails on about:blank, which we want to include in startup... | 625990130a366e3fb87dd6d9 |
class GradientTapeError(Exception): <NEW_LINE> <INDENT> pass | Raised when an inappropriate GradientTape event occurs. | 62599013d18da76e235b77c1 |
class Logger(app.AppLogger): <NEW_LINE> <INDENT> observerFactory = log.CLILogObserver <NEW_LINE> def __init__(self, config): <NEW_LINE> <INDENT> self.config = config <NEW_LINE> <DEDENT> def _getLogObserver(self): <NEW_LINE> <INDENT> return self.observerFactory(self.config) <NEW_LINE> <DEDENT> def _initialLog(self): <NE... | CLI-oriented logger factory. | 62599013be8e80087fbbfd5a |
class CrossValidatorModel(Model, ValidatorParams): <NEW_LINE> <INDENT> def __init__(self, bestModel, avgMetrics=[]): <NEW_LINE> <INDENT> super(CrossValidatorModel, self).__init__() <NEW_LINE> self.bestModel = bestModel <NEW_LINE> self.avgMetrics = avgMetrics <NEW_LINE> <DEDENT> def _transform(self, dataset): <NEW_LINE>... | Model from k-fold cross validation.
.. versionadded:: 1.4.0 | 6259901315fb5d323ce7fa26 |
class Solution2: <NEW_LINE> <INDENT> def threeSum(self, nums: List[int]) -> List[List[int]]: <NEW_LINE> <INDENT> result = set() <NEW_LINE> nums.sort() <NEW_LINE> for i in range(len(nums) - 2): <NEW_LINE> <INDENT> if nums[i] > 0: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> if i > 0 and nums[i] == nums[i - 1]: <NEW_LIN... | Runtime: 1132 ms, less than 33.53 % of python3.
Memory Usage: 17.4 MB, less than 19.96 % of python3.
Algorithm idea:
The way to think about it is since it's 3 sum, there's only going to be 3 numbers.
So to find the combinations of 3 numbers, we iterating through the list with
the first pointer, and then tr... | 625990139b70327d1c57fa69 |
class Debt_To_Equity_Ratio(CustomFactor): <NEW_LINE> <INDENT> inputs = [morningstar.balance_sheet.total_debt, morningstar.balance_sheet.common_stock_equity] <NEW_LINE> window_length = 1 <NEW_LINE> def compute(self, today, assets, out, debt, equity): <NEW_LINE> <INDENT> out[:] = debt[-1] / equity[-1] | Debt / Equity Ratio:
Total Debts divided by Common Stock Equity
https://www.pnc.com/content/dam/pnc-com/pdf/personal/wealth-investments/WhitePapers/FactorAnalysisFeb2014.pdf
Notes:
High value suggests that company is taking on debts to leverage
Low value suggests good financial health as little-to-no leveraging
Long... | 62599013d18da76e235b77c2 |
class World(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def stacked_proxy_safe_get(stacked_proxy, key, default=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return getattr(stacked_proxy, key) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> return default <NEW_LINE> <DEDENT> <DEDENT> def curren... | A World is the proxy to the app/request state for Features.
Proxying through World allows for easy testing and caching if needed. | 62599013bf627c535bcb219c |
class ThreadedUnixSocketServer(SocketServer.ThreadingUnixStreamServer): <NEW_LINE> <INDENT> pass | multi-thread unix socket server class | 62599013796e427e5384f46f |
class Pagination: <NEW_LINE> <INDENT> def __init__(self, page_type=PAGE_TYPE_RANGE, pages=None, is_counted=False, page_len=None, start_empty=False, num_shift=0): <NEW_LINE> <INDENT> self.page_type = page_type <NEW_LINE> self.pages = pages <NEW_LINE> self.is_counted = is_counted <NEW_LINE> self.page_len = page_len <NEW_... | Pagination style | 625990130a366e3fb87dd6e2 |
class ContainsAttributeValue(Comparator): <NEW_LINE> <INDENT> def __init__(self, key, value): <NEW_LINE> <INDENT> self._key = key <NEW_LINE> self._value = value <NEW_LINE> <DEDENT> def equals(self, rhs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return getattr(rhs, self._key) == self._value <NEW_LINE> <DEDENT> excep... | Checks whether passed parameter contains attributes with a given value.
Example:
mock_dao.UpdateSomething(ContainsAttribute('stevepm', stevepm_user_info)) | 62599013462c4b4f79dbc6f7 |
class RadarPlot(_BasePlot): <NEW_LINE> <INDENT> pass | A radar-style plot. | 625990140a366e3fb87dd6e4 |
class CloseAndPull(CommandGroup): <NEW_LINE> <INDENT> def __init__(self, robot): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.addParallel(CloseClaw(robot=robot)) <NEW_LINE> self.addSequential(Pull(robot=robot)) | Open claw and punch. | 62599014462c4b4f79dbc6f9 |
class _Appearance(_Settings): <NEW_LINE> <INDENT> class _ColorSettings(_Settings): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.text = '' <NEW_LINE> self.prompt = color.Fore.TOGGLE_BRIGHT <NEW_LINE> self.selection = (color.Fore.TOGGLE_RED + color.Fore.TOGGLE_GREEN + color.Fore.TOGGLE_BLUE + color.Ba... | Appearance settings | 62599014507cdc57c63a5a92 |
class DataStore(object): <NEW_LINE> <INDENT> DS_RESOURCES = "resources" <NEW_LINE> DS_OBJECTS = "objects" <NEW_LINE> DS_EVENTS = "events" <NEW_LINE> DS_DIRECTORY = DS_RESOURCES <NEW_LINE> DS_STATE = "state" <NEW_LINE> DS_PROFILE_LIST = ['OBJECTS', 'RESOURCES', 'DIRECTORY', 'STATE', 'EVENTS', 'EXAMPLES', 'SCIDATA', 'FIL... | Common utilities for datastores | 625990145166f23b2e2440c2 |
class Xco2: <NEW_LINE> <INDENT> allowed = ('polygon', 'point', ) <NEW_LINE> def on_post(self, req, resp): <NEW_LINE> <INDENT> resp.status = falcon.HTTP_200 <NEW_LINE> data = req.context['geojson'] <NEW_LINE> coords = spatial.from_list_to_ewkt( spatial.coordinates_from_geojson(data) ) <NEW_LINE> print(coords) <NEW_LINE>... | Long-living REST resource class.
Use only POST method. | 62599014bf627c535bcb21a2 |
class Handler(handler.handler): <NEW_LINE> <INDENT> def dispatch(self, session): <NEW_LINE> <INDENT> req_body = self.context.request.body <NEW_LINE> resp_body = self.context.response.body <NEW_LINE> id = req_body.id <NEW_LINE> name = req_body.name <NEW_LINE> sort_order = req_body.sort_order <NEW_LINE> info = { 'name': ... | 商品型号更新 | 62599014925a0f43d25e8d33 |
class ModulesHolder( ObjectHolder ): <NEW_LINE> <INDENT> idxName = "modules" <NEW_LINE> counterName = "MODULES" <NEW_LINE> _availableModules = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> ObjectHolder.__init__(self) <NEW_LINE> import MaKaC.modules.news as news <NEW_LINE> import MaKaC.modules.cssTpls as cssTp... | Specialised ObjectHolder class which provides a wrapper for collections
based in a Catalog for indexing the objects. It allows to index some
declared attributes of the stored objects and then perform SQL-like
queries | 62599014d18da76e235b77c7 |
class RoutingGroupRouteInfo(NetAppObject): <NEW_LINE> <INDENT> _routing_group = None <NEW_LINE> @property <NEW_LINE> def routing_group(self): <NEW_LINE> <INDENT> return self._routing_group <NEW_LINE> <DEDENT> @routing_group.setter <NEW_LINE> def routing_group(self, val): <NEW_LINE> <INDENT> if val != None: <NEW_LINE> <... | Routing group route information
When returned as part of the output, all elements of this typedef
are reported, unless limited by a set of desired attributes
specified by the caller.
<p>
When used as input to specify desired attributes to return,
omitting a given element indicates that it shall not be returned
in the o... | 6259901456b00c62f0fb35b2 |
class Patient(object): <NEW_LINE> <INDENT> def __init__(self, viruses, maxPop): <NEW_LINE> <INDENT> self.viruses = viruses <NEW_LINE> self.maxPop = maxPop <NEW_LINE> <DEDENT> def getViruses(self): <NEW_LINE> <INDENT> return self.viruses <NEW_LINE> <DEDENT> def getMaxPop(self): <NEW_LINE> <INDENT> return self.maxPop <NE... | Representation of a simplified patient. The patient does not take any drugs
and his/her virus populations have no drug resistance. | 62599014507cdc57c63a5a96 |
class Is(StaticType): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> def matches(self, value): <NEW_LINE> <INDENT> return self.value == value | A static type that matches a value if the value is equal, as determined by
the == operator, to a specified value. | 6259901456b00c62f0fb35b4 |
class optimizer(): <NEW_LINE> <INDENT> def __init__(self, file_name): <NEW_LINE> <INDENT> self.file_name = file_name <NEW_LINE> self.file = self.load_file() <NEW_LINE> self.best = "" <NEW_LINE> self.find_best() <NEW_LINE> <DEDENT> def load_file(self): <NEW_LINE> <INDENT> with open(self.file_name, "r") as fi: <NEW_LINE>... | Find the most optimized motor based of a list of motors. | 62599014507cdc57c63a5a98 |
class Regex(object): <NEW_LINE> <INDENT> def __init__(self, regex, flags=0): <NEW_LINE> <INDENT> self.regex = compile(regex, flags) <NEW_LINE> <DEDENT> def is_match(self, str): <NEW_LINE> <INDENT> return match(self.regex, str) | Wrapper class for regular expressions. | 625990149b70327d1c57fa79 |
class LogNorm(Normalize): <NEW_LINE> <INDENT> def __call__(self, value, clip=None): <NEW_LINE> <INDENT> if clip is None: <NEW_LINE> <INDENT> clip = self.clip <NEW_LINE> <DEDENT> result, is_scalar = self.process_value(value) <NEW_LINE> result = np.ma.masked_less_equal(result, 0, copy=False) <NEW_LINE> self.autoscale_Non... | Normalize a given value to the 0-1 range on a log scale | 62599014d164cc6175821c78 |
class Process(models.Model): <NEW_LINE> <INDENT> process = models.CharField(max_length=32, null=False, verbose_name='流程名', help_text='流程名', unique=True) <NEW_LINE> create_time = models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间', help_text='创建时间') <NEW_LINE> remark = models.CharField(max_length=32, ... | 审批流程表 | 62599014bf627c535bcb21aa |
class ReleaseEventComboBox(Gtk.HBox): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ReleaseEventComboBox, self).__init__() <NEW_LINE> self.model = Gtk.ListStore(object, str) <NEW_LINE> self.combo = Gtk.ComboBox(model=self.model) <NEW_LINE> render = Gtk.CellRendererText() <NEW_LINE> self.combo.pack_s... | A ComboBox for picking a release event. | 625990149b70327d1c57fa7b |
class Variety(models.Model): <NEW_LINE> <INDENT> variety = models.CharField(max_length=45, blank=False) <NEW_LINE> seed_color = models.CharField(max_length=75) <NEW_LINE> parts_to_harvest = models.TextField() <NEW_LINE> unique_characteristics = models.TextField() <NEW_LINE> planting_intructions = models.TextField() <NE... | TODO: Description of class | 625990145166f23b2e2440cc |
class Window (gtk.Window): <NEW_LINE> <INDENT> def __init__ (self, ident): <NEW_LINE> <INDENT> self.ident = ident <NEW_LINE> gtk.Window.__init__(self) <NEW_LINE> w, h = settings['win_size_{}'.format(ident)][:2] <NEW_LINE> self.set_default_size(w, h) <NEW_LINE> if settings['win_max_{}'.format(ident)]: <NEW_LINE> <INDENT... | A Gtk.Window subclass that saves its size.
Takes a string identifier used in the setting keys. | 62599014d164cc6175821c7a |
class FirebirdTests(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> print('=' * 80) <NEW_LINE> print('Begin Firebird test') <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> print('End Firebird test') <NEW_LINE> print('=' * 80) <NEW_LINE> <DEDENT> @skipUnless(db.backend_name == "f... | Tests firebird related issues | 6259901456b00c62f0fb35ba |
class UserProfileManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self, email, name, password=None): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError('Users must have an email address.') <NEW_LINE> <DEDENT> email = self.normalize_email(email) <NEW_LINE> user = self.model(email=email, ... | Helps Django work with our custom user model | 6259901421a7993f00c66c79 |
class ResourceMockView(View): <NEW_LINE> <INDENT> class MockForm(forms.Form): <NEW_LINE> <INDENT> foo = forms.BooleanField(required=False) <NEW_LINE> bar = forms.IntegerField(help_text='Must be an integer.') <NEW_LINE> baz = forms.CharField(max_length=32) <NEW_LINE> <DEDENT> form = MockForm | This is a resource-based mock view | 625990149b70327d1c57fa7d |
class Application(tk.Tk): <NEW_LINE> <INDENT> red, red_hover = "#e74c3c", "#c0392b" <NEW_LINE> orange, orange_hover = "#e67e22", "#d35400" <NEW_LINE> yellow, yellow_hover = "#f1c40f", "#f39c12" <NEW_LINE> green, green_hover = "#2ecc71", "#27ae60" <NEW_LINE> blue, blue_hover = "#3498db", "#2980b9" <NEW_LINE> gray, gray_... | Simple Application with a text entry controlled by two buttons. | 62599014a8ecb03325871f1f |
class Scenario(object): <NEW_LINE> <INDENT> def __init__(self, feature, name, line_number, example_converters=None, tags=None): <NEW_LINE> <INDENT> self.feature = feature <NEW_LINE> self.name = name <NEW_LINE> self.params = set() <NEW_LINE> self.steps = [] <NEW_LINE> self.example_params = [] <NEW_LINE> self.examples = ... | Scenario. | 62599014d18da76e235b77ce |
class PyWcsaxes(PythonPackage): <NEW_LINE> <INDENT> homepage = "http://wcsaxes.readthedocs.io/en/latest/index.html" <NEW_LINE> url = "https://github.com/astrofrog/wcsaxes/archive/v0.8.tar.gz" <NEW_LINE> version('0.8', sha256='9c6addc1ec04cc99617850354b2c03dbd4099d2e43b45a81f8bc3069de9c8e83') <NEW_LINE> extends('py... | WCSAxes is a framework for making plots of Astronomical data
in Matplotlib. | 625990149b70327d1c57fa81 |
class TabCompletionRegistry(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._comp_dict = {} <NEW_LINE> <DEDENT> def register_tab_comp_context(self, context_words, comp_items): <NEW_LINE> <INDENT> if not isinstance(context_words, list): <NEW_LINE> <INDENT> raise TypeError("Incorrect type in con... | Registry for tab completion responses. | 62599014bf627c535bcb21b2 |
class NestActivityZoneSensor(NestBinarySensor): <NEW_LINE> <INDENT> def __init__(self, structure, device, zone): <NEW_LINE> <INDENT> super(NestActivityZoneSensor, self).__init__(structure, device, "") <NEW_LINE> self.zone = zone <NEW_LINE> self._name = "{} {} activity".format(self._name, self.zone.name) <NEW_LINE> <DED... | Represents a Nest binary sensor for activity in a zone. | 625990148c3a8732951f7265 |
class overridable_property(cachedproperty): <NEW_LINE> <INDENT> __unset__ = None <NEW_LINE> def __get__(self, obj, cls): <NEW_LINE> <INDENT> obj = self.__gettarget__(obj) <NEW_LINE> value = getattr(obj, self.__hidden_name__, self.__unset__) <NEW_LINE> return self.__func__(obj) if value is self.__unset__ else value | A property that works like a normal property, but can be overridden. | 62599014507cdc57c63a5aa4 |
class ChooseAuthenticatorTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> zope.component.provideUtility(display_util.FileDisplay(sys.stdout)) <NEW_LINE> self.mock_apache = mock.Mock() <NEW_LINE> self.mock_stand = mock.Mock() <NEW_LINE> self.mock_apache().more_info.return_value = "Apache... | Test choose_authenticator function. | 62599014507cdc57c63a5aa6 |
class CSRF(v.Validator): <NEW_LINE> <INDENT> name = "csrf" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def populate(self, name): <NEW_LINE> <INDENT> if flask.session.get("_csrf_token") is None: <NEW_LINE> <INDENT> token = base64.b64encode(os.urandom(24)) <NEW_LINE> flask.session["_csrf_t... | Create a CSRF token and ensure that the token exists (and matches that
of the form) when serving and processing forms.
Only usable with the Flask engine.
:usage:
@app.route("/")
@sb.validator({
"csrf": sb.CSRF(),
})
def index():
# Your code here
pass | 6259901421a7993f00c66c81 |
class LocalDiscogsConnector(object): <NEW_LINE> <INDENT> def __init__(self, delegate_discogs_connector): <NEW_LINE> <INDENT> self.delegate = delegate_discogs_connector <NEW_LINE> <DEDENT> def fetch_release(self, release_id): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def fetch_release(self, release_id, source_dir): <... | use local json, do not fetch json from discogs, instead use the one in the source_directory
We will need to use the Original DiscogsConnector to allow the usage of the authentication
for fetching images. | 62599014d18da76e235b77d0 |
class Track(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.trackId = None <NEW_LINE> self.trackfile = None <NEW_LINE> self.trackMinPressure = None <NEW_LINE> self.trackMaxWind = None <NEW_LINE> <DEDENT> def __getattr__(self, key): <NEW_LINE> <INDENT> if key.s... | A single tropical cyclone track.
The object exposes the track data through the object attributes.
For example, If `data` contains the tropical cyclone track data
(`numpy.array`) loaded with the :meth:`readTrackData` function,
then the central pressure column can be printed out with the
code::
t = Track(data)
... | 62599014d164cc6175821c84 |
class StockDataAnalysis(Data, metaclass=ABCMeta): <NEW_LINE> <INDENT> data_type = DataType.STOCK_DATA_ANALYSIS <NEW_LINE> def __init__(self, dependencies=None, visible=True): <NEW_LINE> <INDENT> super(StockDataAnalysis, self).__init__(dependencies, visible) | Base class for storing stock data analysis.
| 6259901456b00c62f0fb35c4 |
class FileStore: <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> self.path = os.path.abspath(path) | must exist | 625990149b70327d1c57fa87 |
class ContactSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> resume = ResumesSerializer() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Contact <NEW_LINE> fields = [ 'id', 'resume', 'email', 'phone', 'social_networks', 'updated_at' ] | Serializer for contact resource. | 62599014be8e80087fbbfd7a |
class HostConfigurer(Configurable): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(HostConfigurer, self).__init__(*args, **kwargs) <NEW_LINE> self.setter = InteractiveConfigurationSetter("host", add_cwd=False, add_logging=False) <NEW_LINE> self.definition = None <NEW_LINE> self.host_... | This class ... | 62599014507cdc57c63a5aaa |
class Buyer(Worker): <NEW_LINE> <INDENT> def __init__(self, db, buyer_name='Zissou', **kwargs): <NEW_LINE> <INDENT> super(Buyer, self).__init__(db, **kwargs) <NEW_LINE> self.buyer_name = str(buyer_name) <NEW_LINE> <DEDENT> def buy_item(self, row, date, price): <NEW_LINE> <INDENT> if not row.sale == 0: <NEW_LINE> <INDEN... | Auction House buyer.
:param db: database object | 625990145166f23b2e2440da |
class EffectiveRouteListResult(Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveRoute]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(EffectiveRouteListResult, self).__init__(**kwargs) <NEW_LINE> self.va... | Response for list effective route API service call.
:param value: A list of effective routes.
:type value: list[~azure.mgmt.network.v2016_12_01.models.EffectiveRoute]
:param next_link: The URL to get the next set of results.
:type next_link: str | 625990149b70327d1c57fa89 |
class FixOrderingView(BrowserView): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> return "Aborted, fixing ordering is only necessary on python 2." <NEW_LINE> catalog = getToolByName(self.context, "portal_catalog") <NEW_LINE> for brain in catalog.unrestrictedSearchResults(QUERY): <NEW_LINE> <INDENT> folder... | Attempt to fix ordering for all potentially affected objects.
By default will fix ordering object ids for every object that considers
itself folderish.
The problem only exists with python 2 so we do nothing when we are
called on python 3 by mistake. | 62599014462c4b4f79dbc713 |
class NetworkSecurityGroupRule(Model): <NEW_LINE> <INDENT> _validation = { 'priority': {'required': True}, 'access': {'required': True}, 'source_address_prefix': {'required': True}, } <NEW_LINE> _attribute_map = { 'priority': {'key': 'priority', 'type': 'int'}, 'access': {'key': 'access', 'type': 'NetworkSecurityGroupR... | A network security group rule to apply to an inbound endpoint.
All required parameters must be populated in order to send to Azure.
:param priority: Required. The priority for this rule. Priorities within a
Pool must be unique and are evaluated in order of priority. The lower the
number the higher the priority. For... | 6259901421a7993f00c66c87 |
class ClippedReLU(function_node.FunctionNode): <NEW_LINE> <INDENT> _use_cudnn = False <NEW_LINE> def __init__(self, z): <NEW_LINE> <INDENT> if not isinstance(z, float): <NEW_LINE> <INDENT> raise TypeError('z must be float value') <NEW_LINE> <DEDENT> assert z > 0 <NEW_LINE> self.cap = z <NEW_LINE> <DEDENT> def check_typ... | Clipped Rectifier Unit function.
Clipped ReLU is written as
:math:`ClippedReLU(x, z) = \min(\max(0, x), z)`,
where :math:`z(>0)` is a parameter to cap return value of ReLU. | 6259901456b00c62f0fb35ca |
class ActionLong(Action): <NEW_LINE> <INDENT> def __init__(self, title, start_callback, stop_callback): <NEW_LINE> <INDENT> Action.__init__(self, title) <NEW_LINE> self.__actions = [start_callback, stop_callback] <NEW_LINE> <DEDENT> def Down(self): <NEW_LINE> <INDENT> self.__actions[0]() <NEW_LINE> <DEDENT> def Up(self... | Action with start and stop callbacks
| 62599014bf627c535bcb21bc |
class MvCommand(Command): <NEW_LINE> <INDENT> command_spec = { COMMAND_NAME : 'mv', COMMAND_NAME_ALIASES : ['move', 'ren', 'rename'], MIN_ARGS : 2, MAX_ARGS : NO_MAX, SUPPORTED_SUB_ARGS : 'pv', FILE_URIS_OK : True, PROVIDER_URIS_OK : False, URIS_START_ARG : 0, } <NEW_LINE> help_spec = { HELP_NAME : 'mv', HELP_NAME_ALIA... | Implementation of gsutil mv command.
Note that there is no atomic rename operation - this command is simply
a shorthand for 'cp' followed by 'rm'. | 625990148c3a8732951f726f |
class PluginBase(metaclass=abc.ABCMeta): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> @abc.abstractmethod <NEW_LINE> def get_code(cls): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.get_code() | Base class definition for plugin. | 62599014be8e80087fbbfd7f |
class F99(GenericCurve): <NEW_LINE> <INDENT> def __init__(self, var=False): <NEW_LINE> <INDENT> self.default_pars(var=var) <NEW_LINE> self._f = self.f_90 <NEW_LINE> <DEDENT> def default_pars(self, var=False): <NEW_LINE> <INDENT> p = {} <NEW_LINE> p['R_v'] = 3.1 + var * normal(0, 0.6) <NEW_LINE> p['ospline_x'] = 1e4 / n... | Fitzpatrick 1999 R_v dependent extinction curves. These are a
one parameter family, though in practice we allow the bump
strength to vary. | 6259901456b00c62f0fb35cc |
class IcmpCode(Field): <NEW_LINE> <INDENT> pass | A icmp-code field. | 62599014462c4b4f79dbc717 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.