code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class QXmlNodeModelIndex(__sip.simplewrapper): <NEW_LINE> <INDENT> def additionalData(self): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> def data(self): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> def internalPointer(self): <NEW_LINE> <INDENT> return object() <NEW_LINE> <DEDENT> def isNull(self): <NEW_LINE> <... | QXmlNodeModelIndex()
QXmlNodeModelIndex(QXmlNodeModelIndex) | 62598f96004d5f362081ee74 |
class WechatSogouBase(object): <NEW_LINE> <INDENT> pass | 爬虫最基类 | 62598f964527f215b58e9bd4 |
class MotionParameters(object): <NEW_LINE> <INDENT> def __init__(self, X0, Z0, V0, THETA_MAX, F, PHI): <NEW_LINE> <INDENT> self.X0 = X0 <NEW_LINE> self.Z0 = Z0 <NEW_LINE> self.V0 = V0 <NEW_LINE> self.THETA_MAX = THETA_MAX <NEW_LINE> self.F = F <NEW_LINE> self.PHI = PHI | A collection of parameters related to a swimmer's path of motion.
Attributes:
X0, Z0: Initial position of the leading edge (absolute frame).
V0: Free-stream velocity.
THETA_MAX: Maximum pitching angle of the body.
F: Frequency of the body's pitching motion.
PHI: Phase offset of the body's pitching ... | 62598f96b5575c28eb712b44 |
class StatusSerializer(serializers.HyperlinkedModelSerializer): <NEW_LINE> <INDENT> artifacts = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='usertaskartifact-detail', lookup_field='uuid') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = UserTaskStatus <NEW_LINE> fields = ( 'name', 'state'... | REST API serializer for the UserTaskStatus model. | 62598f9630dc7b766599f543 |
class SegmentConfigureInfo(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Switch = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Switch = params.get("Switch") | Control parameter of video splitting recognition task
| 62598f9607f4c71912baf13c |
class ManifestContent(ManifestChrome): <NEW_LINE> <INDENT> type = 'content' <NEW_LINE> allowed_flags = ManifestChrome.allowed_flags + [ 'contentaccessible', 'platform', ] <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.serialize(self.name, self.relpath) | Class for 'content' entries.
content global content/global/ | 62598f96baa26c4b54d4efa0 |
class VeraLock(VeraDevice, LockDevice): <NEW_LINE> <INDENT> def __init__(self, vera_device, controller): <NEW_LINE> <INDENT> self._state = None <NEW_LINE> VeraDevice.__init__(self, vera_device, controller) <NEW_LINE> self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id) <NEW_LINE> <DEDENT> def lock(self, **kwargs): <N... | Representation of a Vera lock. | 62598f964428ac0f6e65821b |
class TestSwitch(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.hass = get_test_home_assistant() <NEW_LINE> platform = getattr(self.hass.components, "test.switch") <NEW_LINE> platform.init() <NEW_LINE> self.switch_1, self.switch_2, self.switch_3 = platform.ENTITIES <NEW_LINE> <DEDENT>... | Test the switch module. | 62598f9685dfad0860cbf8ec |
class TestReportScope(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 testReportScope(self): <NEW_LINE> <INDENT> pass | ReportScope unit test stubs | 62598f96d7e4931a7ef3bd94 |
class V1TagImportPolicy(object): <NEW_LINE> <INDENT> operations = [ ] <NEW_LINE> swagger_types = { 'insecure': 'bool', 'scheduled': 'bool' } <NEW_LINE> attribute_map = { 'insecure': 'insecure', 'scheduled': 'scheduled' } <NEW_LINE> def __init__(self, insecure=None, scheduled=None): <NEW_LINE> <INDENT> self._insecure = ... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f9656b00c62f0fb25a0 |
class OBJECT_OT_RemoveLimitDOFButton(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "mocap.removelimitdof" <NEW_LINE> bl_label = "Remove DOF Constraints" <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> mocap_tools.limit_dof_toggle_off(context, context.active_object) <NEW_LINE> return {'FINISHED'} <NEW_... | Remove previously created limit constraints on the active armature | 62598f9691af0d3eaad39af9 |
class TelnetDevice(object): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.ip_addr = kwargs.get('ip_addr') <NEW_LINE> self.username = kwargs.get('username') <NEW_LINE> self.password = kwargs.get('password') <NEW_LINE> self.telnet_port = kwargs.get('telnet_port', 23) <NEW_LINE> self.te... | Class details here | 62598f96442bda511e95c156 |
class BatchCreator(Process): <NEW_LINE> <INDENT> def __init__(self, data_store, event): <NEW_LINE> <INDENT> super(BatchCreator, self).__init__() <NEW_LINE> self.ds = data_store <NEW_LINE> self.batch_size = self.ds.batch_size <NEW_LINE> self.is_stop = False <NEW_LINE> self.max_batches = self.ds.max_batches <NEW_LINE> se... | Responsible for creating batches from the created samples | 62598f9607d97122c42169a3 |
class Solution: <NEW_LINE> <INDENT> @timeit <NEW_LINE> def removeBoxes(self, boxes: List[int]) -> int: <NEW_LINE> <INDENT> from functools import lru_cache <NEW_LINE> @lru_cache(None) <NEW_LINE> def dfs(i, j, k): <NEW_LINE> <INDENT> if i > j: return 0 <NEW_LINE> while i < j and boxes[i] == boxes[i+1]: <NEW_LINE> <INDENT... | [546. 移除盒子](https://leetcode-cn.com/problems/remove-boxes) | 62598f967b25080760ed7193 |
class MTCoh(AdjacencyPipe): <NEW_LINE> <INDENT> def __init__(self, time_band, n_taper, cf): <NEW_LINE> <INDENT> check_type(time_band, float) <NEW_LINE> check_type(n_taper, int) <NEW_LINE> check_type(cf, list) <NEW_LINE> if n_taper >= 2*time_band: <NEW_LINE> <INDENT> raise Exception('Number of tapers must be less than 2... | MTCoh pipe for spectral coherence estimation using
multitaper methods
Parameters
----------
time_band: float
The time half bandwidth resolution of the estimate [-NW, NW];
such that resolution is 2*NW
n_taper: int
Number of Slepian sequences to use (Usually < 2*NW-1)
cf: list
... | 62598f96f7d966606f747cd7 |
class PrivateKey: <NEW_LINE> <INDENT> def __init__(self, key, password=None): <NEW_LINE> <INDENT> with reraise_errors( 'Invalid private key: {0!r}', errors=(ValueError,) ): <NEW_LINE> <INDENT> self._key = serialization.load_pem_private_key( ensure_bytes(key), password=password, backend=default_backend()) <NEW_LINE> <DE... | Represents a private key. | 62598f96a8ecb03325870efb |
class DaysOfWeekRepresentationTestCase(WgerTestCase): <NEW_LINE> <INDENT> def test_representation(self): <NEW_LINE> <INDENT> self.assertEqual(f"{DaysOfWeek.objects.get(pk=1)}", 'Monday') | Test the representation of a model | 62598f967d847024c075c0c5 |
class AppearanceFormNew(BetterForm, TemplateForm): <NEW_LINE> <INDENT> name = forms.CharField(label=_('Affiliated Organisation Name')) <NEW_LINE> location = forms.CharField(label=_('Location')) <NEW_LINE> url = forms.URLField(label=_('URL'), required=False) <NEW_LINE> datetime = forms.DateTimeField... | Appearance admin | 62598f963539df3088ecbfb3 |
class PDEntryTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> comp = Composition("LiFeO2") <NEW_LINE> self.entry = PDEntry(comp, 53) <NEW_LINE> self.gpentry = GrandPotPDEntry(self.entry, {Element('O'): 1.5}) <NEW_LINE> <DEDENT> def test_get_energy(self): <NEW_LINE> <INDENT> self.assertE... | Test all functions using a ficitious entry | 62598f96851cf427c66b7fb8 |
class UpdateLiveWatermarkRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.WatermarkId = None <NEW_LINE> self.PictureUrl = None <NEW_LINE> self.XPosition = None <NEW_LINE> self.YPosition = None <NEW_LINE> self.WatermarkName = None <NEW_LINE> self.Width = None <NEW_LINE> self.Heigh... | UpdateLiveWatermark请求参数结构体
| 62598f96097d151d1a2c0d14 |
class NoSuchMethodError(Exception): <NEW_LINE> <INDENT> pass | Indicates that an unrecognized operation has been called. | 62598f962ae34c7f260aadd3 |
class DatabaseSingleton: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> global _db <NEW_LINE> if _db is None: <NEW_LINE> <INDENT> _db = connect(DATA_FILE) <NEW_LINE> <DEDENT> <DEDENT> def get_db(self) -> Connection: <NEW_LINE> <INDENT> global _db <NEW_LINE> return _db <NEW_LINE> <DEDENT> def close(self): <... | Recycling is good! Let's recycle db connection objects :3 | 62598f96d99f1b3c44d053a2 |
class MultiTerm(Query): <NEW_LINE> <INDENT> TOO_MANY_CLAUSES = 1024 <NEW_LINE> constantscore = False <NEW_LINE> def _words(self, ixreader): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def simplify(self, ixreader): <NEW_LINE> <INDENT> existing = [Term(self.fieldname, word, boost=self.boost) for wor... | Abstract base class for queries that operate on multiple terms in the
same field. | 62598f96e5267d203ee6b60b |
class GetAsyncEventStatusResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Result = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("Result") is not None: <NEW_LINE> <INDENT> self.Result = AsyncEventStatu... | GetAsyncEventStatus返回参数结构体
| 62598f960a50d4780f7050ca |
class Config: <NEW_LINE> <INDENT> NEWS_SOURCE_API_BASE_URL= 'https://newsapi.org/v2/sources?apiKey=2ac4f1aeb1c84eba9807e140b299880e' <NEW_LINE> NEWS_API_BASE_URL= 'https://newsapi.org/v2/everything?sources={}&apiKey={}' <NEW_LINE> NEWS_API_KEY ='2ac4f1aeb1c84eba9807e140b299880e' | General configuration parent class | 62598f964428ac0f6e65821d |
class TimeItem(object): <NEW_LINE> <INDENT> __slots__ = ('data', 'use_at') <NEW_LINE> def __init__(self, data, use_at): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.use_at = use_at <NEW_LINE> <DEDENT> def __hash__(self): <NEW_LINE> <INDENT> return hash(self.data) <NEW_LINE> <DEDENT> def __gt__(self, other): <NE... | Used for Cooldown. | 62598f9629b78933be269f56 |
class VersionedSignallingSession(SignallingSession): <NEW_LINE> <INDENT> def delete(self, instance): <NEW_LINE> <INDENT> if isinstance(instance, HistorySnapshot): <NEW_LINE> <INDENT> if not hasattr(g, "__allow_deleting_history__"): <NEW_LINE> <INDENT> raise ChrononautException("Cannot remove version info") <NEW_LINE> <... | A subclass of Flask-SQLAlchemy's SignallingSession that supports
versioned and change info session information. | 62598f96287bf620b62718b2 |
class NetworkLineStyleDelegate(QStyledItemDelegate): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> super(NetworkLineStyleDelegate, self).__init__(parent) <NEW_LINE> log.debug_log("Set up line style delegate") <NEW_LINE> <DEDENT> def createEditor(self, parent, option, index): <NEW_LINE> <INDEN... | Draws the colored/styled network line in a QTableView cell | 62598f96460517430c431ed2 |
class ZiCommentCommand(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def run(self, edit): <NEW_LINE> <INDENT> region = self.view.sel() <NEW_LINE> wordreg = self.view.line(region[0]) <NEW_LINE> word = self.view.substr(wordreg) <NEW_LINE> indentation = " " * word.count(" ") <NEW_LINE> word = word.lstrip() <NEW_LINE> w... | Add special art symbols all around the selection | 62598f96507cdc57c63a4a87 |
class Table(with_metaclass(TableMeta)): <NEW_LINE> <INDENT> classes = [] <NEW_LINE> allow_sort = False <NEW_LINE> no_items = 'No Items' <NEW_LINE> def __init__(self, items, classes=None, sort_by=None, sort_reverse=False, no_items=None): <NEW_LINE> <INDENT> self.items = items <NEW_LINE> self.sort_by = sort_by <NEW_LINE>... | The main table class that should be subclassed when to create a
table. Initialise with an iterable of objects. Then either use the
__html__ method, or just output in a template to output the table
as html. Can also set a list of classes, either when declaring the
table, or when initialising. Can also set the text to di... | 62598f96627d3e7fe0e06b9b |
class Feed(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=255) <NEW_LINE> feed_url = models.URLField(max_length=255, unique=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> ordering = ('name',) | Feed model | 62598f963c8af77a43b67db5 |
class UserInfo(AbstractUser): <NEW_LINE> <INDENT> nid = models.AutoField(primary_key=True) <NEW_LINE> phone = models.CharField(max_length=11, null=True, unique=True) <NEW_LINE> avatar = models.FileField(upload_to="avatars/", default="avatars/default.png", verbose_name="头像") <NEW_LINE> create_time = models.DateTimeField... | 用户信息表 | 62598f961f037a2d8b9e3dd6 |
class WeatherAPIError(AppError): <NEW_LINE> <INDENT> pass | An exception when there is an error in the weather API. | 62598f96236d856c2adc92b1 |
class AntList(pygame.sprite.Group): <NEW_LINE> <INDENT> pass | List of dinosaurs
inherited methods:
.add adds a sprite to group
.remove removes a sprite from group
.update runs update method of every sprite in group
.draw blits the image of every sprite in group | 62598f96be8e80087fbbed51 |
class AjaxPathSearch(SpacesMixin, ListView): <NEW_LINE> <INDENT> model = Article <NEW_LINE> def dispatch(self, *args, **kwargs): <NEW_LINE> <INDENT> keyword = CharField(required=False).clean(kwargs['keyword']) <NEW_LINE> self.keyword = keyword <NEW_LINE> return super(AjaxPathSearch, self).dispatch(*args, **kwargs) <NEW... | Return a JSON-formatted list of URIs whose page titles contain the
given search string. | 62598f96442bda511e95c158 |
class Capabilities: <NEW_LINE> <INDENT> def __init__( self, dialect: str, *, daemon: bool = True, requires_limit: bool = False, inline_comment: bool = False, supports_transactions: bool = True, support_for_update: bool = True, ) -> None: <NEW_LINE> <INDENT> super().__setattr__("_mutable", True) <NEW_LINE> self.dialect ... | DB Client Capabilities indicates the supported feature-set,
and is also used to note common workarounds to deficiencies.
Defaults are set with the following standard:
* Deficiencies: assume it is working right.
* Features: assume it doesn't have it.
:param dialect: Dialect name of the DB Client driver.
:param daemon... | 62598f96d6c5a102081e1e37 |
class Phonetic(object): <NEW_LINE> <INDENT> def __init__(self, vowels=VOWELS): <NEW_LINE> <INDENT> self.vowels = vowels <NEW_LINE> <DEDENT> def syllables_count(self, word): <NEW_LINE> <INDENT> return sum((ch in self.vowels) for ch in word) <NEW_LINE> <DEDENT> def sound_distance(self, word1, word2): <NEW_LINE> <INDENT> ... | Объект для работы с фонетическими формами слова | 62598f96f8510a7c17d7dff1 |
class NotEmptyError(ReviewError): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> ReviewError.__init__(self, "The result dir is not empty") <NEW_LINE> self.show_logs = False | The resultdir is not empty. | 62598f9632920d7e50bc5d4c |
class DeviceClusterInterfaceContext(resource.AciResourceBase): <NEW_LINE> <INDENT> identity_attributes = t.identity( ('tenant_name', t.name), ('contract_name', t.name), ('service_graph_name', t.name), ('node_name', t.name), ('connector_name', t.name)) <NEW_LINE> other_attributes = t.other( ('display_name', t.name), ('d... | Resource representing a device-cluster logical interface context.
| 62598f964a966d76dd5eebd4 |
class Solution1: <NEW_LINE> <INDENT> def isPowerOfFour(self, n: int) -> bool: <NEW_LINE> <INDENT> return n > 0 and (2 ** 30) % sqrt(n) == 0 | 若 n 为 4 的幂,则开平方后为 2 的幂。
这是问题就转化为 sqrt(n) 是否为 2 的幂的问题。 | 62598f968a43f66fc4bf1e6f |
class MacAddress: <NEW_LINE> <INDENT> _address: str <NEW_LINE> def __init__( self, mac_address: str, logger: 'libioc.Logger.Logger' ) -> None: <NEW_LINE> <INDENT> self.logger = libioc.helpers_object.init_logger(self, logger) <NEW_LINE> self.address = mac_address <NEW_LINE> <DEDENT> @property <NEW_LINE> def address(self... | Representation of a NICs hardware address. | 62598f9682261d6c5272fd51 |
class CreateOrUpdatePersonalExtensionTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> program = program_utils.seedProgram() <NEW_LINE> self.survey = seeder_logic.seed(soc_survey_model.Survey) <NEW_LINE> self.survey_key = ndb.Key.from_old_key(self.survey.key()) <NEW_LINE> self.profile = ... | Unit tests for createOrUpdatePersonalExtension function. | 62598f9610dbd63aa1c708aa |
class UpgradeAnalysisProblem(object): <NEW_LINE> <INDENT> def __init__(self, obj: object, message: str): <NEW_LINE> <INDENT> self.__obj = obj <NEW_LINE> self.__message = message <NEW_LINE> if message is None or len(message.strip()) <= 0: <NEW_LINE> <INDENT> raise Exception("invalid message") <NEW_LINE> <DEDENT> <DEDENT... | A problem discovered in the analysis of the upgrade definition | 62598f96a79ad16197769d56 |
class Secret(Yedit): <NEW_LINE> <INDENT> secret_path = "data" <NEW_LINE> kind = 'secret' <NEW_LINE> def __init__(self, content): <NEW_LINE> <INDENT> super(Secret, self).__init__(content=content) <NEW_LINE> self._secrets = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def secrets(self): <NEW_LINE> <INDENT> if self._secr... | Class to wrap the oc command line tools | 62598f9676e4537e8c3ef2a8 |
class WeiboLogin(LoginBase): <NEW_LINE> <INDENT> def login(self, args): <NEW_LINE> <INDENT> log.info("login from Weibo Sina") <NEW_LINE> code = args.get("code") <NEW_LINE> access_token = self.get_token(code) <NEW_LINE> user_info = self.get_user_info(access_token["access_token"], access_token["uid"]) <NEW_LINE> name = u... | Sign in with weibo
:Example:
from client.user.login import WeiboLogin
WeiboLogin()
.. notes:: | 62598f96d486a94d0ba2bcc9 |
class AssignShipmentOut(Wizard): <NEW_LINE> <INDENT> __name__ = 'stock.shipment.out.assign' <NEW_LINE> start = StateTransition() <NEW_LINE> failed = StateView('stock.shipment.out.assign.failed', 'stock.shipment_out_assign_failed_view_form', [ Button('Force Assign', 'force', 'tryton-forward', states={ 'invisible': ~Id('... | Assign Customer Shipment | 62598f969c8ee8231303ffe9 |
class UserDefinedFunction(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def __get__(self, instance, cls=None): <NEW_LINE> <INDENT> if instance is None: <NEW_LINE> <INDENT> return partial(cls._register_override_method, self.name) <NEW_LINE> <DEDENT> retur... | Descriptor to specify a UserDefinedFunction.
Defined in CustomViewer like this:
class CustomViewer(object):
...
plot_data = UserDefinedFunction('plot_data')
The descriptor gives CustomViewer.plot_data a dual functionality.
When accessed at the class level, it behaves as a decorator to
register new UDFs:... | 62598f9601c39578d7f12a7b |
class Relation(ModelBase): <NEW_LINE> <INDENT> RELATION_ID_DELIMITER = u"," <NEW_LINE> _meta = {'table_name':'bloodhound_relations', 'object_name':'Relation', 'key_fields':['source', 'type', 'destination'], 'non_key_fields':[ 'comment', 'author', {'name': 'time','type': 'int64'}, ], 'no_change_fields':['source', 'desti... | The Relation table | 62598f96507cdc57c63a4a89 |
class Namer(object): <NEW_LINE> <INDENT> def __init__(self, global_namespace): <NEW_LINE> <INDENT> self.global_namespace = global_namespace <NEW_LINE> self.generated_names = set() <NEW_LINE> <DEDENT> def _as_symbol_name(self, fqn, style=_NamingStyle.SNAKE): <NEW_LINE> <INDENT> assert style in _NamingStyle <NEW_LINE> if... | Symbol name generator. | 62598f9671ff763f4b5e746d |
class AVScanner(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> log.setLevel(logging.INFO) <NEW_LINE> log.info('Initialize module AntiVirus Scanner') <NEW_LINE> self.avs = None <NEW_LINE> if AV_INIT: <NEW_LINE> <INDENT> if self.initialize(): <NEW_LINE> <INDENT> log.info(self.avs.version()) <NEW_LIN... | AntiVirus Scanner | 62598f963c8af77a43b67db6 |
class SplitSecretStore(object): <NEW_LINE> <INDENT> def __init__(self, shards, required): <NEW_LINE> <INDENT> self.shards = shards <NEW_LINE> self.required = required <NEW_LINE> <DEDENT> def polynomial(self, constant, order): <NEW_LINE> <INDENT> return numpy.polynomial.Polynomial([constant] + [ random.randint(0, 100) f... | A class capable of splitting and reassembly a secret.
.. warning::
This class currently doesn't implement Shamir's secret sharing algorithm
using finite field arithmetic, which means that an attacker learns
increasingly more about your secret with each shard they compromise.
:param shards: The number of shards... | 62598f968da39b475be02ed8 |
class STATe(SCPINode, SCPIBool): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "STATe" <NEW_LINE> args = ["1", "ON", "OFF"] | AMPLitude:SOURce:STATe
Arguments: 1, ON, OFF | 62598f9685dfad0860cbf8ee |
class MaterialCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): <NEW_LINE> <INDENT> model = Material <NEW_LINE> fields = ["material", "mat_group"] <NEW_LINE> permission_required = ["offers.add_material"] | Add a new material | 62598f961b99ca400228f3a7 |
class PrettyTimeDelegate(QtWidgets.QStyledItemDelegate): <NEW_LINE> <INDENT> def displayText(self, value, locale): <NEW_LINE> <INDENT> return pretty_timestamp(value) | A delegate that displays a timestamp as a pretty date.
This displays dates like `pretty_date`. | 62598f9694891a1f408b956b |
class Overrides: <NEW_LINE> <INDENT> def __init__(self, session): <NEW_LINE> <INDENT> self.session = session <NEW_LINE> <DEDENT> def get_year(self, year): <NEW_LINE> <INDENT> for_year = [] <NEW_LINE> for instance in self.session.query(Override). options(joinedload(Override.services)). filt... | Class for fetching custom overrides to be placed over the static calendar | 62598f96f7d966606f747cdb |
class ListStoreModel (Model, gtk.ListStore): <NEW_LINE> <INDENT> __metaclass__ = support.metaclasses.ObservablePropertyGObjectMeta <NEW_LINE> def __init__(self, column_type, *args): <NEW_LINE> <INDENT> Model.__init__(self) <NEW_LINE> gtk.ListStore.__init__(self, column_type, *args) | Use this class as base class for your model derived by
gtk.ListStore | 62598f9645492302aabfc1ce |
class getAllContactIdsForChannel_result(object): <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.LIST, 'success', (TType.STRING, 'UTF8', False), None, ), (1, TType.STRUCT, 'e', (TalkException, TalkException.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None, e=None,): <NEW_LINE> <INDENT> self.success = s... | Attributes:
- success
- e | 62598f967d847024c075c0c9 |
class bars: <NEW_LINE> <INDENT> def __init__(self, x, y, z, h, width=0.05, thick = 0.05, barcolor=(1,1,1), axis=(1,0,0)): <NEW_LINE> <INDENT> self.bars=[vp.box(length=width, width=thick, color=barcolor, axis=axis) for i in range(len(x))] <NEW_LINE> self.move(x, y, z, h) <NEW_LINE> <DEDENT> def move(self, x, y, z, h): <... | create a bar graph over points x[], y[], z[],
with height h[] at each point (along y-axis).
optionally, specify width, thckness, color, and axis | 62598f9616aa5153ce4001f2 |
@conbench.runner.register_benchmark <NEW_LINE> class RecordCppMicroBenchmarks(_benchmark.Benchmark): <NEW_LINE> <INDENT> external = True <NEW_LINE> name = "cpp-micro" <NEW_LINE> options = copy.deepcopy(COMMON_OPTIONS) <NEW_LINE> options.update(**RUN_OPTIONS) <NEW_LINE> description = "Run the Arrow C++ micro benchmarks.... | Run the Arrow C++ micro benchmarks. | 62598f964a966d76dd5eebd7 |
class Foo1: <NEW_LINE> <INDENT> def __init__(self, firstname, lastname): <NEW_LINE> <INDENT> self.firstname = firstname <NEW_LINE> self.lastname = lastname | Now to handle both Foo v0 and Foo v1 we need to add more code ... | 62598f9623e79379d538c1f8 |
class InitializerList(Intermediate): <NEW_LINE> <INDENT> def __init__(self, prev, relativeOrder, *args): <NEW_LINE> <INDENT> super().__init__(prev, relativeOrder) <NEW_LINE> assert 1 <= relativeOrder <= 4 <NEW_LINE> if relativeOrder == 1: <NEW_LINE> <INDENT> assert len(args) == 2 <NEW_LINE> self.initializerList = [(arg... | :type initializerList: list[Initializer|(Designation, Initializer)] | 62598f96e5267d203ee6b60f |
class AttributeChanger(base.Change): <NEW_LINE> <INDENT> def __init__(self, filename, user=None, group=None, mode=None): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> self.user = user <NEW_LINE> self.group = group <NEW_LINE> self.mode = mode <NEW_LINE> self.changed = False <NEW_LINE> <DEDENT> def apply(self, ... | Make the changes required to a file's attributes | 62598f964527f215b58e9bda |
class VerletListAdressLennardJonesCappedLocal(InteractionLocal, interaction_VerletListAdressLennardJonesCapped): <NEW_LINE> <INDENT> def __init__(self, vl, fixedtupleList): <NEW_LINE> <INDENT> if not (pmi._PMIComm and pmi._PMIComm.isActive()) or pmi._MPIcomm.rank in pmi._PMIComm.getMPIcpugroup(): <NEW_LINE> <INDENT> cx... | The (local) Lennard Jones interaction using Verlet lists. | 62598f96009cb60464d0121b |
class FilterMatcher(WrappingMatcher): <NEW_LINE> <INDENT> def __init__(self, child, ids, exclude=False, boost=1.0): <NEW_LINE> <INDENT> super(FilterMatcher, self).__init__(child) <NEW_LINE> self._ids = ids <NEW_LINE> self._exclude = exclude <NEW_LINE> self.boost = boost <NEW_LINE> self._find_next() <NEW_LINE> <DEDENT> ... | Filters the postings from the wrapped based on whether the IDs are
present in or absent from a set. | 62598f96eab8aa0e5d30ba7a |
class CalculatorLoom(object): <NEW_LINE> <INDENT> def __init__(self, embedding_length): <NEW_LINE> <INDENT> self._embedding_length = embedding_length <NEW_LINE> self._named_tensors = {} <NEW_LINE> for n in xrange(10): <NEW_LINE> <INDENT> name = 'terminal_' + str(n) <NEW_LINE> self._named_tensors[name] = tf.Variable( tf... | Wraps a Loom so it can accept CalculatorExpressions. | 62598f96e76e3b2f99fd872b |
class course_dec(dc.Decimal): <NEW_LINE> <INDENT> def __call__(self, cls): <NEW_LINE> <INDENT> return dc.Decimal(self / cls.course).quantize(dc.Decimal('.01')) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return str(self.quantize(dc.Decimal('.01'))) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDE... | Класс, наследуемый от Decimal определяющий метод call | 62598f968e7ae83300ee8d93 |
class ExternalNode(gpi.NodeAPI): <NEW_LINE> <INDENT> def initUI(self): <NEW_LINE> <INDENT> self.addWidget('OpenFileBrowser', 'input-file', button_title='Browse', caption='Open File') <NEW_LINE> self.addWidget('PushButton', 'reverse-dims', toggle=True, val=False, collapsed=True) <NEW_LINE> self.addOutPort(title='image',... | Read data and affine matrix from files supported by NiBabel
Supported formats (see http://nipy.org/nibabel for more info):
* ANALYZE (plain, SPM99, SPM2 and later)
* GIFTI
* NIfTI1, NIfTI2
* MINC1, MINC2
* MGH
* ECAT
* Philips PAR/REC
OUTPUT:
image: image data as N-D NumPy array
affi... | 62598f96627d3e7fe0e06b9f |
class KaggleValidationLogLossObjective(LogLossObjective): <NEW_LINE> <INDENT> def __init__(self, input_layers, *args, **kwargs): <NEW_LINE> <INDENT> super(KaggleValidationLogLossObjective, self).__init__(input_layers, *args, **kwargs) <NEW_LINE> self.target_vars["systole"] = T.fmatrix("systole_target_kaggle") <NEW_LIN... | This is the objective as defined by Kaggle: https://www.kaggle.com/c/second-annual-data-science-bowl/details/evaluation | 62598f9663d6d428bbee24b4 |
class Class(Base): <NEW_LINE> <INDENT> __tablename__ = 'class' <NEW_LINE> name = JSONColumn(String, primary_key=True, doc="Class name") <NEW_LINE> powersource_name = JSONColumn(String, ForeignKey('powersource.name'), doc="Class's power source") <NEW_LINE> role = JSONColumn(Enum('Leader', 'Controller', 'Striker', 'Defen... | Character classes | 62598f96379a373c97d98d09 |
class PNIOServiceReqPDU(Packet): <NEW_LINE> <INDENT> fields_desc = [ EndiannessField( FieldLenField("args_max", None, fmt="I", length_of="blocks"), endianess_from=dce_rpc_endianess), NDRData, ] <NEW_LINE> overload_fields = { DceRpc: { "object_uuid": RandUUID("dea00000-6c97-11d1-8271-******"), "interface_uuid": RPC_INTE... | PNIO PDU for RPC Request | 62598f96379a373c97d98d0a |
class StateObject(netlib.basetypes.Serializable): <NEW_LINE> <INDENT> _stateobject_attributes = None <NEW_LINE> def get_state(self): <NEW_LINE> <INDENT> state = {} <NEW_LINE> for attr, cls in six.iteritems(self._stateobject_attributes): <NEW_LINE> <INDENT> val = getattr(self, attr) <NEW_LINE> if val is None: <NEW_LINE>... | An object with serializable state.
State attributes can either be serializable types(str, tuple, bool, ...)
or StateObject instances themselves. | 62598f96f7d966606f747cdc |
class PlotHorizontalSpectrogramPRNU(Emva1288Plot): <NEW_LINE> <INDENT> name = 'Horizontal spectrogram PRNU' <NEW_LINE> xlabel = 'cycles [periods/pixel]' <NEW_LINE> ylabel = 'Standard deviation and\nrelative presence of each cycle [%]' <NEW_LINE> yscale = 'log' <NEW_LINE> def plot(self, test): <NEW_LINE> <INDENT> ax = s... | Create Horizontal spectrogram PRNU plot | 62598f963617ad0b5ee05e44 |
class ImageDiffDB(object): <NEW_LINE> <INDENT> def __init__(self, storage_root): <NEW_LINE> <INDENT> self._storage_root = storage_root <NEW_LINE> self._diff_dict = {} <NEW_LINE> <DEDENT> def add_image_pair(self, expected_image_url, expected_image_locator, actual_image_url, actual_image_locator): <NEW_LINE> <INDENT> exp... | Calculates differences between image pairs, maintaining a database of
them for download. | 62598f9623849d37ff850dbd |
class EnumInstance(storageType): <NEW_LINE> <INDENT> @property <NEW_LINE> def core(self): <NEW_LINE> <INDENT> return super(EnumInstance, self).core <NEW_LINE> <DEDENT> @core.setter <NEW_LINE> def core(self, val): <NEW_LINE> <INDENT> if val not in valuesDict.values(): <NEW_LINE> <INDENT> raise CorruptedData <NEW_LINE> <... | Enum class that wraps a storageType.
Requires the wrapped type's values conform to the known set of enum values.
This set of enum values was allocated when the field type was created. | 62598f96fff4ab517ebcd4e4 |
class LeNetConvPoolLayer(object): <NEW_LINE> <INDENT> def __init__(self, rng, input, filter_shape, image_shape, poolsize=(2, 2), stride=(1, 1)): <NEW_LINE> <INDENT> assert image_shape[1] == filter_shape[1] <NEW_LINE> self.input = input <NEW_LINE> fan_in = np.prod(filter_shape[1:]) <NEW_LINE> fan_out = (filter_shape[0] ... | Pool Layer of a convolutional network
from:
https://github.com/lisa-lab/DeepLearningTutorials/blob/master/code/convolutional_mlp.py | 62598f964e4d562566372119 |
class Host(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.logger = logging.getLogger('mafiapartygamebot.Host') <NEW_LINE> self.logger.info('host initialized') <NEW_LINE> self.games = [] <NEW_LINE> <DEDENT> def create_game(self, chat_id, user): <NEW_LINE> <INDENT> game = self.get_game(chat_id)... | host | 62598f967cff6e4e811b5716 |
class ExpressRouteCircuitsRoutesTableSummaryListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuitRoutesTableSummary]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super... | Response for ListRoutesTable associated with the Express Route Circuits API.
:param value: A list of the routes table.
:type value: list[~azure.mgmt.network.v2020_04_01.models.ExpressRouteCircuitRoutesTableSummary]
:param next_link: The URL to get the next set of results.
:type next_link: str | 62598f96dd821e528d6d8c2c |
class BusinessForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Business <NEW_LINE> exclude = ('members', 'slug', 'tags') | Form that holds all info on for a particular business
| 62598f96498bea3a75a57817 |
class BaseTag(template.django.template.Node): <NEW_LINE> <INDENT> _tpl = "" <NEW_LINE> _paramsRequired = [] <NEW_LINE> _paramsOptional = [] <NEW_LINE> def __init__(self, params): <NEW_LINE> <INDENT> self.params = {} <NEW_LINE> self.template = Template( self._tpl ) <NEW_LINE> self._formatList( params ) <NEW_LINE> <DEDEN... | Base class for simple Django tags
Example of a template:
_tpl = "Required param=$param, optional $oparam_key$oparam_value"
_paramsRequired = ['param',]
_paramsOptional = [['oparam_value','oparam_key','oparam_key_label','default'],]
The list _paramsOptional contains lists where the first item
specified the option... | 62598f9655399d3f05626217 |
class FactorSet: <NEW_LINE> <INDENT> def __init__(self, *factors_list): <NEW_LINE> <INDENT> from copy import deepcopy <NEW_LINE> if not all(isinstance(phi, Factor) for phi in factors_list): <NEW_LINE> <INDENT> raise TypeError("Input parameters must be all factors") <NEW_LINE> <DEDENT> self.factors = set(deepcopy(factor... | Base class of *Factor Sets*.
A factor set provides a compact representation of higher dimensial factor
:math:`\phi_1\cdot\phi_2\cdots\phi_n`
For example the factor set corresponding to factor :math:`\phi_1\cdot\phi_2` would be the union of the factors
:math:`\phi_1` and :math:`\phi_2` i.e. factor set :math:`\vec\phi... | 62598f960c0af96317c5607b |
class ResumeTest(_CommandWithFlags): <NEW_LINE> <INDENT> def __init__(self, parentmenu, name, helpshort=None, helpfull="Resume testing"): <NEW_LINE> <INDENT> super().__init__(parentmenu, name, helpshort, helpfull) <NEW_LINE> <DEDENT> def execute(self, *args): <NEW_LINE> <INDENT> if len(args) > 0: <NEW_LINE> <INDENT> se... | A command that resumes the automatic execution of test commands after being
interrupted to ask for user input. | 62598f964a966d76dd5eebd9 |
class Face(object): <NEW_LINE> <INDENT> def __init__(self, res, path, size=75): <NEW_LINE> <INDENT> super(Face, self).__init__() <NEW_LINE> self.path = path <NEW_LINE> img = 'C:/Users/dhavalma/AnacondaProjects/FR_HAA/FaceDetect/test/0_Parade_marchingband_1_709.jpg' <NEW_LINE> self.bmp = img.ConvertToBitmap() <NEW_LINE>... | Face Model for each face. | 62598f9699cbb53fe6830bc8 |
class FileMinimalView(StandardView): <NEW_LINE> <INDENT> title = _(u'minimal') <NEW_LINE> def getBUFile(self): <NEW_LINE> <INDENT> acc = self.context.Schema()['file'].getAccessor(self.context)() <NEW_LINE> return acc | File for download in one line. | 62598f96435de62698e9baec |
class AdaptorExtEthIfFsmTask(ManagedObject): <NEW_LINE> <INDENT> consts = AdaptorExtEthIfFsmTaskConsts() <NEW_LINE> naming_props = set(['item']) <NEW_LINE> mo_meta = MoMeta("AdaptorExtEthIfFsmTask", "adaptorExtEthIfFsmTask", "task-[item]", VersionMeta.Version111j, "OutputOnly", 0xf, [], [""], ['adaptorExtEthIf'], [], [... | This is AdaptorExtEthIfFsmTask class. | 62598f964e4d56256637211a |
class Zipper(object): <NEW_LINE> <INDENT> def __init__(self, min_val, max_val, callback): <NEW_LINE> <INDENT> self.min_val = min_val <NEW_LINE> self.max_val = max_val <NEW_LINE> self.callback = callback <NEW_LINE> self.index = min_val <NEW_LINE> <DEDENT> def on_key_press(self, event): <NEW_LINE> <INDENT> prev_index = s... | Keeps an index and allows changing it with on_key_press().
Calls self.callback(index) when the index is changed. | 62598f9676e4537e8c3ef2ab |
class GitUtility(RequestHandler): <NEW_LINE> <INDENT> def get_repo_url(self, github_username = None): <NEW_LINE> <INDENT> return "https://api.github.com/users/{}/repos?sort=created&direction=desc".format(github_username) <NEW_LINE> <DEDENT> def get_followers_url(self, github_username = None): <NEW_LINE> <INDENT> return... | This class for handling git Api's . | 62598f96596a897236127977 |
class DfuzzWrapper(object): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return 'undefined wrapper, add __str__ method' <NEW_LINE> <DEDENT> def system(self, command): <NEW_LINE> <INDENT> logging.debug('Executing: %s', command) <NEW_LINE> pr = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, s... | Abstract class to be used as base for
new wrappers or standalone fuzzers | 62598f96a79ad16197769d5a |
class RegistroI151(Registro): <NEW_LINE> <INDENT> campos = [ CampoFixo(1, 'REG', 'I151'), CampoAlfanumerico(2, 'ASSIN_DIG'), ] | Hash dos Arquivos que Contêm as Fichas de Lançamento Utilizadas no Período | 62598f9621a7993f00c65c78 |
class ModuleEngagementTableTask(BareHiveTableTask): <NEW_LINE> <INDENT> @property <NEW_LINE> def partition_by(self): <NEW_LINE> <INDENT> return 'dt' <NEW_LINE> <DEDENT> @property <NEW_LINE> def table(self): <NEW_LINE> <INDENT> return 'module_engagement' <NEW_LINE> <DEDENT> @property <NEW_LINE> def columns(self): <NEW_L... | The hive table for this engagement data. | 62598f96adb09d7d5dc0a280 |
class ParcelDeliverySchema(SchemaObject): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.schema = 'ParcelDelivery' | Schema Mixin for ParcelDelivery
Usage: place after django model in class definition, schema will return the schema.org url for the object
The delivery of a parcel either via the postal service or a commercial service. | 62598f9638b623060ffa8d85 |
class Solution4: <NEW_LINE> <INDENT> def singleNumber(self, nums: List[int]) -> int: <NEW_LINE> <INDENT> seen_once = seen_twice = 0 <NEW_LINE> for n in nums: <NEW_LINE> <INDENT> seen_once = ~seen_twice & (seen_once ^ n) <NEW_LINE> seen_twice = ~seen_once & (seen_twice ^ n) <NEW_LINE> <DEDENT> return seen_once | O(1) space solution by using three bitwise operators
∼x that means bitwise NOT
x&y that means bitwise AND
x⊕y that means bitwise XOR
Runtime: 52 ms, faster than 90.26% of Python3
Memory Usage: 15.7 MB, less than 88.79% of Python3
Time complexity : O(N) to iterate over the input array.
Space complexity : O(1) ... | 62598f9667a9b606de545ccc |
class Scrape(): <NEW_LINE> <INDENT> def __init__(self, cve_id): <NEW_LINE> <INDENT> if not cve_id.startswith('CVE-'): <NEW_LINE> <INDENT> raise ScrapValueError("cve_id ({}): dosn't match CVE-$YEAR-$ID".format(cve_id)) <NEW_LINE> <DEDENT> self.cve_id = cve_id <NEW_LINE> self.uri = TRACKER_URI.format(bug=self.cve_id) <NE... | class to crape the notes from https://security-tracker.debian.org/tracker/$bug | 62598f96e64d504609df9233 |
class GeneralizedLinearRegressionModel(JavaPredictionModel, _GeneralizedLinearRegressionParams, JavaMLWritable, JavaMLReadable, HasTrainingSummary): <NEW_LINE> <INDENT> @since("3.0.0") <NEW_LINE> def setLinkPredictionCol(self, value): <NEW_LINE> <INDENT> return self._set(linkPredictionCol=value) <NEW_LINE> <DEDENT> @pr... | Model fitted by :class:`GeneralizedLinearRegression`.
.. versionadded:: 2.0.0 | 62598f962c8b7c6e89bd34c7 |
class Stmt(Node): <NEW_LINE> <INDENT> pass | Abstract AST element representing a top-level statement. | 62598f960a50d4780f7050d0 |
class Function(Member): <NEW_LINE> <INDENT> @property <NEW_LINE> def module(self): <NEW_LINE> <INDENT> return self.container <NEW_LINE> <DEDENT> @property <NEW_LINE> def signature(self): <NEW_LINE> <INDENT> return inspection.signature(self.impl) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return '{}{}'.f... | Function.
Attributes:
impl (function): Real function.
options (dict): decorator options. | 62598f960c0af96317c5607c |
class SlackCLient(): <NEW_LINE> <INDENT> def __init__(self,chan): <NEW_LINE> <INDENT> self.client = WebClient(token=slack_token) <NEW_LINE> self.chan = chan <NEW_LINE> <DEDENT> def message(self,message): <NEW_LINE> <INDENT> if isinstance(message,str): <NEW_LINE> <INDENT> return self.client.chat_postMessage(channel=self... | Used to start slack client and hook into api
chan:
(str) the channel we want to load into to start | 62598f96287bf620b62718b8 |
class RHManageSessionsBase(RHManageEventBase): <NEW_LINE> <INDENT> pass | Base RH for all session management RHs | 62598f96eab8aa0e5d30ba7c |
class TinyUrl(Enum): <NEW_LINE> <INDENT> _key = 'tinyurl' <NEW_LINE> NO = {_key: 0} <NEW_LINE> YES = {_key: 1} | Автоматически сокращать ссылки в сообщениях. Позволяет заменять ссылки в тексте сообщения на короткие для
сокращения длины, а также для отслеживания количества переходов.
0 (по умолчанию) – оставить ссылки в тексте сообщения без изменений.
1 – сократить ссылки | 62598f96cb5e8a47e493bff0 |
class Update(mixins.Administrator, BaseUpdateView): <NEW_LINE> <INDENT> model = models.Patient <NEW_LINE> fields = None <NEW_LINE> form_class = forms.Patient <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(Update, self).__init__() <NEW_LINE> <DEDENT> def get_success_url(self): <NEW_LINE> <INDENT> return revers... | Update a Patient | 62598f9685dfad0860cbf8f0 |
class Error(Exception): <NEW_LINE> <INDENT> pass | DBText error. | 62598f96f7d966606f747cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.