abc.abstractmethod

Here are the examples of the python api abc.abstractmethod taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

Example 1

Project: bsd-cloudinit
Source File: serializer.py
View license
    @abc.abstractmethod
    def deserialize_entity(self, context, entity):
        """Deserialize something from primitive form.

        :param context: Security context
        :param entity: Primitive to be deserialized
        :returns: Deserialized form of entity
        """
        pass

Example 2

Project: chainer
Source File: serializer.py
View license
    @abc.abstractmethod
    def __getitem__(self, key):
        """Gets a child serializer.

        This operator creates a _child_ serializer represented by the given
        key.

        Args:
            key (str): Name of the child serializer.

        """
        raise NotImplementedError

Example 3

Project: PHEnix
Source File: __init__.py
View license
    @abc.abstractmethod
    def create_aux_files(self, ref):
        """Create required auxiliary files for *ref*.
        
        Parameters
        ----------
        ref: str
            Path to the reference file.
        
        Returns
        -------
        bool:
            True if auxiliary files were created, False otherwise.
        """
        raise NotImplementedError("creating auxiliary has not been implemented yet.")

Example 4

Project: sdk-python
Source File: apicontrollersbase.py
View license
    @abc.abstractmethod
    def execute(self):
        '''
        Makes a http-post call. 
        Uses request xml and response class type to check that the response was of correct type
        '''
        pass

Example 5

Project: presto-admin
Source File: base_cluster.py
View license
    @abc.abstractmethod
    def run_script_on_host(self, script_contents, host, tty=True):
        """Create a script on the remote host with the given content and execute it.

        NOTE: if tty is set to True then the results of the execution on stdout will
        have ^M (carriage return) at the end of every line. If doing string
        comparison of the output, turn off tty.

        :param script_contents: a string with the script contents
        :param host: the host where to execute the script
        :param tty: whether to execute the script with tty enabled
        """
        pass

Example 6

Project: pymanopt
Source File: solver.py
View license
    @abc.abstractmethod
    def solve(self, problem, x=None):
        '''
        Solve the given :py:class:`pymanopt.core.problem.Problem` (starting
        from a random initial guess if the optional argument x is not
        provided).
        '''
        pass

Example 7

Project: pysb
Source File: bng.py
View license
    @abc.abstractmethod
    def __init__(self, model=None, verbose=False, cleanup=False,
                 output_prefix=None, output_dir=None):
        self._base_file_stem = 'pysb'
        self.verbose = verbose
        self.cleanup = cleanup
        self.output_prefix = 'tmpBNG' if output_prefix is None else \
            output_prefix
        if model:
            self.generator = BngGenerator(model)
            self.model = self.generator.model
            self._check_model()
        else:
            self.generator = None
            self.model = None

        self.base_directory = tempfile.mkdtemp(prefix=self.output_prefix,
                                               dir=output_dir)

Example 8

Project: pyspace
Source File: WindowerInterface.py
View license
    @abc.abstractmethod
    def read(self, nblocks):
        """ Read *nblocks* of the stream and pass it to registers functions 
        
        The callback function that is registered by the windower has the
        signature 'func_name(self, ndsamples, ndmarkers)' where ndsamples
        is a numpy 2d-array with shape (number_of_sensors x stdblocksize) and
        ndmarkerks is a numpy ndarray of length stdblocksize filled with the
        unique marker ids (ints) where the events occurred and -1 otherwise.
        The read function has to provide this two arrays and then pass it
        to the callback functions. It should in addition return the number of
        read blocks.
        """
        return

Example 9

Project: python-acoustics
Source File: directivity.py
View license
    @abc.abstractmethod
    def _directivity(self, theta, phi):
        """
        This function should return the directivity as function of :math:`\\theta` and :math:`\\phi`.
        """
        pass

Example 10

