Skip to content

Commit

Permalink
removed stale code and reapplied black protontypes#164
Browse files Browse the repository at this point in the history
  • Loading branch information
kikass13 committed Oct 26, 2020
1 parent f6931f3 commit 46a2468
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 215 deletions.
2 changes: 1 addition & 1 deletion libreselery/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _runCommand(args):
selery.connect()

# initialize the CDE (Contribution Distribution Engine)
# this also involves finding and
# this also involves finding and
# instantiating activity plugins
selery.startEngine()

Expand Down
214 changes: 0 additions & 214 deletions libreselery/libreselery.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,220 +173,6 @@ def startEngine(self):
# kickstart cde
self.cde = ContributionDistributionEngine(self.config, self.connectors)

def gather(self):
return

# projectUrl = git_utils.grabLocalProject(self.config.directory)

# localProject = self.githubConnector.grabRemoteProjectByUrl(projectUrl)
# self.log(
# "Gathering project information of '%s' at local folder '%s"
# % (projectUrl, self.config.directory)
# )

# print("=======================================================")
# if self.config.include_main_repository:
# # find official repositories
# self.log(
# "Including contributors of root project '%s'" % localProject.full_name
# )

# self.log(" -- %s" % localProject.html_url)
# # print(" -- %s" % [c.author.email for c in localContributors])

# # safe dependency information
# mainProjects.append(localProject)

# for p in mainProjects:
# # grab contributors
# mainContributor = self.githubConnector.grabRemoteProjectContributors(p)
# # filter contributors
# mainContributor = selery_utils.validateContributors(
# mainContributor, self.config.min_contributions_required_payout
# )
# # safe contributor information
# mainContributors.extend(mainContributor)

# if self.config.include_dependencies:
# self.log(
# "Searching for dependencies of project '%s' " % localProject.full_name
# )
# # scan for dependencies repositories
# rubyScanScriptPath = os.path.join(
# self.seleryDir, "libreselery", "ruby_extensions", "scan.rb"
# )
# process = subprocess.run(
# ["ruby", rubyScanScriptPath, "--project=%s" % self.config.directory],
# stdout=subprocess.PIPE,
# stderr=subprocess.PIPE,
# universal_newlines=True,
# )
# # exec and evaluate stdout
# if process.returncode == 0:
# dependencies_json = json.loads(process.stdout)
# else:
# self.logError("Could not find project manifesto")
# print(process.stderr)
# raise Exception("Aborting")

# # process dependency json
# unique_dependency_dict = selery_utils.getUniqueDependencies(
# dependencies_json
# )
# for platform, depList in unique_dependency_dict.items():
# for dep in depList:
# d = dep["name"]
# r = dep["requirement"]
# print(" -- %s: %s [%s]" % (platform, d, r))
# libIoProject = self.librariesIoConnector.findProject(platform, d)
# print(
# " > %s"
# % ("FOUND %s" % libIoProject if libIoProject else "NOT FOUND")
# )
# # gather more information for project dependency
# if libIoProject:
# libIoRepository = self.librariesIoConnector.findRepository(
# libIoProject
# )
# libIoDependencies = (
# self.librariesIoConnector.findProjectDependencies(
# libIoProject
# )
# )
# # print(" > %s" %
# # [dep.project_name for dep in libIoDependencies])
# # libIoProject
# # )

# if libIoRepository:
# gitproject = self.githubConnector.grabRemoteProject(
# libIoRepository.github_id
# )

# # safe project / dependency information
# dependencyProjects.append(gitproject)

# self.log(
# "Gathering dependency contributor information from Github. This will take some time for larger projects."
# )
# for p in dependencyProjects:
# # grab contributors
# depContributors = self.githubConnector.grabRemoteProjectContributors(p)
# # filter contributors based min contribution
# depContributors = selery_utils.validateContributors(
# depContributors, self.config.min_contributions_required_payout
# )
# # safe contributor information
# dependencyContributors.extend(depContributors)

# if self.config.include_tooling_and_runtime and self.config.tooling_path:
# # tooling projects will be treated as dependency projects
# self.log("Searching for tooling of project '%s' " % localProject.full_name)
# for toolurl in self.config.toolrepos["github"]:
# toolingProject = self.githubConnector.grabRemoteProjectByUrl(toolurl)
# self.log(" -- %s" % toolingProject)
# self.log(" -- %s" % toolingProject.html_url)

# # safe tooling information
# toolingProjects.append(toolingProject)

# self.log("Gathering toolchain contributor information")

# # scan for project contributors
# for p in toolingProjects:
# # grab contributors
# toolingContributor = self.githubConnector.grabRemoteProjectContributors(
# p
# )
# # filter contributors
# toolingContributor = selery_utils.validateContributors(
# toolingContributor, self.config.min_contributions_required_payout
# )
# # safe contributor information
# dependencyContributors.extend(toolingContributor)

# print("=======================================================")

# self.logNotify("Gathered valid directory: %s" % self.config.directory)
# self.logNotify("Gathered '%s' valid main repositories" % len(mainProjects))
# self.logNotify("Gathered '%s' valid main contributors" % len(mainContributors))

# self.logNotify(
# "Gathered '%s' valid dependency repositories" % len(dependencyProjects)
# )
# self.logNotify(
# "Gathered '%s' valid dependency contributors" % len(dependencyContributors)
# )

# return (
# mainProjects,
# mainContributors,
# dependencyProjects,
# dependencyContributors,
# )

def weight(
self, mainProjects, mainContributors, dependencyProjects, dependencyContributors
):
return

# if len(dependencyContributors):
# self.log(
# "Add %s dependency contributor to main contributor by random choice."
# % self.config.included_dependency_contributor
# )
# randomDependencyContributors = random.choices(
# dependencyContributors, k=self.config.included_dependency_contributor
# )
# mainContributors.extend(randomDependencyContributors)

# # create uniform weights for all main contributors
# self.log("Create uniform weights for contributors")
# uniform_weights = selery_utils.calculateContributorWeights(
# mainContributors, self.config.uniform_weight
# )
# self.log("Uniform Weights: " + str(uniform_weights))

# # create commit weights
# commit_weights = [0] * len(mainContributors)
# commit_identifier = CommitIdentifierFromString(
# self.config.activity_since_commit
# )
# if not commit_identifier:
# self.logError(
# "Invalid commit identifier in 'activity_since_commit': "
# + self.config.activity_since_commit
# )
# raise Exception("Invalid commit identifier in 'activity_since_commit'")

# weighted_commits = git_utils.find_involved_commits(
# self.config.directory, commit_identifier
# )
# if weighted_commits:
# # calc release weights
# self.log(
# "Add additional weight to contributors of the last commits until "
# + str(self.config.activity_since_commit)
# )
# # Create a unique list of all release contributor
# weighted_contributor = set(c.author.email.lower() for c in weighted_commits)
# self.log("Found release contributor: " + str(len(weighted_contributor)))
# for idx, user in enumerate(mainContributors):
# if user.stats.author.email.lower() in weighted_contributor:
# commit_weights[idx] = self.config.activity_weight
# self.log(
# "Github email matches git commit email of contributor: "
# + user.stats.author.login
# )
# self.log("Release Weights: " + str(commit_weights))

# # sum up the two list with the same size
# combined_weights = [x + y for x, y in zip(uniform_weights, commit_weights)]

# self.log("Combined Weights: " + str(combined_weights))
# # read @user from commit
# return combined_weights, mainContributors

def run(self):
contributorData_scored = self.cde.gather_()
domainContributors_weighted = self.cde.weight_(contributorData_scored)
Expand Down

0 comments on commit 46a2468

Please sign in to comment.