Path.mkdir
Path.mkdir(...)Description
Documentation for Path.mkdir.
Real-World Examples
Practical code examples showing how Path.mkdir is used in real projects.
def download(self):
metadata_path = os.path.join(self.download_dir, 'metadata.json')
if os.path.exists(metadata_path):
return
os.path.exists(self.download_dir) or os.mkdir(self.download_dir)
projects = list(self.github_search())
metadata = dict()
for i, project in enumerate(projects):
log.info(f"Downloading {project['full_name']} ({i + 1} of {len(projects)})")
metadata[self.download_project(project)] = project
with open(metadata_path, "w") as fd:
json.dump(metadata, fd)
self.languages = ['Python', 'Java', 'Rust', 'C++', 'C', 'Rust', 'Javascript', 'PHP']
script_dir = Path(__file__).parent
project_root = script_dir.parent
self.data_dir = project_root / '.data'
self.data_dir.mkdir(exist_ok=True)
async def get_popular_topics(self, n: int) -> List[str]:
"""Use LLM to get n most popular programming topics."""
try:
# Define the function for LLM to call
tools = [
{
"type": "function",
"function": {
"name": "get_popular_topics",
"description": "Get the most popular programming and technology topics",
"parameters": {
"type": "object",
"properties": {
"topics": {
"type": "array",
"items": {"type": "string"},
"description": f"List of {n} most popular programming/technology topics"