code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class FactorizationMachine(QuadraticLayer): <NEW_LINE> <INDENT> def __init__(self, input_size, factorization_size=8, act="identity", **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.factorization_size = factorization_size <NEW_LINE> self.input_size = input_size <NEW_LINE> self.trainer = None <N... | Factorization Machine as a neural network layer.
Args:
input_size (int):
The dimension of input value.
factorization_size (int (<=input_size)):
The rank of decomposition of interaction terms.
act (string, optional):
Name of activation function applied on FM output: "identity", "sigm... | 6259904d30dc7b76659a0c63 |
class KnittedSweaterDecorator(ClothingDecorator): <NEW_LINE> <INDENT> def __init__(self, person): <NEW_LINE> <INDENT> super().__init__(person) <NEW_LINE> <DEDENT> def decorate(self): <NEW_LINE> <INDENT> print("一件紫红色针织毛衣") | 针织毛衣装饰器 | 6259904d3c8af77a43b68955 |
class CustomPeriod(proto.Message): <NEW_LINE> <INDENT> start_date = proto.Field( proto.MESSAGE, number=1, message=date_pb2.Date, ) <NEW_LINE> end_date = proto.Field( proto.MESSAGE, number=2, message=date_pb2.Date, ) | All date times begin at 12 AM US and Canadian Pacific Time
(UTC-8).
Attributes:
start_date (google.type.date_pb2.Date):
Required. The start date must be after
January 1, 2017.
end_date (google.type.date_pb2.Date):
Optional. The end date of the time period. Budgets with
elapsed e... | 6259904db5575c28eb7136e1 |
class HashTagDecorator: <NEW_LINE> <INDENT> SEARCH_RE = re.compile(r'#\w+') <NEW_LINE> def replace(self, match, block_type): <NEW_LINE> <INDENT> if block_type == BLOCK_TYPES.CODE: <NEW_LINE> <INDENT> return match.group(0) <NEW_LINE> <DEDENT> return DOM.create_element( 'span', {'class': 'hash_tag'}, match.group(0) ) | Wrap hash tags in spans with specific class. | 6259904db830903b9686ee92 |
class LeagueData(CoreData): <NEW_LINE> <INDENT> _dto_type = LeagueDto <NEW_LINE> _renamed = {"leagueId": "id"} <NEW_LINE> def __call__(self, **kwargs): <NEW_LINE> <INDENT> if "entries" in kwargs: <NEW_LINE> <INDENT> self.entries = [LeagueEntryData(**entry) for entry in kwargs.pop("entries")] <NEW_LINE> <DEDENT> super()... | Contains the data for one League which has many entries. | 6259904d82261d6c527308de |
class MetaQuery(BaseQuery): <NEW_LINE> <INDENT> def __init__(self, inner): <NEW_LINE> <INDENT> self._inner = inner <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return internal.ReprPrettyPrinter().meta_query(self, []) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "<MetaQuery %s>" % str... | Queries that create, destroy, or examine databases or tables rather than
working with actual data are instances of :class:`MetaQuery`. | 6259904d23e79379d538d92e |
class EncodingStyle_(SamlBase): <NEW_LINE> <INDENT> c_tag = 'encodingStyle' <NEW_LINE> c_namespace = NAMESPACE <NEW_LINE> c_children = SamlBase.c_children.copy() <NEW_LINE> c_attributes = SamlBase.c_attributes.copy() <NEW_LINE> c_child_order = SamlBase.c_child_order[:] <NEW_LINE> c_cardinality = SamlBase.c_cardinality.... | The http://schemas.xmlsoap.org/wsdl/soap/:encodingStyle element | 6259904d1f037a2d8b9e5284 |
class UnsupportedMediaType(HTTPError): <NEW_LINE> <INDENT> pass | docstring for UnsupportedMediaType | 6259904da219f33f346c7c32 |
class roleViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = role.objects.all() <NEW_LINE> serializer_class = roleSerializer | API endpoint that allows users to be viewed or edited. | 6259904d8a43f66fc4bf35c7 |
class SocosException(Exception): <NEW_LINE> <INDENT> pass | General socos exception | 6259904dd4950a0f3b11185b |
class PerFieldAnalyzerTestCase(PyLuceneTestCase): <NEW_LINE> <INDENT> def testPerField(self): <NEW_LINE> <INDENT> perField = HashMap() <NEW_LINE> perField.put("special", SimpleAnalyzer()) <NEW_LINE> analyzer = PerFieldAnalyzerWrapper(WhitespaceAnalyzer(), perField) <NEW_LINE> text = "Qwerty" <NEW_LINE> tokenStream = an... | Unit tests ported from Java Lucene | 6259904db57a9660fecd2ead |
class SparseVector(Vector): <NEW_LINE> <INDENT> def __init__(self, values, indices, length = 0, zero_test = lambda x : (x == 0)): <NEW_LINE> <INDENT> super(SparseVector, self).__init__(values, zero_test) <NEW_LINE> self.value=values <NEW_LINE> self.indice=indices <NEW_LINE> self.len=length <NEW_LINE> <DEDENT> def __len... | Vector that has very few non-zero entries
Values and corresponding indices are kept in separate lists | 6259904d8da39b475be04621 |
class ModalitiesReplacement(Transformer): <NEW_LINE> <INDENT> def __init__(self, column, replacement=dict()): <NEW_LINE> <INDENT> self.column = column <NEW_LINE> self.replacement = replacement <NEW_LINE> <DEDENT> def transform(self, data): <NEW_LINE> <INDENT> data = data.copy() <NEW_LINE> data[self.column] = data[self.... | Transformer which replaces modalities present in column
Parameters
----------
column : str
column on which modalities must be replaced
replacement : dict, optional, default is dict()
replacement pattern where keys are original modalities and
value is replacement
Attributes
----------
column : str
colu... | 6259904dec188e330fdf9ccf |
class ShiftUserField(fields.Raw): <NEW_LINE> <INDENT> def format(self, value): <NEW_LINE> <INDENT> u = User.query.get(value) <NEW_LINE> if u.name: <NEW_LINE> <INDENT> return u.name <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return u.email | get the user's name or email as a shift field | 6259904dac7a0e7691f7390c |
class updateAccount_args(object): <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRUCT, 'accountInfo', (AccountInfo, AccountInfo.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, accountInfo=None,): <NEW_LINE> <INDENT> self.accountInfo = accountInfo <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDE... | Attributes:
- accountInfo | 6259904d596a897236128fc7 |
class PrivateLinkConnectionApprovalRequestResource(ProxyOnlyResource): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'kind': {'key': 'kind',... | Private Endpoint Connection Approval ARM resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource Id.
:vartype id: str
:ivar name: Resource Name.
:vartype name: str
:ivar kind: Kind of resource.
:vartype kind: str
:ivar type: Resource type.
:vartype type: st... | 6259904dbe383301e0254c4c |
class PersonResponsibleJson(object): <NEW_LINE> <INDENT> def __init__(self, id = None, name = ''): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.name = name <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'id: {0} name {1}'.format(self.id, self.name) <NEW_LINE> <DEDENT> def getAllAPI(): <NEW_LINE> ... | This class manage the object and is used to map them into json format | 6259904da8ecb03325872643 |
class MyClass: <NEW_LINE> <INDENT> i = 12345 <NEW_LINE> def f(self): <NEW_LINE> <INDENT> return 'hello world' | 实例 | 6259904de76e3b2f99fd9e37 |
class RemoteData(DataBase, RemoteFileMixin): <NEW_LINE> <INDENT> _T = TypeVar("_T", bound="RemoteData") <NEW_LINE> def __init__( self, remote_path: str, *, timestamp: Optional[float] = None, url: Optional[URL] = None, cache_path: str = "", ) -> None: <NEW_LINE> <INDENT> DataBase.__init__(self, timestamp) <NEW_LINE> Rem... | RemoteData is a combination of a specific tensorbay dataset file and its label.
It contains the file remote path, label information of the file
and the file metadata, such as timestamp.
A RemoteData instance contains one or several types of labels.
Arguments:
remote_path: The file remote path.
timestamp: The... | 6259904d3cc13d1c6d466b6a |
class WussStructureTests(StructureStringTests): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.Struct = WussStructure <NEW_LINE> super(WussStructureTests,self).setUp() <NEW_LINE> self.WussNoPairs = WussStructure('.-_,~:') <NEW_LINE> self.WussOneHelix = WussStructure('[-{<(__)-->}]',-0.01) <NEW_LINE> self... | Test that WussStructure methods and properties work | 6259904dd53ae8145f919894 |
class GeneralTestCase(LiveServerTestCase): <NEW_LINE> <INDENT> selenium = None <NEW_LINE> created_user = None <NEW_LINE> login_required = True <NEW_LINE> def setUp(self) -> None: <NEW_LINE> <INDENT> self.setup_fixtures() <NEW_LINE> if self.login_required: <NEW_LINE> <INDENT> force_login(self.created_user, self.selenium... | Parent class to setup the selenium tests. | 6259904db57a9660fecd2eae |
class DjangoObjectPermissionsFilter(BaseFilterBackend): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> assert guardian, 'Using DjangoObjectPermissionsFilter, but django-guardian is not installed' <NEW_LINE> <DEDENT> perm_format = '%(app_label)s.view_%(model_name)s' <NEW_LINE> def filter_queryset(self, requ... | A filter backend that limits results to those where the requesting user
has read object level permissions. | 6259904d507cdc57c63a61d2 |
@total_ordering <NEW_LINE> class InformationElementList(object): <NEW_LINE> <INDENT> def __init__(self, iterable = None): <NEW_LINE> <INDENT> self.inner = [] <NEW_LINE> if iterable: <NEW_LINE> <INDENT> for x in iterable: <NEW_LINE> <INDENT> self.append(x) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def __iter__(self): <NEW_L... | A hashable ordered list of Information Elements.
Used internally by templates, and to specify the
order of tuples to the tuple append and iterator interfaces. Get an
instance by calling :func:`spec_list` | 6259904dcad5886f8bdc5a97 |
class ExtremeInitialization(Initialization): <NEW_LINE> <INDENT> def __init__(self, distance: dist.DistanceMetric): <NEW_LINE> <INDENT> self.distance = distance <NEW_LINE> <DEDENT> def __call__(self, data: Data, number_of_centroids: int) -> Centroids: <NEW_LINE> <INDENT> _validate(data, number_of_centroids) <NEW_LINE> ... | Initializes k-means by picking extreme points | 6259904d0c0af96317c5777a |
class _PrefetchToDeviceEagerIterator(iterator_ops.EagerIterator): <NEW_LINE> <INDENT> def __init__(self, input_dataset, device, buffer_size): <NEW_LINE> <INDENT> with ops.device("/device:CPU:0"): <NEW_LINE> <INDENT> super(_PrefetchToDeviceEagerIterator, self).__init__(input_dataset) <NEW_LINE> input_iterator_handle = c... | A replacement for `tf.data.Iterator` that prefetches to another device.
Args:
input_dataset: The input dataset
one_shot: If true, we make a one shot iterator that's already initialized.
device: A fully specified device string where we want to prefetch to
buffer_size: Size of the prefetching buffer.
shared_na... | 6259904d8e05c05ec3f6f874 |
class ListTopWafDataResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TopTypeData = None <NEW_LINE> self.TopIpData = None <NEW_LINE> self.TopUrlData = None <NEW_LINE> self.TopDomainData = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <N... | ListTopWafData返回参数结构体
| 6259904db5575c28eb7136e3 |
class Solution(object): <NEW_LINE> <INDENT> def rightSideView(self, root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> l = [] <NEW_LINE> q = [root] <NEW_LINE> while q: <NEW_LINE> <INDENT> l.append(q[-1].val) <NEW_LINE> new_q = [] <NEW_LINE> for node in q: <NEW_LINE> <INDENT> if no... | 给定一棵二叉树,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值。
示例:
输入: [1,2,3,null,5,null,4]
输出: [1, 3, 4]
解释:
1 <---
/ 2 3 <---
\ 5 4 <---
| 6259904d23e79379d538d931 |
class By(object): <NEW_LINE> <INDENT> id = "id" <NEW_LINE> xpath = "xpath" <NEW_LINE> link = "link text" <NEW_LINE> plink = "partial link text" <NEW_LINE> name = "name" <NEW_LINE> tag = "tag name" <NEW_LINE> cls = "class name" <NEW_LINE> css = "css selector" <NEW_LINE> aid = 'accessibility id' <NEW_LINE> ui = '-android... | Set of supported locator strategies | 6259904db830903b9686ee94 |
class Comment(Base): <NEW_LINE> <INDENT> __tablename__ = 'comments' <NEW_LINE> __exclude_columns__ = tuple() <NEW_LINE> __get_by__ = ('id',) <NEW_LINE> karma = Column(Integer, default=0) <NEW_LINE> karma_critpath = Column(Integer, default=0) <NEW_LINE> text = Column(UnicodeText, nullable=False) <NEW_LINE> timestamp = C... | An update comment.
Attributes:
karma (int): The karma associated with this comment. Defaults to 0.
karma_critpath (int): The critpath karma associated with this comment. Defaults to 0.
**DEPRECATED** no longer used in the UI
text (str): The text of the comment.
timestamp (datetime.datetime): Th... | 6259904dcb5e8a47e493cba0 |
class field_dict(dict): <NEW_LINE> <INDENT> def __init__(self, rank = 0): <NEW_LINE> <INDENT> self._rank = rank <NEW_LINE> self._run = False <NEW_LINE> self._accessedFields = {} <NEW_LINE> self._returnedFields = {} <NEW_LINE> dict.__init__(self) <NEW_LINE> <DEDENT> def readyToRun(self): <NEW_LINE> <INDENT> self._run = ... | Used for the state.xxx_fields dicts. It functions like a regular dict,
but remembers which keys are set and get when in the 'run' mode. | 6259904de76e3b2f99fd9e38 |
class DrawLine(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.enabled = False <NEW_LINE> self.shape = "Line" <NEW_LINE> self.intersecting_contours = deque() <NEW_LINE> <DEDENT> def onMouseDown(self, x, y, button, shift): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def onMouseDownMap(self, x,... | Implementation for contour_attributor.drawline (Tool) | 6259904d0a366e3fb87dde19 |
class ICollectiveCropimageLayer(Interface): <NEW_LINE> <INDENT> pass | Marker interface for browserlayer. | 6259904d23e79379d538d932 |
class SetTileSize(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "render.autotilesize_set" <NEW_LINE> bl_label = "Set" <NEW_LINE> @classmethod <NEW_LINE> def poll(clss, context): <NEW_LINE> <INDENT> return ats_poll(context) <NEW_LINE> <DEDENT> def execute(self, context): <NEW_LINE> <INDENT> if do_set_tile_size(co... | The first render may not obey the tile-size set here | 6259904d004d5f362081fa02 |
class DevicePluginMessageCollection(list): <NEW_LINE> <INDENT> def __init__(self, messages, priority=PRIO_NORMAL): <NEW_LINE> <INDENT> super(DevicePluginMessageCollection, self).__init__(messages) <NEW_LINE> self.priority = priority | Zero or more messages from a device plugin, to be consumed one by one by a service on
the manager server.
Return this instead of a naked {} or a DevicePluginMessage if you need to return
multiple messages from one callback. | 6259904d498bea3a75a58f54 |
class Furniture(Inventory): <NEW_LINE> <INDENT> inventory_type = "Furniture" <NEW_LINE> def __init__(self, product_code, description, market_price, rental_price, material, size): <NEW_LINE> <INDENT> Inventory.__init__(self, product_code, description, market_price, rental_price) <NEW_LINE> self.material = material <NEW_... | Represent an furniture | 6259904d50485f2cf55dc3c1 |
class EmpiresDatGzip: <NEW_LINE> <INDENT> def __init__(self, datfile_name): <NEW_LINE> <INDENT> self.fname = datfile_name <NEW_LINE> dbg("reading empires2*.dat from %s..." % self.fname, lvl=1) <NEW_LINE> filename = file_get_path(self.fname, write=False) <NEW_LINE> f = file_open(filename, binary=True, write=False) <NEW_... | uncompresses the gzip'd empires dat. | 6259904d07f4c71912bb0869 |
class ClusterControllerStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.CreateCluster = channel.unary_unary( "/google.cloud.dataproc.v1beta2.ClusterController/CreateCluster", request_serializer=google_dot_cloud_dot_dataproc__v1beta2_dot_proto_dot_clusters__pb2.CreateClusterRequest... | The ClusterControllerService provides methods to manage clusters
of Compute Engine instances. | 6259904d76d4e153a661dc92 |
class BarcodeMSI(BarcodeI2of5): <NEW_LINE> <INDENT> codeName = "MSI" <NEW_LINE> def __init__(self,**kw): <NEW_LINE> <INDENT> from reportlab.graphics.barcode.common import MSI <NEW_LINE> _BarcodeWidget.__init__(self,MSI,1234,**kw) | MSI is used for inventory control in retail applications.
There are several methods for calculating check digits so we
do not implement one. | 6259904d91af0d3eaad3b259 |
class CQIReportingEvent(events.EventBase): <NEW_LINE> <INDENT> def __init__(self, candidate_sigpower, curr_sigpower): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.candidate_sigpower = candidate_sigpower <NEW_LINE> self.curr_sigpower = curr_sigpower | Events reported by each AP. | 6259904d0c0af96317c5777b |
class EperTestCase(unittest.TestCase): <NEW_LINE> <INDENT> imaging_value = 100 <NEW_LINE> overscan_value = 1 <NEW_LINE> overscans = 2 <NEW_LINE> verbose = False | Base class for eper TestCase classes. | 6259904d097d151d1a2c24a4 |
class Srv(object): <NEW_LINE> <INDENT> def __init__(self, port, host=''): <NEW_LINE> <INDENT> sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) <NEW_LINE> self.port = port <NEW_LINE> sck.bind((host, port)) <NEW_LINE> sck.listen(1) <NEW_LINE> self._sck = sck <NEW_LINE> self._cnt = None <NEW_LINE> thread = threadin... | Listen to the Cnt connection and reply.
| 6259904dac7a0e7691f73910 |
class NoSession(Error): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.message = message | Execption raised when there is no existing API session
Attributes:
message (str): explanation of the error | 6259904d63d6d428bbee3c00 |
@node(params=['BRAINSTools_hash', 'ANTs_hash'], deps=['dwi']) <NEW_LINE> class DwiEd(NrrdOutput): <NEW_LINE> <INDENT> def static_build(self): <NEW_LINE> <INDENT> with BRAINSTools.env(self.BRAINSTools_hash), ANTs.env(self.ANTs_hash): <NEW_LINE> <INDENT> eddy_py['-i', self.dwi, '-o', self.output(), '--force', '-n', NCPU]... | Eddy current correction. Accepts nrrd only. | 6259904db830903b9686ee95 |
class CloudifyBaseLoggingHandler(logging.Handler): <NEW_LINE> <INDENT> def __init__(self, ctx, out_func, message_context_builder): <NEW_LINE> <INDENT> logging.Handler.__init__(self) <NEW_LINE> self.context = message_context_builder(ctx) <NEW_LINE> if _is_system_workflow(ctx): <NEW_LINE> <INDENT> out_func = stdout_log_o... | A base handler class for writing log messages to RabbitMQ | 6259904de76e3b2f99fd9e39 |
class Breeze(object): <NEW_LINE> <INDENT> def __init__(self, location): <NEW_LINE> <INDENT> self.location = location <NEW_LINE> self.known = False | Encapsulates a breeze.
| 6259904dd6c5a102081e3552 |
@dataclass <NEW_LINE> class ChannelSectionResponse(BaseApiResponse): <NEW_LINE> <INDENT> items: Optional[List[ChannelSection]] = field(default=None, repr=False) | A class representing the channel section's retrieve response info.
Refer: https://developers.google.com/youtube/v3/docs/channelSections/list?#properties_1 | 6259904d3eb6a72ae038ba91 |
class topdown_lateral_module(nn.Module): <NEW_LINE> <INDENT> def __init__(self, dim_in_top, dim_in_lateral): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.dim_in_top = dim_in_top <NEW_LINE> self.dim_in_lateral = dim_in_lateral <NEW_LINE> self.dim_out = dim_in_top <NEW_LINE> if cfg.FPN.USE_GN: <NEW_LINE> <INDEN... | Add a top-down lateral module. | 6259904d507cdc57c63a61d6 |
class Monitor(problem.OptimizationFunction): <NEW_LINE> <INDENT> def get_data(self, param: parametrization.Parametrization): <NEW_LINE> <INDENT> return self.calculate_objective_function(param) | Defines a monitor.
Monitors behave exactly as functions but do not implement differentiation.
This enables using the graph evaluation engine to share computation
when multiple monitors need to evaluated simultaneously.
This is mainly used to rename `calculate_objective_function` to
`get_data`, the latter of which is ... | 6259904d50485f2cf55dc3c3 |
class GenwebCoreControlPanel(controlpanel.ControlPanelFormWrapper): <NEW_LINE> <INDENT> form = GenwebCoreControlPanelSettingsForm | Genweb Core settings control panel | 6259904d8e71fb1e983bcefc |
class LoginView(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> if 'username' in request.COOKIES: <NEW_LINE> <INDENT> username = request.COOKIES.get('username') <NEW_LINE> checked = 'checked' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> username = '' <NEW_LINE> checked = '' <NEW_LINE> <DEDENT> r... | 登录 | 6259904d8da39b475be04627 |
class Solution: <NEW_LINE> <INDENT> def twoSum(self, nums, target): <NEW_LINE> <INDENT> l = 0 <NEW_LINE> r = len(nums) - 1 <NEW_LINE> while l < r: <NEW_LINE> <INDENT> if nums[l] + nums[r] == target: <NEW_LINE> <INDENT> return [l + 1, r + 1] <NEW_LINE> <DEDENT> if nums[l] + nums[r] < target: <NEW_LINE> <INDENT> l += 1 <... | @param: nums: an array of Integer
@param: target: target = nums[index1] + nums[index2]
@return: [index1 + 1, index2 + 1] (index1 < index2) | 6259904db57a9660fecd2eb3 |
class LineShape(Shape): <NEW_LINE> <INDENT> def __init__(self, pen, points): <NEW_LINE> <INDENT> Shape.__init__(self) <NEW_LINE> self.pen = pen.copy() <NEW_LINE> self.points = points <NEW_LINE> <DEDENT> def draw(self, painter, highlight=False): <NEW_LINE> <INDENT> pen = self.select_pen(highlight) <NEW_LINE> painter.set... | Used to draw a line with QPainter. | 6259904dcad5886f8bdc5a99 |
class VenueImage(ImageModel): <NEW_LINE> <INDENT> original_image = models.ImageField(upload_to='venue_images') <NEW_LINE> num_views = models.PositiveIntegerField(editable=False, default=0) <NEW_LINE> class IKOptions: <NEW_LINE> <INDENT> spec_module = 'venues.specs' <NEW_LINE> cache_dir = 'venue_images' <NEW_LINE> image... | A venue's image | 6259904d6fece00bbacccdf0 |
class Rectangle: <NEW_LINE> <INDENT> number_of_instances = 0 <NEW_LINE> def __init__(self, width=0, height=0): <NEW_LINE> <INDENT> self.width = width <NEW_LINE> self.height = height <NEW_LINE> Rectangle.number_of_instances += 1 <NEW_LINE> <DEDENT> @property <NEW_LINE> def height(self): <NEW_LINE> <INDENT> return self._... | creates a class Rectangle | 6259904dd10714528d69f0a9 |
class ITriggersQueueItem(ABC): <NEW_LINE> <INDENT> pass | Storage service queue item interface
@package FastyBird:MiniServer!
@module queue
@author Adam Kadlec <adam.kadlec@fastybird.com> | 6259904dac7a0e7691f73912 |
@singleton <NEW_LINE> class Settings(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.timeout = 10 <NEW_LINE> self.path_errors = 'errors' <NEW_LINE> self.path_log = 'log' <NEW_LINE> self.path_sqlite = 'instance' <NEW_LINE> self.name_database = 'base' <NEW_LINE> self.print_table=None <NEW_LINE> config... | Класс считывает настройки и хранит их | 6259904dec188e330fdf9cd6 |
class ZCave(grok.Model): <NEW_LINE> <INDENT> pass | we call this `ZCave` because we want to test that we do not
depend on alphabetical order | 6259904da79ad1619776b4b8 |
class SNP(_SNP): <NEW_LINE> <INDENT> def __new__(cls, name, chromosome, position, genotype, variation=None, strand=None): <NEW_LINE> <INDENT> return super(SNP, cls).__new__(cls, name, variation, chromosome, int(position), strand, genotype) | A wrapper for SNP data, provided by various formats. | 6259904db830903b9686ee96 |
class WaitingList(Base): <NEW_LINE> <INDENT> __tablename__ = 'waitinglist' <NEW_LINE> email = sqla.Column(sqla.Unicode(255), primary_key=True) <NEW_LINE> ipaddr = sqla.Column(sqla.Unicode(255)) <NEW_LINE> requested = sqla.Column(sqla.DateTime) <NEW_LINE> accepted = sqla.Column(sqla.DateTime) <NEW_LINE> completed = sqla... | Log the email, time and ipaddr
If we get another request from same ipaddr | 6259904d379a373c97d9a462 |
class _PartialStringStats(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.total_bytes_length = 0 <NEW_LINE> self.total_num_values = 0 | Holds partial statistics needed to compute the string statistics
for a single feature. | 6259904d3eb6a72ae038ba93 |
class GoalSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Goal <NEW_LINE> fields = ('id', 'name', 'date_created', 'date_modified') <NEW_LINE> read_only_fields = ('date_created', 'date_modified') | Serializer to map the Model instance into JSON format. | 6259904d29b78933be26aade |
class ParserErrorsDialog(Gtk.Dialog): <NEW_LINE> <INDENT> def __init__(self, error_logs): <NEW_LINE> <INDENT> GObject.GObject.__init__(self, title='Parser Errors', buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.ACCEPT)) <NEW_LINE> self._error_logs = None <NEW_LINE> self.tree_store = Gtk.TreeStore(str) <NEW_LINE> self.updat... | A dialog for viewing parser errors | 6259904d76e4537e8c3f09bd |
@six.add_metaclass(abc.ABCMeta) <NEW_LINE> class ExtensionDriver(object): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def initialize(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abc.abstractproperty <NEW_LINE> def extension_alias(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def process_create_netw... | Define stable abstract interface for ML2 extension drivers.
An extension driver extends the core resources implemented by the
ML2 plugin with additional attributes. Methods that process create
and update operations for these resources validate and persist
values for extended attributes supplied through the API. Other
... | 6259904d3cc13d1c6d466b70 |
class CustomLogger(object): <NEW_LINE> <INDENT> def __init__(self, logfilename): <NEW_LINE> <INDENT> self.logfilename = logfilename <NEW_LINE> self.msgs = [] <NEW_LINE> <DEDENT> def log(self, msg, timestamp=None): <NEW_LINE> <INDENT> if timestamp is None: <NEW_LINE> <INDENT> timestamp = time.time() <NEW_LINE> <DEDENT> ... | Logs information into file.
Attributes:
close(): closes program | 6259904d1f037a2d8b9e5288 |
class PasteComment(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'paste_comments' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False) <NEW_LINE> paste_id = db.Column(db.Integer, db.ForeignKey('pastes.id'), nullable=False) <NEW_LI... | 评论表 | 6259904d96565a6dacd2d9a5 |
class NetworkRuleSet(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'bypass': {'key': 'bypass', 'type': 'str'}, 'default_action': {'key': 'defaultAction', 'type': 'str'}, 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNet... | A set of rules governing the network accessibility of a vault.
:param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or
'None'. If not specified the default is 'AzureServices'. Possible values include:
"AzureServices", "None".
:type bypass: str or ~azure.mgmt.keyvault.v2018_02_14.m... | 6259904d50485f2cf55dc3c4 |
class ChatForm(Form): <NEW_LINE> <INDENT> message = TextField(label="Chat:", validators=[Length(min=1, max=MAX_CHAT)]) | User enters a chat message | 6259904d8a43f66fc4bf35cf |
class RetrieveHGMModel(SaveandRetrieveModel): <NEW_LINE> <INDENT> def __init__(self, filename=None): <NEW_LINE> <INDENT> SaveandRetrieveModel.__init__(self, filename=filename) <NEW_LINE> <DEDENT> def GetModel(self): <NEW_LINE> <INDENT> if self._filename is None: <NEW_LINE> <INDENT> raise Exception("Please enter the fil... | Retrieve the model from a specific file location. | 6259904d07f4c71912bb086d |
class QNetwork(nn.Module): <NEW_LINE> <INDENT> def __init__(self, state_size, action_size, hidden_layers, seed=42): <NEW_LINE> <INDENT> super(QNetwork, self).__init__() <NEW_LINE> self.seed = torch.manual_seed(seed) <NEW_LINE> layer_sizes = [state_size] + hidden_layers <NEW_LINE> layer_dims = zip(layer_sizes[:-1], laye... | Actor (Policy) Model. | 6259904dd99f1b3c44d06ad2 |
class ScheduleQueryHandler(base.BaseHandler): <NEW_LINE> <INDENT> @access_control.OwnerRestricted <NEW_LINE> @access_control.ValidXsrfTokenRequired <NEW_LINE> @access_control.ActiveGaSuperProxyUser <NEW_LINE> def post(self): <NEW_LINE> <INDENT> query_id = self.request.get('query_id') <NEW_LINE> api_query = query_helper... | Handles the scheduling of API Queries. Starting and stopping. | 6259904d009cb60464d02971 |
class PopupBreadcrumbTestCase(PopupBaseTestCase): <NEW_LINE> <INDENT> pat = ('http://nohost/plone%%srefbrowser_popup?fieldName=%s&' 'fieldRealName=%s&at_url=/plone/layer1/layer2/ref') <NEW_LINE> def test_breadcrumbs(self): <NEW_LINE> <INDENT> fieldname = 'multiRef3' <NEW_LINE> self.request.set('at_url', '/plone/layer1/... | Test the popup breadcrumbs | 6259904d26068e7796d4dd7d |
class HPDaPhyDrvMap(HPHardDiskMap): <NEW_LINE> <INDENT> maptype = "HPDaPhyDrvMap" <NEW_LINE> modname = "ZenPacks.community.HPMon.cpqDaPhyDrv" <NEW_LINE> snmpGetTableMaps = ( GetTableMap('cpqDaPhyDrvTable', '.1.3.6.1.4.1.232.3.2.5.1.1', { '.3': 'description', '.4': 'FWRev', '.5': 'bay', '.6': 'status', '.45': 'size', '.... | Map HP/Compaq insight manager DA Hard Disk tables to model. | 6259904d16aa5153ce401927 |
class Place(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=255) <NEW_LINE> description = models.TextField(null=True) <NEW_LINE> address = models.CharField(max_length=255, null=True) <NEW_LINE> zipcode = models.CharField(max_length=10, blank=True, help_text="Code postal / Zipcode") <NEW_LINE> city... | Some place belonging to an organization | 6259904dd6c5a102081e3557 |
class MongoInstrumentedAttribute(object): <NEW_LINE> <INDENT> def __init__(self, attr, db, *args): <NEW_LINE> <INDENT> self.__attr = attr <NEW_LINE> self.__db = db <NEW_LINE> if args: <NEW_LINE> <INDENT> self.original_class_value, = args <NEW_LINE> <DEDENT> <DEDENT> def __get__(self, entity, entity_class): <NEW_LINE> <... | Lazy resolution of relation attributes through Mongo DB refs. | 6259904dd53ae8145f91989c |
class Minimizable(sgqlc.types.Interface): <NEW_LINE> <INDENT> __schema__ = github_schema <NEW_LINE> __field_names__ = ('is_minimized', 'minimized_reason', 'viewer_can_minimize') <NEW_LINE> is_minimized = sgqlc.types.Field(sgqlc.types.non_null(Boolean), graphql_name='isMinimized') <NEW_LINE> minimized_reason = sgqlc.typ... | Entities that can be minimized. | 6259904df7d966606f7492d5 |
class BaseQuestionnaireTests(actions.TestBase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(BaseQuestionnaireTests, self).setUp() <NEW_LINE> actions.login(ADMIN_EMAIL, is_admin=True) <NEW_LINE> self.base = '/' + COURSE_NAME <NEW_LINE> test_course = actions.simple_add_course( COURSE_NAME, ADMIN_EMAIL,... | Tests for REST endpoint and tag renderer. | 6259904d435de62698e9d242 |
class ElementSin(Node): <NEW_LINE> <INDENT> result_types = { ('Matrix',): Matrix, ('Vector',): Vector, ('Scalar',): Scalar } <NEW_LINE> operation_node_type = _v.operation_node_type.OPERATION_UNARY_SIN_TYPE <NEW_LINE> def _node_init(self): <NEW_LINE> <INDENT> self.shape = self.operands[0].shape | Represent the elementwise computation of ``sin`` on an object. | 6259904d07d97122c42180de |
class Guard(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.id = str(random.random())+str(time.time()) <NEW_LINE> <DEDENT> def post_read(self, req): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def post_write(self, req): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def remove_read(self, req): <NEW_L... | The empty interface of a guard. | 6259904d8e71fb1e983bcf00 |
class StrSQLCompiler(SQLCompiler): <NEW_LINE> <INDENT> def _fallback_column_name(self, column): <NEW_LINE> <INDENT> return "<name unknown>" <NEW_LINE> <DEDENT> def visit_getitem_binary(self, binary, operator, **kw): <NEW_LINE> <INDENT> return "%s[%s]" % ( self.process(binary.left, **kw), self.process(binary.right, **kw... | A :class:`.SQLCompiler` subclass which allows a small selection
of non-standard SQL features to render into a string value.
The :class:`.StrSQLCompiler` is invoked whenever a Core expression
element is directly stringified without calling upon the
:meth:`_expression.ClauseElement.compile` method.
It can render a limit... | 6259904dcad5886f8bdc5a9b |
class Meta: <NEW_LINE> <INDENT> interface = output.IOutput <NEW_LINE> label = 'null' | Handler meta-data | 6259904d4428ac0f6e65996d |
class SequenceIterator(object): <NEW_LINE> <INDENT> def __init__(self, handle, alphabet=generic_alphabet): <NEW_LINE> <INDENT> self.handle = handle <NEW_LINE> self.alphabet = alphabet <NEW_LINE> <DEDENT> def __next__(self): <NEW_LINE> <INDENT> raise NotImplementedError("The subclass should implement the __next__ method... | Base class for building SeqRecord iterators.
You should write a __next__ method to return SeqRecord objects. You may
wish to redefine the __init__ method as well. | 6259904dec188e330fdf9cda |
class DictString(object): <NEW_LINE> <INDENT> def dict2data(self, dict): <NEW_LINE> <INDENT> return '\n'.join(['%s\t%s' % (key,value) for (key,value) in dict.items()]) <NEW_LINE> <DEDENT> def data2dict(self, string): <NEW_LINE> <INDENT> return dict([entry.split('\t') for entry in string.split('\n')]) | Dictionary to data file strukture (string):
url1 url2
url1 url2
...
and vice versa | 6259904da8ecb0332587264d |
class StrPacker(BytesPacker): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def pack_pk(user_pk): <NEW_LINE> <INDENT> user_pk = user_pk.encode() <NEW_LINE> length = len(user_pk) <NEW_LINE> if length > 255: <NEW_LINE> <INDENT> raise ValueError("Primary key is too large (%d UTF-8 bytes)" % length) <NEW_LINE> <DEDENT> retu... | Generic packer for strings, from 0 to 255 UTF-8 encoded bytes. | 6259904dd486a94d0ba2d400 |
class AgeFilter(Q): <NEW_LINE> <INDENT> def __init__(self, field1_name, field2_name, operator, value): <NEW_LINE> <INDENT> self._field1_name = field1_name <NEW_LINE> self._field2_name = field2_name <NEW_LINE> self._operator = operator <NEW_LINE> self._value = value <NEW_LINE> super(AgeFilter, self).__init__() <NEW_LINE... | Q subclass for adding age based queries
Arguments:
field1_name (will follow relationships)
field2_name (will follow relationships)
operator (should include value placeholder, e.g. "< %s"
value
Usage:
queryset = queryset.filter(
AgeFilter(
'related__model__field',
'... | 6259904d0fa83653e46f631a |
class CorrectDescriptions(QtWidgets.QDialog): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> if parent is None: <NEW_LINE> <INDENT> self.showprocesslog = print <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.showprocesslog = parent.showprocesslog <NEW_LIN... | Correct SEISAN descriptions.
This compares the descriptions found in SEISAN type 3 lines to a custom
list.
Attributes
----------
parent : parent
reference to the parent routine
indata : dictionary
dictionary of input datasets
outdata : dictionary
dictionary of output datasets | 6259904d0a50d4780f7067db |
class OffersAccept(View): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get(request, pk): <NEW_LINE> <INDENT> offer = get_object_or_404(Offer, pk=pk) <NEW_LINE> if ( request.user.is_authenticated() and request.user.userprofile.is_administrator ): <NEW_LINE> <INDENT> offer.publish() <NEW_LINE> messages.info(request, ... | Class view responsible for acceptance of offers | 6259904d23849d37ff8524fa |
class NIC(models.Model): <NEW_LINE> <INDENT> name = models.CharField('网卡名称', max_length=128) <NEW_LINE> hwaddr = models.CharField('网卡mac地址', max_length=64) <NEW_LINE> netmask = models.CharField(max_length=64) <NEW_LINE> ipaddrs = models.CharField('ip地址', max_length=256) <NEW_LINE> up = models.BooleanField(default=False... | 网卡信息 | 6259904d507cdc57c63a61dc |
class RoofSlope(BSElement): <NEW_LINE> <INDENT> element_type = "xs:string" <NEW_LINE> element_enumerations = [ "Flat", "Sloped", "Greater than 2 to 12", "Less than 2 to 12", "Other", "Unknown", ] | A descriptive value for tilt, when an exact numeric angle is not known. | 6259904d45492302aabfd910 |
class ShowLldpTraffic(ShowLldpTrafficSchema): <NEW_LINE> <INDENT> cli_command = 'show lldp traffic' <NEW_LINE> exclude = ['frame_in' , 'frame_out', 'tlv_discard', 'tlv_unknown'] <NEW_LINE> def cli(self,output=None): <NEW_LINE> <INDENT> if output is None: <NEW_LINE> <INDENT> out = self.device.execute(self.cli_command) <... | Parser for show lldp traffic | 6259904d462c4b4f79dbce3d |
class Get_ip(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Get_ip, self).__init__() <NEW_LINE> self.url='http://www.xicidaili.com/nn/' <NEW_LINE> self.headers = { 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0', 'Accept': 'text/html,application/x... | docstring for Get_ip | 6259904d15baa723494633c9 |
class MapOidCbor(_types._OidKeysMixin, _types._CborValuesMixin, PersistentMap): <NEW_LINE> <INDENT> def __init__(self, slot=None, compress=None, marshal=None, unmarshal=None): <NEW_LINE> <INDENT> PersistentMap.__init__(self, slot=slot, compress=compress) <NEW_LINE> _types._CborValuesMixin.__init__(self, marshal=marshal... | Persistent map with OID (uint64) keys and CBOR values. | 6259904dec188e330fdf9cdc |
class NoHostsAvailable(RuntimeError): <NEW_LINE> <INDENT> pass | Exception raised when no hosts specified in KerberosConnectionPool are available. | 6259904dd6c5a102081e355a |
class NeosLibvirtVM(object): <NEW_LINE> <INDENT> def __init__(self, instance): <NEW_LINE> <INDENT> self._instance = instance <NEW_LINE> self.name = self._instance.name() <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "<{0} ({1}): {2}>".format(self.__class__.__name__, self.status, self.name) <NEW_LIN... | Initialize libvirt instance. | 6259904dd53ae8145f91989f |
class LessVariableListAPIView(LessVariableMixin, generics.ListAPIView): <NEW_LINE> <INDENT> serializer_class = LessVariableSerializer <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> queryset = LessVariable.objects.filter( account=self.account, cssfile=self.get_cssfile()) <NEW_LINE> return queryset | Lists a website css variables
**Examples
.. code-block:: http
GET /api/themes/sitecss/variables/ HTTP/1.1
responds
.. code-block:: json
{
"count": 1,
"previous": null,
"next": null,
"results": [{
"name": "primary-color",
"value": "#ff0000",
"created_at": "2... | 6259904d8a43f66fc4bf35d5 |
class Unique(model.Model): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def create(cls, value): <NEW_LINE> <INDENT> entity = cls(key=model.Key(cls, value)) <NEW_LINE> txn = lambda: entity.put() if not entity.key.get() else None <NEW_LINE> return model.transaction(txn) is not None <NEW_LINE> <DEDENT> @classmethod <NEW_LI... | A model to store unique values.
The only purpose of this model is to "reserve" values that must be unique
within a given scope, as a workaround because datastore doesn't support
the concept of uniqueness for entity properties.
For example, suppose we have a model `User` with three properties that
must be unique acros... | 6259904d507cdc57c63a61de |
class SshTunnel(object): <NEW_LINE> <INDENT> def __init__(self, host, local_port, remote_port, port_ssh=None, user=None, password=None, private_key=None, private_key_password=None, remote_address=None): <NEW_LINE> <INDENT> ssh_port = 22 <NEW_LINE> if port_ssh is not None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ss... | SSH tunnel | 6259904d50485f2cf55dc3cb |
class SequentialDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, image_provider, image_indexes, config, stage='test', transforms=ToTensor()): <NEW_LINE> <INDENT> super(SequentialDataset, self).__init__(image_provider, image_indexes, config, stage, transforms=transforms) <NEW_LINE> self.good_tiles = [] <NEW_LINE... | dataset for inference | 6259904d8da39b475be0462f |
class DataObject: <NEW_LINE> <INDENT> def __init__(self, from_dict=None): <NEW_LINE> <INDENT> _from_dict = from_dict is not None and isinstance(from_dict, dict) <NEW_LINE> self._lock = RLock() <NEW_LINE> self._initialized = False <NEW_LINE> if _from_dict and not self._initialized: <NEW_LINE> <INDENT> for key, val in fr... | Generic object used to store data/settings as attributes.
Args:
from_dict (dict): Initialize object using dict. | 6259904dcad5886f8bdc5a9d |
class Sqlite(Download): <NEW_LINE> <INDENT> ext = 'sqlite' <NEW_LINE> def create(self, req): <NEW_LINE> <INDENT> print('+---------------------------------------------+') <NEW_LINE> print('| This download must be created "by hand".') <NEW_LINE> print('| Make sure a suitable file is available at') <NEW_LINE> print('|', s... | Generic download - no support for file creation. | 6259904d7cff6e4e811b6e79 |
class ParentsChildsFullDataViewSet(BaseViewSet): <NEW_LINE> <INDENT> permission_code = 'parentschilds' <NEW_LINE> queryset = ParentsChilds.objects.all().select_related('parent', 'child', 'relationship', 'created_by','updated_by') <NEW_LINE> serializer_class = ParentsChildsFullDataSerializer <NEW_LINE> filter_class = Pa... | Parents Childs views full data
FILTROS:
'id': ['exact'],
'description':['exact', 'icontains'],
'type_diagnostic':['exact',],
'created_at': ['exact', 'year', 'year__gte', 'year__lte', 'month', 'month__lte', 'month__gte', 'day', 'day__lte', 'day__gte', 'year__in', 'month__in', 'day__in'],
'created_by_... | 6259904d3c8af77a43b6895d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.