This file contains hidden or 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
""" | |
GitDateShifter: A Python script to shift Git commit dates from an old range to a new one, constrained within specific hours. | |
It retrieves commits from a specified old range (e.g., 2025-03-02 00:00:00 to 2025-03-02 23:59:59), redistributes them evenly across a new range (e.g., 2025-03-03 09:30:00 to 2025-03-04 17:59:00) between new_min_time (09:00:00) and new_max_time (18:00:00), and updates both author and committer dates via Git rebase. | |
Features: | |
- Evenly spreads commits within specific hours (e.g., 9 AM to 6 PM) across days. | |
- Preserves commit order. | |
- Handles partial first/last days and multi-day ranges. | |
- Includes error handling and logging with rebase abort safety. | |
- Shows updated commit logs with --pretty=fuller. |
This file contains hidden or 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
""" | |
1. Store the image and create an instance of ImagefileProcessHistory with status NOT_STARTED | |
ImageFileProcessHistory | |
- local_path | |
- file_name | |
- status # enum: NOT_STARTED, STARTED, SUCCEEDED, FAILED | |
- bytes_processed | |
- bytes_total | |
""" |
This file contains hidden or 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
@app.route("/sitemap") | |
@app.route("/sitemap/") | |
@app.route("/sitemap.xml") | |
def sitemap(): | |
""" | |
Route to dynamically generate a sitemap of your website/application. | |
lastmod and priority tags omitted on static pages. | |
lastmod included on dynamic content such as blog posts. | |
""" | |
from flask import make_response, request, render_template |
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
Convert camel-case to snake-case in python. | |
e.g.: CamelCase -> snake_case | |
Relevant StackOverflow question: http://stackoverflow.com/a/1176023/293064 | |
""" |
This file contains hidden or 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
# Copyright (C) 2018 Google Inc. | |
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> | |
"""Constants and methods for work with objects.""" | |
import sys | |
class ClassRepr(object): | |
"""Properties for class representation.""" | |
@property |
This file contains hidden or 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
class PeopleFactory(EntitiesFactory): | |
"""Factory class for Persons entities.""" | |
def __init__(self, obj_name=objects.PEOPLE): | |
super(PeopleFactory, self).__init__(obj_name, self.default_user) | |
if self.child_cls not in [AssessmentTemplatesFactory, | |
CustomAttributeDefinitionsFactory]: | |
if self.child_cls == ProgramsFactory: | |
self.manager = self.obj_creator |
This file contains hidden or 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
class CommentItem(object): | |
"""Locators for single item in comments' panel.""" | |
AUTHOR_CSS = (By.CSS_SELECTOR, ".person-holder") | |
DATETIME_CSS = (By.CSS_SELECTOR, | |
".comment-object-item__header-author-info") | |
CONTENT_CSS = (By.CSS_SELECTOR, ".comment-object-item__text") |
This file contains hidden or 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
def open_url(driver, url): | |
"""Open URL in current browser session if it hasn't been opened yet.""" | |
# driver.get(url) | |
f = 1 | |
# driver.execute_script("window.open('http://google.com', 'new_window')") | |
# if driver.current_url != url: | |
# driver.switch_to_window(driver.window_handles[0]) | |
if driver.current_url != url: | |
driver.execute_script("window.open('{}', '_self')".format(url)) | |
# driver.get(url) |
This file contains hidden or 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
BLANK = '' | |
STAR = "*" | |
WHITESPACE = " " | |
COMMA = "," # comma is used as delimiter for multi-choice values | |
LESS = "<" | |
MORE = ">" | |
DOUBLE_QUOTES = '\"' | |
SINGLE_QUOTE = "\'" | |
BACKSLASH = "\\" | |
SLASH = "/" |
This file contains hidden or 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
DB: Rich Text_d01d2475-3039__[=\'?$={.).:%($~{\'%-=)+$-`/+>>*~&;;~[[\'\n | |
Rich Text_d01d2475-3039__[=\'?$={.).:%($~{\'%-=)+$-`/+>>*~&;;~[[\'\\n\ | |
Server's RESPONSE: Rich Text_d01d2475-3039__[='?$={.).:%($ {!_$[:%';'=�_@' | |
BAD SYMBOLS: \' | |
DB: Dropdown_fe22e33f-ce93_~{:*~++#^]~:@@|//.?[$?{*.#.:\ | |
Server's RESPONSE: Dropdown_fe22e33f-ce93_ +.{@> | |
BAD SYMBOLS: \' |
NewerOlder