These are steps for attempting to reproduce this test failure.
If you don't already have a local CPython clone, go to wherever you clone repositories and execute:
git clone [email protected]:python/cpython.git
cd cpython
# A clang-format style that approximates Python's PEP 7 | |
# Useful for IDE integration | |
BasedOnStyle: Google | |
AlwaysBreakAfterReturnType: All | |
AllowShortIfStatementsOnASingleLine: false | |
AlignAfterOpenBracket: Align | |
BreakBeforeBraces: Stroustrup | |
ColumnLimit: 79 | |
DerivePointerAlignment: false | |
IndentWidth: 4 |
# Released under MPL 2.0 per https://github.com/HypothesisWorks/hypothesis/blob/master/LICENSE.txt | |
# and CC-0: https://creativecommons.org/publicdomain/zero/1.0/legalcode | |
# | |
# Feel free to contact Paul Ganssle if you'd like this released under other terms. | |
from datetime import datetime, timedelta, timezone | |
from dateutil import tz | |
ZERO = timedelta(0) |
These are steps for attempting to reproduce this test failure.
If you don't already have a local CPython clone, go to wherever you clone repositories and execute:
git clone [email protected]:python/cpython.git
cd cpython
#![feature(concat_idents,duration_as_u128)] | |
extern crate pyo3; | |
use std::thread; | |
use std::time; | |
use pyo3::prelude::*; | |
use pyo3::ffi::*; | |
use std::ffi::CString; |
#!/usr/bin/env bash | |
# Parse CLI arguments | |
REGEXES=() | |
POSITIONAL=() | |
while [[ $# -gt 0 ]]; do | |
key=$1 | |
case $key in | |
-r|--regex) | |
REGEXES+=("$2") |
import timeit | |
import operator | |
def time_func(f, N, k=3): | |
"""Basic version of IPython's %timeit magic""" | |
t = min(timeit.timeit(f, number=N) for _ in range(k)) | |
t_per = t / N | |
if t_per < 1e-6: | |
units = 'ns' |
import random | |
import string | |
from timeit import timeit | |
def _recombine_skipped_queue(tokens, skipped_idxs): | |
""" | |
>>> tokens = ["foo", " ", "bar", " ", "19June2000", "baz"] | |
>>> skipped_idxs = set([0, 1, 2, 5]) | |
>>> _recombine_skipped(tokens, skipped_idxs) |
Most of us have faced a point when trying to make things work with the Python datetime module by just trying things around. Datetime is one of those APIs that seems easy to use but requires the developer to have a deep understanding of what things actually mean, as otherwise it is really easy to introduce unexpected bugs given the actual complexity of date and time related issues.
The first concept we need to grasp when working with time is a standard that defines how we can measure units of time. The same way we have standards to measure weight or length that define kilograms or meters, we need a way to accurately define what
import pandas as pd | |
import sys | |
pdf = pd.DataFrame(dict(name= ('Earl', 'Eve', 'Alan', 'Randall', 'Danielle'), | |
age= ( 29, 17, 73, 31, 62), | |
gender= ( 'M', 'F', 'M', 'M', 'F'), | |
nationality=( 'US', 'UK', 'CAN', 'CAN', 'US'), | |
height= ( 182.9, 167.6, 175.3, 170.2, 172.8)), | |
columns=('name', 'age', 'gender', 'nationality', 'height')) | |
pdf = pdf.set_index('name') |
I hereby claim:
To claim this, I am signing this object: