-
Notifications
You must be signed in to change notification settings - Fork 4
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 #83 from hitblast/async
✨ `async` / `await` implementation and restructure of documentation
- Loading branch information
Showing
22 changed files
with
1,071 additions
and
324 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 was deleted.
Oops, something went wrong.
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,5 @@ | ||
## Important References / Links | ||
Note: This file has only been created for storing important resources related to the development of the project. | ||
|
||
- NumPy-themed documentation (Sphinx-compatible): https://numpydoc.readthedocs.io/en/latest/format.html | ||
- Projects concept (uv): https://docs.astral.sh/uv/concepts/projects/init/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,28 +1,34 @@ | ||
# Import the package. | ||
# Imports. | ||
import asyncio | ||
|
||
import avro | ||
|
||
# Let's assume we'd like to convert "amar sOnar bangla" to Unicode. | ||
dummy_text = "amar sOnar bangla" | ||
print("Original English Text:", dummy_text) | ||
|
||
# Parse the text to Avro. | ||
parsed_text = avro.parse(dummy_text) | ||
print("Parsed Unicode Output:", parsed_text) | ||
# Please follow the detailed guidelines given in the README.md file about each function to learn more. | ||
async def main() -> None: | ||
dummy_text = "amar sOnar bangla" # Dummy text. | ||
print("Original English Text:", dummy_text) | ||
|
||
parsed_text = await avro.parse(dummy_text) # Parse the text to Bengali. | ||
print("Parsed Unicode Output:", parsed_text) | ||
|
||
# We can parse it directly to Bijoy, or use the to_bijoy function to convert it. | ||
# Both should return the same result. | ||
bijoy_text_direct = await avro.parse(dummy_text, bijoy=True) | ||
bijoy_text_function = await avro.to_bijoy(parsed_text) | ||
|
||
if bijoy_text_direct == bijoy_text_function: | ||
print(f"Bijoy Output: {bijoy_text_direct}") | ||
|
||
# We can parse it directly to Bijoy, or use the to_bijoy function to convert it. | ||
# Both should return the same result. | ||
bijoy_text_direct = avro.parse(dummy_text, bijoy=True) | ||
bijoy_text_function = avro.to_bijoy(parsed_text) | ||
# Now, we can return the Bijoy text to Unicode since we'd like the original output (assuming). | ||
# This should be the same as the old parsed_text variable. | ||
unicode_text = await avro.to_unicode(bijoy_text_direct) | ||
print("Reversed Unicode Output:", unicode_text) | ||
|
||
# Print the Bijoy text. | ||
if bijoy_text_direct == bijoy_text_function: | ||
print(f"Bijoy Output: {bijoy_text_direct}") | ||
# Finally, we can reverse the Bengali text, back to English! | ||
reversed = await avro.reverse(unicode_text) | ||
print("Reversed English Output:", reversed) | ||
|
||
# Now, we can return the Bijoy text to Unicode since we'd like the original output (assuming). | ||
# This should be the same as the old parsed_text variable. | ||
unicode_text = avro.to_unicode(bijoy_text_direct) | ||
print("Reversed Unicode Output:", unicode_text) | ||
|
||
# Finally, we can reverse the Bengali text, back to English! | ||
reversed = avro.reverse(unicode_text) | ||
print("Reversed English Output:", reversed) | ||
if __name__ == "__main__": | ||
asyncio.run(main()) |
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,2 @@ | ||
[pytest] | ||
asyncio_mode = auto |
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 |
---|---|---|
@@ -1,22 +1,44 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
|
||
# Import local modules. | ||
# Imports. | ||
from avro.core import config | ||
|
||
|
||
# Functions. | ||
def count_vowels(text: str) -> int: | ||
""" | ||
Count number of occurrences of vowels in a given string. | ||
"""Count number of occurrences of vowels in a given string. | ||
Parameters: | ||
----------- | ||
text: str | ||
The text to count vowels from. | ||
Returns: | ||
-------- | ||
int | ||
The number of vowels in the given text. | ||
""" | ||
|
||
return sum(1 for i in text if i.lower() in config.AVRO_VOWELS) | ||
|
||
|
||
def count_consonants(text: str) -> int: | ||
""" | ||
Count number of occurrences of consonants in a given string. | ||
"""Count number of occurrences of consonants in a given string. | ||
Parameters: | ||
----------- | ||
text: str | ||
The text to count consonants from. | ||
Returns: | ||
-------- | ||
int | ||
The number of consonants in the given text. | ||
""" | ||
|
||
return sum(1 for i in text if i.lower() in config.AVRO_CONSONANTS) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.