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
from datetime import datetime, timedelta | |
from pytz import timezone as pytz_timezone | |
def normalize_timedelta(dt: datetime, delta: timedelta) -> datetime: | |
"""Normalize timedelta operation, to preserve DST properly.""" | |
if hasattr(dt.tzinfo, "zone"): | |
timezone_ = dt.tzinfo.zone | |
return pytz_timezone(timezone_).normalize(dt + delta) |
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
FROM python:3.11.0b4-slim-bullseye | |
RUN apt-get update && apt-get -y install libpq-dev git | |
RUN apt-get -y install build-essential | |
WORKDIR /workdir | |
# create virtual environment and activate it | |
RUN python -m venv /opt/venv | |
ENV VIRTUAL_ENV="/opt/venv" \ |
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
> [compile-image 10/10] RUN poetry install --only main: | |
#0 0.832 Installing dependencies from lock file | |
#0 1.480 | |
#0 1.480 Package operations: 47 installs, 0 updates, 0 removals | |
#0 1.480 | |
... | |
... | |
#0 25.15 |
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
[[package]] | |
name = "click" | |
version = "8.1.3" | |
description = "Composable command line interface toolkit" | |
category = "dev" | |
optional = false | |
python-versions = ">=3.7" | |
[package.dependencies] | |
colorama = {version = "*", markers = "platform_system == \"Windows\""} |
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
import logging | |
import re | |
class RedactingFilter(logging.Filter): | |
def __init__(self, patterns): | |
super(RedactingFilter, self).__init__() | |
self._patterns = patterns | |
def filter(self, record): |
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
[tool.poetry] | |
name = "pandastest" | |
version = "0.1.0" | |
description = "" | |
authors = [] | |
[tool.poetry.dependencies] | |
python = "^3.10" | |
pandas = "^1.3.4" |
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
ubuntu@ubuntu:~$ sudo apt update | |
Ign:1 cdrom://Ubuntu 20.04.3 LTS _Focal Fossa_ - Release amd64 (20210819) focal InRelease | |
Hit:2 cdrom://Ubuntu 20.04.3 LTS _Focal Fossa_ - Release amd64 (20210819) focal Release | |
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease | |
Hit:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease | |
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
125 packages can be upgraded. Run 'apt list --upgradable' to see them. |
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
def _my_decorator(func): | |
def wrapper(*args, **kwargs): | |
print("wrapper got args...", args) | |
print("wrapper got kwargs...", kwargs) | |
print("Something is happening before the function is called.") | |
func(*args, **kwargs) | |
print("Something is happening after the function is called.") | |
return wrapper |
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
"""Upload file to folder. | |
Note: | |
Written for Python 3.7. | |
""" | |
import os | |
import ftplib |
NewerOlder