Project: fe
Source File: api.py
View license
	@abc.abstractmethod
	def proc(self,
		procedure_id : \
			"The procedure identifier; a valid ``regprocedure`` or Oid."
	) -> StoredProcedure:
		"""

Example 11

Project: python-future
Source File: _policybase.py
View license
    @abc.abstractmethod
    def fold_binary(self, name, value):
        """Given the header name and the value from the model, return binary
        data containing linesep characters that implement the folding of the
        header according to the policy controls.  The value passed in by the
        email package may contain surrogateescaped binary data.

        """
        raise NotImplementedError

Example 12

Project: pyudev
Source File: discover.py
View license
    @classmethod
    @abc.abstractmethod
    def match(cls, value): # pragma: no cover
        """
        Match the given string according to the hypothesis.

        The purpose of this method is to obtain a value corresponding to
        ``value`` if that is possible. It may use a regular expression, but
        in general it should just return ``value`` and let the lookup method
        sort out the rest.

        :param str value: the string to inspect
        :returns: the matched thing or None if unmatched
        :rtype: the type of lookup's key parameter or NoneType
        """
        raise NotImplementedError()

Example 13

Project: python-qinfer
Source File: abstract_model.py
View license
    @abc.abstractmethod
    def domain(self, exparams):
        """
        Returns a list of :class:`Domain` objects, one for each input expparam.

        :param numpy.ndarray expparams:  Array of experimental parameters. This
            array must be of dtype agreeing with the ``expparams_dtype``
            property, or, in the case where ``n_outcomes_constant`` is ``True``,
            ``None`` should be a valid input.

        :rtype: list of :class:`Domain`
        """
        pass

Example 14

Project: qtile
Source File: command.py
View license
    @abc.abstractmethod
    def _select(self, name, sel):
        """Select the given item of the given item class

        This method is called with the following guarantees:
            - `name` is a valid selector class for this item
            - `sel` is a valid selector for this item
            - the `(name, sel)` tuple is not an "impossible" combination (e.g. a
              selector is specified when `name` is not a containment object).

        Return None if no such object exists
        """
        pass

Example 15

Project: zipline
Source File: execution.py
View license
    @abc.abstractmethod
    def get_stop_price(self, is_buy):
        """
        Get the stop price for this order.
        Returns either None or a numerical value >= 0.
        """
        raise NotImplemented

Example 16

Project: blivet
Source File: manager.py
View license
    @abc.abstractmethod
    def enable(self):
        """ Enable monitoring and handling of events.

            :raises: :class:`~.errors.EventManagerError` if no callback defined
        """
        if self.handler_cb is None:
            raise EventManagerError("cannot enable handler with no callback")

        event_log.info("enabling event handling")

Example 17

Project: rqalpha
Source File: data_accessor.py
View license
    @abc.abstractmethod
    def history(self, order_book_id, dt, bar_count, frequency, field):
        """get history data

        :param str order_book_id:
        :param datetime dt:
        :param int bar_count:
        :param str frequency: '1d' or '1m'
        :param str field: "open", "close", "high", "low", "volume", "last", "total_turnover"
        :returns:
        :rtype: pandas.DataFrame

        """
        raise NotImplementedError

Example 18

Project: imagrium
Source File: test_abc.py
View license
    def test_abstractmethod_basics(self):
        @abc.abstractmethod
        def foo(self): pass
        self.assertTrue(foo.__isabstractmethod__)
        def bar(self): pass
        self.assertFalse(hasattr(bar, "__isabstractmethod__"))

Example 19

Project: mortar-luigi
Source File: dbms.py
View license
    @abc.abstractmethod
    def table_name(self):
        """
        Name of the table on which operation should be performed.

        :rtype: str:
        :returns: table_name for operation
        """
        raise RuntimeError("Please implement the table_name method in your DBMSTask subclass")

Example 20

Project: tasklib
Source File: backends.py
View license
    @abc.abstractmethod
    def refresh_task(self, task, after_save=False):
        """
        Refreshes the given task. Returns new data dict with serialized
        attributes.
        """
        pass

Example 21

Project: retdec-python
Source File: decompiler.py
View license
    @abc.abstractmethod
    def display_generation_failure(self, what, reason):
        """Displays a warning message that `what` failed to be generated
        because of `reason`.
        """
        raise NotImplementedError

Example 22

Project: libmunin
Source File: __init__.py
View license
    @abc.abstractmethod
    def do_compute(self, list_a, list_b):
        """Compare both lists with eq by default.

        This goes through both lists and counts the matching elements at the same index.

        :return: Number of matches divivded through the max length of both lists.
        """
        # Default to max. diversity:
        n_max = max(len(list_a), len(list_b))
        if n_max is 0:
            return 1.0

        return 1.0 - sum(a == b for a, b in zip(list_a, list_b)) / n_max

Example 23

Project: Ice
Source File: backing_store.py
View license
  @abc.abstractmethod
  def add_identifier(self, ident):
    """
    Adds an identifier to the BackingStore. Throws an ValueError if an
    identifier already exists with that id.
    """
    pass

Example 24

Project: splash
Source File: qtrender.py
View license
    @abc.abstractmethod
    def get_result(self):
        """
        This method is called to get the result after the requested page is
        downloaded and rendered. Subclasses should implement it to customize
        which data to return.
        """
        pass

Example 25

Project: selinon
Source File: selinonTask.py
View license
    @abc.abstractmethod
    def run(self, node_args):
        """
        Task's entrypoint - user defined computation

        :param node_args: arguments passed to flow/node
        :return: tasks's result that will be stored in database as configured
        """
        pass

Example 26

Project: coursys
Source File: base.py
View license
    @abc.abstractmethod
    def short_summary(self):
        """
        A short-line text-only summary of the event for summary displays

        """
        pass

Example 27

Project: shuup
Source File: charts.py
View license
    @abc.abstractmethod
    def get_config(self):
        """
        Get a JSONable dictionary of configuration data for this chart.
        This is passed on as `CHART_CONFIGS` in the JS environment and eventually
        processed by `dashboard-charts.js`.

        :return: Dict of configuration
        :rtype: dict
        """
        return {}  # Implement me in a subclass, please.

Example 28

Project: cosmic-ray
Source File: test_runner.py
View license
    @abc.abstractmethod
    def _run(self):
        """Run all of the tests and return the results.

        The results are returned as a (success, result)
        tuple. `success` is a boolean indicating if the tests
        passed. `result` is any object that is appropriate to provide
        more information about the success/failure of the tests.
        """
        raise NotImplemented()

Example 29

Project: postpic
Source File: datareader.py
View license
    @abc.abstractmethod
    def keys(self):
        '''
        Returns:
          a list of keys, that can be used in __getitem__ to read
          any information from this dump.
        '''
        pass

Example 30

Project: luigi
Source File: hive.py
View license
    @abc.abstractmethod
    def table_location(self, table, database='default', partition=None):
        """
        Returns location of db.table (or db.table.partition). partition is a dict of partition key to
        value.
        """
        pass

Example 31

Project: st2
Source File: __init__.py
View license
    @abc.abstractmethod
    def run_and_print(self, args, **kwargs):
        """
        This method is invoked when the corresponding command is executed
        from the command line.
        """
        raise NotImplementedError

Example 32

Project: repositorytools
Source File: common.py
View license
    @abc.abstractmethod
    def _get_parser(self):
        """
        :return: argparse.ArgumentParser
        """
        pass

Example 33

Project: Comp-Finance
Source File: Optimizer.py
View license
    @abc.abstractmethod
    def optimize(self, iterations=1000, stopping=True):
        """
        This is the generic optimization method to be overloaded by each optimizer
        :param stopping: whether or not the algorithm should use early stopping
        :param iterations: the number of iterations to optimize for, default is 1000
        """
        return

Example 34

Project: subuser
Source File: fileStructure.py
View license
  @abc.abstractmethod
  def read(self,path):
    """
    Returns the contents of the given file.
    """
    pass

Example 35

Project: TabPy
Source File: query_object.py
View license
    @abc.abstractmethod
    def get_doc_string(self):
        '''Returns documentation for the query object

        By default, this method returns the docstring for 'query' method
        Derived class may overwrite this method to dynamically create doc string
        '''
        pass

Example 36

Project: pysimsearch
Source File: sim_index.py
View license
    @abc.abstractmethod
    def index_files(self, named_files):
        '''Add ``named_files`` to the index
        
        Params:
            named_files: iterable of (filename, file) pairs.
                         Takes ownership of (and consumes) the files.
        '''
        return

Example 37

Project: models
Source File: accountant.py
View license
  @abc.abstractmethod
  def _compute_log_moment(self, sigma, q, moment_order):
    """Compute high moment of privacy loss.

    Args:
      sigma: the noise sigma, in the multiples of the sensitivity.
      q: the sampling ratio.
      moment_order: the order of moment.
    Returns:
      log E[exp(moment_order * X)]
    """
    pass

Example 38

Project: forseti
Source File: base.py
View license
    @abc.abstractmethod
    def generate_ami(self):
        """
        Generate the AMI to be used in the autoscale group.
        """
        pass

Example 39

Project: TrustRouter
Source File: abc.py
View license
    @abc.abstractmethod
    def find_module(self, fullname, path=None):
        """Abstract method which when implemented should find a module.
        The fullname is a str and the optional path is a str or None.
        Returns a Loader object.
        """
        raise NotImplementedError

Example 40

Project: tuskar
Source File: policy.py
View license
    @abc.abstractmethod
    def __call__(self, target, cred):
        """
        Perform the check.  Returns False to reject the access or a
        true value (not necessary True) to accept the access.
        """

        pass

Example 41

Project: abjad
Source File: ScorePackageScript.py
View license
    @abc.abstractmethod
    def _setup_argument_parser(self, parser):
        parser.add_argument(
            '-s', '--score-path',
            metavar='SCORE_PATH',
            default=os.path.curdir,
            )

Example 42

Project: sts
Source File: controllers.py
View license
  @abc.abstractmethod
  def check_status(self, simulation):
    """
    Check whether the actual status of the controller coincides with self.state

    Returns a tuple of ControllerStatus and message entailing the details of
    the status.
    """
    raise NotImplementedError()

Example 43

Project: FIDDLE
Source File: data_decoder.py
View license
  @abc.abstractmethod
  def decode(self, data, items):
    """Decodes the data to returns the tensors specified by the list of items.

    Args:
      data: A possibly encoded data format.
      items: A list of strings, each of which indicate a particular data type.

    Returns:
      A list of `Tensors`, whose length matches the length of `items`, where
      each `Tensor` corresponds to each item.

    Raises:
      ValueError: If any of the items cannot be satisfied.
    """
    pass

Example 44

Project: raco
Source File: testquery.py
View license
    @abc.abstractmethod
    def run(self, name, tmppath):
        """
        Run the query on this platform.
        Note that implementations are allowed to raise
        exceptions if execution of the query on the platform
        fails.

        @param name query name
        @return path of output file
        """
        pass

Example 45

Project: rest_toolkit
Source File: abc.py
View license
    @abc.abstractmethod
    def to_dict(self):
        """Generate a (JSON-compatible) dictionary with resource data.

        This method is used by the default GET, PATCH and PUT views to generate
        the data for the response.
        """
        raise NotImplemented()

Example 46

Project: wtframework
Source File: page.py
View license
    @abc.abstractmethod
    def _validate_page(self, webdriver):
        """Perform checks to validate this page is the correct target page.

        All PageObjects must implement this method.

        Args:
            webdriver (Webdriver) : instance of Selenium Webdriver
        Raises:
            InvalidPageError: Raised when we try to assign the wrong page 
            to this page object.  This exception should be raised when a page match 
            fails.  Any other exception type would be consider a code failure.

        """
        return

Example 47

Project: linkchecker
Source File: __init__.py
View license
    @abc.abstractmethod
    def log_url (self, url_data):
        """
        Log a new url with this logger.
        """
        pass

Example 48

Project: wfuzz
Source File: base.py
View license
    @abc.abstractmethod
    def fr_headers(self):
	"""
	Gets HTTP request headers in the form of a dictionary.dict(request = {}, response = {})
	"""
	return

Example 49

Project: scikit-bio
Source File: _mixin.py
View license
    @abc.abstractmethod
    def _positional_metadata_axis_len_(self):
        """Return length of axis that positional metadata applies to.

        Returns
        -------
        int
            Positional metadata axis length.

        """
        raise NotImplementedError

Example 50

Project: Z2Pack
Source File: _result.py
View license
    @property
    @abc.abstractmethod
    def convergence_report(self):
        r"""
        Returns a convergence report (as a string) for the result. This report shows whether the convergence options used for calculating this result were satisfied or not.
        """
        pass