repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
reflex
reflex/components/tags/match_tag.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.""" from reflex_base.components.tags.match_tag import * # pragma: no cover
5
156
reflex
reflex/components/tags/cond_tag.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.""" from reflex_base.components.tags.cond_tag import * # pragma: no cover
5
155
reflex
reflex/components/tags/__init__.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.""" from reflex_base.components.tags import * # pragma: no cover
5
146
reflex
reflex/components/tags/tagless.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.""" from reflex_base.components.tags.tagless import * # pragma: no cover
5
154
reflex
reflex/components/tags/tag.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.""" from reflex_base.components.tags.tag import * # pragma: no cover
5
150
reflex
reflex/components/tags/iter_tag.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.""" from reflex_base.components.tags.iter_tag import * # pragma: no cover
5
155
reflex
reflex/compiler/utils.py
.py
"""Common utility functions used in the compiler.""" from __future__ import annotations import asyncio import concurrent.futures import copy import json import operator import os import tempfile import traceback from collections.abc import Iterable, Mapping, Sequence from datetime import datetime from pathlib import ...
970
31,790
reflex
reflex/compiler/templates.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.""" from reflex_base.compiler.templates import * # pragma: no cover
5
149
reflex
reflex/compiler/compiler.py
.py
"""Compiler for the reflex apps.""" from __future__ import annotations import collections import dataclasses import json import sys from collections.abc import Callable, Iterable, Sequence from inspect import getmodule from pathlib import Path from typing import TYPE_CHECKING, Any from reflex_base import constants f...
1,462
50,094
reflex
reflex/compiler/plugins/__init__.py
.py
"""Built-in compiler plugins for single-pass page compilation.""" from reflex_base.plugins import ( BaseContext, CompileContext, CompilerHooks, ComponentAndChildren, PageContext, ) from .builtin import ( ApplyStylePlugin, DefaultCollectorPlugin, DefaultPagePlugin, default_page_plug...
31
630
reflex
reflex/compiler/plugins/memoize.py
.py
"""MemoizeStatefulPlugin — auto-memoize stateful components with ``rx._x.memo``. This plugin replaces the legacy ``StatefulComponent`` wrapping pass. It participates in the normal single-pass walk via ``enter_component`` and inserts per-subtree ``{children}``-pass-through wrappers built on the experimental memo infras...
406
17,173
reflex
reflex/compiler/plugins/builtin.py
.py
"""Built-in compiler plugins and the default plugin pipeline.""" from __future__ import annotations import dataclasses from collections.abc import Callable, Sequence from typing import Any from reflex_base.components.component import BaseComponent, Component, ComponentStyle from reflex_base.components.state_context ...
621
22,175
reflex
reflex/plugins/_screenshot.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.plugins._screenshot.""" from reflex_base.plugins._screenshot import * # pragma: no cover
5
170
reflex
reflex/plugins/tailwind_v3.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.plugins.tailwind_v3.""" from reflex_base.plugins.tailwind_v3 import * # pragma: no cover
5
170
reflex
reflex/plugins/__init__.py
.py
"""Re-export from reflex_base.plugins.""" from reflex_base.plugins import ( BaseContext, CommonContext, CompileContext, CompilerHooks, ComponentAndChildren, EmbedPlugin, PageContext, Plugin, PreCompileContext, RegisterRouteContext, SitemapPlugin, TailwindV3Plugin, Ta...
48
930
reflex
reflex/plugins/tailwind_v4.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.plugins.tailwind_v4.""" from reflex_base.plugins.tailwind_v4 import * # pragma: no cover
5
170
reflex
reflex/plugins/sitemap.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.plugins.sitemap.""" from reflex_base.plugins.sitemap import * # pragma: no cover
5
162
reflex
reflex/plugins/shared_tailwind.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.plugins.shared_tailwind.""" from reflex_base.plugins.shared_tailwind import * # pragma: no cover
5
178
reflex
reflex/plugins/base.py
.py
# pyright: reportWildcardImportFromLibrary=false """Re-export from reflex_base.plugins.base.""" from reflex_base.plugins.base import * # pragma: no cover
5
156
smolagents
docs/source/es/_config.py
.py
# docstyle-ignore INSTALL_CONTENT = """ # Installation ! pip install smolagents # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/smolagents.git """ notebook_first_cells = [{"type": "code", "content": INST...
15
488
smolagents
tests/test_gradio_ui.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
380
16,229
smolagents
tests/test_vision_web_browser.py
.py
"""Test XPath injection vulnerability fix in vision_web_browser.py""" from unittest.mock import Mock, patch import pytest from smolagents.vision_web_browser import _escape_xpath_string, search_item_ctrl_f @pytest.fixture def mock_driver(): """Mock Selenium WebDriver""" driver = Mock() driver.find_eleme...
133
5,196
smolagents
tests/test_search.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
36
1,108
smolagents
tests/test_tool_validation.py
.py
import ast from textwrap import dedent import pytest from smolagents.default_tools import ( DuckDuckGoSearchTool, GoogleSearchTool, SpeechToTextTool, VisitWebpageTool, WebSearchTool, ) from smolagents.tool_validation import MethodChecker, validate_tool_attributes from smolagents.tools import Tool,...
190
5,530
smolagents
tests/test_all_docs.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
177
6,342
smolagents
tests/test_models.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
1,081
46,440
smolagents
tests/test_import.py
.py
import os import subprocess import tempfile def test_import_smolagents_without_extras(monkeypatch): monkeypatch.delenv("VIRTUAL_ENV", raising=False) with tempfile.TemporaryDirectory() as temp_dir: # Create a virtual environment venv_dir = os.path.join(temp_dir, "venv") subprocess.run([...
32
1,052
smolagents
tests/test_mcp_client.py
.py
import json from textwrap import dedent import pytest from mcp import StdioServerParameters from smolagents.mcp_client import MCPClient @pytest.fixture def echo_server_script(): return dedent( ''' from mcp.server.fastmcp import FastMCP mcp = FastMCP("Echo Server") @mcp.tool() ...
132
5,121
smolagents
tests/test_telemetry.py
.py
# coding=utf-8 # Copyright 2025 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
89
3,250
smolagents
tests/test_function_type_hints_utils.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
515
16,686
smolagents
tests/test_local_python_executor.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
2,990
110,030
smolagents
tests/test_remote_executors.py
.py
import importlib import io from textwrap import dedent from unittest.mock import MagicMock, patch import docker import PIL.Image import pytest from rich.console import Console from smolagents.default_tools import FinalAnswerTool, WikipediaSearchTool from smolagents.local_python_executor import CodeOutput from smolage...
618
23,787
smolagents
tests/test_agents.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
2,629
106,339
smolagents
tests/test_final_answer.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
57
1,870
smolagents
tests/test_cli.py
.py
from unittest.mock import patch import pytest from smolagents.cli import load_model from smolagents.local_python_executor import CodeOutput, LocalPythonExecutor from smolagents.models import InferenceClientModel, LiteLLMModel, OpenAIModel, TransformersModel @pytest.fixture def set_env_vars(monkeypatch): monkeyp...
113
5,029
smolagents
tests/test_monitoring.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
236
8,314
smolagents
tests/test_types.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
119
3,745
smolagents
tests/test_serialization.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
929
31,599
smolagents
tests/test_memory.py
.py
import json import pytest from PIL import Image from smolagents.agents import ToolCall from smolagents.memory import ( ActionStep, AgentMemory, ChatMessage, MemoryStep, MessageRole, PlanningStep, SystemPromptStep, TaskStep, ) from smolagents.monitoring import Timing, TokenUsage class...
274
10,000
smolagents
tests/test_utils.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
555
16,057
smolagents
tests/test_tools.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
1,069
41,261
smolagents
tests/test_default_tools.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
255
9,817
smolagents
tests/conftest.py
.py
from unittest.mock import patch import pytest from smolagents.agents import MultiStepAgent from smolagents.monitoring import LogLevel # Import fixture modules as plugins pytest_plugins = ["tests.fixtures.agents", "tests.fixtures.tools"] original_multi_step_agent_init = MultiStepAgent.__init__ @pytest.fixture(aut...
24
735
smolagents
tests/fixtures/agents.py
.py
import pytest AGENT_DICTS = { "v1.9": { "tools": [], "model": { "class": "InferenceClientModel", "data": { "last_input_token_count": None, "last_output_token_count": None, "model_id": "Qwen/Qwen2.5-Coder-32B-Instruct", ...
139
5,219
smolagents
tests/fixtures/tools.py
.py
import pytest from smolagents.tools import Tool, tool @pytest.fixture def test_tool(): class TestTool(Tool): name = "test_tool" description = "A test tool" inputs = {"input": {"type": "string", "description": "Input value"}} output_type = "string" def forward(self, input)...
163
4,355
smolagents
examples/gradio_ui.py
.py
from smolagents import CodeAgent, GradioUI, InferenceClientModel, WebSearchTool agent = CodeAgent( tools=[WebSearchTool()], model=InferenceClientModel(model_id="meta-llama/Llama-3.3-70B-Instruct", provider="fireworks-ai"), verbosity_level=1, planning_interval=3, name="example_agent", descripti...
17
503
smolagents
examples/structured_output_tool.py
.py
# How to run with uv: # uv run structured_output_tool.py # # Modify the smolagents dependency to point to the local smolagents repo or # remove `@ file:///<path-to-smolagents>` # # /// script # requires-python = ">=3.10" # dependencies = [ # "smolagents[mcp,litellm] @ file:///<path-to-smolagents>", # "pydantic", ...
78
2,373
smolagents
examples/agent_from_any_llm.py
.py
from smolagents import ( CodeAgent, InferenceClientModel, LiteLLMModel, OpenAIModel, ToolCallingAgent, TransformersModel, tool, ) # Choose which inference type to use! available_inferences = ["inference_client", "transformers", "ollama", "litellm", "openai"] chosen_inference = "inference_...
62
2,260
smolagents
examples/inspect_multiagent_run.py
.py
from openinference.instrumentation.smolagents import SmolagentsInstrumentor from phoenix.otel import register register() SmolagentsInstrumentor().instrument(skip_dep_check=True) from smolagents import ( CodeAgent, InferenceClientModel, ToolCallingAgent, VisitWebpageTool, WebSearchTool, ) # The...
40
1,023
smolagents
examples/rag_using_chromadb.py
.py
import os import datasets from langchain.docstore.document import Document from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_chroma import Chroma # from langchain_community.document_loaders import PyPDFLoader from langchain_huggingface import HuggingFaceEmbeddings from tqdm import tqdm...
132
4,049
smolagents
examples/rag.py
.py
# from huggingface_hub import login # login() import datasets from langchain.docstore.document import Document from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.retrievers import BM25Retriever knowledge_base = datasets.load_dataset("m-ric/huggingface_doc", split="train") kno...
71
2,245
smolagents
examples/multiple_tools.py
.py
import requests # from smolagents.agents import ToolCallingAgent from smolagents import CodeAgent, InferenceClientModel, tool # Choose which LLM engine to use! model = InferenceClientModel() # model = TransformersModel(model_id="meta-llama/Llama-3.2-2B-Instruct") # For anthropic: change model_id below to 'anthropic...
257
8,529
smolagents
examples/text_to_sql.py
.py
from sqlalchemy import ( Column, Float, Integer, MetaData, String, Table, create_engine, insert, inspect, text, ) engine = create_engine("sqlite:///:memory:") metadata_obj = MetaData() # create city SQL table table_name = "receipts" receipts = Table( table_name, metada...
80
2,175
smolagents
examples/multi_llm_agent.py
.py
import os from smolagents import CodeAgent, LiteLLMRouterModel, WebSearchTool # Make sure to setup the necessary environment variables! llm_loadbalancer_model_list = [ { "model_name": "model-group-1", "litellm_params": { "model": "gpt-4o-mini", "api_key": os.getenv("OPENA...
47
1,488
smolagents
examples/sandboxed_execution.py
.py
from smolagents import CodeAgent, InferenceClientModel, WebSearchTool model = InferenceClientModel() # Blaxel executor example with CodeAgent(tools=[WebSearchTool()], model=model, executor_type="blaxel") as agent: output = agent.run("How many seconds would it take for a leopard at full speed to run through Pont ...
25
1,171
smolagents
examples/smolagents_benchmark/run.py
.py
import argparse import datetime import json import os import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from pathlib import Path import datasets import pandas as pd from dotenv import load_dotenv from tqdm import tqdm from smolagents import ( AgentError, CodeAgent, ...
258
8,366
smolagents
examples/server/main.py
.py
from anyio import to_thread from starlette.applications import Starlette from starlette.responses import HTMLResponse, JSONResponse from starlette.routing import Route from smolagents import CodeAgent, InferenceClientModel, MCPClient # Create an MCP client to connect to the MCP server mcp_server_parameters = { "...
215
6,517
smolagents
examples/plan_customization/plan_customization.py
.py
""" Plan Customization Example This example demonstrates how to use step callbacks to interrupt the agent after plan creation, allow user interaction to approve or modify the plan, and then resume execution while preserving agent memory. Key concepts demonstrated: 1. Step callbacks to interrupt after PlanningStep 2. ...
168
5,835
smolagents
examples/async_agent/main.py
.py
""" Async CodeAgent Example with Starlette This example demonstrates how to use a CodeAgent in an async Starlette app, running the agent in a background thread using anyio.to_thread.run_sync. """ import anyio.to_thread from starlette.applications import Starlette from starlette.requests import Request from starlette....
50
1,422
smolagents
examples/open_deep_research/app.py
.py
from run import create_agent from smolagents.gradio_ui import GradioUI agent = create_agent() demo = GradioUI(agent) if __name__ == "__main__": demo.launch()
12
167
smolagents
examples/open_deep_research/run.py
.py
import argparse import os import threading from dotenv import load_dotenv from huggingface_hub import login from scripts.text_inspector_tool import TextInspectorTool from scripts.text_web_browser import ( ArchiveSearchTool, FinderTool, FindNextTool, PageDownTool, PageUpTool, SimpleTextBrowser, ...
126
3,874
smolagents
examples/open_deep_research/run_gaia.py
.py
# EXAMPLE COMMAND: from folder examples/open_deep_research, run: python run_gaia.py --concurrency 32 --run-name generate-traces-03-apr-noplanning --model-id gpt-4o import argparse import json import os import threading from concurrent.futures import ThreadPoolExecutor, as_completed from datetime import datetime from pa...
313
11,944
smolagents
examples/open_deep_research/scripts/cookies.py
.py
from requests.cookies import RequestsCookieJar COOKIES_LIST = [ { "domain": ".youtube.com", "expirationDate": 1718884961, "hostOnly": False, "httpOnly": False, "name": "ST-xuwub9", "path": "/", "sameSite": None, "secure": False, "session": Fa...
716
23,304
smolagents
examples/open_deep_research/scripts/gaia_scorer.py
.py
import re import string import warnings def normalize_number_str(number_str: str) -> float: # we replace these common units and commas to allow # conversion to float for char in ["$", "%", ","]: number_str = number_str.replace(char, "") try: return float(number_str) except ValueErr...
125
3,827
smolagents
examples/open_deep_research/scripts/text_web_browser.py
.py
# Shamelessly stolen from Microsoft Autogen team: thanks to them for this great resource! # https://github.com/microsoft/autogen/blob/gaia_multiagent_v01_march_1st/autogen/browser_utils.py import mimetypes import os import pathlib import re import time import uuid from typing import Any from urllib.parse import unquote...
568
23,353
smolagents
examples/open_deep_research/scripts/text_inspector_tool.py
.py
from smolagents import Tool from smolagents.models import Model class TextInspectorTool(Tool): name = "inspect_file_as_text" description = """ You cannot load files yourself: instead call this tool to read a file as markdown text and ask questions about it. This tool handles the following file extensions: ["....
125
4,687
smolagents
examples/open_deep_research/scripts/visual_qa.py
.py
import base64 import json import mimetypes import os import uuid from io import BytesIO import PIL.Image import requests from dotenv import load_dotenv from huggingface_hub import InferenceClient from smolagents import Tool, tool load_dotenv(override=True) def process_images_and_text(image_path, query, client): ...
190
6,107
smolagents
examples/open_deep_research/scripts/mdconvert.py
.py
# This is copied from Magentic-one's great repo: https://github.com/microsoft/autogen/blob/v0.4.4/python/packages/autogen-magentic-one/src/autogen_magentic_one/markdown_browser/mdconvert.py # Thanks to Microsoft researchers for open-sourcing this! # type: ignore import base64 import copy import html import json import ...
1,003
36,705
smolagents
examples/open_deep_research/scripts/run_agents.py
.py
import json import os import shutil import textwrap from pathlib import Path # import tqdm.asyncio from smolagents.utils import AgentError def serialize_agent_error(obj): if isinstance(obj, AgentError): return {"error_type": obj.__class__.__name__, "message": obj.message} else: return str(obj...
89
3,738
smolagents
examples/open_deep_research/scripts/reformulator.py
.py
# Shamelessly stolen from Microsoft Autogen team: thanks to them for this great resource! # https://github.com/microsoft/autogen/blob/gaia_multiagent_v01_march_1st/autogen/browser_utils.py import copy from smolagents.models import MessageRole, Model def prepare_response(original_task: str, inner_messages, reformulat...
87
4,430
smolagents
src/smolagents/gradio_ui.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
465
19,092
smolagents
src/smolagents/utils.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
607
21,240
smolagents
src/smolagents/monitoring.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
274
9,716
smolagents
src/smolagents/models.py
.py
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
2,103
86,054
smolagents
src/smolagents/default_tools.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
699
25,804
smolagents
src/smolagents/agent_types.py
.py
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
285
9,215
smolagents
src/smolagents/local_python_executor.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
1,769
68,159
smolagents
src/smolagents/agents.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
1,814
80,780
smolagents
src/smolagents/tool_validation.py
.py
import ast import builtins from itertools import zip_longest from .utils import BASE_BUILTIN_MODULES, get_source, is_valid_name _BUILTIN_NAMES = set(vars(builtins)) class MethodChecker(ast.NodeVisitor): """ Checks that a method - only uses defined names - contains no local imports (e.g. numpy is ok...
264
10,699
smolagents
src/smolagents/vision_web_browser.py
.py
import argparse from io import BytesIO from time import sleep import helium import PIL.Image from dotenv import load_dotenv from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from smolagents import CodeAgent, WebSearchTool, tool from smolagents.a...
248
8,700
smolagents
src/smolagents/remote_executors.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
1,077
44,941
smolagents
src/smolagents/mcp_client.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
172
7,123
smolagents
src/smolagents/cli.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
295
9,658
smolagents
src/smolagents/tools.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
1,423
59,873
smolagents
src/smolagents/_function_type_hints_utils.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
432
16,007
smolagents
src/smolagents/serialization.py
.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
515
21,194
smolagents
src/smolagents/memory.py
.py
import inspect from dataclasses import asdict, dataclass from logging import getLogger from typing import TYPE_CHECKING, Any, Callable, Type from smolagents.models import ChatMessage, MessageRole, get_dict_from_nested_dataclasses from smolagents.monitoring import AgentLogger, LogLevel, Timing, TokenUsage from smolagen...
317
12,341
linkedin-skill-assessments-quizzes
translate.py
.py
#!/usr/bin/env python3 """ Automated Translation Tool for LinkedIn Quiz Files Translates quiz markdown files to multiple languages """ import sys import time from pathlib import Path from deep_translator import GoogleTranslator # Language configurations with codes LANGUAGES = { '1': {'name': 'Chinese (Simplified)...
240
7,587
linkedin-skill-assessments-quizzes
python/example-codes/Q28_zip_lists.py
.py
#!/usr/bin/env python3 """ This script demonstrates zipping three lists into a list of tuples. Corresponding to Q28 from the Python quiz: Given three lists of fruits, quantities, and prices, create a new list that pairs them as tuples. """ # Define the lists as given in the quiz fruits = ['Apples', 'Oranges', 'Banana...
21
781
linkedin-skill-assessments-quizzes
python/example-codes/Q35_nested_loops.py
.py
#!/usr/bin/env python3 """ This script demonstrates nested for loops printing combinations of characters and numbers. Corresponding to Q35 from the Python quiz: What does this function print? """ def print_alpha_nums(abc_list, num_list): """ Prints each character from abc_list paired with each number from num...
34
842
celery
setup.py
.py
#!/usr/bin/env python3 import codecs import os import re import setuptools NAME = 'celery' # -*- Extras -*- EXTENSIONS = ( 'arangodb', 'auth', 'azureblockblob', 'brotli', 'cassandra', 'consul', 'cosmosdbsql', 'couchbase', 'couchdb', 'django', 'dynamodb', 'elasticsearc...
184
4,605
celery
extra/release/sphinx2rst_config.py
.py
REFBASE = 'https://docs.celeryq.dev/en/latest' REFS = { 'mailing-list': 'https://groups.google.com/group/celery-users', 'irc-channel': 'getting-started/resources.html#irc', 'breakpoint-signal': 'tutorials/debugging.html', 'internals-guide': 'internals/guide.html', 'bundles': 'getting-started...
11
409
celery
extra/release/attribution.py
.py
#!/usr/bin/env python import fileinput from pprint import pprint def author(line): try: A, E = line.strip().rsplit(None, 1) E.replace('>', '').replace('<', '') except ValueError: A, E = line.strip(), None return A.lower() if A else A, E.lower() if E else E def proper_name(name):...
35
841
celery
docs/changelog_formatter.py
.py
#!/usr/bin/env python3 import re import sys import click import pyperclip from colorama import Fore, init # Initialize colorama for color support in terminal init(autoreset=True) # Regular expression pattern to match the required lines PATTERN = re.compile(r"^\*\s*(.*?)\s+by\s+@[\w-]+\s+in\s+https://github\.com/[\w...
131
3,034
celery
docs/conf.py
.py
from sphinx_celery import conf globals().update(conf.build_config( 'celery', __file__, project='Celery', version_dev='6.0', version_stable='5.0', canonical_url='https://docs.celeryq.dev', webdomain='celeryproject.org', github_project='celery/celery', author='Ask Solem & contributors', ...
105
2,616
celery
docs/_ext/celerydocs.py
.py
import typing from docutils import nodes from sphinx.errors import NoUri APPATTRS = { 'amqp': 'celery.app.amqp.AMQP', 'backend': 'celery.backends.base.BaseBackend', 'conf': 'celery.app.utils.Settings', 'control': 'celery.app.control.Control', 'events': 'celery.events.Events', 'loader': 'celery...
181
5,164
celery
t/skip.py
.py
import sys import pytest if_pypy = pytest.mark.skipif(getattr(sys, 'pypy_version_info', None), reason='PyPy not supported.') if_win32 = pytest.mark.skipif(sys.platform.startswith('win32'), reason='Does not work on Windows')
7
226
celery
t/integration/test_database_backend.py
.py
from unittest.mock import patch import pytest from sqlalchemy.exc import OperationalError from sqlalchemy.orm import Session from celery.exceptions import BackendStoreError @pytest.fixture def db_retry_app(celery_app, tmp_path): """Fixture to set up a Celery app with a database backend and retry configs.""" ...
120
4,615
celery
t/integration/django_settings.py
.py
import logging logging.info("Initializing Django settings for Celery integration tests") DEBUG = True INSTALLED_APPS = [ 'django.contrib.contenttypes', 'django.contrib.auth', ] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } CELERY_BROKER_UR...
20
378
celery
t/integration/test_backend.py
.py
import os import pytest from celery import states from celery.backends.azureblockblob import AzureBlockBlobBackend pytest.importorskip('azure') @pytest.mark.skipif( not os.environ.get('AZUREBLOCKBLOB_URL'), reason='Environment variable AZUREBLOCKBLOB_URL required' ) class test_AzureBlockBlobBackend: de...
41
1,120