code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class PollingConnection(Connection): <NEW_LINE> <INDENT> poll_interval = 0.5 <NEW_LINE> timeout = 200 <NEW_LINE> request_method = 'request' <NEW_LINE> def async_request(self, action, params=None, data='', headers=None, method='GET', context=None): <NEW_LINE> <INDENT> request = getattr(self, self.request_method) <NEW_LI... | Connection class which can also work with the async APIs.
After initial requests, this class periodically polls for jobs status and
waits until the job has finished.
If job doesn't finish in timeout seconds, an Exception thrown. | 62598f19099cdd3c63674a57 |
class PickleStreamWriter(object): <NEW_LINE> <INDENT> def __init__(self, fname, compression=True): <NEW_LINE> <INDENT> self.fname = fname <NEW_LINE> self.sw = None <NEW_LINE> self.comp = None <NEW_LINE> return <NEW_LINE> <DEDENT> def write(self, data): <NEW_LINE> <INDENT> self.sw.write(self.comp.compress(data)) <NEW_LI... | Pickles and compresses data and writes it to a file.
Provides a function
writer(): filewrite(compress(pickle(data)))
which pickles and compresses the given data, before writing
it. Uses cpickle and zlib for pickling and compression, resp.
The pickling protocol used is HIGHEST_PROTOCOL.
The default compression level f... | 62598f199f288636728174fb |
class StyleField(forms.Field): <NEW_LINE> <INDENT> def to_python(self, value): <NEW_LINE> <INDENT> if not value or isinstance(value, RasterRenderer): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return {int(k): get_renderer_from_definition(v) for k, v in json.loads(value).items()} <NEW_... | Custom renderer configurations | 62598f19adb09d7d5dc092a7 |
class DataStatis(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(DataStatis, self).__init__() <NEW_LINE> self.config = ConfigX() <NEW_LINE> self.rg = RatingGetter() <NEW_LINE> self.tg = TrustGetter() <NEW_LINE> self.cold_rating = 0 <NEW_LINE> self.cold_social = 0 <NEW_LINE> self.cold_rating_s... | docstring for DataStatis | 62598f197cff6e4e811b46ef |
class BusWriteError(BusError): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> self.msg = msg | CAN Bus Write Error | 62598f199f288636728174fd |
class SAGEConv(MessagePassing): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels): <NEW_LINE> <INDENT> super(SAGEConv, self).__init__(aggr='max') <NEW_LINE> self.lin = torch.nn.Linear(in_channels, out_channels) <NEW_LINE> self.act = torch.nn.ReLU() <NEW_LINE> self.update_lin = torch.nn.Linear(in_channel... | SAGECOV MessagePassing. | 62598f19adb09d7d5dc092a9 |
class _NFSMounter(_ShareHandler): <NEW_LINE> <INDENT> _DEBIAN_INSTALL = "dpkg -s nfs-common || apt-get -y install nfs-common" <NEW_LINE> _REDHAT_INSTALL = "rpm -q nfs-utils || yum install -y nfs-utils" <NEW_LINE> _NFS_CHECKS = { "centos": _REDHAT_INSTALL, "fedora": _REDHAT_INSTALL, "redhatenterpriseserver": _REDHAT_INS... | Handles mounting of a single NFS share to any number of instances. | 62598f199f288636728174fe |
class OneClassSVM(SparseBaseLibSVM): <NEW_LINE> <INDENT> def __init__(self, kernel='rbf', degree=3, gamma=0.0, coef0=0.0, tol=1e-3, nu=0.5, shrinking=True, probability=False, cache_size=200, verbose=False, max_iter=-1): <NEW_LINE> <INDENT> super(OneClassSVM, self).__init__( 'one_class', kernel, degree, gamma, coef0, to... | OneClassSVM for sparse matrices (csr)
See :class:`sklearn.svm.OneClassSVM` for a complete list of parameters
Notes
-----
For best results, this accepts a matrix in csr format
(scipy.sparse.csr), but should be able to convert from any array-like
object (including other sparse representations). | 62598f19fbf16365ca792da5 |
class Recommendation: <NEW_LINE> <INDENT> def __init__(self, user_id, common_user_count): <NEW_LINE> <INDENT> self.user_id = user_id <NEW_LINE> self.common_user_count = common_user_count <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str(self.user_id) + '(' + str(self.common_user_count) + ')' <NEW_LI... | Created by Arezou on 2017-02-12.
This Class describe a recommendation, and a recommendation has a
user_Id and a number of followed user by this user in common (common_user_count). | 62598f19091ae3566870390f |
class C(B, A): <NEW_LINE> <INDENT> pass | 多继承可以让子类对象,同时拥有多个父类的方法和属性 | 62598f19adb09d7d5dc092ab |
class ComputationalGraph(object): <NEW_LINE> <INDENT> def __init__(self, nodes, edges, variable_style=None, function_style=None): <NEW_LINE> <INDENT> self.nodes = nodes <NEW_LINE> self.edges = edges <NEW_LINE> self.variable_style = variable_style <NEW_LINE> self.function_style = function_style <NEW_LINE> <DEDENT> def _... | Class that represents computational graph.
.. note::
We assume that the computational graph is directed and acyclic. | 62598f1931939e2706ed10e5 |
class Rewards: <NEW_LINE> <INDENT> @autocastable <NEW_LINE> def check_value(self, value: TransitionValue[D.T_value]) -> bool: <NEW_LINE> <INDENT> return self._check_value(value) <NEW_LINE> <DEDENT> def _check_value(self, value: TransitionValue[D.T_value]) -> bool: <NEW_LINE> <INDENT> return True | A domain must inherit this class if it sends rewards (positive and/or negative). | 62598f1997e22403b3839be9 |
class PhysicalDAO(ABSDao): <NEW_LINE> <INDENT> TABLE = DBLoader().get_table(ABSDao.DATABASE_NAME.get('physical_machine')) <NEW_LINE> CLASS = DBLoader().get_base_class(ABSDao.DATABASE_NAME.get('physical_machine')) <NEW_LINE> EVENT_TYPE = 'compute_event' <NEW_LINE> INNER_OBJ = 'compute_node' <NEW_LINE> DB_MAP = dict(host... | Physical DAO abstraction to create physical machine messages. | 62598f19d8ef3951e32c74d8 |
class TestingConfig(Config): <NEW_LINE> <INDENT> TESTING = True <NEW_LINE> DEBUG = True | Config for Testing, with a separate test database. | 62598f193617ad0b5ee04e35 |
class QResizeEvent(__PyQt5_QtCore.QEvent): <NEW_LINE> <INDENT> def oldSize(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def size(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __init__(self, *__args): <NEW_LINE> <INDENT> pass | QResizeEvent(QSize, QSize)
QResizeEvent(QResizeEvent) | 62598f1950812a4eaa620270 |
class Checker(object): <NEW_LINE> <INDENT> def get_requirement_versions(self): <NEW_LINE> <INDENT> distributions = pip.get_installed_distributions() <NEW_LINE> dist_requirements = {} <NEW_LINE> for dist in distributions: <NEW_LINE> <INDENT> dist_requirement_dict = dist_requirements.get(dist.project_name, {}) <NEW_LINE>... | Class that contains all the checker methods that find dependency conflicts | 62598f19ab23a570cc2d43f0 |
class TestDatabaseToDict: <NEW_LINE> <INDENT> def test_to_dict(self, high_quality_image: io.BytesIO) -> None: <NEW_LINE> <INDENT> database = VuforiaDatabase() <NEW_LINE> vws_client = VWS( server_access_key=database.server_access_key, server_secret_key=database.server_secret_key, ) <NEW_LINE> with MockVWS() as mock: <NE... | Tests for dumping a database to a dictionary. | 62598f19099cdd3c63674a5a |
class RunnerReturnCodes: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> raise InvalidUseError("RunnerReturnCodes should not be instantiated!") <NEW_LINE> <DEDENT> TESTS_SUCCEEDED = 0 <NEW_LINE> TESTS_FAILED = 1 <NEW_LINE> INCORRECT_USAGE = 101 <NEW_LINE> FAILED_TO_LOAD_LIBRARY = 102 <NEW_LINE> SYMBOL_NOT_F... | Defines return and error codes from running the test scanner.
| 62598f19adb09d7d5dc092ad |
class UserInfoCache(LRUCache): <NEW_LINE> <INDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> def _fail(msg): <NEW_LINE> <INDENT> self.__delitem__(key) <NEW_LINE> raise KeyError(msg) <NEW_LINE> <DEDENT> item = super().__getitem__(key) <NEW_LINE> if isinstance(item, UserInfos): <NEW_LINE> <INDENT> if item.valid_for... | This caches user_infos for access tokens for an unspecified time.
Before yielding UserInfos, the validity of user infos is checked. | 62598f19187af65679d2928a |
class DeckCatalogScreen(Screen): <NEW_LINE> <INDENT> catalog = ObjectProperty() <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> Screen.__init__(self, **kwargs) <NEW_LINE> self.carousel = Carousel(direction="right") <NEW_LINE> standard = self.catalog["Lovers & Spies Deck"] <NEW_LINE> self.carousel.add_widge... | Provide a means of exploring and purchasing available decks. | 62598f19ab23a570cc2d43f1 |
class IperfServer(IperfMachine, metaclass=Singleton): <NEW_LINE> <INDENT> def __init__(self, host, password, password_file): <NEW_LINE> <INDENT> self._running = False <NEW_LINE> super(IperfServer, self).__init__(host, password, password_file) <NEW_LINE> <DEDENT> def start(self): <NEW_LINE> <INDENT> command = 'iperf3 -s... | Server class | 62598f19283ffb24f3cf25ae |
class FloatingIP(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant): <NEW_LINE> <INDENT> floating_ip_address = sa.Column(sa.String(64), nullable=False) <NEW_LINE> floating_network_id = sa.Column(sa.String(36), nullable=False) <NEW_LINE> floating_port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id'), nullab... | Represents a floating IP address.
This IP address may or may not be allocated to a tenant, and may or
may not be associated with an internal port/ip address/router. | 62598f199f28863672817503 |
@register_resource <NEW_LINE> class v1_NodeList(Resource): <NEW_LINE> <INDENT> __kind__ = 'v1.NodeList' <NEW_LINE> __fields__ = { 'api_version': 'apiVersion', 'items': 'items', 'kind': 'kind', 'metadata': 'metadata', } <NEW_LINE> __types__ = { 'items': 'v1.Node', 'metadata': 'unversioned.ListMeta', } <NEW_LINE> __requi... | NodeList is the whole list of all Nodes which have been registered
with master. | 62598f19ec188e330fdf75c1 |
class SQL2TextModel(nn.Module): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.bert = BartForConditionalGeneration.from_pretrained("facebook/bart-large") <NEW_LINE> <DEDENT> def forward(self, *input, **kwargs): <NEW_LINE> <INDENT> input_ids = kwargs.pop("input_ids") <NEW_... | output: tuple: (loss, ) in training | 62598f1950812a4eaa620272 |
class UUID4TestCase(unittest2.TestCase): <NEW_LINE> <INDENT> def test_type(self): <NEW_LINE> <INDENT> self.assertIsInstance(utils.uuid4(), type('')) | Test :func:`pulp_smash.utils.uuid4`. | 62598f19ad47b63b2c5a651b |
class BadNominalFormatting(ArffException): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.message = ( ('Nominal data value "%s" not properly quoted in line ' % value) + '%d.' ) | Error raised when a nominal value with space is not properly quoted. | 62598f1926238365f5fab898 |
class _OptionMapping(object): <NEW_LINE> <INDENT> __slots__ = ['option', 'name', 'type', 'help'] <NEW_LINE> def __init__(self, *, option: str, name: str, type: type, help: str): <NEW_LINE> <INDENT> self.option = option <NEW_LINE> self.name = name <NEW_LINE> self.type = type <NEW_LINE> self.help = help | (internal) mapping entry between a command line option and a
argument name and its type | 62598f19091ae35668703917 |
class AuthorViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Author.objects.all() <NEW_LINE> serializer_class = AuthorSerializer <NEW_LINE> permission_classes = (permissions.IsAuthenticated,) <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> queryset = self.queryset <NEW_LINE> if self.request.user.is... | API viewset for Author objects. | 62598f19d8ef3951e32c74dc |
class MSLE(MSE): <NEW_LINE> <INDENT> def __init__(self, transform=None): <NEW_LINE> <INDENT> transform = transform or (lambda x: x) <NEW_LINE> super(MSLE, self).__init__(transform=lambda x: torch.log(transform(x)+1)) | Meter for mean squared log error metric
| 62598f1950812a4eaa620274 |
class UWProxy(requests.Session): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self._logged_in = False <NEW_LINE> self._user = None <NEW_LINE> <DEDENT> def login(self, last_name, card_barcode): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.... | rewrite requests to go through the UW library
TODO: is there a better way to write this? as a python-requests plugin of some sort? | 62598f19187af65679d2928d |
class MolecularComponent: <NEW_LINE> <INDENT> def __init__(self, name="", metadata=None, *args, **kwargs): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> if metadata is None: <NEW_LINE> <INDENT> metadata = {} <NEW_LINE> <DEDENT> self.metadata = metadata <NEW_LINE> <DEDENT> def __repr__(self) -> str: <NEW_LINE> <INDENT... | Abstract base molecular entity. | 62598f19ab23a570cc2d43f4 |
class ModelData(object): <NEW_LINE> <INDENT> def __init__(self, name="", net_path="", gpu_id=0): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.net_path = net_path <NEW_LINE> self.net = None <NEW_LINE> self.gpu_id = gpu_id <NEW_LINE> <DEDENT> def get_net(self): <NEW_LINE> <INDENT> if not self.net: <NEW_LINE> <IND... | This class contains methods for loading the neural network | 62598f19283ffb24f3cf25b4 |
class ClientException(LitecoinException): <NEW_LINE> <INDENT> pass | P2P network error.
This exception is never raised but functions as a superclass
for other P2P client exceptions. | 62598f19ec188e330fdf75c7 |
class UserSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = get_user_model() <NEW_LINE> fields = ("email", "display_name", "password", "account_type") <NEW_LINE> extra_kwargs = {"password": {"write_only": True}} <NEW_LINE> <DEDENT> def create(self, validated_data): <NE... | Serializer for the users object | 62598f19d8ef3951e32c74dd |
class HttpArtifactInstallation(ProjectBaseMixin): <NEW_LINE> <INDENT> _default_retries = 1 <NEW_LINE> _default_retry_delay = 0 <NEW_LINE> def __init__(self, base, artifact_url, remote_name=None, retries=None, retry_delay=None, downloader=None, runner=None): <NEW_LINE> <INDENT> super(HttpArtifactInstallation, self).__in... | Download and install a single file into a remote release directory.
This is useful for installing an application that is typically bundled as a
single file, e.g. Go binaries or Java JAR files, after downloading it from
some sort of artifact repository (such as a company-wide file server or artifact
store like Artifact... | 62598f19099cdd3c63674a5f |
class DriveBackward(Command): <NEW_LINE> <INDENT> def __init__(self, dist): <NEW_LINE> <INDENT> super().__init__('Driving forward %d inches' % dist) <NEW_LINE> self.requires(subsystems.motors) <NEW_LINE> self.drive = RectifiedDrive(0, 0.05) <NEW_LINE> self.timer = wpilib.Timer() <NEW_LINE> self.desired_dist = dist * 10... | Drives backward the given distance in inches. | 62598f19ec188e330fdf75c9 |
class InvokeRank(WsResource): <NEW_LINE> <INDENT> def _invoke_rank(self, finishes, index=10): <NEW_LINE> <INDENT> invoked_record = Counter(i.spider for i in finishes) <NEW_LINE> ranks = invoked_record.most_common(index) if invoked_record else [] <NEW_LINE> return ranks <NEW_LINE> <DEDENT> @decorator_auth <NEW_LINE> def... | 爬虫运行时长排行 根据index参数进行切片 | 62598f1931939e2706ed10eb |
class Word2VecModel(JavaModel, JavaMLReadable, JavaMLWritable): <NEW_LINE> <INDENT> @since("1.5.0") <NEW_LINE> def getVectors(self): <NEW_LINE> <INDENT> return self._call_java("getVectors") <NEW_LINE> <DEDENT> @since("1.5.0") <NEW_LINE> def findSynonyms(self, word, num): <NEW_LINE> <INDENT> if not isinstance(word, base... | Model fitted by :py:class:`Word2Vec`.
.. versionadded:: 1.4.0 | 62598f1997e22403b3839bf5 |
class manager_skill(BaseEstimator, TransformerMixin): <NEW_LINE> <INDENT> def __init__(self, threshold=5): <NEW_LINE> <INDENT> self.threshold = threshold <NEW_LINE> <DEDENT> def _reset(self): <NEW_LINE> <INDENT> if hasattr(self, 'mapping_'): <NEW_LINE> <INDENT> self.mapping_ = {} <NEW_LINE> self.mean_skill_ = 0.0 <NEW_... | Adds the column "manager_skill" to the dataset, based on the Kaggle kernel
"Improve Perfomances using Manager features" by den3b. The function should
be usable in scikit-learn pipelines.
Parameters
----------
threshold : Minimum count of rental listings a manager must have in order
to get his "own" score, ... | 62598f190fa83653e46f3bf9 |
class ObjectFactory(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ObjectFactory, self).__init__() <NEW_LINE> <DEDENT> def toMapForm(self, obj): <NEW_LINE> <INDENT> t = type(obj) <NEW_LINE> if t is PolyAmplitude: <NEW_LINE> <INDENT> return self.__PolyAmplitude_ToMap(obj) <NEW_LINE> <DEDENT> ... | Object factory for amplitude objects. | 62598f190fa83653e46f3bfb |
class IEEE2030_5Renderer: <NEW_LINE> <INDENT> media_type = 'application/sep+xml' <NEW_LINE> @staticmethod <NEW_LINE> def export(xsd_object, make_pretty=True): <NEW_LINE> <INDENT> buff = io.StringIO() <NEW_LINE> xsd_object.export( buff, 1, namespacedef_='xmlns="http://zigbee.org/sep" xmlns:xsi="http://www.w3.org/2001/XM... | Takes IEEE 2030.5 Type objects and renders them as XML formatted data for HTTP response. | 62598f19ec188e330fdf75cd |
class Interpellation(Act): <NEW_LINE> <INDENT> ANSWER_TYPES = Choices( ('WRITTEN', 'written', _('Written')), ('VERBAL', 'verbal', _('Verbal')), ) <NEW_LINE> FINAL_STATUSES = ( ('ANSWERED', _('answered')), ('NOTANSWERED', _('not answered')), ('RETIRED', _('retired')), ('DECAYED', _('decayed')), ) <NEW_LINE> STATUS = Cho... | WRITEME | 62598f19adb09d7d5dc092bb |
class CourtierList(ListView): <NEW_LINE> <INDENT> model = Courtier <NEW_LINE> template_name = 'administrateur/list_courtier.html' <NEW_LINE> context_object_name = 'courtiers' <NEW_LINE> paginate_by = 10 <NEW_LINE> queryset = Courtier.objects.all() | Generic List Courtier View | 62598f19fbf16365ca792db7 |
class ChunkedUpload(BaseChunkedUpload): <NEW_LINE> <INDENT> user = models.ForeignKey(AUTH_USER_MODEL, related_name='chunked_uploads', on_delete=models.CASCADE) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> abstract = ABSTRACT_MODEL | Default chunked upload model.
To use it, set CHUNKED_UPLOAD_ABSTRACT_MODEL as True in your settings. | 62598f19ad47b63b2c5a6526 |
class Time: <NEW_LINE> <INDENT> def tostring(self): <NEW_LINE> <INDENT> timestr = str(self.hr) if self.hr > 9 else "0" + str(self.hr) <NEW_LINE> timestr += ":" <NEW_LINE> timestr += str(self.min) if self.min > 9 else "0" + str(self.min) <NEW_LINE> timestr += ":" <NEW_LINE> timestr += str(self.sec) if self.sec > 9 else ... | def isvalidTime(self):
if 0 <= self.hr < 13 and 0 <= self.min <= 59 and 0 <= self.sec <= 59:
return True
else:
return False | 62598f19099cdd3c63674a62 |
class BitpandaParser(TradeHistoryParser): <NEW_LINE> <INDENT> _COLUMN_ID = "ID" <NEW_LINE> _COLUMN_DATE = "Created at" <NEW_LINE> _COLUMN_TYPE = "Type" <NEW_LINE> _COLUMN_DIRECTION = "In/Out" <NEW_LINE> _COLUMN_FIAT = "Fiat Currency" <NEW_LINE> _COLUMN_FIAT_AMOUNT = "Amount Fiat" <NEW_LINE> _COLUMN_CRYPTO = "Cryptocoin... | Parses csv files of the Bitpanda exchange platform. | 62598f194c34283577618fee |
class LivingSocialDeal(Item): <NEW_LINE> <INDENT> title = Field() <NEW_LINE> link = Field() <NEW_LINE> location = Field() <NEW_LINE> original_page = Field() <NEW_LINE> price = Field() <NEW_LINE> end_date = Field() | Livingsocial container (dictionary-like object) for scraped data | 62598f19d8ef3951e32c74e1 |
class VariantStorage(Stream): <NEW_LINE> <INDENT> def __init__(self, *arguments, **keywords): <NEW_LINE> <INDENT> Stream.__init__(self, *arguments, **keywords) <NEW_LINE> self.variantParent = None <NEW_LINE> if 'variantParent' in keywords: <NEW_LINE> <INDENT> self.variantParent = keywords['variantParent'] | For advanced use. This Stream subclass is only
used inside of a Variant object to provide object
storage of connected elements (things the Variant
defines).
This subclass name can be used to search in an
object's Sites and find any and all
locations that are VariantStorage objects.
A `variantParent` keyword argument ... | 62598f197cff6e4e811b4704 |
class CompetitorsPoint(object): <NEW_LINE> <INDENT> swagger_types = { 'current_car': 'CompetitorsCarDetails', 'similar_car_models': 'list[CompetitorsSimilarCars]', 'same_car_models': 'list[CompetitorsSameCars]' } <NEW_LINE> attribute_map = { 'current_car': 'current_car', 'similar_car_models': 'similar_car_models', 'sam... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f19099cdd3c63674a63 |
class Meta: <NEW_LINE> <INDENT> database = DB <NEW_LINE> primary_key = CompositeKey('author', 'doi', 'author_order') | PeeWee meta class contains the database and the primary key. | 62598f194c34283577618ff0 |
class _GroupAffinityFilter(filters.BaseHostFilter): <NEW_LINE> <INDENT> def host_passes(self, host_state, spec_obj): <NEW_LINE> <INDENT> policies = (spec_obj.instance_group.policies if spec_obj.instance_group else []) <NEW_LINE> if self.policy_name not in policies: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> gr... | Schedule the instance on to host from a set of group hosts.
| 62598f199f28863672817514 |
class BkgdGreyscale(KaitaiStruct): <NEW_LINE> <INDENT> SEQ_FIELDS = ["value"] <NEW_LINE> def __init__(self, _io, _parent=None, _root=None): <NEW_LINE> <INDENT> self._io = _io <NEW_LINE> self._parent = _parent <NEW_LINE> self._root = _root if _root else self <NEW_LINE> self._debug = collections.defaultdict(dict) <NEW_LI... | Background chunk for greyscale images. | 62598f190fa83653e46f3c01 |
class NexusReader(object): <NEW_LINE> <INDENT> def __init__(self, filename=None, debug=False): <NEW_LINE> <INDENT> self.debug = debug <NEW_LINE> self.blocks = {} <NEW_LINE> self.rawblocks = {} <NEW_LINE> self.handlers = { 'data': DataHandler, 'characters': DataHandler, 'trees': TreeHandler, 'taxa': TaxaHandler, } <NEW_... | A nexus reader | 62598f19fbf16365ca792dbb |
class _DataPreview(qt.QWidget): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> super(_DataPreview, self).__init__(parent) <NEW_LINE> self.__formatter = Hdf5Formatter(self) <NEW_LINE> self.__data = None <NEW_LINE> self.__info = qt.QTableView(self) <NEW_LINE> self.__model = qt.QStandardItemModel... | Provide a preview of the selected image | 62598f193617ad0b5ee04e49 |
class NavigationError(CFMEException): <NEW_LINE> <INDENT> def __init__(self, page_name): <NEW_LINE> <INDENT> self.page_name = page_name <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'Unable to navigate to page "{}"'.format(self.page_name) <NEW_LINE> <DEDENT> pass | Raised when pytest_selenium.go_to function is unable to navigate to the requested page. | 62598f1926238365f5fab8a6 |
class Error(namedtuple('Error', ['uuid', 'node', 'code', 'title', 'details', 'version'])): <NEW_LINE> <INDENT> pass | Represents an error message to be sent to the calling node on the network.
* uuid - the ID of the request that generated the error.
* node - the ID of the node sending the message.
* code - the code that identifies the specific error.
* title - a description of the type of error generated.
* details - diagnostic detai... | 62598f19099cdd3c63674a64 |
class EdiSupplierOrderDDTLine(orm.Model): <NEW_LINE> <INDENT> _name = 'edi.supplier.order.ddt.line' <NEW_LINE> _description = 'Supplier order DDT line' <NEW_LINE> _rec_name = 'name' <NEW_LINE> _order = 'sequence' <NEW_LINE> _columns = { 'sequence': fields.char('Seq.', size=4), 'name': fields.char( 'Numero DDT', size=20... | Model name: Edi Supplier Order DDT Line
| 62598f1926238365f5fab8a8 |
class CustomerList(GridReport): <NEW_LINE> <INDENT> template = 'input/customerlist.html' <NEW_LINE> title = _("Customer List") <NEW_LINE> basequeryset = Customer.objects.all() <NEW_LINE> model = Customer <NEW_LINE> frozenColumns = 1 <NEW_LINE> rows = ( GridFieldText('name', title=_('name'), key=True, formatter='custome... | A list report to show customers. | 62598f1aec188e330fdf75d5 |
class FrameTransmitter(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def ACK(): <NEW_LINE> <INDENT> return 0x40 <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def SYN_DISCONNECT(): <NEW_LINE> <INDENT> return 0x80 <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def SYN_REQUEST(): <NEW_LINE> <INDENT> return 0x81 <NEW_... | classdocs | 62598f1a50812a4eaa62027c |
class ContentNode(Node): <NEW_LINE> <INDENT> title = models.CharField( max_length=50, verbose_name=_("title"), default=_("Title"), help_text=_("Title of the content item"), ) <NEW_LINE> author = models.CharField( max_length=255, help_text=_("Name of the author(s) of book/movie/exercise"), ) <NEW_LINE> license_owner = m... | Model for content data nodes, which will be stored as leaves only | 62598f1afbf16365ca792dbf |
class RunUnitTestsCoverage(Command): <NEW_LINE> <INDENT> def initialize_options(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def finalize_options(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> user_options = [] <NEW_LINE> description = __doc__[1:] <NEW_LINE> def run(self): <NEW_LINE> <INDENT> import subproc... | run unit tests and report on code coverage using the 'coverage' tool | 62598f1a187af65679d29295 |
class InclusionAdminNode(InclusionNode): <NEW_LINE> <INDENT> def __init__(self, parser, token, func, template_name, takes_context=True): <NEW_LINE> <INDENT> self.template_name = template_name <NEW_LINE> params, varargs, varkw, defaults, kwonly, kwonly_defaults, _ = getfullargspec(func) <NEW_LINE> bits = token.split_con... | Template tag that allows its template to be overridden per model, per app,
or globally. | 62598f1a9f28863672817519 |
class Strategy(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> @abstractmethod <NEW_LINE> def calculate_signals(self, *args): <NEW_LINE> <INDENT> raise NotImplementedError("Should implement calculate_signals()!") | Strategy抽象基类
此类及其继承类通过对Bars(SD-OHLCV)(由DataHandler对象生成)处理产生Signal对象
Strategy类对历史数据和实时数据均有效,实际上它对数据来源不知晓,直接从queue对象获取bar元组 | 62598f1a091ae35668703929 |
class OneCyclePolicy(ListScheduler): <NEW_LINE> <INDENT> def __init__(self, optimizer, lr, epochs, momentum_rng=[0.85, 0.95], phase_ratio=0.45): <NEW_LINE> <INDENT> phase_epochs = int(phase_ratio * epochs) <NEW_LINE> if isinstance(lr, (list, tuple)): <NEW_LINE> <INDENT> lrs = [ np.hstack([ np.linspace(l * 1e-1, l, phas... | Scheduler class that implements the 1cycle policy search specified in:
A disciplined approach to neural network hyper-parameters: Part 1 -- learning rate, batch
size, momentum, and weight decay. Leslie N. Smith, 2018, arXiv:1803.09820.
Args:
optimizer (Optimizer): Wrapped optimizer.
lr (float or list).... | 62598f1a7cff6e4e811b470c |
class Person(object): <NEW_LINE> <INDENT> def __init__(self,name='name',id='id',password='pass'): <NEW_LINE> <INDENT> self.name=name <NEW_LINE> self.ID=id <NEW_LINE> self.password=password <NEW_LINE> <DEDENT> def set_name(self,name): <NEW_LINE> <INDENT> self.name=name <NEW_LINE> <DEDENT> def set_ID(self,id): <NEW_LINE>... | creates a person with name, ID and password | 62598f1a4c34283577618ff8 |
class TestHardwareStopItem(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 testHardwareStopItem(self): <NEW_LINE> <INDENT> pass | HardwareStopItem unit test stubs | 62598f1aab23a570cc2d43fd |
class Square(Rectangle): <NEW_LINE> <INDENT> def __init__(self, size, x=0, y=0, id=None): <NEW_LINE> <INDENT> super().__init__(size, size, x, y, id) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "[Square] ({}) {}/{} - {}".format( self.id, self.x, self.y, self.size) <NEW_LINE> <DEDENT> def update(sel... | Class for defining and working with squares | 62598f1a283ffb24f3cf25c6 |
class MapClass(dict): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> if hasattr(self, '__unicode__'): <NEW_LINE> <INDENT> return force_unicode(self).encode('utf-8') <NEW_LINE> <DEDENT> return '%s object' % self.__class__.__name__ <NEW_LINE> <DEDENT> def setOptions(self, opts): <NEW_LINE> <INDENT> if 'arg' i... | A base class for Google Maps API classes. | 62598f1a091ae3566870392b |
class HallLittlewood_p(HallLittlewood_generic): <NEW_LINE> <INDENT> r <NEW_LINE> class Element(HallLittlewood_generic.Element): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __init__(self, hall_littlewood): <NEW_LINE> <INDENT> HallLittlewood_generic.__init__(self, hall_littlewood) <NEW_LINE> self._self_to_s_cache = ... | A class representing the Hall-Littlewood `P` basis of symmetric functions | 62598f1ac4546d3d9def68f7 |
class AuthRouter: <NEW_LINE> <INDENT> route_app_labels = {'auth', 'contenttypes','admin','contenttypes','sessions','accounts'} <NEW_LINE> def db_for_read(self, model, **hints): <NEW_LINE> <INDENT> if model._meta.app_label in self.route_app_labels: <NEW_LINE> <INDENT> return 'auth_db' <NEW_LINE> <DEDENT> return None <NE... | A router to control all database operations on models in the
auth and contenttypes applications. | 62598f1aec188e330fdf75d9 |
class UpdatePolicyProfile(neutronV20.UpdateCommand): <NEW_LINE> <INDENT> resource = RESOURCE | Update policy profile's information. | 62598f1a31939e2706ed10f4 |
class CoercionTable(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.table = {} <NEW_LINE> self.srcs = defaultdict(set) <NEW_LINE> self.dsts = defaultdict(set) <NEW_LINE> <DEDENT> def add_coercion(self, src, dst, cost, transitive=True): <NEW_LINE> <INDENT> if (src, dst) not in self.table: <NEW_... | Table to hold coercion rules | 62598f1a50812a4eaa620280 |
class AccessToken(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="user_access_tokens", blank=True, null=True) <NEW_LINE> app = models.ForeignKey(App, related_name="app_access_token") <NEW_LINE> token = models.CharField(max_length=255, default=utils.generate_token) <NE... | Default access token implementation. An access token is a time limited
token to access a user's resources.
Access tokens are outlined :rfc:`5`.
@param user
@param app : App model foreign key
@param expires : datetime of expiry
@param token : Generated private key for access | 62598f1ad8ef3951e32c74ea |
class PandasSplitTransformer(): <NEW_LINE> <INDENT> def __init__(self, splits: list[list[Any]]): <NEW_LINE> <INDENT> self.splits = splits <NEW_LINE> <DEDENT> def __call__(self, x: pd.Series) -> list[pd.Series]: <NEW_LINE> <INDENT> return [x[s] for s in self.splits] <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <IN... | Splits the input pandas series into groups by name | 62598f1a0fa83653e46f3c0f |
class Speaker(ndb.Model): <NEW_LINE> <INDENT> name = ndb.StringProperty() <NEW_LINE> sessions = ndb.StringProperty(repeated=True) | Speaker -- Speaker object | 62598f1aadb09d7d5dc092d1 |
class AstDumper(object): <NEW_LINE> <INDENT> def __init__(self, annotate_fields=False, disabled_fields=None, include_attributes=False, indent_ws=' ', ): <NEW_LINE> <INDENT> self.annotate_fields = annotate_fields <NEW_LINE> self.disabled_fields = disabled_fields or ['ctx',] <NEW_LINE> self.include_attributes = include_... | Return a formatted dump (a string) of the AST node.
Adapted from Python's ast.dump. | 62598f1a3617ad0b5ee04e5b |
class Solution(object): <NEW_LINE> <INDENT> N = 0 <NEW_LINE> arr = [] <NEW_LINE> result = 0 <NEW_LINE> def solveNQueens(self, n): <NEW_LINE> <INDENT> self.N = n <NEW_LINE> self.arr = [0 for _ in range(n)] <NEW_LINE> self.result = 0 <NEW_LINE> self.queen(0) <NEW_LINE> return self.result <NEW_LINE> <DEDENT> def queen(sel... | 给定一个整数 n,返回所有不同的 n 皇后问题的解决方案。
每一种解法包含一个明确的 n 皇后问题的棋子放置方案,该方案中 'Q' 和 '.' 分别代表了皇后和空位。
输入: 4
输出: [
[".Q..", // 解法 1
"...Q",
"Q...",
"..Q."],
["..Q.", // 解法 2
"Q...",
"...Q",
".Q.."]
]
解释: 4 皇后问题存在两个不同的解法。 | 62598f1aab23a570cc2d4403 |
class AuxilliaryVariableDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, data, n_valid, auxilliary_sampler, data_corruptor=None, prng=None): <NEW_LINE> <INDENT> def corruptor(data, prng): <NEW_LINE> <INDENT> if data_corruptor is not None: <NEW_LINE> <INDENT> data = data_corruptor(data, prng) <NEW_LINE> <DEDENT>... | Dataset class for models with inputs formed of data vector plus
independent auxillary random vector. | 62598f1aec188e330fdf75e5 |
class GoodsSKU(BaseModel): <NEW_LINE> <INDENT> status_choices = ( (1, '上架'), (2, '下架') ) <NEW_LINE> goods = models.ForeignKey('GoodsType', verbose_name='商品种类') <NEW_LINE> spu = models.ForeignKey('GoodsSPU', verbose_name='商品spu') <NEW_LINE> name = models.CharField(max_length=20, verbose_name='商品名称') <NEW_LINE> desc = mo... | 商品SKU模型类 | 62598f1aadb09d7d5dc092d3 |
class JNode(dict): <NEW_LINE> <INDENT> def __init__(self, *args, **kargs): <NEW_LINE> <INDENT> self.func = None <NEW_LINE> self.shell = None <NEW_LINE> self.method = None <NEW_LINE> self.subtree = None <NEW_LINE> super().__init__(*args) <NEW_LINE> try: <NEW_LINE> <INDENT> self.__doc__ = self[HELP] <NEW_LINE> del self[H... | JSON Command Tree Node | 62598f1a50812a4eaa620284 |
class TestRunner(TestResultProxy): <NEW_LINE> <INDENT> def __init__(self, plugins, stream, writercls=None, descriptions=True, logger=None): <NEW_LINE> <INDENT> self.descriptions = descriptions <NEW_LINE> self.plugins = [] <NEW_LINE> writercls = writercls or TestStream <NEW_LINE> result = TestResult(descriptions=self.de... | An asynchronous test runner | 62598f1aad47b63b2c5a653e |
class Cosh(FuncOp): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.value = 'cosh' <NEW_LINE> <DEDENT> def inverse(self, RHS): <NEW_LINE> <INDENT> super().inverse(RHS) <NEW_LINE> self.__class__ = ArcCosh <NEW_LINE> <DEDENT> def differentiate(self): <NEW_LINE> <INDENT> supe... | Class for cosh function -- cosh(...)
Extends:
FuncOp | 62598f1aab23a570cc2d4404 |
class TestRequest(TestRequestBase): <NEW_LINE> <INDENT> def __setitem__(self, key, value): <NEW_LINE> <INDENT> pass | Zope 3's TestRequest doesn't support item assignment, but Zope 2's
request does. | 62598f1a7cff6e4e811b471c |
class device_handler(debounce_handler): <NEW_LINE> <INDENT> TRIGGERS = {"light": 53000,"fan": 52004} <NEW_LINE> def act(self, client_address, state, name): <NEW_LINE> <INDENT> print("State", state, "from client @", client_address) <NEW_LINE> if name=="light": <NEW_LINE> <INDENT> GPIO.setmode(GPIO.BOARD) <NEW_LINE> GPIO... | Publishes the on/off state requested,
and the IP address of the Echo making the request. | 62598f1a26238365f5fab8bc |
class TimeSeriesEEGData(TimeSeriesData): <NEW_LINE> <INDENT> _ui_name = "EEG time-series" <NEW_LINE> sensors = sensors_module.SensorsEEG <NEW_LINE> labels_ordering = basic.List(default=["Time", "EEG Sensor"]) | A time series associated with a set of EEG sensors. | 62598f1a0fa83653e46f3c15 |
class FlashLdr: <NEW_LINE> <INDENT> def __init__(self,device=None,debug=False): <NEW_LINE> <INDENT> self.IsAltosFlash=False <NEW_LINE> output = bytearray([118]) <NEW_LINE> self.gotDevice=False <NEW_LINE> if(device==None): <NEW_LINE> <INDENT> if platform.system() == 'Windows': <NEW_LINE> <INDENT> baseDevice='COM' <NEW_L... | A representation of the Altos Flash Loader | 62598f1aad47b63b2c5a6540 |
class JsonSaver(): <NEW_LINE> <INDENT> def __init__(self, jsondirectory=None): <NEW_LINE> <INDENT> self.data = [] <NEW_LINE> self.jsondirectory = None <NEW_LINE> self.jsonfile = None <NEW_LINE> if jsondirectory: <NEW_LINE> <INDENT> self.jsondirectory = jsondirectory <NEW_LINE> self.jsonfile = open(jsondirectory + '/' +... | Class that saves different messages to a json file. | 62598f1a187af65679d2929e |
class FabricV1NetworkConfig(BlockchainNetworkConfig): <NEW_LINE> <INDENT> def __init__(self, consensus_plugin=CONSENSUS_MODES[0], size=4): <NEW_LINE> <INDENT> self.network_type = NETWORK_TYPE_FABRIC_V1 <NEW_LINE> self.consensus_plugin = consensus_plugin <NEW_LINE> self.size = size <NEW_LINE> super(FabricV1NetworkConfig... | FabricV1NetworkConfig includes configs for fabric v1.0 network. | 62598f1a283ffb24f3cf25d7 |
class InlineQueryResultAudio(InlineQueryResult): <NEW_LINE> <INDENT> def __init__( self, audio_url: str, title: str, duration: int = 0, voice: bool = False, performer: str = "", mime_type: str = "audio/ogg", thumb_url: str = None, id: str = None, description: str = None, caption: str = "", parse_mode: Union[str, None] ... | Link to an audio file.
By default, this audio file will be sent by the user with optional caption.
Alternatively, you can use *input_message_content* to send a message with the specified content instead of the
audio.
Parameters:
audio_url (``str``):
A valid URL for the audio file.
title (``str``):
... | 62598f1a4c3428357761900a |
class MapiContactPhotoDto(ContactPhoto): <NEW_LINE> <INDENT> swagger_types = { 'photo_image_format': 'str', 'base64_data': 'str', 'discriminator': 'str' } <NEW_LINE> attribute_map = { 'photo_image_format': 'photoImageFormat', 'base64_data': 'base64Data', 'discriminator': 'discriminator' } <NEW_LINE> def __init__(self, ... | Contains data and type of contact's photo.
| 62598f1aad47b63b2c5a6543 |
class PolarisFile(PolarisStage): <NEW_LINE> <INDENT> def _write(self, userid, uuid, content, *args, **kwargs): <NEW_LINE> <INDENT> target_dir = os.path.join(kwargs.get('prefix', '/tmp'), userid) <NEW_LINE> if not os.path.exists(target_dir): <NEW_LINE> <INDENT> os.mkdir(target_dir) <NEW_LINE> <DEDENT> path = os.path.joi... | File
File represents the local file system write/read operations | 62598f1ac4546d3d9def6900 |
class Proxy(ProxyBase): <NEW_LINE> <INDENT> def __init__(self, msggen, router, *, timeout=None): <NEW_LINE> <INDENT> super().__init__(msggen) <NEW_LINE> self._router = router <NEW_LINE> self._timeout = timeout <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> extra = '' if (self._timeout is None) else f', tim... | A blocking proxy for calling D-Bus methods via a :class:`DBusRouter`.
You can call methods on the proxy object, such as ``bus_proxy.Hello()``
to make a method call over D-Bus and wait for a reply. It will either
return a tuple of returned data, or raise :exc:`.DBusErrorResponse`.
The methods available are defined by t... | 62598f1aad47b63b2c5a6544 |
class MoveFileOrFolderResultSet(ResultSet): <NEW_LINE> <INDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | Retrieve the value for the "Response" output from this choreography execution. ((xml) The response from Box.net.) | 62598f1a9f2886367281752e |
class IntroductionText(Element): <NEW_LINE> <INDENT> XMLNAME = 'introductionText' <NEW_LINE> XMLCONTENT = xml.ElementType.Mixed | The Block's introductory text. | 62598f1a4c3428357761900b |
class IsVisible(Condition): <NEW_LINE> <INDENT> def check(self, instance): <NEW_LINE> <INDENT> return instance.visible | Is entry zone visible? | 62598f1a9f2886367281752f |
class ConfigurationError(ValueError): <NEW_LINE> <INDENT> pass | Generic error thrown if there was an error while reading the scenario file. | 62598f1aad47b63b2c5a6545 |
class TestGrid(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.grid = grid.Grid <NEW_LINE> self.cell = grid.Cell <NEW_LINE> <DEDENT> def test_grid_exists(self): <NEW_LINE> <INDENT> self.assertIsNotNone(self.grid) <NEW_LINE> self.assertEqual(self.grid, grid.Grid) <NEW_LINE> <DEDENT> def... | Unit tests for the min module | 62598f1a31939e2706ed10fd |
class ParametersLink(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'uri': {'required': True}, } <NEW_LINE> _attribute_map = { 'uri': {'key': 'uri', 'type': 'str'}, 'content_version': {'key': 'contentVersion', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, uri: str, content_version: Optional[str]... | Entity representing the reference to the deployment parameters.
All required parameters must be populated in order to send to Azure.
:ivar uri: Required. URI referencing the template.
:vartype uri: str
:ivar content_version: If included it must match the ContentVersion in the template.
:vartype content_version: str | 62598f1a0fa83653e46f3c1b |
class IndexedAndOneLevelSearchTests(SearchTests): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(IndexedAndOneLevelSearchTests, self).setUp() <NEW_LINE> self.l.add({"dn": "@INDEXLIST", "@IDXATTR": [b"x", b"y", b"ou"], "@IDXONE": [b"1"]}) <NEW_LINE> self.IDX = True | Test searches using the index including @IDXONE, to ensure
the index doesn't break things | 62598f1a099cdd3c63674a72 |
class InvalidLiteralError(DecodingException): <NEW_LINE> <INDENT> def __init__(self, state_or_node, code_point, code_point_esc, comment=None): <NEW_LINE> <INDENT> self.state_or_node = state_or_node <NEW_LINE> self.code_point = code_point <NEW_LINE> self.code_point_esc = code_point_esc <NEW_LINE> self.comment = comment ... | Code point that is not allowed to appear literally has appeared. | 62598f1aec188e330fdf75ef |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.