From f519fb78df369314648a6376a6e3e3f2981f3980 Mon Sep 17 00:00:00 2001 From: FunctionsAPI Date: Thu, 12 Jun 2025 09:05:38 +0000 Subject: [PATCH] Automatic push from FunctionsAPI --- New File | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 +-- main.py | 2 ++ requirements.txt | 2 ++ 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 New File create mode 100644 main.py create mode 100644 requirements.txt diff --git a/New File b/New File new file mode 100644 index 0000000..3f07ad6 --- /dev/null +++ b/New File @@ -0,0 +1,51 @@ +# my_module.py + +def greet(name): + """This function greets the person passed in as a parameter.""" + return f"Hello, {name}!" + + +def add(x, y): + """This function returns the sum of two numbers.""" + return x + y + + +def write_to_file(filename, content): + """This function writes the given content to the specified file.""" + with open(filename, "w") as f: + f.write(content) + + +def read_from_file(filename): + """This function reads the content of the specified file and returns it.""" + try: + with open(filename, "r") as f: + return f.read() + except FileNotFoundError: + return "File not found." + +def main(): + """Main function that runs when the script is executed directly.""" + name = "Alice" + print(greet(name)) + + num1 = 5 + num2 = 3 + print(f"The sum of {num1} and {num2} is: {add(num1, num2)}") + + file_content = "This is some content written to a file." + write_to_file("example.txt", file_content) + print(f"Content written to file: {file_content}") + + read_file_content = read_from_file("example.txt") + print(f"Content read from file: {read_file_content}") + + read_file_content = read_from_file("nonexistent.txt") + print(f"Content read from file: {read_file_content}") + + +if __name__ == "__main__": + print("This script is being run directly.") + main() +else: + print("This script is being imported as a module.") \ No newline at end of file diff --git a/README.md b/README.md index af4d9fb..ca9945f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# 0e3ae225fd9046bdbc1c57c0ec6c27fe - +# python hello-world diff --git a/main.py b/main.py new file mode 100644 index 0000000..c6ffed6 --- /dev/null +++ b/main.py @@ -0,0 +1,2 @@ +def main(request): + return "hello, world" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..55e8614 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +functions-framework==1.4.3 +markupsafe==2.0.1