for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from six.moves import UserDict
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
class SomeClass: def some_method(self): """Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.
six.moves
This can be caused by one of the following:
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
# .scrutinizer.yml before_commands: - sudo pip install abc # Python2 - sudo pip3 install abc # Python3
This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.
__init__.py
from functools import partial
from topik.singleton_registry import _base_register_decorator
# This subclass serves to establish a new singleton instance of functions
# for this particular step in topic modeling. No implementation necessary.
class ModelRegistry(UserDict, object):
object
UserDict
"""Uses Borg design pattern. Core idea is that there is a global registry for each step's
possible methods
"""
__shared_state = {}
def __init__(self, *args, **kwargs):
self.__dict__ = self.__shared_state
self
super(ModelRegistry, self).__init__(*args, **kwargs)
args
kwargs
# a nicer, more pythonic handle to our singleton instance
registered_models = ModelRegistry()
registered_models
(([A-Z_][A-Z0-9_]*)|(__.*__))$
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.
# fill in the registration function
register = partial(_base_register_decorator, registered_models)
register
_base_register_decorator
# this function is the primary API for people using any registered functions.
def run_model(input_data, model_name='lda', ntopics=3, **kwargs):
return registered_models[model_name](input_data, ntopics, **kwargs)
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.