Skip to content

Commit d52848c

Browse files
committed
copyright & sphinx
1 parent fd6ad91 commit d52848c

File tree

3 files changed

+83
-5
lines changed

3 files changed

+83
-5
lines changed

xarray/core/accessor_dt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ class DatetimeAccessor:
133133
134134
"""
135135

136-
def __init__(self, xarray_obj):
137-
if not _contains_datetime_like_objects(xarray_obj):
136+
def __init__(self, obj):
137+
if not _contains_datetime_like_objects(obj):
138138
raise TypeError("'dt' accessor only available for "
139139
"DataArray with datetime64 timedelta64 dtype or "
140140
"for arrays containing cftime datetime "
141141
"objects.")
142-
self._obj = xarray_obj
142+
self._obj = obj
143143

144144
def _tslib_field_accessor(name, docstring=None, dtype=None):
145145
def f(self, dtype=dtype):

xarray/core/accessor_str.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
# The StringAccessor class defined below is an adaptation of the
2+
# pandas string methods source code (see pd.core.strings)
3+
4+
# For reference, here is a copy of the pandas copyright notice:
5+
6+
# (c) 2011-2012, Lambda Foundry, Inc. and PyData Development Team
7+
# All rights reserved.
8+
9+
# Copyright (c) 2008-2011 AQR Capital Management, LLC
10+
# All rights reserved.
11+
12+
# Redistribution and use in source and binary forms, with or without
13+
# modification, are permitted provided that the following conditions are
14+
# met:
15+
16+
# * Redistributions of source code must retain the above copyright
17+
# notice, this list of conditions and the following disclaimer.
18+
19+
# * Redistributions in binary form must reproduce the above
20+
# copyright notice, this list of conditions and the following
21+
# disclaimer in the documentation and/or other materials provided
22+
# with the distribution.
23+
24+
# * Neither the name of the copyright holder nor the names of any
25+
# contributors may be used to endorse or promote products derived
26+
# from this software without specific prior written permission.
27+
28+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
29+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39+
140
import codecs
241
import re
342
import textwrap
@@ -33,8 +72,8 @@ class StringAccessor:
3372
3473
"""
3574

36-
def __init__(self, xarray_obj):
37-
self._obj = xarray_obj
75+
def __init__(self, obj):
76+
self._obj = obj
3877

3978
def _apply(self, f, dtype=None):
4079
# TODO handling of na values ?

xarray/tests/test_accessor_str.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
# Tests for the `str` accessor are derived from the original
2+
# pandas string accessor tests.
3+
4+
# For reference, here is a copy of the pandas copyright notice:
5+
6+
# (c) 2011-2012, Lambda Foundry, Inc. and PyData Development Team
7+
# All rights reserved.
8+
9+
# Copyright (c) 2008-2011 AQR Capital Management, LLC
10+
# All rights reserved.
11+
12+
# Redistribution and use in source and binary forms, with or without
13+
# modification, are permitted provided that the following conditions are
14+
# met:
15+
16+
# * Redistributions of source code must retain the above copyright
17+
# notice, this list of conditions and the following disclaimer.
18+
19+
# * Redistributions in binary form must reproduce the above
20+
# copyright notice, this list of conditions and the following
21+
# disclaimer in the documentation and/or other materials provided
22+
# with the distribution.
23+
24+
# * Neither the name of the copyright holder nor the names of any
25+
# contributors may be used to endorse or promote products derived
26+
# from this software without specific prior written permission.
27+
28+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
29+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39+
140
import re
241

342
import pytest

0 commit comments

Comments
 (0)