For testing, ability to mock objects

@param null Downloads $downloads
@param null \Pressbooks\Contributors $contributors
519779
public function dependencies( $downloads = null, $contributors = null ) {
		$this->downloads = $downloads ? $downloads : new Downloads( $this );
		$this->contributors = $contributors ? $contributors : new Contributors();
	}
459131
public Downloader newDownloader(URL source, Path destination, ProgressListener progressListener) {
    return new Downloader(source, destination, userAgentString, progressListener);
  }
109642
def get_contributors(self):
        """"""
        return User.objects.filter(
            freelanceprofile__is_freelance=True
        ).filter(
            contributions__content__published__gte=self.start,
            contributions__content__published__lt=self.end
        ).distinct()
1200805
private function handleExtractors($extractors, AuthorExtractor $reference, AuthorListComparator $comparator)
    {
        $failed = false;

        foreach ($extractors as $extractor) {
            $failed = !$comparator->compare($extractor, $reference) || $failed;
        }

        return $failed;
    }
320525
public function beforeNodeCopy(NodeInterface $sourceNode, NodeInterface $targetParentNode)
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        if ($this->currentlyCopying) {
            throw new \Exception('TODO: already copying...');
        }

        $this->currentlyCopying = true;

        /* @var $nodeEvent NodeEvent */
        $nodeEvent = $this->eventEmittingService->emit(self::NODE_COPY, [
            'copiedInto' => $targetParentNode->getContextPath()
        ], NodeEvent::class);
        $nodeEvent->setNode($sourceNode);
        $this->eventEmittingService->pushContext();
    }
1307925
public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment')
    {
        $response = new StreamedResponse($callback, 200, $headers);

        if (! is_null($name)) {
            $response->headers->set('Content-Disposition', $response->headers->makeDisposition(
                $disposition,
                $name,
                $this->fallbackName($name)
            ));
        }

        return $response;
    }
778997
function (evt, args) {
            var res = {
                content : null
            };
            if (evt.downloadFailed) {
                res.downloadFailed = evt.downloadFailed;
            }
            if (evt.logicalPaths.length > 0) {
                res.content = this.getFileContent(evt.logicalPaths[0]);
            }
            this.$callback(args.origCb, res);
        }
1346557
private static Set<String> populateContributors(Set<String> source, Set<String> destination) {
		for (String contributor : source) {
			if (!emailPattern.matcher(contributor).matches()) {
				LOGGER.warning("The contributor '" + contributor + "' does not respect the email pattern " + emailPattern.pattern() + " and is ignored");
			}
			else if (destination.contains(contributor)) {
				LOGGER.info("The contributor '" + contributor + "' is already present in the collection and is ignored");
			}
			else {
				destination.add(contributor);
			}
		}
		return destination;
	}
374575
public function check($username, $repository, $collaborator)
    {
        return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));
    }
985128
private function create_contributors( $users ) {
		global $wp_version;
		$contributors = [];
		foreach ( (array) $users as $contributor ) {
			$contributors[ $contributor ]['display_name'] = $contributor;
			$contributors[ $contributor ]['profile']      = '//profiles.wordpress.org/' . $contributor;
			$contributors[ $contributor ]['avatar']       = 'https://wordpress.org/grav-redirect.php?user=' . $contributor;
			if ( version_compare( $wp_version, '5.1-alpha', '<' ) ) {
				$contributors[ $contributor ] = '//profiles.wordpress.org/' . $contributor;
			}
		}

		return $contributors;
	}
572831
static void copyFileFromResources(String sourcePath, String destPath) throws IOException {
        LOGGER.entering(new Object[] { sourcePath, destPath });

        File downloadFile = new File(destPath);

        if (!downloadFile.exists()) {
            InputStream stream = JarSpawner.class.getResourceAsStream(sourcePath);
            FileUtils.copyInputStreamToFile(stream, downloadFile);
            LOGGER.fine("File copied to " + destPath);
        }
        LOGGER.exiting();
    }
48513
public function requestPlayers($cb)
    {
        $this->request('challenge', null, function ($conn, $result) use ($cb) {
            if (is_array($result)) {
                $cb($conn, $result);
                return;
            }
            $conn->request('players', $result, $cb);
        });
    }
221397
def build_contributors(authors, contrib_type, competing_interests=None):
    

    contributors = []

    for author in authors:
        contributor = None
        author_contrib_type = contrib_type

        surname = author.get("surname")
        given_name = author.get("given-names")
        collab = author.get("collab")

        # Small hack for on-behalf-of type when building authors
        #  use on-behalf-of as the contrib_type
        if author.get("type") and author.get("type") == "on-behalf-of":
            collab = author.get("on-behalf-of")
            author_contrib_type = "on-behalf-of"

        if surname or collab:
            contributor = ea.Contributor(author_contrib_type, surname, given_name, collab)

        utils.set_attr_if_value(contributor, 'suffix', author.get('suffix'))

        contributor.group_author_key = author.get("group-author-key")
        contributor.orcid = author.get("orcid")
        contributor.corresp = bool(author.get("corresp"))
        if author.get("equal-contrib") == "yes":
            contributor.equal_contrib = True

        # Add contributor affiliations
        for aff in author.get("affiliations", []):
            affiliation = ea.Affiliation()
            affiliation.text = utils.text_from_affiliation_elements(
                aff.get("dept"),
                aff.get("institution"),
                aff.get("city"),
                aff.get("country"))
            # fall back if no other fields are set take the text content
            if affiliation.text == '':
                affiliation.text = aff.get("text")
            contributor.set_affiliation(affiliation)

        # competing interests / conflicts
        if (competing_interests and author.get("references")
            and "competing-interest" in author.get("references")):
            for ref_id in author["references"]["competing-interest"]:
                for competing_interest in competing_interests:
                    if competing_interest.get("text") and competing_interest.get("id") == ref_id:
                        clean_text = utils.remove_tag('p', competing_interest.get("text"))
                        contributor.set_conflict(clean_text)

        # Finally add the contributor to the list
        if contributor:
            contributors.append(contributor)

    return contributors
690565
private static function parse_contributors_from_pull_requests( $pull_requests ) {
		$contributors = array();
		foreach ( $pull_requests as $pull_request ) {
			if ( ! empty( $pull_request->user ) ) {
				$contributors[ $pull_request->user->html_url ] = $pull_request->user->login;
			}
		}
		return $contributors;
	}
979675
public function addTorrents($paths)
    {
        if (is_array($paths)) {
            $paths = implode(' ', $paths);
        }
        $this->execute('transmission-remote ' . $this->getAuthFlag() . ' -a ' . $paths);
    }
671784
public static void zip(File[] sources, File target) throws IOException {
		zip(sources, target, null);
	}
37390
def get_creators(self, *args, **kwargs):
        
        from .creator import Creator, CreatorDataWrapper
        return self.get_related_resource(Creator, CreatorDataWrapper, args, kwargs)