code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Float(_StructParserBase): <NEW_LINE> <INDENT> def __init__(self, double=True, endian='big'): <NEW_LINE> <INDENT> if double: <NEW_LINE> <INDENT> desc = 'd' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> desc = 'f' <NEW_LINE> <DEDENT> super().__init__(endian, desc) | Create a parser for a floating-point decimal (4 bytes).
double=True creates a double precision float. | 62598ede7047854f4633d971 |
class EditForm(DefaultEditForm): <NEW_LINE> <INDENT> @property <NEW_LINE> def description(self): <NEW_LINE> <INDENT> return _( 'edit_infocard_help', ( u"Configure an infocard." ) ) | Add form for the server content type | 62598ede16aa5153ce3fea8b |
class _PGSC(nodes.SelectNoParens): <NEW_LINE> <INDENT> def flatten(self): <NEW_LINE> <INDENT> return nodes.flattenKWs(self, ("SELECT", None), ("", "setQuantifier"), ("", "selectList"), ("", "fromClause"), ("", "whereClause"), ("", "groupby"), ("", "having"), ("", "orderBy"), ("LIMIT", "setLimit")) | A modifield selectNoParens that fixes the syntactic differences
between ADQL and postgres. | 62598ede21bff66bcd7211e2 |
class Lock(_ContextManagerMixin): <NEW_LINE> <INDENT> def __init__(self, *, loop=None): <NEW_LINE> <INDENT> self._waiters = collections.deque() <NEW_LINE> self._locked = False <NEW_LINE> if loop is not None: <NEW_LINE> <INDENT> self._loop = loop <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._loop = events.get_even... | Primitive lock objects.
A primitive lock is a synchronization primitive that is not owned
by a particular coroutine when locked. A primitive lock is in one
of two states, 'locked' or 'unlocked'.
It is created in the unlocked state. It has two basic methods,
acquire() and release(). When the state is unlocked, acqu... | 62598edef7d966606f746580 |
class SP_routing: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._radix = radix.Radix() <NEW_LINE> for rr in conf.route.routes: <NEW_LINE> <INDENT> addr = IP("%s/%s"%(IP(rr[0]), IP(rr[1]))) <NEW_LINE> rnode = self._radix.add(addr.strNormal()) <NEW_LINE> rnode.data["gw"] = rr[2] <NEW_LINE> rnode.data["... | A simple class to load the rouing table of the host and decide which
interface should be monitored | 62598ede67a9b606de54455e |
class Dp_pdf(Bukin_pdf) : <NEW_LINE> <INDENT> def __init__ ( self , mass , name = 'Dp' , mean = 1.869 , sigma = 7.1183e-03 , xi = -7.7344e-03 , rhoL = 3.0241e-01 , rhoR = 3.7452e-01 ) : <NEW_LINE> <INDENT> Bukin_pdf.__init__ ( self ... | D+: Bukin function
| 62598edebaa26c4b54d4d861 |
class PySqliteTableExecutor(Base): <NEW_LINE> <INDENT> key = 'table' <NEW_LINE> class Meta(Base.Meta): <NEW_LINE> <INDENT> engine = Plugin.Engine.Table | PySQLite table executor class. | 62598eded6c5a102081e06c0 |
class ApiTokenPaginationResponse(object): <NEW_LINE> <INDENT> swagger_types = { 'total': 'int', 'search_id': 'str', 'items': 'list[APIToken]' } <NEW_LINE> attribute_map = { 'total': 'total', 'search_id': 'searchId', 'items': 'items' } <NEW_LINE> def __init__(self, total=None, search_id=None, items=None): <NEW_LINE> <IN... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598ede29b78933be269397 |
class Fetcher: <NEW_LINE> <INDENT> def __init__(self,stockfile): <NEW_LINE> <INDENT> self.startyear = 1974 <NEW_LINE> self.nextyear = 1975 <NEW_LINE> self.current = date(self.startyear,12,10) <NEW_LINE> self.curend = date(self.nextyear,12,10) <NEW_LINE> self.cache = {} <NEW_LINE> self.stocks = None <NEW_LINE> self.qcli... | Provides batches of images | 62598ede21a7993f00c644fc |
class Test(unittest.TestCase): <NEW_LINE> <INDENT> url = 'https://silverbirdcinemas.com/cinema/accra/' <NEW_LINE> data = [ (1, "showtime", "FRI - SUN: 12:10PM, 2:00PM, 3:50PM, 5:40PM, 7:30PM, 9:30PM"), (1, "genre", "Action, Adventure, Comedy, Now Showing"), (2, "title", "A SIMPLE FAVOR"), (4, "duration", "02 hours 01 ... | Test data is arranged in a list of tuples: (item number, test attribute, expected value)
NOTE: if following the website some data on "genre and release date" attributes is hidden | 62598ede2eb69b55b15a0651 |
class MainHandler(webapp.RequestHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> upload_info = self.request.GET.get('upload_info') <NEW_LINE> if upload_info: <NEW_LINE> <INDENT> self.response.headers['content-type'] = 'text/plain' <NEW_LINE> self.response.out.write(upload_info) <NEW_LINE> return <NEW_LI... | A simple main handler. | 62598edef8510a7c17d7d444 |
class PageTrail: <NEW_LINE> <INDENT> _cubictemp_unescaped = 1 <NEW_LINE> def __init__(self, node): <NEW_LINE> <INDENT> self.node = node <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> trail = self.node.pathToRoot() <NEW_LINE> trailList = [] <NEW_LINE> for crumb in trail: <NEW_LINE> <INDENT> if crumb.structur... | Provides a string of page links leading from the root page to
the current page | 62598ede097d151d1a2bf5af |
class EnvironmentAPICompletenessTests(PythonAPICompletenessTestCase, PyFlinkTestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def python_class(cls): <NEW_LINE> <INDENT> return TableEnvironment <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def java_class(cls): <NEW_LINE> <INDENT> return "org.apache.flink.table.api.Ta... | Tests whether the Python :class:`TableEnvironment` is consistent with
Java `org.apache.flink.table.api.TableEnvironment`. | 62598ededd821e528d6d74d8 |
class Turbomole(QM_calculator): <NEW_LINE> <INDENT> def __init__(self, functional, basis_set, memory, root_path, nthreads, version): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.functional = functional <NEW_LINE> self.basis_set = basis_set <NEW_LINE> self.memory = memory <NEW_LINE> self.nthreads = nthreads <N... | Class for common parts of Turbomole
:param string functional: Exchange-correlation functional information
:param string basis_set: Basis set information
:param string memory: Allocatable memory in the calculations
:param string root_path: Path for Turbomole root directory
:param integer nthreads: Number of threads in ... | 62598ede8e7ae83300ee7621 |
class Symbol(Text): <NEW_LINE> <INDENT> def fromUnicode(self, value): <NEW_LINE> <INDENT> return reportlab.graphics.widgets.markers.makeMarker(value) | This attribute should contain the text representation of a symbol to be
used. | 62598ede4a966d76dd5ed475 |
class Max(Unary): <NEW_LINE> <INDENT> def __init__(self, name, axis=None): <NEW_LINE> <INDENT> Unary.__init__(self, name=name, axis=axis) <NEW_LINE> self.axis = axis <NEW_LINE> <DEDENT> def transform(self): <NEW_LINE> <INDENT> Unary.transform(self) <NEW_LINE> if self.axis is None: <NEW_LINE> <INDENT> self.output.variab... | Returns the max of an input, or over a given axis. | 62598edee1aae11d1e7cdb07 |
class Ensemble(csb.core.AbstractNIContainer, AbstractEntity): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._models = EnsembleModelsCollection() <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "<Ensemble: {0} models>".format(self.models.length) <NEW_LINE> <DEDENT> @property <NEW_LI... | Represents an ensemble of multiple L{Structure} models.
Provides a list-like access to these models:
>>> ensemble[0]
<Structure Model 1: accn, x chains>
>>> ensemble.models[1]
<Structure Model 1: accn, x chains> | 62598ede23849d37ff84f64c |
class Service(models.Model): <NEW_LINE> <INDENT> project = models.ForeignKey('Project', on_delete=models.CASCADE) <NEW_LINE> service_name = models.CharField(max_length=32, verbose_name='服务名称', help_text='数据库、中间件等') <NEW_LINE> service_asset = models.ForeignKey('assets.Assets', verbose_name='提供服务的机器', on_delete=models.CA... | 服务类型表 | 62598ede3eb6a72ae0388bd2 |
class ImageManager(base.ManagerWithFind): <NEW_LINE> <INDENT> resource_class = Image <NEW_LINE> def get(self, image): <NEW_LINE> <INDENT> warnings.warn( 'The novaclient.v2.images module is deprecated and will be ' 'removed after Nova 15.0.0 is released. Use python-glanceclient ' 'or python-openstacksdk instead.', Depre... | DEPRECATED: Manage :class:`Image` resources. | 62598edefbf16365ca792634 |
class UhdSyncMsg(object): <NEW_LINE> <INDENT> def __init__(self, ip_address = "127.0.0.1", port = 47009, packet_size = 3, packet_type = "fff"): <NEW_LINE> <INDENT> self.tcpa = _TcpSyncClient(ip_address, port, packet_size, packet_type) <NEW_LINE> self.tcpa.start() <NEW_LINE> <DEDENT> def __exit__(self): <NEW_LINE> <INDE... | Creates a thread to connect to the synchronous uhd messages tcp port | 62598ede99fddb7c1ca620cf |
class TestCustomerProfileIntegrationRequestV2(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 make_instance(self, include_optional): <NEW_LINE> <INDENT> if include_optional : <NEW_LINE> <INDENT> re... | CustomerProfileIntegrationRequestV2 unit test stubs | 62598edef548e778e5969b29 |
class FollowerListSerializer(serializers.BaseSerializer): <NEW_LINE> <INDENT> def to_representation(self, obj): <NEW_LINE> <INDENT> return { 'username': obj.user.username, } | Follower serializer to display the username of the follower | 62598ede8e71fb1e983ba002 |
class NumpyToTensor(object): <NEW_LINE> <INDENT> def __call__(self, sample): <NEW_LINE> <INDENT> img_name = sample['image_id'] <NEW_LINE> image = sample['image'] <NEW_LINE> labels = sample['labels'] <NEW_LINE> image = image.transpose((2, 0, 1)) <NEW_LINE> return {'image': torch. from_numpy(image).typ... | Convert ndarrays in sample to Tensors. | 62598ede442bda511e95a9f9 |
class CompatibilityError(MicropipenvException): <NEW_LINE> <INDENT> pass | Raised when internal pip API is incompatible with micropipenv. | 62598ede30bbd722464681ca |
class ClienteViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Cliente.objects.all().order_by('sigla') <NEW_LINE> serializer_class = ClienteSerializer | API endpoint that allows clientes to be viewed or edited. | 62598ede2ae34c7f260a9679 |
class NotRegistered(Exception): <NEW_LINE> <INDENT> pass | Alerts users when nothing is registered for a given app_label. | 62598edebe8e80087fbbd5de |
@implementer(IPage, IInstanceBehaviorAssignableContent) <NEW_LINE> class Page(Pages): <NEW_LINE> <INDENT> category_name = "page_category" | Page class | 62598edeb7558d5895461bdd |
class NestDisplay(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.colors = salt.utils.get_colors(__opts__.get('color')) <NEW_LINE> <DEDENT> def ustring(self, indent, color, msg, prefix='', suffix='', endc=None, encoding='utf-8'): <NEW_LINE> <INDENT> if endc is None: <NEW_LINE> <INDENT> endc = ... | Manage the nested display contents | 62598ede21bff66bcd7211e4 |
class UpvoteQuestion(APIView): <NEW_LINE> <INDENT> permission_classes = [permissions.IsAuthenticated, TokenAllowedPermission] <NEW_LINE> def patch(self, request: Request, meetup_id: str, question_id: str) -> Response: <NEW_LINE> <INDENT> vote_value = 1 <NEW_LINE> return give_vote( request=request, meetup_id=meetup_id, ... | A viw for handling question upvotes
PATCH /api/meetups/{meetupId}/questions/{questionId}/upvote | 62598edef7d966606f746582 |
class VirtualElectricalPort(ElectricalPort): <NEW_LINE> <INDENT> def __init__(self, parent, pin, virtual=False, **kwargs): <NEW_LINE> <INDENT> ElectricalPort.__init__(self, parent, pin, virtual, **kwargs) <NEW_LINE> <DEDENT> def get_pin_alias(self, p): <NEW_LINE> <INDENT> return self.parent.get_pin_alias(p) <NEW_LINE> ... | NO IDEA WHAT ANYTHING IN THIS FILE DOES
Args:
None | 62598ede4e4d5625663709ab |
class optimal(Executable): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Executable.__init__(self, "optimal", executable="optimal", spkg="rubiks") | A :class:`~sage.features.Feature` describing the presence of ``optimal``
EXAMPLES::
sage: from sage.features.rubiks import optimal
sage: optimal().is_present() # optional - rubiks
FeatureTestResult('optimal', True) | 62598edeb7558d5895461bde |
class UploadedDeliveryFileQuerySet(models.QuerySet): <NEW_LINE> <INDENT> def delete_objects_and_files(self): <NEW_LINE> <INDENT> for uploaded_deliveryfile in self: <NEW_LINE> <INDENT> uploaded_deliveryfile.uploaded_file.delete() <NEW_LINE> <DEDENT> self.delete() | QuerySet for :class:`.UploadedDeliveryFileManager`. | 62598edecad5886f8bdc3891 |
class CannotLoadSourceFileError(PreProcError): <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'Unable to load file {}'.format(self.filename) | When a netCDF file can't be opened to find a required attribute. | 62598ede45492302aabfaa46 |
class UniqueIdTestCases(ImmutableTestCases): <NEW_LINE> <INDENT> field_class = String <NEW_LINE> field_default = UNIQUE_ID <NEW_LINE> new_value = 'user-assigned ID' | Set up tests for field with UNIQUE_ID default | 62598ede85dfad0860cbed33 |
class Turn(object): <NEW_LINE> <INDENT> def deal(self, deck): <NEW_LINE> <INDENT> card = random.choice(deck.deck_list) <NEW_LINE> deck.update(card) <NEW_LINE> return card | Using a class for this, function would probably work fine. | 62598edea17c0f6771d5a7ed |
class TileFormGroup(Group): <NEW_LINE> <INDENT> prefix = "" <NEW_LINE> def updateWidgets(self, prefix=None): <NEW_LINE> <INDENT> self.widgets = getMultiAdapter( (self, self.request, self.getContent()), IWidgets ) <NEW_LINE> for attrName in ( "mode", "ignoreRequest", "ignoreContext", "ignoreReadonly", ): <NEW_LINE> <IND... | TileForm group class, which prefixes group form fields similarly
to TileForm | 62598ede29b78933be269398 |
class RevisionTextStore(TextVersionedFiles): <NEW_LINE> <INDENT> def __init__(self, transport, serializer, compressed, mapper, is_locked, can_write): <NEW_LINE> <INDENT> TextVersionedFiles.__init__(self, transport, compressed, mapper, is_locked, can_write) <NEW_LINE> self._serializer = serializer <NEW_LINE> <DEDENT> de... | Legacy thunk for format 4 repositories. | 62598ede24f1403a92684b6d |
class CsvResponseMixin(MultipleObjectMixin): <NEW_LINE> <INDENT> response_class = CsvResponse <NEW_LINE> column_serializer_class = ColumnSerializer <NEW_LINE> columns = None <NEW_LINE> output_headers = True <NEW_LINE> filename = '{model_name}_list.csv' <NEW_LINE> def render_to_response(self, context, **kwargs): <NEW_LI... | A ListView mixin that returns a CsvResponse. | 62598ede3cc13d1c6d463cfc |
class Budget(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='budgets') <NEW_LINE> id = models.AutoField(primary_key=True) <NEW_LINE> name = models.CharField(max_length=180, default='Untitled Budget Name') <NEW_LINE> total_budget = models.FloatField(blank=True) <... | To create model Budget. | 62598ede67a9b606de544561 |
class PartitionMount(object): <NEW_LINE> <INDENT> def __init__(self, disk_img, mount_ok=None): <NEW_LINE> <INDENT> self.mount_dev = None <NEW_LINE> self.mount_size = None <NEW_LINE> self.mount_dir = None <NEW_LINE> self.disk_img = disk_img <NEW_LINE> self.mount_ok = mount_ok <NEW_LINE> if not self.mount_ok: <NEW_LINE> ... | Mount a partitioned image file using kpartx | 62598edeeab8aa0e5d30a309 |
class Instance(AWSObject): <NEW_LINE> <INDENT> resource_type = "AWS::Lightsail::Instance" <NEW_LINE> props: PropsDictType = { "AddOns": ([AddOn], False), "AvailabilityZone": (str, False), "BlueprintId": (str, True), "BundleId": (str, True), "Hardware": (Hardware, False), "InstanceName": (str, True), "KeyPairName": (str... | `Instance <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html>`__ | 62598edea79ad161977685ae |
class Example_Callable_Attribute(Function): <NEW_LINE> <INDENT> def __defaults__(self): <NEW_LINE> <INDENT> self.area = None <NEW_LINE> self.taper = None <NEW_LINE> <DEDENT> def __check__(self): <NEW_LINE> <INDENT> if self.taper == 10: <NEW_LINE> <INDENT> self.area = 20 <NEW_LINE> <DEDENT> <DEDENT> def __call__(self,in... | <Description>
Assumptions:
<any assumptions>
Source:
<source> | 62598ede38b623060ffa7626 |
class TestListQueues(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 testListQueues(self): <NEW_LINE> <INDENT> pass | ListQueues unit test stubs | 62598ede9c8ee8231303f421 |
class Clock(morse.core.sensor.Sensor): <NEW_LINE> <INDENT> _name = "Clock" <NEW_LINE> def __init__(self, obj, parent=None): <NEW_LINE> <INDENT> logger.info('%s initialization' % obj.name) <NEW_LINE> morse.core.sensor.Sensor.__init__(self, obj, parent) <NEW_LINE> logger.info('Component initialized, runs at %.2f Hz', sel... | This sensor returns the current time, measured by the robot (in s). | 62598ede097d151d1a2bf5b1 |
@python_2_unicode_compatible <NEW_LINE> class TaggedItem(TimestampedModelMixin, models.Model): <NEW_LINE> <INDENT> tag = models.ForeignKey(Tag, verbose_name=_("tag"), related_name="items") <NEW_LINE> content_type = models.ForeignKey(ContentType, verbose_name=_("content type")) <NEW_LINE> object_id = models.PositiveInte... | Holds the relationship between a tag and the item being tagged. | 62598ede3d592f4c4edb9487 |
class CopyGenerator(nn.Module): <NEW_LINE> <INDENT> def __init__(self, hidden_size, output_size, fix_norm=False): <NEW_LINE> <INDENT> super(CopyGenerator, self).__init__() <NEW_LINE> self.hidden_size = hidden_size <NEW_LINE> self.output_size = output_size <NEW_LINE> self.c = 0.1712209 <NEW_LINE> self.linear_copy = Xavi... | Generator module that additionally considers copying
words directly from the source.
The main idea is that we have an extended "dynamic dictionary".
It contains `|tgt_dict|` words plus an arbitrary number of
additional words introduced by the source sentence.
For each source sentence we have a `src_map` that maps
each ... | 62598ede6e29344779afebc0 |
class TestRuleWithNoDependencies(Rule): <NEW_LINE> <INDENT> pass | Module d'exemple pour les règles de corrélation. | 62598eded53ae8145f916a1e |
class ShellSTC(PeppySTC): <NEW_LINE> <INDENT> def __init__(self, parent, **kwargs): <NEW_LINE> <INDENT> PeppySTC.__init__(self, parent, **kwargs) <NEW_LINE> self.pipe=None <NEW_LINE> self.waiting=False <NEW_LINE> self.promptPosEnd=0 <NEW_LINE> self.filter=1 <NEW_LINE> self.more=0 <NEW_LINE> <DEDENT> def open(self, buff... | Specialized STC used as the buffer of a shell mode. Note, setting
the cursor position on this STC doesn't affect the views directly.
This is the data storage STC, not the viewing STC. | 62598ede442bda511e95a9fa |
class State(BaseModel): <NEW_LINE> <INDENT> name = "" | State Class extends BaseModel | 62598ede97e22403b3839483 |
class VultrCloudProvider(CloudProvider): <NEW_LINE> <INDENT> def __init__(self, args): <NEW_LINE> <INDENT> super().__init__(args) <NEW_LINE> self.uses_config = True <NEW_LINE> <DEDENT> def setup(self): <NEW_LINE> <INDENT> super().setup() <NEW_LINE> self._use_static_config() | Checks if a configuration file has been passed or fixtures are going to be used for testing | 62598ede3539df3088eca845 |
class RegisterException(Exception): <NEW_LINE> <INDENT> pass | Exception raised on a registration error. | 62598ede2c8b7c6e89bd1d53 |
class GithubException(CumulusCIException): <NEW_LINE> <INDENT> pass | Raise for errors related to GitHub | 62598edeb5575c28eb711f9a |
class EditComment(BlogHandler): <NEW_LINE> <INDENT> def commenter_auth(self, comment_id): <NEW_LINE> <INDENT> comment = self.retrieve_comment(comment_id) <NEW_LINE> if not comment: <NEW_LINE> <INDENT> self.render('404error.html') <NEW_LINE> self.error(404) <NEW_LINE> return <NEW_LINE> <DEDENT> if self.uid == comment.ui... | Handler to edit a comment | 62598ede6aa9bd52df0d3441 |
class Ellipse(BRectShape): <NEW_LINE> <INDENT> def __init__(self, x, y, width, height, color, borderColor, borderThickness=0): <NEW_LINE> <INDENT> return super().__init__(x, y, width, height, color, borderColor, borderThickness) <NEW_LINE> <DEDENT> def Render(self, qp, scale=1): <NEW_LINE> <INDENT> p = QPen() <NEW_LINE... | Ellipical object to draw | 62598ede63d6d428bbee0d65 |
class ManagedClusterAccessProfile(Resource): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': '... | Managed cluster Access Profile.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str... | 62598edee1aae11d1e7cdb08 |
class ParserBase(ABC): <NEW_LINE> <INDENT> def __init__(self, shared_states): <NEW_LINE> <INDENT> self.shared_states = shared_states <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def run(self, event): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def reset(self): <NEW_LINE> <INDENT> pass <NEW... | The base class for all event parsers. | 62598edec432627299fa1549 |
class EventValues(ind.EventValues): <NEW_LINE> <INDENT> def __init__(self, attribs): <NEW_LINE> <INDENT> super(EventValues, self).__init__() <NEW_LINE> for key, value in attribs.items(): <NEW_LINE> <INDENT> setattr(self, key, value) <NEW_LINE> <DEDENT> self.Extension = [] <NEW_LINE> self.Interval = [] <NEW_LINE> self.V... | Represents a <EventValues> tag in v4.0 and provides methods to convert to PFA. | 62598ede3539df3088eca846 |
class ServerTimeError(C8ServerError): <NEW_LINE> <INDENT> pass | Failed to retrieve server system time. | 62598ede796e427e5384cd2c |
class PluginsPlugin(TelexPlugin): <NEW_LINE> <INDENT> patterns = { "^{prefix}plugins$": "list_plugins", "^{prefix}plugins? (enable) ([\w_.-]+)$": "enable_plugin", "^{prefix}plugins? (disable) ([\w_.-]+)$": "disable_plugin", "^{prefix}plugins? (reload)$": "reload_plugins" } <NEW_LINE> usage = [ "{prefix}plugins: list al... | Plugin to manage other plugins. Enable, disable or reload. | 62598ede1f5feb6acb1611e5 |
class DictStore(AbstractStore): <NEW_LINE> <INDENT> def __init__(self, data=None, **kwargs): <NEW_LINE> <INDENT> super(DictStore, self).__init__(**kwargs) <NEW_LINE> if data is None: <NEW_LINE> <INDENT> data = {} <NEW_LINE> <DEDENT> self.data = data <NEW_LINE> <DEDENT> def store_exists(self, key): <NEW_LINE> <INDENT> r... | Store implementation using a simple `dict`.
| 62598edecb5e8a47e493b443 |
class CrawlScript(object): <NEW_LINE> <INDENT> swagger_types = { 'crawl_script_data': 'Script', 'crawl_script_id': 'str', 'number_scripts': 'int' } <NEW_LINE> attribute_map = { 'crawl_script_data': 'crawl_script_data', 'crawl_script_id': 'crawl_script_id', 'number_scripts': 'number_scripts' } <NEW_LINE> def __init__(se... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598ede498bea3a75a560ca |
class PropertyTabChangedEventHandler(MulticastDelegate,ICloneable,ISerializable): <NEW_LINE> <INDENT> def BeginInvoke(self,s,e,callback,object): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def CombineImpl(self,*args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def DynamicInvokeImpl(self,*args): <NEW_LINE> <INDENT> p... | Represents the method that will handle the System.Windows.Forms.PropertyGrid.PropertyTabChanged event of a System.Windows.Forms.PropertyGrid.
PropertyTabChangedEventHandler(object: object,method: IntPtr) | 62598ede5f7d997b871f869f |
class OptionPair(Option): <NEW_LINE> <INDENT> def __init__(self, key, value): <NEW_LINE> <INDENT> super(OptionPair, self).__init__(key=key, value=value, is_pair=True) <NEW_LINE> <DEDENT> def trace(self, level): <NEW_LINE> <INDENT> indent = ' ' * level <NEW_LINE> output = str() <NEW_LINE> output += '{}{!r}\n'.format(in... | The C{OptionPair} class represents an argument obeying a C{KEY=VALUE} schema.
Although the C{KEY=VALUE} expressions could be added as simple arguments, the benefit
of having a specific sub-class is the tracking of the key in the C{Command.options}
dictionary.
Attributes: | 62598ede30dc7b766599de1c |
class Post(models.Model): <NEW_LINE> <INDENT> author = models.ForeignKey('auth.User', on_delete=models.CASCADE) <NEW_LINE> title = models.CharField(max_length=200) <NEW_LINE> text = models.TextField() <NEW_LINE> created_date = models.DateTimeField( default=timezone.now) <NEW_LINE> published_date = models.DateTimeField(... | Post Model.
Allows you to write basic posts | 62598edebaa26c4b54d4d865 |
class Addr: <NEW_LINE> <INDENT> def __init__(self, ip, port, zone=None): <NEW_LINE> <INDENT> if isinstance(ip, str): <NEW_LINE> <INDENT> ip = decodeStringIP(ip) <NEW_LINE> <DEDENT> self.ip = ip <NEW_LINE> self.port = port <NEW_LINE> self.zone = zone | Addr is a mimic of Go's net.TCPAddr. | 62598eded6c5a102081e06c4 |
class MotionDecoderThread(QThread): <NEW_LINE> <INDENT> motion_decoding_progress = pyqtSignal(int) <NEW_LINE> motion_decoding_finished = pyqtSignal(bool) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.infile = None <NEW_LINE> self.outfile = None <NEW_LINE> self.total_frames = 0 <N... | Class for parallel decoding of motion information from H.264 videos | 62598edea79ad161977685b0 |
class PIPInterface(object, metaclass=ABCMeta): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> @abstractmethod <NEW_LINE> def attributeQuery(self, context, attributeDesignator): <NEW_LINE> <INDENT> return [] | Interface class for XACML Policy Information Point. The PDP can relay
attribute queries back via the Context handler to the PIP in order to help
it in making an access control decision | 62598ede498bea3a75a560cb |
class StatusDisplayStrings(object): <NEW_LINE> <INDENT> _UPLOADING = ugettext_noop("Uploading") <NEW_LINE> _IN_PROGRESS = ugettext_noop("In Progress") <NEW_LINE> _COMPLETE = ugettext_noop("Ready") <NEW_LINE> _FAILED = ugettext_noop("Failed") <NEW_LINE> _INVALID_TOKEN = ugettext_noop("Invalid Token") <NEW_LINE> _UNKNOWN... | A class to map status strings as stored in VAL to display strings for the
video upload page | 62598edea17c0f6771d5a7f0 |
class Solution: <NEW_LINE> <INDENT> class TreeNode(): <NEW_LINE> <INDENT> def __init__(self,val): <NEW_LINE> <INDENT> self.val=val <NEW_LINE> self.left,self.right=None,None <NEW_LINE> <DEDENT> <DEDENT> def preorderTraversal(self, root): <NEW_LINE> <INDENT> if root==None: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT... | @param root: The root of binary tree.
@return: Preorder in ArrayList which contains node values. | 62598edeac7a0e7691f70aa8 |
class EventConfig(FolioApi): <NEW_LINE> <INDENT> def get_eventConfigs(self, **kwargs): <NEW_LINE> <INDENT> return self.call("GET", "/eventConfig", query=kwargs) <NEW_LINE> <DEDENT> def set_eventConfig(self, eventConfig: dict): <NEW_LINE> <INDENT> return self.call("POST", "/eventConfig", data=eventConfig) <NEW_LINE> <DE... | Event config
**CRUD APIs for event configuration.** | 62598eded7e4931a7ef3a631 |
class Post(models.Model): <NEW_LINE> <INDENT> content = models.TextField() <NEW_LINE> image = models.ImageField(upload_to='posts', validators=[FileExtensionValidator(['png', 'jpg', 'jpeg'])], blank=True) <NEW_LINE> liked = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, related_name='likes') <NEW_LINE> upd... | model for Posts | 62598ede4e4d5625663709ae |
@can_disable_rate_limit <NEW_LINE> class EnrollmentView(APIView, ApiKeyPermissionMixIn): <NEW_LINE> <INDENT> authentication_classes = (JwtAuthentication, OAuth2AuthenticationAllowInactiveUser, SessionAuthenticationAllowInactiveUser,) <NEW_LINE> permission_classes = ApiKeyHeaderPermissionIsAuthenticated, <NEW_LINE> thro... | **Use Case**
Get the user's enrollment status for a course.
**Example Request**
GET /api/enrollment/v1/enrollment/{username},{course_id}
**Response Values**
If the request for information about the user is successful, an HTTP 200 "OK" response
is returned.
The HTTP 200 response has the followi... | 62598ede60cbc95b063628d1 |
class TestBlockResults(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 testBlockResults(self): <NEW_LINE> <INDENT> pass | BlockResults unit test stubs | 62598ede2c8b7c6e89bd1d54 |
class InvalidUpstream(ReverseProxyException): <NEW_LINE> <INDENT> pass | Invalid upstream set | 62598ede2c8b7c6e89bd1d55 |
class Tipme(Platform): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.platformName = "Tipme" <NEW_LINE> self.tags = ["cryptocurrencies", "payments"] <NEW_LINE> self.isValidMode = {} <NEW_LINE> self.isValidMode["phonefy"] = False <NEW_LINE> self.isValidMode["usufy"] = True <NEW_LINE> self.isValidMode["... | A <Platform> object for Tipme. | 62598ede57b8e32f525073d1 |
class TTreeWrap(object): <NEW_LINE> <INDENT> def __init__(self, treeReader): <NEW_LINE> <INDENT> self.treeReader = treeReader <NEW_LINE> <DEDENT> def GetEntries(self): <NEW_LINE> <INDENT> return self.treeReader.GetEntries() <NEW_LINE> <DEDENT> def GetEntry(self, entry): <NEW_LINE> <INDENT> return self.treeReader.ReadEn... | wrap ExRootTreeReader so that Events can treat it as TTree
| 62598ede63d6d428bbee0d67 |
class IndexView(AdminUserRequiredMixin, View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> video_count = Video.objects.get_count() <NEW_LINE> video_has_published_count = Video.objects.get_published_count() <NEW_LINE> video_not_published_count = Video.objects.get_not_published_count() <NEW_LINE> user... | 总览数据 | 62598ede097d151d1a2bf5b4 |
class CustomRotatingFileLogger(CustomLogger): <NEW_LINE> <INDENT> def __init__(self, filepath, *, maxbytes=10485, backupcount=8): <NEW_LINE> <INDENT> handler = logging.handlers.RotatingFileHandler(filepath, maxBytes=maxbytes, backupCount=backupcount) <NEW_LINE> super().__init__(handler=handler) | Subclass CustomLogger to provide a rotating file logger.
The rotation of log file is enabled by default.
Usage:
>>> import sys
>>> sys.stderr = CustomRotatingFileLogger(filepath='/foo.log')
Arguments:
filepath (str) : file path of the log file
maxbytes (int) : log file is rotated when it grows bigger... | 62598ede8a43f66fc4bf0707 |
class ProfileFeedItem(models.Model): <NEW_LINE> <INDENT> user_profile = models.ForeignKey("UserProfile", on_delete=models.CASCADE) <NEW_LINE> status_text = models.CharField(max_length=50) <NEW_LINE> created_on = models.DateTimeField(auto_now_add=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.status... | Profile status update | 62598edef548e778e5969b2d |
class LoginView(View): <NEW_LINE> <INDENT> template_name = 'accounts/login.html' <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> form = LoginForm() <NEW_LINE> context = { "title": "Login", "form": form } <NEW_LINE> return render(request, self.template_name, context) <NEW_LINE> <DEDENT> def post(... | Login view | 62598ede3539df3088eca848 |
class KafkaReceiver(object): <NEW_LINE> <INDENT> def __init__(self, topic, security_type): <NEW_LINE> <INDENT> from kafka import KafkaConsumer <NEW_LINE> remaining_retries = 10 <NEW_LINE> port = 9092 <NEW_LINE> if security_type != 'PLAINTEXT': <NEW_LINE> <INDENT> security_type = 'SSL' <NEW_LINE> port = 9093 <NEW_LINE> ... | class for receiving and storing messages on a topic from the kafka broker | 62598ede4428ac0f6e656ae8 |
class createClass_IDL_args(object): <NEW_LINE> <INDENT> thrift_spec = (None, (1, TType.I32, 'sessionId', None, None), (2, TType.I32, 'classOper', None, None)) <NEW_LINE> def __init__(self, sessionId = None, classOper = None): <NEW_LINE> <INDENT> self.sessionId = sessionId <NEW_LINE> self.classOper = classOper <NEW_LINE... | Attributes:
- sessionId
- classOper | 62598ede7b25080760ed5a30 |
class BinaryStructure(StructObject): <NEW_LINE> <INDENT> def __init__(self, structure_dict): <NEW_LINE> <INDENT> self.structure_dict = structure_dict <NEW_LINE> self.format = '' <NEW_LINE> for k, v in self.structure_dict.items(): <NEW_LINE> <INDENT> if isinstance(v, OrderedDict): <NEW_LINE> <INDENT> new_binarystructure... | This is the core binary struct class that will need used. | 62598ede56ac1b37e6300783 |
class LookupView(View): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get(request): <NEW_LINE> <INDENT> ds = [] <NEW_LINE> if 'pk' in request.GET: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pk = int(request.GET['pk']) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> pk = 1 <NEW_LINE> <DEDENT> ds = Locati... | View class for Location lookup filter | 62598edebaa26c4b54d4d867 |
class TestHighestScoringWord(unittest.TestCase): <NEW_LINE> <INDENT> def test_highest_scoring_word(self): <NEW_LINE> <INDENT> self.assertEqual(highest_scoring_word('man i need a taxi up to ubud'), 'taxi') <NEW_LINE> self.assertEqual(highest_scoring_word('what time are we climbing up the volcano'), 'volcano') <NEW_LINE>... | Class to test "highest_scoring_word" function | 62598ede45492302aabfaa4a |
class OVSController( Controller ): <NEW_LINE> <INDENT> def __init__( self, name, command='ovs-controller', **kwargs ): <NEW_LINE> <INDENT> if quietRun( 'which test-controller' ): <NEW_LINE> <INDENT> command = 'test-controller' <NEW_LINE> <DEDENT> Controller.__init__( self, name, command=command, **kwargs ) <NEW_LINE> <... | Open vSwitch controller | 62598ede29b78933be26939a |
class Batch: <NEW_LINE> <INDENT> def __init__(self, src, trg=None, pad=0): <NEW_LINE> <INDENT> self.src = src <NEW_LINE> self.src_mask = (src != pad).unsqueeze(-2) <NEW_LINE> if trg is not None: <NEW_LINE> <INDENT> self.trg = trg <NEW_LINE> self.trg_y = trg <NEW_LINE> self.trg_mask = self.make_std_mask(self.trg, pad) <... | Object for holding a batch of data with mask during training. | 62598ede44b2445a339b5c31 |
class EabiCheck(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.flag = "FAIL" <NEW_LINE> self.tag = True <NEW_LINE> self.info = "" <NEW_LINE> <DEDENT> def checkEnv(self): <NEW_LINE> <INDENT> self.checkInstall() <NEW_LINE> if self.tag: <NEW_LINE> <INDENT> self.checkEabiVersion() <NEW_LINE> <DED... | check the requirement for arm-linux-androideabi-gcc compiler | 62598edea79ad161977685b2 |
class Urls(object): <NEW_LINE> <INDENT> __metaclass__ = UrlsMeta <NEW_LINE> def __init__(self, scraper, urls): <NEW_LINE> <INDENT> self.urls = urls <NEW_LINE> self.scraper = scraper <NEW_LINE> for name, url in urls.items(): <NEW_LINE> <INDENT> url = UrlData(name, url, scraper, urls_object=self) <NEW_LINE> setattr(self,... | Contains urls we need to fetch during this scrape.
| 62598ede21a7993f00c64503 |
class OrganizationController(group.GroupController): <NEW_LINE> <INDENT> group_type = 'organization' <NEW_LINE> def _group_form(self, group_type=None): <NEW_LINE> <INDENT> return 'organization/new_organization_form.html' <NEW_LINE> <DEDENT> def _form_to_db_schema(self, group_type=None): <NEW_LINE> <INDENT> return looku... | The organization controller is pretty much just the group
controller. It has a few templates defined that are different and sets
the group_type to organization so that the group controller knows that
it is in fact the organization controller. All the main logical
differences are therefore in the group controller.
The... | 62598ede32920d7e50bc45c4 |
class Singleton(type): <NEW_LINE> <INDENT> _instances = {} <NEW_LINE> def __call__ (cls, *args): <NEW_LINE> <INDENT> if cls not in cls._instances: <NEW_LINE> <INDENT> cls._instances[cls] = super(Singleton, cls).__call__(*args) <NEW_LINE> <DEDENT> return cls._instances[cls] | Metaclass for classes need to be created only once.
Realize Singleton design pattern in a pythonic way. | 62598ede6e29344779afebc4 |
class ArgParser(ArgumentParser): <NEW_LINE> <INDENT> def __init__(self, usage_v, supported_areas=None): <NEW_LINE> <INDENT> super(ArgParser, self).__init__(description=usage_v) <NEW_LINE> if supported_areas is None: <NEW_LINE> <INDENT> supported_areas = areas <NEW_LINE> <DEDENT> area = self.add_mutually_exclusive_group... | Makes a custom parser class with area arguments by default. | 62598ede01c39578d7f1133e |
class ZabbixConnection(Exception): <NEW_LINE> <INDENT> pass | call this on present issues related to the zabbix connection | 62598eded7e4931a7ef3a633 |
class LearningRule(): <NEW_LINE> <INDENT> def add_channels_to_monitor(self, monitor, monitoring_dataset): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def get_updates(self, learning_rate, grads, lr_scalers=None): <NEW_LINE> <INDENT> raise NotImplementedError() | A pylearn2 learning rule is an object which computes new parameter values
given (1) a learning rate (2) current parameter values and (3) the current
estimated gradient. | 62598ede2eb69b55b15a0654 |
class TileDeviceTracker(TileEntity, TrackerEntity): <NEW_LINE> <INDENT> def __init__(self, coordinator, tile_uuid, tile): <NEW_LINE> <INDENT> super().__init__(coordinator) <NEW_LINE> self._name = tile["name"] <NEW_LINE> self._tile = tile <NEW_LINE> self._tile_uuid = tile_uuid <NEW_LINE> self._unique_id = f"tile_{tile_u... | Representation of a network infrastructure device. | 62598edebe383301e0251d6e |
class _DummyEagerGraph(threading.local): <NEW_LINE> <INDENT> class _WeakReferencableClass: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __init__(self): <NEW_LINE> <INDENT> super(_DummyEagerGraph, self).__init__() <NEW_LINE> self.key = _DummyEagerGraph._WeakReferencableClass() <NEW_LINE> self.learning_phase_is_set =... | _DummyEagerGraph provides a thread local `key` attribute.
We can't use threading.local directly, i.e. without subclassing, because
gevent monkey patches threading.local and its version does not support
weak references. | 62598ede442bda511e95a9fe |
class GBApi(object): <NEW_LINE> <INDENT> def __init__(self, protocol='https', format='json'): <NEW_LINE> <INDENT> self.protocol = protocol <NEW_LINE> self.domain = 'www.giantbomb.com' <NEW_LINE> self.api_key = os.environ.get('GB_API_KEY') <NEW_LINE> self.format = 'json' <NEW_LINE> self.fields = ['name', 'original_relea... | Class to facilitate interaction. | 62598eded58c6744b42db582 |
class Photo(models.Model): <NEW_LINE> <INDENT> TAG_CHOICES = ( (FULL_BODY_SHOT, u'全身照'), ) <NEW_LINE> user = models.ForeignKey(User) <NEW_LINE> file = ThumbnailerImageField( upload_to=path_and_rename('fullbody-shot'), resize_source=dict(size=(1024, 1024), sharpen=True)) <NEW_LINE> is_primary = models.BooleanField(defau... | User photos | 62598ede460517430c430a20 |
class Instruction(InstructionBase): <NEW_LINE> <INDENT> def __init__(self, mnemonic, description, opcodes, alternate=None): <NEW_LINE> <INDENT> super(Instruction, self).__init__(mnemonic, description) <NEW_LINE> self._alternate = alternate <NEW_LINE> self._opcodes = [Opcode(self, **opcode_dict) for opcode_dict in opcod... | This class implements an AVR instruction.
An instruction can have one or several associated opcodes. | 62598ede4f6381625f198788 |
class EnvVars(unittest.TestCase): <NEW_LINE> <INDENT> def test_env(self): <NEW_LINE> <INDENT> def get_env(_): <NEW_LINE> <INDENT> return dict(os.environ) <NEW_LINE> <DEDENT> wrenexec = pywren.default_executor() <NEW_LINE> extra_env = {"HELLO" : "WORLD"} <NEW_LINE> fut = wrenexec.call_async(get_env, None, extra_env=extr... | Can we set the environment vars to map? | 62598ede1b99ca400228e7d8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.