citelang package
Submodules
citelang.defaults module
citelang.logger module
- class citelang.logger.ColorizingStreamHandler(nocolor=False, stream=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, use_threads=False)[source]
Bases:
StreamHandler
- BLACK = 0
- BLUE = 4
- BOLD_SEQ = '\x1b[1m'
- COLOR_SEQ = '\x1b[%dm'
- CYAN = 6
- GREEN = 2
- MAGENTA = 5
- RED = 1
- RESET_SEQ = '\x1b[0m'
- WHITE = 7
- YELLOW = 3
- colors = {'CRITICAL': 1, 'DEBUG': 4, 'ERROR': 1, 'INFO': 2, 'WARNING': 3}
- emit(record)[source]
Emit a record.
If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.
- property is_tty
- class citelang.logger.Logger[source]
Bases:
object
citelang.main module
citelang.main.base module
- class citelang.main.base.BaseClient(quiet=False, **kwargs)[source]
Bases:
object
A baseclient controls interactions with endpoints and the cache.
- dependencies(manager, name, use_cache=True)[source]
Get dependencies for a package. If no version, use latest.
- graph(fmt=None, *args, **kwargs)[source]
Generate a graph for a package.
credit_split is how to split credit between some package and its dependents. E.g., 0.5 means 50/50. 0.8 means the main package gets 80%, and dependencies split 20%. We go up until the min credit 0.05 at which case we stop adding.
citelang.main.client module
citelang.main.endpoints module
- class citelang.main.endpoints.Dependencies(require_params=False, *args, **kwargs)[source]
Bases:
Endpoint
- dont_truncate = ['project_name']
- emoji = 'arrow'
- format_url = ['manager', 'package_name', 'version']
- name = 'dependencies'
- path = '/api/{manager}/{package_name}/{version}/dependencies'
- skips = ['normalized_licenses']
- class citelang.main.endpoints.Endpoint(require_params=False, *args, **kwargs)[source]
Bases:
object
- dont_truncate = ['url']
- emoji = 'sparkles'
- property skip_list
- table_data(data)[source]
A custom data parser, optionally if an endpoint needs to parse data further.
- property title
- property truncate_list
- property url
- class citelang.main.endpoints.Package(require_params=False, *args, **kwargs)[source]
Bases:
Endpoint
- emoji = 'box'
- format_url = ['manager', 'package_name']
- name = 'package'
- path = '/api/{manager}/{package_name}'
- skips = ['repository_sources', 'spdx_expression', 'researched_at', 'original_license']
- table_data(data)[source]
A custom data parser, optionally if an endpoint needs to parse data further.
- property title
- class citelang.main.endpoints.PackageManagers(require_params=False, *args, **kwargs)[source]
Bases:
Endpoint
- emoji = 'box'
- name = 'package_managers'
- path = '/api/platforms'
- skips = ['color']
- citelang.main.endpoints.endpoint
alias of
Dependencies
citelang.main.package module
- class citelang.main.package.CustomPackage(manager, name, version=None, data=None, use_cache=True, manager_kwargs=None)[source]
Bases:
PackageBase
A wrapper for a custom package (provided by citelang)
- property homepage
- class citelang.main.package.Package(manager, name, version=None, data=None, use_cache=True, manager_kwargs=None)[source]
Bases:
PackageBase
A basic wrapper for package parsing functions (libraries.io)
citelang.main.result module
- class citelang.main.result.Badge(result)[source]
Bases:
Tree
This is an static badge that uses plotly.
- class citelang.main.result.Graph(root)[source]
Bases:
Result
A graph result can generate text for a graph
- class citelang.main.result.InteractiveBadge(result)[source]
Bases:
Tree
A badge uses tree data with d3 for an interactive visualization
- class citelang.main.result.Result(data, endpoint=None)[source]
Bases:
object
A result holds the request result and can parse or return in different formats.
- class citelang.main.result.Table(data, endpoint=None)[source]
Bases:
Result
A table is a result formatted as a table for the client.
citelang.main.schemas module
citelang.main.settings module
- class citelang.main.settings.Settings(settings_file, validate=True)[source]
Bases:
SettingsBase
The settings class is a wrapper for easily parsing a settings.yml file.
We parse into a query-able class. It also gives us control to update settings, meaning we change the values and then write them to file. It’s basically a dictionary-like class with extra functions.
- class citelang.main.settings.SettingsBase(settings_file=None, validate=True)[source]
Bases:
object
- get_settings_file(settings_file=None)[source]
Get the preferred user settings file, set user settings if exists.
- update_param(command, param)[source]
Given a parameter, update the configuration on the fly if it’s in set/add/remove
citelang.main.graph module
citelang.main.graph.base module
citelang.main.graph.cypher module
citelang.main.graph.dot module
citelang.main.graph.gexf module
citelang.main.graph.text module
citelang.main.graph.tree module
citelang.main.packages module
citelang.main.packages.spack module
- class citelang.main.packages.spack.SpackManager(*args, **kwargs)[source]
Bases:
PackageManager
Packages from spack.
- apiroot = 'https://packages.spack.io/data'
- color = '#0f3a80'
- default_language = None
- default_versions = []
- dependencies(name)[source]
Get dependencies for a spack package
Some package managers have separate endpoints for this, but we use the same package endpoint and return that data.
- homepage = 'https://spack.github.io/packages'
- name = 'spack'
- property project_count
citelang.main.packages.github module
- class citelang.main.packages.github.GitHubManager(*args, **kwargs)[source]
Bases:
PackageManager
Packages from GitHub, either release, or branch.
- apiroot = 'https://api.github.com'
- color = '#000000'
- default_language = None
- default_versions = ['main', 'master', 'develop']
- homepage = 'https://github.com'
- name = 'github'
- project_count = None
citelang.utils module
citelang.utils.fileio module
- citelang.utils.fileio.get_tmpdir(tmpdir=None, prefix='', create=True)[source]
Get a temporary directory for an operation.
- citelang.utils.fileio.get_tmpfile(tmpdir=None, prefix='')[source]
Get a temporary file with an optional prefix.
- citelang.utils.fileio.mkdir_p(path)[source]
mkdir_p attempts to get the same functionality as mkdir -p :param path: the path to create.
- citelang.utils.fileio.workdir(dirname)[source]
Do something in the context of a directory, and then change back
citelang.utils.terminal module
- citelang.utils.terminal.confirm_action(question, force=False)[source]
confirm if the user wants to perform a certain action
Parameters
question: the question that will be asked force: if the user wants to skip the prompt
- citelang.utils.terminal.confirm_uninstall(filename, force=False)[source]
confirm if the user wants to uninstall a module
Parameters
filename: the file that will be removed force: if the user wants to skip the prompt
- citelang.utils.terminal.get_installdir()[source]
get_installdir returns the installation directory of the application
- citelang.utils.terminal.run_command(cmd, sudo=False, stream=False)[source]
run_command uses subprocess to send a command to the terminal.
Parameters
cmd: the command to send, should be a list for subprocess error_message: the error message to give to user if fails, if none specified, will alert that command failed.