from .pandas_vb_common import *
from pandas import to_timedelta, Timestamp
import pytz
import datetime


class TimestampProperties(object):
    goal_time = 0.2

    params = [None, pytz.timezone('Europe/Amsterdam')]
    param_names = ['tz']

    def setup(self, tz):
        self.ts = Timestamp('2017-08-25 08:16:14', tzinfo=tz)

    def time_tz(self):
        self.ts.tz

    def time_offset(self):
        self.ts.offset

    def time_dayofweek(self):
        self.ts.dayofweek

    def time_weekday_name(self):
        self.ts.weekday_name

    def time_dayofyear(self):
        self.ts.dayofyear

    def time_week(self):
        self.ts.week

    def time_quarter(self):
        self.ts.quarter

    def time_days_in_month(self):
        self.ts.days_in_month

    def time_freqstr(self):
        self.ts.freqstr

    def time_is_month_start(self):
        self.ts.is_month_start

    def time_is_month_end(self):
        self.ts.is_month_end

    def time_is_quarter_start(self):
        self.ts.is_quarter_start

    def time_is_quarter_end(self):
        self.ts.is_quarter_end

    def time_is_year_start(self):
        self.ts.is_quarter_end

    def time_is_year_end(self):
        self.ts.is_quarter_end

    def time_is_leap_year(self):
        self.ts.is_quarter_end

    def time_microsecond(self):
        self.ts.microsecond


class TimestampOps(object):
    goal_time = 0.2

    params = [None, 'US/Eastern']
    param_names = ['tz']

    def setup(self, tz):
        self.ts = Timestamp('2017-08-25 08:16:14', tz=tz)

    def time_replace_tz(self):
        self.ts.replace(tzinfo=pytz.timezone('US/Eastern'))

    def time_replace_None(self):
        self.ts.replace(tzinfo=None)

    def time_to_pydatetime(self):
        self.ts.to_pydatetime()


class TimestampAcrossDst(object):
    goal_time = 0.2

    def setup(self):
        dt = datetime.datetime(2016, 3, 27, 1)
        self.tzinfo = pytz.timezone('CET').localize(dt, is_dst=False).tzinfo
        self.ts2 = Timestamp(dt)

    def time_replace_across_dst(self):
        self.ts2.replace(tzinfo=self.tzinfo)

@@ -335,32 +335,36 @@
 def time_tz(self
+, tz
 ):%0A        self.
@@ -390,24 +390,28 @@
 _offset(self
+, tz
 ):%0A        s
@@ -444,32 +444,36 @@
 e_dayofweek(self
+, tz
 ):%0A        self.
@@ -512,24 +512,28 @@
 ay_name(self
+, tz
 ):%0A        s
@@ -572,32 +572,36 @@
 e_dayofyear(self
+, tz
 ):%0A        self.
@@ -632,24 +632,28 @@
 me_week(self
+, tz
 ):%0A        s
@@ -686,24 +686,28 @@
 quarter(self
+, tz
 ):%0A        s
@@ -749,24 +749,28 @@
 n_month(self
+, tz
 ):%0A        s
@@ -812,24 +812,28 @@
 freqstr(self
+, tz
 ):%0A        s
@@ -872,32 +872,36 @@
 month_start(self
+, tz
 ):%0A        self.
@@ -941,32 +941,36 @@
 s_month_end(self
+, tz
 ):%0A        self.
@@ -1012,32 +1012,36 @@
 arter_start(self
+, tz
 ):%0A        self.
@@ -1085,32 +1085,36 @@
 quarter_end(self
+, tz
 ):%0A        self.
@@ -1159,24 +1159,28 @@
 r_start(self
+, tz
 ):%0A        s
@@ -1227,24 +1227,28 @@
 ear_end(self
+, tz
 ):%0A        s
@@ -1296,24 +1296,28 @@
 ap_year(self
+, tz
 ):%0A        s
@@ -1364,24 +1364,28 @@
 osecond(self
+, tz
 ):%0A        s
@@ -1622,24 +1622,28 @@
 lace_tz(self
+, tz
 ):%0A        s
@@ -1720,24 +1720,28 @@
 ce_None(self
+, tz
 ):%0A        s
@@ -1796,24 +1796,28 @@
 atetime(self
+, tz
 ):%0A        s

fix missing arg in asvs (#18503)