Find the projects listed in the Home Documentation's
    index.md file

    Returns:
        set(str): projects' names, with the '/' in their beginings
5371
def get_listed_projects():
    
    index_path = Path().resolve() / "docs" / "index.md"
    with open(index_path, "r") as index_file:
        lines = index_file.readlines()

    listed_projects = set()
    project_section = False
    for _, l in enumerate(lines):
        idx = l.find(PROJECT_KEY)
        if idx >= 0:
            project_section = True
        if project_section:
            # Find first parenthesis after the key
            start = l.find("](")
            if start > 0:
                closing_parenthesis = sorted(
                    [m.start() for m in re.finditer(r"\)", l) if m.start() > start]
                )[0]
                project = l[start + 2 : closing_parenthesis]
                listed_projects.add(project)
        # If the Projects section is over, stop iteration.
        # It will stop before seeing ## but wainting for it
        # Allows the user to use single # in the projects' descriptions
        if len(listed_projects) > 0 and l.startswith("#"):
            return listed_projects
    return listed_projects
525565
def getFilepaths(self, filename):
        
        return (os.path.join(os.environ['HOME'], filename),
                os.path.join(self.mackup.mackup_folder, filename))
826663
def get_projects_list(self):
        
        try:
            result = self._request('/getprojectslist/')
            return [TildaProject(**p) for p in result]
        except NetworkError:
            return []
700824
def list(self, **kwargs):
        
        projects = Project.select().order_by(Project.name)
        if len(projects) == 0:
            self._print('No projects available', 'yellow')
            return

        for project in projects:
            project_repr = self._PROJECT_ITEM.format(project.name, project.path)
            row = '- {}'.format(self._PROJECT_ITEM.format(project.name, project.path))
            six.print_(row)
860893
def _get_index_urls_locations(self, project_name):
        # type: (str) -> List[str]
        

        def mkurl_pypi_url(url):
            loc = posixpath.join(
                url,
                urllib_parse.quote(canonicalize_name(project_name)))
            # For maximum compatibility with easy_install, ensure the path
            # ends in a trailing slash.  Although this isn't in the spec
            # (and PyPI can handle it without the slash) some other index
            # implementations might break if they relied on easy_install's
            # behavior.
            if not loc.endswith('/'):
                loc = loc + '/'
            return loc

        return [mkurl_pypi_url(url) for url in self.index_urls]
906844
def files(self):
        
        files_description = [
            [ self.project_name,
              self.project_name + '.tex',
              'LaTeXBookFileTemplate'
            ],
            [ self.project_name,
              'references.bib',
              'BibTeXFileTemplate'
            ],
            [ self.project_name,
              'Makefile',
              'LaTeXMakefileFileTemplate'
            ],
        ]
        return files_description
702177
def contains_project_name(name, link):
    
    def unclutter(string):
        # strip out all python references and remove all excessive characters
        string = string.lower().replace("_", "-").replace(".", "-")
        for replace in ["python-", "py-", "-py", "-python"]:
            string = string.replace(replace, "")
        return re.sub("[^0123456789 a-zA-Z]", "", string).strip()
    return unclutter(name) in unclutter(link)
383137
def list_projects_search(self, searchstring):
        """"""
        log.debug('List all projects with: %s' % searchstring)
        return self.collection('projects/search/%s.json' %
                               quote_plus(searchstring))
383533
def get_project_name(dir = Dir.pwd, _options = {})
      path = normalized_path(dir)
      path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
      File.basename(path)
    end
484337
def _diagnose_prefixes(self):
        
        from peyotl.collections_store import COLLECTION_ID_PATTERN
        p = set()
        for owner_dirname in os.listdir(self.doc_dir):
            example_collection_name = "{n}/xxxxx".format(n=owner_dirname)
            if COLLECTION_ID_PATTERN.match(example_collection_name):
                p.add(owner_dirname)
        return p
1007317
def result_str(self):
        
        return '{}, {}, {}'.format(LocalOnlyCounter.plural_fmt('project', self.projects),
                                   LocalOnlyCounter.plural_fmt('folder', self.folders),
                                   LocalOnlyCounter.plural_fmt('file', self.files))
647954
def generate_folder_names(name, project):
    """"""

    out_data_dir = prms.Paths.outdatadir
    project_dir = os.path.join(out_data_dir, project)
    batch_dir = os.path.join(project_dir, name)
    raw_dir = os.path.join(batch_dir, "raw_data")
    return out_data_dir, project_dir, batch_dir, raw_dir
1022257
def list_projects(root, backend=os.listdir):
    
    projects = list()
    for project in sorted(backend(root)):
        abspath = os.path.join(root, project)
        if not isproject(abspath):
            continue
        projects.append(project)
    return projects
252702
def get_project_by_name(project_name,**kwargs):
    
    user_id = kwargs.get('user_id')

    projects_i = db.DBSession.query(Project).join(ProjectOwner).filter(
                                                    Project.name==project_name,
                                                    ProjectOwner.user_id==user_id).order_by('name').all()

    ret_projects = []
    for project_i in projects_i:
        try:
            project_i.check_read_permission(user_id)
            ret_projects.append(project_i)
        except:
            log.info("Can't return project %s. User %s does not have permission to read it.", project_i.id, user_id)

    return ret_projects
1300615
def get_directories_with_extensions(self, start, extensions=None):
        
        return set([p.parent for ext in extensions for p in start.rglob(ext)])
175431
def list_files(self, project):
        
        path = "/projects/{}/files".format(project.id)
        res = yield from self.http_query("GET", path, timeout=120)
        return res.json
574902
def find_all_candidates(self, project_name):
        # type: (str) -> List[Optional[InstallationCandidate]]
        
        index_locations = self._get_index_urls_locations(project_name)
        index_file_loc, index_url_loc = self._sort_locations(index_locations)
        fl_file_loc, fl_url_loc = self._sort_locations(
            self.find_links, expand_dir=True,
        )

        file_locations = (Link(url) for url in itertools.chain(
            index_file_loc, fl_file_loc,
        ))

        # We trust every url that the user has given us whether it was given
        #   via --index-url or --find-links.
        # We want to filter out any thing which does not have a secure origin.
        url_locations = [
            link for link in itertools.chain(
                (Link(url) for url in index_url_loc),
                (Link(url) for url in fl_url_loc),
            )
            if self._validate_secure_origin(logger, link)
        ]

        logger.debug('%d location(s) to search for versions of %s:',
                     len(url_locations), project_name)

        for location in url_locations:
            logger.debug('* %s', location)

        canonical_name = canonicalize_name(project_name)
        formats = self.format_control.get_allowed_formats(canonical_name)
        search = Search(project_name, canonical_name, formats)
        find_links_versions = self._package_versions(
            # We trust every directly linked archive in find_links
            (Link(url, '-f') for url in self.find_links),
            search
        )

        page_versions = []
        for page in self._get_pages(url_locations, project_name):
            try:
                logger.debug('Analyzing links from page %s', page.url)
            except AttributeError:
                continue
            with indent_log():
                page_versions.extend(
                    self._package_versions(page.iter_links(), search)
                )

        file_versions = self._package_versions(file_locations, search)
        if file_versions:
            file_versions.sort(reverse=True)
            logger.debug(
                'Local files found: %s',
                ', '.join([
                    url_to_path(candidate.location.url)
                    for candidate in file_versions
                ])
            )

        # This is an intentional priority ordering
        return file_versions + find_links_versions + page_versions