code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Event_Quit(BaseEvent): <NEW_LINE> <INDENT> def __init__ (self): <NEW_LINE> <INDENT> self.name = "Quit event" <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.name | Quit event. | 62598f6e8e05c05ec3f6ea33 |
class FirewallPolicyRuleApplicationProtocol(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'port': {'maximum': 64000, 'minimum': 0}, } <NEW_LINE> _attribute_map = { 'protocol_type': {'key': 'protocolType', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, } <NEW_LINE> def __init__( self, **kwarg... | Properties of the application rule protocol.
:param protocol_type: Protocol type. Possible values include: "Http", "Https".
:type protocol_type: str or
~azure.mgmt.network.v2021_02_01.models.FirewallPolicyRuleApplicationProtocolType
:param port: Port number for the protocol, cannot be greater than 64000.
:type port: ... | 62598f6e91af0d3eaad395e7 |
class NoneWeights(Weights): <NEW_LINE> <INDENT> def get_weights(self, window_size): <NEW_LINE> <INDENT> weights = [1 for _ in range(window_size)] <NEW_LINE> return weights | None-weights (all ones) for rolling window.
:example:
>>> from timeseries.filter.weights import NoneWeights
>>> NoneWeights().get_weights(5)
[1, 1, 1, 1, 1] | 62598f6ed10714528d69d6a9 |
class ResponsableCreate(CreateView): <NEW_LINE> <INDENT> model = Responsable <NEW_LINE> form_class = ResponsableCreateForm <NEW_LINE> template_name = 'eia_app/create_form.html' <NEW_LINE> success_url = reverse_lazy('consultor-crud:lista-responsables') <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT>... | Crear una Responsable | 62598f6e38b623060ffa8878 |
class Accuracy(TensorboardMean): <NEW_LINE> <INDENT> def __call__(self, output): <NEW_LINE> <INDENT> _, y_pred, y_true, = output <NEW_LINE> if len(y_true.shape) > 1: <NEW_LINE> <INDENT> y_pred = y_pred.reshape(y_true.shape[0], -1, y_true.shape[1]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> indices = (y_true // self.... | Calculate mean accuracy of neural network predictions across all tasks.
For MultiOutput (e.g. mix or concatenation) output of the final layer
has to be reshaped from `(batch, task * classes)` into `(batch, task, labels)`
and it's done automatically in this function. | 62598f6e4d74a7450cd58ac7 |
class NumberSpiral(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.side_length = 3 <NEW_LINE> self._tr = 7 <NEW_LINE> self._tr_length = 2 <NEW_LINE> self._bl = 3 <NEW_LINE> self._bl_length = 1 <NEW_LINE> self._tl = 5 <NEW_LINE> self._tl_length = 1 <NEW_LINE> self._br = 9 <NEW_LINE> self._br_length =... | Represents the diagonals of a number spiral, which goes clockwise
starting from the bottom. | 62598f6e7b25080760ed6c79 |
class MailServer(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> from jupiter.utils import read_url, CONF_FILE <NEW_LINE> self.__mail_host = "smtp.163.com" <NEW_LINE> self.__mail_user = "friederich" <NEW_LINE> self.__mail_pw = "monster1983" <NEW_LINE> self.sender = "Friederich River<friederich@163.... | A robot who send mails in templates.
version 2.0 | 62598f6e1d351010ab8f331d |
class Resource(Model): <NEW_LINE> <INDENT> _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {... | Common resource representation.
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
:param tags:... | 62598f6ea4f1c619b294ddd4 |
class TransactionExportView(LoginRequiredMixin, generic.FormView): <NEW_LINE> <INDENT> template_name = 'account_keeping/export.html' <NEW_LINE> form_class = forms.ExportForm <NEW_LINE> def get_form_kwargs(self): <NEW_LINE> <INDENT> kwargs = super(TransactionExportView, self).get_form_kwargs() <NEW_LINE> kwargs['initial... | Creates a csv, which includes a specific set of transactions. | 62598f6eff9c53063f519e35 |
class BoardAdminApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> self.admin = create_user(is_admin=True) <NEW_LINE> self.client.force_authenticate(user=self.admin) <NEW_LINE> <DEDENT> def test_create_board_successful(self): <NEW_LINE> <INDENT> payload = c... | Test privately board API with admin user | 62598f6e7c178a314d78cc81 |
class InitTest(TestCase): <NEW_LINE> <INDENT> @patch('bundlewrap.group.validate_name', return_value=False) <NEW_LINE> def test_bad_bundle_name(self, *args): <NEW_LINE> <INDENT> with self.assertRaises(RepositoryError): <NEW_LINE> <INDENT> Group("name", {}) <NEW_LINE> <DEDENT> <DEDENT> def test_bundles(self): <NEW_LINE> ... | Tests initalization of bundlewrap.group.Group. | 62598f6e711fe17d825dfec8 |
class CreatePluginConfig(Config): <NEW_LINE> <INDENT> def __init__(self, name, destination, template): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.destination = destination <NEW_LINE> self.template = template <NEW_LINE> <DEDENT> @property <NEW_LINE> def resourcename(self): <NEW_LINE> <INDENT> if self.template ... | This class represents a container of variables
that are used to create a new plugin | 62598f6e4d74a7450cd58ac8 |
class Solution: <NEW_LINE> <INDENT> @timeit <NEW_LINE> def findCircleNum(self, M: List[List[int]]) -> int: <NEW_LINE> <INDENT> n = len(M) <NEW_LINE> arr = [i for i in range(n)] <NEW_LINE> def find(p): <NEW_LINE> <INDENT> if p == arr[p]: <NEW_LINE> <INDENT> return p <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> arr[p] =... | [547. 朋友圈](https://leetcode-cn.com/problems/friend-circles/) | 62598f6e711fe17d825dfec9 |
class XMLFeedSpider(InitSpider): <NEW_LINE> <INDENT> iterator = 'iternodes' <NEW_LINE> itertag = 'item' <NEW_LINE> namespaces = () <NEW_LINE> def process_results(self, response, results): <NEW_LINE> <INDENT> return results <NEW_LINE> <DEDENT> def adapt_response(self, response): <NEW_LINE> <INDENT> return response <NEW_... | This class intends to be the base class for spiders that scrape
from XML feeds.
You can choose whether to parse the file using the 'iternodes' iterator, an
'xml' selector, or an 'html' selector. In most cases, it's convenient to
use iternodes, since it's a faster and cleaner. | 62598f6ed6c5a102081e1924 |
class DatabaseAccountCreateUpdateParameters(Resource): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, 'locations': {'required': True}, 'database_account_offer_type': {'required': True, 'constant': True}, } <NEW_LINE> ... | Parameters to create and update Cosmos DB database accounts.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: The unique resource identifier of the database account.
:vartype id: str
:ivar name: The name of the database account.
:vartype name: str
:ivar type: The type ... | 62598f6e8c3a8732951f5d2e |
class PostOwnStatus(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self,request,view,obj): <NEW_LINE> <INDENT> if request.method in permissions.SAFE_METHODS: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return obj.user_profile.id == request.user.id | Allow users to update their own status. | 62598f6e73bcbd0ca4bc9a36 |
class Outbox(Feed): <NEW_LINE> <INDENT> _ENDPOINT = "{proto}://{server}/api/user/{username}/feed" <NEW_LINE> def __init__(self, parent, endpoint=None): <NEW_LINE> <INDENT> self._parent = parent <NEW_LINE> self._pump = self._parent._pump <NEW_LINE> if endpoint is not None: <NEW_LINE> <INDENT> self._ENDPOINT = endpoint <... | Person's outbox | 62598f6e0383005118f6cee1 |
class AggregateAlgoWrapper(object): <NEW_LINE> <INDENT> _DEFAULT_WORKSPACE_CLASS = AggregateAlgoWorkspace <NEW_LINE> def __init__(self, interface, workspace=None): <NEW_LINE> <INDENT> assert isinstance(interface, AggregateAlgo) <NEW_LINE> self._workspace = workspace or self._DEFAULT_WORKSPACE_CLASS() <NEW_LINE> self._i... | Aggregate algo wrapper to execute an aggregate algo instance on the platform. | 62598f6e9b70327d1c57e58c |
class HDD(Storage): <NEW_LINE> <INDENT> def __init__( self, name, manufacturer, total, allocated, capacity_gb, size, rpm ): <NEW_LINE> <INDENT> super().__init__(name, manufacturer, total, allocated, capacity_gb) <NEW_LINE> allowed_sizes = ['2.5"', '3.5"'] <NEW_LINE> if size not in allowed_sizes: <NEW_LINE> <INDENT> rai... | Class used for HDD type resources | 62598f6ed53ae8145f917c77 |
class IndexView(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> all_blog = Blog.objects.all().order_by('-id') <NEW_LINE> count_nums = Counts.objects.get(id=1) <NEW_LINE> blog_nums = count_nums.blog_nums <NEW_LINE> cate_nums = count_nums.category_nums <NEW_LINE> tag_nums = count_nums.tag_nums <NEW... | 首页 | 62598f6e76d4e153a661c3f4 |
class BinHierarchyDesignSession(abc_resource_sessions.BinHierarchyDesignSession, osid_sessions.OsidSession): <NEW_LINE> <INDENT> def __init__(self, proxy=None, runtime=None, **kwargs): <NEW_LINE> <INDENT> OsidSession.__init__(self) <NEW_LINE> OsidSession._init_proxy_and_runtime(proxy=proxy, runtime=runtime) <NEW_LINE> ... | This session defines methods for managing a hierarchy of ``Bin`` objects.
Each node in the hierarchy is a unique ``Bin``. | 62598f6e8a349b6b43685a21 |
class User(Model): <NEW_LINE> <INDENT> id = IntegerField('id') <NEW_LINE> name = StringField('username') <NEW_LINE> email = StringField('email') <NEW_LINE> password = StringField('password') <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> print('aaa') <NEW_LINE> <DEDEN... | 子类可以隐式的继承父类的metaclass
类名User 对应 name
父类中的 dict 作为 基类
这些键值对会作为metaclass魔术方法的attrs参数传过去 | 62598f6e6aa9bd52df0d46b3 |
class ValidatedModelSerializer(ModelSerializer): <NEW_LINE> <INDENT> def validate(self, data): <NEW_LINE> <INDENT> attrs = data.copy() <NEW_LINE> attrs.pop('custom_fields', None) <NEW_LINE> if self.instance is None: <NEW_LINE> <INDENT> instance = self.Meta.model(**attrs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> in... | Extends the built-in ModelSerializer to enforce calling clean() on the associated model during validation. | 62598f6e30c21e258be97fe2 |
class UserProfile(AbstractBaseUser, PermissionsMixin): <NEW_LINE> <INDENT> email = models.EmailField(max_length=255, unique=True) <NEW_LINE> name = models.CharField(max_length=25) <NEW_LINE> is_active = models.BooleanField(default=True) <NEW_LINE> is_staff = models.BooleanField(default=False) <NEW_LINE> objects = UserP... | Database model for user in the system | 62598f6e0383005118f6cee2 |
class SlLetterPersonSensation(SlGeneric): <NEW_LINE> <INDENT> pass | Select List table: letter person - sensation
Inherits the standard SlGeneric model | 62598f6ed164cc6175820755 |
class PermissiveParser(argparse.ArgumentParser): <NEW_LINE> <INDENT> _names = None <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self._names = {} <NEW_LINE> kwargs['add_help'] = False <NEW_LINE> kwargs['description'] = argparse.SUPPRESS <NEW_LINE> kwargs['usage'] = argparse.SUPPRESS <NEW_LINE> sup... | An ArgumentParser that handles errors without exiting.
An argparse.ArgumentParser that doesn't sys.exit(2) when it
gets the wrong number of arguments. Gives us better control
over exception handling. | 62598f6ed99f1b3c44d04e95 |
class Consume(base.Frame): <NEW_LINE> <INDENT> __annotations__: typing.Dict[str, object] = { 'ticket': int, 'queue': str, 'consumer_tag': str, 'no_local': bool, 'no_ack': bool, 'exclusive': bool, 'nowait': bool, 'arguments': common.Arguments } <NEW_LINE> __slots__: typing.List[str] = [ 'ticket', 'queue', 'consumer_tag'... | Start a queue consumer
This method asks the server to start a "consumer", which is a transient
request for messages from a specific queue. Consumers last as long as
the channel they were declared on, or until the client cancels them.
:param ticket: Deprecated, must be ``0``
- Default: ``0``
:param queue: Specifie... | 62598f6e4d74a7450cd58ac9 |
class ContainerFullException(Exception): <NEW_LINE> <INDENT> pass | raise if the Container is full | 62598f6e925a0f43d25e781c |
class DysonAccount: <NEW_LINE> <INDENT> _HOST = DYSON_API_HOST <NEW_LINE> def __init__( self, auth_info: Optional[dict] = None, ): <NEW_LINE> <INDENT> self._auth_info = auth_info <NEW_LINE> <DEDENT> @property <NEW_LINE> def auth_info(self) -> Optional[dict]: <NEW_LINE> <INDENT> return self._auth_info <NEW_LINE> <DEDENT... | Dyson account. | 62598f6e167d2b6e312b675e |
class TexEnv(TexExpr): <NEW_LINE> <INDENT> _begin = None <NEW_LINE> _end = None <NEW_LINE> def __init__(self, name, begin, end, contents=(), args=(), preserve_whitespace=False, position=-1): <NEW_LINE> <INDENT> super().__init__(name, contents, args, preserve_whitespace, position) <NEW_LINE> self._begin = begin <NEW_LIN... | Abstraction for a LaTeX command, with starting and ending markers.
Contains three attributes:
1. a human-readable environment name,
2. the environment delimiters
3. the environment's contents.
>>> t = TexEnv('displaymath', r'\[', r'\]',
... ['\\mathcal{M} \\circ \\mathcal{A}'])
>>> t
TexEnv('displaymath', ['\\mat... | 62598f6e21bff66bcd722441 |
class ListRegKeyValues(BaseSessionCommand): <NEW_LINE> <INDENT> def __init__(self, regkeypath: str, return_json=False): <NEW_LINE> <INDENT> super().__init__(description=f"List Registry Keys and Values @ {regkeypath}") <NEW_LINE> self.regkeypath = regkeypath <NEW_LINE> self.return_json = return_json <NEW_LINE> <DEDENT> ... | List all registry values from the specified registry key. | 62598f6eff9c53063f519e39 |
class AllocateServer: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.company_list = get_data.get_company_list() <NEW_LINE> self.server_list = get_data.get_server_list() <NEW_LINE> self.server_threshold = get_data.get_server_threshold() <NEW_LINE> self.retry_queue = [] <NEW_LINE> <DEDENT> def retry_fai... | Class to allocate the servers efficiently to
the request as per the assigned company. | 62598f6e1f5feb6acb162419 |
class ExperimentD(BlobExperiment): <NEW_LINE> <INDENT> r <NEW_LINE> def __init__(self, modes=1, dimensions=2, n_training=200, n_test=2000): <NEW_LINE> <INDENT> self.dimensions = dimensions <NEW_LINE> self.modes = modes <NEW_LINE> mu_s = [] <NEW_LINE> sigma_s = [] <NEW_LINE> for i in range(modes): <NEW_LINE> <INDENT> si... | Random M Modal ND | 62598f6e56b00c62f0fb2098 |
class FBPropertyListAnimationNode (object): <NEW_LINE> <INDENT> def FindByLabel(self,pNodeLabel): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> pass | List of animation nodes.b>List: AudioClip.
| 62598f6ec432627299fa27b7 |
class LoggedException(Exception): <NEW_LINE> <INDENT> def __init__(self, msg, logger=None): <NEW_LINE> <INDENT> if logger: <NEW_LINE> <INDENT> logger.critical(msg) <NEW_LINE> <DEDENT> super(LoggedException, self).__init__(msg) | Logs an exception message as a critical event | 62598f6e5166f23b2e242bbd |
class CensusCounty(): <NEW_LINE> <INDENT> def __init__(self, d=None): <NEW_LINE> <INDENT> self.name = "" <NEW_LINE> self.county_code = "" <NEW_LINE> self.lat = decimal.Decimal(0) <NEW_LINE> self.lon = decimal.Decimal(0) <NEW_LINE> if d is not None: <NEW_LINE> <INDENT> self.name = d["name"] <NEW_LINE> self.county_code =... | A US County or County Equivalent | 62598f6e30c21e258be97fe5 |
class GoogleCloudStorageDownloadOperator(BaseOperator): <NEW_LINE> <INDENT> template_fields = ('bucket','object','filename',) <NEW_LINE> template_ext = ('.sql',) <NEW_LINE> ui_color = '#f0eee4' <NEW_LINE> @apply_defaults <NEW_LINE> def __init__( self, bucket, object, filename, google_cloud_storage_conn_id='google_cloud... | Downloads a file from Google Cloud Storage. | 62598f6e711fe17d825dfecc |
class ServiceState(basestring): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_api_name(): <NEW_LINE> <INDENT> return "service-state" | down|up
Possible values:
<ul>
<li> "down" ,
<li> "up"
</ul> | 62598f6e38b623060ffa887e |
class CustomUserManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self, username, password, **extra_fields): <NEW_LINE> <INDENT> if not username: <NEW_LINE> <INDENT> raise ValueError(_('The Username must be set')) <NEW_LINE> <DEDENT> user = self.model(username=username, **extra_fields) <NEW_LINE> user.set_p... | Custom user model manager where login is the unique identifiers
for authentication instead of usernames. | 62598f6ed99f1b3c44d04e97 |
class GrafanaManager(object): <NEW_LINE> <INDENT> def __init__(self, module, url, url_username, url_password, token): <NEW_LINE> <INDENT> self.module = module <NEW_LINE> self.url = url <NEW_LINE> self.headers = {"Content-Type": "application/json", "Accept": "application/json"} <NEW_LINE> if url_username and url_passwor... | Manage communication with grafana HTTP API | 62598f6ecad5886f8bdc4b02 |
class TestDanglIdentityApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = avacloud_client_python.api.dangl_identity_api.DanglIdentityApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_dangl_identity_login_and_return_token(self): <... | DanglIdentityApi unit test stubs | 62598f6e6e29344779affe3f |
class Transport: <NEW_LINE> <INDENT> def __init__(self, handler): <NEW_LINE> <INDENT> raise NotImplementedError("Transport.init should have been implemented by transport module") <NEW_LINE> <DEDENT> def open(self, staged=False): <NEW_LINE> <INDENT> raise NotImplementedError("Transport.open should have been implemented ... | Transport: abstract way for communication between agent and handler | 62598f6ebe8e80087fbbe841 |
class CommDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, img_items, transform=None, relabel=True): <NEW_LINE> <INDENT> self.img_items = img_items <NEW_LINE> self.transform = transform <NEW_LINE> self.relabel = relabel <NEW_LINE> pid_set = set() <NEW_LINE> cam_set = set() <NEW_LINE> for i in img_items: <NEW_LI... | Image Person ReID Dataset | 62598f6eec188e330fdf8084 |
class CommandWithPositionalParameters(CommandWithParameters): <NEW_LINE> <INDENT> def get_attribute_names(self, attr_type=None): <NEW_LINE> <INDENT> positional = {} <NEW_LINE> non_positional = [] <NEW_LINE> for name in sorted(list(self.__dict__)): <NEW_LINE> <INDENT> attr = getattr(self, name) <NEW_LINE> if isinstance(... | Command that uses positional parameters.
Used to support positional parameters for dmg and daos. | 62598f6e6fece00bbaccb16e |
class RegistrationProfile(models.Model): <NEW_LINE> <INDENT> ACTIVATED = u"ALREADY_ACTIVATED" <NEW_LINE> user = models.ForeignKey(User, unique=True, verbose_name=_('user')) <NEW_LINE> activation_key = models.CharField(_('activation key'), max_length=40) <NEW_LINE> objects = RegistrationManager() <NEW_LINE> class Meta: ... | A simple profile which stores an activation key for use during
user account registration.
Generally, you will not want to interact directly with instances
of this model; the provided manager includes methods
for creating and activating new accounts, as well as for cleaning
out accounts which have never been activated.... | 62598f6e6aa9bd52df0d46b7 |
class equalProp(SchemaProperty): <NEW_LINE> <INDENT> _prop_schema = 'equal' <NEW_LINE> _expected_schema = 'QualitativeValue' <NEW_LINE> _enum = False <NEW_LINE> _format_as = "TextField" | SchemaField for equal
Usage: Include in SchemaObject SchemaFields as your_django_field = equalProp()
schema.org description:This ordering relation for qualitative values indicates that the subject is equal to the object.
prop_schema returns just the property without url#
format_as is used by app templatetags based u... | 62598f6eb57a9660fecd1271 |
class session_user(AnsiFunction): <NEW_LINE> <INDENT> type = sqltypes.String <NEW_LINE> inherit_cache = True | The SESSION_USER() SQL function. | 62598f6e30c21e258be97fe6 |
class FileManifest(Manifest): <NEW_LINE> <INDENT> id = 'file' <NEW_LINE> @classmethod <NEW_LINE> def make(cls, env, filename=None): <NEW_LINE> <INDENT> if not filename: <NEW_LINE> <INDENT> filename = '.webassets-manifest' <NEW_LINE> <DEDENT> return cls(os.path.join(env.directory, filename)) <NEW_LINE> <DEDENT> def __in... | Stores version data in a single file.
Uses Python's pickle module to stores a dict data structure. You should
only use this when the manifest is read-only in production, since it is
not multi-process safe. If you use ``auto_build`` in production, use
``CacheManifest`` instead.
By default, the file is named ".webasset... | 62598f6e7b25080760ed6c80 |
class GenericMap(Pyramid, XYZtiling): <NEW_LINE> <INDENT> profile = 'generic' <NEW_LINE> defaul_ext = '.generic' <NEW_LINE> def __init__(self, src=None, dest=None, options=None): <NEW_LINE> <INDENT> options = LooseDict(options) <NEW_LINE> self.srs = txt2proj4(options.proj4def or options.tiles_srs) <NEW_LINE> assert sel... | full profile options are to be specified | 62598f6e15baa7234946176e |
class IngredientViewSet(BaseRecipeAttributesViewSet): <NEW_LINE> <INDENT> queryset = Ingredient.objects.all() <NEW_LINE> serializer_class = serializers.IngredientSerializer | Manage ingredients in the database | 62598f6e9b70327d1c57e592 |
class DecoderSimpleNBN(DecoderBase): <NEW_LINE> <INDENT> def _init(self, in_channels, middle_channels, out_channels): <NEW_LINE> <INDENT> return nn.Sequential( ConvRelu(in_channels, middle_channels, kernel_size=3, padding=1), UpsamplingBilinear(), nn.Conv2d(middle_channels, out_channels, kernel_size=3, padding=1), nn.R... | as dsb2018_topcoders
from https://github.com/selimsef/dsb2018_topcoders/blob/master/selim/models/unets.py#L76 | 62598f6e76d4e153a661c3f7 |
class CMW(BaseAlgo): <NEW_LINE> <INDENT> def __init__(self, global_hyperparams, weights): <NEW_LINE> <INDENT> BaseAlgo.__init__(self, global_hyperparams) <NEW_LINE> self.algo_type='BA' <NEW_LINE> self.weights=weights <NEW_LINE> self.name='Core Manual Weighting' <NEW_LINE> <DEDENT> def predict(self, X_test, pred_index=N... | Core Manual Weighting: This algo used as a core algo just manually fixes the weights of the prediction | 62598f6eb57a9660fecd1273 |
class VideoType (pyxb.binding.datatypes.string, pyxb.binding.basis.enumeration_mixin): <NEW_LINE> <INDENT> _ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'VideoType') <NEW_LINE> _XSDLocation = pyxb.utils.utility.Location('http://ddex.net/xml/20120719/ddex.xsd', 5824, 3) <NEW_LINE> _Documentation = 'A ddex:Type ... | A ddex:Type of ddex:Video. | 62598f6e6aa9bd52df0d46b9 |
class PharmaconerEvaluation(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.evaluations = [] <NEW_LINE> <DEDENT> def add_eval(self, e, label=""): <NEW_LINE> <INDENT> e.sys_id = "SYSTEM: " + e.sys_id <NEW_LINE> e.label = label <NEW_LINE> self.evaluations.append(e) <NEW_LINE> <DEDENT> def print_... | Base class for running the evaluations. | 62598f6efb3f5b602db47da3 |
class pid(object): <NEW_LINE> <INDENT> def __init__(self, p, i_t, d_t, loss=-10.): <NEW_LINE> <INDENT> if p < 0.0 or i_t < 0.0 or d_t < 0.0: <NEW_LINE> <INDENT> raise ValueError("p, i, and d must be positive") <NEW_LINE> <DEDENT> if loss >=0: <NEW_LINE> <INDENT> raise ValueError("loss must be negative") <NEW_LINE> <DED... | A very simple PID class. | 62598f6e50485f2cf55da755 |
class QianlongwangSpiderMiddleware(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def from_crawler(cls, crawler): <NEW_LINE> <INDENT> s = cls() <NEW_LINE> crawler.signals.connect(s.spider_opened, signal=signals.spider_opened) <NEW_LINE> crawler.signals.connect(s.item_scraped, signal=signals.item_scraped) <NEW_LIN... | 从网上找到的其他人的中间键 | 62598f6e4d74a7450cd58acc |
class BrotabExtension(Extension): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(BrotabExtension, self).__init__() <NEW_LINE> self.logger.info("Initializing Brotab Extension") <NEW_LINE> self.brotab_client = BrotabClient() <NEW_LINE> self.mode = "activator" <NEW_LINE> self.subscribe(KeywordQueryEvent... | Main Extension Class | 62598f6e6e29344779affe44 |
class ForkedSingleTask(ForkedTaskMixin, SingleTask): <NEW_LINE> <INDENT> pass | Single Task that executes in its own process. | 62598f6ed18da76e235b6d29 |
class Enroler(flow.WellKnownFlow): <NEW_LINE> <INDENT> well_known_session_id = rdfvalue.SessionID("aff4:/flows/CA:Enrol") <NEW_LINE> def ProcessMessage(self, message): <NEW_LINE> <INDENT> cert = rdfvalue.Certificate(message.args) <NEW_LINE> queue = self.well_known_session_id.Queue() <NEW_LINE> client_id = message.sourc... | Manage enrolment requests. | 62598f6eec188e330fdf8088 |
class MLField(fields.Field): <NEW_LINE> <INDENT> identity_type: type <NEW_LINE> def _deserialize(self, value, attr, data, **kwargs): <NEW_LINE> <INDENT> if isinstance(value, self.identity_type): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> return super()._deserialize(value, attr, data, **kwargs) | Subclassing of Marshmallow field for everything we want to extend in MLSchema | 62598f6e6fece00bbaccb172 |
class SoftLabeledImagenetDataset(ImagenetDataset): <NEW_LINE> <INDENT> def __init__(self, resolution, seed): <NEW_LINE> <INDENT> super(SoftLabeledImagenetDataset, self).__init__( resolution=resolution, seed=seed) <NEW_LINE> self._name = "soft_labeled_" + self._name <NEW_LINE> <DEDENT> def _replace_label(self, feature_d... | ImageNet2012 dataset with soft labels. | 62598f6e30c21e258be97fe9 |
class BaiduImporter(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.typeDict = {} <NEW_LINE> self.typeIdx = {} <NEW_LINE> <DEDENT> def loadTypeList(self, filename): <NEW_LINE> <INDENT> f = open(filename) <NEW_LINE> for line in f: <NEW_LINE> <INDENT> lineArr = line.split("\t") <NEW_LINE> typena... | docstring for BaiduImporter | 62598f6e8a43f66fc4bf1965 |
class StoredFile(object): <NEW_LINE> <INDENT> swagger_types = { 'id': 'str', 'name': 'str', 'type': 'str', 'size': 'float' } <NEW_LINE> attribute_map = { 'id': 'id', 'name': 'name', 'type': 'type', 'size': 'size' } <NEW_LINE> def __init__(self, id=None, name=None, type=None, size=None): <NEW_LINE> <INDENT> self._id = N... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f6e15fb5d323ce7e50e |
class OutputType(object): <NEW_LINE> <INDENT> def close(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> closed = property(None, None, None, """ True if the file is closed """ ) <NEW_LINE> def flush(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def getvalue(self, use_pos=None): <NEW_LINE> <INDENT> return "" <N... | Simple type for output to strings. | 62598f6e8c3a8732951f5d37 |
class Resource(object): <NEW_LINE> <INDENT> HUMAN_ID = False <NEW_LINE> NAME_ATTR = 'name' <NEW_LINE> def __init__(self, manager, info, loaded=False): <NEW_LINE> <INDENT> self.manager = manager <NEW_LINE> self._info = info <NEW_LINE> self._add_details(info) <NEW_LINE> self._loaded = loaded <NEW_LINE> <DEDENT> def __rep... | Base class for OpenStack resources (tenant, user, etc.).
This is pretty much just a bag for attributes. | 62598f6ed53ae8145f917c7f |
class ArtistList(ListCreateAPIView): <NEW_LINE> <INDENT> model = models.Artist <NEW_LINE> serializer_class = serializers.ArtistSerializer <NEW_LINE> parser_classes = (JSONParser,) | List artist resources.
# AND...
We can use markdown in our documentation by simply providing
it in the docstring of the API methods. | 62598f6e6aa9bd52df0d46bb |
class UserManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self, email: str, password: str, **extra_fields) -> Model: <NEW_LINE> <INDENT> email = self.normalize_email(email) <NEW_LINE> user = self.model(email=email, **extra_fields) <NEW_LINE> self.validate_raw_password(password, user) <NEW_LINE> user.set_p... | Manager for User model | 62598f6e3eb6a72ae0389e29 |
class AttachmentPreprocessor(markdown.preprocessors.Preprocessor): <NEW_LINE> <INDENT> def run(self, lines): <NEW_LINE> <INDENT> new_text = [] <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> m = ATTACHMENT_RE.match(line) <NEW_LINE> if m: <NEW_LINE> <INDENT> attachment_id = m.group('id').strip() <NEW_LINE> try: <NEW_L... | django-wiki attachment preprocessor - parse text for [attachment:id] references. | 62598f6e796e427e5384df7d |
class PermissionDenied(PermissionException): <NEW_LINE> <INDENT> def __init__(self, perm_name, target, permittee, allow_redirect=True): <NEW_LINE> <INDENT> from expedient.common.permissions.models import Permittee <NEW_LINE> if not isinstance(target, models.Model): <NEW_LINE> <INDENT> target = ContentType.objects.get_f... | Raised when a permission is denied/not found. | 62598f6e63f4b57ef0085963 |
class SpecifyChangedFiles: <NEW_LINE> <INDENT> def it_is_callable(self): <NEW_LINE> <INDENT> import da.vcs.git_adapter <NEW_LINE> assert callable(da.vcs.git_adapter.changed_files) | Specify the da.vcs.git_adapter.changed_files() function | 62598f6ed164cc617582075d |
class OrderedDefaultDict(collections.OrderedDict): <NEW_LINE> <INDENT> def __init__(self, default_factory=None, *a, **kw): <NEW_LINE> <INDENT> if (default_factory is not None and not callable(default_factory)): <NEW_LINE> <INDENT> raise TypeError('first argument must be callable') <NEW_LINE> <DEDENT> collections.Ordere... | A Dictionary that maintains insertion order where missing values
are provided by a factory function, i.e., a combination of
the semantics of collections.defaultdict and collections.OrderedDict. | 62598f6ed4950a0f3b110a2b |
class itkVectorCastImageFilterICVF22IVF22(itkVectorCastImageFilterICVF22IVF22_Superclass): <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") <NEW_LINE>... | Proxy of C++ itkVectorCastImageFilterICVF22IVF22 class | 62598f6e50485f2cf55da757 |
class IUIFolderSettings(Interface): <NEW_LINE> <INDENT> folder_icon_link = schema.Bool( title=_(u"Clicking on the icon goes to the content/edit view."), default=True, required=False) <NEW_LINE> folder_icon_preview = schema.Bool( title=_(u"Enable content preview when hovering over the icon."), description=_(u"This can b... | SMI Settings for the folder view.
| 62598f6e0383005118f6ceea |
class Predicate: <NEW_LINE> <INDENT> _arity = 0 <NEW_LINE> def __init__(self, name, children=None): <NEW_LINE> <INDENT> self._name = name <NEW_LINE> children = children or () <NEW_LINE> self._children = tuple(children) <NEW_LINE> self._arity = len(self.children) <NEW_LINE> self._strings = { self._name } <NEW_LINE> for ... | Represents a predicate which can have any (fixed) arity, and which maintains
a list of "children" predicates that describe its arguments. | 62598f6ed10714528d69d6b5 |
class NoopQuotaDriver(object): <NEW_LINE> <INDENT> def get_defaults(self, context, resources): <NEW_LINE> <INDENT> quotas = {} <NEW_LINE> for resource in resources.values(): <NEW_LINE> <INDENT> quotas[resource.name] = -1 <NEW_LINE> <DEDENT> return quotas <NEW_LINE> <DEDENT> def get_class_quotas(self, context, resources... | Driver that turns quotas calls into no-ops and pretends that quotas
for all resources are unlimited. This can be used if you do not
wish to have any quota checking. For instance, with nova compute
cells, the parent cell should do quota checking, but the child cell
should not. | 62598f6e7b25080760ed6c84 |
class CannotGetBlogContentError(Exception): <NEW_LINE> <INDENT> pass | ページの情報の取得に失敗したときに投げるエラー | 62598f6e9b70327d1c57e596 |
class ComposeRequest(_messages.Message): <NEW_LINE> <INDENT> class SourceObjectsValueListEntry(_messages.Message): <NEW_LINE> <INDENT> class ObjectPreconditionsValue(_messages.Message): <NEW_LINE> <INDENT> ifGenerationMatch = _messages.IntegerField(1) <NEW_LINE> <DEDENT> generation = _messages.IntegerField(1) <NEW_LINE... | A Compose request.
Messages:
SourceObjectsValueListEntry: A SourceObjectsValueListEntry object.
Fields:
destination: Properties of the resulting object.
kind: The kind of item this is.
sourceObjects: The list of source objects that will be concatenated into a
single object.
userProject: The project to b... | 62598f6e287bf620b62713aa |
class ADBase(object): <NEW_LINE> <INDENT> default_ldap_server = None <NEW_LINE> default_gc_server = None <NEW_LINE> default_ldap_port = None <NEW_LINE> default_gc_port = None <NEW_LINE> default_domain = _default_detected_domain <NEW_LINE> default_forest = _default_detected_forest <NEW_LINE> adsi_provider = _adsi_provid... | Base class that is utilized by all objects within package to help
store defaults. (search, query, all AD objects) | 62598f6ec432627299fa27bf |
class EdgeMetric(MetricsProcessor): <NEW_LINE> <INDENT> def __init__(self, pattern, includes=(), excludes=(), roundto=900, select=None, path=None): <NEW_LINE> <INDENT> super(EdgeMetric, self).__init__(pattern, includes, excludes, roundto, path) <NEW_LINE> self._select = None <NEW_LINE> if select and select not in ('las... | Edge metric
count issues where selected parameter can be provided as the list with ranges. For example:
[(1463075452, 1463599017, u'Closed'), (1463675880, 1480841839, u'Closed')]
Possible options:
- last-right (implemented)
- last-left
- first-right
- first-left | 62598f6eac7a0e7691f71cff |
@parser(Specs.dmesg) <NEW_LINE> class DmesgLineList(CommandParser, LogFileOutput): <NEW_LINE> <INDENT> _line_re = re.compile(r'^(?:\[\s*(?P<timestamp>\d+\.\d+)\]\s+)?(?P<message>.*)$') <NEW_LINE> def has_startswith(self, prefix): <NEW_LINE> <INDENT> return any( self._line_re.search(line).group('message').startswith(pre... | Class for reading output of ``dmesg`` using the LogFileOutput parser class.
.. note::
Please refer to its super-class :class:`insights.core.LogFileOutput` | 62598f6e6aa9bd52df0d46bd |
class BaseLazyDataset(AbstractDataset): <NEW_LINE> <INDENT> def __init__(self, data_path: typing.Union[str, list], load_fn: typing.Callable, **load_kwargs): <NEW_LINE> <INDENT> super().__init__(data_path, load_fn) <NEW_LINE> self._load_kwargs = load_kwargs <NEW_LINE> self.data = self._make_dataset(self.data_path) <NEW_... | Dataset to load data in a lazy way | 62598f6e5e10d32532ce34e0 |
@method_decorator(login_required, name='dispatch') <NEW_LINE> class IntentsView(StudioViewMixin, ListView): <NEW_LINE> <INDENT> context_object_name = 'intents' <NEW_LINE> template_name = 'intents_list.html' <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(IntentsView, self).get_conte... | List of AIs, current homepage | 62598f6e8a349b6b43685a2b |
class Player(Actor): <NEW_LINE> <INDENT> def __init__(self, initialPosition, initialDirection, speed, image): <NEW_LINE> <INDENT> Actor.__init__(self, initialPosition, initialDirection, speed, image) <NEW_LINE> <DEDENT> def move(self, timeDelta, boundsRect): <NEW_LINE> <INDENT> pass | Movable actor for both player and CPU characters | 62598f6ea8ecb033258709f0 |
class WeatherStore(Store): <NEW_LINE> <INDENT> def get_first(self, key): <NEW_LINE> <INDENT> return self.data[key][0] | Defines how to get weather data | 62598f6efb3f5b602db47da5 |
class DocumentSection: <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def get_text(self) -> str: ... <NEW_LINE> @abstractmethod <NEW_LINE> def get_position(self) -> str: ... <NEW_LINE> def get_nlp_text(self): <NEW_LINE> <INDENT> from fairest.core.nlp import get_nlp_doc <NEW_LINE> return get_nlp_doc(self.get_text()) | Abstract representation of a unit in the Document model.
Document interpreters should implement the get_text method to return its plain string representation,
which is used to process full and short texts. | 62598f6e925a0f43d25e7826 |
class Word(object): <NEW_LINE> <INDENT> def __init__(self, new_word): <NEW_LINE> <INDENT> self.name = new_word <NEW_LINE> self.points = 0 <NEW_LINE> <DEDENT> def score(self): <NEW_LINE> <INDENT> if len(self.name) == 3: <NEW_LINE> <INDENT> self.points = 1 <NEW_LINE> <DEDENT> elif len(self.name) == 4: <NEW_LINE> <INDENT>... | object holding words found by the player and points scored for the word | 62598f6e07d97122c4216490 |
class CustomBackend(ModelBackend): <NEW_LINE> <INDENT> def authenticate(self, request, username=None, password=None, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = UserProfile.objects.get(Q(username=username)|Q(email=username)) <NEW_LINE> if user.check_password(password): <NEW_LINE> <INDENT> return user... | 增加邮箱登录
继承ModelBackend类,覆盖authenticate方法, 增加邮箱认证 | 62598f6e66673b3332c2fba9 |
class Presets(ServiceDialog): <NEW_LINE> <INDENT> __slots__ = [] <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(Presets, self).__init__(title="Manage Service Presets", *args, **kwargs) <NEW_LINE> <DEDENT> def _ui_control(self): <NEW_LINE> <INDENT> header = Label("About Service Presets") <NEW_... | Provides a dialog for editing presets. | 62598f6e15baa72349461774 |
class ConnectionOption(CaseInsensitive): <NEW_LINE> <INDENT> __slots__ = () | A connection option (RFC 7230 Section 6.1). | 62598f6e711fe17d825dfed5 |
class CSharpDistribTest(object): <NEW_LINE> <INDENT> def __init__(self, platform, arch, docker_suffix=None, use_dotnet_cli=False, presubmit=False): <NEW_LINE> <INDENT> self.name = 'csharp_%s_%s' % (platform, arch) <NEW_LINE> self.platform = platform <NEW_LINE> self.arch = arch <NEW_LINE> self.docker_suffix = docker_suf... | Tests C# NuGet package | 62598f6e30c21e258be97fee |
class HitosIV: <NEW_LINE> <INDENT> def todos_hitos(self): <NEW_LINE> <INDENT> return hitos <NEW_LINE> <DEDENT> def cuantos(self): <NEW_LINE> <INDENT> return len(hitos['hitos']) <NEW_LINE> <DEDENT> def uno(self,hito_id): <NEW_LINE> <INDENT> if hito_id > len(hitos['hitos_lista']) or hito_id < 0: <NEW_LINE> <INDENT> raise... | Una clase para los hitos del proyecto de Infraestructura Virtual | 62598f6e711fe17d825dfed6 |
class PEB_LDR_DATA(Structure): <NEW_LINE> <INDENT> _fields_ = [ ("Length", c_ulong), ("Initialized", c_ubyte), ("SsHandle", c_void_p), ("InLoadOrderModuleList", LIST_ENTRY), ("InMemoryOrderModuleList", LIST_ENTRY), ("InInitializationO... | +0x000 Length : ULONG
+0x004 Initialized : BOOLEAN
+0x008 SsHandle : HANDLE
+0x00c InLoadOrderModuleList : LIST_ENTRY
+0x014 InMemoryOrderModuleList : LIST_ENTRY
+0x01C InInitializationOrderModuleList : _LIST_ENTRY
typedef struct _PE... | 62598f6e73bcbd0ca4bc9a3e |
class DevelopmentConfig(Config): <NEW_LINE> <INDENT> DEVELOPMENT = True <NEW_LINE> DEBUG = True | Dev config. | 62598f6e8a43f66fc4bf196a |
class LiveUpdateAfterEditMixin(object): <NEW_LINE> <INDENT> def form_valid(self, form): <NEW_LINE> <INDENT> self.object = form.save() <NEW_LINE> regions = DetailView.render_regions(self) <NEW_LINE> data = {'!form-errors': {}} <NEW_LINE> data.update(changed_regions(regions, form.changed_data)) <NEW_LINE> return HttpResp... | Only uses the editlive mechanism for updating. The edit step happens
inside a standard modal. | 62598f6ed10714528d69d6b9 |
class ChoiceSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Choice <NEW_LINE> fields = ['id', 'choice_text'] | Choice model serializer | 62598f6e26238365f5fac363 |
class PortAllowedAddressPair(NeutronAPIDictWrapper): <NEW_LINE> <INDENT> def __init__(self, addr_pair): <NEW_LINE> <INDENT> super(PortAllowedAddressPair, self).__init__(addr_pair) <NEW_LINE> self.id = addr_pair['ip_address'] | Wrapper for neutron port allowed address pairs. | 62598f6e5e10d32532ce34e2 |
class DynamicLanguageUnittestMixin: <NEW_LINE> <INDENT> def execute_unittest(self): <NEW_LINE> <INDENT> command = self.get_command_for_unittest() <NEW_LINE> time_limit = self.options.get('time_limit') or TIMELIMIT <NEW_LINE> try: <NEW_LINE> <INDENT> returncode, output = run_cmd(command, time_limit) <NEW_LINE> <DEDENT> ... | Executes dynamic languages like python & ruby in the following form
$ python tests.py
$ ruby tests.rb
$ node tests.js | 62598f6e7c178a314d78cc91 |
class PatchGeneratorWithPaddingIHC(PatchGeneratorIHC): <NEW_LINE> <INDENT> def __init__(self, size, level, padding): <NEW_LINE> <INDENT> super(PatchGeneratorWithPaddingIHC, self).__init__(size, level) <NEW_LINE> self._padding = padding <NEW_LINE> <DEDENT> def get_patches(self, ihc_slide, all_indices): <NEW_LINE> <INDEN... | add padding around patch to avoid the analysis being distorted by the edge
of the image usefull when doing image processing | 62598f6e15fb5d323ce7e514 |
class MnistDataLoader(BaseDataLoader): <NEW_LINE> <INDENT> def __init__(self, data_dir, batch_size, shuffle, validation_split, num_workers, training=True): <NEW_LINE> <INDENT> trsfm = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.1307,), (0.3081,)) ]) <NEW_LINE> self.data_dir = data_dir <NEW_LINE>... | MNIST data loading demo using BaseDataLoader | 62598f6ea8ecb033258709f4 |
class ComplexityClass(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.coeff = None <NEW_LINE> <DEDENT> def fit(self, n, t): <NEW_LINE> <INDENT> x = self._transform_n(n) <NEW_LINE> y = self._transform_time(t) <NEW_LINE> coeff, residuals, rank, s = np.linalg.lstsq(x, y, rcond=-1) <NEW_LINE> self... | Abstract class that fits complexity classes to timing data.
| 62598f6e30c21e258be97fef |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.