code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Command(BaseCommand): <NEW_LINE> <INDENT> help = 'Send email reminder to Mentors about Reps without reports.' <NEW_LINE> SUBJECT = '[Report] Your mentees with no reports for %s' <NEW_LINE> EMAIL_TEMPLATE = 'emails/mentor_notification.txt' <NEW_LINE> def handle(self, *args, **options): <NEW_LINE> <INDENT> rep_grou...
Command to send email reminder to Mentors about Reps without reports.
6259907666673b3332c31d79
class DunMcStrategy(Strategy): <NEW_LINE> <INDENT> def __init__(self, env: Environment, model: RQModelBase, memory_capacity=100000, discount_factor=0.96, batch_size=64, epsilon=0.5): <NEW_LINE> <INDENT> super(DunMcStrategy, self).__init__(env, model) <NEW_LINE> self.replay = GenericMemory(memory_capacity, [ ('state', n...
Updates Q values with the accumulated rewards over a whole episode
625990767047854f46340d33
class DysonPureHotCool(DysonPureCool, DysonHeatingDevice): <NEW_LINE> <INDENT> pass
Dyson Pure Hot+Cool device.
625990764f6381625f19a168
class BibCatalogSystem: <NEW_LINE> <INDENT> TICKET_ATTRIBUTES = ['ticketid', 'priority', 'recordid', 'subject', 'text', 'creator', 'owner', 'date', 'status', 'queue', 'url_display', 'url_modify', 'url_close'] <NEW_LINE> def check_system(self, uid=None): <NEW_LINE> <INDENT> raise NotImplementedError("This class cannot b...
A template class for ticket support.
625990763539df3088ecdc11
class IntegerValidator(NumberValidator): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> NumberValidator.__init__(self,floats=False) <NEW_LINE> <DEDENT> def Clone(self): <NEW_LINE> <INDENT> return IntegerValidator()
Validator for integer numbers
625990765fdd1c0f98e5f8f8
class ActivePowerLimit(OperationalLimit): <NEW_LINE> <INDENT> def __init__(self, value=0.0, ActivePowerLimitSet=None, *args, **kw_args): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self._ActivePowerLimitSet = None <NEW_LINE> self.ActivePowerLimitSet = ActivePowerLimitSet <NEW_LINE> super(ActivePowerLimit, self)._...
Limit on active power flow.Limit on active power flow.
6259907632920d7e50bc79c2
class IsInHgRepoConstraint(AbstractConstraint): <NEW_LINE> <INDENT> def test(self, view: sublime.View) -> bool: <NEW_LINE> <INDENT> view_info = self.get_view_info(view) <NEW_LINE> if not view_info["file_name"]: <NEW_LINE> <INDENT> raise AlwaysFalsyException("file not on disk") <NEW_LINE> <DEDENT> return self.has_siblin...
Check whether this file is in a Mercurial repo.
62599076aad79263cf430132
class Capture(ContextSensitive): <NEW_LINE> <INDENT> def __init__(self, parser: Parser, zero_length_warning: bool=True) -> None: <NEW_LINE> <INDENT> super(Capture, self).__init__(parser) <NEW_LINE> self.zero_length_warning: bool = zero_length_warning <NEW_LINE> self._can_capture_zero_length: Optional[bool] = None <NEW_...
Applies the contained parser and, in case of a match, saves the result in a variable. A variable is a stack of values associated with the contained parser's name. This requires the contained parser to be named.
625990767c178a314d78e8a8
class Test(unittest.TestCase): <NEW_LINE> <INDENT> def testFunction(self): <NEW_LINE> <INDENT> r = Restaurant('sample') <NEW_LINE> self.assertEqual(-1, r.test_grades(['A','B'])) <NEW_LINE> self.assertEqual(1, r.test_grades(['C','B','B'])) <NEW_LINE> self.assertEqual(0, r.test_grades(['A'])) <NEW_LINE> self.assertEqual(...
test the test_grades funciton in the Restaurant class
625990768a349b6b43687bd5
class Sysadmin(factory.Factory): <NEW_LINE> <INDENT> FACTORY_FOR = ckan.model.User <NEW_LINE> fullname = 'Mr. Test Sysadmin' <NEW_LINE> password = 'pass' <NEW_LINE> about = 'Just another test sysadmin.' <NEW_LINE> name = factory.Sequence(lambda n: 'test_sysadmin_{0:02d}'.format(n)) <NEW_LINE> email = factory.LazyAttrib...
A factory class for creating sysadmin users.
625990764f88993c371f11de
class Gyroscope(morse.core.sensor.Sensor): <NEW_LINE> <INDENT> _name = "Gyroscope" <NEW_LINE> add_data('yaw', 0.0, "float", 'rotation around the Z axis of the sensor, in radian') <NEW_LINE> add_data('pitch', 0.0, "float", 'rotation around the Y axis of the sensor, in radian') <NEW_LINE> add_data('roll', 0.0, "float", '...
This sensor emulates a Gyroscope, providing the yaw, pitch and roll angles of the sensor object with respect to the Blender world reference axes. Angles are given in radians.
6259907697e22403b383c87e
class PageThree(tk.Frame): <NEW_LINE> <INDENT> def __init__(self, parent, root): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> tk.Label(self, text="这是其他", font=LARGE_FONT).pack() <NEW_LINE> button1 = ttk.Button(self, text="回到选课程", command=lambda: root.show_frame(StartPage)).pack()
其他
625990763317a56b869bf203
class User(db.Model): <NEW_LINE> <INDENT> __tablename__ = "users" <NEW_LINE> user_id = db.Column(db.Integer, autoincrement=True, primary_key=True) <NEW_LINE> email = db.Column(db.String(128), nullable=True) <NEW_LINE> password = db.Column(db.String(128), nullable=True) <NEW_LINE> age = db.Column(db.Integer, nullable=Tr...
User of ratings website.
625990765fcc89381b266e17
class BIOSConfig(DRACConfig): <NEW_LINE> <INDENT> def __init__(self, bios_settings, committed_job): <NEW_LINE> <INDENT> super(BIOSConfig, self).__init__('BIOS', committed_job) <NEW_LINE> self.bios_settings = bios_settings <NEW_LINE> self.changing_settings = {} <NEW_LINE> <DEDENT> def is_change_required(self): <NEW_LINE...
Configuration state machine for DRAC BIOS settings.
625990763d592f4c4edbc81b
class SymbioticTool(SymbioticBaseTool): <NEW_LINE> <INDENT> def __init__(self, opts): <NEW_LINE> <INDENT> SymbioticBaseTool.__init__(self, opts) <NEW_LINE> self._memsafety = self._options.property.memsafety() <NEW_LINE> <DEDENT> def name(self): <NEW_LINE> <INDENT> return 'predator' <NEW_LINE> <DEDENT> def executable(se...
Predator integraded into Symbiotic
6259907666673b3332c31d7b
class TestValueRef(object): <NEW_LINE> <INDENT> def test_grammar_typechecking(self): <NEW_LINE> <INDENT> grammar_types = [ ('value', [str]), ('value', [int]), ('value', [float]), ('field', [str]), ('scale', [str]), ('mult', [int]), ('mult', [float]), ('offset', [int]), ('offset', [float]), ('band', [bool])] <NEW_LINE> ...
Test the ValueRef class
625990762c8b7c6e89bd5165
class Shooter(pygame.sprite.Sprite): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.image = pygame.Surface([20, 20]) <NEW_LINE> self.image.fill(RED) <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.rect.x = 600 <NEW_LINE> self.rect.y = 10
this class represents the player
625990764e4d562566373d7e
class Match(ctypes.Structure): <NEW_LINE> <INDENT> _fields_ = [("projection", ctypes.c_char_p), ("delta", ctypes.c_double)]
Python class to mirror match struct in c
62599076a17c0f6771d5d86b
class test_BrLenDerivatives_ExpCM_empirical_phi(test_BrLenDerivatives_ExpCM): <NEW_LINE> <INDENT> MODEL = phydmslib.models.ExpCM_empirical_phi
Test branch length derv for ExpCM with empirical phi.
6259907632920d7e50bc79c4
class StateAwareWeblogConfigEditForm(WeblogConfigEditForm): <NEW_LINE> <INDENT> label = _(u'Configure Blog') <NEW_LINE> description = _(u"Weblog View Configuration") <NEW_LINE> form_name = _(u"Configure rule") <NEW_LINE> template = ViewPageTemplateFile('weblogconfig.pt') <NEW_LINE> form_fields = form.Fields(IStateAware...
Edit form for weblog view configuration.
625990768a43f66fc4bf3b12
class VrSamplePage(page.Page): <NEW_LINE> <INDENT> def __init__(self, sample_page, page_set, url_parameters=None, extra_browser_args=None): <NEW_LINE> <INDENT> url = '%s.html' % sample_page <NEW_LINE> if url_parameters is not None: <NEW_LINE> <INDENT> url += '?' + '&'.join(url_parameters) <NEW_LINE> <DEDENT> name = url...
Superclass for all VR sample pages.
6259907691f36d47f2231b4d
class VGG(nn.Module): <NEW_LINE> <INDENT> def __init__(self, features): <NEW_LINE> <INDENT> super(VGG, self).__init__() <NEW_LINE> self.features = features <NEW_LINE> self.classifier = nn.Sequential( nn.Dropout(), nn.Linear(512, 512), nn.ReLU(True), nn.Dropout(), nn.Linear(512, 512), nn.ReLU(True), nn.Linear(512, 100),...
VGG model
6259907616aa5153ce401e57
class ViewTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> user = User.objects.create_superuser(username='olivia', password='secret', email="[email protected]") <NEW_LINE> self.client = APIClient() <NEW_LINE> self.client.force_authenticate(user=user) <NEW_LINE> self.instance_data = { "name": "J...
Test suite for the api views.
62599076091ae356687065b7
class ColorBar(PlotlyDict): <NEW_LINE> <INDENT> pass
ColorBar doc.
6259907697e22403b383c880
class annotator_1to1(object): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") <NEW_LINE> __repr__ = _swig_repr <NEW_LINE> def mak...
1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. This block creates tags to be sent downstream every 10,000 items it sees. The tags contain the name and ID of the instantiated block, use "seq" as a key, and have a counter that increments by 1 for every tag produced that is used as the tag's value. The...
6259907632920d7e50bc79c5
class WhoFromCmd(Command): <NEW_LINE> <INDENT> aliases = ('@who', '@@who') <NEW_LINE> syntax = "[<player>]" <NEW_LINE> lock = "perm(manage players)" <NEW_LINE> arg_parsers = { 'player': parsers.MatchDescendants(cls=BasePlayer, search_for='player', show=True), } <NEW_LINE> def run(self, this, actor, args): <NEW_LINE> <I...
@who [<player>] Display connection information for the specified player.
625990763317a56b869bf204
class Connection(rackit.Connection): <NEW_LINE> <INDENT> projects = rackit.RootResource(AuthProject) <NEW_LINE> def __init__(self, auth_url, params, interface = 'public', verify = True): <NEW_LINE> <INDENT> self.auth_url = auth_url.rstrip('/') <NEW_LINE> self.params = params <NEW_LINE> self.interface = interface <NEW_L...
Class for a connection to an OpenStack API, which handles the authentication, project and service discovery elements. Can be used as an auth object for a requests session.
625990765fcc89381b266e18
class CategoryDaoImpl(CategoryDao): <NEW_LINE> <INDENT> def find_all(self): <NEW_LINE> <INDENT> super().find_all() <NEW_LINE> <DEDENT> def find_by_id(self, id=0): <NEW_LINE> <INDENT> super().find_by_id(id) <NEW_LINE> <DEDENT> def save(self, product): <NEW_LINE> <INDENT> super().save(product) <NEW_LINE> <DEDENT> def upd...
This class helps to do CRUD operations for the Category
6259907621bff66bcd7245e7
class EditHandler(BaseHandler): <NEW_LINE> <INDENT> @tornado.web.authenticated <NEW_LINE> @tornado.web.addslash <NEW_LINE> def get(self, network_name): <NEW_LINE> <INDENT> network = self.bouncer.networks[network_name] <NEW_LINE> self.render("edit.html", network=network, **self.env) <NEW_LINE> <DEDENT> @tornado.web.aut...
The RequestHandler that serves the edit network page. The edit network page uses a form to receive updated settings from users. When a network is editted, it is disconnected and then recreated using the new settings.
62599076a17c0f6771d5d86c
class Update(ValuesBase): <NEW_LINE> <INDENT> __visit_name__ = 'update' <NEW_LINE> def __init__(self, table, whereclause, values=None, inline=False, bind=None, returning=None, **kwargs): <NEW_LINE> <INDENT> ValuesBase.__init__(self, table, values) <NEW_LINE> self._bind = bind <NEW_LINE> self._returning = returning <NEW...
Represent an Update construct. The :class:`.Update` object is created using the :func:`update()` function.
625990777c178a314d78e8aa
class Button(): <NEW_LINE> <INDENT> def __init__(self, screen, msg): <NEW_LINE> <INDENT> self.screen = screen <NEW_LINE> self.screen_rect = screen.get_rect() <NEW_LINE> self.width, self.height = 200, 50 <NEW_LINE> self.button_color = (0, 255, 0) <NEW_LINE> self.text_color = (255, 255, 255) <NEW_LINE> self.font = pygame...
Button class
62599077e1aae11d1e7cf4ce
class PackageUpdate(NotContainerized, OpenShiftCheck): <NEW_LINE> <INDENT> name = "package_update" <NEW_LINE> tags = ["preflight"] <NEW_LINE> def run(self, tmp, task_vars): <NEW_LINE> <INDENT> args = {"packages": []} <NEW_LINE> return self.module_executor("check_yum_update", args, tmp, task_vars)
Check that there are no conflicts in RPM packages.
6259907744b2445a339b761d
class L1ICache(L1Cache): <NEW_LINE> <INDENT> size = '16kB' <NEW_LINE> clusivity = 'mostly_incl' <NEW_LINE> def __init__(self, options=None): <NEW_LINE> <INDENT> super(L1ICache, self).__init__(options) <NEW_LINE> if not options or not options.l1i_size: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.size = options.l...
Simple L1 instruction cache with default values
625990778a349b6b43687bd9
class Testcase_260_250_FlowmodPriority(base_tests.SimpleDataPlane): <NEW_LINE> <INDENT> @wireshark_capture <NEW_LINE> def runTest(self): <NEW_LINE> <INDENT> logging.info("Running 260.250 - Priority level of flow entry test") <NEW_LINE> rv = delete_all_flows(self.controller) <NEW_LINE> self.assertEqual(rv, 0, "Failed to...
260.250 - Priority level of flow entry Verify that traffic matches against higher priority rules
62599077aad79263cf430137
class EdgeCasesTest(QueueDatabaseTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> QueueDatabaseTest.setUp(self) <NEW_LINE> <DEDENT> def test_aggregate_empty_results(self): <NEW_LINE> <INDENT> self.create_wiki_cohort() <NEW_LINE> metric = metric_classes['NamespaceEdits']( name='NamespaceEdits', namespaces...
Tests different cases for metric system when it comes to report results
62599077d268445f2663a81d
class ExactInference(InferenceModule): <NEW_LINE> <INDENT> def initializeUniformly(self, gameState): <NEW_LINE> <INDENT> self.beliefs = util.Counter() <NEW_LINE> for p in self.legalPositions: self.beliefs[p] = 1.0 <NEW_LINE> self.beliefs.normalize() <NEW_LINE> <DEDENT> def observe(self, observation, gameState): <NEW_LI...
The exact dynamic inference module should use forward-algorithm updates to compute the exact belief function at each time step.
625990773346ee7daa33831f
class Column(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.type = NoType <NEW_LINE> self.dtype = None <NEW_LINE> self.str_vals = [] <NEW_LINE> self.fill_values = {}
Table column. The key attributes of a Column object are: * **name** : column name * **type** : column type (NoType, StrType, NumType, FloatType, IntType) * **dtype** : numpy dtype (optional, overrides **type** if set) * **str_vals** : list of column values as strings * **data** : list of converted column values
62599077091ae356687065b9
class Predicate(Pattern): <NEW_LINE> <INDENT> def __init__(self, predicate): <NEW_LINE> <INDENT> self.predicate = predicate <NEW_LINE> <DEDENT> def __match__(self, x): <NEW_LINE> <INDENT> if self.predicate(x): <NEW_LINE> <INDENT> return x <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise MatchFailure(matched=x, patte...
Base class for 'predicate' objects implementing the match protocol
625990771b99ca40022901f5
class ComposeFormTests(TestCase): <NEW_LINE> <INDENT> fixtures = ['users'] <NEW_LINE> def test_invalid_data(self): <NEW_LINE> <INDENT> invalid_data_dicts = [ {'data': {'to': 'john', 'body': ''}, 'error': ('body', [u'This field is required.'])}, ] <NEW_LINE> for invalid_dict in invalid_data_dicts: <NEW_LINE> <INDENT> fo...
Test the compose form.
6259907756b00c62f0fb4251
class HelmBuildFilteringPipeline(BuildStepsFilteringPipeline): <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> super().__init__( [ HelmBuilderValidator(), GiantSwarmHelmValidator(), HelmGitVersionSetter(), HelmRequirementsUpdater(), HelmChartToolLinter(), KubeLinter(), HelmChartMetadataPreparer(), H...
Pipeline that combines all the steps required to use helm3 as a chart builder.
625990775fcc89381b266e19
class Timetools: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.timeformatter = '%Y-%m-%d %H:%M:%S' <NEW_LINE> self.dateformatter = '%Y年%m月%d日' <NEW_LINE> self.maxdatespan = 50 <NEW_LINE> <DEDENT> def timetostr(self, ttime): <NEW_LINE> <INDENT> return time.strftime(self.timeformatter, ttime) <NEW_LINE...
日期转换工具
6259907799fddb7c1ca63a95
class TestSetup(unittest.TestCase): <NEW_LINE> <INDENT> layer = PLOMINO_WIZARD_INTEGRATION_TESTING <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.portal = self.layer['portal'] <NEW_LINE> self.installer = api.portal.get_tool('portal_quickinstaller') <NEW_LINE> <DEDENT> def test_product_installed(self): <NEW_LINE> ...
Test that plomino.wizard is properly installed.
625990773317a56b869bf205
class DueFilter(BaseFilter): <NEW_LINE> <INDENT> def __init__(self, dueRange): <NEW_LINE> <INDENT> BaseFilter.__init__(self, dueRange) <NEW_LINE> <DEDENT> def isMatch(self, task): <NEW_LINE> <INDENT> return (not task.is_complete) and (self.text in task.dueRanges) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDEN...
Due list filter for ranges
625990774527f215b58eb660
class ContactForm(forms.ModelForm): <NEW_LINE> <INDENT> captcha = ReCaptchaField() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Contact <NEW_LINE> fields = ("email", "captcha") <NEW_LINE> widgets = { "email": forms.TextInput(attrs={"class": "editContent", "placeholder": "Your Email..."}) } <NEW_LINE> labels = { "...
Форма подписки по email
62599077adb09d7d5dc0bee9
class RobustQueue(Queue): <NEW_LINE> <INDENT> def __init__(self, loop, future_store, channel, name, durable, exclusive, auto_delete, arguments): <NEW_LINE> <INDENT> super(RobustQueue, self).__init__(loop, future_store, channel, name or "amq_%s" % shortuuid.uuid(), durable, exclusive, auto_delete, arguments) <NEW_LINE> ...
A queue that, if the connection drops, will recreate itself once it's back up
625990774a966d76dd5f086b
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE) <NEW_LINE> class TestPeerGradingFound(ModuleStoreTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.course_name = 'edX/open_ended_nopath/2012_Fall' <NEW_LINE> self.course = modulestore().get_course(self.course_name) <NEW_LINE> <DEDENT> de...
Test to see if peer grading modules can be found properly.
625990773539df3088ecdc17
class TVshow: <NEW_LINE> <INDENT> def __init__(self, show): <NEW_LINE> <INDENT> self.__show1 = show <NEW_LINE> <DEDENT> @property <NEW_LINE> def show2(self): <NEW_LINE> <INDENT> return self.__show1
显示电视节目,属性设置为私有的,限制在函数体外修改,只读模式
62599077379a373c97d9a9a2
class Test_Geom_BSplineSurface(unittest.TestCase): <NEW_LINE> <INDENT> def test_Weights(self): <NEW_LINE> <INDENT> s1 = Geom_SphericalSurface(gp_Ax3(), 1.) <NEW_LINE> s2 = Geom_RectangularTrimmedSurface(s1, 0., 1., 0., 1.) <NEW_LINE> s3 = GeomConvert.SurfaceToBSplineSurface_(s2) <NEW_LINE> weights = TColStd_Array2OfRea...
Test for Geom_BSplineSurface class.
625990779c8ee82313040e47
class RFFT(Layer): <NEW_LINE> <INDENT> def rfft(self, x, fft_fn): <NEW_LINE> <INDENT> resh = K.cast(K.map_fn(K.transpose, x), dtype='complex64') <NEW_LINE> spec = K.abs(K.map_fn(fft_fn, resh)) <NEW_LINE> out = K.cast(K.map_fn(K.transpose, spec), dtype='float32') <NEW_LINE> shape = tf.shape(out) <NEW_LINE> new_shape = [...
Keras layer for one-dimensional discrete Fourier Transform for real input. Computes rfft transforn on each slice along last dim. Input shape 3D tensor (batch_size, signal_length, nb_channels) Output shape 3D tensor (batch_size, int(signal_length / 2), nb_channels)
625990775fdd1c0f98e5f8fe
class LearningStyleHistory(db.Model): <NEW_LINE> <INDENT> recorded = db.DateTimeProperty(auto_now_add=True) <NEW_LINE> user = db.ReferenceProperty(Student) <NEW_LINE> intelligent_type = db.ReferenceProperty(IntelligentType) <NEW_LINE> realized_test = db.ReferenceProperty(IntelligentTest)
Learning style history
62599077bf627c535bcb2e4e
class SomeIntEnum(enum.Enum): <NEW_LINE> <INDENT> FOO = 1 <NEW_LINE> BAR = 2
An enum with int values
625990777d847024c075dd5b
class TestCreateFilesystemStructure(TankTestBase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestCreateFilesystemStructure, self).setUp() <NEW_LINE> self.setup_fixtures() <NEW_LINE> self.seq = {"type": "Sequence", "id": 2, "code": "seq_code", "project": self.project} <NEW_LINE> self.shot = {"type":...
Tests of the function schema.create_folders.
6259907744b2445a339b761e
class TransplantMergeView(FormView): <NEW_LINE> <INDENT> form_class = UserMergeForm <NEW_LINE> success_url = settings.TRANSPLANT_SUCCESS_URL <NEW_LINE> template_name = 'transplant/merge.html' <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> FormView.__init__(self, **kwargs) <NEW_LINE> <DEDENT> def form_vali...
View performing User merge using all operations defined in settings.TRANSPLANT_OPERATIONS. Handles transactions (rollback on any exception) and exceptions (see transplant.settings for full info). Uses django.contrib.auth.forms.AuthenticationForm by default, but any other Form that will conform to it's API can do (the...
625990778a349b6b43687bdb
class Durations(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> interval = db.Column(db.Integer) <NEW_LINE> time_req = db.Column(db.Integer) <NEW_LINE> connection_id = db.Column(db.Integer, db.ForeignKey('connections.id'))
Duration to travel connection at a given time bucket
62599077d268445f2663a81e
class Detector(object): <NEW_LINE> <INDENT> def __init__(self, threshold=None, sample_times=None): <NEW_LINE> <INDENT> self.threshold = threshold <NEW_LINE> self.sample_times = sample_times <NEW_LINE> self.sample_points = None <NEW_LINE> <DEDENT> def get_sample_points(self, position): <NEW_LINE> <INDENT> if self.sample...
Defines a sensor's detector. Parameters ---------- threshold : int The minimum signal that can be detected by the sensor sample_times : list of ints or floats List of the sensor's sample/measurement times
6259907767a9b606de547765
class OMPSerializer(serializers.HyperlinkedModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = models.Book <NEW_LINE> fields = ( 'id', 'slug', 'prefix', 'title', 'subtitle', 'cover', 'submission_date', 'publication_date', 'license', 'pages', 'book_type', 'author', 'description', 'keywords', 's...
This serializer is used only by Ubiquity Press.
6259907732920d7e50bc79c9
class HomeAssistantQueueHandler(logging.handlers.QueueHandler): <NEW_LINE> <INDENT> def handle(self, record: logging.LogRecord) -> Any: <NEW_LINE> <INDENT> return_value = self.filter(record) <NEW_LINE> if return_value: <NEW_LINE> <INDENT> self.emit(record) <NEW_LINE> <DEDENT> return return_value
Process the log in another thread.
625990775fdd1c0f98e5f8ff
class Return(Action): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> def perform(self, token_stream, text): <NEW_LINE> <INDENT> return self.value <NEW_LINE> <DEDENT> def same_as(self, other): <NEW_LINE> <INDENT> return isinstance(other, Return) and self.value =...
Internal Plex action which causes |value| to be returned as the value of the associated token
62599077a05bb46b3848bdeb
class Task(ClassTemplate): <NEW_LINE> <INDENT> pass
dnacsdk interaction with Task API on DNA Center.
62599077167d2b6e312b8252
class ContainedInLocationNegated(Relation): <NEW_LINE> <INDENT> relation_name = 'contained_in_location_negated'
contained_in_location_negated relation.
6259907755399d3f05627e95
class Merge: <NEW_LINE> <INDENT> def __init__(self, bot): <NEW_LINE> <INDENT> self.bot = bot <NEW_LINE> <DEDENT> @commands.group(pass_context=True, invoke_without_command=True) <NEW_LINE> @commands.cooldown(1, 5) <NEW_LINE> async def merge(self, ctx, *urls:str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if urls and ...
Merge avatars
6259907756ac1b37e63039a3
class UserViewSet(BaseViewSet): <NEW_LINE> <INDENT> queryset = User.objects.all().order_by('-date_joined') <NEW_LINE> serializer_class = UserSerializer <NEW_LINE> def current(self, request): <NEW_LINE> <INDENT> user = UserUtils.get_user_from_request(request) <NEW_LINE> self.queryset = User.objects.filter(id=user.id)
API endpoint that allows users to be viewed or edited.
6259907760cbc95b06365a2e
class WitnessUpdateBlock(Block): <NEW_LINE> <INDENT> fields_to_id = ['block_signing_key']
Class to save witness_update operation
62599077cc0a2c111447c792
class Node(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.connections = [] <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.name
Node of a tree. Contains references of other nodes with witch has output connection. Just do A.connections.append(B) for create edge like A->B.
625990774a966d76dd5f086c
class StockProfileModel(models.Model): <NEW_LINE> <INDENT> tickerName = models.CharField(max_length=10, primary_key=True) <NEW_LINE> fullName = models.CharField(max_length=50) <NEW_LINE> overview = models.CharField(max_length=2000) <NEW_LINE> founded = models.CharField(max_length=4) <NEW_LINE> category= models.CharFiel...
Model representing basic information about a stock including abbreviated name and full name
625990772c8b7c6e89bd516b
class UserProfileManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self, email, name, password): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError("Email field is required") <NEW_LINE> <DEDENT> email = self.normalize_email(email) <NEW_LINE> user = self.model(email=email, name=name) <NEW...
Manager for our user model Args: BaseUserManager (UserManager): Contributed by django users
625990773539df3088ecdc19
class EtherCATHandTrajectorySlider(ExtendedSlider): <NEW_LINE> <INDENT> def __init__(self, joint, uiFile, plugin_parent, parent=None): <NEW_LINE> <INDENT> ExtendedSlider.__init__(self, joint, uiFile, plugin_parent, parent) <NEW_LINE> self.initialize_controller() <NEW_LINE> <DEDENT> def initialize_controller(self): <NEW...
Slider for one EtherCAT Hand joint, that uses the trajectory controller interface.
625990779c8ee82313040e48
class TestSubtasks(InstructorTaskCourseTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestSubtasks, self).setUp() <NEW_LINE> self.initialize_course() <NEW_LINE> <DEDENT> def _enroll_students_in_course(self, course_id, num_students): <NEW_LINE> <INDENT> for _ in range(num_students): <NEW_LINE>...
Tests for subtasks.
625990777d847024c075dd5d
class BraintreeConfig(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.public_key = settings.BRAINTREE_PUBLIC_KEY <NEW_LINE> self.private_key = settings.BRAINTREE_PRIVATE_KEY
Rather than trying to recreate the entire Environment, which needs information we don't have, just create an object which contains the parts we need to parse webhooks, namely the public and private keys.
62599077a8370b77170f1d4f
class AutoConfig(Config): <NEW_LINE> <INDENT> USERNAME = '[email protected]' <NEW_LINE> PASSWORD = '123456' <NEW_LINE> USER_ID = '13764904' <NEW_LINE> MEMBER_ID = '380' <NEW_LINE> SHOP_ID = 98204 <NEW_LINE> TERMINAL_ID = 109828 <NEW_LINE> URL = 'http://testwkd.snsshop.net' <NEW_LINE> URL_TERMINAL = 'http://testwkdshopadm...
微客多自动化测试环境配置(自动化测试专用)
62599077be8e80087fbc0a16
class Price03(Benchmark): <NEW_LINE> <INDENT> def __init__(self, dimensions=2): <NEW_LINE> <INDENT> Benchmark.__init__(self, dimensions) <NEW_LINE> self.bounds = list(zip([-50.0] * self.dimensions, [ 50.0] * self.dimensions)) <NEW_LINE> self.custom_bounds = [(0, 2), (0, 2)] <NEW_LINE> self.global_optimum = [1.0, 1.0...
Price 3 test objective function. This class defines the Price 3 global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{Price03}}(\mathbf{x}) = 100(x_2 - x_1^2)^2 + \left[6.4(x_2 - 0.5)^2 - x_1 - 0.6 \right]^2 Here, :math:`n` represents the number of dimensi...
6259907776e4537e8c3f0f01
class cached_property(object): <NEW_LINE> <INDENT> def __init__(self, func): <NEW_LINE> <INDENT> self.__doc__ = getattr(func, '__doc__') <NEW_LINE> self.func = func <NEW_LINE> <DEDENT> def __get__(self, obj, cls): <NEW_LINE> <INDENT> if obj is None: <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> value = obj.__dict...
A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property. This genius snippet is taken form: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76
62599077bf627c535bcb2e50
class Hourglass(nn.Module): <NEW_LINE> <INDENT> def __init__(self, down_seq, up_seq, skip_seq, merge_type="add", return_first_skip=False): <NEW_LINE> <INDENT> super(Hourglass, self).__init__() <NEW_LINE> self.depth = len(down_seq) <NEW_LINE> assert (merge_type in ["cat", "add"]) <NEW_LINE> assert (len(up_seq) == self.d...
A hourglass module. Parameters: ---------- down_seq : nn.Sequential Down modules as sequential. up_seq : nn.Sequential Up modules as sequential. skip_seq : nn.Sequential Skip connection modules as sequential. merge_type : str, default 'add' Type of concatenation of up and skip outputs. return_first_ski...
6259907791f36d47f2231b50
class InvalidShardId(Exception): <NEW_LINE> <INDENT> pass
Raised when an invalid shard ID is passed
62599077091ae356687065bd
class _420chanThreadExtractor(Extractor): <NEW_LINE> <INDENT> category = "420chan" <NEW_LINE> subcategory = "thread" <NEW_LINE> directory_fmt = ("{category}", "{board}", "{thread} {title}") <NEW_LINE> archive_fmt = "{board}_{thread}_{filename}" <NEW_LINE> pattern = r"(?:https?://)?boards\.420chan\.org/([^/?#]+)/thread/...
Extractor for 420chan threads
62599077442bda511e95da19
@attr('shard_1') <NEW_LINE> @ddt.ddt <NEW_LINE> class CourseInstantiationTests(ModuleStoreTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(CourseInstantiationTests, self).setUp() <NEW_LINE> self.factory = RequestFactory() <NEW_LINE> <DEDENT> @ddt.data(*itertools.product(xrange(5), [ModuleStoreE...
Tests around instantiating a course multiple times in the same request.
6259907799fddb7c1ca63a97
class v_bytes(v_prim): <NEW_LINE> <INDENT> _vs_builder = True <NEW_LINE> def __init__(self, size=0, vbytes=None): <NEW_LINE> <INDENT> v_prim.__init__(self) <NEW_LINE> if vbytes == None: <NEW_LINE> <INDENT> vbytes = b'\x00' * size <NEW_LINE> <DEDENT> self._vs_length = len(vbytes) <NEW_LINE> self._vs_value = vbytes <NEW_...
v_bytes is used for fixed width byte fields.
62599077a05bb46b3848bdec
class StyledForm(forms.ModelForm): <NEW_LINE> <INDENT> error_css_class = 'error' <NEW_LINE> required_css_class = 'required'
Base class for all our forms. Has Django automatically style the input fields based on state.
62599077ec188e330fdfa22a
class setMetaConf_result: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, o1=None,): <NEW_LINE> <INDENT> self.o1 = o1 <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtoco...
Attributes: - o1
625990774a966d76dd5f086f
@register_plugin <NEW_LINE> class MLPPredictor(PredictorABC): <NEW_LINE> <INDENT> def __init__(self, data: DatasetSplits, model: torch.nn.Module): <NEW_LINE> <INDENT> super().__init__(vectorizer=data.vectorizer, model=model) <NEW_LINE> <DEDENT> def json_to_data(self, input_json: Dict): <NEW_LINE> <INDENT> return { 'x_i...
Toy example: we want to make predictions on inputs of the form {"inputs": ["hello world", "foo", "bar"]}
625990774a966d76dd5f086e
class TorchImageProcessor: <NEW_LINE> <INDENT> def __init__(self, image_size, is_color, mean, scale, crop_size=0, pad=28, color='BGR', use_cutout=False, use_mirroring=False, use_random_crop=False, use_center_crop=False, use_random_gray=False): <NEW_LINE> <INDENT> self.transf = transforms.ToTensor() <NEW_LINE> <DEDENT> ...
Simple data processors
625990772ae34c7f260aca69
class FastaReader(object): <NEW_LINE> <INDENT> def __init__(self, file, wholefile=False, keep_linebreaks=False): <NEW_LINE> <INDENT> if isinstance(file, str): <NEW_LINE> <INDENT> file = xopen(file, "r") <NEW_LINE> <DEDENT> self.fp = file <NEW_LINE> self.wholefile = wholefile <NEW_LINE> self.keep_linebreaks = keep_lineb...
Reader for FASTA files.
62599077aad79263cf43013c
class SectionHeading(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.contents = list() <NEW_LINE> self.style_name = None <NEW_LINE> self.section_number = None <NEW_LINE> self.title = None <NEW_LINE> self.section_points = [] <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'Sec...
A section object holds both the title of a given section as well as the paragraph numbers of text and table entries within it (until the next section) NOTE: This should not be confused with the docx Section object that is provides page setting and format information
625990777c178a314d78e8ad
class Diff(ApplyManyTransform): <NEW_LINE> <INDENT> def __init__(self, order): <NEW_LINE> <INDENT> self.order = order <NEW_LINE> <DEDENT> def get_name(self): <NEW_LINE> <INDENT> return 'diff-%d' % self.order <NEW_LINE> <DEDENT> def apply_one(self, data, meta=None): <NEW_LINE> <INDENT> return np.diff(data, n=self.order,...
Wrapper for np.diff
6259907771ff763f4b5e9130
class IndexESKibana(Command): <NEW_LINE> <INDENT> min_args = max_args = 1 <NEW_LINE> arguments = "<instance id>" <NEW_LINE> indexer_name = None <NEW_LINE> serializer = "IKibanaIndexSerializable" <NEW_LINE> options = [ ( "no-index", { "type": "yn", "default": False, "help": "set to True if you only want to create views"...
Create indexes and index data monitoring in Kibana. <instance id> identifier of the instance
625990777047854f46340d3e
class MvcTemplateLoader(BaseLoader): <NEW_LINE> <INDENT> is_usable = True <NEW_LINE> __view_paths = None <NEW_LINE> def __init__(self, views_path): <NEW_LINE> <INDENT> self.views_path = views_path <NEW_LINE> if MvcTemplateLoader.__view_paths is None: <NEW_LINE> <INDENT> temp_paths = [] <NEW_LINE> for each_path in os.li...
A custom template loader for the MVCEngine framework.
62599077f9cc0f698b1c5f8e
class SeqReversible(Sequence): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def _seqtools_reversed(self): <NEW_LINE> <INDENT> raise NotImplementedError
Abstract Base Class for a Sequence that provides its own conversion to a sequence with order reversed, overriding the default behavior of the `Reversed` class. A Sequence class should only inherit from SeqReversible if it can be reversed in some way more efficient than making an explicit copy or iterating over indices...
62599077be7bc26dc9252b17
class DummyNode(object): <NEW_LINE> <INDENT> pass
Description Args: arg1: help for arg1
625990774f88993c371f11e3
class Saver(object): <NEW_LINE> <INDENT> def __init__(self, logger: Logger, settings: SettingsNamespace, max_length: int): <NEW_LINE> <INDENT> self.logger = logger <NEW_LINE> self.logger.debug('Creating a saver object') <NEW_LINE> self.settings = settings <NEW_LINE> self.meta_path = constants.MODEL_DIR + self.settings....
Class for saving and loading the RNN model.
625990773346ee7daa338322
class ItemStatus(list, _List["OrderItemStatus"]): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> super().__init__([OrderItemStatus(datum) for datum in data]) <NEW_LINE> self.data = data
Detailed description of items order status.
6259907716aa5153ce401e5f
class TestV1ServiceStatus(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 testV1ServiceStatus(self): <NEW_LINE> <INDENT> pass
V1ServiceStatus unit test stubs
625990772c8b7c6e89bd516e
class Solution: <NEW_LINE> <INDENT> def getNum(self, head): <NEW_LINE> <INDENT> sum = 0 <NEW_LINE> tmp = head <NEW_LINE> while tmp: <NEW_LINE> <INDENT> sum = sum * 10 + tmp.val <NEW_LINE> tmp = tmp.next <NEW_LINE> <DEDENT> return sum <NEW_LINE> <DEDENT> def addLists2(self, l1, l2): <NEW_LINE> <INDENT> num1 = self.getNu...
Given 6->1->7 + 2->9->5. That is, 617 + 295 Return 9->1->2. That is, 912
6259907732920d7e50bc79cd
class Order_Impl(Default, HasSide, HasPrice, HasVolume, Cancellable): <NEW_LINE> <INDENT> def __init__(self, side, price, volume, owner = None, volumeFilled = 0): <NEW_LINE> <INDENT> self._ticks = None <NEW_LINE> HasSide.__init__(self, side) <NEW_LINE> HasVolume.__init__(self, volume, volumeFilled) <NEW_LINE> Cancellab...
Limit order of the given *side*, *price* and *volume*
6259907763b5f9789fe86aea
class CacheEntry(object): <NEW_LINE> <INDENT> __slots__ = [ 'dirty', 'inode', 'blockno', 'last_access', 'size', 'pos', 'fh', 'removed' ] <NEW_LINE> def __init__(self, inode, blockno, filename): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.fh = open(filename, "w+b", 0) <NEW_LINE> self.dirty = False <NEW_LINE> ...
An element in the block cache Attributes: ----------- :dirty: entry has been changed since it was last uploaded. :size: current file size :pos: current position in file
625990775166f23b2e244d5c
class CreateOverridesIfReqdForm(BrowserView): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> navroot = self.context <NEW_LINE> overridesItem = navroot.get(OVERRIDES_FIXED_ID) <NEW_LINE> if overridesItem is None: <NEW_LINE> <INDENT> overridesItem = createContentInContainer( navroot, 'ftw.logo.ManualOverride...
Create IManualOverrides if it does not exist and redirect to it's edit form
625990773317a56b869bf208
class GetEquipmentList(core.TestCase): <NEW_LINE> <INDENT> PREREQUISITES = ["CreateDatabase"] <NEW_LINE> def execute(self): <NEW_LINE> <INDENT> app = self.config.app <NEW_LINE> rv = decoder(app.get('/equipment')) <NEW_LINE> self.info(rv) <NEW_LINE> self.assertTrue(rv[0][1] == 'TestEquipment') <NEW_LINE> self.passed("Pa...
Purpose ------- Get the equipment list resource. Pass Criteria ------------- The resource is fetched without error.
6259907756ac1b37e63039a5
class NomenclateException(Exception): <NEW_LINE> <INDENT> pass
Base Tabulator exception.
62599077cc0a2c111447c794
class ActNorm1d(ActNormNd): <NEW_LINE> <INDENT> def _get_spatial_ndims(self) -> int: <NEW_LINE> <INDENT> return 1
1D convolutional ActNorm flow.
62599077379a373c97d9a9a9
class Employee(DB.Model, Randomizer): <NEW_LINE> <INDENT> id = DB.Column(DB.Integer, primary_key=True) <NEW_LINE> department_id = DB.Column(DB.Integer, DB.ForeignKey( 'department.id', ondelete='CASCADE'), nullable=False) <NEW_LINE> name = DB.Column(DB.String(50), nullable=False) <NEW_LINE> birthdate = DB.Column(DB.Date...
ORM representation for 'employee' table in the database. This class is, basically, a relation schema for 'employee' table. An instance of the class represents a row in the table. Attributes: id: A unique identifier for given entity in DB. name: A string corresponding to employee's name. birthdate: A date ...
625990775fdd1c0f98e5f904
class FlavorsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def resource_setup(cls): <NEW_LINE> <INDENT> super(FlavorsAdminNegativeTestJSON, cls).resource_setup() <NEW_LINE> if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): <NEW_LINE> <INDENT> msg = "OS-FLV...
Tests Flavors API Create and Delete that require admin privileges
625990774e4d562566373d88