PK{}~M wily/__init__.py""" Wily. A Python application for tracking, reporting on timing and complexity in tests and applications. """ import colorlog import datetime __version__ = "1.6.0" _handler = colorlog.StreamHandler() _handler.setFormatter(colorlog.ColoredFormatter("%(log_color)s%(message)s")) logger = colorlog.getLogger(__name__) logger.addHandler(_handler) """ Max number of characters of the Git commit to print """ MAX_MESSAGE_WIDTH = 50 def format_date(timestamp): """Reusable timestamp -> date.""" return datetime.date.fromtimestamp(timestamp).isoformat() def format_datetime(timestamp): """Reusable timestamp -> datetime.""" return datetime.datetime.fromtimestamp(timestamp).isoformat() def format_revision(sha): """Return a shorter git sha.""" return sha[:7] PK{}~MHbY wily/__main__.py# -*- coding: UTF-8 -*- """Main command line.""" import os.path import click from wily import logger from wily.archivers import resolve_archiver from wily.cache import exists, get_default_metrics from wily.config import DEFAULT_CONFIG_PATH, DEFAULT_CACHE_PATH from wily.config import load as load_config from wily.operators import resolve_operators @click.group() @click.option( "--debug/--no-debug", default=False, help="Print debug information, used for development", ) @click.option( "--config", default=DEFAULT_CONFIG_PATH, help="Path to configuration file, defaults to wily.cfg", ) @click.option( "-p", "--path", type=click.Path(resolve_path=True), default=".", help="Root path to the project folder to scan", ) @click.pass_context def cli(ctx, debug, config, path): """ \U0001F98A Inspect and search through the complexity of your source code. To get started, run setup: $ wily setup To reindex any changes in your source code: $ wily build Then explore basic metrics with: $ wily report You can also graph specific metrics in a browser with: $ wily graph """ ctx.ensure_object(dict) ctx.obj["DEBUG"] = debug if debug: logger.setLevel("DEBUG") else: logger.setLevel("INFO") ctx.obj["CONFIG"] = load_config(config) if path: logger.debug(f"Fixing path to {path}") ctx.obj["CONFIG"].path = path ctx.obj["CONFIG"].cache_path = os.path.join(path, DEFAULT_CACHE_PATH) logger.debug(f"Loaded configuration from {config}") @cli.command() @click.option( "-n", "--max-revisions", default=None, type=click.INT, help="The maximum number of historical commits to archive", ) @click.argument("targets", type=click.Path(resolve_path=True), nargs=-1, required=True) @click.option( "-o", "--operators", type=click.STRING, help="List of operators, separated by commas", ) @click.option( "--skip-gitignore-check/--gitignore-check", default=False, help="Skip checking of .gitignore for '.wily/'", ) @click.pass_context def build(ctx, max_revisions, targets, operators, skip_gitignore_check): """Build the wily cache.""" config = ctx.obj["CONFIG"] from wily.commands.build import build if max_revisions: logger.debug(f"Fixing revisions to {max_revisions}") config.max_revisions = max_revisions if operators: logger.debug(f"Fixing operators to {operators}") config.operators = operators.strip().split(",") config.skip_ignore_check = skip_gitignore_check logger.debug(f"Fixing targets to {targets}") config.targets = targets build( config=config, archiver=resolve_archiver(config.archiver), operators=resolve_operators(config.operators), ) logger.info( "Completed building wily history, run `wily report ` or `wily index` to see more." ) @cli.command() @click.pass_context @click.option("--message/--no-message", default=False, help="Include revision message") def index(ctx, message): """Show the history archive in the .wily/ folder.""" config = ctx.obj["CONFIG"] if not exists(config): handle_no_cache(ctx) from wily.commands.index import index index(config=config, include_message=message) @cli.command() @click.argument("file", type=click.Path(resolve_path=False)) @click.argument("metrics", nargs=-1, required=False) @click.option("-n", "--number", help="Number of items to show", type=click.INT) @click.option("--message/--no-message", default=False, help="Include revision message") @click.pass_context def report(ctx, file, metrics, number, message): """Show metrics for a given file.""" config = ctx.obj["CONFIG"] if not exists(config): handle_no_cache(ctx) if not metrics: metrics = get_default_metrics(config) logger.info(f"Using default metrics {metrics}") from wily.commands.report import report logger.debug(f"Running report on {file} for metric {metrics}") report(config=config, path=file, metrics=metrics, n=number, include_message=message) @cli.command() @click.argument("files", type=click.Path(resolve_path=False), nargs=-1, required=True) @click.option( "--metrics", default=None, help="comma-seperated list of metrics, see list-metrics for choices", ) @click.option( "--all/--changes-only", default=False, help="Show all files, instead of changes only", ) @click.option( "--detail/--no-detail", default=True, help="Show function/class level metrics where available", ) @click.pass_context def diff(ctx, files, metrics, all, detail): """Show the differences in metrics for each file.""" config = ctx.obj["CONFIG"] if not exists(config): handle_no_cache(ctx) if not metrics: metrics = get_default_metrics(config) logger.info(f"Using default metrics {metrics}") else: metrics = metrics.split(",") logger.info(f"Using specified metrics {metrics}") from wily.commands.diff import diff logger.debug(f"Running diff on {files} for metric {metrics}") diff( config=config, files=files, metrics=metrics, changes_only=not all, detail=detail ) @cli.command() @click.argument("path", type=click.Path(resolve_path=False)) @click.argument("metrics", nargs=-2, required=True) @click.option( "-o", "--output", help="Output report to specified HTML path, e.g. reports/out.html" ) @click.option("-x", "--x-axis", help="Metric to use on x-axis, defaults to history.") @click.option( "-a/-c", "--changes/--all", default=True, help="All commits or changes only" ) @click.pass_context def graph(ctx, path, metrics, output, x_axis, changes): """ Graph a specific metric for a given file, if a path is given, all files within path will be graphed. Some common examples: Graph all .py files within src/ for the raw.loc metric $ wily graph src/ raw.loc Graph test.py against raw.loc and cyclomatic.complexity metrics $ wily graph src/test.py raw.loc cyclomatic.complexity Graph test.py against raw.loc and raw.sloc on the x-axis $ wily graph src/test.py raw.loc --x-axis raw.sloc """ config = ctx.obj["CONFIG"] if not exists(config): handle_no_cache(ctx) from wily.commands.graph import graph logger.debug(f"Running report on {path} for metrics {metrics}") graph( config=config, path=path, metrics=metrics, output=output, x_axis=x_axis, changes=changes, ) @cli.command() @click.option("-y/-p", "--yes/--prompt", default=False, help="Skip prompt") @click.pass_context def clean(ctx, yes): """Clear the .wily/ folder.""" config = ctx.obj["CONFIG"] if not exists(config): handle_no_cache(ctx) if not yes: p = input("Are you sure you want to delete wily cache? [y/N]") if p.lower() != "y": exit(0) from wily.cache import clean clean(config) @cli.command("list-metrics") @click.pass_context def list_metrics(ctx): """List the available metrics.""" config = ctx.obj["CONFIG"] if not exists(config): handle_no_cache(ctx) from wily.commands.list_metrics import list_metrics list_metrics() @cli.command("setup") @click.pass_context def setup(ctx): """Run a guided setup to build the wily cache.""" handle_no_cache(ctx) def handle_no_cache(context): """Handle lack-of-cache error, prompt user for index process.""" logger.error( f"Could not locate wily cache, the cache is required to provide insights." ) p = input("Do you want to run setup and index your project now? [y/N]") if p.lower() != "y": exit(1) else: revisions = input("How many previous git revisions do you want to index? : ") revisions = int(revisions) path = input("Path to your source files; comma-separated for multiple: ") paths = path.split(",") context.invoke( build, max_revisions=revisions, targets=paths, operators=None, skip_gitignore_check=False, ) if __name__ == "__main__": cli() # pragma: no cover PK {~Mw.[pp wily/cache.py""" A module for working with the .wily/ cache directory. This API is not intended to be public and should not be consumed directly. The API in this module is for archivers and commands to work with the local cache TODO: Version .wily/ cache folders? """ import json import os.path import pathlib import shutil from wily import logger, __version__ from wily.archivers import ALL_ARCHIVERS from wily.operators import resolve_operator def exists(config): """ Check whether the .wily/ directory exists. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :return: Whether the .wily directory exists :rtype: ``boolean`` """ exists = ( pathlib.Path(config.cache_path).exists() and pathlib.Path(config.cache_path).is_dir() ) if not exists: return False index_path = pathlib.Path(config.cache_path) / "index.json" if index_path.exists(): with open(index_path, "r") as out: index = json.load(out) if index["version"] != __version__: # TODO: Inspect the versions properly. logger.warning( "! Wily cache is old, you may incur errors until you rebuild the cache." ) else: logger.warning( "Wily cache was not versioned, you may incur errors until you rebuild the cache." ) create_index(config) return True def create_index(config): """Create the root index.""" filename = pathlib.Path(config.cache_path) / "index.json" index = {"version": __version__} with open(filename, "w") as out: out.write(json.dumps(index, indent=2)) def create(config): """ Create a wily cache. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :return: The path to the cache :rtype: ``str`` """ if exists(config): logger.debug("Wily cache exists, skipping") return config.cache_path logger.debug(f"Creating wily cache {config.cache_path}") pathlib.Path(config.cache_path).mkdir() create_index(config) return config.cache_path def clean(config): """ Delete a wily cache. :param config: The configuration :type config: :class:`wily.config.WilyConfig` """ if not exists(config): logger.debug("Wily cache does not exist, skipping") return shutil.rmtree(config.cache_path) logger.debug("Deleted wily cache") def store(config, archiver, revision, stats): """ Store a revision record within an archiver folder. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :param archiver: The name of the archiver type (e.g. 'git') :type archiver: ``str`` :param revision: The revision ID :type revision: ``str`` :param stats: The collected data :type stats: ``dict`` :return: The absolute path to the created file :rtype: ``str`` :rtype: `pathlib.Path` """ root = pathlib.Path(config.cache_path) / archiver.name if not root.exists(): logger.debug("Creating wily cache") root.mkdir() # fix absolute path references. if config.path != ".": for operator, operator_data in list(stats["operator_data"].items()): if operator_data: new_operator_data = operator_data.copy() for k, v in list(operator_data.items()): new_key = os.path.relpath(str(k), str(config.path)) del new_operator_data[k] new_operator_data[new_key] = v del stats["operator_data"][operator] stats["operator_data"][operator] = new_operator_data logger.debug(f"Creating {revision.key} output") filename = root / (revision.key + ".json") if filename.exists(): raise RuntimeError(f"File {filename} already exists, index may be corrupt.") with open(filename, "w") as out: out.write(json.dumps(stats, indent=2)) return filename def store_archiver_index(config, archiver, index): """ Store an archiver's index record for faster search. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :param archiver: The name of the archiver type (e.g. 'git') :type archiver: ``str`` :param index: The archiver index record :type index: ``dict`` :rtype: `pathlib.Path` """ root = pathlib.Path(config.cache_path) / archiver.name if not root.exists(): root.mkdir() logger.debug("Created archiver directory") index = sorted(index, key=lambda k: k["date"], reverse=True) filename = root / "index.json" with open(filename, "w") as out: out.write(json.dumps(index, indent=2)) logger.debug(f"Created index output") return filename def list_archivers(config): """ List the names of archivers with data. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :return: A list of archiver names :rtype: ``list`` of ``str`` """ root = pathlib.Path(config.cache_path) result = [] for archiver in ALL_ARCHIVERS: if (root / archiver.name).exists(): result.append(archiver.name) return result def get_default_metrics(config): """ Get the default metrics for a configuration. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :return: Return the list of default metrics in this index :rtype: ``list`` of ``str`` """ archivers = list_archivers(config) default_metrics = [] for archiver in archivers: index = get_archiver_index(config, archiver) if len(index) == 0: logger.warning("No records found in the index, no metrics available") return [] operators = index[0]["operators"] for operator in operators: o = resolve_operator(operator) if o.cls.default_metric_index is not None: metric = o.cls.metrics[o.cls.default_metric_index] default_metrics.append("{0}.{1}".format(o.cls.name, metric.name)) return default_metrics def has_archiver_index(config, archiver): """ Check if this archiver has an index file. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :param archiver: The name of the archiver type (e.g. 'git') :type archiver: ``str`` :return: the exist :rtype: ``bool`` """ root = pathlib.Path(config.cache_path) / archiver / "index.json" return root.exists() def get_archiver_index(config, archiver): """ Get the contents of the archiver index file. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :param archiver: The name of the archiver type (e.g. 'git') :type archiver: ``str`` :return: The index data :rtype: ``dict`` """ root = pathlib.Path(config.cache_path) / archiver with (root / "index.json").open("r") as index_f: index = json.load(index_f) return index def get(config, archiver, revision): """ Get the data for a given revision. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :param archiver: The name of the archiver type (e.g. 'git') :type archiver: ``str`` :param revision: The revision ID :type revision: ``str`` :return: The data record for that revision :rtype: ``dict`` """ root = pathlib.Path(config.cache_path) / archiver # TODO : string escaping!!! with (root / f"{revision}.json").open("r") as rev_f: index = json.load(rev_f) return index PK {~M\+ + wily/config.py""" Configuration of wily. TODO : Handle operator settings. Maybe a section for each operator and then pass kwargs to operators? TODO : Better utilise default values and factory in @dataclass to replace DEFAULT_CONFIG and replace the logic in load() to set default values. """ import configparser import logging import pathlib from dataclasses import dataclass, field from typing import Any, List import wily.operators as operators from wily.archivers import ARCHIVER_GIT logger = logging.getLogger(__name__) """ The default path name to the cache """ DEFAULT_CACHE_PATH = ".wily" @dataclass class WilyConfig(object): """ Wily configuration. A data class to reflect the configurable options within Wily. """ operators: List archiver: Any path: str max_revisions: int skip_ignore_check: bool = False cache_path: str = DEFAULT_CACHE_PATH targets: List[str] = None checkout_options: dict = field(default_factory=dict) def __post_init__(self): """Clone targets as a list of path.""" if self.targets is None or "": self.targets = [self.path] # Default values for Wily """ The default operators """ DEFAULT_OPERATORS = { operators.OPERATOR_RAW.name, operators.OPERATOR_MAINTAINABILITY.name, operators.OPERATOR_CYCLOMATIC.name, } """ The name of the default archiver """ DEFAULT_ARCHIVER = ARCHIVER_GIT.name """ The default configuration file name """ DEFAULT_CONFIG_PATH = "wily.cfg" """ The default section name in the config """ DEFAULT_CONFIG_SECTION = "wily" """ The default maximum number of revisions to archiver """ DEFAULT_MAX_REVISIONS = 50 DEFAULT_PATH = "." """ The default configuration for Wily (if no config file exists) """ DEFAULT_CONFIG = WilyConfig( operators=DEFAULT_OPERATORS, archiver=DEFAULT_ARCHIVER, path=DEFAULT_PATH, max_revisions=DEFAULT_MAX_REVISIONS, ) """ Default table style in console. See tabulate docs for more. """ DEFAULT_GRID_STYLE = "fancy_grid" def load(config_path=DEFAULT_CONFIG_PATH): """ Load config file and set values to defaults where no present. :return: The configuration ``WilyConfig`` :rtype: :class:`wily.config.WilyConfig` """ if not pathlib.Path(config_path).exists(): logger.debug(f"Could not locate {config_path}, using default config.") return DEFAULT_CONFIG config = configparser.ConfigParser(default_section=DEFAULT_CONFIG_SECTION) config.read(config_path) operators = config.get( section=DEFAULT_CONFIG_SECTION, option="operators", fallback=DEFAULT_OPERATORS ) archiver = config.get( section=DEFAULT_CONFIG_SECTION, option="archiver", fallback=DEFAULT_ARCHIVER ) path = config.get(section=DEFAULT_CONFIG_SECTION, option="path", fallback=".") max_revisions = int( config.get( section=DEFAULT_CONFIG_SECTION, option="max_revisions", fallback=DEFAULT_MAX_REVISIONS, ) ) return WilyConfig( operators=operators, archiver=archiver, path=path, max_revisions=max_revisions ) PK {~M6aQQ wily/state.py""" For managing the state of the wily process. Contains a lazy revision, index and process state model. """ from collections import OrderedDict from dataclasses import dataclass, asdict from typing import List import wily.cache as cache from wily import logger from wily.archivers import Revision, resolve_archiver from wily.operators import get_metric @dataclass class IndexedRevision(object): """Union of revision and the operators executed.""" revision: Revision operators: List _data = None @staticmethod def fromdict(d): """Instantiate from a dictionary.""" rev = Revision( key=d["key"], author_name=d["author_name"], author_email=d["author_email"], date=d["date"], message=d["message"], ) operators = d["operators"] return IndexedRevision(revision=rev, operators=operators) def asdict(self): """Convert to dictionary.""" d = asdict(self.revision) d["operators"] = self.operators return d def get(self, config, archiver, operator, path, key): """ Get the metric data for this indexed revision. :param config: The wily config. :type config: :class:`wily.config.WilyConfig` :param archiver: The archiver. :type archiver: :class:`wily.archivers.Archiver` :param operator: The operator to find :type operator: ``str`` :param path: The path to find :type path: ``str`` :param key: The metric key :type key: ``str`` """ if not self._data: self._data = cache.get( config=config, archiver=archiver, revision=self.revision.key )["operator_data"] logger.debug(f"Fetching metric {path} - {key} for operator {operator}") return get_metric(self._data, operator, path, key) def store(self, config, archiver, stats): """ Store the stats for this indexed revision. :param config: The wily config. :type config: :class:`wily.config.WilyConfig` :param archiver: The archiver. :type archiver: :class:`wily.archivers.Archiver` :param stats: The data :type stats: ``dict`` """ self._data = stats return cache.store(config, archiver, self.revision, stats) class Index(object): """The index of the wily cache.""" operators = None def __init__(self, config, archiver): """ Instantiate a new index. :param config: The wily config. :type config: :class:`wily.config.WilyConfig` :param archiver: The archiver. :type archiver: :class:`wily.archivers.Archiver` """ self.config = config self.archiver = archiver self.data = ( cache.get_archiver_index(config, archiver.name) if cache.has_archiver_index(config, archiver.name) else [] ) self._revisions = OrderedDict() for d in self.data: self._revisions[d["key"]] = IndexedRevision.fromdict(d) def __len__(self): """Use length of revisions as len.""" return len(self._revisions) @property def revisions(self): """ List of all the revisions. :rtype: ``list`` of :class:`LazyRevision` """ return list(self._revisions.values()) @property def revision_keys(self): """ List of all the revision indexes. :rtype: ``list`` of ``str`` """ return list(self._revisions.keys()) def __contains__(self, item): """ Check if index contains `item`. :param item: The item to search for :type item: ``str``, :class:`Revision` or :class:`LazyRevision` :return: ``True`` for contains, ``False`` for not. """ if isinstance(item, Revision): return item.key in self._revisions elif isinstance(item, str): return item in self._revisions else: raise TypeError("Invalid type for __contains__ in Index.") def __getitem__(self, index): """Get the revision for a specific index.""" return self._revisions[index] def add(self, revision, operators): """ Add a revision to the index. :param revision: The revision. :type revision: :class:`Revision` or :class:`LazyRevision` """ ir = IndexedRevision( revision=revision, operators=[operator.name for operator in operators] ) self._revisions[revision.key] = ir return ir def save(self): """Save the index data back to the wily cache.""" data = [i.asdict() for i in self._revisions.values()] logger.debug(data) cache.store_archiver_index(self.config, self.archiver, data) class State(object): """ The wily process state. Includes indexes for each archiver. """ def __init__(self, config, archiver=None): """ Instantiate a new process state. :param config: The wily configuration. :type config: :class:`WilyConfig` :param archiver: The archiver (optional). :type archiver: :class:`wily.archivers.Archiver` """ if archiver: self.archivers = [archiver.name] else: self.archivers = cache.list_archivers(config) self.config = config self.index = {} for archiver in self.archivers: self.index[archiver] = Index(self.config, resolve_archiver(archiver)) self.default_archiver = self.archivers[0] def ensure_exists(self): """Ensure that cache directory exists.""" if not cache.exists(self.config): logger.debug("Wily cache not found, creating.") cache.create(self.config) logger.debug("Created wily cache") PKD{M$3wily/archivers/__init__.py""" Archivers module. Specifies a standard interface for finding revisions (versions) of a path and switching to them. """ from collections import namedtuple from dataclasses import dataclass class BaseArchiver(object): """Abstract Archiver Class.""" def revisions(self, path, max_revisions): """ Get the list of revisions. :param path: the path to target. :type path: ``str`` :param max_revisions: the maximum number of revisions. :type max_revisions: ``int`` :return: A list of revisions. :rtype: ``list`` of :class:`Revision` """ raise NotImplementedError def checkout(self, revision, **options): """ Checkout a specific revision. :param revision: The revision identifier. :type revision: :class:`Revision` :param options: Any additional options. :type options: ``dict`` """ raise NotImplementedError def finish(self): """Clean up any state if processing completed/failed.""" raise NotImplementedError @dataclass class Revision: """Represents a revision in the archiver.""" key: str author_name: str author_email: str date: str message: str from wily.archivers.git import GitArchiver """Type for an operator""" Archiver = namedtuple("Archiver", "name cls description") """Git Operator defined in `wily.archivers.git`""" ARCHIVER_GIT = Archiver(name="git", cls=GitArchiver, description="Git archiver") """Set of all available archivers""" ALL_ARCHIVERS = {ARCHIVER_GIT} def resolve_archiver(name): """ Get the :class:`wily.archivers.Archiver` for a given name. :param name: The name of the archiver :type name: ``str`` :return: The archiver type """ r = [archiver for archiver in ALL_ARCHIVERS if archiver.name == name.lower()] if not r: raise ValueError(f"Resolver {name} not recognised.") else: return r[0] PK {~MWAwily/archivers/git.py""" Git Archiver. Implementation of the archiver API for the gitpython module. """ import logging import pathlib from git import Repo from wily.archivers import BaseArchiver, Revision logger = logging.getLogger(__name__) """Possible combinations in .gitignore.""" gitignore_options = (".wily/", ".wily", ".wily/*", ".wily/**/*") class DirtyGitRepositoryError(Exception): """Error for a dirty git repository (untracked files).""" def __init__(self, untracked_files): """ Raise error for untracked files. :param untracked_files: List of untracked files :param untracked_files: ``list`` """ self.untracked_files = untracked_files self.message = "Dirty repository, make sure you commit/stash files first" class WilyIgnoreGitRepositoryError(Exception): """Error for .wily/ being missing from .gitignore.""" def __init__(self): """Raise runtime error for .gitignore being incorrectly configured.""" self.message = "Please add '.wily/' to .gitignore before running wily" class GitArchiver(BaseArchiver): """Gitpython implementation of the base archiver.""" name = "git" """Whether to ignore checking for .wily/ in .gitignore files.""" ignore_gitignore = False def __init__(self, config): """ Instantiate a new Git Archiver. :param config: The wily configuration :type config: :class:`wily.config.WilyConfig` """ self.repo = Repo(config.path) self.ignore_gitignore = config.skip_ignore_check gitignore = pathlib.Path(config.path) / ".gitignore" if not gitignore.exists(): raise WilyIgnoreGitRepositoryError() with open(gitignore, "r") as gitignore_f: lines = [line.replace("\n", "") for line in gitignore_f.readlines()] logger.debug(lines) has_ignore = False for gitignore_opt in gitignore_options: if gitignore_opt in lines: has_ignore = True break if not has_ignore and not self.ignore_gitignore: # :-/ raise WilyIgnoreGitRepositoryError() self.config = config self.current_branch = self.repo.active_branch assert not self.repo.bare, "Not a Git repository" def revisions(self, path, max_revisions): """ Get the list of revisions. :param path: the path to target. :type path: ``str`` :param max_revisions: the maximum number of revisions. :type max_revisions: ``int`` :return: A list of revisions. :rtype: ``list`` of :class:`Revision` """ if self.repo.is_dirty(): raise DirtyGitRepositoryError(self.repo.untracked_files) revisions = [] for commit in self.repo.iter_commits( self.current_branch, max_count=max_revisions ): rev = Revision( key=commit.name_rev.split(" ")[0], author_name=commit.author.name, author_email=commit.author.email, date=commit.committed_date, message=commit.message, ) revisions.append(rev) return revisions def checkout(self, revision, options): """ Checkout a specific revision. :param revision: The revision identifier. :type revision: :class:`Revision` :param options: Any additional options. :type options: ``dict`` """ rev = revision.key self.repo.git.checkout(rev) def finish(self): """ Clean up any state if processing completed/failed. For git, will checkout HEAD on the original branch when finishing """ self.repo.git.checkout(self.current_branch) PKD{Mh''wily/commands/__init__.py"""Command implementations for CLI.""" PK {~MaU wily/commands/build.py""" Builds a cache based on a source-control history. TODO : Convert .gitignore to radon ignore patterns to make the build more efficient. """ from progress.bar import Bar from wily import logger from wily.state import State def build(config, archiver, operators): """ Build the history given a archiver and collection of operators. :param config: The wily configuration :type config: :namedtuple:`wily.config.WilyConfig` :param archiver: The archiver to use :type archiver: :namedtuple:`wily.archivers.Archiver` :param operators: The list of operators to execute :type operators: `list` of :namedtuple:`wily.operators.Operator` """ state = State(config, archiver=archiver) # Check for existence of cache, else provision state.ensure_exists() try: logger.debug(f"Using {archiver.name} archiver module") archiver = archiver.cls(config) revisions = archiver.revisions(config.path, config.max_revisions) except Exception as e: logger.error(f"Failed to setup archiver: '{e.message}'") exit(1) index = state.index[archiver.name] # remove existing revisions from the list revisions = [revision for revision in revisions if revision not in index] logger.info( f"Found {len(revisions)} revisions from '{archiver.name}' archiver in '{config.path}'." ) _op_desc = ",".join([operator.name for operator in operators]) logger.info(f"Running operators - {_op_desc}") bar = Bar("Processing", max=len(revisions) * len(operators)) state.operators = operators try: for revision in revisions: # Checkout target revision archiver.checkout(revision, config.checkout_options) # Build a set of operators _operators = [operator.cls(config) for operator in operators] stats = {"operator_data": {}} for operator in _operators: logger.debug(f"Running {operator.name} operator on {revision.key}") stats["operator_data"][operator.name] = operator.run(revision, config) bar.next() ir = index.add(revision, operators=operators) ir.store(config, archiver, stats) index.save() bar.finish() except Exception as e: logger.error(f"Failed to build cache: '{e}'") raise e finally: # Reset the archive after every run back to the head of the branch archiver.finish() PK {~Mwwily/commands/diff.py""" Diff command. Compares metrics between uncommitted files and indexed files. """ import os import tabulate from wily import logger from wily.config import DEFAULT_GRID_STYLE from wily.operators import ( resolve_metric, resolve_operator, get_metric, GOOD_COLORS, BAD_COLORS, OperatorLevel, ) from wily.state import State def diff(config, files, metrics, changes_only=True, detail=True): """ Show the differences in metrics for each of the files. :param config: The wily configuration :type config: :namedtuple:`wily.config.WilyConfig` :param files: The files to compare. :type files: ``list`` of ``str`` :param metrics: The metrics to measure. :type metrics: ``list`` of ``str`` :param changes_only: Only include changes files in output. :type changes_only: ``bool`` :param detail: Show details (function-level) :type detail: ``bool`` """ config.targets = files files = list(files) state = State(config) last_revision = state.index[state.default_archiver].revisions[0] # Convert the list of metrics to a list of metric instances operators = {resolve_operator(metric.split(".")[0]) for metric in metrics} metrics = [(metric.split(".")[0], resolve_metric(metric)) for metric in metrics] data = {} results = [] # Build a set of operators _operators = [operator.cls(config) for operator in operators] cwd = os.getcwd() os.chdir(config.path) for operator in _operators: logger.debug(f"Running {operator.name} operator") data[operator.name] = operator.run(None, config) os.chdir(cwd) # Write a summary table.. extra = [] for operator, metric in metrics: if detail and resolve_operator(operator).level == OperatorLevel.Object: for file in files: try: extra.extend( [ f"{file}:{k}" for k in data[operator][file].keys() if k != metric.name ] ) except KeyError: logger.debug(f"File {file} not in cache") logger.debug("Cache follows -- ") logger.debug(data[operator]) files.extend(extra) logger.debug(files) for file in files: metrics_data = [] has_changes = False for operator, metric in metrics: try: current = last_revision.get( config, state.default_archiver, operator, file, metric.name ) except KeyError as e: current = "-" try: new = get_metric(data, operator, file, metric.name) except KeyError as e: new = "-" if new != current: has_changes = True if metric.type in (int, float) and new != "-" and current != "-": if current > new: metrics_data.append( "{0:n} -> \u001b[{2}m{1:n}\u001b[0m".format( current, new, BAD_COLORS[metric.measure] ) ) elif current < new: metrics_data.append( "{0:n} -> \u001b[{2}m{1:n}\u001b[0m".format( current, new, GOOD_COLORS[metric.measure] ) ) else: metrics_data.append("{0:n} -> {1:n}".format(current, new)) else: if current == "-" and new == "-": metrics_data.append("-") else: metrics_data.append("{0} -> {1}".format(current, new)) if has_changes or not changes_only: results.append((file, *metrics_data)) else: logger.debug(metrics_data) descriptions = [metric.description for operator, metric in metrics] headers = ("File", *descriptions) if len(results) > 0: print( # But it still makes more sense to show the newest at the top, so reverse again tabulate.tabulate( headers=headers, tabular_data=results, tablefmt=DEFAULT_GRID_STYLE ) ) PK {~MCzppwily/commands/graph.py""" Draw graph in HTML for a specific metric. TODO: Add multiple lines for multiple files """ import pathlib import plotly.graph_objs as go import plotly.offline from wily import logger, format_datetime from wily.operators import resolve_metric from wily.state import State def graph(config, path, metrics, output=None, x_axis=None, changes=True, text=False): """ Graph information about the cache and runtime. :param config: The configuration. :type config: :class:`wily.config.WilyConfig` :param path: The path to the files. :type path: ``list`` :param metrics: The Y and Z-axis metrics to report on. :type metrics: ``tuple`` :param output: Save report to specified path instead of opening browser. :type output: ``str`` """ logger.debug("Running report command") data = [] state = State(config) abs_path = config.path / pathlib.Path(path) if x_axis is None: x_axis = "history" else: x_operator, x_key = x_axis.split(".") if abs_path.is_dir(): paths = [ p.relative_to(config.path) for p in pathlib.Path(abs_path).glob("**/*.py") ] else: paths = [path] operator, key = metrics[0].split(".") if len(metrics) == 1: # only y-axis z_axis = None else: z_axis = resolve_metric(metrics[1]) z_operator, z_key = metrics[1].split(".") for path in paths: x = [] y = [] z = [] labels = [] last_y = None for rev in state.index[state.default_archiver].revisions: labels.append(f"{rev.revision.author_name}
{rev.revision.message}") try: val = rev.get(config, state.default_archiver, operator, str(path), key) if val != last_y or not changes: y.append(val) if z_axis: z.append( rev.get( config, state.default_archiver, z_operator, str(path), z_key, ) ) if x_axis == "history": x.append(format_datetime(rev.revision.date)) else: x.append( rev.get( config, state.default_archiver, x_operator, str(path), x_key, ) ) last_y = val except KeyError: # missing data pass # Create traces trace = go.Scatter( x=x, y=y, mode="lines+markers+text" if text else "lines+markers", name=f"{path}", ids=state.index[state.default_archiver].revision_keys, text=labels, marker=dict( size=0 if z_axis is None else z, color=list(range(len(y))), # colorscale='Viridis', ), xcalendar="gregorian", hoveron="points+fills", ) data.append(trace) if output: filename = output auto_open = False else: filename = "wily-report.html" auto_open = True y_metric = resolve_metric(metrics[0]) title = f"{x_axis.capitalize()} of {y_metric.description} for {path}" plotly.offline.plot( { "data": data, "layout": go.Layout( title=title, xaxis={"title": x_axis}, yaxis={"title": y_metric.description}, ), }, auto_open=auto_open, filename=filename, ) PK {~Mabbwily/commands/index.py""" Print command. Print information about the wily cache and what is in the index. """ import tabulate from wily import logger, format_date, format_revision, MAX_MESSAGE_WIDTH from wily.config import DEFAULT_GRID_STYLE from wily.state import State def index(config, include_message=False): """ Show information about the cache and runtime. :param config: The wily configuration :type config: :namedtuple:`wily.config.WilyConfig` :param include_message: Include revision messages :type include_message: ``bool`` """ state = State(config=config) logger.debug("Running show command") logger.info("--------Configuration---------") logger.info(f"Path: {config.path}") logger.info(f"Archiver: {config.archiver}") logger.info(f"Operators: {config.operators}") logger.info("") logger.info("-----------History------------") data = [] for archiver in state.archivers: for rev in state.index[archiver].revisions: if include_message: data.append( ( format_revision(rev.revision.key), rev.revision.author_name, rev.revision.message[:MAX_MESSAGE_WIDTH], format_date(rev.revision.date), ) ) else: data.append( ( format_revision(rev.revision.key), rev.revision.author_name, format_date(rev.revision.date), ) ) if include_message: headers = ("Revision", "Author", "Message", "Date") else: headers = ("Revision", "Author", "Date") print( tabulate.tabulate( headers=headers, tabular_data=data, tablefmt=DEFAULT_GRID_STYLE ) ) PK {~Mwily/commands/list_metrics.py""" List available metrics across all providers. TODO : Only show metrics for the operators that the cache has? """ import tabulate from wily.config import DEFAULT_GRID_STYLE from wily.operators import ALL_OPERATORS def list_metrics(): """List metrics available.""" for operator in ALL_OPERATORS: print(f"{operator.name} operator:") if len(operator.cls.metrics) > 0: print( tabulate.tabulate( headers=("Name", "Description", "Type"), tabular_data=operator.cls.metrics, tablefmt=DEFAULT_GRID_STYLE, ) ) PK {~MDc66wily/commands/report.py""" Report command. The report command gives a table of metrics for a specified list of files. Will compare the values between revisions and highlight changes in green/red. """ import tabulate from wily import logger, format_date, format_revision, MAX_MESSAGE_WIDTH from wily.config import DEFAULT_GRID_STYLE from wily.operators import resolve_metric, MetricType from wily.state import State def report(config, path, metrics, n, include_message=False): """ Show information about the cache and runtime. :param config: The configuration :type config: :class:`wily.config.WilyConfig` :param path: The path to the file :type path: ``str`` :param metrics: Name of the metric to report on :type metrics: ``str`` :param n: Number of items to list :type n: ``int`` :param include_message: Include revision messages :type include_message: ``bool`` """ logger.debug("Running report command") logger.info(f"-----------History for {metrics}------------") data = [] metric_metas = [] for metric in metrics: operator, key = metric.split(".") metric = resolve_metric(metric) # Set the delta colors depending on the metric type if metric.measure == MetricType.AimHigh: good_color = 32 bad_color = 31 elif metric.measure == MetricType.AimLow: good_color = 31 bad_color = 32 elif metric.measure == MetricType.Informational: good_color = 33 bad_color = 33 metric_meta = { "key": key, "operator": operator, "good_color": good_color, "bad_color": bad_color, "title": metric.description, "type": metric.type, } metric_metas.append(metric_meta) state = State(config) for archiver in state.archivers: # We have to do it backwards to get the deltas between releases history = state.index[archiver].revisions[:n][::-1] last = {} for rev in history: vals = [] for meta in metric_metas: try: logger.debug( f"Fetching metric {meta['key']} for {meta['operator']} in {path}" ) val = rev.get(config, archiver, meta["operator"], path, meta["key"]) last_val = last.get(meta["key"], None) # Measure the difference between this value and the last if meta["type"] in (int, float): if last_val: delta = val - last_val else: delta = 0 last[meta["key"]] = val else: # TODO : Measure ranking increases/decreases for str types? delta = 0 if delta == 0: delta_col = delta elif delta < 0: delta_col = f"\u001b[{meta['good_color']}m{delta:n}\u001b[0m" else: delta_col = f"\u001b[{meta['bad_color']}m+{delta:n}\u001b[0m" if meta["type"] in (int, float): k = f"{val:n} ({delta_col})" else: k = f"{val}" except KeyError as e: k = f"Not found {e}" vals.append(k) if include_message: data.append( ( format_revision(rev.revision.key), rev.revision.message[:MAX_MESSAGE_WIDTH], rev.revision.author_name, format_date(rev.revision.date), *vals, ) ) else: data.append( ( format_revision(rev.revision.key), rev.revision.author_name, format_date(rev.revision.date), *vals, ) ) descriptions = [meta["title"] for meta in metric_metas] if include_message: headers = ("Revision", "Message", "Author", "Date", *descriptions) else: headers = ("Revision", "Author", "Date", *descriptions) print( # But it still makes more sense to show the newest at the top, so reverse again tabulate.tabulate( headers=headers, tabular_data=data[::-1], tablefmt=DEFAULT_GRID_STYLE ) ) PKD{MF̅wily/operators/__init__.py"""Models and types for "operators" the basic measure of a module that measures code.""" from collections import namedtuple from enum import Enum class MetricType(Enum): """Type of metric, used in trends.""" AimLow = 1 # Low is good, high is bad AimHigh = 2 # High is good, low is bad Informational = 3 # Doesn't matter Metric = namedtuple("Metric", "name description type measure") GOOD_COLORS = { MetricType.AimHigh: 32, MetricType.AimLow: 31, MetricType.Informational: 33, } BAD_COLORS = { MetricType.AimHigh: 31, MetricType.AimLow: 32, MetricType.Informational: 33, } class OperatorLevel(Enum): """Level of operator.""" File = 1 Object = 2 class BaseOperator(object): """Abstract Operator Class.""" """Name of the operator.""" name = "abstract" """Default settings.""" defaults = {} """Available metrics as a list of tuple ("name", "description", "type", "metric_type").""" metrics = () """Which metric is the default to display in the report command.""" default_metric_index = None """Level at which the operator goes to.""" level = OperatorLevel.File def run(self, module, options): """ Run the operator. :param module: The target module path. :type module: ``str`` :param options: Any runtime options. :type options: ``dict`` :return: The operator results. :rtype: ``dict`` """ raise NotImplementedError from wily.operators.cyclomatic import CyclomaticComplexityOperator from wily.operators.maintainability import MaintainabilityIndexOperator from wily.operators.raw import RawMetricsOperator """Type for an operator.""" Operator = namedtuple("Operator", "name cls description level") OPERATOR_CYCLOMATIC = Operator( name="cyclomatic", cls=CyclomaticComplexityOperator, description="Cyclomatic Complexity of modules", level=OperatorLevel.Object, ) OPERATOR_RAW = Operator( name="raw", cls=RawMetricsOperator, description="Raw Python statistics", level=OperatorLevel.File, ) OPERATOR_MAINTAINABILITY = Operator( name="maintainability", cls=MaintainabilityIndexOperator, description="Maintainability index (lines of code and branching)", level=OperatorLevel.File, ) """Set of all available operators.""" ALL_OPERATORS = {OPERATOR_CYCLOMATIC, OPERATOR_MAINTAINABILITY, OPERATOR_RAW} def resolve_operator(name): """ Get the :namedtuple:`wily.operators.Operator` for a given name. :param name: The name of the operator :return: The operator type """ r = [operator for operator in ALL_OPERATORS if operator.name == name.lower()] if not r or len(r) == 0: raise ValueError(f"Operator {name} not recognised.") else: return r[0] def resolve_operators(operators): """ Resolve a list of operator names to their corresponding types. :param operators: The list of operators :type operators: iterable or ``str`` :rtype: ``list`` of :class:`Operator` """ return [resolve_operator(operator) for operator in operators] def resolve_metric(metric): """ Resolve metric key to a given target. :param metric: the metric name. :type metric: ``str`` :rtype: :class:`Metric` """ operator, key = metric.split(".") r = [ metric for metric in resolve_operator(operator).cls.metrics if metric[0] == key ] if not r or len(r) == 0: raise ValueError(f"Metric {metric} not recognised.") else: return r[0] def get_metric(revision, operator, path, key): """ Get a metric from the cache. :param revision: The revision id. :type revision: ``str`` :param operator: The operator name. :type operator: ``str`` :param path: The path to the file/function :type path: ``str`` :param key: The key of the data :type key: ``str`` :return: Data from the cache :rtype: ``dict`` """ if ":" in path: part, entry = path.split(":") val = revision[operator][part][entry][key] else: val = revision[operator][path][key] return val PK {~MZ2g g wily/operators/cyclomatic.py""" Cyclomatic complexity metric for each function/method. Provided by the radon library. """ import radon import radon.cli.harvest as harvesters from radon.cli import Config from radon.visitors import Function, Class from wily import logger from wily.operators import BaseOperator, Metric, MetricType class CyclomaticComplexityOperator(BaseOperator): """Cyclomatic complexity operator.""" name = "cyclomatic" defaults = { "exclude": None, "ignore": None, "min": "A", "max": "F", "no_assert": True, "show_closures": False, "order": radon.complexity.SCORE, } metrics = (Metric("complexity", "Cyclomatic Complexity", float, MetricType.AimLow),) default_metric_index = 0 # MI def __init__(self, config): """ Instantiate a new Cyclomatic Complexity operator. :param config: The wily configuration. :type config: :class:`WilyConfig` """ # TODO: Import config for harvester from .wily.cfg logger.debug(f"Using {config.targets} with {self.defaults} for CC metrics") self.harvester = harvesters.CCHarvester( config.targets, config=Config(**self.defaults) ) def run(self, module, options): """ Run the operator. :param module: The target module path. :type module: ``str`` :param options: Any runtime options. :type options: ``dict`` :return: The operator results. :rtype: ``dict`` """ logger.debug("Running CC harvester") results = {} for filename, details in dict(self.harvester.results).items(): results[filename] = {} total = 0 # running CC total for instance in details: if isinstance(instance, Class): i = self._dict_from_class(instance) elif isinstance(instance, Function): i = self._dict_from_function(instance) else: raise TypeError results[filename][i["fullname"]] = i del i["fullname"] total += i["complexity"] results[filename]["complexity"] = total return results @staticmethod def _dict_from_function(l): return { "name": l.name, "is_method": l.is_method, "classname": l.classname, "closures": l.closures, "complexity": l.complexity, "fullname": l.fullname, "loc": l.endline - l.lineno, } @staticmethod def _dict_from_class(l): return { "name": l.name, "inner_classes": l.inner_classes, "real_complexity": l.real_complexity, "complexity": l.complexity, "fullname": l.fullname, "loc": l.endline - l.lineno, } PK {~Mav,,!wily/operators/maintainability.py""" Maintainability operator. Measures the "maintainability" using the Halstead index. """ import radon.cli.harvest as harvesters from radon.cli import Config from wily import logger from wily.operators import BaseOperator, MetricType, Metric class MaintainabilityIndexOperator(BaseOperator): """MI Operator.""" name = "maintainability" defaults = { "exclude": None, "ignore": None, "min": "A", "max": "C", "multi": True, "show": False, "sort": False, } metrics = ( Metric("rank", "Maintainability Ranking", str, MetricType.Informational), Metric("mi", "Maintainability Index", float, MetricType.AimLow), ) default_metric_index = 1 # MI def __init__(self, config): """ Instantiate a new MI operator. :param config: The wily configuration. :type config: :class:`WilyConfig` """ # TODO : Import config from wily.cfg logger.debug(f"Using {config.targets} with {self.defaults} for MI metrics") self.harvester = harvesters.MIHarvester( config.targets, config=Config(**self.defaults) ) def run(self, module, options): """ Run the operator. :param module: The target module path. :type module: ``str`` :param options: Any runtime options. :type options: ``dict`` :return: The operator results. :rtype: ``dict`` """ logger.debug("Running raw harvester") return dict(self.harvester.results) PK {~MO?!QQwily/operators/raw.py""" Raw statistics operator. Includes insights like lines-of-code, number of comments. Does not measure complexity. """ import radon.cli.harvest as harvesters from radon.cli import Config from wily import logger from wily.operators import BaseOperator, MetricType, Metric class RawMetricsOperator(BaseOperator): """Raw Metrics Operator.""" name = "raw" defaults = {"exclude": None, "ignore": None, "summary": False} metrics = ( Metric("loc", "Lines of Code", int, MetricType.Informational), Metric("lloc", "L Lines of Code", int, MetricType.AimLow), Metric("sloc", "S Lines of Code", int, MetricType.AimLow), Metric("comments", "Multi-line comments", int, MetricType.AimHigh), Metric("multi", "Multi lines", int, MetricType.Informational), Metric("blank", "blank lines", int, MetricType.Informational), Metric( "single_comments", "Single comment lines", int, MetricType.Informational ), ) default_metric_index = 0 # LOC def __init__(self, config): """ Instantiate a new raw operator. :param config: The wily configuration. :type config: :class:`WilyConfig` """ # TODO: Use config from wily.cfg for harvester logger.debug(f"Using {config.targets} with {self.defaults} for Raw metrics") self.harvester = harvesters.RawHarvester( config.targets, config=Config(**self.defaults) ) def run(self, module, options): """ Run the operator. :param module: The target module path. :type module: ``str`` :param options: Any runtime options. :type options: ``dict`` :return: The operator results. :rtype: ``dict`` """ logger.debug("Running raw harvester") return dict(self.harvester.results) PK!H=d)*%wily-1.6.0.dist-info/entry_points.txtN+I/N.,()*̩z񹉙yV9\\PKILM]{],],wily-1.6.0.dist-info/LICENSE Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. PK!H>*RQwily-1.6.0.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,rzd&Y)r$[)T&UrPK!H< |3wily-1.6.0.dist-info/METADATA[nϧ[8LuԺ[o5umap88,ghY( }(P`}>M̐"%;7WF~Ԃs9wn3o15/لsL|B"]:7|礜isst gZjL伣eh*3bO㙂wag >%9E9Pۥ4l=YL(r/B~qxC1WG2<2_*yRD"80" yvrD󼐗D4rdC`Xr6o\vig5>kgZUb Y)boi9xֱ:,5T’XA|=cȃ(hƉS3c(+Lk&y&\\\8Hї܄"Z=+*2Ud%J2a=LcBХ57cThm:x49P b 8NadQStF8#D?D/Z(׼f4]*Ȝ@w , a3adL Ke3ZDbeORM5H8VAp MK LS HiʫB#RRP /ĄH(_x(N!?1ɎCjxpO.$γ?sD w!S9N4XfZ,وW\y꠾q 1T2:HfR."2?^Y@o0"IV`KZSMKIdAXizg ;yJ5G@x|0ywQ1~ƾEuez0nw`o'}h8ƽQ%a<%-6d DqBEH<`|I4u>; ( ~T8}>`An7~ǣ(iῠT1E0p̺I O~/ #!|wG]f! 8HhܥO0(x<0 ~x8FG!h/ A4 Q^~4dFuT1ă$Na7v~<( =R#!>)a'x m>_w0{5G޾"2v}"Q:Nk#O:Ef)'sݸᄻv{5g "9etr3G$Ed+Lo{t鄊 7vjxI'ُ:~nVJv Ƨ"wG`L´|cLQ3O춈lnl {|oߓ{|/N3~SZ*[;G,7k~W~4QJWڶ{|/Vc|L5mul <|c[D´i~z߹a![<1pIgoGNI:G+]G[FQ /j\6p<2'I%!6SXcvA$Z@SWX?#g4Ŏ_U{em4UEݽ4A%nE~|/PK!HV1wily-1.6.0.dist-info/RECORDmɒJ}? V3$ ,z$Ȇ@dHezoUExZ?D(*QYHOȆh(LygqX D#;i$5~:E9VM k$f)+{J66Wd +/( ,~Q˒mdLd`ǁw2Ekͫ!ްN|ܯz&an-X) h1{ZE󵩱~FP5= e]qVlXz)>R*4{ (Y=m%I6 8  Aq~^U仔e L XgА\^]̧p\'7h)k 0҅`'Evt^_bE|/֖1?PK{}~M wily/__init__.pyPK{}~MHbY Bwily/__main__.pyPK {~Mw.[pp $wily/cache.pyPK {~M\+ + Bwily/config.pyPK {~M6aQQ Owily/state.pyPKD{M$3fwily/archivers/__init__.pyPK {~MWAnwily/archivers/git.pyPKD{Mh''}wily/commands/__init__.pyPK {~MaU ~wily/commands/build.pyPK {~Mwwily/commands/diff.pyPK {~MCzppWwily/commands/graph.pyPK {~Mabbwily/commands/index.pyPK {~Mwily/commands/list_metrics.pyPK {~MDc66Rwily/commands/report.pyPKD{MF̅wily/operators/__init__.pyPK {~MZ2g g zwily/operators/cyclomatic.pyPK {~Mav,,!wily/operators/maintainability.pyPK {~MO?!QQwily/operators/raw.pyPK!H=d)*% wily-1.6.0.dist-info/entry_points.txtPKILM]{],],vwily-1.6.0.dist-info/LICENSEPK!H>*RQ wily-1.6.0.dist-info/WHEELPK!H< |3wily-1.6.0.dist-info/METADATAPK!HV1)wily-1.6.0.dist-info/RECORDPK<.