code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def qualify_by_address(
self, cr, uid, ids, context=None,
params_to_check=frozenset(QUALIF_BY_ADDRESS_PARAM)):
""" This gets called by the web server """ | This gets called by the web server | qualify_by_address | python | hhatto/autopep8 | test/suite/E12.py | https://github.com/hhatto/autopep8/blob/master/test/suite/E12.py | MIT |
def return_random_from_word(word):
"""
This function receives a TextMobject,
obtains its length:
len(TextMobject("Some text"))
and returns a random list, example:
INPUT: word = TextMobjecT("Hello")
length = len(word) # 4
rango = list(range(length)) # [0,1,2,3]
OUTPUT: [3,0,2,1]... |
This function receives a TextMobject,
obtains its length:
len(TextMobject("Some text"))
and returns a random list, example:
INPUT: word = TextMobjecT("Hello")
length = len(word) # 4
rango = list(range(length)) # [0,1,2,3]
OUTPUT: [3,0,2,1] # Random list
| return_random_from_word | python | manim-kindergarten/manim_sandbox | utils/animations/RandomScene.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/animations/RandomScene.py | MIT |
def get_random_coord(r_x, r_y, step_x, step_y):
"""
Given two ranges (a, b) and (c, d), this function returns an
intermediate array (x, y) such that "x" belongs to (a, c)
and "y" belongs to (b, d).
"""
range_x = list(range(r_x[0], r_x[1], step_x))
range_y = list(range(r_y[0], r_y[1], step_... |
Given two ranges (a, b) and (c, d), this function returns an
intermediate array (x, y) such that "x" belongs to (a, c)
and "y" belongs to (b, d).
| get_random_coord | python | manim-kindergarten/manim_sandbox | utils/animations/RandomScene.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/animations/RandomScene.py | MIT |
def return_random_coords(word, r_x, r_y, step_x, step_y):
"""
This function returns a random coordinate array,
given the length of a TextMobject
"""
rango = range(len(word))
return [word.get_center() + get_random_coord(r_x, r_y, step_x, step_y) for _ in rango] |
This function returns a random coordinate array,
given the length of a TextMobject
| return_random_coords | python | manim-kindergarten/manim_sandbox | utils/animations/RandomScene.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/animations/RandomScene.py | MIT |
def get_formatter(self, **kwargs):
"""
Configuration is based first off instance attributes,
but overwritten by any kew word argument. Relevant
key words:
- include_sign
- group_with_commas
- num_decimal_places
- field_name (e.g. 0 or 0.real)
"""
... |
Configuration is based first off instance attributes,
but overwritten by any kew word argument. Relevant
key words:
- include_sign
- group_with_commas
- num_decimal_places
- field_name (e.g. 0 or 0.real)
| get_formatter | python | manim-kindergarten/manim_sandbox | utils/mobjects/ColorText.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/mobjects/ColorText.py | MIT |
def apply_edge(self):
'''
(private)
Finally apply the edge.
Appies the edge
'''
for (u,v) in self.edgeQ:
if u==v:
continue
self.adde(u,v) |
(private)
Finally apply the edge.
Appies the edge
| apply_edge | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def adde(self, u, v):
'''
(private)
Add an edge applied on arraies inside.
'''
if self.verbose:
print("Added edge from and to"+str(u)+" "+str(v))
self.hasone[u] = True
self.hasone[v] = True
self.out[u]=self.out[u]+1
self.cnt = self.cn... |
(private)
Add an edge applied on arraies inside.
| adde | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def dfs(self, x,layer,fat):
'''
(private)
Get the basic arguments of the tree.
'''
self.dfsord.append(x)
self.dep[x] = layer
self.fa[x] = fat
i = self.head[x]
if i==0:
self.size[x]=1
while i != int(0):
v = self.edg[... |
(private)
Get the basic arguments of the tree.
| dfs | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def getpos(self,v):
'''
(private)
Get the x-y crood position between of a tree.
'''
if v!= self.treeroot:
u=self.fa[v]
self.pos[v] = self.pos[u]+2*np.array([math.cos(self.tau[v]+self.omega[v]/2),math.sin(self.tau[v]+self.omega[v]/2),0])
yita = se... |
(private)
Get the x-y crood position between of a tree.
| getpos | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def getxy(self):
'''
(private)
Get the position between of a tree.
'''
self.getpos(self.treeroot)
for i in range(1,self.edgnum):
if self.hasone[i]:
p=Circle(fill_color=GREEN,radius=0.25,fill_opacity=0.8,color=GREEN)
p.move_to(se... |
(private)
Get the position between of a tree.
| getxy | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def get_id(self):
'''
(private)
Get the id between of a tree.
'''
for i in range(1,self.edgnum):
if self.hasone[i]==True:
ics=TextMobject(str(i))
ics.move_to(self.pos[i]).shift((self.radius+0.1)*DOWN).scale(0.6)
self.ids... |
(private)
Get the id between of a tree.
| get_id | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def get_connection(self,x,fa):
'''
(private)
Get the lines between of a tree.
'''
ln = Line(self.pos[self.fa[x]],self.pos[self.fa[x]],color=BLUE)
ln = Line(self.pos[self.fa[x]],self.pos[x],color=BLUE)
self.lines.add(ln)
txt=TextMobject(str(len(self.lines)-... |
(private)
Get the lines between of a tree.
| get_connection | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def highlight_edge(self,frm,to):
"""
Focuses on an edge to stress
"""
for i in range(0,len(self.sidecnt)):
u = self.sidecnt[i][0]
v = self.sidecnt[i][1]
if u!=0 and v!=0:
if frm==u and to==v:
self.play(FocusOn(self.... |
Focuses on an edge to stress
| highlight_edge | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def get_instance_of_edge(self,x):
'''
Returns a instance of edge which you can apply methods on.
'''
for i in range(0,len(self.sidecnt)):
u = self.sidecnt[i][0]
v = self.sidecnt[i][1]
if u!=0 and v!=0:
if frm==u and to==v:
... |
Returns a instance of edge which you can apply methods on.
| get_instance_of_edge | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def get_arguments(self):
'''
(private)
Get the datas of a tree.
'''
self.apply_edge()
self.dfs(self.treeroot,self.treeroot,0)
self.treeMobject.add(self.getxy())
self.treeMobject.add(self.get_nodes())
self.treeMobject.add(self.get_id())
self... |
(private)
Get the datas of a tree.
| get_arguments | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def restart(self):
'''
(private)
Restart the tree. Clear all the mobjects and datas.
'''
self.cnt = 0
self.edg = [Edge(0,0)]
self.head = [0]*self.edgnum
self.dep = [0]*self.edgnum
self.sidecnt = [(0,0)]
self.fa = [0]*self.edgnum
sel... |
(private)
Restart the tree. Clear all the mobjects and datas.
| restart | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def draw_tree(self):
'''
Show up the tree onto the screen.
'''
self.apply_edge()
self.dfs(self.treeroot,self.treeroot,0)
self.treeMobject.add(self.getxy())
self.treeMobject.add(self.get_nodes())
self.treeMobject.add(self.get_id())
self.treeMobject.... |
Show up the tree onto the screen.
| draw_tree | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def update_transform(self):
'''
Update the tree on the screen, which uses the latest data to
reposition and rebuild the tree.
'''
utter = self.treeMobject.copy()
self.remove(self.treeMobject)
self.restart()
self.get_arguments()
self.play(Transfo... |
Update the tree on the screen, which uses the latest data to
reposition and rebuild the tree.
| update_transform | python | manim-kindergarten/manim_sandbox | utils/scenes/OITree.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/utils/scenes/OITree.py | MIT |
def capture(self, mobjects, write_current_frame=True):
"""
Capture mobjects on the current frame, write to movie if possible.
:param mobjects: instance of Mobject to be captured.
:param write_current_frame: boolean value, whether to write current frame to movie.
"""
self... |
Capture mobjects on the current frame, write to movie if possible.
:param mobjects: instance of Mobject to be captured.
:param write_current_frame: boolean value, whether to write current frame to movie.
| capture | python | manim-kindergarten/manim_sandbox | videos/Solitaire/raw_frame_scene.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/videos/Solitaire/raw_frame_scene.py | MIT |
def tear_down(self):
"""
Finish method for RawFrameScene. A must call after using this scene.
"""
self.file_writer.close_movie_pipe()
setattr(self, "msg_flag", False)
self.msg_thread.join()
self.print_frame_message(msg_end="\n")
self.num_plays += 1 |
Finish method for RawFrameScene. A must call after using this scene.
| tear_down | python | manim-kindergarten/manim_sandbox | videos/Solitaire/raw_frame_scene.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/videos/Solitaire/raw_frame_scene.py | MIT |
def play(*args, **kwargs):
"""
'self.play' method fails in this scene. Do not use it.
"""
raise Exception("""
'self.play' method is not allowed to use in this scene
Use 'self.capture(...)' instead
""") |
'self.play' method fails in this scene. Do not use it.
| play | python | manim-kindergarten/manim_sandbox | videos/Solitaire/raw_frame_scene.py | https://github.com/manim-kindergarten/manim_sandbox/blob/master/videos/Solitaire/raw_frame_scene.py | MIT |
async def async_update_worker(worker_id, q, notification_q, app, datastore):
"""
Async worker function that processes watch check jobs from the queue.
Args:
worker_id: Unique identifier for this worker
q: AsyncSignalPriorityQueue containing jobs to process
notification_q: Standa... |
Async worker function that processes watch check jobs from the queue.
Args:
worker_id: Unique identifier for this worker
q: AsyncSignalPriorityQueue containing jobs to process
notification_q: Standard queue for notifications
app: Flask application instance
datastore... | async_update_worker | python | dgtlmoon/changedetection.io | changedetectionio/async_update_worker.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/async_update_worker.py | Apache-2.0 |
def cleanup_error_artifacts(uuid, datastore):
"""Helper function to clean up error artifacts"""
cleanup_files = ["last-error-screenshot.png", "last-error.txt"]
for f in cleanup_files:
full_path = os.path.join(datastore.datastore_path, uuid, f)
if os.path.isfile(full_path):
os.unl... | Helper function to clean up error artifacts | cleanup_error_artifacts | python | dgtlmoon/changedetection.io | changedetectionio/async_update_worker.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/async_update_worker.py | Apache-2.0 |
async def send_content_changed_notification(watch_uuid, notification_q, datastore):
"""Helper function to queue notifications using the new notification service"""
try:
from changedetectionio.notification_service import create_notification_service
# Create notification service instance
... | Helper function to queue notifications using the new notification service | send_content_changed_notification | python | dgtlmoon/changedetection.io | changedetectionio/async_update_worker.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/async_update_worker.py | Apache-2.0 |
async def send_filter_failure_notification(watch_uuid, notification_q, datastore):
"""Helper function to send filter failure notifications using the new notification service"""
try:
from changedetectionio.notification_service import create_notification_service
# Create notification serv... | Helper function to send filter failure notifications using the new notification service | send_filter_failure_notification | python | dgtlmoon/changedetection.io | changedetectionio/async_update_worker.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/async_update_worker.py | Apache-2.0 |
async def send_step_failure_notification(watch_uuid, step_n, notification_q, datastore):
"""Helper function to send step failure notifications using the new notification service"""
try:
from changedetectionio.notification_service import create_notification_service
# Create notification ... | Helper function to send step failure notifications using the new notification service | send_step_failure_notification | python | dgtlmoon/changedetection.io | changedetectionio/async_update_worker.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/async_update_worker.py | Apache-2.0 |
def login_optionally_required(func):
"""
If password authentication is enabled, verify the user is logged in.
To be used as a decorator for routes that should optionally require login.
This version is blueprint-friendly as it uses current_app instead of directly accessing app.
"""
@wraps(func)
... |
If password authentication is enabled, verify the user is logged in.
To be used as a decorator for routes that should optionally require login.
This version is blueprint-friendly as it uses current_app instead of directly accessing app.
| login_optionally_required | python | dgtlmoon/changedetection.io | changedetectionio/auth_decorator.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/auth_decorator.py | Apache-2.0 |
def get_uuid_position(self, target_uuid):
"""
Find the position of a watch UUID in the priority queue.
Optimized for large queues - O(n) complexity instead of O(n log n).
Args:
target_uuid: The UUID to search for
Returns:
dict: Contai... |
Find the position of a watch UUID in the priority queue.
Optimized for large queues - O(n) complexity instead of O(n log n).
Args:
target_uuid: The UUID to search for
Returns:
dict: Contains position info or None if not found
... | get_uuid_position | python | dgtlmoon/changedetection.io | changedetectionio/custom_queue.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/custom_queue.py | Apache-2.0 |
def get_queue_summary(self):
"""
Get a quick summary of queue state without expensive operations.
O(n) complexity - fast even for large queues.
Returns:
dict: Queue summary statistics
"""
with self.mutex:
queue_list = list(self.queue)
... |
Get a quick summary of queue state without expensive operations.
O(n) complexity - fast even for large queues.
Returns:
dict: Queue summary statistics
| get_queue_summary | python | dgtlmoon/changedetection.io | changedetectionio/custom_queue.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/custom_queue.py | Apache-2.0 |
def get_uuid_position(self, target_uuid):
"""
Find the position of a watch UUID in the async priority queue.
Optimized for large queues - O(n) complexity instead of O(n log n).
Args:
target_uuid: The UUID to search for
Returns:
dict: ... |
Find the position of a watch UUID in the async priority queue.
Optimized for large queues - O(n) complexity instead of O(n log n).
Args:
target_uuid: The UUID to search for
Returns:
dict: Contains position info or None if not found
... | get_uuid_position | python | dgtlmoon/changedetection.io | changedetectionio/custom_queue.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/custom_queue.py | Apache-2.0 |
def get_queue_summary(self):
"""
Get a quick summary of async queue state.
O(n) complexity - fast even for large queues.
"""
queue_list = list(self._queue)
total_items = len(queue_list)
if total_items == 0:
return {
'total_item... |
Get a quick summary of async queue state.
O(n) complexity - fast even for large queues.
| get_queue_summary | python | dgtlmoon/changedetection.io | changedetectionio/custom_queue.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/custom_queue.py | Apache-2.0 |
def customSequenceMatcher(
before: List[str],
after: List[str],
include_equal: bool = False,
include_removed: bool = True,
include_added: bool = True,
include_replaced: bool = True,
include_change_type_prefix: bool = True,
html_colour: bool = False
) -> Iterator[List[str]]:
"""
C... |
Compare two sequences and yield differences based on specified parameters.
Args:
before (List[str]): Original sequence
after (List[str]): Modified sequence
include_equal (bool): Include unchanged parts
include_removed (bool): Include removed parts
include_added (bool): ... | customSequenceMatcher | python | dgtlmoon/changedetection.io | changedetectionio/diff.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/diff.py | Apache-2.0 |
def render_diff(
previous_version_file_contents: str,
newest_version_file_contents: str,
include_equal: bool = False,
include_removed: bool = True,
include_added: bool = True,
include_replaced: bool = True,
line_feed_sep: str = "\n",
include_change_type_prefix: bool = True,
patch_for... |
Render the difference between two file contents.
Args:
previous_version_file_contents (str): Original file contents
newest_version_file_contents (str): Modified file contents
include_equal (bool): Include unchanged parts
include_removed (bool): Include removed parts
inc... | render_diff | python | dgtlmoon/changedetection.io | changedetectionio/diff.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/diff.py | Apache-2.0 |
def get_socketio_path():
"""Generate the correct Socket.IO path prefix for the client"""
# If behind a proxy with a sub-path, we need to respect that path
prefix = ""
if os.getenv('USE_X_SETTINGS') and 'X-Forwarded-Prefix' in request.headers:
prefix = request.headers['X-Forwarded-Prefix']
#... | Generate the correct Socket.IO path prefix for the client | get_socketio_path | python | dgtlmoon/changedetection.io | changedetectionio/flask_app.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/flask_app.py | Apache-2.0 |
def _jinja2_filter_format_number_locale(value: float) -> str:
"Formats for example 4000.10 to the local locale default of 4,000.10"
# Format the number with two decimal places (locale format string will return 6 decimal)
formatted_value = locale.format_string("%.2f", value, grouping=True)
return format... | Formats for example 4000.10 to the local locale default of 4,000.10 | _jinja2_filter_format_number_locale | python | dgtlmoon/changedetection.io | changedetectionio/flask_app.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/flask_app.py | Apache-2.0 |
def _get_worker_status_info():
"""Get detailed worker status information for display"""
status = worker_handler.get_worker_status()
running_uuids = worker_handler.get_running_uuids()
return {
'count': status['worker_count'],
'type': status['worker_type'],
'active_workers': l... | Get detailed worker status information for display | _get_worker_status_info | python | dgtlmoon/changedetection.io | changedetectionio/flask_app.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/flask_app.py | Apache-2.0 |
def process_formdata(self, valuelist):
"""
Processes the raw input from the form and stores it as a string.
"""
if valuelist:
time_str = valuelist[0]
# Simple validation for HH:MM format
if not time_str or len(time_str.split(":")) != 2:
... |
Processes the raw input from the form and stores it as a string.
| process_formdata | python | dgtlmoon/changedetection.io | changedetectionio/forms.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/forms.py | Apache-2.0 |
def memory_cleanup(app=None):
"""
Perform comprehensive memory cleanup operations and log memory usage
at each step with nicely formatted numbers.
Args:
app: Optional Flask app instance for clearing Flask-specific caches
Returns:
str: Status message
"""
# Get cu... |
Perform comprehensive memory cleanup operations and log memory usage
at each step with nicely formatted numbers.
Args:
app: Optional Flask app instance for clearing Flask-specific caches
Returns:
str: Status message
| memory_cleanup | python | dgtlmoon/changedetection.io | changedetectionio/gc_cleanup.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/gc_cleanup.py | Apache-2.0 |
def element_removal(selectors: List[str], html_content):
"""Removes elements that match a list of CSS or XPath selectors."""
modified_html = html_content
css_selectors = []
xpath_selectors = []
for selector in selectors:
if selector.startswith(('xpath:', 'xpath1:', '//')):
# Han... | Removes elements that match a list of CSS or XPath selectors. | element_removal | python | dgtlmoon/changedetection.io | changedetectionio/html_tools.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/html_tools.py | Apache-2.0 |
def workarounds_for_obfuscations(content):
"""
Some sites are using sneaky tactics to make prices and other information un-renderable by Inscriptis
This could go into its own Pip package in the future, for faster updates
"""
# HomeDepot.com style <span>$<!-- -->90<!-- -->.<!-- -->74</span>
# ht... |
Some sites are using sneaky tactics to make prices and other information un-renderable by Inscriptis
This could go into its own Pip package in the future, for faster updates
| workarounds_for_obfuscations | python | dgtlmoon/changedetection.io | changedetectionio/html_tools.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/html_tools.py | Apache-2.0 |
def queue_notification_for_watch(self, n_object, watch):
"""
Queue a notification for a watch with full diff rendering and template variables
"""
from changedetectionio import diff
from changedetectionio.notification import default_notification_format_for_watch
dates = [... |
Queue a notification for a watch with full diff rendering and template variables
| queue_notification_for_watch | python | dgtlmoon/changedetection.io | changedetectionio/notification_service.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/notification_service.py | Apache-2.0 |
def _check_cascading_vars(self, var_name, watch):
"""
Check notification variables in cascading priority:
Individual watch settings > Tag settings > Global settings
"""
from changedetectionio.notification import (
default_notification_format_for_watch,
def... |
Check notification variables in cascading priority:
Individual watch settings > Tag settings > Global settings
| _check_cascading_vars | python | dgtlmoon/changedetection.io | changedetectionio/notification_service.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/notification_service.py | Apache-2.0 |
def send_content_changed_notification(self, watch_uuid):
"""
Send notification when content changes are detected
"""
n_object = {}
watch = self.datastore.data['watching'].get(watch_uuid)
if not watch:
return
watch_history = watch.history
dates... |
Send notification when content changes are detected
| send_content_changed_notification | python | dgtlmoon/changedetection.io | changedetectionio/notification_service.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/notification_service.py | Apache-2.0 |
def send_filter_failure_notification(self, watch_uuid):
"""
Send notification when CSS/XPath filters fail consecutively
"""
threshold = self.datastore.data['settings']['application'].get('filter_failure_notification_threshold_attempts')
watch = self.datastore.data['watching'].get... |
Send notification when CSS/XPath filters fail consecutively
| send_filter_failure_notification | python | dgtlmoon/changedetection.io | changedetectionio/notification_service.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/notification_service.py | Apache-2.0 |
def send_step_failure_notification(self, watch_uuid, step_n):
"""
Send notification when browser steps fail consecutively
"""
watch = self.datastore.data['watching'].get(watch_uuid, False)
if not watch:
return
threshold = self.datastore.data['settings']['appli... |
Send notification when browser steps fail consecutively
| send_step_failure_notification | python | dgtlmoon/changedetection.io | changedetectionio/notification_service.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/notification_service.py | Apache-2.0 |
def collect_ui_edit_stats_extras(watch):
"""Collect and combine HTML content from all plugins that implement ui_edit_stats_extras"""
extras_content = []
# Get all plugins that implement the ui_edit_stats_extras hook
results = plugin_manager.hook.ui_edit_stats_extras(watch=watch)
# If we ha... | Collect and combine HTML content from all plugins that implement ui_edit_stats_extras | collect_ui_edit_stats_extras | python | dgtlmoon/changedetection.io | changedetectionio/pluggy_interface.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/pluggy_interface.py | Apache-2.0 |
def rehydrate_entity(self, uuid, entity, processor_override=None):
"""Set the dict back to the dict Watch object"""
entity['uuid'] = uuid
if processor_override:
watch_class = get_custom_watch_obj_for_processor(processor_override)
entity['processor']=processor_override
... | Set the dict back to the dict Watch object | rehydrate_entity | python | dgtlmoon/changedetection.io | changedetectionio/store.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/store.py | Apache-2.0 |
def get_preferred_proxy_for_watch(self, uuid):
"""
Returns the preferred proxy by ID key
:param uuid: UUID
:return: proxy "key" id
"""
if self.proxy_list is None:
return None
# If it's a valid one
watch = self.data['watching'].get(uuid)
... |
Returns the preferred proxy by ID key
:param uuid: UUID
:return: proxy "key" id
| get_preferred_proxy_for_watch | python | dgtlmoon/changedetection.io | changedetectionio/store.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/store.py | Apache-2.0 |
def get_all_tags_for_watch(self, uuid):
"""This should be in Watch model but Watch doesn't have access to datastore, not sure how to solve that yet"""
watch = self.data['watching'].get(uuid)
# Should return a dict of full tag info linked by UUID
if watch:
return dictfilt(sel... | This should be in Watch model but Watch doesn't have access to datastore, not sure how to solve that yet | get_all_tags_for_watch | python | dgtlmoon/changedetection.io | changedetectionio/store.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/store.py | Apache-2.0 |
def am_i_inside_time(
day_of_week: str,
time_str: str,
timezone_str: str,
duration: int = 15,
) -> bool:
"""
Determines if the current time falls within a specified time range.
Parameters:
day_of_week (str): The day of the week (e.g., 'Monday').
time_str (str... |
Determines if the current time falls within a specified time range.
Parameters:
day_of_week (str): The day of the week (e.g., 'Monday').
time_str (str): The start time in 'HH:MM' format.
timezone_str (str): The timezone identifier (e.g., 'Europe/Berlin').
duration (int, optiona... | am_i_inside_time | python | dgtlmoon/changedetection.io | changedetectionio/time_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/time_handler.py | Apache-2.0 |
def start_async_event_loop():
"""Start a dedicated event loop for async workers in a separate thread"""
global async_loop
logger.info("Starting async event loop for workers")
try:
# Create a new event loop for this thread
async_loop = asyncio.new_event_loop()
# Set it as the... | Start a dedicated event loop for async workers in a separate thread | start_async_event_loop | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def start_async_workers(n_workers, update_q, notification_q, app, datastore):
"""Start the async worker management system"""
global async_loop_thread, async_loop, running_async_tasks, currently_processing_uuids
# Clear any stale UUID tracking state
currently_processing_uuids.clear()
# Star... | Start the async worker management system | start_async_workers | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
async def start_single_async_worker(worker_id, update_q, notification_q, app, datastore):
"""Start a single async worker with auto-restart capability"""
from changedetectionio.async_update_worker import async_update_worker
# Check if we're in pytest environment - if so, be more gentle with logging
... | Start a single async worker with auto-restart capability | start_single_async_worker | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def add_worker(update_q, notification_q, app, datastore):
"""Add a new async worker (for dynamic scaling)"""
global running_async_tasks
if not async_loop:
logger.error("Async loop not running, cannot add worker")
return False
worker_id = len(running_async_tasks)
logger.... | Add a new async worker (for dynamic scaling) | add_worker | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def remove_worker():
"""Remove an async worker (for dynamic scaling)"""
global running_async_tasks
if not running_async_tasks:
return False
# Cancel the last worker
task_future = running_async_tasks.pop()
task_future.cancel()
logger.info(f"Removed async worker, {len(run... | Remove an async worker (for dynamic scaling) | remove_worker | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def set_uuid_processing(uuid, processing=True):
"""Mark a UUID as being processed or completed"""
global currently_processing_uuids
if processing:
currently_processing_uuids.add(uuid)
logger.debug(f"Started processing UUID: {uuid}")
else:
currently_processing_uuids.discard(uuid)
... | Mark a UUID as being processed or completed | set_uuid_processing | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def queue_item_async_safe(update_q, item):
"""Queue an item for async queue processing"""
if async_loop and not async_loop.is_closed():
try:
# For async queue, schedule the put operation
asyncio.run_coroutine_threadsafe(update_q.put(item), async_loop)
except RuntimeError ... | Queue an item for async queue processing | queue_item_async_safe | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def shutdown_workers():
"""Shutdown all async workers fast and aggressively"""
global async_loop, async_loop_thread, running_async_tasks
# Check if we're in pytest environment - if so, be more gentle with logging
import os
in_pytest = "pytest" in os.sys.modules or "PYTEST_CURRENT_TEST" in os.en... | Shutdown all async workers fast and aggressively | shutdown_workers | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def adjust_async_worker_count(new_count, update_q=None, notification_q=None, app=None, datastore=None):
"""
Dynamically adjust the number of async workers.
Args:
new_count: Target number of workers
update_q, notification_q, app, datastore: Required for adding new workers
Return... |
Dynamically adjust the number of async workers.
Args:
new_count: Target number of workers
update_q, notification_q, app, datastore: Required for adding new workers
Returns:
dict: Status of the adjustment operation
| adjust_async_worker_count | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def get_worker_status():
"""Get status information about async workers"""
return {
'worker_type': 'async',
'worker_count': get_worker_count(),
'running_uuids': get_running_uuids(),
'async_loop_running': async_loop is not None,
} | Get status information about async workers | get_worker_status | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def check_worker_health(expected_count, update_q=None, notification_q=None, app=None, datastore=None):
"""
Check if the expected number of async workers are running and restart any missing ones.
Args:
expected_count: Expected number of workers
update_q, notification_q, app, datastore: R... |
Check if the expected number of async workers are running and restart any missing ones.
Args:
expected_count: Expected number of workers
update_q, notification_q, app, datastore: Required for restarting workers
Returns:
dict: Health check results
| check_worker_health | python | dgtlmoon/changedetection.io | changedetectionio/worker_handler.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/worker_handler.py | Apache-2.0 |
def post(self):
"""
@api {post} /api/v1/import Import a list of watched URLs
@apiDescription Accepts a line-feed separated list of URLs to import, additionally with ?tag_uuids=(tag id), ?tag=(name), ?proxy={key}, ?dedupe=true (default true) one URL per line.
@apiExample {curl} Example u... |
@api {post} /api/v1/import Import a list of watched URLs
@apiDescription Accepts a line-feed separated list of URLs to import, additionally with ?tag_uuids=(tag id), ?tag=(name), ?proxy={key}, ?dedupe=true (default true) one URL per line.
@apiExample {curl} Example usage:
curl http... | post | python | dgtlmoon/changedetection.io | changedetectionio/api/Import.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Import.py | Apache-2.0 |
def get(self):
"""
@api {get} /api/v1/notifications Return Notification URL List
@apiDescription Return the Notification URL List from the configuration
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/notifications -H"x-api-key:813031b16330fe25e3780cf0325d... |
@api {get} /api/v1/notifications Return Notification URL List
@apiDescription Return the Notification URL List from the configuration
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/notifications -H"x-api-key:813031b16330fe25e3780cf0325daa45"
HTTP/1.0... | get | python | dgtlmoon/changedetection.io | changedetectionio/api/Notifications.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Notifications.py | Apache-2.0 |
def post(self):
"""
@api {post} /api/v1/notifications Create Notification URLs
@apiDescription Add one or more notification URLs from the configuration
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/notifications/batch -H"x-api-key:813031b16330fe25e3780cf... |
@api {post} /api/v1/notifications Create Notification URLs
@apiDescription Add one or more notification URLs from the configuration
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/notifications/batch -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type... | post | python | dgtlmoon/changedetection.io | changedetectionio/api/Notifications.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Notifications.py | Apache-2.0 |
def put(self):
"""
@api {put} /api/v1/notifications Replace Notification URLs
@apiDescription Replace all notification URLs with the provided list (can be empty)
@apiExample {curl} Example usage:
curl -X PUT http://localhost:5000/api/v1/notifications -H"x-api-key:813031b16330... |
@api {put} /api/v1/notifications Replace Notification URLs
@apiDescription Replace all notification URLs with the provided list (can be empty)
@apiExample {curl} Example usage:
curl -X PUT http://localhost:5000/api/v1/notifications -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "... | put | python | dgtlmoon/changedetection.io | changedetectionio/api/Notifications.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Notifications.py | Apache-2.0 |
def delete(self):
"""
@api {delete} /api/v1/notifications Delete Notification URLs
@apiDescription Deletes one or more notification URLs from the configuration
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/notifications -X DELETE -H"x-api-key:813031b1633... |
@api {delete} /api/v1/notifications Delete Notification URLs
@apiDescription Deletes one or more notification URLs from the configuration
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/notifications -X DELETE -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Co... | delete | python | dgtlmoon/changedetection.io | changedetectionio/api/Notifications.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Notifications.py | Apache-2.0 |
def get(self):
"""
@api {get} /api/v1/systeminfo Return system info
@apiDescription Return some info about the current system state
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/systeminfo -H"x-api-key:813031b16330fe25e3780cf0325daa45"
HTTP/1... |
@api {get} /api/v1/systeminfo Return system info
@apiDescription Return some info about the current system state
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/systeminfo -H"x-api-key:813031b16330fe25e3780cf0325daa45"
HTTP/1.0 200
{
... | get | python | dgtlmoon/changedetection.io | changedetectionio/api/SystemInfo.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/SystemInfo.py | Apache-2.0 |
def get(self, uuid):
"""
@api {get} /api/v1/tag/:uuid Single tag - get data or toggle notification muting.
@apiDescription Retrieve tag information and set notification_muted status
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/tag/cc0cfffa-f449-477b-83e... |
@api {get} /api/v1/tag/:uuid Single tag - get data or toggle notification muting.
@apiDescription Retrieve tag information and set notification_muted status
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/tag/cc0cfffa-f449-477b-83ea-0caafd1dc091 -H"x-api-key:8130... | get | python | dgtlmoon/changedetection.io | changedetectionio/api/Tags.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Tags.py | Apache-2.0 |
def delete(self, uuid):
"""
@api {delete} /api/v1/tag/:uuid Delete a tag and remove it from all watches
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/tag/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X DELETE -H"x-api-key:813031b16330fe25e3780cf0325daa45"
@apiPa... |
@api {delete} /api/v1/tag/:uuid Delete a tag and remove it from all watches
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/tag/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X DELETE -H"x-api-key:813031b16330fe25e3780cf0325daa45"
@apiParam {uuid} uuid Tag unique ID.
... | delete | python | dgtlmoon/changedetection.io | changedetectionio/api/Tags.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Tags.py | Apache-2.0 |
def put(self, uuid):
"""
@api {put} /api/v1/tag/:uuid Update tag information
@apiExample {curl} Example usage:
Update (PUT)
curl http://localhost:5000/api/v1/tag/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X PUT -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: a... |
@api {put} /api/v1/tag/:uuid Update tag information
@apiExample {curl} Example usage:
Update (PUT)
curl http://localhost:5000/api/v1/tag/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X PUT -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json" -d '{"title": "... | put | python | dgtlmoon/changedetection.io | changedetectionio/api/Tags.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Tags.py | Apache-2.0 |
def post(self):
"""
@api {post} /api/v1/watch Create a single tag
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json" -d '{"name": "Work related"}'
@apiName Create
... |
@api {post} /api/v1/watch Create a single tag
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json" -d '{"name": "Work related"}'
@apiName Create
@apiGroup Tag
@api... | post | python | dgtlmoon/changedetection.io | changedetectionio/api/Tags.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Tags.py | Apache-2.0 |
def get(self):
"""
@api {get} /api/v1/tags List tags
@apiDescription Return list of available tags
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/tags -H"x-api-key:813031b16330fe25e3780cf0325daa45"
{
"cc0cfffa-f449-477b-83ea-0c... |
@api {get} /api/v1/tags List tags
@apiDescription Return list of available tags
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/tags -H"x-api-key:813031b16330fe25e3780cf0325daa45"
{
"cc0cfffa-f449-477b-83ea-0caafd1dc091": {
... | get | python | dgtlmoon/changedetection.io | changedetectionio/api/Tags.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Tags.py | Apache-2.0 |
def get(self, uuid):
"""
@api {get} /api/v1/watch/:uuid Single watch - get data, recheck, pause, mute.
@apiDescription Retrieve watch information and set muted/paused status
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caa... |
@api {get} /api/v1/watch/:uuid Single watch - get data, recheck, pause, mute.
@apiDescription Retrieve watch information and set muted/paused status
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -H"x-api-key:813031b16... | get | python | dgtlmoon/changedetection.io | changedetectionio/api/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Watch.py | Apache-2.0 |
def delete(self, uuid):
"""
@api {delete} /api/v1/watch/:uuid Delete a watch and related history
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X DELETE -H"x-api-key:813031b16330fe25e3780cf0325daa45"
@apiParam {... |
@api {delete} /api/v1/watch/:uuid Delete a watch and related history
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X DELETE -H"x-api-key:813031b16330fe25e3780cf0325daa45"
@apiParam {uuid} uuid Watch unique ID.
... | delete | python | dgtlmoon/changedetection.io | changedetectionio/api/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Watch.py | Apache-2.0 |
def put(self, uuid):
"""
@api {put} /api/v1/watch/:uuid Update watch information
@apiExample {curl} Example usage:
Update (PUT)
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X PUT -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-T... |
@api {put} /api/v1/watch/:uuid Update watch information
@apiExample {curl} Example usage:
Update (PUT)
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091 -X PUT -H"x-api-key:813031b16330fe25e3780cf0325daa45" -H "Content-Type: application/json" -d '{"url... | put | python | dgtlmoon/changedetection.io | changedetectionio/api/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Watch.py | Apache-2.0 |
def get(self, uuid):
"""
@api {get} /api/v1/watch/<string:uuid>/history Get a list of all historical snapshots available for a watch
@apiDescription Requires `uuid`, returns list
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea... |
@api {get} /api/v1/watch/<string:uuid>/history Get a list of all historical snapshots available for a watch
@apiDescription Requires `uuid`, returns list
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091/history -H"x-api-k... | get | python | dgtlmoon/changedetection.io | changedetectionio/api/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Watch.py | Apache-2.0 |
def get(self, uuid, timestamp):
"""
@api {get} /api/v1/watch/<string:uuid>/history/<int:timestamp> Get single snapshot from watch
@apiDescription Requires watch `uuid` and `timestamp`. `timestamp` of "`latest`" for latest available snapshot, or <a href="#api-Watch_History-Get_list_of_available_s... |
@api {get} /api/v1/watch/<string:uuid>/history/<int:timestamp> Get single snapshot from watch
@apiDescription Requires watch `uuid` and `timestamp`. `timestamp` of "`latest`" for latest available snapshot, or <a href="#api-Watch_History-Get_list_of_available_stored_snapshots_for_watch">use the list ret... | get | python | dgtlmoon/changedetection.io | changedetectionio/api/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Watch.py | Apache-2.0 |
def post(self):
"""
@api {post} /api/v1/watch Create a single watch
@apiDescription Requires atleast `url` set, can accept the same structure as <a href="#api-Watch-Watch">get single watch information</a> to create.
@apiExample {curl} Example usage:
curl http://localhost:5000... |
@api {post} /api/v1/watch Create a single watch
@apiDescription Requires atleast `url` set, can accept the same structure as <a href="#api-Watch-Watch">get single watch information</a> to create.
@apiExample {curl} Example usage:
curl http://localhost:5000/api/v1/watch -H"x-api-key:... | post | python | dgtlmoon/changedetection.io | changedetectionio/api/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/api/Watch.py | Apache-2.0 |
async def action_remove_elements(self, selector, value):
"""Removes all elements matching the given selector from the DOM."""
if not selector:
return
await self.page.locator(selector).evaluate_all("els => els.forEach(el => el.remove())") | Removes all elements matching the given selector from the DOM. | action_remove_elements | python | dgtlmoon/changedetection.io | changedetectionio/blueprint/browser_steps/browser_steps.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/blueprint/browser_steps/browser_steps.py | Apache-2.0 |
async def action_make_all_child_elements_visible(self, selector, value):
"""Recursively makes all child elements inside the given selector fully visible."""
if not selector:
return
await self.page.locator(selector).locator("*").evaluate_all("""
els => els.for... | Recursively makes all child elements inside the given selector fully visible. | action_make_all_child_elements_visible | python | dgtlmoon/changedetection.io | changedetectionio/blueprint/browser_steps/browser_steps.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/blueprint/browser_steps/browser_steps.py | Apache-2.0 |
async def cleanup(self):
"""Properly clean up all resources to prevent memory leaks"""
if self._is_cleaned_up:
return
logger.debug("Cleaning up browser steps resources")
# Clean up page
if hasattr(self, 'page') and self.page is not None:
... | Properly clean up all resources to prevent memory leaks | cleanup | python | dgtlmoon/changedetection.io | changedetectionio/blueprint/browser_steps/browser_steps.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/blueprint/browser_steps/browser_steps.py | Apache-2.0 |
async def get_current_state(self):
"""Return the screenshot and interactive elements mapping, generally always called after action_()"""
import importlib.resources
import json
# because we for now only run browser steps in playwright mode (not puppeteer mode)
from changedetection... | Return the screenshot and interactive elements mapping, generally always called after action_() | get_current_state | python | dgtlmoon/changedetection.io | changedetectionio/blueprint/browser_steps/browser_steps.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/blueprint/browser_steps/browser_steps.py | Apache-2.0 |
def run_async_in_browser_loop(coro):
"""Run async coroutine using the existing async worker event loop"""
from changedetectionio import worker_handler
# Use the existing async worker event loop instead of creating a new one
if worker_handler.USE_ASYNC_WORKERS and worker_handler.async_loop and not w... | Run async coroutine using the existing async worker event loop | run_async_in_browser_loop | python | dgtlmoon/changedetection.io | changedetectionio/blueprint/browser_steps/__init__.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/blueprint/browser_steps/__init__.py | Apache-2.0 |
def _watch_has_tag_options_set(watch):
"""This should be fixed better so that Tag is some proper Model, a tag is just a Watch also"""
for tag_uuid, tag in datastore.data['settings']['application'].get('tags', {}).items():
if tag_uuid in watch.get('tags', []) and (tag.get('include_filters') o... | This should be fixed better so that Tag is some proper Model, a tag is just a Watch also | _watch_has_tag_options_set | python | dgtlmoon/changedetection.io | changedetectionio/blueprint/ui/edit.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/blueprint/ui/edit.py | Apache-2.0 |
def watch_get_preview_rendered(uuid):
'''For when viewing the "preview" of the rendered text from inside of Edit'''
from flask import jsonify
from changedetectionio.processors.text_json_diff import prepare_filter_prevew
result = prepare_filter_prevew(watch_uuid=uuid, form_data=request.fo... | For when viewing the "preview" of the rendered text from inside of Edit | watch_get_preview_rendered | python | dgtlmoon/changedetection.io | changedetectionio/blueprint/ui/edit.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/blueprint/ui/edit.py | Apache-2.0 |
def form_share_put_watch(uuid):
"""Given a watch UUID, upload the info and return a share-link
the share-link can be imported/added"""
import requests
import json
from copy import deepcopy
# more for testing
if uuid == 'first':
uuid = list(datastor... | Given a watch UUID, upload the info and return a share-link
the share-link can be imported/added | form_share_put_watch | python | dgtlmoon/changedetection.io | changedetectionio/blueprint/ui/__init__.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/blueprint/ui/__init__.py | Apache-2.0 |
def verify_condition_single_rule(watch_uuid):
"""Verify a single condition rule against the current snapshot"""
from changedetectionio.processors.text_json_diff import prepare_filter_prevew
from flask import request, jsonify
from copy import deepcopy
ephemeral_data = {}
... | Verify a single condition rule against the current snapshot | verify_condition_single_rule | python | dgtlmoon/changedetection.io | changedetectionio/conditions/blueprint.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/conditions/blueprint.py | Apache-2.0 |
def convert_to_jsonlogic(logic_operator: str, rule_dict: list):
"""
Convert a structured rule dict into a JSON Logic rule.
:param rule_dict: Dictionary containing conditions.
:return: JSON Logic rule as a dictionary.
"""
json_logic_conditions = []
for condition in rule_dict:
oper... |
Convert a structured rule dict into a JSON Logic rule.
:param rule_dict: Dictionary containing conditions.
:return: JSON Logic rule as a dictionary.
| convert_to_jsonlogic | python | dgtlmoon/changedetection.io | changedetectionio/conditions/__init__.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/conditions/__init__.py | Apache-2.0 |
def execute_ruleset_against_all_plugins(current_watch_uuid: str, application_datastruct, ephemeral_data={} ):
"""
Build our data and options by calling our plugins then pass it to jsonlogic and see if the conditions pass
:param ruleset: JSON Logic rule dictionary.
:param extracted_data: Dictionary cont... |
Build our data and options by calling our plugins then pass it to jsonlogic and see if the conditions pass
:param ruleset: JSON Logic rule dictionary.
:param extracted_data: Dictionary containing the facts. <-- maybe the app struct+uuid
:return: Dictionary of plugin results.
| execute_ruleset_against_all_plugins | python | dgtlmoon/changedetection.io | changedetectionio/conditions/__init__.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/conditions/__init__.py | Apache-2.0 |
def ui_edit_stats_extras(watch):
"""Add Levenshtein stats to the UI using the global plugin system"""
"""Generate the HTML for Levenshtein stats - shared by both plugin systems"""
if len(watch.history.keys()) < 2:
return "<p>Not enough history to calculate Levenshtein metrics</p>"
try:
... | Add Levenshtein stats to the UI using the global plugin system | ui_edit_stats_extras | python | dgtlmoon/changedetection.io | changedetectionio/conditions/plugins/levenshtein_plugin.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/conditions/plugins/levenshtein_plugin.py | Apache-2.0 |
def add_data(current_watch_uuid, application_datastruct, ephemeral_data):
"""Add word count data for conditions"""
result = {}
watch = application_datastruct['watching'].get(current_watch_uuid)
if watch and 'text' in ephemeral_data:
word_count = count_words_in_history(watch, ephemeral_data[... | Add word count data for conditions | add_data | python | dgtlmoon/changedetection.io | changedetectionio/conditions/plugins/wordcount_plugin.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/conditions/plugins/wordcount_plugin.py | Apache-2.0 |
def _generate_stats_html(watch):
"""Generate the HTML content for the stats tab"""
word_count = count_words_in_history(watch)
html = f"""
<div class="word-count-stats">
<h4>Content Analysis</h4>
<table class="pure-table">
<tbody>
<tr>
... | Generate the HTML content for the stats tab | _generate_stats_html | python | dgtlmoon/changedetection.io | changedetectionio/conditions/plugins/wordcount_plugin.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/conditions/plugins/wordcount_plugin.py | Apache-2.0 |
def manage_user_agent(headers, current_ua=''):
"""
Basic setting of user-agent
NOTE!!!!!! The service that does the actual Chrome fetching should handle any anti-robot techniques
THERE ARE MANY WAYS THAT IT CAN BE DETECTED AS A ROBOT!!
This does not take care of
- Scraping of 'navigator' (platf... |
Basic setting of user-agent
NOTE!!!!!! The service that does the actual Chrome fetching should handle any anti-robot techniques
THERE ARE MANY WAYS THAT IT CAN BE DETECTED AS A ROBOT!!
This does not take care of
- Scraping of 'navigator' (platform, productSub, vendor, oscpu etc etc) browser object... | manage_user_agent | python | dgtlmoon/changedetection.io | changedetectionio/content_fetchers/base.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/content_fetchers/base.py | Apache-2.0 |
def _run_sync(self,
url,
timeout,
request_headers,
request_body,
request_method,
ignore_status_codes=False,
current_include_filters=None,
is_binary=False,
empty_pages_are_a_change=False):
"""Synchronous v... | Synchronous version of run - the original requests implementation | _run_sync | python | dgtlmoon/changedetection.io | changedetectionio/content_fetchers/requests.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/content_fetchers/requests.py | Apache-2.0 |
async def run(self,
url,
timeout,
request_headers,
request_body,
request_method,
ignore_status_codes=False,
current_include_filters=None,
is_binary=False,
empty_pages_are_a_change=False):
"""Async wrapper... | Async wrapper that runs the synchronous requests code in a thread pool | run | python | dgtlmoon/changedetection.io | changedetectionio/content_fetchers/requests.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/content_fetchers/requests.py | Apache-2.0 |
def get_fetch_backend(self):
"""
Like just using the `fetch_backend` key but there could be some logic
:return:
"""
# Maybe also if is_image etc?
# This is because chrome/playwright wont render the PDF in the browser and we will just fetch it and use pdf2html to see the t... |
Like just using the `fetch_backend` key but there could be some logic
:return:
| get_fetch_backend | python | dgtlmoon/changedetection.io | changedetectionio/model/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/model/Watch.py | Apache-2.0 |
def history(self):
"""History index is just a text file as a list
{watch-uuid}/history.txt
contains a list like
{epoch-time},{filename}\n
We read in this list as the history information
"""
tmp_history = {}
# In the case we are only us... | History index is just a text file as a list
{watch-uuid}/history.txt
contains a list like
{epoch-time},{filename}
We read in this list as the history information
| history | python | dgtlmoon/changedetection.io | changedetectionio/model/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/model/Watch.py | Apache-2.0 |
def get_from_version_based_on_last_viewed(self):
"""Unfortunately for now timestamp is stored as string key"""
keys = list(self.history.keys())
if not keys:
return None
if len(keys) == 1:
return keys[0]
last_viewed = int(self.get('last_viewed'))
... | Unfortunately for now timestamp is stored as string key | get_from_version_based_on_last_viewed | python | dgtlmoon/changedetection.io | changedetectionio/model/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/model/Watch.py | Apache-2.0 |
def get_error_text(self):
"""Return the text saved from a previous request that resulted in a non-200 error"""
fname = os.path.join(self.watch_data_dir, "last-error.txt")
if os.path.isfile(fname):
with open(fname, 'r') as f:
return f.read()
return False | Return the text saved from a previous request that resulted in a non-200 error | get_error_text | python | dgtlmoon/changedetection.io | changedetectionio/model/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/model/Watch.py | Apache-2.0 |
def get_error_snapshot(self):
"""Return path to the screenshot that resulted in a non-200 error"""
fname = os.path.join(self.watch_data_dir, "last-error-screenshot.png")
if os.path.isfile(fname):
return fname
return False | Return path to the screenshot that resulted in a non-200 error | get_error_snapshot | python | dgtlmoon/changedetection.io | changedetectionio/model/Watch.py | https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/model/Watch.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.