code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class RoleModelForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = models.Role <NEW_LINE> fields = ['title', ] <NEW_LINE> widgets = { 'title': forms.TextInput(attrs={'class': 'layui-input'}) } | ModelForm自动渲染form的类,便于下面调用 | 625990343eb6a72ae038b76f |
class RoleAssignmentOwnerTransferForm(SODARForm): <NEW_LINE> <INDENT> def __init__(self, project, current_user, current_owner, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self.current_user = current_user <NEW_LINE> self.project = project <NEW_LINE> self.current_owner = current_own... | Form for transferring owner role assignment between users | 62599034a4f1c619b294f6ff |
class PrePublishSquashPlugin(PrePublishPlugin): <NEW_LINE> <INDENT> key = "squash" <NEW_LINE> is_allowed_to_fail = False <NEW_LINE> def __init__(self, workflow, tag=None, from_base=True, from_layer=None, dont_load=False, save_archive=True): <NEW_LINE> <INDENT> super(PrePublishSquashPlugin, self).__init__(workflow) <NEW... | This feature requires docker-squash package to be installed in version 1.0.0rc3
or higher.
Usage:
A json build config file should be created with following content:
```
"prepublish_plugins": [{
"name": "squash",
"args": {
"tag": "SQUASH_TAG",
"from_layer": "FROM_LAYER",
"dont_load... | 62599034ac7a0e7691f735f0 |
class TestDanger(TestInfotech): <NEW_LINE> <INDENT> def check_stats(self, info, val_types, val_methods, counts): <NEW_LINE> <INDENT> from oeg_infotech.base import DistItem <NEW_LINE> from oeg_infotech import defect <NEW_LINE> stats_values, stats_counts = info.defects.danger_stats() <NEW_LINE> self.assert_list(stats_val... | Defects danger stuff. | 62599034be383301e025491c |
class RegisterMatmul(object): <NEW_LINE> <INDENT> def __init__(self, lin_op_cls_a, lin_op_cls_b): <NEW_LINE> <INDENT> self._key = (lin_op_cls_a, lin_op_cls_b) <NEW_LINE> <DEDENT> def __call__(self, matmul_fn): <NEW_LINE> <INDENT> if not callable(matmul_fn): <NEW_LINE> <INDENT> raise TypeError( "matmul_fn must be callab... | Decorator to register a Matmul implementation function.
Usage:
@linear_operator_algebra.RegisterMatmul(
lin_op.LinearOperatorIdentity,
lin_op.LinearOperatorIdentity)
def _matmul_identity(a, b):
# Return the identity matrix. | 62599034d164cc617582207a |
class _unlatex: <NEW_LINE> <INDENT> def __iter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def __init__(self,tex): <NEW_LINE> <INDENT> self.tex = tuple(_tokenize(tex)) <NEW_LINE> self.pos = 0 <NEW_LINE> self.lastoutput = 'x' <NEW_LINE> <DEDENT> def __getitem__(self,n): <NEW_LINE> <INDENT> p = self.pos ... | Convert tokenized tex into sequence of unicode strings. Helper for decode(). | 6259903473bcbd0ca4bcb38f |
class UniformShell(pml.SubmodularShell): <NEW_LINE> <INDENT> def configTypes(self): <NEW_LINE> <INDENT> return dict(self.config().items(),std=float,gridResolution=readArray,gridMargin=readArray) <NEW_LINE> <DEDENT> def createGrid(self): <NEW_LINE> <INDENT> self.grid = np.zeros(tuple(self._gridResolution)+(len(self._gri... | A general coverage shell in n-dimensions. In practice, it is instantiated for small dimensions like geocoverage, timecoverage. | 625990349b70327d1c57fe8d |
class TranslationCall(BrowserView): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> from zeep import Client <NEW_LINE> from zeep.wsse.username import UsernameToken <NEW_LINE> client = Client( 'https://webgate.ec.europa.eu/etranslation/si/WSEndpointHandlerService?WSDL', wsse=UsernameToken('Marine_EEA_2018070... | Call Translation class | 6259903430c21e258be99915 |
class InputURLList: <NEW_LINE> <INDENT> def __init__(self, attributes): <NEW_LINE> <INDENT> self._path = None <NEW_LINE> self._encoding = None <NEW_LINE> if not ValidateAttributes('URLLIST', attributes, ('path', 'encoding')): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self._path = attributes.get('path') <NEW_LINE> ... | Each Input class knows how to yield a set of URLs from a data source.
This one handles a text file with a list of URLs | 6259903426068e7796d4da53 |
class Config(object): <NEW_LINE> <INDENT> DEBUG = False <NEW_LINE> TESTING = False <NEW_LINE> HOST = "0.0.0.0" <NEW_LINE> PORT = 8000 <NEW_LINE> LOGGING_CONFIG = { "version": 1, "disable_existing_loggers": False, "formatters": { "default": { "format": ( "%(asctime)s - %(name)s [%(levelname)s]: %(message)s " "%(module)s... | Common configurations | 6259903430c21e258be99916 |
class ThreadPool: <NEW_LINE> <INDENT> def __init__(self, num_threads): <NEW_LINE> <INDENT> self.tasks = Queue(num_threads) <NEW_LINE> for _ in range(num_threads): <NEW_LINE> <INDENT> Worker(self.tasks) <NEW_LINE> <DEDENT> <DEDENT> def add_task(self, func, *args, **kargs): <NEW_LINE> <INDENT> self.tasks.put((func, args,... | Pool of threads consuming tasks from a queue | 625990348c3a8732951f7662 |
class DefaultFactory: <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __call__(self, **kwargs): <NEW_LINE> <INDENT> data = kwargs.copy() <NEW_LINE> return data | This is the default factory used by relatorio.
It just returns a copy of the data it receives | 62599034b830903b9686ecff |
class Unevaluated(Builtin): <NEW_LINE> <INDENT> attributes = ('HoldAllComplete',) | <dl>
<dt>'Unevaluated[$expr$]'
<dd>temporarily leaves $expr$ in an unevaluated form when it
appears as a function argument.
</dl>
'Unevaluated' is automatically removed when function arguments are
evaluated:
>> Sqrt[Unevaluated[x]]
= Sqrt[x]
>> Length[Unevaluated[1+2+3+4]]
= 4
'Unevaluated' has attribute 'H... | 625990341d351010ab8f4c23 |
class CreateEndpoint(show.ShowOne): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + '.CreateEndpoint') <NEW_LINE> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(CreateEndpoint, self).get_parser(prog_name) <NEW_LINE> parser.add_argument( 'service', metavar='<service>', help=_('New endpoint se... | Create new endpoint | 62599034d6c5a102081e322f |
class ConnectionError(InstascrapeError): <NEW_LINE> <INDENT> def __init__(self, url: str): <NEW_LINE> <INDENT> super().__init__("Failed to connect to '{0}'.".format(url)) | Raised when Instascrape fails to connect to Instagram server. | 6259903476d4e153a661daf6 |
class DatetimeDescriptor(ScalarDescriptor): <NEW_LINE> <INDENT> default_instance = datetime.datetime.fromtimestamp(0) <NEW_LINE> type_cls = datetime.datetime <NEW_LINE> def sortkey(self, coerced): <NEW_LINE> <INDENT> return super(DatetimeDescriptor, self).sortkey(coerced).strftime("%s") | Python's datetime is a special snowflake that requires some massaging.
This is just like ScalarDescriptor, except it works around the weirdness
in datetime's sorting behavior and absence of default parameters in the
constructor. | 6259903415baa723494630a4 |
class PickGame(object): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> top = self.top = tk.Toplevel(parent) <NEW_LINE> top.title('Pick a Game') <NEW_LINE> self.choice = tk.Entry(top, width=10) <NEW_LINE> self.maxlim = len(parent._start_confs)*2 <NEW_LINE> self.entry_label = tk.Label(top, text='Choo... | Pop-up window in lights out game, allows selection of game by number. | 6259903407d97122c4217db2 |
class AnalyticEuropeanStockOptionSolver(OptionSolver): <NEW_LINE> <INDENT> def solve_option_price(self, option): <NEW_LINE> <INDENT> underlying = option.assets[0] <NEW_LINE> spot = underlying.spot <NEW_LINE> vol = underlying.vol <NEW_LINE> risk_free = option.risk_free <NEW_LINE> expiry = option.expiry <NEW_LINE> strike... | A Black-Scholes stock option pricer. Only works for European stock options | 62599034b57a9660fecd2b8f |
class NetRpcNfsd(ReadFile): <NEW_LINE> <INDENT> FILENAME = ospath.join('proc', 'net', 'rpc', 'nfsd') <NEW_LINE> KEY = 'netrpcnfsd' <NEW_LINE> FIELDS = { 'net': ('packets', 'udp', 'tcp', 'tcpconn', ), 'rpc': ('calls', 'badcalls', 'badclnt', 'badauth', 'xdrcall', ), 'ra': ('size', 'deep10', 'deep20', 'deep30', 'deep40', ... | NetRpcNfsd handling | 625990348e05c05ec3f6f6e0 |
class Settings(db.Model, BaseMixin): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> darkmode = db.Column(db.Boolean, default=False) <NEW_LINE> api_key = db.Column(db.String) <NEW_LINE> @staticmethod <NEW_LINE> def get_api_key(): <NEW_LINE> <INDENT> s = Settings.query.first() <NEW_LINE> if s... | Global Application Settings. (SQL Alchemy model) | 625990348a43f66fc4bf3293 |
@register <NEW_LINE> class ArrayContains(FunctionSignature): <NEW_LINE> <INDENT> name = "arrayContains" <NEW_LINE> argument_types = [TypeHint.Array, TypeHint.primitives()] <NEW_LINE> return_value = TypeHint.Boolean <NEW_LINE> additional_types = TypeHint.primitives() <NEW_LINE> @classmethod <NEW_LINE> def run(cls, array... | Check if ``value`` is a member of the array ``some_array``. | 625990348a349b6b43687349 |
class TybaltAutoban(commands.Cog): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.config = Config.get_conf(self, identifier=1840351931) <NEW_LINE> default_guild = { 'ban_like': [], 'ban_regex': [] } <NEW_LINE> self.config.register_guild(**default_guild) <NEW_LINE> <DEDENT... | TybaltAutoban. | 6259903496565a6dacd2d812 |
class BrokenCtypesTest(NormalTest): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> uptime.ctypes = None <NEW_LINE> delattr(uptime, 'struct') <NEW_LINE> delattr(uptime, 'os') | It's ridiculous how many platforms don't have ctypes. This class simulates
that. | 62599034d10714528d69ef11 |
class SpecsSpreadsheet(object): <NEW_LINE> <INDENT> def __init__(self, creds_file, spreadsheet_id): <NEW_LINE> <INDENT> self.service = self.login(creds_file, spreadsheet_id) <NEW_LINE> self.spreadsheet_id = spreadsheet_id <NEW_LINE> <DEDENT> def login(self, creds_file, spreadsheet_id): <NEW_LINE> <INDENT> creds = None ... | Handles auth/requests for a single login + spreadsheet
| 625990349b70327d1c57fe91 |
class FocusMimics(MappingRule): <NEW_LINE> <INDENT> mapping = { "focus chrome": Mimic("switch", "to", "Google Chrome"), "focus note": Mimic("switch", "to", "notepad++"), "focus word": Mimic("switch", "to", "Microsoft Word"), "focus evernote": Mimic("switch", "to", "evernote"), "focus fire": Mimic("switch", "to", "Firef... | This mimics the "switch to" command from DNS to use the Dragonfly "focus" command syntax.
The main definitions of the Dragonfly "focus" command are in _window_control.py. | 62599034ec188e330fdf99a1 |
class Click(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def login_button(driver): <NEW_LINE> <INDENT> login_button = Browser._FieldHelper.find_element(driver, xpath=web_elements.login_button) <NEW_LINE> login_button.click() | The class allows the Browser to click on the various button on the page | 625990340a366e3fb87ddaf3 |
class DashbordViewWidget(FWidget): <NEW_LINE> <INDENT> def __init__(self, parent=0, *args, **kwargs): <NEW_LINE> <INDENT> super(DashbordViewWidget, self).__init__( parent=parent, *args, **kwargs) <NEW_LINE> self.parentWidget().set_window_title("TABLEAU DE BORD") <NEW_LINE> self.parent = parent <NEW_LINE> vbox = QVBoxLa... | Shows the home page | 6259903450485f2cf55dc08b |
class Product(_messages.Message): <NEW_LINE> <INDENT> imageUri = _messages.StringField(1) <NEW_LINE> productId = _messages.StringField(2) <NEW_LINE> score = _messages.FloatField(3, variant=_messages.Variant.FLOAT) | Information about a product. .
Fields:
imageUri: The URI of the image which matched the query image. This field
is returned only if `view` is set to `FULL` in the request.
productId: Product ID.
score: A confidence level on the match, ranging from 0 (no confidence) to
1 (full confidence). This field is... | 6259903426238365f5fadc61 |
class ErrorLoadingConfig(Exception): <NEW_LINE> <INDENT> def __init__(self, config_file, message=None): <NEW_LINE> <INDENT> message = 'Failed in reading config file %s. Original message: %s' % (config_file, message) <NEW_LINE> Exception.__init__(self, message) | Exception class, which is used for config loading exceptions. | 62599034d4950a0f3b1116c5 |
class BeamSearch: <NEW_LINE> <INDENT> def __init__(self, beam_size: int) -> None: <NEW_LINE> <INDENT> self._beam_size = beam_size <NEW_LINE> <DEDENT> def search(self, num_steps: int, initial_state: DecoderState, decoder_step: DecoderStep, keep_final_unfinished_states: bool = True) -> Dict[int, List[DecoderState]]: <NEW... | This class implements beam search over transition sequences given an initial ``DecoderState``
and a ``DecoderStep``, returning the highest scoring final states found by the beam (the states
will keep track of the transition sequence themselves).
The initial ``DecoderState`` is assumed to be `batched`. The value we re... | 6259903466673b3332c31500 |
class BernsteinDualSet(DualSet): <NEW_LINE> <INDENT> def __init__(self, ref_el, degree): <NEW_LINE> <INDENT> topology = ref_el.get_topology() <NEW_LINE> entity_ids = {dim: {entity_i: [] for entity_i in entities} for dim, entities in topology.items()} <NEW_LINE> inverse_topology = {vertices: (dim, entity_i) for dim, ent... | The dual basis for Bernstein elements. | 625990346e29344779b01760 |
class DigitClassificationModel(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.layers = [] <NEW_LINE> self.layers.append(Layer(784, 400, True, True)) <NEW_LINE> self.layers.append(Layer(400, 80, True, True)) <NEW_LINE> self.layers.append(Layer(80, 10, True, True)) <NEW_LINE> self.batch_size = ... | A model for handwritten digit classification using the MNIST dataset.
Each handwritten digit is a 28x28 pixel grayscale image, which is flattened
into a 784-dimensional vector for the purposes of this model. Each entry in
the vector is a floating point number between 0 and 1.
The goal is to sort each digit into one o... | 62599034be383301e0254922 |
class PasswordInputPlugin(FormFieldPlugin): <NEW_LINE> <INDENT> uid = UID <NEW_LINE> name = _("Password") <NEW_LINE> group = _("Fields") <NEW_LINE> form = PasswordInputForm <NEW_LINE> def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs): <NEW_LINE> <INDENT> widget_attrs... | Password field plugin. | 62599034711fe17d825e1522 |
class Zone: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.records = {} <NEW_LINE> <DEDENT> def add_node(self, name, record_set): <NEW_LINE> <INDENT> self.records[name] = record_set <NEW_LINE> <DEDENT> def read_master_file(self, filename): <NEW_LINE> <INDENT> with open(filename) as file: <NEW_LINE> <I... | A zone in the domain name space | 6259903473bcbd0ca4bcb396 |
class ParamsBaseClass: <NEW_LINE> <INDENT> def to_dict(self): <NEW_LINE> <INDENT> return self.__dict__ <NEW_LINE> <DEDENT> def from_dict(self, params_dict): <NEW_LINE> <INDENT> self.__dict__.update(params_dict) | . | 62599034287bf620b6272cf6 |
class ReplacePreview(megrok.pagelet.Pagelet): <NEW_LINE> <INDENT> grok.layer(asm.cmsui.interfaces.ICMSSkin) <NEW_LINE> grok.require('asm.cms.EditContent') <NEW_LINE> def update(self): <NEW_LINE> <INDENT> self.search = self.request.form.get('search', '') <NEW_LINE> self.found = 0 <NEW_LINE> self.results = [] <NEW_LINE> ... | Given a users search and replace terms show a list of all matches. | 625990348a43f66fc4bf3297 |
class Entry(models.Model): <NEW_LINE> <INDENT> topic = models.ForeignKey(Topic, on_delete=models.PROTECT) <NEW_LINE> text = models.TextField() <NEW_LINE> date_added = models.DateTimeField(auto_now_add=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name_plural = 'entries' <NEW_LINE> <DEDENT> def __str__(self):... | Информация, изученная пользователем по теме | 625990348c3a8732951f7667 |
class ApproximateQAgent(PacmanQAgent): <NEW_LINE> <INDENT> def __init__(self, extractor='IdentityExtractor', **args): <NEW_LINE> <INDENT> self.featExtractor = util.lookup(extractor, globals())() <NEW_LINE> PacmanQAgent.__init__(self, **args) <NEW_LINE> self.weights = util.Counter() <NEW_LINE> <DEDENT> def getWeights(se... | ApproximateQLearningAgent
You should only have to overwrite getQValue
and update. All other QLearningAgent functions
should work as is. | 6259903430c21e258be9991b |
class GRUCell(RNNCellBase): <NEW_LINE> <INDENT> def __init__(self, input_size, hidden_size, bias=True): <NEW_LINE> <INDENT> super(GRUCell, self).__init__(input_size, hidden_size,bias, num_chunks=3) <NEW_LINE> <DEDENT> def forward(self, input, h=None): <NEW_LINE> <INDENT> self.check_forward_input(input) <NEW_LINE> if h ... | egin{array}{ll}
r = \sigma(W_{ir} x + b_{ir} + W_{hr} h + b_{hr}) \
z = \sigma(W_{iz} x + b_{iz} + W_{hz} h + b_{hz}) \
n = anh(W_{in} x + b_{in} + r * (W_{hn} h + b_{hn})) \
h' = (1 - z) * n + z * h
\end{array}
Inputs: input, hidden
- **input** of shape `(batch, input_size)`: tensor containing input features
- *... | 62599034a8ecb0332587232c |
class Teacher(models.Model): <NEW_LINE> <INDENT> teacher_name = models.CharField(max_length=40) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.teacher_name | Teacher model. | 62599034d18da76e235b79d6 |
class Movie: <NEW_LINE> <INDENT> def __init__(self, name, room, seat, schedule): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.room = room <NEW_LINE> self.total_seat = seat <NEW_LINE> self.free_seat = random.randint(1, 50) <NEW_LINE> self.schedule = schedule <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <IND... | CLass créant un objet "film" contenant le nom du film
la salle de projection ainsi que les horaires. | 6259903421bff66bcd723d75 |
class EvalModelFn(beam.DoFn): <NEW_LINE> <INDENT> def __init__(self, config, checkpoint): <NEW_LINE> <INDENT> self.config = config <NEW_LINE> self.checkpoint = checkpoint <NEW_LINE> self.wrapper = None <NEW_LINE> <DEDENT> def get_wrapper(self): <NEW_LINE> <INDENT> self.wrapper = inference_utils.get_inference_wrapper( s... | Beam wrapper for the inference wrapper. | 62599034b830903b9686ed01 |
class ShoppinglistTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.app = create_app(config_name="testing") <NEW_LINE> self.client = self.app.test_client <NEW_LINE> self.register_route = '/auth/register' <NEW_LINE> self.login_route = '/auth/login' <NEW_LINE> self.user_route = '/user... | This class is a test case for shoppinglist | 62599034be8e80087fbc018e |
class CarAdapter(object): <NEW_LINE> <INDENT> def __init__(self, manual): <NEW_LINE> <INDENT> self._manual = manual <NEW_LINE> <DEDENT> def low_gear(self): <NEW_LINE> <INDENT> if type(self.gear) is int and self.gear > 1: <NEW_LINE> <INDENT> while(self.gear != 1): <NEW_LINE> <INDENT> self._manual.shift_down <NEW_LINE> <... | Adapter class to make an manual car act like an automatic car | 625990345e10d32532ce418b |
class VideoIntelligenceServiceClient(object): <NEW_LINE> <INDENT> SERVICE_ADDRESS = 'videointelligence.googleapis.com' <NEW_LINE> DEFAULT_SERVICE_PORT = 443 <NEW_LINE> _ALL_SCOPES = ('https://www.googleapis.com/auth/cloud-platform', ) <NEW_LINE> def __init__(self, channel=None, credentials=None, ssl_credentials=None, s... | Service that implements Google Cloud Video Intelligence API. | 6259903463f4b57ef00865fc |
class IRCNumeric(enum.Enum): <NEW_LINE> <INDENT> def __str__(self) -> str: <NEW_LINE> <INDENT> return str(self.value).zfill(3) <NEW_LINE> <DEDENT> def __repr__(self) -> str: <NEW_LINE> <INDENT> return f"{self.__class__.__name__}_{self.name}" | Base class for IRC numeric enums. | 6259903426238365f5fadc65 |
class UserList(APIView): <NEW_LINE> <INDENT> permission_classes = (permissions.AllowAny,) <NEW_LINE> def post(self, request, format=None): <NEW_LINE> <INDENT> serializer = UserSerializerWithToken(data=request.data) <NEW_LINE> if serializer.is_valid(): <NEW_LINE> <INDENT> serializer.save() <NEW_LINE> return Response(ser... | Create a new user. It's called 'UserList' because normally we'd have a get
method here too, for retrieving a list of all User objects. | 6259903421bff66bcd723d77 |
class NamedRegex(_BaseRegex): <NEW_LINE> <INDENT> def validate(self, value): <NEW_LINE> <INDENT> value = super(NamedRegex, self).validate(value) <NEW_LINE> return value.groupdict() | A string based type like Regex but returning named groups in dict.
| 6259903496565a6dacd2d815 |
class TropicalMaxPlusSemiring(SemiringWithThresholdABC): <NEW_LINE> <INDENT> def __init__(self, threshold): <NEW_LINE> <INDENT> if not isinstance(threshold, int): <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> if threshold < 0: <NEW_LINE> <INDENT> raise ValueError <NEW_LINE> <DEDENT> self._threshold = threshol... | A *tropical max plus semiring* is a semiring comprising the set :math:`\{0,
\ldots, t\} \cup\{-\infty\}`, for some value :math:`t\in\mathbb{N} \cup
\{0\}`, the threshold of the semiring, together with an operation which
returns the maximum of two elements, as the additive operation and addition
of integers as the multi... | 62599034d164cc6175822084 |
class UserViewSet(viewsets.ReadOnlyModelViewSet): <NEW_LINE> <INDENT> queryset = User.objects.all() <NEW_LINE> serializer_class = UserSerializer | This viewset automatically provide `list` and `detail` actions | 6259903407d97122c4217dba |
class ProgramEnrollmentSerializer(serializers.Serializer): <NEW_LINE> <INDENT> created = serializers.DateTimeField(format=DATETIME_FORMAT) <NEW_LINE> modified = serializers.DateTimeField(format=DATETIME_FORMAT) <NEW_LINE> external_user_key = serializers.CharField() <NEW_LINE> status = serializers.CharField() <NEW_LINE>... | Serializes a Program Enrollment Model object | 625990349b70327d1c57fe97 |
class Sync(A10BaseClass): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.ERROR_MSG = "" <NEW_LINE> self.required=[] <NEW_LINE> self.b_key = "sync" <NEW_LINE> self.a10_url="/axapi/v3/configure/sync" <NEW_LINE> self.DeviceProxy = "" <NEW_LINE> self.all_partitions = "" <NEW_LINE> self.partition... | :param all_partitions: {"default": 0, "optional": true, "type": "number", "description": "All partition configurations", "format": "flag"}
:param partition_name: {"description": "Partition name", "format": "string", "minLength": 1, "optional": true, "maxLength": 128, "type": "string"}
:param pwd: {"minLength": ... | 62599034be8e80087fbc0190 |
class SegParagraph(_BaseList): <NEW_LINE> <INDENT> item_class = SegSentence | A list of word-segmented sentences.
.. admonition:: Data Structure Examples
Text format
Used for :meth:`from_text` and :meth:`to_text`.
.. code-block:: python
[
'中文字 耶 , 啊 哈 哈 。', # Sentence 1
'「 完蛋 了 ! 」 , 畢卡索 他 想', # Sentence 2
]
... | 62599034ec188e330fdf99a7 |
class TypeHIdItem : <NEW_LINE> <INDENT> def __init__(self, size, buff, cm) : <NEW_LINE> <INDENT> self.__CM = cm <NEW_LINE> self.offset = buff.get_idx() <NEW_LINE> self.type = [] <NEW_LINE> for i in range(0, size) : <NEW_LINE> <INDENT> self.type.append( TypeIdItem( buff, cm ) ) <NEW_LINE> <DEDENT> <DEDENT> def get_type(... | This class can parse a list of type_id_item of a dex file
:param buff: a string which represents a Buff object of the list of type_id_item
:type buff: Buff object
:param cm: a ClassManager object
:type cm: :class:`ClassManager` | 6259903491af0d3eaad3af42 |
class AliyunConfig(models.Model): <NEW_LINE> <INDENT> key = models.CharField('阿里云登录 Key', max_length=256, null=False) <NEW_LINE> secret = models.CharField('阿里云登录 Secret', max_length=256, null=False) <NEW_LINE> region = models.CharField('阿里云 Region', max_length=256, null=False) <NEW_LINE> create_time = models.DateTimeFi... | 阿里云账号配置 | 62599034287bf620b6272cfb |
class BalsaStringListHandler(logging.NullHandler): <NEW_LINE> <INDENT> def __init__(self, max_entries): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.max_entries = max_entries <NEW_LINE> self.strings = [] <NEW_LINE> <DEDENT> def handle(self, record): <NEW_LINE> <INDENT> self.strings.append(self.format(record))... | keeps a buffer of the most recent log entries | 625990348c3a8732951f766c |
class AbstractLossFunction(nn.Module, ABC): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def forward( self, pos_scores: FloatTensorType, neg_scores: FloatTensorType ) -> FloatTensorType: <NEW_LINE> <INDENT> pass | Calculate weighted loss of scores for positive and negative pairs.
The inputs are a 1-D tensor of size P containing scores for positive pairs
of entities (i.e., those among which an edge exists) and a P x N tensor
containing scores for negative pairs (i.e., where no edge should exist). The
pairs of entities correspond... | 6259903466673b3332c31506 |
class checl_web_url(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(checl_web_url, self).__init__() <NEW_LINE> <DEDENT> def get_url_status(self, checkurl): <NEW_LINE> <INDENT> mess = {"url": checkurl} <NEW_LINE> print(">> get_url_status %s" % checkurl) <NEW_LINE> r = requests.get(checkweburl_... | docstring for checl_web_url | 62599034d164cc6175822086 |
class UnaryOperation(object): <NEW_LINE> <INDENT> def __init__(self, tokens): <NEW_LINE> <INDENT> self.op, self.operands = tokens[0] | takes one operand,e.g. not | 62599034be8e80087fbc0192 |
class User(AbstractUser): <NEW_LINE> <INDENT> id = models.UUIDField( primary_key=True, default=uuid.uuid4, editable=False ) <NEW_LINE> email = models.EmailField( "Email", unique=True ) <NEW_LINE> password_reset_token = models.UUIDField( "Password's reset token", null=True, blank=True, unique=True, help_text="This token... | This model will be used for both admin and client users | 625990346fece00bbacccabd |
class marshal_with(object): <NEW_LINE> <INDENT> def __init__( self, fields, envelope=None, skip_none=False, mask=None, ordered=False ): <NEW_LINE> <INDENT> self.fields = fields <NEW_LINE> self.envelope = envelope <NEW_LINE> self.skip_none = skip_none <NEW_LINE> self.ordered = ordered <NEW_LINE> self.mask = Mask(mask, s... | A decorator that apply marshalling to the return values of your methods.
>>> from flask_restx import fields, marshal_with
>>> mfields = { 'a': fields.Raw }
>>> @marshal_with(mfields)
... def get():
... return { 'a': 100, 'b': 'foo' }
...
...
>>> get()
OrderedDict([('a', 100)])
>>> @marshal_with(mfields, envelope=... | 62599034d99f1b3c44d067b8 |
class TestDocument(Document): <NEW_LINE> <INDENT> def __init__(self, doc_text): <NEW_LINE> <INDENT> self.sents = self._parse_doc_text(doc_text) <NEW_LINE> self.mentions = self._get_mentions(self.sents) <NEW_LINE> <DEDENT> def to_conll_format(self): <NEW_LINE> <INDENT> self._change_coref_values() <NEW_LINE> lines = [] <... | A container for storing mentions extracted from a file in CONLL 2012
format. This Document subclass is used for testing, where it is more
efficient to compute MentionPairs on the fly.
Attributes:
sents: A list of sublists of dictionaries corresponding to rows of
the CONLL document.
mentions: A list of ... | 6259903476d4e153a661dafb |
class UserDoesNotExistsError(QiitaWareError): <NEW_LINE> <INDENT> pass | Error used when a user does not exist | 62599034d6c5a102081e323b |
class NotAFileError(Exception): <NEW_LINE> <INDENT> pass | Excepción que indica que no la ruta no es un fichero | 62599034287bf620b6272cfd |
class Game(object): <NEW_LINE> <INDENT> class Player(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.hp = PLAYER_HP <NEW_LINE> self.mana = PLAYER_MANA <NEW_LINE> self.damage = 0 <NEW_LINE> self.armor = 0 <NEW_LINE> self.mana_spent = 0 <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> ... | Game state object. Represents the state of Game at some instance. | 6259903494891a1f408b9f84 |
class OfferToAgent(OfferAspect): <NEW_LINE> <INDENT> agents = models.ManyToManyField('rea.Agent') <NEW_LINE> reason = models.TextField() | Theoretically offer a unique set of Agents an Offer Aspect based
on some kind of activity.
For example, if the Agent has had this Offer or a Related Offer
in their Quote/Cart before then perhaps offer them a better deal?
Note: these are best created with an algorithm. Rule-based
Offer Aspects will be better applicab... | 6259903471ff763f4b5e88ad |
class Path: <NEW_LINE> <INDENT> def __init__(self, lst: list = []) -> None: <NEW_LINE> <INDENT> self.states = lst <NEW_LINE> <DEDENT> def contains(self, state: State) -> bool: <NEW_LINE> <INDENT> if state in self.states: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False <NEW_LINE> <DEDENT> def getTermina... | Path class holds a list of all possible paths and adds new states into path. | 62599034a4f1c619b294f70d |
class UsuarioSchema(ma.Schema): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> fields = ("id", "correo", "clave") | Representa el schema de un usuario | 625990341f5feb6acb163d08 |
class Path(String): <NEW_LINE> <INDENT> def validate(self, value): <NEW_LINE> <INDENT> value = super(Path, self).validate(value) <NEW_LINE> return os.path.abspath(os.path.expanduser(value)) | A string representing a filesystem path.
It will expand '~' to user home directory and return an absolute path if
you provide a relative path (this is usefull if you change the working
directory of a process after configuration parsing). | 625990341d351010ab8f4c30 |
class LetterRedirectView(RedirectView): <NEW_LINE> <INDENT> def get_redirect_url(self, year, month, day, slug): <NEW_LINE> <INDENT> return reverse( "letter_detail", kwargs={"year": year, "month": month, "day": day, "slug": slug}, ) | To help with redirecting from old /letter/1660/01/01/slug-field.php URLs
to the new Letter URLs. | 62599034ac7a0e7691f73600 |
class AddChildMemberApiView(CreateAPIView): <NEW_LINE> <INDENT> serializer_class = AddChildMemberSerializer | Add child API view | 625990343eb6a72ae038b77e |
class ShuffleInitBlock(HybridBlock): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, **kwargs): <NEW_LINE> <INDENT> super(ShuffleInitBlock, self).__init__(**kwargs) <NEW_LINE> with self.name_scope(): <NEW_LINE> <INDENT> self.conv = nn.Conv2D( channels=out_channels, kernel_size=3, strides=2, padding=1,... | ShuffleNet specific initial block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels. | 625990345e10d32532ce418e |
class ScoreModel(ndb.Model): <NEW_LINE> <INDENT> away_name = ndb.StringProperty(default='') <NEW_LINE> away_score = ndb.IntegerProperty(required=True) <NEW_LINE> game_clock = ndb.StringProperty(default='00:00') <NEW_LINE> game_day = ndb.StringProperty(default='') <NEW_LINE> game_id = ndb.IntegerProperty(required=True) ... | Datastore model for Spread data
away_name: away team's name
away_score: away team's score
game_clock: the amount of time remaining in the game
game_day: the day of the week that the game is played on
game_id: unique identifier of the game
game_status: playing status of the game (final, pre... | 625990349b70327d1c57fe9c |
class RequestConfiguration(Payload): <NEW_LINE> <INDENT> INTENT = "COMMAND" | Configuration request message | 625990348e05c05ec3f6f6e6 |
class Entity(object): <NEW_LINE> <INDENT> __metaclass__ = metaEntity <NEW_LINE> def __init__(self, **kw): <NEW_LINE> <INDENT> self._pyport_new = True <NEW_LINE> self._pyport_data = {} <NEW_LINE> self._pyport_dirty = False <NEW_LINE> self._pyport_dirty_list = {} <NEW_LINE> self._pyport_session = None <NEW_LINE> for name... | Entity base class. | 6259903426238365f5fadc6b |
class BaseTTSTest(unittest.TestCase): <NEW_LINE> <INDENT> CLS = None <NEW_LINE> SLUG = None <NEW_LINE> INIT_ATTRS = ['enabled'] <NEW_LINE> CONF = {} <NEW_LINE> OBJ_ATTRS = [] <NEW_LINE> EVAL_PLAY = True <NEW_LINE> SKIP_IF_NOT_AVAILABLE = True <NEW_LINE> FILE_TYPE = 'WAVE audio' <NEW_LINE> @classmethod <NEW_LINE> def se... | Tests talkey basic functionality | 62599034b830903b9686ed05 |
class SricErrorTimeout(Exception): <NEW_LINE> <INDENT> pass | Request timed out | 62599034c432627299fa410f |
class Component(ApplicationSession): <NEW_LINE> <INDENT> @inlineCallbacks <NEW_LINE> def onJoin(self, details): <NEW_LINE> <INDENT> for x in [2, 0, -2]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> res = yield self.call('com.myapp.sqrt', x) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> print("Error: {}... | Example WAMP application frontend that catches exceptions. | 625990343eb6a72ae038b780 |
class RecipeSchema(Schema): <NEW_LINE> <INDENT> title = fields.String(required=True) <NEW_LINE> ingredients = fields.String(required=True) <NEW_LINE> steps = fields.String(required=True) <NEW_LINE> category_id = fields.Integer(required=True) <NEW_LINE> @validates('title') <NEW_LINE> def validate_recipe_title(self, titl... | Schema used for validating Recipes. | 6259903430c21e258be99926 |
class Dataset(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def __init__(self, name, subset): <NEW_LINE> <INDENT> assert subset in self.available_subsets(), self.available_subsets() <NEW_LINE> self.name = name <NEW_LINE> self.subset = subset <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def num_class... | A simple class for handling data sets. | 62599034e76e3b2f99fd9b25 |
class bottleneck_transformation(nn.Module): <NEW_LINE> <INDENT> def __init__(self, inplanes, outplanes, innerplanes, stride=1, dilation=1, group=1, downsample=None, deform=False): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> (str1x1, str3x3) = (stride, 1) if cfg.RESNETS.STRIDE_1X1 else (1, stride) <NEW_LINE> self.... | Bottleneck Residual Block | 62599034d53ae8145f91957d |
class BaseGeometry: <NEW_LINE> <INDENT> def area(self): <NEW_LINE> <INDENT> raise Exception("area() is not implemented") | BaseGeometry contains a method area | 62599034b830903b9686ed06 |
class LogMainPage(AppDashboard): <NEW_LINE> <INDENT> TEMPLATE = 'logs/main.html' <NEW_LINE> def get(self): <NEW_LINE> <INDENT> is_cloud_admin = self.helper.is_user_cloud_admin() <NEW_LINE> apps_user_is_admin_on = self.helper.get_owned_apps() <NEW_LINE> if (not is_cloud_admin) and (not apps_user_is_admin_on): <NEW_LINE>... | Class to handle requests to the /logs page. | 6259903426068e7796d4da64 |
class SuppressCrashReport: <NEW_LINE> <INDENT> old_value = None <NEW_LINE> old_modes = None <NEW_LINE> def __enter__(self): <NEW_LINE> <INDENT> if sys.platform.startswith('win'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import msvcrt <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> return <NEW_LINE> <DED... | Try to prevent a crash report from popping up.
On Windows, don't display the Windows Error Reporting dialog. On UNIX,
disable the creation of coredump file. | 625990341d351010ab8f4c34 |
class Verbose(object): <NEW_LINE> <INDENT> async def pinged(self, **kw): <NEW_LINE> <INDENT> await super().pinged(**kw) <NEW_LINE> print("%d bytes from %s: icmp_seq=%d ttl=%d time=%.2f ms" % ( kw['size'], kw['host'], kw['seqNum'], kw['ttl'], kw['delay']*1000)) | A mix-in class to print a message when each ping os received | 625990344e696a045264e6af |
class LoadedFiles(NamedTuple): <NEW_LINE> <INDENT> files: Optional[List[str]] = None <NEW_LINE> file_data: Optional[Dict[str, dict]] = None | A collection of data for files loaded at runtime (or, a continuation of
this information loaded from a cache). | 62599034c432627299fa4111 |
class QSVR(SVR): <NEW_LINE> <INDENT> def __init__(self, *args, quantum_kernel: Optional[QuantumKernel] = None, **kwargs): <NEW_LINE> <INDENT> if (len(args)) != 0: <NEW_LINE> <INDENT> msg = ( f"Positional arguments ({args}) are deprecated as of version 0.3.0 and " f"will be removed no sooner than 3 months after the rele... | Quantum Support Vector Regressor.
This class shows how to use a quantum kernel for regression. The class extends
`sklearn.svm.SVR <https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVR.html>`_,
and thus inherits its methods like ``fit`` and ``predict`` used in the example below.
Read more in the
`sklearn u... | 62599034d10714528d69ef19 |
class NullableInfoNameError(BaseOverhaveSynchronizerException): <NEW_LINE> <INDENT> pass | Exception for situation without feature info name. | 625990348e05c05ec3f6f6e8 |
class WorkflowUsers(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(User, on_delete=models.CASCADE) <NEW_LINE> @property <NEW_LINE> def fullname(self): <NEW_LINE> <INDENT> return f"{self.user.first_name} {self.user.last_name}" | Database RareUser Model | 62599034ec188e330fdf99b1 |
class TractionComposition(TractionField): <NEW_LINE> <INDENT> components = List.T( AbstractTractionField.T(), default=[], help='Ordered list of tractions.') <NEW_LINE> def get_tractions(self, nx, ny, patches=None): <NEW_LINE> <INDENT> npatches = nx * ny <NEW_LINE> tractions = num.zeros((npatches, 3)) <NEW_LINE> for com... | Composition of traction fields.
:py:class:`~pyrocko.gf.tractions.TractionField` and
:py:class:`~pyrocko.gf.tractions.AbstractTractionField` can be combined
to realize a combination of different fields. | 6259903494891a1f408b9f87 |
class Partial(object): <NEW_LINE> <INDENT> def __init__(self, pycolab_thing, *args, **kwargs): <NEW_LINE> <INDENT> if not issubclass(pycolab_thing, (things.Backdrop, things.Sprite, things.Drape)): <NEW_LINE> <INDENT> raise TypeError('the pycolab_thing argument to ascii_art.Partial must be ' 'a Backdrop, Sprite, or Drap... | Holds a pycolab "thing" and its extra constructor arguments.
In a spirit similar to `functools.partial`, a `Partial` object holds a
subclass of one of the pycolab game entities described in `things.py`, along
with any "extra" arguments required for its constructor (i.e. those besides
the constructor arguments specified... | 62599034be383301e0254930 |
class ClixxException(Exception): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> self.message = message <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self.message) | Exception class used for the Clixx.Py library
| 6259903473bcbd0ca4bcb3a4 |
class UDF(object): <NEW_LINE> <INDENT> def __init__(self, name, nargs): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.nargs = nargs <NEW_LINE> self.f = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def is_agg(self): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> @property <NEW_LINE> def is_incremental(self... | Wrapper for registering metadata about UDFs.
TODO: add setup function/dependencies so that compiler can generate the
appropriate import statements and definitions. | 62599034b830903b9686ed07 |
class Reader(object): <NEW_LINE> <INDENT> Variant = namedtuple('RohVariant', ('seq', 'pos', 'state', 'quality')) <NEW_LINE> def __init__(self, filename): <NEW_LINE> <INDENT> self.__filename = filename <NEW_LINE> <DEDENT> def variants(self): <NEW_LINE> <INDENT> with open(self.__filename) as input_file: <NEW_LINE> <INDEN... | This class implements a reader for output files produced by
bcftools roh. | 62599034cad5886f8bdc5909 |
class Train_suits: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.img = [] <NEW_LINE> self.name = "Placeholder" | Structure to store information about train suit images. | 6259903450485f2cf55dc099 |
class ServerMessages(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.conn = amqp.Connection(host=MsgHost, userid=MsgUserid, password=MsgPassword, virtual_host=MsgVirtualHost, insist=False) <NEW_LINE> self.chan = self.conn.channel() <NEW_LINE> self.chan.queue_declare(queue=Queue, durable=True, ... | Class to read from the server queue.
If reading an processing with ACK:
c = ServerMessages()
while True:
msg = c.recv_message()
if msg is None:
break
# prolonged processing here
c.ack_message() | 6259903423e79379d538d627 |
class ExecutorServer(object): <NEW_LINE> <INDENT> def __init__(self, executor): <NEW_LINE> <INDENT> self._executor = executor <NEW_LINE> <DEDENT> def run_action(self, rpc_ctx, task_id, action_class_str, attributes, params): <NEW_LINE> <INDENT> LOG.info( "Received RPC request 'run_action'[rpc_ctx=%s," " task_id=%s, acti... | RPC Executor server. | 625990346fece00bbacccac6 |
class StubConverter(object): <NEW_LINE> <INDENT> def __init__(self, currentTest): <NEW_LINE> <INDENT> self.currentTest = currentTest <NEW_LINE> self.convertCount = 0 <NEW_LINE> <DEDENT> def convert(self): <NEW_LINE> <INDENT> self.convertCount += 1 <NEW_LINE> <DEDENT> def assertConvertCountEquals(self, convertCount): <N... | A stand-in object for a converter that does nothing | 6259903466673b3332c31511 |
class RHExportSubmissionsCSV(RHExportSubmissionsBase): <NEW_LINE> <INDENT> def _export(self, filename, headers, rows): <NEW_LINE> <INDENT> return send_csv(filename + '.csv', headers, rows) | Export submissions as CSV | 62599034e76e3b2f99fd9b29 |
class MacOSKeyboardLayoutPlugin(PlistFileArtifactPreprocessorPlugin): <NEW_LINE> <INDENT> ARTIFACT_DEFINITION_NAME = 'MacOSKeyboardLayoutPlistFile' <NEW_LINE> _PLIST_KEYS = ['AppleCurrentKeyboardLayoutInputSourceID'] <NEW_LINE> def _ParsePlistKeyValue(self, mediator, name, value): <NEW_LINE> <INDENT> if name in self._P... | MacOS keyboard layout plugin. | 62599034ec188e330fdf99b3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.