function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def source(self):
"""Gets the source of this EducationSummaryV30. # noqa: E501
:return: The source of this EducationSummaryV30. # noqa: E501
:rtype: SourceV30
"""
return self._source | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def source(self, source):
"""Sets the source of this EducationSummaryV30.
:param source: The source of this EducationSummaryV30. # noqa: E501
:type: SourceV30
"""
self._source = source | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def put_code(self):
"""Gets the put_code of this EducationSummaryV30. # noqa: E501
:return: The put_code of this EducationSummaryV30. # noqa: E501
:rtype: int
"""
return self._put_code | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def put_code(self, put_code):
"""Sets the put_code of this EducationSummaryV30.
:param put_code: The put_code of this EducationSummaryV30. # noqa: E501
:type: int
"""
self._put_code = put_code | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def department_name(self):
"""Gets the department_name of this EducationSummaryV30. # noqa: E501
:return: The department_name of this EducationSummaryV30. # noqa: E501
:rtype: str
"""
return self._department_name | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def department_name(self, department_name):
"""Sets the department_name of this EducationSummaryV30.
:param department_name: The department_name of this EducationSummaryV30. # noqa: E501
:type: str
"""
self._department_name = department_name | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def role_title(self):
"""Gets the role_title of this EducationSummaryV30. # noqa: E501
:return: The role_title of this EducationSummaryV30. # noqa: E501
:rtype: str
"""
return self._role_title | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def role_title(self, role_title):
"""Sets the role_title of this EducationSummaryV30.
:param role_title: The role_title of this EducationSummaryV30. # noqa: E501
:type: str
"""
self._role_title = role_title | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def start_date(self):
"""Gets the start_date of this EducationSummaryV30. # noqa: E501
:return: The start_date of this EducationSummaryV30. # noqa: E501
:rtype: FuzzyDateV30
"""
return self._start_date | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def start_date(self, start_date):
"""Sets the start_date of this EducationSummaryV30.
:param start_date: The start_date of this EducationSummaryV30. # noqa: E501
:type: FuzzyDateV30
"""
self._start_date = start_date | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def end_date(self):
"""Gets the end_date of this EducationSummaryV30. # noqa: E501
:return: The end_date of this EducationSummaryV30. # noqa: E501
:rtype: FuzzyDateV30
"""
return self._end_date | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def end_date(self, end_date):
"""Sets the end_date of this EducationSummaryV30.
:param end_date: The end_date of this EducationSummaryV30. # noqa: E501
:type: FuzzyDateV30
"""
self._end_date = end_date | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def organization(self):
"""Gets the organization of this EducationSummaryV30. # noqa: E501
:return: The organization of this EducationSummaryV30. # noqa: E501
:rtype: OrganizationV30
"""
return self._organization | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def organization(self, organization):
"""Sets the organization of this EducationSummaryV30.
:param organization: The organization of this EducationSummaryV30. # noqa: E501
:type: OrganizationV30
"""
self._organization = organization | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def url(self):
"""Gets the url of this EducationSummaryV30. # noqa: E501
:return: The url of this EducationSummaryV30. # noqa: E501
:rtype: UrlV30
"""
return self._url | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def url(self, url):
"""Sets the url of this EducationSummaryV30.
:param url: The url of this EducationSummaryV30. # noqa: E501
:type: UrlV30
"""
self._url = url | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def external_ids(self):
"""Gets the external_ids of this EducationSummaryV30. # noqa: E501
:return: The external_ids of this EducationSummaryV30. # noqa: E501
:rtype: ExternalIDsV30
"""
return self._external_ids | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def external_ids(self, external_ids):
"""Sets the external_ids of this EducationSummaryV30.
:param external_ids: The external_ids of this EducationSummaryV30. # noqa: E501
:type: ExternalIDsV30
"""
self._external_ids = external_ids | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def display_index(self):
"""Gets the display_index of this EducationSummaryV30. # noqa: E501
:return: The display_index of this EducationSummaryV30. # noqa: E501
:rtype: str
"""
return self._display_index | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def display_index(self, display_index):
"""Sets the display_index of this EducationSummaryV30.
:param display_index: The display_index of this EducationSummaryV30. # noqa: E501
:type: str
"""
self._display_index = display_index | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def visibility(self):
"""Gets the visibility of this EducationSummaryV30. # noqa: E501
:return: The visibility of this EducationSummaryV30. # noqa: E501
:rtype: str
"""
return self._visibility | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def visibility(self, visibility):
"""Sets the visibility of this EducationSummaryV30.
:param visibility: The visibility of this EducationSummaryV30. # noqa: E501
:type: str
"""
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE"] # noqa: E501
if visibi... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def path(self):
"""Gets the path of this EducationSummaryV30. # noqa: E501
:return: The path of this EducationSummaryV30. # noqa: E501
:rtype: str
"""
return self._path | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def path(self, path):
"""Sets the path of this EducationSummaryV30.
:param path: The path of this EducationSummaryV30. # noqa: E501
:type: str
"""
self._path = path | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, EducationSummaryV30):
return False
return self.__dict__ == other.__dict__ | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | [
13,
7,
13,
28,
1486087622
] |
def _kaitai_repr(self):
_repr_list = []
for item in vars(self):
if not item.startswith('_'):
_r = getattr(self, item)
if type(_r) in (int, float, str, bytes, bool):
_repr_list.append("=".join((item, _r.__repr__())))
else:
_repr_list.app... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def _kaitai_show(self, parent_path=' '):
if type(self) in (int, float, str, bytes, bool):
print(" == ".join((parent_path, self.__repr__())))
elif type(self) == list:
for i, item in enumerate(self):
try:
item.show('{}[{}]'.format(parent_path,i))
except:
... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def __repr__(self):
_repr_list = [
"time=" + str(self.time)] if self.fracsec.fraction_of_second else []
for item in vars(self):
if not item.startswith('_'):
_r = getattr(self, item)
if type(_r) in (int, float, str, bytes):
_repr... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def __init__(self, _io, _parent=None, _root=None, _mini_cfgs=None):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self._pkt_pos = self._io.pos()
self.sync = self._root.SyncWord(self._io, self, self._root)
self.framesize = self._io.read_u2be()... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def __init__(self, _io, _parent=None, _root=None):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self.magic = self._io.ensure_fixed_contents(struct.pack('1b', -86))
self.reserved = self._io.read_bits_int(1) != 0
self.f... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def __repr__(self):
_repr_list = ["fraction_of_second=" +
str(self.fraction_of_second)] if self.fraction_of_second else []
for item in vars(self):
if not item.startswith('_'):
_r = getattr(self, item)
if type(_r) i... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def __init__(self, _io, _parent=None, _root=None, _time_base=None):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self._time_base = _time_base
self.reserved = self._io.read_bits_int(1) != 0
self.leap_second_direction =... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def fraction_of_second(self):
if hasattr(self, '_m_fraction_of_second'):
return self._m_fraction_of_second if hasattr(self, '_m_fraction_of_second') else None
if self._time_base:
self._m_fraction_of_second = self.raw_fraction_of_second / self._time_base
... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def time(self):
if hasattr(self, '_m_time'):
return self._m_time if hasattr(self, '_m_time') else None
self._m_time = self.soc + self.fracsec.fraction_of_second
return self._m_time if hasattr(self, '_m_time') else None | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def chk_body(self):
if hasattr(self, '_m_chk_body'):
return self._m_chk_body if hasattr(self, '_m_chk_body') else None
_pos = self._io.pos()
self._io.seek(0)
self._m_chk_body = self._io.read_bytes((self.framesize - 2))
self._io.seek(_pos)
return self._m_chk_b... | sonusz/PhasorToolBox | [
19,
7,
19,
4,
1492726633
] |
def test_server_meta_data_headers_full(self):
"""Tests that the MetaDataProvider can construct meta_data_headers when supplied with a full shopping cart"""
shopping_cart_extension = ShoppingCartExtension("Ingenico.creator", "Extension", "1.0", "ExtensionId")
meta_data_provider = MetaDataProvider... | Ingenico-ePayments/connect-sdk-python3 | [
8,
7,
8,
2,
1474883685
] |
def test_get_server_metadata_headers_no_additional_headers(self):
"""Tests that the MetaDataProvider functions correctly without any additional headers as arguments"""
meta_data_provider = MetaDataProvider("Ingenico")
request_headers = meta_data_provider.meta_data_headers
self.assertEqu... | Ingenico-ePayments/connect-sdk-python3 | [
8,
7,
8,
2,
1474883685
] |
def test_constructor_with_prohibited_headers(self):
"""Tests that the MetaDataProvider constructor does not accept any headers marked as prohibited"""
for name in MetaDataProvider.prohibited_headers:
additional_headers = [RequestHeader("Header1", "Value1"),
... | Ingenico-ePayments/connect-sdk-python3 | [
8,
7,
8,
2,
1474883685
] |
def __init__(self, filename, dic_variables, experiment, name='', shift_lon=False, **kwargs):
super(JSBACH_BOT, self).__init__(filename, dic_variables, name=name, **kwargs)
self.experiment = experiment
self.shift_lon = shift_lon
self.type = 'JSBACH_BOT'
self._unique_name = self.... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_albedo_data(self, interval='season'):
"""
get albedo data for JSBACH
returns Data object
"""
if interval != 'season':
raise ValueError('Other temporal sampling than SEASON not supported yet for JSBACH BOT files, sorry')
v = 'var176'
filenam... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_grass_fraction(self, interval='season'):
"""
todo implement this for data from a real run !!!
"""
if interval != 'season':
raise ValueError('Other temporal sampling than SEASON not supported yet for JSBACH BOT files, sorry')
ls_mask = get_T63_landseamask(sel... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_rainfall_data(self, interval='season'):
"""
get rainfall data for JSBACH
returns Data object
"""
if interval == 'season':
pass
else:
raise ValueError('Invalid value for interval: %s' % interval)
#/// PREPROCESSING: seasonal means ... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def __init__(self, filename, dic_variables, experiment, name='', shift_lon=False, input_format='grb', raw_outdata='outdata/jsbach/', **kwargs):
"""
The assignment of certain variables to different input streams is done in the routine
get_jsbach_data_generic()
Parameters
------... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def _get_filenames_veg_stream(self):
return self.data_dir + self.raw_outdata + self.experiment + '_jsbach_veg_mm_*.' + self.input_format | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def _get_filenames_surf_stream(self):
return self.data_dir + self.raw_outdata + self.experiment + '_jsbach_surf_mm_*.' + self.input_format | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def _get_filenames_albedo_NIR(self):
return self.data_dir + self.raw_outdata + self.experiment + '_jsbach_mm_*_NIR_albedo.' + self.input_format | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def _preproc_streams(self):
"""
It is assumed that the standard JSBACH postprocessing scripts have been applied.
Thus monthly mean data is available for each stream and code tables still need to be applied.
This routine does the following:
1) merge all times from individual (mon... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_albedo_data(self, interval='season'):
"""
calculate albedo as ratio of upward and downwelling fluxes
first the monthly mean fluxes are used to calculate the albedo,
This routine uses the definitions of the routines how to
read upward and downward fluxes
"""
... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_albedo_data_nir(self, interval='season', **kwargs):
"""
This routine retrieves the JSBACH albedo information for VIS
it requires a preprocessing with a script that aggregates from tile
to box values!
Parameters
----------
interval : str
['seas... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_surface_shortwave_radiation_down(self, interval='season', **kwargs):
return self.get_jsbach_data_generic(interval=interval, **kwargs) | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_temperature_2m(self, interval='season', **kwargs):
return self.get_jsbach_data_generic(interval=interval, **kwargs) | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def __init__(self, filename, dic_variables, experiment, name='', shift_lon=False, model_dict=None, input_format='nc', raw_outdata='', **kwargs):
super(JSBACH_SPECIAL, self).__init__(filename, dic_variables, experiment, name=name, shift_lon=shift_lon, model_dict=model_dict, input_format=input_format, raw_outdata... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def __init__(self, filename, dic_variables, experiment, name='', shift_lon=False, intervals='monthly', **kwargs):
super(JSBACH_RAW, self).__init__(filename, dic_variables, name=name, intervals=intervals, **kwargs)
print('WARNING: This model class should be depreciated as it contained a lot of hardcoded... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_temperature_2m(self, interval='monthly', **kwargs):
"""
get surface temperature (2m) from JSBACH model results
Parameters
----------
interval : str
specifies the aggregation interval. Possible options: ['season','monthly']
"""
locdict = kwarg... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def _do_preprocessing(self, rawfile, varname, s_start_time, s_stop_time, interval='monthly', force_calc=False, valid_mask='global', target_grid='t63grid'):
"""
perform preprocessing
* selection of variable
* temporal subsetting
"""
cdo = Cdo()
if not os.path.exis... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_surface_shortwave_radiation_up(self, interval='monthly', **kwargs):
"""
get surface shortwave upward radiation data for JSBACH
Parameters
----------
interval : str
specifies the aggregation interval. Possible options: ['season','monthly']
"""
... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_model_data_generic(self, interval='monthly', **kwargs):
"""
This is only a wrapper to redirect to individual functions
for the JSBACH_RAW class
Currently only the usage for rainfall is supported!
"""
# HACK: only a wrapper, should be depreciated
raise Val... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def get_gpp_data(self, interval='season'):
"""
get surface GPP data for JSBACH
todo temporal aggregation of data --> or leave it to the user!
"""
cdo = Cdo()
v = 'var167'
y1 = str(self.start_time)[0:10]
y2 = str(self.stop_time)[0:10]
rawfilename =... | pygeo/pycmbs | [
15,
10,
15,
9,
1391865830
] |
def __init__(self, base_site, auth, listing_type, listing_uuid):
super(RemoteListingImages, self).__init__(auth)
self._base_site = base_site
self._auth = auth
self._listing_type = listing_type
self._listing_uuid = listing_uuid
self._endpoint = base_site + "/api/listings/%... | propdata/rewp-api | [
5,
1,
5,
3,
1300814012
] |
def get(self, uuid):
"""
Returns a single ListingImage instance, matching uuid.
Raises a DoesNotExist exception if the object does not exist.
"""
b = ListingResidential()
b.branch_name = "Foo"
return b | propdata/rewp-api | [
5,
1,
5,
3,
1300814012
] |
def set_fields(self, images):
self.images = images | propdata/rewp-api | [
5,
1,
5,
3,
1300814012
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('CalculateExchangeOperationResultResponse', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def reset(cls):
cls.info = [
[
"Keyboard Control:",
" auto repeat: on key click percent: 0 LED mask: 00000002",
" XKB indicators:",
" 00: Caps Lock: off 01: Num Lock: on 02: Scroll Lock: off",
"... | qtile/qtile | [
3906,
650,
3906,
237,
1220055400
] |
def call_process(cls, cmd):
if cls.is_error:
raise subprocess.CalledProcessError(-1, cmd=cmd, output="Couldn't call xset.")
if cmd[1:] == ["q"]:
track = cls.info[cls.index]
output = "\n".join(track)
return output | qtile/qtile | [
3906,
650,
3906,
237,
1220055400
] |
def patched_cnli(monkeypatch):
MockCapsNumLockIndicator.reset()
monkeypatch.setattr(
"libqtile.widget.caps_num_lock_indicator.subprocess", MockCapsNumLockIndicator
)
monkeypatch.setattr(
"libqtile.widget.caps_num_lock_indicator.subprocess.CalledProcessError",
subprocess.CalledPro... | qtile/qtile | [
3906,
650,
3906,
237,
1220055400
] |
def test_cnli_caps_on(fake_qtile, patched_cnli, fake_window):
widget = patched_cnli.CapsNumLockIndicator()
# Simulate Caps on
MockCapsNumLockIndicator.index = 1
fakebar = FakeBar([widget], window=fake_window)
widget._configure(fake_qtile, fakebar)
text = widget.poll()
assert text == "Caps... | qtile/qtile | [
3906,
650,
3906,
237,
1220055400
] |
def callback(response):
assert response is not None
assert response.model_version
assert response.raw_response is not None
assert response.statistics.document_count == 5
assert response.statistics.transaction_count == 4
assert response.statistics.v... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
language_str = "\"language\": \"fr\""
language = resp.http_request.body.count(language_str)
assert language == 3 | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
language_str = "\"language\": \"\""
language = resp.http_request.body.count(language_str)
assert language == 3 | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
language_str = "\"language\": \"\""
language = resp.http_request.body.count(language_str)
assert language == 2
language_str = "\"language\": \"en\""
language = resp.http_request.body.count(language_str)
assert language == 1 | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
language_str = "\"language\": \"de\""
language = resp.http_request.body.count(language_str)
assert language == 3 | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
language_str = "\"language\": \"es\""
language = resp.http_request.body.count(language_str)
assert language == 2
language_str = "\"language\": \"en\""
language = resp.http_request.body.count(language_str)
assert language == 1 | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
language_str = "\"language\": \"es\""
language = resp.http_request.body.count(language_str)
assert language == 2
language_str = "\"language\": \"en\""
language = resp.http_request.body.count(language_str)
assert language == 1 | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
language_str = "\"language\": \"es\""
language = resp.http_request.body.count(language_str)
assert language == 3 | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
assert "azsdk-python-ai-textanalytics/{} Python/{} ({})".format(
VERSION, platform.python_version(), platform.platform()) in \
resp.http_request.headers["User-Agent"] | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(response):
language_str = "\"language\": \"es\""
assert response.http_request.body.count(language_str) == 1
assert response.model_version is not None
assert response.statistics is not None | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(pipeline_response, deserialized, _):
return "cls result" | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(response):
assert response.http_request.query["stringIndexType"] == "UnicodeCodePoint" | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(response):
assert response.http_request.query["stringIndexType"] == "TextElements_v8" | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def callback(resp):
assert resp.http_request.query['loggingOptOut'] | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def getattributes(nc, exclude=[]):
# in order not to rely on implementation, provide fallback
try:
a = dict(nc._attributes)
except AttributeError:
a = dict((k, getattr(nc, k)) for k in dir(nc) if k[0] != '_' and k not in exclude)
return a | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def __init__(self, fpatt, layout=None, multitime=False):
fnames = glob.glob(fpatt) | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def __getattr__(self, k):
try:
return self._attributes[k]
except KeyError:
raise AttributeError("'MNC' object has no attribute '" + k + "'") | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def close(self):
"""Close tile files"""
for nc in self.nc:
nc.close() | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def faces(self):
if self.layout == 'faces':
return self._fns
else:
return None | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def __init__(self, mnc, name):
self._name = name
self.nc = mnc.nc
self.layout = mnc.layout
self._i0 = mnc._i0
self._ie = mnc._ie
self._j0 = mnc._j0
self._je = mnc._je
self._nf = mnc._nf
self._fn = mnc._fn
v0 = mnc.nc[0].variables[name]
... | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def __dir__(self):
return self.__dict__.keys() + self._attributes.keys() | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def _getfaces(self, ind):
res = []
for f in range(self._nf):
shape = tuple(np.isscalar(d) and d or d[f] for d in self.shape)
a = np.zeros(shape, self.typecode())
res.append(a)
s = [slice(None) for d in self.shape]
for i,nc in enumerate(self.nc):
... | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def mnc_files(fpatt, layout=None):
return MNC(fpatt, layout) | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def rdmnc(fpatt, varnames=None, iters=None, slices=Ellipsis, layout=None):
''' Read one or more variables from an mnc file set. | altMITgcm/MITgcm66h | [
3,
9,
3,
7,
1496868193
] |
def define_tables(cls, metadata):
Table(
"table1",
metadata,
Column(
"id", Integer, primary_key=True, test_needs_autoincrement=True
),
Column("data", String(30)),
)
Table(
"table2",
metadata,
... | sqlalchemy/sqlalchemy | [
6899,
1088,
6899,
170,
1543289703
] |
def test_config_errors(self):
Session = scoped_session(sa.orm.sessionmaker())
s = Session() # noqa
assert_raises_message(
sa.exc.InvalidRequestError,
"Scoped session is already present",
Session,
bind=testing.db,
)
assert_warns_m... | sqlalchemy/sqlalchemy | [
6899,
1088,
6899,
170,
1543289703
] |
def test_methods_etc(self):
mock_session = Mock()
mock_session.bind = "the bind"
sess = scoped_session(lambda: mock_session)
sess.add("add")
sess.delete("delete")
sess.get("Cls", 5)
eq_(sess.bind, "the bind")
eq_(
mock_session.mock_calls,
... | sqlalchemy/sqlalchemy | [
6899,
1088,
6899,
170,
1543289703
] |
def test_get_bind_custom_session_subclass(self, style):
"""test #6285"""
class MySession(Session):
if style == "style1":
def get_bind(self, mapper=None, **kwargs):
return super().get_bind(mapper=mapper, **kwargs)
elif style == "style2":
... | sqlalchemy/sqlalchemy | [
6899,
1088,
6899,
170,
1543289703
] |
def test_parse_timespan_invalid_values(self):
self.assertRaises(ValueError, parse_timespan, None)
self.assertRaises(ValueError, parse_timespan, "")
self.assertRaises(ValueError, parse_timespan, "q") | heyman/locust | [
19,
6,
19,
1,
1294745352
] |
def test_parse_timespan(self):
self.assertEqual(7, parse_timespan("7"))
self.assertEqual(7, parse_timespan("7s"))
self.assertEqual(60, parse_timespan("1m"))
self.assertEqual(7200, parse_timespan("2h"))
self.assertEqual(3787, parse_timespan("1h3m7s")) | heyman/locust | [
19,
6,
19,
1,
1294745352
] |
def test_rounding_down(self):
self.assertEqual(1, proper_round(1.499999999))
self.assertEqual(5, proper_round(5.499999999))
self.assertEqual(2, proper_round(2.05))
self.assertEqual(3, proper_round(3.05)) | heyman/locust | [
19,
6,
19,
1,
1294745352
] |
def __init__(self, data: T) -> None:
self.data = data
self.parent = self
self.rank = 0 | TheAlgorithms/Python | [
154959,
39275,
154959,
147,
1468662241
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.