rgwfuncs 0.0.18__py3-none-any.whl → 0.0.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rgwfuncs/__init__.py +2 -2
- rgwfuncs/df_lib.py +1 -1
- rgwfuncs/str_lib.py +46 -4
- {rgwfuncs-0.0.18.dist-info → rgwfuncs-0.0.19.dist-info}/METADATA +41 -4
- rgwfuncs-0.0.19.dist-info/RECORD +9 -0
- rgwfuncs-0.0.18.dist-info/RECORD +0 -9
- {rgwfuncs-0.0.18.dist-info → rgwfuncs-0.0.19.dist-info}/LICENSE +0 -0
- {rgwfuncs-0.0.18.dist-info → rgwfuncs-0.0.19.dist-info}/WHEEL +0 -0
- {rgwfuncs-0.0.18.dist-info → rgwfuncs-0.0.19.dist-info}/entry_points.txt +0 -0
- {rgwfuncs-0.0.18.dist-info → rgwfuncs-0.0.19.dist-info}/top_level.txt +0 -0
rgwfuncs/__init__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# This file is automatically generated
|
2
2
|
# Dynamically importing functions from modules
|
3
3
|
|
4
|
-
from .df_lib import append_columns, append_percentile_classification_column, append_ranged_classification_column, append_ranged_date_classification_column, append_rows, append_xgb_labels, append_xgb_logistic_regression_predictions, append_xgb_regression_predictions, bag_union_join, bottom_n_unique_values, cascade_sort, delete_rows,
|
5
|
-
from .str_lib import send_telegram_message
|
4
|
+
from .df_lib import append_columns, append_percentile_classification_column, append_ranged_classification_column, append_ranged_date_classification_column, append_rows, append_xgb_labels, append_xgb_logistic_regression_predictions, append_xgb_regression_predictions, bag_union_join, bottom_n_unique_values, cascade_sort, delete_rows, df_docs, drop_duplicates, drop_duplicates_retain_first, drop_duplicates_retain_last, filter_dataframe, filter_indian_mobiles, first_n_rows, from_raw_data, insert_dataframe_in_sqlite_database, last_n_rows, left_join, limit_dataframe, load_data_from_path, load_data_from_query, load_data_from_sqlite_path, mask_against_dataframe, mask_against_dataframe_converse, numeric_clean, order_columns, print_correlation, print_dataframe, print_memory_usage, print_n_frequency_cascading, print_n_frequency_linear, rename_columns, retain_columns, right_join, send_data_to_email, send_data_to_slack, send_dataframe_via_telegram, sync_dataframe_to_sqlite_database, top_n_unique_values, union_join, update_rows
|
5
|
+
from .str_lib import send_telegram_message, str_docs
|
rgwfuncs/df_lib.py
CHANGED
@@ -29,7 +29,7 @@ import warnings
|
|
29
29
|
warnings.filterwarnings("ignore", category=FutureWarning)
|
30
30
|
|
31
31
|
|
32
|
-
def
|
32
|
+
def df_docs(method_type_filter: Optional[str] = None) -> None:
|
33
33
|
"""
|
34
34
|
Print a list of function names in alphabetical order. If method_type_filter
|
35
35
|
is specified, print the docstrings of the functions that match the filter.
|
rgwfuncs/str_lib.py
CHANGED
@@ -1,7 +1,50 @@
|
|
1
1
|
import os
|
2
2
|
import json
|
3
3
|
import requests
|
4
|
-
|
4
|
+
import inspect
|
5
|
+
from typing import Tuple, Optional, Dict, Callable
|
6
|
+
import warnings
|
7
|
+
|
8
|
+
# Suppress all FutureWarnings
|
9
|
+
warnings.filterwarnings("ignore", category=FutureWarning)
|
10
|
+
|
11
|
+
|
12
|
+
def str_docs(method_type_filter: Optional[str] = None) -> None:
|
13
|
+
"""
|
14
|
+
Print a list of function names in alphabetical order. If method_type_filter
|
15
|
+
is specified, print the docstrings of the functions that match the filter.
|
16
|
+
Using '*' as a filter will print the docstrings for all functions.
|
17
|
+
|
18
|
+
Parameters:
|
19
|
+
method_type_filter: Optional filter string representing a function name,
|
20
|
+
or '*' to display docstrings for all functions.
|
21
|
+
"""
|
22
|
+
# Get the current module's namespace
|
23
|
+
current_module = __name__
|
24
|
+
|
25
|
+
local_functions: Dict[str, Callable] = {
|
26
|
+
name: obj for name, obj in globals().items()
|
27
|
+
if inspect.isfunction(obj) and obj.__module__ == current_module
|
28
|
+
}
|
29
|
+
|
30
|
+
# List of function names sorted alphabetically
|
31
|
+
function_names = sorted(local_functions.keys())
|
32
|
+
|
33
|
+
# Print function names
|
34
|
+
print("Functions in alphabetical order:")
|
35
|
+
for name in function_names:
|
36
|
+
print(name)
|
37
|
+
|
38
|
+
# If a filter is provided or '*', print the docstrings of functions
|
39
|
+
if method_type_filter:
|
40
|
+
# print("\nFiltered function documentation:")
|
41
|
+
for name, func in local_functions.items():
|
42
|
+
docstring: Optional[str] = func.__doc__
|
43
|
+
if docstring:
|
44
|
+
if method_type_filter == '*' or method_type_filter == name:
|
45
|
+
# Print the entire docstring for the matching function
|
46
|
+
print(f"\n{name}:\n{docstring}")
|
47
|
+
|
5
48
|
|
6
49
|
def send_telegram_message(preset_name: str, message: str) -> None:
|
7
50
|
"""Send a Telegram message using the specified preset.
|
@@ -48,10 +91,10 @@ def send_telegram_message(preset_name: str, message: str) -> None:
|
|
48
91
|
|
49
92
|
# Load the configuration
|
50
93
|
config = load_config()
|
51
|
-
|
94
|
+
|
52
95
|
# Get bot details from the configuration
|
53
96
|
bot_token, chat_id = get_telegram_bot_details(config, preset_name)
|
54
|
-
|
97
|
+
|
55
98
|
# Prepare the request
|
56
99
|
url = f"https://api.telegram.org/bot{bot_token}/sendMessage"
|
57
100
|
payload = {"chat_id": chat_id, "text": message}
|
@@ -59,4 +102,3 @@ def send_telegram_message(preset_name: str, message: str) -> None:
|
|
59
102
|
# Send the message
|
60
103
|
response = requests.post(url, json=payload)
|
61
104
|
response.raise_for_status()
|
62
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: rgwfuncs
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.19
|
4
4
|
Summary: A functional programming paradigm for mathematical modelling and data science
|
5
5
|
Home-page: https://github.com/ryangerardwilson/rgwfunc
|
6
6
|
Author: Ryan Gerard Wilson
|
@@ -135,11 +135,48 @@ To display all docstrings, use:
|
|
135
135
|
|
136
136
|
--------------------------------------------------------------------------------
|
137
137
|
|
138
|
-
##
|
138
|
+
## String Based Functions
|
139
|
+
|
140
|
+
### 1. str_docs
|
141
|
+
Print a list of available function names in alphabetical order. If a filter is provided, print the matching docstrings.
|
142
|
+
|
143
|
+
• Parameters:
|
144
|
+
- `method_type_filter` (str): Optional, comma-separated to select docstring types, or '*' for all.
|
145
|
+
|
146
|
+
• Example:
|
147
|
+
|
148
|
+
import rgwfuncs
|
149
|
+
rgwfuncs.str_docs(method_type_filter='numeric_clean,limit_dataframe')
|
150
|
+
|
151
|
+
--------------------------------------------------------------------------------
|
152
|
+
|
153
|
+
### 2. send_telegram_message
|
154
|
+
|
155
|
+
Send a message to a Telegram chat using a specified preset from your configuration file.
|
156
|
+
|
157
|
+
• Parameters:
|
158
|
+
- `preset_name` (str): The name of the preset to use for sending the message. This should match a preset in the configuration file.
|
159
|
+
- `message` (str): The message text that you want to send to the Telegram chat.
|
160
|
+
|
161
|
+
• Raises:
|
162
|
+
- `RuntimeError`: If the preset is not found in the configuration file or if necessary details (bot token or chat ID) are missing.
|
163
|
+
|
164
|
+
• Example:
|
165
|
+
|
166
|
+
from rgwfuncs import send_telegram_message
|
167
|
+
|
168
|
+
preset_name = "daily_updates"
|
169
|
+
message = "Here is your daily update!"
|
170
|
+
|
171
|
+
send_telegram_message(preset_name, message)
|
172
|
+
|
173
|
+
--------------------------------------------------------------------------------
|
174
|
+
|
175
|
+
## Dataframe Based Functions
|
139
176
|
|
140
177
|
Below is a quick reference of available functions, their purpose, and basic usage examples.
|
141
178
|
|
142
|
-
### 1.
|
179
|
+
### 1. df_docs
|
143
180
|
Print a list of available function names in alphabetical order. If a filter is provided, print the matching docstrings.
|
144
181
|
|
145
182
|
• Parameters:
|
@@ -148,7 +185,7 @@ Print a list of available function names in alphabetical order. If a filter is p
|
|
148
185
|
• Example:
|
149
186
|
|
150
187
|
import rgwfuncs
|
151
|
-
rgwfuncs.
|
188
|
+
rgwfuncs.df_docs(method_type_filter='numeric_clean,limit_dataframe')
|
152
189
|
|
153
190
|
--------------------------------------------------------------------------------
|
154
191
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
rgwfuncs/__init__.py,sha256=2nrp3c5VmVrKh0Ih6zELL8niH9nAHN0XnObqe-EpxlE,1169
|
2
|
+
rgwfuncs/df_lib.py,sha256=KVe7o9P3XZEDUlF-ilwA7bRZeJi212vSayCfxFCsXtw,67151
|
3
|
+
rgwfuncs/str_lib.py,sha256=I5B0WOGaLUGaedMG7hqiKnIqV7Jc9h1RYlgOiC_-iGY,3678
|
4
|
+
rgwfuncs-0.0.19.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
|
5
|
+
rgwfuncs-0.0.19.dist-info/METADATA,sha256=q6-lkZGd4szwaagm98MKtFrM7XoC8CW9lZqwEbY_hEk,34681
|
6
|
+
rgwfuncs-0.0.19.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
+
rgwfuncs-0.0.19.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
|
8
|
+
rgwfuncs-0.0.19.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
|
9
|
+
rgwfuncs-0.0.19.dist-info/RECORD,,
|
rgwfuncs-0.0.18.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
rgwfuncs/__init__.py,sha256=XqJ8TJuc4HkQq3T5Gzjf3KTBsdJtyi2NKXBgbPuDn0Y,1156
|
2
|
-
rgwfuncs/df_lib.py,sha256=rY1yVvY04uqR174JwYBFiRnujekr9mbe258wmu9OeeY,67148
|
3
|
-
rgwfuncs/str_lib.py,sha256=6v9AXZ5wWsWVEcvcIz0B1rTmsvYaD-v53r2sYPcV4pU,2109
|
4
|
-
rgwfuncs-0.0.18.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
|
5
|
-
rgwfuncs-0.0.18.dist-info/METADATA,sha256=GfMK-J1vH4CG_fQqQAWwAvDE6JcSqNrKuNKvfOUKV_E,33442
|
6
|
-
rgwfuncs-0.0.18.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
-
rgwfuncs-0.0.18.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
|
8
|
-
rgwfuncs-0.0.18.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
|
9
|
-
rgwfuncs-0.0.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|