code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class RegisterForm(Form): <NEW_LINE> <INDENT> email = StringField(locales.FormConstants.EMAIL, validators=[DataRequired(), Length(min=3, max=25)]) <NEW_LINE> password = PasswordField(locales.FormConstants.PASSWORD, validators=[DataRequired(), Length(min=6, max=40)]) <NEW_LINE> confirm = PasswordField( locales.FormConst... | Register form. | 62598ee5be383301e0251e48 |
class LayerMaskAdjustmentData (Dummy): <NEW_LINE> <INDENT> pass | http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_22582
| 62598ee501c39578d7f11418 |
class DocExistsException(BaseException): <NEW_LINE> <INDENT> pass | Web Document already exists | 62598ee54428ac0f6e656bc2 |
class NSNitroNserrKcdAccountNotExists(NSNitroSslvpnAaaErrors): <NEW_LINE> <INDENT> pass | Nitro error code 2689
The KCD account does not exist | 62598ee516aa5153ce3feb6b |
class InlineMRJobRunner(SimMRJobRunner): <NEW_LINE> <INDENT> alias = 'inline' <NEW_LINE> def __init__(self, mrjob_cls=None, **kwargs): <NEW_LINE> <INDENT> super(InlineMRJobRunner, self).__init__(**kwargs) <NEW_LINE> if not (mrjob_cls is None or issubclass(mrjob_cls, MRJob) or mrjob_cls.__module__ == '__main__'): <NEW_L... | Runs an :py:class:`~mrjob.job.MRJob` in the same process, so it's easy
to attach a debugger.
This is the default way to run jobs (we assume you'll spend some time
debugging your job before you're ready to run it on EMR or Hadoop).
Unlike other runners, ``InlineMRJobRunner``\ 's ``run()`` method
raises the actual exce... | 62598ee5b7558d5895461cb4 |
class ServerHardwareTypeSpec(unittest.TestCase, ModuleContructorTestCase, ValidateEtagTestCase, ErrorHandlingTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.configure_mocks(self, ServerHardwareTypeModule) <NEW_LINE> self.resource = self.mock_ov_client.server_hardware_types <NEW_LINE> ErrorHandl... | ModuleContructorTestCase has common tests for class constructor and main function
ValidateEtagTestCase has common tests for the validate_etag attribute, also provides the mocks used in this test
case.
ErrorHandlingTestCase has common tests for the module error handling. | 62598ee55fdd1c0f98e5c61e |
class cloud_tqdm(tqdm.tqdm): <NEW_LINE> <INDENT> @property <NEW_LINE> def should_post(self): <NEW_LINE> <INDENT> is_past = self.last_post_time is None or (time() - self.last_post_time) > POST_INTERVAL_SEC <NEW_LINE> return not self.loading and is_past <NEW_LINE> <DEDENT> def post_if_need(self, force): ... | Implementation of tqdm that can be displayed on the web. | 62598ee53539df3088eca922 |
class BayesModeler(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.model = Pipeline([ ('vect', CountVectorizer()), ('tfidf', TfidfTransformer()), ('clf', MultinomialNB()) ]) <NEW_LINE> <DEDENT> def fit(self, X, y): <NEW_LINE> <INDENT> self.model.fit(X, y) <NEW_LINE> <DEDENT> def predict_proba(self, ... | Creates the Naive Bayes model used to maximize precision.
Creates a pipeline that applies a count vectorizer, term frequency,
indirect document frequency transformer and then creates
a naive bayes model | 62598ee58e7ae83300ee76ff |
class PartialUpdateMixin(ProcessRelationshipsMixin): <NEW_LINE> <INDENT> def partial_update(self, request, *args, **kwargs): <NEW_LINE> <INDENT> resource = self.get_resource(request, *args, **kwargs) <NEW_LINE> serializer = self.serializer_class( resource, data=request.data["data"], only_fields=request.fields, partial=... | Override base view behavior for partial update endpoints | 62598ee5379a373c97d9766b |
class Recall(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def processData(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def train(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def predict(self, items, k=10): <NEW_LINE> <INDENT> result = dict() <NEW_... | the base class for recall algorithm, other algorithm should inherit this
class and rewrite some methods | 62598ee5d486a94d0ba2a63c |
class TestEmptyDate(common.TransactionCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestEmptyDate, self).setUp() <NEW_LINE> self.Model = self.env['test_read_group.on_date'] <NEW_LINE> <DEDENT> def test_empty_only(self): <NEW_LINE> <INDENT> self.Model.create({'value': 1}) <NEW_LINE> self.Model.cr... | Test what happens when grouping on date fields and getting a "false"
grouping value | 62598ee53d592f4c4edb9565 |
class BarcodeMap(models.Model): <NEW_LINE> <INDENT> barcode = models.CharField(max_length=128,blank=True) <NEW_LINE> shaastra_id = models.ForeignKey(Participant, blank=True, null=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.barcode | Maps barcode to participant | 62598ee567a9b606de54463e |
class HouseDoctorMain(BasePage): <NEW_LINE> <INDENT> def goto_doctor_search(self): <NEW_LINE> <INDENT> with allure.step("房博士页面,点击“搜索”"): <NEW_LINE> <INDENT> self.steps("../../page_object/housedoctor/housedoctormain.yaml") <NEW_LINE> <DEDENT> return self <NEW_LINE> <DEDENT> def goto_doctor_call(self): <NEW_LINE> <INDENT... | 房博士模块的首页 | 62598ee5a79ad16197768689 |
class UserMembershipRestServlet(RestServlet): <NEW_LINE> <INDENT> PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/joined_rooms$") <NEW_LINE> def __init__(self, hs: "HomeServer"): <NEW_LINE> <INDENT> self.is_mine = hs.is_mine <NEW_LINE> self.auth = hs.get_auth() <NEW_LINE> self.store = hs.get_datastore() <NEW_LINE>... | Get room list of an user. | 62598ee5cad5886f8bdc3971 |
class OUNoise: <NEW_LINE> <INDENT> def __init__(self, size, seed, mu=0., theta=0.15, sigma=0.4): <NEW_LINE> <INDENT> self.mu = mu * np.ones(size) <NEW_LINE> self.theta = theta <NEW_LINE> self.sigma = sigma <NEW_LINE> self.seed = random.seed(seed) <NEW_LINE> self.reset() <NEW_LINE> <DEDENT> def reset(self): <NEW_LINE> <... | Ornstein-Uhlenbeck process. | 62598ee54f6381625f1987f4 |
class paludis_flat_list(database): <NEW_LINE> <INDENT> pkgcore_config_type = ConfigHint( {'readonly': 'bool', 'location': 'str', 'label': 'str'}, required=['location'], positional=['location'], typename='cache') <NEW_LINE> def __init__(self, *args, **config): <NEW_LINE> <INDENT> config['auxdbkeys'] = self.auxdbkeys_ord... | (Hopefully) write a paludis specific form of flat_list format cache.
Not very well tested.
Difference from a normal flat_list cache is that mtime is set to ebuild
for normal, for paludis it's max mtime of eclasses/ebuild involved. | 62598ee555399d3f05624ba2 |
class MockPWMPin(MockPin): <NEW_LINE> <INDENT> def __init__(self, factory, number): <NEW_LINE> <INDENT> super(MockPWMPin, self).__init__(factory, number) <NEW_LINE> self._frequency = None <NEW_LINE> <DEDENT> def close(self): <NEW_LINE> <INDENT> self.frequency = None <NEW_LINE> super(MockPWMPin, self).close() <NEW_LINE>... | This derivative of :class:`MockPin` adds PWM support. | 62598ee57047854f4633da46 |
class ThroughputValueType (NonNegativeFloatType): <NEW_LINE> <INDENT> _ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'ThroughputValueType') <NEW_LINE> _XSDLocation = pyxb.utils.utility.Location('MapsPlatformDescriptor.xsd', 176, 2) <NEW_LINE> _Documentation = None | An atomic simple type. | 62598ee59c8ee8231303f490 |
class AgentPodNotReadyException(Exception): <NEW_LINE> <INDENT> pass | Raised when the agent pod is not fully ready according to the K8s API server. | 62598ee5be383301e0251e4a |
class AdvancedMeteringSystems(BSElement): <NEW_LINE> <INDENT> class MeasureName(BSElement): <NEW_LINE> <INDENT> element_type = "xs:string" <NEW_LINE> element_enumerations = [ "Install advanced metering systems", "Clean and/or repair", "Implement training and/or documentation", "Upgrade operating protocols, calibration,... | Advanced metering systems. | 62598ee54428ac0f6e656bc4 |
@dataclass <NEW_LINE> class Audio(Base): <NEW_LINE> <INDENT> file_id: str <NEW_LINE> file_unique_id: str <NEW_LINE> duration: int <NEW_LINE> performer: Optional[str] = None <NEW_LINE> title: Optional[str] = None <NEW_LINE> file_name: Optional[str] = None <NEW_LINE> mime_type: Optional[str] = None <NEW_LINE> file_size: ... | This object represents an audio file to be treated as music by the
Telegram clients. | 62598ee5e5267d203ee69f77 |
class ListPlaylistsByChannelResultSet(ResultSet): <NEW_LINE> <INDENT> def getJSONFromString(self, str): <NEW_LINE> <INDENT> return json.loads(str) <NEW_LINE> <DEDENT> def get_NewAccessToken(self): <NEW_LINE> <INDENT> return self._output.get('NewAccessToken', None) <NEW_LINE> <DEDENT> def get_Response(self): <NEW_LINE> ... | A ResultSet with methods tailored to the values returned by the ListPlaylistsByChannel Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution. | 62598ee566656f66f7d58a52 |
class BotHelp(BotCmdError): <NEW_LINE> <INDENT> pass | Raised when the user asks for help | 62598ee5460517430c430af9 |
class ProjectSheetNeedForm(SpecificQuestionForm): <NEW_LINE> <INDENT> type = forms.ModelChoiceField(queryset=SpecificQuestionType.objects.filter(type__in=['pj-need', 'pj-help'])) | Form to create a project sheet support | 62598ee5d486a94d0ba2a63e |
class SettingsCase(ClientCase): <NEW_LINE> <INDENT> settings = {} <NEW_LINE> @classmethod <NEW_LINE> def setUp(cls): <NEW_LINE> <INDENT> cls._restore = {} <NEW_LINE> for k, v in list(cls.settings.items()): <NEW_LINE> <INDENT> cls._restore[k] = getattr(pdb_settings, k, getattr(settings, k, None)) <NEW_LINE> setattr(pdb_... | Since we read settings from peeringdb_server.settings
we can't use the `settings` fixture from pytest-django
This class instead does something similar for peeringdb_server.settings,
where it will override settings specified and then reset after test case
is finished | 62598ee576e4537e8c3edc2a |
class ShowUsage(show.ShowOne): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + ".ShowUsage") <NEW_LINE> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(ShowUsage, self).get_parser(prog_name) <NEW_LINE> parser.add_argument( "--project", metavar="<project>", default=None, help="Name or ID of pr... | Show resource usage for a single project | 62598ee52ae34c7f260a9759 |
class ThresholdLogisticRegression(LogisticRegression): <NEW_LINE> <INDENT> def __init__(self, penalty='l2', dual=False, tol=1e-4, C=1.0, threshold=0.5, fit_intercept=True, intercept_scaling=1, class_weight=None, random_state=None): <NEW_LINE> <INDENT> super(LogisticRegression, self).__init__( penalty=penalty, dual=dual... | Custom predict that uses a different threshold | 62598ee5d58c6744b42db5ef |
class PostSitemap(Sitemap): <NEW_LINE> <INDENT> changefreq = 'weekly' <NEW_LINE> priority = 0.9 <NEW_LINE> def items(self): <NEW_LINE> <INDENT> return Post.published.all() <NEW_LINE> <DEDENT> def lastmod(self, obj): <NEW_LINE> <INDENT> return obj.updated | Creates a sitemap for Post
Here is some more info for this class | 62598ee52eb69b55b15a06c2 |
class ListUser(lister.Lister): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + '.ListUser') <NEW_LINE> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(ListUser, self).get_parser(prog_name) <NEW_LINE> parser.add_argument( '--project', metavar='<project>', help='Filter users by project (name or... | List users | 62598ee58c0ade5d55dc29bc |
class RadioTranscriptDocSink(BaseDocSink): <NEW_LINE> <INDENT> pass | Unchanged from BaseDocSink but will probably modify to suit radio. | 62598ee5dd821e528d6d75b7 |
class NdArrayResolver(BaseResolver): <NEW_LINE> <INDENT> def __isNumeric(self, arr): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return arr.dtype.kind in 'biufc' <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> def resolve(self, var, attribute): <NEW_LINE> <INDEN... | Class used to resolve from numpy ndarray including some meta data. | 62598ee5aad79263cf42ce7c |
class UnitConversionContextAdapterTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.context = AdaptedDataContext(context=DataContext()) <NEW_LINE> <DEDENT> @performance <NEW_LINE> def test_exec_is_not_slow(self): <NEW_LINE> <INDENT> allowed_slowdown = 2.5 <NEW_LINE> N = 1000 <NE... | Other tests for UnitConversionContextAdapater
| 62598ee5a8370b77170eea56 |
class BasicRessource: <NEW_LINE> <INDENT> X_FILTER_FIELDS = "x-filter-fields" <NEW_LINE> __slots__ = ["current_user", "user_rights"] <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.current_user = None <NEW_LINE> self.user_rights = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def route(self): <NEW_LINE> <INDENT... | A base for all endpoints | 62598ee507f4c71912badac6 |
class EseDbParser(interface.FileObjectParser): <NEW_LINE> <INDENT> _INITIAL_FILE_OFFSET = None <NEW_LINE> NAME = u'esedb' <NEW_LINE> DESCRIPTION = u'Parser for Extensible Storage Engine (ESE) database files.' <NEW_LINE> _plugin_classes = {} <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(EseDbParser, self).__i... | Parses Extensible Storage Engine (ESE) database files (EDB). | 62598ee545492302aabfab1f |
class MarvinCameraException(Exception): <NEW_LINE> <INDENT> def __init__(self,cam_id=None,*args,**kwargs): <NEW_LINE> <INDENT> super(MarvinSerialException,self).__init__(*args,**kwargs) <NEW_LINE> cam_string = str(cam_id) if not marvin.typeCheck(cam_id,None) else "UNKNOWN" <NEW_LINE> error_message = """problem reading ... | Exception meant to be raised when their is a problem reading a frame from
a camera
does NOT raise a SystemExit | 62598ee597e22403b3839562 |
class FewShotDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, filenames, labels, transform): <NEW_LINE> <INDENT> self.filenames = filenames <NEW_LINE> self.labels = labels <NEW_LINE> self.transform = transform <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return len(self.filenames) <NEW_LINE> <DEDE... | A standard PyTorch definition of Dataset which defines the functions __len__ and __getitem__. | 62598ee5925a0f43d25e669f |
class XilinxUploadTool(JinjaTool): <NEW_LINE> <INDENT> def __init__(self, db: Database, log: Callable[[str, LogLevel], None]): <NEW_LINE> <INDENT> super(XilinxUploadTool, self).__init__(db, log) <NEW_LINE> self.bin = BinaryDriver("vivado") <NEW_LINE> self.upload = self.get_db(self.get_namespace("XilinxUploadTool")) <NE... | Xilinx synthesis and implementation tool | 62598ee52ae34c7f260a975a |
class BJ_Dealer(BJ_Hand): <NEW_LINE> <INDENT> def is_hitting(self): <NEW_LINE> <INDENT> return self.total < 17 <NEW_LINE> <DEDENT> def bust(self): <NEW_LINE> <INDENT> print(self.name, "перебрал.") <NEW_LINE> <DEDENT> def flip_first_card(self): <NEW_LINE> <INDENT> first_card = self.cards[0] <NEW_LINE> first_card.flip() | Дилер в игре "Блек-джек". | 62598ee560cbc95b063629af |
class StructureProb(Feature): <NEW_LINE> <INDENT> def __init__(self, structureObject = None, solution = None, label="", args = { 'structure_range' : (0,59), 'acc_region' : [], 'window' : 50, 'mutable_region' : None, 'cds_region' : None, 'keep_aa' : True }): <NEW_LINE> <INDENT> Feature.__init__(self, solution=solution, ... | StructureProb Feature
solution - solution where structure accessibility probability should be computed
label - some label to append to the name of structure file
structure_range - start and end position to calculate structure - a tuple in the form (start, end)
mutable_region - a list with all bases th... | 62598ee5090684286d592a19 |
class GameHighScore(_GameHighScoreBase): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> @staticmethod <NEW_LINE> def from_result(result): <NEW_LINE> <INDENT> if result is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return GameHighScore( position=result.get('position'), user=User.from_result(result.get('use... | This object represents one row of the high scores table for a game.
Attributes:
position (int) :Position in high score table for the game
user (User) :User
score (int) :Score | 62598ee5e64d504609df86f8 |
class BaseUpdateView(ModelFormMixin, ProcessFormView): <NEW_LINE> <INDENT> partial_updates = False <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> self.object = self.get_object() <NEW_LINE> return super(BaseUpdateView, self).get(request, *args, **kwargs) <NEW_LINE> <DEDENT> def post(self, reques... | Base view for updating an existing object.
Using this base class requires subclassing to provide a response mixin. | 62598ee5eab8aa0e5d30a3eb |
class HSVColor (UIColor): <NEW_LINE> <INDENT> h = None <NEW_LINE> s = None <NEW_LINE> v = None <NEW_LINE> def __init__(self, h=None, s=None, v=None, hsv=None, color=None): <NEW_LINE> <INDENT> UIColor.__init__(self) <NEW_LINE> if color is not None: <NEW_LINE> <INDENT> h, s, v = color.get_hsv() <NEW_LINE> <DEDENT> if hsv... | Cylindrical Hue/Saturation/Value representation of a color.
>>> col = HSVColor(0.6, 0.5, 0.4)
>>> col.h = 0.7
>>> col.s = 0.0
>>> col.v = 0.1
>>> col.get_rgb()
(0.1, 0.1, 0.1) | 62598ee53eb6a72ae0388cb5 |
class getInvAndInstantConfirm_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.STRUCT, 'success', (GetInvAndInstantConfirmResponse, GetInvAndInstantConfirmResponse.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> <DEDENT> def read(self, ip... | Attributes:
- success | 62598ee5f7d966606f746663 |
class Downloader(): <NEW_LINE> <INDENT> def __init__(self,folder): <NEW_LINE> <INDENT> self.session = requests.Session() <NEW_LINE> self.download_folder_path = folder <NEW_LINE> <DEDENT> def run(self,url): <NEW_LINE> <INDENT> session = self.session <NEW_LINE> file_name = list(url.keys())[0] <NEW_LINE> file_path = '{fol... | Sequentially downloads. | 62598ee563d6d428bbee0e3f |
class ExternalResource(EntityType): <NEW_LINE> <INDENT> __permissions__ = { "read": ("managers", ERQLExpression("X uploaded_by U"),), "add": ("managers", "users"), "delete": ("managers",), "update": ("managers",), } <NEW_LINE> name = String(required=True, indexed=False) <NEW_LINE> filepath = String(required=True, ... | An entity used to to store a file path.
Attributes
----------
name: String (mandatory)
the parameter name.
filepath: String (mandatory)
the file path.
uploaded_by: SubjectRelation (mandatory)
who has created the item. | 62598ee5e1aae11d1e7cdb78 |
class EmbeddingModel: <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.model_cache = {} <NEW_LINE> if 'USE' in kwargs: <NEW_LINE> <INDENT> self.USE(kwargs['USE']) <NEW_LINE> <DEDENT> <DEDENT> def USE(self, model_path: str=None)-> object : <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if model_p... | create different types of embedding model | 62598ee5b7558d5895461cb8 |
class CommodityPriceHistoryTests(TestCase): <NEW_LINE> <INDENT> def test_str(self): <NEW_LINE> <INDENT> date = timezone.now() <NEW_LINE> commodity = Commodity(name="commodity", price=2.50) <NEW_LINE> test_object = CommodityPriceHistory(commodity=commodity, old_price=100, new_price=200, transaction_date=date) <NEW_LINE>... | Here we'll define the tests that we'll run against
our CommodityPriceHistory model | 62598ee5fff4ab517ebcbe4d |
class TestCategoryListViewAsLogged(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.user_info = create_user()[0] <NEW_LINE> <DEDENT> def tests_empty(self): <NEW_LINE> <INDENT> self.assertTrue(self.client.login(username=self.user_info['username'], password=self.user_info['password'])) <NEW_LINE> ... | Tests ListView for Category. | 62598ee5dd821e528d6d75b8 |
class File(ParamType): <NEW_LINE> <INDENT> name = 'filename' <NEW_LINE> envvar_list_splitter = os.path.pathsep <NEW_LINE> def __init__(self, mode='r', encoding=None, errors='strict', lazy=None, atomic=False): <NEW_LINE> <INDENT> self.mode = mode <NEW_LINE> self.encoding = encoding <NEW_LINE> self.errors = errors <NEW_L... | Declares a parameter to be a file for reading or writing. The file
is automatically closed once the context tears down (after the command
finished working).
Files can be opened for reading or writing. The special value ``-``
indicates stdin or stdout depending on the mode.
By default, the file is opened for reading... | 62598ee55fdd1c0f98e5c622 |
class EarlyStopping(object): <NEW_LINE> <INDENT> def __init__(self, wait=25): <NEW_LINE> <INDENT> self.wait = wait <NEW_LINE> self.best_valid_loss = np.inf <NEW_LINE> self.best_epoch = 0 <NEW_LINE> self.best_weights = None <NEW_LINE> <DEDENT> def __call__(self, nn, train_history): <NEW_LINE> <INDENT>... | Class for early stopping.
If validation error does not reduce even after specified number of epochs
i.e. 'wait', stop training a model and return parameters of learned model
that has the least validation error. | 62598ee5379a373c97d9766e |
class MainAppIndexDashboard(AppIndexDashboard): <NEW_LINE> <INDENT> title = "" <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> AppIndexDashboard.__init__(self, *args, **kwargs) <NEW_LINE> self.children += [ modules.ModelList(self.app_title, self.models), modules.RecentActions( _("Recent Actions"), i... | Custom app index dashboard for backend. | 62598ee563b5f9789fe837d1 |
class test_CityModel(unittest.TestCase): <NEW_LINE> <INDENT> def test_pep8(self): <NEW_LINE> <INDENT> style = pep8.StyleGuide(quiet=True) <NEW_LINE> f = style.check_files(['models/city.py']) <NEW_LINE> self.assertEqual(f.total_errors, 0, "Pep8 Style Error(s) found") <NEW_LINE> <DEDENT> def test_docstringCheck(self): <N... | Defines Test Cases for City Class | 62598ee5d7e4931a7ef3a712 |
class ZIPPackage(Component): <NEW_LINE> <INDENT> implements(PackageInterface) <NEW_LINE> name = "ZIP" <NEW_LINE> def extract(self, package_filename, location, path): <NEW_LINE> <INDENT> zipfile = ZipFile(package_filename, "r") <NEW_LINE> infile = zipfile.open(location) <NEW_LINE> with open(path, "wb") as outfile: <NEW_... | Implementation of the package interface for ZIP package files.
| 62598ee523849d37ff84f729 |
class CustomTableWidgetItem(QTableWidgetItem): <NEW_LINE> <INDENT> def __init__(self, text, sort_key): <NEW_LINE> <INDENT> QTableWidgetItem.__init__(self, text, QTableWidgetItem.UserType) <NEW_LINE> self.sortKey = sort_key <NEW_LINE> <DEDENT> def __lt__(self, other): <NEW_LINE> <INDENT> return self.sortKey < other.sort... | Override __lt__ function for sorting in qt tables by the key | 62598ee56e29344779afeca4 |
class TwoLayerNet(object): <NEW_LINE> <INDENT> def __init__(self, input_dim=3*32*32, hidden_dim=100, num_classes=10, weight_scale=1e-3, reg=0.0): <NEW_LINE> <INDENT> self.params = {} <NEW_LINE> self.reg = reg <NEW_LINE> W1 = np.random.normal(0, weight_scale, [input_dim, hidden_dim]) <NEW_LINE> b1 = np.zeros([1, hidden_... | A two-layer fully-connected neural network with ReLU nonlinearity and
softmax loss that uses a modular layer design. We assume an input dimension
of D, a hidden dimension of H, and perform classification over C classes.
The architecure should be affine - relu - affine - softmax.
Note that this class does not implemen... | 62598ee5cb5e8a47e493b4b3 |
class TestCase(base.BaseTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestCase, self).setUp() <NEW_LINE> token_info = { 'token': { 'project': { 'id': 'fake_project' }, 'user': { 'id': 'fake_user' } } } <NEW_LINE> self.context = magnum_context.RequestContext( auth_token_info=token_info, proje... | Test case base class for all unit tests. | 62598ee510dbd63aa1c6f1e6 |
class Leave(Power): <NEW_LINE> <INDENT> name = meta.CharField(_("Leave Type"),maxlength=50,unique=True) | Types of leave available
| 62598ee5796e427e5384ce0c |
class ExpressRouteServiceProvider(Resource): <NEW_LINE> <INDENT> _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': '... | A ExpressRouteResourceProvider object.
Variables are only populated by the server, and will be ignored when sending a request.
:param id: Resource ID.
:type id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:param location: Resource location.
:type location: str
:para... | 62598ee5cc0a2c1114479677 |
class CreateSemanticDemandTable(pg_tools.PostgresTask): <NEW_LINE> <INDENT> schema = luigi.Parameter() <NEW_LINE> table = luigi.Parameter() <NEW_LINE> sql_file = luigi.Parameter() <NEW_LINE> def requires(self): <NEW_LINE> <INDENT> return [CreateSemanticTable()] <NEW_LINE> <DEDENT> def output(self): <NEW_LINE> <INDENT> ... | runs set of SQL queries that create the semantic demand table
"master" in the schema "semantic_demand"
communication with the DB is done with PostgresTask | 62598ee5a17c0f6771d5a8c8 |
class tm_enable_port_sched_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.I32, 'dev', None, None, ), (2, TType.I32, 'port', None, None, ), (3, TType.I32, 'speed', None, None, ), ) <NEW_LINE> def __init__(self, dev=None, port=None, speed=None,): <NEW_LINE> <INDENT> self.dev = dev <NEW_LINE> self.port = port <... | Attributes:
- dev
- port
- speed | 62598ee555399d3f05624ba6 |
@implementer(IQuickSearchPortlet) <NEW_LINE> class Assignment(base.Assignment): <NEW_LINE> <INDENT> heading = FieldProperty(IQuickSearchPortlet['heading']) <NEW_LINE> heading_filter = FieldProperty(IQuickSearchPortlet['heading_filter']) <NEW_LINE> target_search = None <NEW_LINE> title = _(u'MLS: Listing Quick Search') ... | Quick Search Portlet Assignment. | 62598ee54527f215b58e857b |
class UserCreateDone(generic.TemplateView): <NEW_LINE> <INDENT> template_name = 'register/user_create_done.html' | ユーザー仮登録完了 | 62598ee54f88993c371ef820 |
class UofLFooterPersonalBarViewlet(common.PersonalBarViewlet): <NEW_LINE> <INDENT> index = ViewPageTemplateFile('footer_personaltools.pt') <NEW_LINE> def update(self): <NEW_LINE> <INDENT> super(UofLFooterPersonalBarViewlet, self).update() <NEW_LINE> context = aq_inner(self.context) <NEW_LINE> context_state = getMultiAd... | A custom version of the Personal Bar
| 62598ee53eb6a72ae0388cb7 |
class ErroServicoNaoEncontrado(ErroNaoEncontrado): <NEW_LINE> <INDENT> pass | Lançado quando a consulta de Serviços não for capaz de localizar o
serviço solicitado, resultando em um erro HTTP 404 na consulta. | 62598ee5be383301e0251e4e |
class Observable: <NEW_LINE> <INDENT> def __init__ (self): <NEW_LINE> <INDENT> self.__observers = [ ] <NEW_LINE> <DEDENT> def register (self, observer): <NEW_LINE> <INDENT> assert callable (observer) <NEW_LINE> self.__observers.append (observer) <NEW_LINE> observer () <NEW_LINE> <DEDENT> def notify (self): <NEW_LINE> <... | Derive from this object to be observable. An observable object will
notify each of its observers every time it changes state. | 62598ee5adb09d7d5dc08c3b |
class QuestionObj(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.QuestionTextNo = None <NEW_LINE> self.QuestionTextType = None <NEW_LINE> self.QuestionText = None <NEW_LINE> self.QuestionOptions = None <NEW_LINE> self.QuestionSubquestion = None <NEW_LINE> self.QuestionImageCoords = Non... | 试题识别结构化信息
| 62598ee54c34283577618958 |
class CachingAction(argparse.Action): <NEW_LINE> <INDENT> def __init__(self, option_strings, CACHE=None, LOOKUP_FITNESS=None, LOOKUP_BAD_FITNESS=None, MUTATE_DUPLICATES=None, **kwargs): <NEW_LINE> <INDENT> self.CACHE = CACHE <NEW_LINE> self.LOOKUP_FITNESS = LOOKUP_FITNESS <NEW_LINE> self.LOOKUP_BAD_FITNESS = LOOKUP_BAD... | Class for defining special mutually exclusive options for caching. | 62598ee576e4537e8c3edc2d |
class SendEventNode(Node, ArmLogicTreeNode): <NEW_LINE> <INDENT> bl_idname = 'LNSendEventNode' <NEW_LINE> bl_label = 'Send Event' <NEW_LINE> bl_icon = 'CURVE_PATH' <NEW_LINE> def init(self, context): <NEW_LINE> <INDENT> self.inputs.new('ArmNodeSocketAction', 'In') <NEW_LINE> self.inputs.new('NodeSocketString', 'Event')... | Send event node | 62598ee58da39b475be0181f |
class ptGrassShader: <NEW_LINE> <INDENT> def __init__(self,key): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def getWaveDirection(self,waveNum): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def getWaveDistortion(self,waveNum): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def getWaveSpeed(self,waveNum): <NEW_LINE> <IND... | Plasma Grass Shader class | 62598ee5baa26c4b54d4d944 |
@attr.s <NEW_LINE> class Date(TemporalBase): <NEW_LINE> <INDENT> valid_types = valid_date_types <NEW_LINE> valid_noun = 'datetime.date' <NEW_LINE> introspect_type = 'date' | Conformity field that ensures that the value is a `datetime.date` instance and optionally enforces boundaries
for that `date` with the `gt`, `gte`, `lt`, and `lte` arguments, which must also be `date` instances if specified. | 62598ee5d7e4931a7ef3a713 |
class UnReleaseImageRequest(JDCloudRequest): <NEW_LINE> <INDENT> def __init__(self, parameters, header=None, version="v1"): <NEW_LINE> <INDENT> super(UnReleaseImageRequest, self).__init__( '/regions/{regionId}/images/{imageId}:unrelease', 'POST', header, version) <NEW_LINE> self.parameters = parameters |
撤销社区镜像。
详细操作说明请参考帮助文档:[镜像概述](https://docs.jdcloud.com/cn/virtual-machines/image-overview)
## 接口说明
- 只允许撤销用户的私有镜像。
| 62598ee530bbd722464682ae |
class CartState(Structure): <NEW_LINE> <INDENT> _fields_ = [ ('x', c_double), ('y', c_double), ('z', c_double), ('xd', c_double), ('yd', c_double), ('zd', c_double) ] <NEW_LINE> def get_xyz(self): <NEW_LINE> <INDENT> return self.x,self.y,self.z <NEW_LINE> <DEDENT> def get_uvw(self): <NEW_LINE> <INDENT> return self.xd,s... | ctypes "CartState" Structure for passing cartesian
coords back and forth between python & C | 62598ee5460517430c430afd |
class SubPieMenu(Menu): <NEW_LINE> <INDENT> bl_label = "Subpie Name" <NEW_LINE> def draw(self, context): <NEW_LINE> <INDENT> pass | Docstring. | 62598ee52c8b7c6e89bd1e36 |
class DimensionalError(Exception): <NEW_LINE> <INDENT> pass | TODO: class docstring. | 62598ee58e7ae83300ee7705 |
class Case(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> TestCase.setUp(self) <NEW_LINE> app=services.MyPizzeria() <NEW_LINE> self.sess=app.createContext() <NEW_LINE> services.populate(self.sess) <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.sess.shutdown() <NEW_LINE> <DEDENT> d... | (this failed on 20040322) | 62598ee5379a373c97d97671 |
class MockBundleDir(type(Path())): <NEW_LINE> <INDENT> def __new__(cls, *args, **kwargs): <NEW_LINE> <INDENT> self = super().__new__(cls, *args, **kwargs) <NEW_LINE> self.pip_deps_dir = self / "deps" / "pip" <NEW_LINE> return self | Mocked RequestBundleDir. | 62598ee5d486a94d0ba2a642 |
class RestEncryptContent: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> REST_ENCRYPT_SECRET_KEY = getattr(settings, 'REST_ENCRYPT_SECRET_KEY') <NEW_LINE> <DEDENT> except AttributeError as e: <NEW_LINE> <INDENT> e.args = ('Provide the REST_ENCRYPT_SECRET_KEY in settings with the key generated by generate_key command.',) ... | we can transfer data in the encrypted form using symmetric encryption.
the parties who has the key are able to decrypt the encrypted data. | 62598ee58c0ade5d55dc29be |
class Tk(tkinter.Tk, tixCommand): <NEW_LINE> <INDENT> def __init__(self, screenName=None, baseName=None, className='Tix'): <NEW_LINE> <INDENT> tkinter.Tk.__init__(self, screenName, baseName, className) <NEW_LINE> tixlib = os.environ.get('TIX_LIBRARY') <NEW_LINE> self.tk.eval('global auto_path; lappend auto_path [file d... | Toplevel widget of Tix which represents mostly the main window
of an application. It has an associated Tcl interpreter. | 62598ee5a79ad1619776868f |
class APICredentials: <NEW_LINE> <INDENT> @property <NEW_LINE> def user_id(self): <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> @property <NEW_LINE> def secret(self): <NEW_LINE> <INDENT> return '' | Stores information needed to make an Uplynk API call. | 62598ee5d6c5a102081e07a6 |
class DB_Reason(Base): <NEW_LINE> <INDENT> __tablename__ = 'SPReason' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> date = Column(DateTime(timezone=False), default=func.now()) <NEW_LINE> reason = Column(String(100), nullable=False) <NEW_LINE> description = Column(String(50), nullable=True) <NEW_LINE> def... | class create reason table for Spare Parts | 62598ee5cb5e8a47e493b4b4 |
class IWindowZSettings(zope.interface.Interface): <NEW_LINE> <INDENT> page_width = TextLine( title=_("windowZ_tool_label_page_width", default="Default Page Width"), description=_("windowZ_tool_help_page_width", default=( "Width of the iFrame area. This is the default value for the " "Window content types and may be red... | Default settings for windowZ content objects | 62598ee5656771135c487d0a |
class Train(SparkOperator): <NEW_LINE> <INDENT> OP_NAME = 'train' <NEW_LINE> OP_CATEGORY = 'machine-learning' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(Train, self).__init__() <NEW_LINE> self.op_input_num = 2 <NEW_LINE> self.op_output_num = 1 <NEW_LINE> self.op_status = OperatorStatus.INIT <NEW_LINE> sel... | Train model operator | 62598ee5fbf16365ca792719 |
class DescribeOperationResultRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TaskId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.TaskId = params.get("TaskId") <NEW_LINE> memeber_set = set(params.keys()) <NEW_LINE> for name, value in vars(se... | DescribeOperationResult请求参数结构体
| 62598ee54a966d76dd5ed55a |
class MemcachedError(Exception): <NEW_LINE> <INDENT> def __init__(self, status, msg): <NEW_LINE> <INDENT> supermsg = 'Memcached error #' + repr(status) <NEW_LINE> if msg: <NEW_LINE> <INDENT> supermsg += ": " + msg <NEW_LINE> <DEDENT> Exception.__init__(self, supermsg) <NEW_LINE> self.status = status <NEW_LINE> self.ms... | Error raised when a command fails. | 62598ee57b25080760ed5b10 |
class GitIntegration(object): <NEW_LINE> <INDENT> def __init__(self, repo): <NEW_LINE> <INDENT> head = None <NEW_LINE> try: <NEW_LINE> <INDENT> head = repo.head <NEW_LINE> self._branch_nick = head.name <NEW_LINE> self._commit_id = head.commit.hexsha <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass <N... | Git integration for versiontools | 62598ee5a8ecb0332586f85f |
class EnemyExplosion(pygame.sprite.Sprite): <NEW_LINE> <INDENT> def __init__(self, obj): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.images = [ "assets/images/alien/alien_explod1.png", "assets/images/alien/alien_explod1.png", "assets/images/alien/alien_explod2.png", "assets/images/alien/alien_explod2.png", "... | Explosion sprites of enemy ship | 62598ee526068e7796d4afd2 |
class QLearningAgent(ReinforcementAgent): <NEW_LINE> <INDENT> def __init__(self, **args): <NEW_LINE> <INDENT> ReinforcementAgent.__init__(self, **args) <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> self.QValues = util.Counter() <NEW_LINE> <DEDENT> def getQValue(self, state, action): <NEW_LINE> <INDENT> return self.QVa... | Q-Learning Agent
Functions you should fill in:
- getQValue
- getAction
- getValue
- getPolicy
- update
Instance variables you have access to
- self.epsilon (exploration prob)
- self.alpha (learning rate)
- self.discount (discount rate)
Functions you should use
- self.getLegalActions(state)
whic... | 62598ee5498bea3a75a561ac |
class CustomSlide(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model): <NEW_LINE> <INDENT> slide_callback_name = 'customslide' <NEW_LINE> title = models.CharField(max_length=256, verbose_name=ugettext_lazy('Title')) <NEW_LINE> text = models.TextField(null=True, blank=True, verbose_name=ugettext_lazy('Text')) <N... | Model for Slides, only for the projector. | 62598ee59c8ee8231303f493 |
class TravelPlan(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User) <NEW_LINE> destination = models.CharField(max_length=255) <NEW_LINE> comment = models.CharField(max_length=255) <NEW_LINE> start_date = models.DateField() <NEW_LINE> end_date = models.DateField() <NEW_LINE> created_at = models.DateTimeFi... | Travel Plan model | 62598ee5f548e778e5969c0c |
class Delay(object): <NEW_LINE> <INDENT> def __init__(self, stamp, sender=None): <NEW_LINE> <INDENT> self.stamp = stamp <NEW_LINE> self.sender = sender <NEW_LINE> <DEDENT> def toElement(self, legacy=False): <NEW_LINE> <INDENT> if not self.stamp: <NEW_LINE> <INDENT> raise ValueError("stamp is required") <NEW_LINE> <DEDE... | Delayed Delivery information.
Instances of this class represent delayed delivery information that can be
parsed from and rendered into both XEP-0203 and legacy XEP-0091 formats.
@ivar stamp: The timestamp the stanza was originally sent.
@type stamp: L{datetime.datetime}
@ivar sender: The optional entity that original... | 62598ee5cc0a2c111447967a |
class SimpleVal(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.baseErrorClass = ConfigObjError <NEW_LINE> <DEDENT> def check(self, check, member, missing=False): <NEW_LINE> <INDENT> if missing: <NEW_LINE> <INDENT> raise self.baseErrorClass <NEW_LINE> <DEDENT> return member | A simple validator.
Can be used to check that all members expected are present.
To use it, provide a configspec with all your members in (the value given
will be ignored). Pass an instance of ``SimpleVal`` to the ``validate``
method of your ``ConfigObj``. ``validate`` will return ``True`` if all
members are present, o... | 62598ee5e1aae11d1e7cdb7a |
class UserCustomAdmin(UserAdmin): <NEW_LINE> <INDENT> list_display = ('username', 'is_staff', 'is_client') <NEW_LINE> actions = UserAdmin.actions + ['set_client', 'unset_client'] <NEW_LINE> fieldsets = ( (None, {'fields': ('username', 'password')}), ('Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser',)}... | Customize view email statistics | 62598ee5dd821e528d6d75bc |
class ModuleSingleton(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> time.sleep(0.1) | 模块 | 62598ee5435de62698e9a44d |
class Curtains(UnitNoise): <NEW_LINE> <INDENT> _axes = 2 <NEW_LINE> def fill(self, size: Sequence[int], loc: Sequence[int] = (0, 0, 0)) -> np.ndarray: <NEW_LINE> <INDENT> noise_size = (size[Z], size[X]) <NEW_LINE> noise_loc = (loc[Z], loc[X]) <NEW_LINE> a = super().fill(noise_size, noise_loc) <NEW_LINE> return np.tile(... | Unit noise that creates vertical lines, like curtains. | 62598ee53cc13d1c6d463de5 |
class WDMonolingualText(WDBaseDataType): <NEW_LINE> <INDENT> DTYPE = 'monolingualtext' <NEW_LINE> def __init__(self, value, prop_nr, language='en', is_reference=False, is_qualifier=False, snak_type='value', references=None, qualifiers=None, rank='normal', check_qualifier_equality=True): <NEW_LINE> <INDENT> self.languag... | Implements the Wikidata data type for Monolingual Text strings | 62598ee599cbb53fe682f528 |
class PyArray(object): <NEW_LINE> <INDENT> def __init__(self, data_type, init_data=None): <NEW_LINE> <INDENT> self._type = data_type <NEW_LINE> if init_data is None: <NEW_LINE> <INDENT> self._init_data = [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._init_data = init_data <NEW_LINE> <DEDENT> if not isinstance(s... | 这是一个数组 | 62598ee591f36d47f22301df |
class Singleton(type): <NEW_LINE> <INDENT> _lock = Lock() <NEW_LINE> _instances = {} <NEW_LINE> def __call__(cls, *args, **kwargs): <NEW_LINE> <INDENT> with Singleton._lock: <NEW_LINE> <INDENT> if cls not in Singleton._instances: <NEW_LINE> <INDENT> Singleton._instances[cls] = super(Singleton, cls).__call__(*args, **kw... | Metaclass for singletons.
This metaclass creates thread-safe singletons. | 62598ee501c39578d7f11421 |
class _SeqId(): <NEW_LINE> <INDENT> def __init__(self, ident, seq): <NEW_LINE> <INDENT> self.id = ident <NEW_LINE> self.seq = seq <NEW_LINE> self.original_length = len(seq) <NEW_LINE> self.distance = None | Sets parameters of a new sequence object | 62598ee5cb5e8a47e493b4b5 |
class Profile(UserMixin, PKMixin): <NEW_LINE> <INDENT> __tablename__ = 'profiles' <NEW_LINE> username = db.Column(db.String(64), unique=True, index=True) <NEW_LINE> email = db.Column(db.String(64), unique=True, index=True) <NEW_LINE> passwd = db.Column(db.String(128)) <NEW_LINE> avatar = Column(db.String(256), nullable... | Users' model. | 62598ee5be8e80087fbbd6c6 |
@route("/(?P<city>\w*)/borough/detail/sellFinishCityareaDistribution") <NEW_LINE> class SellWeekChangeCnt(BaseController): <NEW_LINE> <INDENT> def initialize(self): <NEW_LINE> <INDENT> self.service = MiniProgramService() <NEW_LINE> <DEDENT> @catch() <NEW_LINE> def get(self, *args, **kwargs): <NEW_LINE> <INDENT> city = ... | desc: [MP接口] 二手房城市成交城区房源分布 | 62598ee5925a0f43d25e66a5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.