code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class PytestTester: <NEW_LINE> <INDENT> def __init__(self, module_name): <NEW_LINE> <INDENT> self.module_name = module_name <NEW_LINE> <DEDENT> def __call__(self, label='fast', verbose=1, extra_argv=None, doctests=False, coverage=False, durations=-1, tests=None): <NEW_LINE> <INDENT> import pytest <NEW_LINE> import warn... | Pytest test runner.
A test function is typically added to a package's __init__.py like so::
from numpy._pytesttester import PytestTester
test = PytestTester(__name__).test
del PytestTester
Calling this test function finds and runs all tests associated with the
module and all its sub-modules.
Attributes
------... | 6259903a8da39b475be043cd |
class TestMain(unittest.TestCase): <NEW_LINE> <INDENT> @mock.patch('pulp.server.maintenance.monthly.RepoProfileApplicabilityManager.remove_orphans') <NEW_LINE> def test_main_calls_remove_orphans(self, remove_orphans): <NEW_LINE> <INDENT> monthly.main() <NEW_LINE> remove_orphans.assert_called_once_with() | Test the main() function. | 6259903ab57a9660fecd2c5a |
class NewDataEmail(EmailTemplate): <NEW_LINE> <INDENT> def __init__(self, send_from, processor_name, last_data_time, attachments=()): <NEW_LINE> <INDENT> subject = f'No New Data for Summit {processor_name[0].upper() + processor_name[1:]}' <NEW_LINE> body = (f'There has been no new data for the {processor_name} processo... | NewDataEmails subclass EmailTemplates and are specifically for being passed to Errors that are triggered when no new
data is found. | 6259903bd6c5a102081e3305 |
class NonRefCatalogContent(BaseContentMixin): <NEW_LINE> <INDENT> isReferenceable = None <NEW_LINE> def _register(self, *args, **kwargs): pass <NEW_LINE> def _unregister(self, *args, **kwargs): pass <NEW_LINE> def _updateCatalog(self, *args, **kwargs): pass <NEW_LINE> def _referenceApply(self, *args, **kwargs): pass <N... | Base class for content that is neither referenceable nor in the catalog
| 6259903b71ff763f4b5e897a |
class TestScoreOnlyResponse(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 testScoreOnlyResponse(self): <NEW_LINE> <INDENT> pass | ScoreOnlyResponse unit test stubs | 6259903b30dc7b76659a0a11 |
class RunCmdPlugin(base.BaseCloudConfigPlugin): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _unify_scripts(commands, env_header): <NEW_LINE> <INDENT> script_content = env_header + os.linesep <NEW_LINE> entries = 0 <NEW_LINE> for command in commands: <NEW_LINE> <INDENT> if isinstance(command, six.string_types): <NE... | Aggregate and execute cloud-config runcmd entries in a shell.
The runcmd entries can be a string or an array of strings.
The prefered shell is given by the OS platform.
Example for Windows, where cmd.exe is the prefered shell:
#cloud-config
runcmd:
- ['dir', 'C:']
- 'dir C:' | 6259903bb57a9660fecd2c5b |
class Unit: <NEW_LINE> <INDENT> def __init__(self, spec=None, genre=HIDDEN, log_names=('net', 'I_net', 'v_m', 'act', 'v_m_eq', 'adapt')): <NEW_LINE> <INDENT> self.genre = genre <NEW_LINE> self.spec = spec <NEW_LINE> if self.spec is None: <NEW_LINE> <INDENT> self.spec = UnitSpec() <NEW_LINE> <DEDENT> self.log_names = lo... | Leabra Unit (as implemented in emergent 8.0) | 6259903b50485f2cf55dc161 |
class ReadWriteMultipleRegistersRequest(): <NEW_LINE> <INDENT> function_code = 23 <NEW_LINE> _rtu_byte_count_pos = 10 <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.read_address = kwargs.get('read_address', 0x00) <NEW_LINE> self.read_count = kwargs.get('read_count', 0) <NEW_LINE> self.write_a... | This function code performs a combination of one read operation and one
write operation in a single MODBUS transaction. The write
operation is performed before the read.
Holding registers are addressed starting at zero. Therefore holding
registers 1-16 are addressed in the PDU as 0-15.
The request specifies the start... | 6259903bdc8b845886d54795 |
class RenderXHMTLTests(TestCase): <NEW_LINE> <INDENT> def mkdtemp(self): <NEW_LINE> <INDENT> tempDir = FilePath(self.mktemp()) <NEW_LINE> if not tempDir.exists(): <NEW_LINE> <INDENT> tempDir.makedirs() <NEW_LINE> <DEDENT> return tempDir <NEW_LINE> <DEDENT> def test_renderXHTML(self): <NEW_LINE> <INDENT> def mockCSS2XSL... | Tests for L{documint.util.renderXHTML}. | 6259903b30c21e258be999ee |
class ExExit(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def run(self, edit, line_range=None): <NEW_LINE> <INDENT> w = self.view.window() <NEW_LINE> if w.active_view().is_dirty(): <NEW_LINE> <INDENT> w.run_command('save') <NEW_LINE> <DEDENT> w.run_command('close') <NEW_LINE> if len(w.views()) == 0: <NEW_LINE> <IND... | Ex command(s): :x[it], :exi[t]
Like :wq, but write only when changes have been made.
TODO: Support ranges, like :w. | 6259903b8e05c05ec3f6f74b |
class ExactInference(InferenceModule): <NEW_LINE> <INDENT> def initializeUniformly(self, gameState): <NEW_LINE> <INDENT> self.beliefs = DiscreteDistribution() <NEW_LINE> for p in self.legalPositions: <NEW_LINE> <INDENT> self.beliefs[p] = 1.0 <NEW_LINE> <DEDENT> self.beliefs.normalize() <NEW_LINE> <DEDENT> def observeUp... | The exact dynamic inference module should use forward algorithm updates to
compute the exact belief function at each time step. | 6259903bd164cc6175822155 |
class TransferTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> create_database() <NEW_LINE> <DEDENT> def test_NC_005816(self): <NEW_LINE> <INDENT> self.trans("GenBank/NC_005816.gb", "gb") <NEW_LINE> <DEDENT> def test_NC_000932(self): <NEW_LINE> <INDENT> self.trans("GenBank/NC_000932.gb"... | Test file -> BioSQL, BioSQL -> BioSQL. | 6259903b8a349b6b43687424 |
class AaaPolicy(A10BaseClass): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.ERROR_MSG = "" <NEW_LINE> self.required = [ "name"] <NEW_LINE> self.b_key = "aaa-policy" <NEW_LINE> self.a10_url="/axapi/v3/aam/aaa-policy/{name}/stats" <NEW_LINE> self.DeviceProxy = "" <NEW_LINE> self.aaa_rule_lis... | Class Description::
Statistics for the object aaa-policy.
Class aaa-policy supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param aaa_rule_list: {"minItems": 1, "items": {"type": "aaa-rule"}, "uniqueItems": true, "array": [{"required": ["index"], ... | 6259903b73bcbd0ca4bcb46a |
class Designation(models.Model): <NEW_LINE> <INDENT> department = models.OneToOneField(Department, on_delete=models.CASCADE) <NEW_LINE> name = models.CharField(max_length=120, null=True, blank=True) | Designation information | 6259903b711fe17d825e158c |
class SimplifiedStaticFeedbackMetaMixin(object): <NEW_LINE> <INDENT> model = models.StaticFeedback <NEW_LINE> resultfields = FieldSpec('id', 'grade', 'is_passing_grade', 'saved_by', 'save_timestamp', 'delivery', 'rendered_view', candidates=['delivery__deadline__assignment_group__candidates__identifier'], period=['deliv... | Defines the django model to be used, resultfields returned by
search and which fields can be used to search for a StaticFeedback object
using the Simplified API | 6259903b15baa72349463179 |
class AwsSupportRDSSecurityGroupsYellow(AwsSupportRDSSecurityGroups): <NEW_LINE> <INDENT> active = True <NEW_LINE> def __init__(self, app): <NEW_LINE> <INDENT> self.title = "RDS Security Groups: Ingress is restricted for flagged ports" <NEW_LINE> self.description = ( "Checks that there are no Security Groups associated... | Subclass checking for port mismatch between the ELB and VPC. | 6259903bd4950a0f3b111730 |
class SlimServerMessage(SlimMessage): <NEW_LINE> <INDENT> header_size = 6 <NEW_LINE> @classmethod <NEW_LINE> def name_from_data(cls, data): <NEW_LINE> <INDENT> return struct.unpack('! 4s', data[2:6])[0].decode('ascii').lower() <NEW_LINE> <DEDENT> def add_header(self, binarydata): <NEW_LINE> <INDENT> header = struct.pac... | Messages sent from a server to the client.
They hav a header of six bytes (H 4s) that contains the message-length
of the body (including command name, excluding the length Word)
and the command name
command names are lowercase | 6259903b23849d37ff85229a |
class StagingConfig(Config): <NEW_LINE> <INDENT> DEBUG = True <NEW_LINE> DATABASE_URL = os.getenv('DATABASE_TEST_URL') | Configurations for Staging. | 6259903b66673b3332c315d8 |
class Usuario(models.Model): <NEW_LINE> <INDENT> TIPOS = ( ('A', 'Administrador'), ('U', 'Usuario' ), ('C', 'Cliente' ), ) <NEW_LINE> cedula = models.IntegerField(max_length=8, primary_key = True) <NEW_LINE> carnet = models.CharField(max_length=8, unique = True) <NEW_LINE> nombre = models.CharField(m... | Usuario que usa el sistema | 6259903b94891a1f408b9fe8 |
class DevelopmentError(Exception): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> assert isinstance(message, str), 'Invalid string message %s' % message <NEW_LINE> self.message = message <NEW_LINE> Exception.__init__(self, message) | Wraps exceptions that are related to wrong development usage. | 6259903b63f4b57ef0086665 |
class TestConcentration(unittest.TestCase): <NEW_LINE> <INDENT> def test_perm3(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> quantity.Concentration(1.0, "m^-3") <NEW_LINE> self.fail('Allowed invalid unit type "m^-3".') <NEW_LINE> <DEDENT> except quantity.QuantityError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT>... | Contains unit tests of the Concentration unit type object. | 6259903b3c8af77a43b6882d |
class HttpError(ImmediateHttpResponse): <NEW_LINE> <INDENT> def __init__(self, status: Status, code_index: int=0, message: str=None, developer_message: str=None, meta: Any=None, headers: StringMap=None): <NEW_LINE> <INDENT> super().__init__( Error.from_status(status, code_index, message, developer_message, meta), statu... | An error response that should be returned immediately. | 6259903b15baa7234946317a |
class Genotype(tuple, Paranoid): <NEW_LINE> <INDENT> def __init__(self, *args): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> assert self.run_paranoia_checks() <NEW_LINE> <DEDENT> def squeeze(self): <NEW_LINE> <INDENT> return str.join('', [str(_) for _ in tuple(self)]) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LI... | A tuple containing the organism’s actual genes (their values). | 6259903bbe383301e02549fa |
class MyPrettyPrinter(leoBeautify.PythonTokenBeautifier): <NEW_LINE> <INDENT> def __init__ (self,c): <NEW_LINE> <INDENT> leoBeautify.PythonTokenBeautifier.__init__(self,c) <NEW_LINE> self.tracing = False | An example subclass of Leo's PrettyPrinter class.
Not all the base class methods are shown here:
just the ones you are likely to want to override. | 6259903b507cdc57c63a5f7e |
class UpdateFlowRequest(BaseRequest): <NEW_LINE> <INDENT> def __init__(self, ts_connection, new_project_id=None, new_owner_id=None, is_certified_flag=None, certification_note=None): <NEW_LINE> <INDENT> super().__init__(ts_connection) <NEW_LINE> self._new_project_id = new_project_id <NEW_LINE> self._new_owner_id = new_o... | Update flow request for generating API request URLs to Tableau Server.
:param ts_connection: The Tableau Server connection object.
:type ts_connection: class
:param new_project_id: (Optional) The ID of the project to add the data source to.
:type new_project_id: string
:param new_owner_id: ... | 6259903b30c21e258be999f1 |
class MemcacheKeygen(BaseKeyGenerator): <NEW_LINE> <INDENT> def __init__(self, memcache_client=None, counter_key=None, **kwargs): <NEW_LINE> <INDENT> super(MemcacheKeygen, self).__init__(**kwargs) <NEW_LINE> if counter_key is None: <NEW_LINE> <INDENT> raise ValueError('a counter key is required') <NEW_LINE> <DEDENT> se... | Creates keys in-memory. Keys are always generated in increasing order.
| 6259903b287bf620b6272dce |
class SortBigList: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.input_file = None <NEW_LINE> self.output_file = None <NEW_LINE> <DEDENT> def set_input_data(self, file_path_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if not isinstance(file_path_name, str): <NEW_LINE> <INDENT> raise InvalidInp... | This class should be used to sort large amount of data from csv files.
The class has two properties: input_file and output_file which are
strings with the information to be used to read from a file and write
to a file. It also has a merge sort to sort the values read from a file as
long as the file is properly formatte... | 6259903b6e29344779b01836 |
class Registry(object): <NEW_LINE> <INDENT> __metaclass__ = DeclarativeMetaclass <NEW_LINE> def __init__(self, model): <NEW_LINE> <INDENT> self.model = model <NEW_LINE> self.has_admin = self._has_admin() <NEW_LINE> self.fields['model'] = self.model <NEW_LINE> self.fields['verbose_name'] = unicode(self.model._meta.verbo... | Base registry class for core and plugin applications
Example Registry:
from tendenci.core.registry import site
from tendenci.core.registry.base import CoreRegistry, lazy_reverse
from tendenci.addons.models import ExmpleModel
class ExampleRegistry(CoreRegistry):
version = '1.0'
author = 'Glen Zangirolami'
... | 6259903b30dc7b76659a0a15 |
class template_element(object): <NEW_LINE> <INDENT> def __init__(self,title="__Nonefined__",image_url="__Nonefined__",subtitle="__Nonefined__",action="__Nonefined__",buttons=[]): <NEW_LINE> <INDENT> if title != "_Nonefined__": <NEW_LINE> <INDENT> self.title = title <NEW_LINE> <DEDENT> if image_url != "_Nonefined__": <N... | Used to create elements inside templates | 6259903bb57a9660fecd2c5f |
class BezierCurve(object): <NEW_LINE> <INDENT> __slots__ = ('_control_points',) <NEW_LINE> def __init__(self, *control_points): <NEW_LINE> <INDENT> self._control_points = [] <NEW_LINE> for point in control_points: <NEW_LINE> <INDENT> self._control_points.append(ControlPoint(point)) <NEW_LINE> <DEDENT> <DEDENT> def __ca... | An arbitrary degree two-dimensional Bezier curve.
::
>>> b = BezierCurve((0, 0), (50, 100), (100, 0))
>>> b
BezierCurve((0, 0), (50, 100), (100, 0))
>>> len(b)
100
>>> x = 25
>>> x in b
True
>>> b(x)
37.5 | 6259903b66673b3332c315da |
class AUCCallback(LoaderMetricCallback): <NEW_LINE> <INDENT> def __init__( self, input_key: str, target_key: str, compute_per_class_metrics: bool = SETTINGS.compute_per_class_metrics, prefix: str = None, suffix: str = None, ): <NEW_LINE> <INDENT> super().__init__( metric=AUCMetric( compute_per_class_metrics=compute_per... | ROC-AUC metric callback.
Args:
input_key: input key to use for auc calculation, specifies our ``y_true``.
target_key: output key to use for auc calculation, specifies our ``y_pred``.
compute_per_class_metrics: boolean flag to compute per-class metrics
(default: SETTINGS.compute_per_class_metrics o... | 6259903b76d4e153a661db65 |
class BioDataFilter(DataFilter): <NEW_LINE> <INDENT> sample = filters.ModelChoiceFilter(field_name='entity', queryset=Sample.objects.all()) | Filter the data endpoint.
Enable filtering data by the sample.
.. IMPORTANT::
:class:`DataViewSet` must be patched before using it in urls to
enable this feature:
.. code:: python
DataViewSet.filter_class = BioDataFilter | 6259903b004d5f362081f8d6 |
class PostThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(PostThread, self).__init__() <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> if tieba_queue.empty(): <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(... | 从 tieba_queue 队列取贴吧每一页的 url,
调用 crawler 的 post_url 方法,将返回的该页下的所有帖子的 url 放进 post_queue | 6259903b26068e7796d4db2b |
class CameraCoords(AstrometryBase): <NEW_LINE> <INDENT> camera = None <NEW_LINE> allow_multiple_chips = False <NEW_LINE> @cached <NEW_LINE> def get_chipName(self): <NEW_LINE> <INDENT> xPupil, yPupil = (self.column_by_name('x_pupil'), self.column_by_name('y_pupil')) <NEW_LINE> return chipNameFromPupilCoords(xPupil, yPup... | Methods for getting coordinates from the camera object | 6259903b26238365f5fadd3a |
class RbacRuntimeError(RuntimeError): <NEW_LINE> <INDENT> pass | An error has ocurred at runtime. | 6259903b8da39b475be043d3 |
class Preference(models.Model): <NEW_LINE> <INDENT> id = models.AutoField(primary_key=True) <NEW_LINE> user = models.ForeignKey(User, on_delete=models.CASCADE) <NEW_LINE> title = models.CharField(max_length=80) <NEW_LINE> description = models.CharField(max_length=150) <NEW_LINE> active = models.BooleanField(default=Tru... | This class models a notification with 4 fields.
id - The ID to track the preference object.
user -- A one-to-one field that is a user.
title -- The title of the preference.
description -- The description of the preference.
active -- Whether the preference is active or not. | 6259903bb57a9660fecd2c60 |
class Canvas(BaseCanvas): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> BrushSets.inherit(type(self)) <NEW_LINE> self._extended_context = None <NEW_LINE> <DEDENT> def _on_draw(self, ctx): <NEW_LINE> <INDENT> if self._extended_context is None: <NEW_LINE> <INDENT> self._extended_context = E... | X11 Canvas object.
This class is meant to be used as a superclass and should not be
instantiated directly. Subclasses should implement the :func:`on_draw`
callback, which is invoked every time the canvas needs to be redrawn.
Redraws happen at regular intervals in time, as specified by the
``interval`` attribute (also ... | 6259903b596a897236128e84 |
@py2_iterable <NEW_LINE> class Streamer(object): <NEW_LINE> <INDENT> def __init__(self, stream): <NEW_LINE> <INDENT> if isinstance(stream, str) or isinstance(stream, basestring): <NEW_LINE> <INDENT> stream = io.StringIO(u'{}'.format(stream)) <NEW_LINE> <DEDENT> self.stream = stream <NEW_LINE> self._peek = self.stream.r... | Wraps an io.StringIO and iterates a byte at a time,
instead of a line at a time | 6259903b507cdc57c63a5f80 |
class JSONWebTokenSerializerCustomer(Serializer): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(JSONWebTokenSerializerCustomer, self).__init__(*args, **kwargs) <NEW_LINE> self.fields[self.username_field] = serializers.CharField() <NEW_LINE> self.fields['password'] = PasswordField(wr... | Serializer class used to validate a username and password.
'username' is identified by the custom UserModel.USERNAME_FIELD.
Returns a JSON Web Token that can be used to authenticate later calls. | 6259903bac7a0e7691f736ce |
class Checker(object): <NEW_LINE> <INDENT> executables = [] <NEW_LINE> extensions = [] <NEW_LINE> mimetypes = [] | A base class for checkers | 6259903b379a373c97d9a20e |
class NameGender(): <NEW_LINE> <INDENT> def __init__(self, male_file_name, female_file_name): <NEW_LINE> <INDENT> self.males = self._load_dict(male_file_name) <NEW_LINE> self.females = self._load_dict(female_file_name) <NEW_LINE> <DEDENT> def _load_dict(self, file_name): <NEW_LINE> <INDENT> data = dict() <NEW_LINE> for... | This class helps to handle two dictionaries which contain the gender
association scores of names. Provide the gender scores and call
get_gender_scores to get normalized scores for a name for both genders. | 6259903ba4f1c619b294f77a |
class ConcreteA: <NEW_LINE> <INDENT> value = 'A' | A concrete prototype | 6259903bcad5886f8bdc596f |
@keras_export('keras.metrics.Poisson') <NEW_LINE> class Poisson(MeanMetricWrapper): <NEW_LINE> <INDENT> def __init__(self, name='poisson', dtype=None): <NEW_LINE> <INDENT> super(Poisson, self).__init__(poisson, name, dtype=dtype) | Computes the Poisson metric between `y_true` and `y_pred`.
`metric = y_pred - y_true * log(y_pred)`
Args:
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
>>> m = tf.keras.metrics.Poisson()
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, ... | 6259903bd164cc617582215b |
class Connection: <NEW_LINE> <INDENT> def __init__(self, address, listener): <NEW_LINE> <INDENT> if not callable(listener): <NEW_LINE> <INDENT> raise TypeError("listener is not a callable. {} passed".format(type(listener))) <NEW_LINE> <DEDENT> self._address = address <NEW_LINE> self._socket = socket.socket(type=socket.... | Async UDP connection to a server.
If you want to receive data from server say first a "hello" to the server.
Once you have done with the server call :meth:`close`.
Parameters:
address ((host, port)):
listener (callable): It uses the next signature listener(data, socket).
Returns:
An instance of this clas... | 6259903b91af0d3eaad3b01a |
class ToyModel(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def sample_real(n=1, mean_top=[0, 2], std_top=0.2, weights_top=[0.5, 0.5], std_middle=0.2, std_bottom=0.2, weights_bottom=[0.5, 0.5]): <NEW_LINE> <INDENT> assert(sum(weights_top) == 1) <NEW_LINE> assert(sum(weights_bottom) == 1) <NEW_LIN... | Defines a graphical model
p(x1)p(x2|x1)p(x3|x1)p(x4|x2,x3)p(x5|x3)
where the individual distributions are defined via various sample methods | 6259903b73bcbd0ca4bcb46f |
class LaMetricNotificationService(BaseNotificationService): <NEW_LINE> <INDENT> def __init__(self, hasslametricmanager, icon, display_time): <NEW_LINE> <INDENT> self.hasslametricmanager = hasslametricmanager <NEW_LINE> self._icon = icon <NEW_LINE> self._display_time = display_time <NEW_LINE> <DEDENT> def send_message(s... | Implement the notification service for LaMetric. | 6259903b07d97122c4217e84 |
class DihedralSliceLayer(nn.layers.Layer): <NEW_LINE> <INDENT> def __init__(self, input_layer): <NEW_LINE> <INDENT> super(DihedralSliceLayer, self).__init__(input_layer) <NEW_LINE> <DEDENT> def get_output_shape_for(self, input_shape): <NEW_LINE> <INDENT> return (8 * input_shape[0],) + input_shape[1:] <NEW_LINE> <DEDENT... | This layer stacks rotations of 0, 90, 180, and 270 degrees of the input,
as well as their horizontal flips, along the batch dimension.
If the input has shape (batch_size, num_channels, r, c),
then the output will have shape (8 * batch_size, num_channels, r, c).
Note that the stacking happens on axis 0, so a reshape t... | 6259903bd4950a0f3b111733 |
class CmdInventory(MuxCommand): <NEW_LINE> <INDENT> key = "inventory" <NEW_LINE> aliases = ["inv", "i"] <NEW_LINE> locks = "cmd:all()" <NEW_LINE> arg_regex = r"$" <NEW_LINE> def func(self): <NEW_LINE> <INDENT> if not self.caller.contents: <NEW_LINE> <INDENT> self.caller.msg("You are not carrying or wearing anything.") ... | view inventory
Usage:
inventory
inv
Shows your inventory. | 6259903b10dbd63aa1c71dbc |
class FluxProfile(object): <NEW_LINE> <INDENT> def __init__(self, x_edges, x, counts, background, exposure, mask=None): <NEW_LINE> <INDENT> import pandas as pd <NEW_LINE> x_edges = np.asanyarray(x_edges) <NEW_LINE> x = np.asanyarray(x) <NEW_LINE> counts = np.asanyarray(counts) <NEW_LINE> background = np.asanyarray(back... | Compute flux profiles | 6259903b8c3a8732951f773e |
class ClassAttributeModificationWarning(type): <NEW_LINE> <INDENT> def __setattr__(cls, attr, value): <NEW_LINE> <INDENT> logger.warning('You are modifying class attribute of \'{}\' class. You better know what you are doing!' .format(cls.__name__)) <NEW_LINE> logger.debug(pformat(format_stack())) <NEW_LINE> super().__s... | Meta class that logs warnings when class's attributes are overridden. | 6259903b63b5f9789fe86354 |
class Row(TypeEngine): <NEW_LINE> <INDENT> @property <NEW_LINE> def python_type(self) -> Optional[Type[Any]]: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def _compiler_dispatch(cls, _visitor: Visitable, **_kw: Any) -> str: <NEW_LINE> <INDENT> return "ROW" | A type for rows. | 6259903b379a373c97d9a210 |
class DependencyMFVI(nn.Module): <NEW_LINE> <INDENT> def __init__(self, max_iter=3): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.max_iter = max_iter <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return f"{self.__class__.__name__}(max_iter={self.max_iter})" <NEW_LINE> <DEDENT> @torch.enable_grad... | Mean Field Variational Inference for approximately calculating marginals
of dependency trees :cite:`wang-tu-2020-second`. | 6259903b07d97122c4217e85 |
class DescribeLoadBalancersRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.EcmRegion = None <NEW_LINE> self.LoadBalancerIds = None <NEW_LINE> self.LoadBalancerName = None <NEW_LINE> self.LoadBalancerVips = None <NEW_LINE> self.BackendPrivateIps = None <NEW_LINE> self.Offset = No... | DescribeLoadBalancers请求参数结构体
| 6259903b6fece00bbacccb95 |
@attrs.define(kw_only=True) <NEW_LINE> class Record: <NEW_LINE> <INDENT> scores: typing.Optional[RecordScores] <NEW_LINE> categories_node_hash: undefined.UndefinedOr[int] <NEW_LINE> seals_node_hash: undefined.UndefinedOr[int] <NEW_LINE> state: typedefs.IntAnd[RecordState] <NEW_LINE> objectives: typing.Optional[list[Obj... | Represents a Bungie profile records/triumphs component. | 6259903bd53ae8145f91964e |
class Automi: <NEW_LINE> <INDENT> def __init__(self,ns="/automi/"): <NEW_LINE> <INDENT> self.ns=ns <NEW_LINE> self.joints=None <NEW_LINE> self.angles=None <NEW_LINE> self._sub_joints=rospy.Subscriber(ns+"joint_states",JointState,self._cb_joints,queue_size=1) <NEW_LINE> rospy.loginfo("Waiting for joints to be populated.... | Client ROS class for manipulating Automi OP in Gazebo | 6259903b26068e7796d4db2f |
class CheckListBox(ListBox, WithCharEvents): <NEW_LINE> <INDENT> bind_mouse_leaving = bind_lclick_double = True <NEW_LINE> _wx_widget_type = _wx.CheckListBox <NEW_LINE> _native_widget: _wx.CheckListBox <NEW_LINE> def __init__(self, parent, choices=None, isSingle=False, isSort=False, isHScroll=False, isExtended=False, o... | A list of checkboxes, of which one or more can be selected.
Events:
- on_box_checked(index: int): Posted when user checks an item from the
list. The default arg processor extracts the index of the event.
- on_context(lb_instance: CheckListBox): Posted when this CheckListBox is
right-clicked.
- Mouse even... | 6259903b21bff66bcd723e51 |
class AbstractAsyncTaskResult(): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def done(self): <NEW_LINE> <INDENT> raise NotImplementedError() | Definition of the AsyncTaskResult interface
This represents a Future-like object. Custom implementations of WorkerPool
interface need to return objects with this interface in `map` method. | 6259903b8a43f66fc4bf3376 |
class MiddleItem(models.Model): <NEW_LINE> <INDENT> name = models.CharField(verbose_name='中項目', max_length=255) <NEW_LINE> parent = models.ForeignKey(LargeItem, verbose_name='大項目', on_delete=models.PROTECT) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name | 中項目 | 6259903b8e05c05ec3f6f74f |
class TestCertificatesV1beta1Api(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = kubernetes.client.apis.certificates_v1beta1_api.CertificatesV1beta1Api() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_create_certificate_signing_reque... | CertificatesV1beta1Api unit test stubs | 6259903b71ff763f4b5e8984 |
class SearchResult(object): <NEW_LINE> <INDENT> def __init__(self, filename, link, date, time, event, info): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> self.link = link <NEW_LINE> self.date = date <NEW_LINE> self.time = time <NEW_LINE> self.event = event <NEW_LINE> self.info = info | Search result -- a single utterance. | 6259903b507cdc57c63a5f84 |
class Visual(object): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> self._transform = np.eye(4) <NEW_LINE> self._children = [] <NEW_LINE> self._parent = None <NEW_LINE> self.parent = parent <NEW_LINE> self.program = None <NEW_LINE> self._shaderTransforms = {} <NEW_LINE> <DEDENT> @property <NE... | Base class to represent a citizen of a World object. Typically
a visual is used to visualize something, although this is not
strictly necessary. It may for instance also be used as a container
to apply a certain transformation to a group of objects, or a camera
object. | 6259903b30dc7b76659a0a1b |
class HashableShape_Deep(object): <NEW_LINE> <INDENT> def __init__(self, shape): <NEW_LINE> <INDENT> self.Shape = shape <NEW_LINE> self.hash = 0 <NEW_LINE> for el in shape.childShapes(): <NEW_LINE> <INDENT> self.hash = self.hash ^ el.hashCode() <NEW_LINE> <DEDENT> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> i... | Similar to HashableShape, except that the things the shape is composed of are compared.
Example:
>>> wire2 = Part.Wire(wire1.childShapes())
>>> wire2.isSame(wire1)
False # <--- the wire2 is a new wire, although made of edges of wire1
>>> HashableShape_Deep(wire2) == HashableShape_Deep(wire1)
True #... | 6259903b379a373c97d9a212 |
class AlphaBetaPlayer(IsolationPlayer): <NEW_LINE> <INDENT> def get_move(self, game, time_left): <NEW_LINE> <INDENT> self.time_left = time_left <NEW_LINE> best_move = (-1, -1) <NEW_LINE> try: <NEW_LINE> <INDENT> depth = 1 <NEW_LINE> while True: <NEW_LINE> <INDENT> best_move = self.alphabeta(game, depth) <NEW_LINE> dept... | Game-playing agent that chooses a move using iterative deepening minimax
search with alpha-beta pruning. You must finish and test this player to
make sure it returns a good move before the search time limit expires. | 6259903b07d97122c4217e87 |
class Resizer(object): <NEW_LINE> <INDENT> def __call__(self, sample, min_side=512, max_side=512): <NEW_LINE> <INDENT> image, annots = sample['img'], sample['annot'] <NEW_LINE> rows, cols, cns = image.shape <NEW_LINE> smallest_side = min(rows, cols) <NEW_LINE> scale = min_side / smallest_side <NEW_LINE> scale1 = 512 / ... | Convert ndarrays in sample to Tensors. | 6259903b6fece00bbacccb97 |
class TestRoutes(unittest.TestCase): <NEW_LINE> <INDENT> def test_get_authors(self): <NEW_LINE> <INDENT> author = TestRoutesMock.get_authors_mock() <NEW_LINE> self.assertTrue(str(author["author"]["first"])) <NEW_LINE> self.assertTrue(str(author["author"]["formatted_name"])) <NEW_LINE> self.assertTrue(str(author["author... | Unitest for Routes methods | 6259903bd99f1b3c44d06890 |
class Job(): <NEW_LINE> <INDENT> def __init__(self, name="", start_time=0, end_time=0, status=0): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.start_time = start_time <NEW_LINE> self.end_time = end_time <NEW_LINE> self.status = status <NEW_LINE> <DEDENT> def get_start_time_obj(self): <NEW_LINE> <INDENT> return ... | A class definition to hold all the information about a job.
name : string
Name of the job.
start_time : string
When the job started
end_time : string
When the job finished
status: number
Status of the job. If it is 0 means success, all othe values means fai... | 6259903b8a43f66fc4bf3378 |
class LineError(ChatError): <NEW_LINE> <INDENT> @property <NEW_LINE> def message(self): <NEW_LINE> <INDENT> return "{error}: {line}".format( error=self.args[0], line=self.args[1].decode('ascii').strip()) | Error with the line. Usually means a parse or unknown command error. | 6259903b94891a1f408b9fec |
class Candidate(): <NEW_LINE> <INDENT> def __init__(self, locator='', score=0, match_addr='', x=None, y=None, wkid=4326, entity='', confidence='', **kwargs): <NEW_LINE> <INDENT> for k in locals().keys(): <NEW_LINE> <INDENT> if k not in ['self', 'kwargs']: setattr(self, k, locals()[k]) <NEW_LINE> <DEDENT> for k in kwarg... | Class representing a candidate address returned from geocoders.
Accepts arguments defined below, plus informal keyword arguments.
Arguments:
==========
locator -- Locator used for geocoding (default '')
score -- Standardized score (default 0)
match_addr -- Address returned by geocoder (default '')
x ... | 6259903b8da39b475be043d9 |
class BulkIndexError(EdenError): <NEW_LINE> <INDENT> def __init__(self, resource=None, errors=None): <NEW_LINE> <INDENT> super(BulkIndexError, self).__init__( 'Failed to bulk index resource {} errors: {}'.format( resource, errors), payload={}) | Exception raised when bulk index operation fails.. | 6259903b73bcbd0ca4bcb474 |
class Flush(Statement): <NEW_LINE> <INDENT> match = re.compile(r'flush\b', re.I).match <NEW_LINE> def process_item(self): <NEW_LINE> <INDENT> line = self.item.get_line()[5:].lstrip() <NEW_LINE> if not line: <NEW_LINE> <INDENT> self.isvalid = False <NEW_LINE> return <NEW_LINE> <DEDENT> if line.startswith('('): <NEW_LINE... | FLUSH <file-unit-number>
FLUSH ( <flush-spec-list> )
<flush-spec> = [ UNIT = ] <file-unit-number>
| IOSTAT = <scalar-int-variable>
| IOMSG = <iomsg-variable>
| ERR = <label> | 6259903b596a897236128e8a |
class TRFBD(Omni): <NEW_LINE> <INDENT> name = "TRFBD" <NEW_LINE> def __init__(self, **args): <NEW_LINE> <INDENT> Omni.__init__(self, **args) <NEW_LINE> if 'SpinCycle' in args: self.spincycle = self.spincycleMax = args['SpinCycle'] <NEW_LINE> else: self.spincycle = self.spincycleMax = 0 <NEW_LINE> <DEDENT> def Tick(self... | AI for torque reaction full body drums. | 6259903b3c8af77a43b68831 |
class TestRemoveNumbersBadInput(TestCase): <NEW_LINE> <INDENT> def test_non_string_input(self): <NEW_LINE> <INDENT> self.assertRaises(ptext.InputError, ptext.remove_numbers, []) | tests for bad input to remove_numbers | 6259903bbe383301e0254a02 |
class ReadThread(Thread): <NEW_LINE> <INDENT> def __init__(self, socket, name=None): <NEW_LINE> <INDENT> self.socket = socket <NEW_LINE> super(ReadThread, self).__init__() <NEW_LINE> self.endflag = False <NEW_LINE> if name is not None: <NEW_LINE> <INDENT> self.setName(name) <NEW_LINE> <DEDENT> self.resync_count = 0 <NE... | We use a persistent tcp connection and blocking read from a socket with a timeout of 1 sec.
The packets have the following structure:
int32 command
char4 "FOSC"
int32 size
data block with "size" bytes
The integers are little endian. | 6259903b5e10d32532ce41f8 |
class PSDConstraint(LeqConstraint): <NEW_LINE> <INDENT> OP_NAME = ">>" <NEW_LINE> def __init__(self, lh_exp, rh_exp): <NEW_LINE> <INDENT> if (lh_exp.size[0] != lh_exp.size[1]) or (rh_exp.size[0] != rh_exp.size[1]): <NEW_LINE> <INDENT> raise ValueError( "Non-square matrix in positive definite constraint." ) <N... | Constraint X >> Y that z.T(X - Y)z >= 0 for all z.
| 6259903b507cdc57c63a5f85 |
class CBCT1(CatPhan504Mixin, TestCase): <NEW_LINE> <INDENT> file_path = ['CBCT_1.zip'] <NEW_LINE> expected_roll = -0.53 <NEW_LINE> origin_slice = 32 <NEW_LINE> hu_values = {'Poly': -35, 'Acrylic': 130, 'Delrin': 347, 'Air': -996, 'Teflon': 1004, 'PMP': -186, 'LDPE': -94} <NEW_LINE> unif_values = {'Center': 13, 'Left': ... | A Varian CBCT dataset | 6259903b63b5f9789fe86358 |
@six.add_metaclass(ABCMeta) <NEW_LINE> class BaseTowerContext(object): <NEW_LINE> <INDENT> def __init__(self, ns_name, vs_name=''): <NEW_LINE> <INDENT> self._name = ns_name <NEW_LINE> self._vs_name = vs_name <NEW_LINE> if len(vs_name): <NEW_LINE> <INDENT> assert len(ns_name), "TowerContext(vs_name) cannot be used with ... | A context where the current model is built in.
Since TF 1.8, TensorFlow starts to introduce the same concept. | 6259903bcad5886f8bdc5972 |
class ListrefsCommand(BaseCommand): <NEW_LINE> <INDENT> command_name = "ul_listrefs" <NEW_LINE> @inlineCallbacks <NEW_LINE> def run(self, protocol, parsed_line, invoker_dbref): <NEW_LINE> <INDENT> cmd_line = parsed_line.kwargs['cmd'].split() <NEW_LINE> class_choices = ['light', 'medium', 'heavy', 'assault'] <NEW_LINE> ... | Lists unit refs. | 6259903bd53ae8145f919652 |
class APIError(Exception): <NEW_LINE> <INDENT> pass | Summary | 6259903bbaa26c4b54d50494 |
class imerge(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.enabled = True <NEW_LINE> self.checked = False <NEW_LINE> <DEDENT> def onClick(self): <NEW_LINE> <INDENT> pass | Implementation for WEBDHMV2_addin.imerge (Button) | 6259903b07d97122c4217e8a |
@python_2_unicode_compatible <NEW_LINE> class ZDProcess(models.Model): <NEW_LINE> <INDENT> create_time = models.DateTimeField('创建时间', auto_now=True) <NEW_LINE> file_name = models.CharField('请求子文件名', max_length=240, blank=True) <NEW_LINE> userid = models.IntegerField('用户的id', null=True, blank=True) <NEW_LINE> idno = mod... | 中登处理流水 | 6259903b73bcbd0ca4bcb476 |
class TagsDistributionPerCourse( TagsDistributionDownstreamMixin, EventLogSelectionMixin, MapReduceJobTask): <NEW_LINE> <INDENT> def output(self): <NEW_LINE> <INDENT> return get_target_from_url(self.output_root) <NEW_LINE> <DEDENT> def mapper(self, line): <NEW_LINE> <INDENT> value = self.get_event_and_date_string(line)... | Calculates tags distribution. | 6259903b1d351010ab8f4d08 |
class ChooseAddressView(chooser.ChooseView): <NEW_LINE> <INDENT> model = Address <NEW_LINE> form_class = AddressForm <NEW_LINE> results_template = 'wagtailaddresses/address-chooser/results.html' <NEW_LINE> chooser_template = 'wagtailaddresses/address-chooser/chooser.html' <NEW_LINE> chooser... | Address choose view. | 6259903b287bf620b6272dd7 |
class IntentReflectorHandler(AbstractRequestHandler): <NEW_LINE> <INDENT> def can_handle(self, handler_input): <NEW_LINE> <INDENT> return ask_utils.is_request_type("IntentRequest")(handler_input) <NEW_LINE> <DEDENT> def handle(self, handler_input): <NEW_LINE> <INDENT> intent_name = ask_utils.get_intent_name(handler_inp... | The intent reflector is used for interaction model testing and debugging.
It will simply repeat the intent the user said. You can create custom handlers
for your intents by defining them above, then also adding them to the request
handler chain below. | 6259903b6e29344779b01840 |
class AddActivity(Form): <NEW_LINE> <INDENT> activity = StringField('Activity', [validators.DataRequired()]) | creates form input field for adding activity | 6259903b0fa83653e46f60c8 |
class NamespaceListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[NamespaceResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, value: Optional[List["NamespaceResource"]] = None, next_link: Optional[str] = None,... | The response of the List Namespace operation.
:param value: Result of the List Namespace operation.
:type value: list[~azure.mgmt.eventhub.v2015_08_01.models.NamespaceResource]
:param next_link: Link to the next set of results. Not empty if Value contains incomplete list
of namespaces.
:type next_link: str | 6259903b23e79379d538d6ee |
class Week(BaseModel): <NEW_LINE> <INDENT> year = IntegerField() <NEW_LINE> week_number = IntegerField() <NEW_LINE> minutes_to_work = IntegerField(default=0) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> indexes = ( (('year', 'week_number'), True), ) <NEW_LINE> order_by = ('year', 'week_number') <NEW_LINE> <DEDENT> def __... | Week model. | 6259903bcad5886f8bdc5973 |
class MaxReadedDatetimeMixIn(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def max_readed_datetime(self): <NEW_LINE> <INDENT> return now() - timedelta(hours=MESSAGE_ARCHIVE_HOURS) | Mixin helper class for Contact and Archive manager | 6259903b96565a6dacd2d882 |
class KaHrPayrollEmployeeHolidays(models.Model): <NEW_LINE> <INDENT> _inherit = 'hr.holidays' <NEW_LINE> tunjangan_holiday_id = fields.Many2one('ka_hr_payroll.tunjangan.holidays', string="Ref. Tunjangan", readonly=True) <NEW_LINE> @api.multi <NEW_LINE> def get_dinas_cost(self): <NEW_LINE> <INDENT> if self.holiday_statu... | Data holidays of employee.
_inherit = 'hr.holidays' | 6259903b21bff66bcd723e57 |
class EncNet(Chain): <NEW_LINE> <INDENT> def __init__(self, dim, act=F.relu, device=None, ): <NEW_LINE> <INDENT> d_inp, d_out = dim <NEW_LINE> super(EncNet, self).__init__( linear=L.Linear(d_inp, d_out), bn=L.BatchNormalization(d_out, decay=0.9, use_gamma=False, use_beta=False), sb=L.Scale(W_shape=d_out, bias_term=True... | Encoder Component
| 6259903b23e79379d538d6ef |
@implementer(ICheckinCheckoutReference) <NEW_LINE> @adapter(IIterateAware) <NEW_LINE> class CheckinCheckoutReferenceAdapter(object): <NEW_LINE> <INDENT> storage_key = "coci.references" <NEW_LINE> def __init__(self, context): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> <DEDENT> def checkout(self, baseline, wc,... | default adapter for references.
on checkout
forward refs on baseline are copied to wc
backward refs on baseline are ignored on wc
on checkin
forward refs on wc are kept
backwards refs on wc are kept
forward refs on baseline get removed
backward refs on baseline are kept by virtue of UID transferance | 6259903b63b5f9789fe8635c |
class ChoiceQuestion(Question): <NEW_LINE> <INDENT> accuracy = models.FloatField(default=0) <NEW_LINE> correct_count_daily = models.IntegerField(default=0) <NEW_LINE> correct_count_weekly = models.IntegerField(default=0) <NEW_LINE> CHOICE_CLASS = Choice <NEW_LINE> def countInc(self, correct=False, *args, **kwargs): <NE... | Base class for choice question
| 6259903b0fa83653e46f60ca |
class ProductPageJsonSerializer: <NEW_LINE> <INDENT> def __init__(self, row, *args, **kwargs): <NEW_LINE> <INDENT> self._data = self.get_data(row) <NEW_LINE> <DEDENT> def get_data(self, row): <NEW_LINE> <INDENT> fields = row.get('fields', None) <NEW_LINE> fields_bak = row.get('fields_bak', None) <NEW_LINE> name = row.g... | Костыльный класс для работы с json-"дампами" от
прошлого программиста | 6259903b07d97122c4217e8d |
@Thenable.register <NEW_LINE> @python_2_unicode_compatible <NEW_LINE> class GroupResult(ResultSet): <NEW_LINE> <INDENT> id = None <NEW_LINE> results = None <NEW_LINE> def __init__(self, id=None, results=None, **kwargs): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> ResultSet.__init__(self, results, **kwargs) <NEW_LINE> <... | Like :class:`ResultSet`, but with an associated id.
This type is returned by :class:`~celery.group`.
It enables inspection of the tasks state and return values as
a single entity.
:param id: The id of the group.
:param results: List of result instances. | 6259903b76d4e153a661db6b |
class PyMappy(PythonPackage): <NEW_LINE> <INDENT> homepage = "https://pypi.python.org/pypi/mappy" <NEW_LINE> url = "https://pypi.io/packages/source/m/mappy/mappy-2.2.tar.gz" <NEW_LINE> version('2.2', 'dfc2aefe98376124beb81ce7dcefeccb') <NEW_LINE> depends_on('zlib') | Mappy provides a convenient interface to minimap2. | 6259903b50485f2cf55dc171 |
class InstructorInline(admin.TabularInline): <NEW_LINE> <INDENT> model = Instructor <NEW_LINE> extra = 1 <NEW_LINE> verbose_name_plural = 'instructors' | Inline administration descriptor for course instructors | 6259903b91af0d3eaad3b024 |
class TestGenres(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.obj=Genres(type='Comedia', slug= 'comedia', description='A comédia é o uso de humor nas artes cênicas.' ) <NEW_LINE> <DEDENT> def test_create(self): <NEW_LINE> <INDENT> self.obj.save() <NEW_LINE> self.assertEqual(1, self.obj.id) | Testa o Model Genres | 6259903b94891a1f408b9fef |
class MiddlewareUsingCoro(ManagerTestCase): <NEW_LINE> <INDENT> def test_asyncdef(self): <NEW_LINE> <INDENT> resp = Response('http://example.com/index.html') <NEW_LINE> class CoroMiddleware: <NEW_LINE> <INDENT> async def process_request(self, request, spider): <NEW_LINE> <INDENT> await defer.succeed(42) <NEW_LINE> retu... | Middlewares using asyncio coroutines should work | 6259903bd4950a0f3b111738 |
class BuyAndHoldFrameworkAlgorithm(QCAlgorithmFramework): <NEW_LINE> <INDENT> def Initialize(self): <NEW_LINE> <INDENT> self.SetStartDate(2019, 1, 1) <NEW_LINE> self.SetCash(100000) <NEW_LINE> tickers = ['FB', 'AMZN', 'NFLX', 'GOOG'] <NEW_LINE> objectiveFunction = 'std' <NEW_LINE> rebalancingParam = 365 <NEW_LINE> self... | Trading Logic:
This algorithm buys and holds the provided tickers from the start date until the end date
Modules:
Universe: Manual input of tickers
Alpha: Constant creation of Up Insights every trading bar
Portfolio: A choice between Equal Weighting, Maximize Portfolio Return, Minimize Portfolio Standar... | 6259903bbe383301e0254a08 |
class FabricCodeVersionInfo(Model): <NEW_LINE> <INDENT> _attribute_map = { 'code_version': {'key': 'CodeVersion', 'type': 'str'}, } <NEW_LINE> def __init__(self, code_version=None): <NEW_LINE> <INDENT> self.code_version = code_version | Information about a Service Fabric code version.
:param code_version: The product version of Service Fabric.
:type code_version: str | 6259903b0a366e3fb87ddbd6 |
class DirectMainTest(cros_test_lib.MockTempDirTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.hooks_mock = self.PatchObject(pre_upload, '_run_project_hooks', return_value=None) <NEW_LINE> <DEDENT> def testNoArgs(self): <NEW_LINE> <INDENT> ret = pre_upload.direct_main([]) <NEW_LINE> self.assertE... | Tests for direct_main() | 6259903b507cdc57c63a5f8b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.