Skip to content

PatchWork GenerateDocstring #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
import subprocess

def func_calls():
"""Executes a sequence of method calls related to formats, algorithms, CLI Operations, and session redirects.

This function does not take any parameters

It calls following methods in sequence:
1. `get_format()` from formats module
2. `prepare_key()` from HMACAlgorithm class in algorithms module
3. `perform_operation()` from VerifyOperation class in cli module
4. `resolve_redirects()` from SessionRedirectMixin class in sessions module

Returns:
None: This function does not return a value.
"""
formats.get_format()
algorithms.HMACAlgorithm.prepare_key()
cli.VerifyOperation.perform_operation()
Expand Down
149 changes: 82 additions & 67 deletions sw.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,82 @@

if (location.href.includes('howdz.xyz')) {
importScripts('https://cdn.staticfile.org/workbox-sw/7.0.0/workbox-sw.js')
workbox.setConfig({
debug: false,
});
console.log('sw.js is load by CDN!')
} else {
importScripts('./workbox/workbox-sw.js')
workbox.setConfig({
debug: false,
modulePathPrefix: './workbox/'
});
console.log('sw.js is load by local!')
}

// Cache css/js/font.
workbox.routing.registerRoute(
({ request }) => request.destination === 'style' || request.destination === 'script' || request.destination === 'font',
new workbox.strategies.CacheFirst({
cacheName: 'css-js-font',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
]
})
);

// Cache image.
workbox.routing.registerRoute(
({ request }) => request.destination === 'image',
new workbox.strategies.StaleWhileRevalidate({
cacheName: 'image',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
})
]
})
)

// Cache video
workbox.routing.registerRoute(
({ request }) => request.destination === 'video',
new workbox.strategies.CacheFirst({
cacheName: 'video',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
new workbox.rangeRequests.RangeRequestsPlugin()
]
})
)

if (location.href.includes('howdz.xyz')) {
importScripts('https://cdn.staticfile.org/workbox-sw/7.0.0/workbox-sw.js')
workbox.setConfig({
debug: false,
});
console.log('sw.js is load by CDN!')
} else {
importScripts('./workbox/workbox-sw.js')
workbox.setConfig({
debug: false,
modulePathPrefix: './workbox/'
});
console.log('sw.js is load by local!')
}

// Cache css/js/font.
workbox.routing.registerRoute(
/**
* Checks if the request destination is either 'style', 'script' or 'font'.
* @param {{request: Object}} object - An object containing a request property
* @returns {Boolean} True if the request destination matches 'style', 'script', or 'font'. Otherwise, returns false.
*/
({ request }) => request.destination === 'style' || request.destination === 'script' || request.destination === 'font',
new workbox.strategies.CacheFirst({
cacheName: 'css-js-font',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
]
})
);

// Cache image.
workbox.routing.registerRoute(
/**
* A method checking the destination property of the request object.
* @param {Object} request - An object containing request properties.
* @returns {Boolean} Returns true if request destination is 'image', false otherwise.
*/
({ request }) => request.destination === 'image',
new workbox.strategies.StaleWhileRevalidate({
cacheName: 'image',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
})
]
})
)

// Cache video
workbox.routing.registerRoute(
/**
* This method checks if the request's destination is a video.
* @param {Object} request - The object that contains a destination property.
* @returns {Boolean} Returns true if the destination of the request is 'video', false otherwise.
*/
({ request }) => request.destination === 'video',
new workbox.strategies.CacheFirst({
cacheName: 'video',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
new workbox.rangeRequests.RangeRequestsPlugin()
]
})
)