diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml
deleted file mode 100644
index 6bde2c3..0000000
--- a/.idea/dbnavigator.xml
+++ /dev/null
@@ -1,405 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index d95df49..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 1f6e0d4..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/pythonProject110.iml b/.idea/pythonProject110.iml
deleted file mode 100644
index 74d515a..0000000
--- a/.idea/pythonProject110.iml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..42c32b5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,35 @@
+A custom made event loop with async and await syntax,
+background tasks, and custom functions, along with concurrent synchronization.
+
+The selectors module makes this all possible.
+
+https://docs.python.org/3/library/selectors.html
+
+
+
+```python
+from event_loop import EventLoop
+from connection import Connection
+
+
+
+loop = EventLoop(max_connections=15)
+
+async def scrape_other_website():
+ results = await loop.gather(Connection("https://www.google.com/"))
+ return results
+
+async def scrape_website(url):
+ first_result = await scrape_other_website()
+ print(first_result)
+ second_result = await loop.gather(*[Connection(url) for _ in range(10)])
+ return second_result
+
+async def main(loop):
+ url = "https://github.com/"
+ task_1 = loop.create_task(scrape_website(url))
+ result = await loop.gather(task_1)
+ print(result)
+
+loop.run(main(loop))
+
diff --git a/__pycache__/connection.cpython-311.pyc b/__pycache__/connection.cpython-311.pyc
deleted file mode 100644
index 6594551..0000000
Binary files a/__pycache__/connection.cpython-311.pyc and /dev/null differ
diff --git a/__pycache__/event_loop.cpython-311.pyc b/__pycache__/event_loop.cpython-311.pyc
deleted file mode 100644
index 67ea484..0000000
Binary files a/__pycache__/event_loop.cpython-311.pyc and /dev/null differ
diff --git a/__pycache__/future.cpython-311.pyc b/__pycache__/future.cpython-311.pyc
deleted file mode 100644
index b6d1672..0000000
Binary files a/__pycache__/future.cpython-311.pyc and /dev/null differ
diff --git a/__pycache__/task.cpython-311.pyc b/__pycache__/task.cpython-311.pyc
deleted file mode 100644
index 7d029e1..0000000
Binary files a/__pycache__/task.cpython-311.pyc and /dev/null differ
diff --git a/connection.py b/connection.py
index eea5640..f1cc343 100644
--- a/connection.py
+++ b/connection.py
@@ -17,8 +17,7 @@ def initialize_connection(self):
self.get_url_details()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.port == 443:
- context = ssl.create_default_context()
- self.client = context.wrap_socket(s, server_hostname=self.host)
+ self.client = ssl.create_default_context().wrap_socket(s, server_hostname=self.host)
self.client.setblocking(False)
else:
self.client = s
diff --git a/event_loop.py b/event_loop.py
index 853a41c..8819216 100644
--- a/event_loop.py
+++ b/event_loop.py
@@ -82,8 +82,7 @@ def add_connection(self, connection, fut=None,in_gather=False):
connection.initialize_connection()
if len(self.select_connections) < self.max_connections:
self.select_connections.append(connection)
- self.select.register(connection.client, selectors.EVENT_READ | selectors.EVENT_WRITE,
- data=connection)
+ self.select.register(connection.client, selectors.EVENT_READ | selectors.EVENT_WRITE, data=connection)
else:
# limits the amount of concurrent connections
self.connection_queue.put(connection)