-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from radionets-project/update_layouts
Update Layout class
- Loading branch information
Showing
7 changed files
with
126 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .utils import get_array_names | ||
|
||
__all__ = ["get_array_names"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import requests | ||
from bs4 import BeautifulSoup | ||
|
||
|
||
def get_array_names(url: str) -> list[str]: | ||
"""Fetches array names from a given URL | ||
leading to a directory. | ||
Parameters | ||
---------- | ||
url : str | ||
URL leading to a directory containing layout | ||
txt files. | ||
Returns | ||
------- | ||
layouts : list[str] | ||
List of available layouts. | ||
""" | ||
r = requests.get(url) | ||
soup = BeautifulSoup(r.text, features="html.parser") | ||
|
||
a_tags = soup.find_all("a") | ||
|
||
layouts = [] | ||
for i in a_tags: | ||
if ".txt" in str(i.get("href")): | ||
layouts.append(i.get("aria-label").split(".txt")[0]) | ||
|
||
layouts = list(set(layouts)) | ||
|
||
return layouts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters