code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Tape: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.reset() <NEW_LINE> <DEDENT> def inc_val(self): <NEW_LINE> <INDENT> self.cells[self.pointer] += 1 <NEW_LINE> <DEDENT> def dec_val(self): <NEW_LINE> <INDENT> self.cells[self.pointer] -= 1 <NEW_LINE> <DEDENT> def move_right(self): <NEW_LINE> <IND... | A generic implementation of a record tape for a Turing Machine.
It's bounded on the left side and unbounded on the right side.
It stores only Python integers. | 6259906529b78933be26ac6b |
class Normalize(object): <NEW_LINE> <INDENT> def __init__(self, vmin=None, vmax=None, clip=False): <NEW_LINE> <INDENT> self.vmin = vmin <NEW_LINE> self.vmax = vmax <NEW_LINE> self.clip = clip <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def process_value(value): <NEW_LINE> <INDENT> is_scalar = not cbook.iterable(value)... | A class which, when called, can normalize data into
the ``[0.0, 1.0]`` interval. | 625990657cff6e4e811b7195 |
class Payment(Operation): <NEW_LINE> <INDENT> _XDR_OPERATION_TYPE: stellar_xdr.OperationType = stellar_xdr.OperationType.PAYMENT <NEW_LINE> def __init__( self, destination: str, asset: Asset, amount: Union[str, Decimal], source: str = None, ) -> None: <NEW_LINE> <INDENT> super().__init__(source) <NEW_LINE> check_amount... | The :class:`Payment` object, which represents a Payment operation on
Stellar's network.
Sends an amount in a specific asset to a destination account.
Threshold: Medium
:param destination: The destination account ID.
:param asset: The asset to send.
:param amount: The amount to send.
:param source: The source account... | 62599065a17c0f6771d5d74d |
class GlobalNotification(rdf_structs.RDFProtoStruct): <NEW_LINE> <INDENT> protobuf = jobs_pb2.GlobalNotification <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(GlobalNotification, self).__init__(*args, **kwargs) <NEW_LINE> if not self.duration: <NEW_LINE> <INDENT> self.duration = rdfvalue.Dur... | Global notification shown to all the users of GRR. | 62599065379a373c97d9a76c |
class UnsupportedProxyURI(PublisherError): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> if self.data: <NEW_LINE> <INDENT> scheme = urlsplit(self.data, allow_fragments=0)[0] <NEW_LINE> return _("The proxy URI '{uri}' uses the unsupported " "scheme '{scheme}'. Currently the only supported " "scheme is http:... | Used to indicate that the specified proxy URI is unsupported. | 625990659c8ee82313040d2f |
class OutputTests(unittest.TestCase): <NEW_LINE> <INDENT> def test_mad_dots(self): <NEW_LINE> <INDENT> for identifier in ["example", "example.1a", "example.1.2", "example.1-2"]: <NEW_LINE> <INDENT> old = SeqRecord( Seq("ACGT"), id=identifier, name=identifier, description="mad dots", annotations={"molecule_type": "DNA"}... | GenBank output tests. | 62599065f548e778e596ccd8 |
class MixFeatures(FeatureExtractBase): <NEW_LINE> <INDENT> def __init__(self, features_list): <NEW_LINE> <INDENT> self.features_list = features_list <NEW_LINE> <DEDENT> def extract(self, instance): <NEW_LINE> <INDENT> feature_class_dict = {"ARFeatures":ARFeatures, "FFTFeatures":FFTFeatures, "PLVFeatures":PLVFeatures, "... | Class to concatenate output of individual feature classes.
@author V&J | 625990657047854f46340b02 |
class SPLexRank(ya_summarizer): <NEW_LINE> <INDENT> def __init__(self,q,words): <NEW_LINE> <INDENT> self.question = q <NEW_LINE> self.words_limit = words <NEW_LINE> print(q.get_author()) <NEW_LINE> nbest_total_words = 0 <NEW_LINE> nbest = q.get_nbest() <NEW_LINE> for ans in nbest: <NEW_LINE> <INDENT> content = ans.get_... | tfidf matrix => graph => pagerank => lexrank scores | 6259906521bff66bcd7243b4 |
class PavoException(Exception): <NEW_LINE> <INDENT> def __init__(self, message: Optional[str] = None): <NEW_LINE> <INDENT> super().__init__(message or self.__doc__) | Pavo's BaseException-like Exception class, uses docstrings to set default error messages. | 625990658e71fb1e983bd214 |
class TestConfiguration(unittest.TestCase): <NEW_LINE> <INDENT> def test_defaults(self): <NEW_LINE> <INDENT> _, temp_config_path = tempfile.mkstemp() <NEW_LINE> self.addCleanup(os.remove, temp_config_path) <NEW_LINE> with open(temp_config_path, 'w') as temp_config: <NEW_LINE> <INDENT> temp_config.write(yaml.dump({})) <... | Test out configuration defaults, loading yaml/environ config,
etc. | 62599065b7558d5895464ad6 |
class _DirectoryBase(object): <NEW_LINE> <INDENT> def walk(self, top=None, class_pattern=None): <NEW_LINE> <INDENT> return utils.walk(self, top, class_pattern=class_pattern) <NEW_LINE> <DEDENT> def __getattr__(self, attr): <NEW_LINE> <INDENT> return self.Get(attr) <NEW_LINE> <DEDENT> def __getitem__(self, name): <NEW_L... | A mixin (can't stand alone). To be improved. | 6259906597e22403b383c65c |
class Histogram(object): <NEW_LINE> <INDENT> def __init__(self, data, scale=20, formatter=None): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.scale = scale <NEW_LINE> self.formatter = formatter or str <NEW_LINE> self.max_key_len = max([len(str(key)) for key, count in self.data]) <NEW_LINE> self.total = sum([cou... | A histogram generating object.
This object serves the sole purpose of formatting (key, val) pairs as an
ASCII histogram, including bars and percentage markers, and taking care of
label alignment, scaling, etc. In addition to the standard __init__
interface, two static methods are provided for conveniently converting d... | 62599065097d151d1a2c27bb |
class TCPServer(object): <NEW_LINE> <INDENT> is_workflow = True <NEW_LINE> def __init__(self, network_endpoint): <NEW_LINE> <INDENT> self.network_endpoint = network_endpoint <NEW_LINE> self.established_connections = set() <NEW_LINE> <DEDENT> def wait_for_syns(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> s... | Models the tasks and state fof a TCP server. | 625990654f88993c371f10c6 |
class EMM_STATUS(Layer3NASEMM): <NEW_LINE> <INDENT> constructorList = [ie for ie in EMMHeader(Type=96)] + [ Int('EMMCause', Pt=0, Type='uint8', Dict=EMMCause_dict)] | Net <-> UE
Local | 62599065462c4b4f79dbd155 |
class PointerType(ScalarType): <NEW_LINE> <INDENT> def __init__(self, datatype, label_get): <NEW_LINE> <INDENT> super().__init__('pointer', constant=None) <NEW_LINE> self.datatype = datatype <NEW_LINE> self.label_get = label_get <NEW_LINE> <DEDENT> def from_data(self, rom, offset, project, context, parents): <NEW_LINE>... | Class to models pointers. | 62599065f548e778e596ccd9 |
class LocationEvent(BaseEvent): <NEW_LINE> <INDENT> event = "location" <NEW_LINE> latitude = FloatField("Latitude", 0.0) <NEW_LINE> longitude = FloatField("Longitude", 0.0) <NEW_LINE> precision = FloatField("Precision", 0.0) | 上报地理位置事件
详情请参阅
https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_event_pushes.html | 62599065baa26c4b54d509f4 |
class DistillKL(nn.Module): <NEW_LINE> <INDENT> def __init__(self, T): <NEW_LINE> <INDENT> super(DistillKL, self).__init__() <NEW_LINE> self.T = T <NEW_LINE> <DEDENT> def forward(self, y_s, y_t): <NEW_LINE> <INDENT> p_s = F.log_softmax(y_s/self.T, dim=1) <NEW_LINE> p_t = F.softmax(y_t/self.T, dim=1) <NEW_LINE> loss = F... | KL divergence for distillation | 62599065d486a94d0ba2d718 |
@skipIf(NO_MOCK, NO_MOCK_REASON) <NEW_LINE> @skipIf(not HAS_PYVMOMI, 'The \'pyvmomi\' library is missing') <NEW_LINE> class GetPropertiesOfManagedObjectTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> patches = ( ('salt.utils.vmware.get_service_instance_from_managed_object', MagicMock()), ('... | Tests for salt.utils.get_properties_of_managed_object | 6259906545492302aabfdc2c |
class AlphabeticalIndex(Report): <NEW_LINE> <INDENT> def __init__(self, database, options, user): <NEW_LINE> <INDENT> Report.__init__(self, database, options, user) <NEW_LINE> self._user = user <NEW_LINE> menu = options.menu <NEW_LINE> <DEDENT> def write_report(self): <NEW_LINE> <INDENT> self.doc.insert_index() | This report class generates an alphabetical index for a book. | 6259906571ff763f4b5e8ef7 |
class _Col(object): <NEW_LINE> <INDENT> def __init__(self, data=None): <NEW_LINE> <INDENT> if data == None: <NEW_LINE> <INDENT> self.__data = [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__data = data <NEW_LINE> <DEDENT> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> return self.__data[key] <NEW_LINE... | Please don't use this. | 62599065379a373c97d9a76e |
class FieldOrientedDrive(DriveInterface): <NEW_LINE> <INDENT> def __init__(self, interface, ahrs, offset=0.0): <NEW_LINE> <INDENT> self.interface = interface <NEW_LINE> self.ahrs = ahrs <NEW_LINE> self.origin = 0.0 <NEW_LINE> self.offset = offset <NEW_LINE> <DEDENT> def zero(self): <NEW_LINE> <INDENT> self.origin = sel... | Wraps another drive interface, and provides field orientation. | 625990657c178a314d78e794 |
class BlameRepoState(Persistable): <NEW_LINE> <INDENT> TEMPLATE = {'sha_date_author': lambda: {}} | Repository level persisted data structures
Currently this is just sha_date_author. | 625990654428ac0f6e659c82 |
class Garlicoin(Bitcoin): <NEW_LINE> <INDENT> name = 'garlicoin' <NEW_LINE> symbols = ('GRLC', ) <NEW_LINE> seeds = ('dnsseed.brennanmcdonald.io', 'dnsseed.rshaw.space', ) <NEW_LINE> port = 42069 <NEW_LINE> message_start = b'\xd2\xc6\xb6\xdb' <NEW_LINE> base58_prefixes = { 'PUBKEY_ADDR': 38, 'SCRIPT_ADDR': 5, 'SECRET_K... | Class with all the necessary Garlicoin (GRLC) network information based on
https://github.com/GarlicoinOrg/Garlicoin/blob/master/src/chainparams.cpp
(date of access: 02/16/2018) | 6259906555399d3f05627c71 |
class TestTumDataloader(object): <NEW_LINE> <INDENT> path = "/home/akashsharma/Documents/datasets/tum/rgbd_dataset_freiburg1_xyz/" <NEW_LINE> sequence = "1" <NEW_LINE> def test_init(self): <NEW_LINE> <INDENT> with pytest.raises(AssertionError): <NEW_LINE> <INDENT> tum = loader.TumDataloader("/home/akashsharma/Documents... | Docstring for TestTumDataloader. | 625990650c0af96317c57907 |
class GroupManager(models.Manager): <NEW_LINE> <INDENT> def get_queryset(self): <NEW_LINE> <INDENT> return GroupQuerySet(self.model, using=self._db) <NEW_LINE> <DEDENT> def active(self, *args, **kwargs): <NEW_LINE> <INDENT> return self.get_queryset().active(*args, **kwargs) <NEW_LINE> <DEDENT> def inactive(self, *args,... | Group model manager. | 625990656e29344779b01da0 |
class TwoLayerNet: <NEW_LINE> <INDENT> def __init__(self, n_input, n_output, hidden_layer_size, reg): <NEW_LINE> <INDENT> self.fcl1 = FullyConnectedLayer(n_input, hidden_layer_size) <NEW_LINE> self.fcl2 = FullyConnectedLayer(hidden_layer_size, n_output) <NEW_LINE> self.relu = ReLULayer() <NEW_LINE> self.reg = reg <NEW_... | Neural network with two fully connected layers | 62599065442bda511e95d902 |
class RGetopt(RPackage): <NEW_LINE> <INDENT> homepage = "https://github.com/trevorld/getopt" <NEW_LINE> url = "https://cloud.r-project.org/src/contrib/getopt_1.20.1.tar.gz" <NEW_LINE> list_url = "https://cloud.r-project.org/src/contrib/Archive/getopt" <NEW_LINE> version('1.20.3', sha256='531f5fdfdcd6b96a73df2b3992... | Package designed to be used with Rscript to write "#!" shebang scripts
that accept short and long flags/options. Many users will prefer using
instead the packages optparse or argparse which add extra features like
automatically generated help option and usage, support for default
values, positional argument support, et... | 6259906545492302aabfdc2d |
class ReadResult(object): <NEW_LINE> <INDENT> def __init__(self, value=None, vector_clock=None,): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self.vector_clock = vector_clock <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CRe... | Attributes:
- value
- vector_clock | 62599065d268445f2663a705 |
class NyRemoveGroupRoleEvent(object): <NEW_LINE> <INDENT> implements(INyRemoveGroupRoleEvent) <NEW_LINE> def __init__(self, context, group, roles): <NEW_LINE> <INDENT> super(NyRemoveGroupRoleEvent, self).__init__() <NEW_LINE> self.context, self.group, self.roles = context, group, roles | Group roles will be removed | 6259906566673b3332c31b4e |
class Tag(Base): <NEW_LINE> <INDENT> name = Column(String(64), unique = False, nullable = False) <NEW_LINE> opportunities = relationship('Opportunity', secondary = tags, back_populates = 'tags') <NEW_LINE> users_following = relationship('User', secondary = tags_following, back_populates = 'tags_following') <NEW_LINE> d... | Tag model to store a tag for an opportunity | 62599065d7e4931a7ef3d72e |
class Match(object): <NEW_LINE> <INDENT> def __init__(self, match_results): <NEW_LINE> <INDENT> if match_results.shape.ndims != 1: <NEW_LINE> <INDENT> raise ValueError('match_results should have rank 1') <NEW_LINE> <DEDENT> if match_results.dtype != tf.int32: <NEW_LINE> <INDENT> raise ValueError('match_results should b... | Class to store results from the matcher.
This class is used to store the results from the matcher. It provides
convenient methods to query the matching results. | 62599065cb5e8a47e493cd2d |
class CsvContainer(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._name = '' <NEW_LINE> self._telephone = None <NEW_LINE> reload(sys) <NEW_LINE> sys.setdefaultencoding("utf-8") <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return self._name <NEW_LINE> <DEDENT> @... | CSVの定形フォーマットで保持するクラス | 625990653539df3088ecd9f0 |
class PkgStatus(BASE): <NEW_LINE> <INDENT> __tablename__ = 'pkg_status' <NEW_LINE> status = sa.Column(sa.String(50), primary_key=True) <NEW_LINE> def __init__(self, status): <NEW_LINE> <INDENT> self.status = status <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def all_txt(cls, session): <NEW_LINE> <INDENT> return [ item.... | Table storing the statuses a package can have. | 6259906556b00c62f0fb401f |
class GitPathTool(object): <NEW_LINE> <INDENT> _cwd = None <NEW_LINE> _root = None <NEW_LINE> @classmethod <NEW_LINE> def set_cwd(cls, cwd): <NEW_LINE> <INDENT> if isinstance(cwd, six.binary_type): <NEW_LINE> <INDENT> cwd = cwd.decode(sys.getdefaultencoding()) <NEW_LINE> <DEDENT> cls._cwd = cwd <NEW_LINE> cls._root = c... | Converts `git diff` paths to absolute paths or relative paths to cwd.
This class should be used throughout the project to change paths from
the paths yielded by `git diff` to correct project paths | 625990655166f23b2e244b22 |
class _LSE(ABC): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def solve(self, coeficients, results): <NEW_LINE> <INDENT> ... | Interface for Least Square Estimation methods | 625990652ae34c7f260ac839 |
class VolumeAttachment(BASE, CinderBase): <NEW_LINE> <INDENT> __tablename__ = 'volume_attachment' <NEW_LINE> id = sa.Column(sa.String(36), primary_key=True) <NEW_LINE> volume_id = sa.Column( sa.String(36), sa.ForeignKey('volumes.id'), nullable=False, index=True ) <NEW_LINE> volume = relationship( Volume, backref="volum... | Represents a volume attachment for a vm. | 625990652ae34c7f260ac83a |
class CountingAI(AIMixin): <NEW_LINE> <INDENT> ... | Representation
==============
Count number of pieces of all players in each megatile. Use the representation
of the megatile the AI should play in linked to the number of pieces in the
other megatiles as a key to learn.
E.g. (this is probably an illegal board)
| | | | | | | |
-+-+- | -+-+- | -+-+-
X| |X | |O| ... | 62599065aad79263cf42ff0f |
class StorageVolumeManager(BaseManager): <NEW_LINE> <INDENT> def __init__(self, storage_group): <NEW_LINE> <INDENT> query_props = [ 'name', 'fulfillment-state', 'maximum-size', 'minimum-size', 'usage', ] <NEW_LINE> super(StorageVolumeManager, self).__init__( resource_class=StorageVolume, class_name=RC_STORAGE_VOLUME, s... | Manager providing access to the :term:`storage volumes <storage volume>`
in a particular :term:`storage group`.
Derived from :class:`~zhmcclient.BaseManager`; see there for common methods
and attributes.
Objects of this class are not directly created by the user; they are
accessible via the following instance variabl... | 625990657047854f46340b06 |
@six.add_metaclass(ABCMeta) <NEW_LINE> class Protocol(object): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def data_received(self, data): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def connection_made(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def conn... | Interface for various protocols.
Protocol usually encloses a transport/connection/socket to
peer/client/server and encodes and decodes communication/messages. Protocol
can also maintain any related state machine, protocol message encoding or
decoding utilities. This interface identifies minimum methods to support to
f... | 62599065f548e778e596ccdc |
class MetricDefinition(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, 'category': {'key': 'category', 'type': 'str'}, 'unit': {'key': 'un... | Metric definition class specifies the metadata for a metric.
:param resource_id: The resource identifier of the resource that emitted the metric.
:type resource_id: str
:param resource_uri: The resource identifier of the resource that emitted the metric.
:type resource_uri: str
:param name: the name and the display na... | 625990657c178a314d78e795 |
class Guild: <NEW_LINE> <INDENT> @classmethod <NEW_LINE> async def convert(cls, ctx, arg): <NEW_LINE> <INDENT> guild = None <NEW_LINE> if arg.isdigit(): <NEW_LINE> <INDENT> guild = ctx.bot.get_guild(int(arg)) <NEW_LINE> <DEDENT> if not guild: <NEW_LINE> <INDENT> guild = ctx.bot.find_guild(arg) <NEW_LINE> <DEDENT> retur... | Convert Guild object by ID or name.
Returns
--------
:class:`discord.Guild` | 62599065fff4ab517ebcef6e |
class QueryInputSet(InputSet): <NEW_LINE> <INDENT> def set_Components(self, value): <NEW_LINE> <INDENT> super(QueryInputSet, self)._set_input('Components', value) <NEW_LINE> <DEDENT> def set_SetID(self, value): <NEW_LINE> <INDENT> super(QueryInputSet, self)._set_input('SetID', value) | An InputSet with methods appropriate for specifying the inputs to the Query
Choreo. The InputSet object is used to specify input parameters when executing this Choreo. | 6259906532920d7e50bc7799 |
class C51ClassicControlPreset(Preset): <NEW_LINE> <INDENT> def __init__(self, env, name, device, **hyperparameters): <NEW_LINE> <INDENT> super().__init__(name, device, hyperparameters) <NEW_LINE> self.model = hyperparameters['model_constructor'](env, atoms=hyperparameters['atoms']).to(device) <NEW_LINE> self.n_actions ... | Categorical DQN (C51) Atari preset.
Args:
env (all.environments.AtariEnvironment): The environment for which to construct the agent.
name (str): A human-readable name for the preset.
device (torch.device): The device on which to load the agent.
Keyword Args:
discount_factor (float): Discount factor fo... | 62599065009cb60464d02c8b |
class WHavenSpider: <NEW_LINE> <INDENT> def __init__(self,topic_url): <NEW_LINE> <INDENT> self.topic_url = topic_url <NEW_LINE> <DEDENT> def getHtml(self,url): <NEW_LINE> <INDENT> req = requests.get(url) <NEW_LINE> html = req.content <NEW_LINE> return html <NEW_LINE> <DEDENT> def selectPartlist(self,html): <NEW_LINE> <... | 用于爬取WallHaven高清壁纸 | 625990650a50d4780f706969 |
class LyricMode(InputMode): <NEW_LINE> <INDENT> pass | A \lyricmode, \lyrics or \addlyrics expression. | 62599065097d151d1a2c27bf |
class AuthenticationError(Exception): <NEW_LINE> <INDENT> pass | Error authenticating | 625990658da39b475be0493c |
class AttributesEqual(Validator): <NEW_LINE> <INDENT> message = u"{a} and {b} must be equal." <NEW_LINE> def __init__(self, a, b): <NEW_LINE> <INDENT> self.a = a <NEW_LINE> self.b = b <NEW_LINE> <DEDENT> def validate(self, element, context): <NEW_LINE> <INDENT> if (not self.is_unusable(element) and getattr(element, sel... | Validator that fails with :attr:`message` if two attributes of the value
are unequal.
Similar to :class:`ItemsEqual` the attributes are defined with the tuples
`a` and `b` each of which consists of two element in the form ``(label,
attribute_name)``. `attribute_name` is used to determine the attributes to
compare and ... | 625990654e4d562566373b5a |
class Context(object): <NEW_LINE> <INDENT> def __init__(self, handle_error): <NEW_LINE> <INDENT> print('__init__({})'.format(handle_error)) <NEW_LINE> self.handle_error = handle_error <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> print('__enter__()') <NEW_LINE> return self <NEW_LINE> <DEDENT> def __exit_... | from Doug Hellmann, PyMOTW
http://pymotw.com/2/contextlib/#module-contextlib | 62599065a219f33f346c7f5a |
class InputReader(TokenReader): <NEW_LINE> <INDENT> def next_token(self): <NEW_LINE> <INDENT> return input() | Token reader that reads tokens from standard input. | 6259906501c39578d7f142de |
class InvalidMerchant(ValueError): <NEW_LINE> <INDENT> pass | Provided order belongs to a different merchant! | 625990651f5feb6acb16433f |
class ExtraUploadForm(UploadForm): <NEW_LINE> <INDENT> author_name = forms.CharField( label=_('Author name'), required=False, help_text=_('Leave empty for using currently logged in user.') ) <NEW_LINE> author_email = forms.EmailField( label=_('Author email'), required=False, help_text=_('Leave empty for using currently... | Advanced upload form for users who can override authorship. | 62599065f548e778e596ccdd |
class pg_functions(functions): <NEW_LINE> <INDENT> class svg(BaseFunction): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> class kml(BaseFunction): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> class gml(BaseFunction): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> class geojson(BaseFunction): <NEW_LINE> <INDENT> pass <NEW_... | Functions only supported by PostGIS
| 625990652c8b7c6e89bd4f42 |
@command_lib.CommandRegexParser(r's ' r'/?(?:"(.+?)"|([\S]+))' r'/(?:"(.*?)"|([\S]*))' r'(?:/(.*?))?' r' ([\s\S]+?)') <NEW_LINE> class SubCommand(command_lib.BaseCommand): <NEW_LINE> <INDENT> @command_lib.MainChannelOnly <NEW_LINE> @command_lib.LimitPublicLines() <NEW_LINE> def _Handle(self, channel: Channel, user: str... | Substitute lines according to a pattern. | 625990654a966d76dd5f0649 |
class ReceiveSignal(QtCore.QObject): <NEW_LINE> <INDENT> sig_mqtt_message = QtCore.pyqtSignal(mqtt.MQTTMessage) | Why a whole new class? See here:
https://stackoverflow.com/a/25930966/2441026 | 62599065baa26c4b54d509f8 |
class ActionList(Receiver): <NEW_LINE> <INDENT> def __init__(self, actions=None): <NEW_LINE> <INDENT> if isinstance(actions, (str, dict)): <NEW_LINE> <INDENT> actions = [actions] <NEW_LINE> <DEDENT> self.actions = tuple(Action.make(a) for a in actions or ()) <NEW_LINE> <DEDENT> def set_project(self, project): <NEW_LINE... | A list of Actions. | 6259906576e4537e8c3f0cd6 |
class TvShow(Video): <NEW_LINE> <INDENT> VALID_RATINGS = ["TV-Y", "TV-Y7", "TV-G", "TV-PG", "TV-14", "TV-MA"] <NEW_LINE> def __init__(self, details): <NEW_LINE> <INDENT> Video.__init__(self, details) <NEW_LINE> self.seasons = details['seasons'] <NEW_LINE> self.network_url = details['network_url'] <NEW_LINE> self.rating... | Holds and provides information on a Television show. | 62599065d7e4931a7ef3d72f |
class InitFromCheckpointHook(tf.estimator.SessionRunHook): <NEW_LINE> <INDENT> def __init__(self, model_dir, ckpt_to_init_from, vars_to_restore_fn=None): <NEW_LINE> <INDENT> self._ckpt = None if tf.train.latest_checkpoint( model_dir) else ckpt_to_init_from <NEW_LINE> self._vars_to_restore_fn = vars_to_restore_fn <NEW_L... | A hook for initializing training from a checkpoint.
Although the Estimator framework supports initialization from a checkpoint via
https://www.tensorflow.org/api_docs/python/tf/estimator/WarmStartSettings,
the only way to build mapping between the variables and the checkpoint names
is via providing a regex. This class... | 625990657b25080760ed888b |
class AvrStaticInfoMessage(AvrMessage): <NEW_LINE> <INDENT> def __init__(self, state): <NEW_LINE> <INDENT> super().__init__('static_info', {}, state) | An AvrMessage containing the static avr information | 62599065627d3e7fe0e085de |
class SpatialAnalysisOperationFocus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): <NEW_LINE> <INDENT> CENTER = "center" <NEW_LINE> BOTTOM_CENTER = "bottomCenter" <NEW_LINE> FOOTPRINT = "footprint" | The operation focus type.
| 625990657c178a314d78e796 |
class UserCustomAction(BaseEntity): <NEW_LINE> <INDENT> @property <NEW_LINE> def client_side_component_id(self): <NEW_LINE> <INDENT> return self.properties.get("ClientSideComponentId", None) <NEW_LINE> <DEDENT> @property <NEW_LINE> def script_block(self): <NEW_LINE> <INDENT> return self.properties.get("ScriptBlock", No... | Represents a custom action associated with a SharePoint list, Web site, or subsite. | 62599065fff4ab517ebcef70 |
class CustomerFollowUp(models.Model): <NEW_LINE> <INDENT> customer = models.ForeignKey("Customer", on_delete=models.CASCADE) <NEW_LINE> content = models.TextField(verbose_name="跟进内容") <NEW_LINE> consultant = models.ForeignKey("UserProfile", on_delete=models.CASCADE) <NEW_LINE> intention_choices = ((0, '2周内报名'), (1, '1个... | 客户跟进表 | 625990656e29344779b01da4 |
class BoreholeForm(ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Borehole <NEW_LINE> fields = [ "borehole_reference", "borehole_northing", "borehole_easting", "ground_level", "drilling_equipment", "borehole_diameter" ] | Form for creating and updating borehole details. | 625990658e71fb1e983bd21a |
class Colorstr(str): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> self._msg = str(msg) <NEW_LINE> super().__init__() <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def from_built_in_type(o: object): <NEW_LINE> <INDENT> return Colorstr(print(o, raw=True)) <NEW_LINE> <DEDENT> def __add__(self, other): <... | 带颜色的字符串类 | 62599065442bda511e95d904 |
class SkipTestException(TestException): <NEW_LINE> <INDENT> pass | Exception class for reporting skipped test cases. | 62599065009cb60464d02c8d |
class UpdateCommentV1(UpdateMessage): <NEW_LINE> <INDENT> body_schema = { 'id': f'{SCHEMA_URL}/v1/bodhi.update.comment#', '$schema': 'http://json-schema.org/draft-04/schema#', 'description': 'Schema for message sent when a comment is added to an update', 'type': 'object', 'properties': { 'comment': { 'type': 'object', ... | Sent when a comment is made on an update. | 62599065462c4b4f79dbd15b |
class State(Base): <NEW_LINE> <INDENT> __tablename__ = "states" <NEW_LINE> id = Column(Integer, nullable=False, primary_key=True) <NEW_LINE> name = Column(String(128), nullable=False) | State Class containing id and name definitions | 625990651f037a2d8b9e5415 |
class ListarEmpresasView(generics.ListAPIView): <NEW_LINE> <INDENT> serializer_class = ClienteSerializer <NEW_LINE> queryset = Cliente.objects.all() | Permite listar empresas. | 625990654f88993c371f10c9 |
class SubmissionTracker(object): <NEW_LINE> <INDENT> def __init__(self, analysis_client, task_completion=None): <NEW_LINE> <INDENT> self.__analysis_client = analysis_client <NEW_LINE> if not task_completion: <NEW_LINE> <INDENT> task_completion = TaskCompletion(analysis_client) <NEW_LINE> <DEDENT> self.__task_completion... | Helper class to track the state of submissions until they're completed
:param analysis_client: analysis_apiclient.AnalysisClientBase
:param task_completion: analysis_apiclient.TaskCompletion or None
If not provided, will create one from the analysis_client.
Providing this parameter explicitly is mainly for tes... | 62599065a219f33f346c7f5b |
class PFDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, csv_file, training_image_path,output_size=(240,240),transform=None): <NEW_LINE> <INDENT> self.out_h, self.out_w = output_size <NEW_LINE> self.train_data = pd.read_csv(csv_file) <NEW_LINE> self.img_A_names = self.train_data.iloc[:,0] <NEW_LINE> self.img_B_... | Proposal Flow image pair dataset
Args:
csv_file (string): Path to the csv file with image names and transformations.
training_image_path (string): Directory with the images.
output_size (2-tuple): Desired output size
transform (callable): Transformation for post-processing the training pair (eg. image... | 62599065435de62698e9d55e |
class TCPServer(socketserver.ForkingTCPServer): <NEW_LINE> <INDENT> def server_bind(self): <NEW_LINE> <INDENT> self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) <NEW_LINE> self.socket.bind(self.server_address) | Our server with custom server_bind() | 62599065ac7a0e7691f73c3a |
class InlineResponse20012(object): <NEW_LINE> <INDENT> swagger_types = { 'params': 'InlineResponse20012Params' } <NEW_LINE> attribute_map = { 'params': 'params' } <NEW_LINE> def __init__(self, params=None): <NEW_LINE> <INDENT> self._params = None <NEW_LINE> self.discriminator = None <NEW_LINE> if params is not None: <N... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 625990654e4d562566373b5d |
class DataSourceCSVSignal(DataSource): <NEW_LINE> <INDENT> def __init__(self, data, **kwargs): <NEW_LINE> <INDENT> assert isinstance(data, csv.DictReader) <NEW_LINE> self.data = data <NEW_LINE> self.source_id = kwargs.get("source_id", None) <NEW_LINE> self.start = kwargs.get('start') <NEW_LINE> self.end = kwargs.get('e... | expects dictReader for a csv file in form with header
dt, sid, signal
dt expected in ISO format | 62599065dd821e528d6da52c |
class ClusterProbabilityPrediction(ClusterPrediction): <NEW_LINE> <INDENT> def predict(self, test: pd.DataFrame) -> pd.DataFrame: <NEW_LINE> <INDENT> indx_clusters = [] <NEW_LINE> for i in range(self.n_clusters): <NEW_LINE> <INDENT> cluster = test.loc[self.clusters_test == i, :] <NEW_LINE> prediction = self.models[i].p... | Predict the probability for each class using clustering | 6259906538b623060ffaa3fc |
class MissingConfigValue(Exception): <NEW_LINE> <INDENT> pass | General exception catch all for missing config values | 625990658a43f66fc4bf38e6 |
class EventList(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.events = [] <NEW_LINE> <DEDENT> def add(self, event): <NEW_LINE> <INDENT> self.events.append(event) <NEW_LINE> <DEDENT> def unprocessed_events(self): <NEW_LINE> <INDENT> return [e for e in self.events if not e.is_processed] <NEW_L... | see http://martinfowler.com/eaaDev/AgreementDispatcher.html | 625990655166f23b2e244b26 |
class InvalidRequest(Exception): <NEW_LINE> <INDENT> pass | invalid request argument | 625990652ae34c7f260ac83d |
class Darker(Density): <NEW_LINE> <INDENT> _name = 'darker' <NEW_LINE> def __init__(self, override_name=None, bit_depth=8, max_output_value=None, eps=1e-5, data_mean=None): <NEW_LINE> <INDENT> Density.__init__(self, override_name=override_name, bit_depth=bit_depth, max_output_value=max_output_value, dmin=0, mmult=40, e... | The density remap using parameters for darker results. | 625990652ae34c7f260ac83e |
class EntityFieldsMetaClass(type): <NEW_LINE> <INDENT> def __new__(mcs, class_name, bases, class_attrs): <NEW_LINE> <INDENT> schema = class_attrs.get("_schema") <NEW_LINE> if schema: <NEW_LINE> <INDENT> for f_name, f in schema.fields.items(): <NEW_LINE> <INDENT> class_attrs[f_name] = EntityFieldDescriptor(f_name) <NEW_... | Magic: we take fields info from class._schema and attach EntityFieldDescriptor
to Resource classes | 62599065f548e778e596cce0 |
class LocalizedString(fields.String): <NEW_LINE> <INDENT> def format(self, value): <NEW_LINE> <INDENT> return fields.String.format(self, _(value)) | Custom LocalizedString to return localized strings | 625990657c178a314d78e797 |
class GroupPipelineSearch(): <NEW_LINE> <INDENT> __groupRank__ = {'CBC' :1, 'Burst':0, } <NEW_LINE> __pipelineRank__ = {'gstlal' :0, 'MBTAOnline' :0, 'pycbc' :0, 'gstlal-spiir':0, 'CWB' :0, 'LIB' :0, } <NEW_LINE> __searchRank__ = {'LowMass' :1, 'HighMass':1, 'AllSky' :1, '' :0,... | a simple wrapper for the group_pipeline_search combinations that knows how to compare them and find a preference
this is done by mapping group, pipeline, search combinations into integers and then comparing the integers
NOTE: bigger things are more preferred and the relative ranking is hard coded into immutable attri... | 62599065fff4ab517ebcef72 |
class ToTensor(object): <NEW_LINE> <INDENT> def __call__(self, sample): <NEW_LINE> <INDENT> image, category = sample['image'], sample['category'] <NEW_LINE> if len(image.shape) == 2: <NEW_LINE> <INDENT> image = image.reshape(image.shape[0], image.shape[1], 1) <NEW_LINE> <DEDENT> image = image.transpose((2, 0, 1)) <NEW_... | Convert ndarrays to Tensors | 62599065009cb60464d02c8f |
class Events(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=50) <NEW_LINE> date = models.DateField(default=timezone.now) <NEW_LINE> image_url = models.CharField(max_length=1000) <NEW_LINE> description = models.CharField(max_length=1000) <NEW_LINE> link = models.URLField() <NEW_LINE> def __unicod... | The Events and Happenings model
:fields:
* Title : The title of the event
* date : The date of the event
* image_url : The url of the image inside the event
* description : The description of the event
* link : The link of the event/ What the event Redirects to
:Functions:
* __unicode__ : Retur... | 62599065442bda511e95d905 |
class AccountDetailSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> user = UserDetailSerializer() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Account <NEW_LINE> fields = [ 'number', 'user', 'balance', 'is_active', 'created_at' ] | Retrieve serializer class for Account model | 62599065f548e778e596cce1 |
class Microplay: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def scraper_dealer(url): <NEW_LINE> <INDENT> url_pages = [] <NEW_LINE> http = tools.get_html(url) <NEW_LINE> html = http[2] <NEW_LINE> http_code = http[1] <NEW_LINE> if html is not None: <NEW_L... | Scrapping for www.microplay.cl | 625990654e4d562566373b5f |
class KaggleHubmapTestConfig(tfds.core.BuilderConfig): <NEW_LINE> <INDENT> def __init__(self, size, kaggle_data_version, **kwargs): <NEW_LINE> <INDENT> super(KaggleHubmapTestConfig, self).__init__(**kwargs) <NEW_LINE> self.size = size <NEW_LINE> self.kaggle_data_version = kaggle_data_version | BuilderConfig for KaggleHubmapTest. | 62599066009cb60464d02c90 |
class VirtualMachine(Node, object): <NEW_LINE> <INDENT> def __init__(self, freq=1, name=None, vm_size=1): <NEW_LINE> <INDENT> super(VirtualMachine, self).__init__(name) <NEW_LINE> self.phys_parent = None <NEW_LINE> self.size = vm_size <NEW_LINE> self.freq = freq <NEW_LINE> self.pair = None <NEW_LINE> <DEDENT> def repli... | Represents a virtual machine in a topology.
Args:
self.phys_parent (PhysicalHost): the host that stores this VM
self.size (int): the number of memory units needed to store this VM
self.freq (int): the frequency this VM communicates with its pair
self.pair (VirtualMachine): the other VM paired up with t... | 625990668a43f66fc4bf38e8 |
class ClothesConfig(Config): <NEW_LINE> <INDENT> NAME = "clothes" <NEW_LINE> GPU_COUNT = 1 <NEW_LINE> IMAGES_PER_GPU = 2 <NEW_LINE> NUM_CLASSES = 1+5 <NEW_LINE> NUM_KPS = 24 <NEW_LINE> IMAGE_MIN_DIM = 512 <NEW_LINE> IMAGE_MAX_DIM = 512 <NEW_LINE> MINI_MASK_SHAPE = (56, 56) <NEW_LINE> KP_MASK_POOL_SIZE = 28 <NEW_LINE> ... | Configuration for training on the toy shapes dataset.
Derives from the base Config class and overrides values specific
to the toy shapes dataset. | 62599066a17c0f6771d5d752 |
class BlinkSensor(SensorEntity): <NEW_LINE> <INDENT> def __init__(self, data, camera, description: SensorEntityDescription): <NEW_LINE> <INDENT> self.entity_description = description <NEW_LINE> self._attr_name = f"{DOMAIN} {camera} {description.name}" <NEW_LINE> self.data = data <NEW_LINE> self._camera = data.cameras[c... | A Blink camera sensor. | 625990667047854f46340b0c |
class OmegaNocTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> app.config.from_pyfile(os.path.join(omeganoc_tests.__path__[0], 'test-config.cfg')) <NEW_LINE> app.config['TESTING'] = True <NEW_LINE> self.app = app.test_client() <NEW_LINE> self.create_db() <NEW_LINE> <DEDENT> def tear... | Base class for all unit tests | 62599066fff4ab517ebcef73 |
class TesneniTyp4(Tesneni): <NEW_LINE> <INDENT> r_2 = 0 <NEW_LINE> fi_G = 0 <NEW_LINE> def calcb_Gifirst(self): <NEW_LINE> <INDENT> self.b_Gi = (12 * self.r_2 * cos(self.fi_G) * self.b_Gt * self.Q_smax / self.E[0])**(1/2) <NEW_LINE> <DEDENT> def calcb_Gi(self,obj1,obj2,F_G0): <NEW_LINE> <INDENT> self.b_Gi = ((12 * self... | description of class | 6259906655399d3f05627c79 |
class Credentials: <NEW_LINE> <INDENT> def __init__(self, name=None, usage=None): <NEW_LINE> <INDENT> self.host = name.host if name else '' <NEW_LINE> self.server = usage == 'accept' <NEW_LINE> <DEDENT> @property <NEW_LINE> def mechs(self): <NEW_LINE> <INDENT> if self.server: <NEW_LINE> <INDENT> return [0] if 'unknown_... | Stub class for GSS credentials | 6259906621bff66bcd7243be |
class IPilgrimage(model.Schema): <NEW_LINE> <INDENT> title = schema.TextLine( title=_(u"Title"), required=False, ) <NEW_LINE> description = schema.Text( title=_(u"Description"), required=False, ) <NEW_LINE> body = RichTextField( title=_(u"Body"), required=False, ) | Pilgrimage Type | 625990660c0af96317c5790b |
class AutomaticSpinner(object): <NEW_LINE> <INDENT> def __init__(self, label, show_time=True): <NEW_LINE> <INDENT> self.label = label <NEW_LINE> self.show_time = show_time <NEW_LINE> self.shutdown_event = multiprocessing.Event() <NEW_LINE> self.subprocess = multiprocessing.Process(target=self._target) <NEW_LINE> <DEDEN... | Show a spinner on the terminal that automatically starts animating.
This class shows a spinner on the terminal (just like :class:`Spinner`
does) that automatically starts animating. This class should be used as a
context manager using the :keyword:`with` statement. The animation
continues for as long as the context is... | 62599066b7558d5895464adb |
class Snakemake(PythonPackage): <NEW_LINE> <INDENT> homepage = "https://snakemake.readthedocs.io/en/stable/" <NEW_LINE> url = "https://pypi.io/packages/source/s/snakemake/snakemake-3.11.2.tar.gz" <NEW_LINE> version('3.11.2', '6bf834526078522b38d271fdf73e6b22') <NEW_LINE> depends_on('python@3.3:') <NEW_LINE> depend... | Snakemake is an MIT-licensed workflow management system. | 6259906699fddb7c1ca6397b |
class JSONEncoder(json.JSONEncoder): <NEW_LINE> <INDENT> def default(self, o): <NEW_LINE> <INDENT> if isinstance(o, datetime): <NEW_LINE> <INDENT> return str(round(datetime.timestamp(o))) <NEW_LINE> <DEDENT> elif isinstance(o, set): <NEW_LINE> <INDENT> return list(o) <NEW_LINE> <DEDENT> elif hasattr(o, 'as_dict'): <NEW... | JSONEncoder that supports Home Assistant objects. | 62599066442bda511e95d906 |
class HADES_UNAUTH_DHCP_LEASE_TIME(Option): <NEW_LINE> <INDENT> default = timedelta(minutes=2) <NEW_LINE> type = timedelta <NEW_LINE> static_check = check.greater_than(timedelta(0)) | DHCP lease time for unauth users
This lease time should be set rather short, so that unauthenticated will
quickly obtain a new address if they become authenticated. | 62599066097d151d1a2c27c5 |
class Form( BoxLayout ) : <NEW_LINE> <INDENT> shared_navigation_controller = ObjectProperty( None ) <NEW_LINE> title = StringProperty( '' ) <NEW_LINE> background_color = ListProperty( None ) <NEW_LINE> def __init__( self, **kargs ) : <NEW_LINE> <INDENT> if 'shared_navigation_controller' not in kargs.keys() : <NEW_LINE>... | Very simple class to manage you're app views.
Use it as if it were an Android's Activity or and iOS's View Controller. | 6259906667a9b606de54764f |
class ProductPatchRequest(BaseModel): <NEW_LINE> <INDENT> doc_repo: Optional[HttpUrl] = None <NEW_LINE> title: Optional[str] = None <NEW_LINE> class Config: <NEW_LINE> <INDENT> extra = "forbid" | Model for a PATCH /products/<slug> request body. | 62599066d268445f2663a709 |
class MessageRedirector: <NEW_LINE> <INDENT> def __init__(self, info=None, warn='stdout', errr='stdout'): <NEW_LINE> <INDENT> if info is None: <NEW_LINE> <INDENT> info = '' <NEW_LINE> <DEDENT> if not isinstance(info, str): <NEW_LINE> <INDENT> raise error('wrong info argument for MessageRedirector constructor') <NEW_LIN... | Class for SIRFReg printing redirection to files/stdout/stderr. | 62599066f548e778e596cce3 |
class HQFormData(FormDataBase): <NEW_LINE> <INDENT> domain = models.CharField(max_length=200) <NEW_LINE> username = models.CharField(max_length=200, blank=True) <NEW_LINE> @property <NEW_LINE> def app_id(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return XFormInstance.get(self.instanceID).app_id <NEW_LINE> <DED... | HQ's implementation of FormData. In addition to the standard attributes
we save additional HQ-specific things like the domain of the form, and
some additional user data. | 62599066e5267d203ee6cf6b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.