code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ParseError(Exception): <NEW_LINE> <INDENT> def __init__(self, msg, type, value, start_pos): <NEW_LINE> <INDENT> Exception.__init__(self, "%s: type=%r, value=%r, start_pos=%r" % (msg, tokenize.tok_name[type], value, start_pos)) <NEW_LINE> self.msg = msg <NEW_LINE> self.type = type <NEW_LINE> self.value = value <NE... | Exception to signal the parser is stuck. | 62599037287bf620b6272d63 |
class Instance(object): <NEW_LINE> <INDENT> implements(IInstance) <NEW_LINE> __slots__ = ("type_name", "snapshot") <NEW_LINE> @classmethod <NEW_LINE> def _build(cls, data): <NEW_LINE> <INDENT> type_name, snapshot = data <NEW_LINE> return cls(type_name, snapshot) <NEW_LINE> <DEDENT> def __init__(self, type_name, snapsho... | Used by TreeSerializer to encapsulate ISerializable instances.
Implements L{IInstance} and can be compared for equality. | 625990378da39b475be04369 |
class DownloadErrorCounter(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.error_count = 0 <NEW_LINE> self.lock = threading.Lock() <NEW_LINE> <DEDENT> def update_counter(self): <NEW_LINE> <INDENT> with self.lock: <NEW_LINE> <INDENT> self.error_count += 1 <NEW_LINE> <DEDENT> <DEDENT> def get_counter(... | Class for tracking download errors in a thread-safe way | 6259903715baa72349463115 |
class replacefile(TextOp): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def op(cls,text,filename,mode='w', newline='\n',*args,**kwargs): <NEW_LINE> <INDENT> out = TextOp.make_string(text, newline) <NEW_LINE> with open(filename, mode) as fh: <NEW_LINE> <INDENT> fh.write(out) | send input to file
Works like :class:`textops.tofile` except it takes care to consume input text generators before writing the file.
This is mandatory when doing some in-file textops.
The drawback is that the data to write to file is stored temporarily in memory.
This does not work::
cat('myfile').sed('from_patt... | 62599037d53ae8145f9195de |
class ContentSourceIDs(Base): <NEW_LINE> <INDENT> __tablename__ = 'content_source_ids' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> source_id = Column( Integer, ForeignKey( 'content_source.id', onupdate='CASCADE', ondelete='CASCADE'), nullable=False, index=True) <NEW_LINE> source = relationship('Content... | A table that keeps track of the number of external identities that
an internal post can be exported to.
A stepping-stone to having Sinks | 625990373eb6a72ae038b7e3 |
class Spectrum(object): <NEW_LINE> <INDENT> def __init__(self, cs, spectrum_id): <NEW_LINE> <INDENT> self._cs = cs <NEW_LINE> self._spectrum_id = int(spectrum_id) <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return isinstance(other, Spectrum) and self.spectrum_id == other.spectrum_id <NEW_LINE> <DED... | A class for retrieving and caching details about a Spectrum. | 6259903726068e7796d4dac2 |
class Container(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._items = [] <NEW_LINE> <DEDENT> def _set_list(self, new_list): <NEW_LINE> <INDENT> self._items = new_list <NEW_LINE> <DEDENT> def _get_list(self): <NEW_LINE> <INDENT> return self._items <NEW_LINE> <DEDENT> def _put(self, item): <N... | A class to represent a container. | 6259903707d97122c4217e17 |
class ReactionEnergyBarrier(ScalarProperty): <NEW_LINE> <INDENT> def __init__(self, name, parser, *args, **kwargs): <NEW_LINE> <INDENT> super(ReactionEnergyBarrier, self).__init__(name, parser, *args, **kwargs) <NEW_LINE> energies = self.parser.reaction_energies() <NEW_LINE> self.value = sorted(energies, key=lambda e: ... | Reaction energy barrier. | 62599037b830903b9686ed36 |
class PyOpencensus(PythonPackage): <NEW_LINE> <INDENT> homepage = "https://github.com/census-instrumentation/opencensus-python" <NEW_LINE> pypi = "opencensus/opencensus-0.7.10.tar.gz" <NEW_LINE> version('0.7.10', sha256='2921e3e570cfadfd123cd8e3636a405031367fddff74c55d3fe627a4cf8b981c') <NEW_LINE> depends_on('py-setupt... | A stats collection and distributed tracing framework. | 62599037a4f1c619b294f744 |
class IronicHostManager(host_manager.HostManager): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _is_ironic_compute(compute): <NEW_LINE> <INDENT> ht = compute.hypervisor_type if 'hypervisor_type' in compute else None <NEW_LINE> return ht == obj_fields.HVType.IRONIC <NEW_LINE> <DEDENT> def _load_filters(self): <NEW_L... | Ironic HostManager class. | 6259903726238365f5fadcd0 |
class Game: <NEW_LINE> <INDENT> def __init__(self, key_name, **args): <NEW_LINE> <INDENT> self.key_name = key_name <NEW_LINE> self.userX = args.get('userX') <NEW_LINE> self.userO = args.get('userO') <NEW_LINE> self.board = args.get('board') <NEW_LINE> self.moveX = args.get('moveX') <NEW_LINE> self.winner = args.get('wi... | All the data we store for a game | 6259903730c21e258be99989 |
class NotEmptyError(enum.IntEnum): <NEW_LINE> <INDENT> UNSPECIFIED = 0 <NEW_LINE> UNKNOWN = 1 <NEW_LINE> EMPTY_LIST = 2 | Enum describing possible not empty errors.
Attributes:
UNSPECIFIED (int): Enum unspecified.
UNKNOWN (int): The received error code is not known in this version.
EMPTY_LIST (int): Empty list. | 625990378da39b475be0436b |
class DeltaFeature(Layer): <NEW_LINE> <INDENT> def build(self, input_shape): <NEW_LINE> <INDENT> if len(input_shape) != 3: <NEW_LINE> <INDENT> raise ValueError('DeltaFeature input should have three ' 'dimensions. Got %d.' % len(input_shape)) <NEW_LINE> <DEDENT> super(DeltaFeature, self).build(input_shape) <NEW_LINE> <D... | Layer for calculating time-wise deltas. | 6259903715baa72349463117 |
class ReferencesField(JsonMixin, Field): <NEW_LINE> <INDENT> def __init__(self, **params): <NEW_LINE> <INDENT> params['widget'] = params.get('widget', ReferencesFieldWidget) <NEW_LINE> super(ReferencesField, self).__init__(**params) <NEW_LINE> <DEDENT> def to_python(self, value): <NEW_LINE> <INDENT> value = super(Refer... | A references form field. | 625990373eb6a72ae038b7e5 |
class QueueHandler(BaseHandler): <NEW_LINE> <INDENT> def flatten(self, obj, data): <NEW_LINE> <INDENT> return data <NEW_LINE> <DEDENT> def restore(self, data): <NEW_LINE> <INDENT> return queue.Queue() | Opaquely serializes Queue objects
Queues contains mutex and condition variables which cannot be serialized.
Construct a new Queue instance when restoring. | 625990370a366e3fb87ddb61 |
class Grid (Drawable): <NEW_LINE> <INDENT> NIL = Node (-1, -1, None, None, None, None) <NEW_LINE> def __init__ (self, size, walls = []): <NEW_LINE> <INDENT> super (Grid, self).__init__ (Vector2D (0,0)) <NEW_LINE> self.nodes = [] <NEW_LINE> self.size = size <NEW_LINE> w = self.width = int (self.size [0] / GRID_SPACING) ... | size: tuple (800, 600) or something like that
Grid class used for player pathfinding | 6259903726068e7796d4dac4 |
class TypeContext(object): <NEW_LINE> <INDENT> def __init__(self, source_code_info, name): <NEW_LINE> <INDENT> self.source_code_info = source_code_info <NEW_LINE> self.path = [] <NEW_LINE> self.name = name <NEW_LINE> self.map_typenames = {} <NEW_LINE> self.oneof_fields = {} <NEW_LINE> self.oneof_names = {} <NEW_LINE> s... | Contextual information for a message/field.
Provides information around namespaces and enclosing types for fields and
nested messages/enums. | 62599038711fe17d825e155a |
class Action: <NEW_LINE> <INDENT> def __init__(self, actionName, actionCost, startState, resultingState): <NEW_LINE> <INDENT> self.actionName = actionName <NEW_LINE> self.actionCost = actionCost <NEW_LINE> self.startState = startState <NEW_LINE> self.resultingState = resultingState <NEW_LINE> <DEDENT> def getActionName... | Each action consists of the ACTION string, the action cost,
the starting state, and the state that would result if this action were taken. | 625990384e696a045264e6e0 |
class PostResultSet(ResultSet): <NEW_LINE> <INDENT> def getJSONFromString(self, str): <NEW_LINE> <INDENT> return json.loads(str) <NEW_LINE> <DEDENT> def get_HTTPLog(self): <NEW_LINE> <INDENT> return self._output.get('HTTPLog', None) <NEW_LINE> <DEDENT> def get_ResponseStatusCode(self): <NEW_LINE> <INDENT> return self._... | A ResultSet with methods tailored to the values returned by the Post Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution. | 625990388c3a8732951f76d4 |
class _VmGroupSpecDecoder(option_decoders.TypeVerifier): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(_VmGroupSpecDecoder, self).__init__(valid_types=(dict,), **kwargs) <NEW_LINE> <DEDENT> def Decode(self, value, component_full_name, flag_values): <NEW_LINE> <INDENT> vm_group_config = sup... | Validates a single VmGroupSpec dictionary. | 62599038c432627299fa4175 |
class FormularioAdminRegPerfil(ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = UserProfile <NEW_LINE> fields = ['fk_tipo_documento', 'id_perfil'] <NEW_LINE> <DEDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(FormularioAdminRegPerfil, self).__init__(*args, **kwargs) <NEW_LINE... | !
Clase que permite crear el formulario para actualizar usuario por el administrador
@author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve)
@copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
@date 09-01-2017
@version 1.0.0 | 62599038b5575c28eb713588 |
class TestAppWithStaticFiles(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.static_url_path = '/a/static/path' <NEW_LINE> self.host = 'foo.host' <NEW_LINE> self.version = '0.3.2' <NEW_LINE> self.app = Flask(__name__, static_url_path=self.static_url_path) <NEW_LINE> self.app.config['APP_VERSION... | We are using :class:`.Base` on a Flask app. | 6259903894891a1f408b9fb6 |
class Corpus(SentenceCollection): <NEW_LINE> <INDENT> def __init__(self, dirname): <NEW_LINE> <INDENT> super(Corpus, self).__init__() <NEW_LINE> self._dirname = dirname <NEW_LINE> self._prepareSentenceSplitter() <NEW_LINE> self._documents = [] <NEW_LINE> <DEDENT> def _prepareSentenceSplitter(self): <NEW_LINE> <INDENT> ... | Class for source documents. Contains utilities for loading document set. | 625990386fece00bbacccb29 |
class CephInt(CephArgtype): <NEW_LINE> <INDENT> def __init__(self, range=''): <NEW_LINE> <INDENT> if range == '': <NEW_LINE> <INDENT> self.range = list() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.range = list(range.split('|')) <NEW_LINE> self.range = [int(x) for x in self.range] <NEW_LINE> <DEDENT> <DEDENT> de... | range-limited integers, [+|-][0-9]+ or 0x[0-9a-f]+
range: list of 1 or 2 ints, [min] or [min,max] | 6259903830c21e258be9998b |
class Record(object): <NEW_LINE> <INDENT> _typeToString = { numpy.int8: "int8", numpy.uint8: "uint8", numpy.int16: "int16", numpy.uint16: "uint16", numpy.int32: "int32", numpy.uint32: "uint32", numpy.int64: "int64", numpy.float32: "float", numpy.float64: "double", numpy.complex128: "complex", numpy.object_: "obje... | A class that represents the CODA record type in Python.
When a record is read from a product file, a Record instance is
created and populated with fields using the _registerField() method.
Each field will appear as an instance attribute. The field name is used as
the name of the attribute, and its value is read from t... | 625990383eb6a72ae038b7e7 |
class DeleteUpdateCommentAPIView(generics.RetrieveUpdateDestroyAPIView): <NEW_LINE> <INDENT> queryset = Comment.objects.all() <NEW_LINE> serializer_class = CommentSerializer <NEW_LINE> permission_classes = ( IsAuthenticated, ) <NEW_LINE> def delete(self, request, *args, **kwargs): <NEW_LINE> <INDENT> comment = get_obje... | class to delete a comment on an article | 6259903826068e7796d4dac6 |
class CephEntityAddr(CephIPAddr): <NEW_LINE> <INDENT> def valid(self, s, partial=False): <NEW_LINE> <INDENT> ip, nonce = s.split('/') <NEW_LINE> super(self.__class__, self).valid(ip) <NEW_LINE> self.nonce = nonce <NEW_LINE> self.val = s <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return '<EntityAddr>' | EntityAddress, that is, IP address/nonce | 625990388e05c05ec3f6f71a |
@dataclass <NEW_LINE> class Program: <NEW_LINE> <INDENT> asts: Dict[str, AST] = field(default_factory=dict) <NEW_LINE> memory: Memory = field(default_factory=Memory) <NEW_LINE> environment: Environment = field(default_factory=Environment) <NEW_LINE> def to_dict(self) -> Dict[str, Any]: <NEW_LINE> <INDENT> d = dict() <N... | Represent a statically analysed program : a set of references, with a
memory containing already initialized values, and a dict containing the ASTs
of the different compiled files. | 62599038d10714528d69ef4a |
class SingletonModel(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> abstract = True <NEW_LINE> <DEDENT> def save(self, *args, **kwargs): <NEW_LINE> <INDENT> self.__class__.objects.exclude(id=self.id).delete() <NEW_LINE> super(SingletonModel, self).save(*args, **kwargs) <NEW_LINE> <DEDENT> @classmeth... | Singleton Django Model
Ensures there's always only one entry in the database, and can fix the
table (by deleting extra entries) even if added via another mechanism.
Also has a static load() method which always returns the object - from
the database if possible, or a new empty (default) instance if the
database is sti... | 62599038b830903b9686ed38 |
class _NXdataBaseDataView(DataView): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> DataView.__init__(self, *args, **kwargs) <NEW_LINE> <DEDENT> def _updateColormap(self, nxdata): <NEW_LINE> <INDENT> cmap_norm = nxdata.plot_style.signal_scale_type <NEW_LINE> if cmap_norm is not None: <NEW_... | Base class for NXdata DataView | 6259903896565a6dacd2d84b |
class WarningWidg(QtGui.QDialog): <NEW_LINE> <INDENT> def __init__(self, message, parent=None): <NEW_LINE> <INDENT> super(WarningWidg, self).__init__(parent) <NEW_LINE> z_label = QtGui.QLabel('Warning: {:s}'.format(message)) <NEW_LINE> nbtn = QtGui.QPushButton('No', self) <NEW_LINE> nbtn.clicked.connect(self.touch_no) ... | GUI to warn user about coming action and solicit response
| 62599038a8ecb0332587239e |
class APIError(Exception): <NEW_LINE> <INDENT> pass | Indicates an exception happened on the bot side of the RPC connection | 6259903873bcbd0ca4bcb408 |
class SimilarUsersFollowingListView(SimilarUsersListView): <NEW_LINE> <INDENT> filmaster_type = 'following' | Followers of given users that are similar to him | 6259903882261d6c52730784 |
class Condition0(Condition): <NEW_LINE> <INDENT> def check(self, instance): <NEW_LINE> <INDENT> return instance.objectPlayer.random.randrange(100 ) < self.evaluate_index(0) | Random Event
Parameters:
0: Percent (EXPRESSION, ExpressionParameter) | 625990388a349b6b436873c1 |
class QLearning(): <NEW_LINE> <INDENT> def __init__(self, env, epsilon = .9, alpha = .1, gamma = .9): <NEW_LINE> <INDENT> self.env = env <NEW_LINE> self.Q = np.zeros(shape=(self.env.observation_space.n, self.env.action_space.n)) <NEW_LINE> self.epsilon = epsilon <NEW_LINE> self.alpha = alpha <NEW_LINE> self.gamma = gam... | Q-learning algorithms with epsilon greedy policy.
References:
https://github.com/udacity/rl-cheatsheet/blob/master/cheatsheet.pdf | 6259903876d4e153a661db32 |
class Package(object): <NEW_LINE> <INDENT> def __init__(self, name, root_path, package_path, profiles=None): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.root_path = root_path <NEW_LINE> self.package_path = package_path <NEW_LINE> self.profiles = profiles or {} <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE... | A ``Package`` object is created when creating a python package
using the "python package" builder.
It contains infos about the package, such as useful paths and can
be used for importing the package and doing things such as loading
the ZCML.
The object can be used as context manager to add the package temporarily to
t... | 62599038d4950a0f3b1116ff |
class Downloader(object): <NEW_LINE> <INDENT> def __init__(self, nb_dl=2): <NEW_LINE> <INDENT> self._nb_dl = nb_dl <NEW_LINE> self._last_display = time.time() <NEW_LINE> <DEDENT> def run(self, uri_list): <NEW_LINE> <INDENT> downloaders = [] <NEW_LINE> in_queue = [] <NEW_LINE> _download_infos = dict(count=0, start_ts = ... | A nice downloader class with pretty user output (stdout)
just call :meth:`run` with a list of uris you want to fetch | 625990386e29344779b017d1 |
class IntentService(): <NEW_LINE> <INDENT> def __init__(self, top_n): <NEW_LINE> <INDENT> self.top_n = top_n <NEW_LINE> self.__noun_phrase_tokens=[] <NEW_LINE> self.__default_categories = CATEGORIES <NEW_LINE> self.__glove_model = GloveService() <NEW_LINE> <DEDENT> def __generate_text_vector(self): <NEW_LINE> <INDENT> ... | The class is for Extracting the top n intents from the input text. | 6259903816aa5153ce40166c |
class SnippetViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Snippet.objects.all() <NEW_LINE> serializer_class = SnippetSerializer <NEW_LINE> permission_classes = (permissions.IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly) <NEW_LINE> @detail_route(renderer_classes=[renderers.StaticHTMLRenderer]) <NEW_LINE... | This viewset automatically provides 'list', 'create', 'retrieve',
'update', and 'destroy' actions. | 625990383eb6a72ae038b7e9 |
class AuthTokenSerializer(serializers.Serializer): <NEW_LINE> <INDENT> email = serializers.CharField() <NEW_LINE> password = serializers.CharField( style={'input_type': 'password'}, trim_whitespace=False ) <NEW_LINE> def validate(self, attrs): <NEW_LINE> <INDENT> email = attrs.get('email') <NEW_LINE> password = attrs.g... | Serializer for User Authentication Object | 62599038ac7a0e7691f73668 |
class Robot(): <NEW_LINE> <INDENT> name = '' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.name = self.generate_name() <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def generate_name(): <NEW_LINE> <INDENT> random.seed() <NEW_LINE> letters = '' <NEW_LINE> number = random.randint(100, 999) <NEW_LINE> for _ in ra... | Robot whose name is unique at each instantiation | 62599038ec188e330fdf9a18 |
class _ScalarAccessIndexer(NDFrameIndexerBase): <NEW_LINE> <INDENT> def _convert_key(self, key, is_setter: bool = False): <NEW_LINE> <INDENT> raise AbstractMethodError(self) <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> if not isinstance(key, tuple): <NEW_LINE> <INDENT> if not is_list_like_indexer... | Access scalars quickly. | 6259903866673b3332c31575 |
class DigitalReceiptSurvey(SurveyStatus): <NEW_LINE> <INDENT> STRONGLY_AGREE = 0 <NEW_LINE> AGREE = 1 <NEW_LINE> NEITHER = 2 <NEW_LINE> DISAGREE = 3 <NEW_LINE> STRONGLY_DISAGREE = 4 <NEW_LINE> LIKERT_CHOICES = ( ( STRONGLY_AGREE, 'Strongly agree'), ( AGREE, 'Agree'), ( NEITHER, 'Neither agree nor disagree'), ( DISAGREE... | Design survey | 6259903873bcbd0ca4bcb409 |
class ResourceObject(object): <NEW_LINE> <INDENT> deserialized_types = { 'object_type': 'str' } <NEW_LINE> attribute_map = { 'object_type': 'type' } <NEW_LINE> supports_multiple_types = False <NEW_LINE> discriminator_value_class_map = { 'InteractionModel': 'ask_smapi_model.v1.skill.interaction_model.jobs.interaction_mo... | Resource object where the job is applied on.
:param object_type: Polymorphic type of the ResourceObject.
:type object_type: (optional) str
.. note::
This is an abstract class. Use the following mapping, to figure out
the model class to be instantiated, that sets ``type`` variable.
| InteractionModel: :... | 62599038a4f1c619b294f747 |
class PageQuerySet(models.QuerySet, TranslatableModelManager): <NEW_LINE> <INDENT> def active(self): <NEW_LINE> <INDENT> return self.filter(active=True) <NEW_LINE> <DEDENT> def get_by_uuid(self, uuid): <NEW_LINE> <INDENT> return self.get(uuid=uuid) | Manager de l'aide | 62599038be383301e0254997 |
class BayerShader(ImageShader): <NEW_LINE> <INDENT> vertex_source = Path(__file__).parent / 'bayer.vs' <NEW_LINE> fragment_source = Path(__file__).parent / 'bayer.fs' <NEW_LINE> patterns = { 'RGGB': QtGui.QVector2D(0, 0), 'GBRG': QtGui.QVector2D(0, 1), 'GRBG': QtGui.QVector2D(1, 0), 'BGGR': QtGui.QVector2D(1, 1), } <NE... | Shader which performs bayer demosaic filtering
NOTE: see LICENSE for source of the original GLSL shader code.
This has been modified for usage with GLSL 4.10 by @klauer | 6259903826238365f5fadcd6 |
class GameTurn(object): <NEW_LINE> <INDENT> def __init__(self, arena, turn_number): <NEW_LINE> <INDENT> self.arena = arena <NEW_LINE> self.trace = [] <NEW_LINE> self.history = [] <NEW_LINE> self.turn_number = turn_number <NEW_LINE> <DEDENT> def evaluate_bot_action(self, bot_response): <NEW_LINE> <INDENT> if not bot_res... | Abstract the actions that take place during a turn, and when it
finishes, return a summarized status of what happened so the engine can
trace it. | 62599038b5575c28eb71358a |
class AccountList(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, 'value': {'key': 'value', 'type': '[Account]'}, } <NEW_LINE> def __init__( self, *, next_link: Optional[str] = None, value: Optional[List["Account"]] = None, **kwargs ): <NEW_LINE> <IND... | List of Accounts.
:param next_link: The link used to get the next page of Accounts list.
:type next_link: str
:param value: List of Accounts.
:type value: list[~device_update.models.Account] | 62599038287bf620b6272d6b |
class Servlet(object): <NEW_LINE> <INDENT> def onServletInit(self, url, runtime): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def onServletError(self, url, error): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def onServletEnd(self, url): <NEW_LINE> <INDENT> pass | A service addresable with an url | 625990386fece00bbacccb2d |
class UploadInfoAPI(BaseDetailView): <NEW_LINE> <INDENT> schema = UploadInfoSchema() <NEW_LINE> permission_classes = [ProjectTransferPermission] <NEW_LINE> http_method_names = ['get'] <NEW_LINE> def _get(self, params): <NEW_LINE> <INDENT> expiration = params['expiration'] <NEW_LINE> num_parts = params['num_parts'] <NEW... | Retrieve info needed to upload a file.
| 6259903891af0d3eaad3afb4 |
class Spider(Worker): <NEW_LINE> <INDENT> queue = 'spider' <NEW_LINE> repeat_delta = timedelta(days=7) <NEW_LINE> headers = { 'user-agent': 'PyBot/1.0' } <NEW_LINE> def work(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> job = self.jobs.reserve_job(self.queue) <NEW_LINE> if job is False: <NEW_LINE> <INDENT> return... | Fetches webpages from the 'spider' queue, and stores a representation
for our search engine in the database. | 62599038287bf620b6272d6c |
class City(Base): <NEW_LINE> <INDENT> __tablename__ = 'cities' <NEW_LINE> id = Column(Integer, primary_key=True, nullable=False) <NEW_LINE> name = Column(String(128), nullable=False) <NEW_LINE> state_id = Column(Integer, ForeignKey('states.id'), nullable=False) | City inheriting from States Base
| 6259903807d97122c4217e1f |
class HelloAPIView(APIView): <NEW_LINE> <INDENT> serializer_class = serializers.HelloSerializer <NEW_LINE> def get(self, request, format=None): <NEW_LINE> <INDENT> an_apiview = [ 'Uses HTTP methods as functions (get, post, patch, put, delete)', 'Is similar to a traditional Django View', 'Gives you the most control over... | Test API View | 625990388e05c05ec3f6f71c |
class TestEnums(unittest.TestCase): <NEW_LINE> <INDENT> def test_core_types(self): <NEW_LINE> <INDENT> self.assertEqual(len(CoreTypes), 6) <NEW_LINE> self.assertEqual(CoreTypes.ENUM_PAIR_SPEC.sym, 'EnumPairSpec') <NEW_LINE> self.assertEqual(CoreTypes.PROTO_SPEC.sym, 'ProtoSpec') <NEW_LINE> self.assertEqual(len(CoreType... | Test enumerations defined in fieldz package. | 6259903873bcbd0ca4bcb40b |
class TwitterJSHelpers(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def context(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> c = toolkit.c.pylons.__dict__ <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> c = dict(toolkit.c.pylons) <NEW_LINE> <DEDENT> return c <NEW_LINE> <DEDENT> def _get_packa... | A class defining various methods to pass into the templates as helpers. | 62599038e76e3b2f99fd9b8f |
class AutoEstimator(EntropyEstimator): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.estimator = None <NEW_LINE> self.k = None <NEW_LINE> <DEDENT> def guess(self, nk, k=None, zk=None): <NEW_LINE> <INDENT> if k is not None: <NEW_LINE> <INDENT> self.k = k <NEW_LINE> self.e... | Select the best estimator for the input data. | 62599038796e427e5384f8ff |
class TestWantedBuilder(unittest.TestCase): <NEW_LINE> <INDENT> @patch('mozci.platforms.fetch_allthethings_data') <NEW_LINE> def test_pgo(self, fetch_allthethings_data): <NEW_LINE> <INDENT> fetch_allthethings_data.return_value = MOCK_ALLTHETHINGS <NEW_LINE> self.assertEquals( _wanted_builder('Platform1 mozilla-central ... | Test _wanted_builder with mock data. | 62599038baa26c4b54d5042b |
class MSDClassifier(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_channels, num_classes): <NEW_LINE> <INDENT> super(MSDClassifier, self).__init__() <NEW_LINE> self.features = nn.Sequential() <NEW_LINE> self.features.add_module("conv1", conv3x3_block( in_channels=in_channels, out_channels=in_channels, stride=2))... | MSDNet classifier.
Parameters:
----------
in_channels : int
Number of input channels.
num_classes : int
Number of classification classes. | 625990381d351010ab8f4c9d |
class ItemAssigned(TimestampedVersionedEntity.Event): <NEW_LINE> <INDENT> def __init__(self, item, index, *args, **kwargs): <NEW_LINE> <INDENT> kwargs['item'] = item <NEW_LINE> super(ItemAssigned, self).__init__(originator_version=index, *args, **kwargs) <NEW_LINE> <DEDENT> @property <NEW_LINE> def item(self): <NEW_LIN... | Occurs when an item is set at a position in an array. | 62599038be383301e0254999 |
class OpenInvoice(Wizard): <NEW_LINE> <INDENT> __name__ = 'project.open_invoice' <NEW_LINE> start_state = 'open_' <NEW_LINE> open_ = StateAction('account_invoice.act_invoice_form') <NEW_LINE> def do_open_(self, action): <NEW_LINE> <INDENT> pool = Pool() <NEW_LINE> Work = pool.get('project.work') <NEW_LINE> works = Work... | Open Invoice | 6259903826238365f5fadcd8 |
class SizedParent: <NEW_LINE> <INDENT> def AddChild(self, child): <NEW_LINE> <INDENT> sizer = self.GetSizer() <NEW_LINE> nolog = wx.LogNull() <NEW_LINE> item = sizer.Add(child) <NEW_LINE> del nolog <NEW_LINE> item.SetUserData({"HGrow":0, "VGrow":0}) <NEW_LINE> child.SetDefaultSizerProps() <NEW_LINE> <DEDENT> def GetSiz... | Mixin class for some methods used by the ``Sized*`` classes. | 625990388a349b6b436873c5 |
class UserViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = User.objects.all().order_by('-date_joined') <NEW_LINE> serializer_class = UserSerializer <NEW_LINE> permission_classes = [permissions.IsAuthenticatedOrReadOnly] | API endpoint that allows users to be viewed or edited. | 6259903894891a1f408b9fb9 |
class PersonDetailView(LinksMixin, SeriesMixin, DetailView): <NEW_LINE> <INDENT> model = Person <NEW_LINE> def get_links(self): <NEW_LINE> <INDENT> links = super().get_links() <NEW_LINE> if self.series: <NEW_LINE> <INDENT> links.append(Link(href=self.series.get_absolute_url(), rel="feed")) <NEW_LINE> <DEDENT> return li... | Information about a person (only allowed if that person has a slug). | 6259903850485f2cf55dc103 |
class Proxy(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ocupied = 'No' <NEW_LINE> self.worker = None <NEW_LINE> <DEDENT> def work(self): <NEW_LINE> <INDENT> print('Checking if worker is available') <NEW_LINE> if self.ocupied == 'No': <NEW_LINE> <INDENT> self.worker = Worker() <NEW_LINE> ti... | docstring for Proxy | 62599038cad5886f8bdc593e |
class WaveWriteCallback(SpeechCallback): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.file = None <NEW_LINE> self.filename = 'test.wav' <NEW_LINE> <DEDENT> def set(self, filename): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> self.close() <NEW_LINE> <DEDENT> ... | Callback that writes sound to wave file. | 625990389b70327d1c57ff0a |
class PredictionSetBase: <NEW_LINE> <INDENT> def __init__(self, definition, path, cutoff_point, prediction_start_day, prediction_interval): <NEW_LINE> <INDENT> self.definition = definition <NEW_LINE> self.path = path <NEW_LINE> self.cutoff_point = cutoff_point <NEW_LINE> self.prediction_start_day = prediction_start_day... | A class that receives as input the processed variables and the definition
that you want classification for and returns the data either in the correct
format for prediction (either using a fixed cut-off point or a sliding
window approach. It also sets a prediction interval in the future where you
will do classification ... | 6259903891af0d3eaad3afb6 |
@admin.register(models.NamesCd) <NEW_LINE> class NamesCdAdmin(BaseAdmin): <NEW_LINE> <INDENT> list_display = ("namid", "namf", "naml",) | Custom admin for the NamesCd model. | 6259903807d97122c4217e21 |
class GtkSettingPresenterContainer(settings.SettingPresenterContainer): <NEW_LINE> <INDENT> def _gui_on_element_value_change(self, widget, presenter, *args): <NEW_LINE> <INDENT> self._on_element_value_change(presenter) <NEW_LINE> <DEDENT> def _gui_on_element_value_change_streamline(self, widget, presenter, *args): <NEW... | This class is used to group `SettingPresenter` objects in a GTK environment. | 625990381f5feb6acb163d76 |
class CreateUserView(generics.CreateAPIView): <NEW_LINE> <INDENT> model = get_user_model() <NEW_LINE> permission_classes = [permissions.AllowAny, ] <NEW_LINE> serializer_class = UserSerializer | Create a user. | 6259903866673b3332c31579 |
class Status(Enum): <NEW_LINE> <INDENT> enabled = 'E' <NEW_LINE> disabled = 'D' | 目前考虑两个状态, 默认为启用状态。 | 6259903873bcbd0ca4bcb40d |
@register('Jupyter.HTML') <NEW_LINE> class HTML(_String): <NEW_LINE> <INDENT> _view_name = Unicode('HTMLView').tag(sync=True) <NEW_LINE> _model_name = Unicode('HTMLModel').tag(sync=True) | Renders the string `value` as HTML. | 62599038711fe17d825e155e |
class TestMeasureDiskUtil: <NEW_LINE> <INDENT> def test_measure_diskutil(self, mock_logger, mock_global_config): <NEW_LINE> <INDENT> MetadataExtractor.measure_diskutil() <NEW_LINE> MetadataExtractor.logging.info.assert_called_once() | Tests for MetadataExtractor.measure_diskutil | 62599038a4f1c619b294f749 |
class Console(Immutable): <NEW_LINE> <INDENT> def print(self, msg: str = '') -> Success[None]: <NEW_LINE> <INDENT> return purify_io_bound(print)(msg) <NEW_LINE> <DEDENT> def input(self, prompt: str = '') -> Success[str]: <NEW_LINE> <INDENT> return purify_io_bound(input)(prompt) | Module that enables printing to stdout and reading from stdin | 6259903830dc7b76659a09b7 |
class AccountError(Exception): <NEW_LINE> <INDENT> pass | Raised when the API can't locate any accounts for the user | 6259903873bcbd0ca4bcb40e |
class ConvModule(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, bias=False, norm_layer=None, activation='relu', inplace=True): <NEW_LINE> <INDENT> super(ConvModule, self).__init__() <NEW_LINE> assert norm_layer is None or norm_layer == 'bn_2d' or norm_lay... | A conv block that contains conv/norm/activation layers. | 62599038287bf620b6272d6f |
class GF: <NEW_LINE> <INDENT> def __init__(self, v): <NEW_LINE> <INDENT> if isinstance(v, GF): <NEW_LINE> <INDENT> self.v = v.v <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.v = int(v) <NEW_LINE> <DEDENT> assert 0 <= int(self.v) < 256 <NEW_LINE> <DEDENT> def __add__(self, o): <NEW_LINE> <INDENT> o = GF(o).v <NEW_L... | Representation of an element from GF(256). | 6259903830c21e258be99993 |
class ControlOptionsCommon(ClientOptionsBase): <NEW_LINE> <INDENT> def __init__(self, count: int=1, timeout: int=None, sync_mode: str=None, close_sleep: int=None): <NEW_LINE> <INDENT> self.count = count <NEW_LINE> self.timeout = timeout <NEW_LINE> self.sync_mode = sync_mode <NEW_LINE> self.close_sleep = close_sleep <NE... | Common control options for all clients. | 62599038cad5886f8bdc593f |
class Mesh_Hub( Hub, Mesh_Node ): <NEW_LINE> <INDENT> def __init__( self, address, children, **args ): <NEW_LINE> <INDENT> Hub.__init__( self, address, children, **args ) <NEW_LINE> Mesh_Node.__init__( self, address ) | hub with mesh to draw itself in opengl
| 625990389b70327d1c57ff0c |
class LoadDialog(Toplevel): <NEW_LINE> <INDENT> def __init__(self, master, load_message = 'Loading', maxDots = 6): <NEW_LINE> <INDENT> assert isinstance(load_message, str) and isinstance(maxDots, int) and maxDots > 0 <NEW_LINE> Toplevel.__init__(self, master) <NEW_LINE> self.transient(master) <NEW_LINE> self.geometry(f... | A simple LoadDialog | 62599038d4950a0f3b111702 |
class LoadRawTestCase(tests.BaseTestCase): <NEW_LINE> <INDENT> def test(self): <NEW_LINE> <INDENT> expected = { 'Accessibility.Accessibility_Information.Cursor_Magnification': 'Off', 'Applications.Installer.Version': '9.0.11', 'Applications.Console.Version': '10.9', 'Locations.Automatic.Active_Location': 'Yes', 'Locati... | Test cases for kerfi.load_raw() function. | 6259903891af0d3eaad3afb8 |
class NotificationContentViewSet(OwnerMessageViewSetMixin, CommonViewSet): <NEW_LINE> <INDENT> queryset = NotificationContent.objects.all() <NEW_LINE> serializer_class = serializers.NotificationContentSerializer <NEW_LINE> permission_classes = [permissions.DjangoModelPermissions] <NEW_LINE> filter_fields = ['title', 'c... | api views for NotificationContent | 62599038ec188e330fdf9a1e |
class SelfPixelwiseNLLLoss(nn.Module): <NEW_LINE> <INDENT> def forward(self, o, δy=0, δx=0, global_best=False): <NEW_LINE> <INDENT> N, C, Y, X = o.shape <NEW_LINE> assert N==1 <NEW_LINE> if global_best: <NEW_LINE> <INDENT> score_00 = torch.sum(o[0, 0, ::2, ::2] + o[0, 1, ::2, 1::2] + o[0, 2, 1::2, ::2] + o[0, 3, 1::2, ... | Modified version of nn.NLLLoss, for pixelwise auxiliary training. | 62599038e76e3b2f99fd9b93 |
class ExponentialFamily(object): <NEW_LINE> <INDENT> def __init__(self, name=None): <NEW_LINE> <INDENT> if not name or name[-1] != '/': <NEW_LINE> <INDENT> with tf.name_scope(name or type(self).__name__) as name: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <DEDENT> self._name = name <NEW_LINE> <DEDENT> @property <NEW_... | Specifies a mean-value parameterized exponential family.
Subclasses implement [exponential-family distribution](
https://en.wikipedia.org/wiki/Exponential_family) properties (e.g.,
`log_prob`, `variance`) as a function of a real-value which is transformed via
some [link function](
https://en.wikipedia.org/wiki/General... | 6259903830c21e258be99994 |
@BlClassRegistry() <NEW_LINE> class MUV_MT_CopyPasteUV_SelSeqCopyUV(bpy.types.Menu): <NEW_LINE> <INDENT> bl_idname = "MUV_MT_CopyPasteUV_SelSeqCopyUV" <NEW_LINE> bl_label = "Copy UV (Selection Sequence) (Menu)" <NEW_LINE> bl_description = "Menu of Copy UV coordinate by selection sequence" <NEW_LINE> @classmethod <NEW_L... | Menu class: Copy UV coordinate by selection sequence | 62599038b830903b9686ed3c |
class Error(Exception): <NEW_LINE> <INDENT> def __init__(self, code=None, msg=None): <NEW_LINE> <INDENT> self.code = code or httplib.INTERNAL_SERVER_ERROR <NEW_LINE> self.msg = msg or httplib.responses[self.code] <NEW_LINE> Exception.__init__(self, self.msg) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> re... | Base Exception for api/handlers. | 62599038507cdc57c63a5f21 |
class ShufflePipeline(pipeline_base.PipelineBase): <NEW_LINE> <INDENT> def run(self, job_name, mapper_params, filenames, shards=None): <NEW_LINE> <INDENT> bucket_name = mapper_params["bucket_name"] <NEW_LINE> hashed_files = yield _HashPipeline(job_name, bucket_name, filenames, shards=shards) <NEW_LINE> sorted_files = y... | A pipeline to shuffle multiple key-value files.
Args:
job_name: The descriptive name of the overall job.
mapper_params: parameters to use for mapper phase.
filenames: list of file names to sort. Files have to be of records format
defined by Files API and contain serialized kv_pb.KeyValue
protocol message... | 62599038a4f1c619b294f74a |
class PerMessageBzip2(PerMessageCompress, PerMessageBzip2Mixin): <NEW_LINE> <INDENT> DEFAULT_COMPRESS_LEVEL = 9 <NEW_LINE> @classmethod <NEW_LINE> def createFromResponseAccept(Klass, isServer, accept): <NEW_LINE> <INDENT> pmce = Klass(isServer, accept.response.server_max_compress_level, accept.compressLevel if accept.c... | `permessage-bzip2` WebSocket extension processor. | 62599038be383301e025499d |
class CalcMag(PhotCalcs): <NEW_LINE> <INDENT> def __init__(self, sed, filterDict, cosmoModel): <NEW_LINE> <INDENT> PhotCalcs.__init__(self, sed, filterDict) <NEW_LINE> self.cosmoModel = cosmoModel <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> str_msg ='\n CalcMag Object: \n' <NEW_LINE> str_msg += " Conta... | Calculate magnitudes for the given SED at redshift z, with absolute magnitude absMag in all of the
filters in filterDict
@param sed SED object (spectral energy distribution)
@param filterDict dictionary of filters: keyword=filter filename without path or extension,
value=Filter object... | 6259903882261d6c52730788 |
class LeafPluggedInSensor(LeafEntity, BinarySensorEntity): <NEW_LINE> <INDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return f"{self.car.leaf.nickname} Plug Status" <NEW_LINE> <DEDENT> @property <NEW_LINE> def is_on(self): <NEW_LINE> <INDENT> return self.car.data[DATA_PLUGGED_IN] <NEW_LINE> <DEDENT> @... | Plugged In Sensor class. | 625990386e29344779b017d9 |
class TestFornavWrapper(unittest.TestCase): <NEW_LINE> <INDENT> def test_fornav_swath_larger_float32(self): <NEW_LINE> <INDENT> from pyresample.ewa import fornav <NEW_LINE> swath_shape = (1600, 3200) <NEW_LINE> data_type = np.float32 <NEW_LINE> rows = np.empty(swath_shape, dtype=np.float32) <NEW_LINE> rows[:] = np.lins... | Test the function wrapping the lower-level fornav code. | 625990381d351010ab8f4ca3 |
class GPXandKMLExport_TheWayIWantItQGIS2DialogTest(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 test_icon_png(self): <NEW_LINE> <INDENT> path = ':/plugins/GPXandKMLExport_TheWayIWantItQGIS2/icon... | Test rerources work. | 62599038a8ecb033258723a8 |
class PygameSystem( PygameFpsLimitMixin, PygameAudioMixin, PygameDisplayMixin, PygameJoystickMixin, ): <NEW_LINE> <INDENT> pass | This mixin simply combines the Display, Joystick, FpsLimit, and Audio mixins to provide a minimally-functional,
bare-bones interactive emulator. | 62599038b57a9660fecd2c04 |
class itkCenteredAffineTransformD3(itkAffineTransformPython.itkAffineTransformD3): <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> __repr_... | Proxy of C++ itkCenteredAffineTransformD3 class | 6259903876d4e153a661db37 |
class Square(Rectangle): <NEW_LINE> <INDENT> def __init__(self, size): <NEW_LINE> <INDENT> self.__size = size <NEW_LINE> <DEDENT> def integer_validator(self, size): <NEW_LINE> <INDENT> if type(self.__size) is not int: <NEW_LINE> <INDENT> raise TypeError("{} must be an integer".format(self.__size)) <NEW_LINE> <DEDENT> i... | Class Square - Type - Rectangle | 625990386fece00bbacccb35 |
class ExactInference(InferenceModule): <NEW_LINE> <INDENT> def initializeUniformly(self, gameState): <NEW_LINE> <INDENT> self.beliefs = util.Counter() <NEW_LINE> for p in self.legalPositions: self.beliefs[p] = 1.0 <NEW_LINE> self.beliefs.normalize() <NEW_LINE> <DEDENT> def observe(self, observation, gameState): <NEW_LI... | The exact dynamic inference module should use forward-algorithm
updates to compute the exact belief function at each time step. | 6259903891af0d3eaad3afbc |
class TestDetailedPlugin: <NEW_LINE> <INDENT> def test_creates(self, detailed_plugin: DetailedPlugin): <NEW_LINE> <INDENT> assert detailed_plugin | Tests for the DetailedPlugin model. | 6259903873bcbd0ca4bcb413 |
class SortingHelpFormatter(HelpFormatter): <NEW_LINE> <INDENT> def add_arguments(self, actions): <NEW_LINE> <INDENT> actions = sorted(actions, key=attrgetter('option_strings')) <NEW_LINE> super(SortingHelpFormatter, self).add_arguments(actions) | Sort options alphabetically when -h prints usage
See http://stackoverflow.com/questions/12268602 | 62599038d6c5a102081e32b1 |
class Monochromator(base.Monochromator): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Monochromator, self).__init__() <NEW_LINE> self._energy = 100 * q.keV <NEW_LINE> <DEDENT> async def _get_energy_real(self): <NEW_LINE> <INDENT> return self._energy <NEW_LINE> <DEDENT> async def _set_energy_real(se... | Monochromator class implementation. | 6259903871ff763f4b5e8924 |
class TimeCycle(PmmlBinding): <NEW_LINE> <INDENT> def toPFA(self, options, context): <NEW_LINE> <INDENT> raise NotImplementedError | Represents a <TimeCycle> tag and provides methods to convert to PFA. | 62599038796e427e5384f907 |
class startup_binder_drone(bee.drone): <NEW_LINE> <INDENT> def on_start(self): <NEW_LINE> <INDENT> for entity_name in self.get_entity_names(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> hivemap_name = self.get_hivemap(entity_name) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> s... | Provides plugins for scene-object binding on startup | 625990381d351010ab8f4ca5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.