buggy
stringlengths
35
5.03k
fixed
stringlengths
46
62.5k
def _align_method_FRAME( def _should_reindex_frame_op( left: "DataFrame", right, axis, default_axis: int, fill_value, level ) -> bool: """ Check if this is an operation between DataFrames that will need to reindex. """ assert isinstance(left, ABCDataFrame) if not isinstance(right, ABCDataFram...
def _align_method_FRAME( def _should_reindex_frame_op( left: "DataFrame", right, op, axis, default_axis: int, fill_value, level ) -> bool: """ Check if this is an operation between DataFrames that will need to reindex. """ assert isinstance(left, ABCDataFrame) if op is operator.pow or op is r...
def _arith_method_FRAME(cls, op, special): @Appender(doc) def f(self, other, axis=default_axis, level=None, fill_value=None): if _should_reindex_frame_op(self, other, axis, default_axis, fill_value, level): return _frame_arith_method_with_reindex(self, other, op) self, other = _ali...
def _arith_method_FRAME(cls, op, special): @Appender(doc) def f(self, other, axis=default_axis, level=None, fill_value=None): if _should_reindex_frame_op( self, other, op, axis, default_axis, fill_value, level ): return _frame_arith_method_with_reindex(self, other, op) ...
class TestFrameArithmeticUnsorted: half = ts[::2] result = ts + half.take(np.random.permutation(len(half))) tm.assert_frame_equal(result, expected)
class TestFrameArithmeticUnsorted: half = ts[::2] result = ts + half.take(np.random.permutation(len(half))) tm.assert_frame_equal(result, expected) def test_pow_with_realignment(): # GH#32685 pow has special semantics for operating with null values left = pd.DataFrame({"A": [0, 1, 2]})...
class IntegerArray(BaseMaskedArray): ExtensionArray.argsort """ data = self._data.copy() data[self._mask] = data.min() - 1 return data @classmethod
class IntegerArray(BaseMaskedArray): ExtensionArray.argsort """ data = self._data.copy() if self._mask.any(): data[self._mask] = data.min() - 1 return data @classmethod
def test_value_counts_na(): tm.assert_series_equal(result, expected) # TODO(jreback) - these need testing / are broken # shift
def test_value_counts_na(): tm.assert_series_equal(result, expected) def test_value_counts_empty(): # https://github.com/pandas-dev/pandas/issues/33317 s = pd.Series([], dtype="Int64") result = s.value_counts() # TODO: The dtype of the index seems wrong (it's int64 for non-empty) idx = pd.Inde...
class TimedeltaIndex( @Appender(_shared_docs["searchsorted"]) def searchsorted(self, value, side="left", sorter=None): if isinstance(value, (np.ndarray, Index)): value = np.array(value, dtype=_TD_DTYPE, copy=False) else: value = Timedelta(value).asm8.view(_TD_DTYPE) ...
class TimedeltaIndex( @Appender(_shared_docs["searchsorted"]) def searchsorted(self, value, side="left", sorter=None): if isinstance(value, (np.ndarray, Index)): if not type(self._data)._is_recognized_dtype(value): raise TypeError( "searchsorted requires c...
class TestTimedeltaArray: arr[0] = obj assert arr[0] == pd.Timedelta(seconds=1) class TestReductions: @pytest.mark.parametrize("name", ["sum", "std", "min", "max", "median"])
class TestTimedeltaArray: arr[0] = obj assert arr[0] == pd.Timedelta(seconds=1) @pytest.mark.parametrize( "other", [ 1, np.int64(1), 1.0, np.datetime64("NaT"), pd.Timestamp.now(), "invalid", np.arang...
def add_special_arithmetic_methods(cls): def f(self, other): result = method(self, other) # this makes sure that we are aligned like the input # we are updating inplace so we want to ignore is_copy self._update_inplace(
def add_special_arithmetic_methods(cls): def f(self, other): result = method(self, other) # Delete cacher self._reset_cacher() # this makes sure that we are aligned like the input # we are updating inplace so we want to ignore is_copy self...
class TestDataFrameSelectReindex: result = df2.reindex(midx) expected = pd.DataFrame({"a": [0, 1, 2, 3, 4, 5, 6, np.nan, 8]}, index=midx) tm.assert_frame_equal(result, expected)
class TestDataFrameSelectReindex: result = df2.reindex(midx) expected = pd.DataFrame({"a": [0, 1, 2, 3, 4, 5, 6, np.nan, 8]}, index=midx) tm.assert_frame_equal(result, expected) @pytest.mark.parametrize( "operation", ["__iadd__", "__isub__", "__imul__", "__ipow__"] ) @pytest...
class TestCustomDateRange: result = pd.date_range(start=start, end=end, periods=2, closed="left") expected = DatetimeIndex([start]) tm.assert_index_equal(result, expected)
class TestCustomDateRange: result = pd.date_range(start=start, end=end, periods=2, closed="left") expected = DatetimeIndex([start]) tm.assert_index_equal(result, expected) def test_date_range_with_custom_holidays(): # GH 30593 freq = pd.offsets.CustomBusinessHour(start="15:00", holiday...
class BusinessHourMixin(BusinessMixin): # adjust by business days first if bd != 0: skip_bd = BusinessDay(n=bd) # midnight business hour may not on BusinessDay if not self.next_bday.is_on_offset(other): prev_open = self._prev_o...
class BusinessHourMixin(BusinessMixin): # adjust by business days first if bd != 0: if isinstance(self, _CustomMixin): # GH 30593 skip_bd = CustomBusinessDay( n=bd, weekmask=self.weekmask, ...
class StringMethods(NoNewAttributesMixin): _doc_args["istitle"] = dict(type="titlecase", method="istitle") _doc_args["isnumeric"] = dict(type="numeric", method="isnumeric") _doc_args["isdecimal"] = dict(type="decimal", method="isdecimal") isalnum = _noarg_wrapper( lambda x: x.isalnum(), ...
class StringMethods(NoNewAttributesMixin): _doc_args["istitle"] = dict(type="titlecase", method="istitle") _doc_args["isnumeric"] = dict(type="numeric", method="isnumeric") _doc_args["isdecimal"] = dict(type="decimal", method="isdecimal") # force _noarg_wrapper return type with dtype=bool (GH 29624) ...
class TestStringMethods: tm.assert_series_equal(empty_str, empty.str.get(0)) tm.assert_series_equal(empty_str, empty_bytes.str.decode("ascii")) tm.assert_series_equal(empty_bytes, empty.str.encode("ascii")) tm.assert_series_equal(empty_str, empty.str.isalnum()) tm.assert_series_e...
class TestStringMethods: tm.assert_series_equal(empty_str, empty.str.get(0)) tm.assert_series_equal(empty_str, empty_bytes.str.decode("ascii")) tm.assert_series_equal(empty_bytes, empty.str.encode("ascii")) # ismethods should always return boolean (GH 29624) tm.assert_series_equa...
class DatetimeLikeArrayMixin(ExtensionOpsMixin, AttributesMixin, ExtensionArray) def __add__(self, other): other = lib.item_from_zerodim(other) if isinstance(other, (ABCSeries, ABCDataFrame)): return NotImplemented # scalar others
class DatetimeLikeArrayMixin(ExtensionOpsMixin, AttributesMixin, ExtensionArray) def __add__(self, other): other = lib.item_from_zerodim(other) if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): return NotImplemented # scalar others
class DatetimeLikeArrayMixin(ExtensionOpsMixin, AttributesMixin, ExtensionArray) def __sub__(self, other): other = lib.item_from_zerodim(other) if isinstance(other, (ABCSeries, ABCDataFrame)): return NotImplemented # scalar others
class DatetimeLikeArrayMixin(ExtensionOpsMixin, AttributesMixin, ExtensionArray) def __sub__(self, other): other = lib.item_from_zerodim(other) if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): return NotImplemented # scalar others
class DatetimeLikeArrayMixin(ExtensionOpsMixin, AttributesMixin, ExtensionArray) return result def __rsub__(self, other): if is_datetime64_dtype(other) and is_timedelta64_dtype(self): # ndarray[datetime64] cannot be subtracted from self, so # we need to wrap in DatetimeArray...
class DatetimeLikeArrayMixin(ExtensionOpsMixin, AttributesMixin, ExtensionArray) return result def __rsub__(self, other): if is_datetime64_any_dtype(other) and is_timedelta64_dtype(self): # ndarray[datetime64] cannot be subtracted from self, so # we need to wrap in DatetimeA...
class TestDatetimeIndexArithmetic: # ------------------------------------------------------------- def test_sub_dti_dti(self): # previously performed setop (deprecated in 0.16.0), now changed to # return subtraction -> TimeDeltaIndex (GH ...)
class TestDatetimeIndexArithmetic: # ------------------------------------------------------------- def test_dta_add_sub_index(self, tz_naive_fixture): # Check that DatetimeArray defers to Index classes dti = date_range("20130101", periods=3, tz=tz_naive_fixture) dta = dti.array ...
def test_shift_months(years, months): tm.assert_index_equal(actual, expected) class SubDatetime(datetime): pass
def test_shift_months(years, months): tm.assert_index_equal(actual, expected) # FIXME: this belongs in scalar tests class SubDatetime(datetime): pass
class TestPeriodIndexArithmetic: with pytest.raises(TypeError): other - obj class TestPeriodSeriesArithmetic: def test_ops_series_timedelta(self):
class TestPeriodIndexArithmetic: with pytest.raises(TypeError): other - obj # --------------------------------------------------------------- # Unsorted def test_parr_add_sub_index(self): # Check that PeriodArray defers to Index on arithmetic ops pi = pd.period_range("2...
class TestTimedelta64ArithmeticUnsorted: tm.assert_index_equal(result1, result4) tm.assert_index_equal(result2, result3) class TestAddSubNaTMasking: # TODO: parametrize over boxes
class TestTimedelta64ArithmeticUnsorted: tm.assert_index_equal(result1, result4) tm.assert_index_equal(result2, result3) def test_tda_add_sub_index(self): # Check that TimedeltaArray defers to Index on arithmetic ops tdi = TimedeltaIndex(["1 days", pd.NaT, "2 days"]) tda = t...
INTERNAL_RESULT_KEYS = ('add_host', 'add_group') LOCALHOST = ('127.0.0.1', 'localhost', '::1') MODULE_REQUIRE_ARGS = ('command', 'win_command', 'shell', 'win_shell', 'raw', 'script') MODULE_NO_JSON = ('command', 'win_command', 'shell', 'win_shell', 'raw') RESTRICTED_RESULT_KEYS = ('ansible_rsync_path', 'ansible_playboo...
INTERNAL_RESULT_KEYS = ('add_host', 'add_group') LOCALHOST = ('127.0.0.1', 'localhost', '::1') MODULE_REQUIRE_ARGS = ('command', 'win_command', 'shell', 'win_shell', 'raw', 'script') MODULE_NO_JSON = ('command', 'win_command', 'shell', 'win_shell', 'raw') RESTRICTED_RESULT_KEYS = ('ansible_rsync_path', 'ansible_playboo...
from ansible.module_utils.common._collections_compat import MutableMapping, Muta from ansible.plugins.loader import connection_loader from ansible.utils.display import Display display = Display()
from ansible.module_utils.common._collections_compat import MutableMapping, Muta from ansible.plugins.loader import connection_loader from ansible.utils.display import Display display = Display()
def namespace_facts(facts): ''' return all facts inside 'ansible_facts' w/o an ansible_ prefix ''' deprefixed = {} for k in facts: if k in ('ansible_local',): # exceptions to 'deprefixing' deprefixed[k] = module_response_deepcopy(facts[k]) else: deprefixed...
def namespace_facts(facts): ''' return all facts inside 'ansible_facts' w/o an ansible_ prefix ''' deprefixed = {} for k in facts: if k.startswith('ansible_') and k not in ('ansible_local',): deprefixed[k[8:]] = module_response_deepcopy(facts[k]) else: deprefixed[k] =...
def main(): 'test/integration/targets/win_module_utils/library/legacy_only_old_way_win_line_ending.ps1', 'test/utils/shippable/timing.py', 'test/integration/targets/old_style_modules_posix/library/helloworld.sh', # Python 3-only. Only run by release engineers 'hacking/release-an...
def main(): 'test/integration/targets/win_module_utils/library/legacy_only_old_way_win_line_ending.ps1', 'test/utils/shippable/timing.py', 'test/integration/targets/old_style_modules_posix/library/helloworld.sh', 'test/integration/targets/gathering_facts/library/bogus_facts', # P...
from pandas.core.dtypes.common import ( is_dtype_equal, is_extension_array_dtype, is_float_dtype, is_int64_dtype, is_integer, is_integer_dtype, is_list_like,
from pandas.core.dtypes.common import ( is_dtype_equal, is_extension_array_dtype, is_float_dtype, is_integer, is_integer_dtype, is_list_like,
class _AsOfMerge(_OrderedMerge): if self.tolerance < Timedelta(0): raise MergeError("tolerance must be positive") elif is_int64_dtype(lt): if not is_integer(self.tolerance): raise MergeError(msg) if self.tolerance < 0:
class _AsOfMerge(_OrderedMerge): if self.tolerance < Timedelta(0): raise MergeError("tolerance must be positive") elif is_integer_dtype(lt): if not is_integer(self.tolerance): raise MergeError(msg) if self.tolerance < 0...
class TestAsOfMerge: ) assert_frame_equal(result, expected)
class TestAsOfMerge: ) assert_frame_equal(result, expected) def test_int_type_tolerance(self, any_int_dtype): # GH #28870 left = pd.DataFrame({"a": [0, 10, 20], "left_val": [1, 2, 3]}) right = pd.DataFrame({"a": [5, 15, 25], "right_val": [1, 2, 3]}) left["a"] = lef...
Make api awesomeness ''' from __future__ import absolute_import, print_function, unicode_literals # Import Python libs import inspect import os # Import Salt libs import salt.log # pylint: disable=W0611 import salt.client import salt.config import salt.runner import salt.syspaths import salt.wheel import salt.utils.a...
Make api awesomeness ''' from __future__ import absolute_import, print_function, unicode_literals import copy # Import Python libs import inspect import logging import os # Import Salt libs import salt.log # pylint: disable=W0611 import salt.auth import salt.client import salt.config import salt.daemons.masterapi i...
class NetapiClient(object): def __init__(self, opts): self.opts = opts def _is_master_running(self): '''
class NetapiClient(object): def __init__(self, opts): self.opts = opts self.loadauth = salt.auth.LoadAuth(opts) self.key = salt.daemons.masterapi.access_keys(self.opts) minopts = copy.deepcopy(self.opts) minopts["enable_ssh_minions"] = True self.ckminions = salt.util...
class NetapiClient(object): self.opts['sock_dir'], ipc_file)) def run(self, low): ''' Execute the specified function in the specified client by passing the
class NetapiClient(object): self.opts['sock_dir'], ipc_file)) def _prep_auth_info(self, clear_load): sensitive_load_keys = [] key = None if "token" in clear_load: auth_type = "token" err_name = "TokenAuthenticationError" sensitive_...
class NetapiClient(object): raise salt.exceptions.EauthAuthenticationError( 'Raw shell option not allowed.') l_fun = getattr(self, low['client']) f_call = salt.utils.args.format_call(l_fun, low) return l_fun(*f_call.get('args', ()), **f_call.get('kwargs', {}))
class NetapiClient(object): raise salt.exceptions.EauthAuthenticationError( 'Raw shell option not allowed.') if low['client'] == 'ssh': self._authorize_ssh(low) l_fun = getattr(self, low['client']) f_call = salt.utils.args.format_call(l_fun, low) ...
# encoding: utf-8 # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import time # Import Salt Testing libs from tests.support.paths import TMP_CONF_DIR, TMP from tests.support.runtests import RUNTIME_VARS from tests.support.unit import TestCase, ski...
# encoding: utf-8 # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging import os import time import salt.config import salt.netapi import salt.utils.files import salt.utils.platform import salt.utils.pycrypto # Import Salt Testing libs from tests.sup...
class NetapiSSHClientTest(SSHCase): ''' opts = salt.config.client_config(os.path.join(TMP_CONF_DIR, 'master')) self.netapi = salt.netapi.NetapiClient(opts) self.priv_file = os.path.join(RUNTIME_VARS.TMP_CONF_DIR, 'key_test') self.rosters = os.path.join(RUNTIME_VARS.TMP_CONF_DIR)
class NetapiSSHClientTest(SSHCase): ''' opts = salt.config.client_config(os.path.join(TMP_CONF_DIR, 'master')) self.netapi = salt.netapi.NetapiClient(opts) opts = salt.config.client_config(os.path.join(TMP_CONF_DIR, "master")) naopts = copy.deepcopy(opts) naopts["ignore_h...
class NetapiSSHClientTest(SSHCase): "roster": "cache", "client": "ssh", "tgt": "www.zerodayinitiative.com", "fun": "xx", "eauth": "xx", "ssh_priv": "aaa|id>{} #".format(path), } ret = self.netapi.run(low) self.assertFalse(os...
class NetapiSSHClientTest(SSHCase): "roster": "cache", "client": "ssh", "tgt": "www.zerodayinitiative.com", "ssh_priv": "aaa|id>{} #".format(path), "fun": "test.ping", "eauth": "auto", "username": "saltdev_auto", "password":...
class NetapiSSHClientTest(SSHCase): "roster": "cache", "client": "ssh", "tgt": "root|id>{} #@127.0.0.1".format(path), "fun": "xx", "eauth": "xx", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", } ...
class NetapiSSHClientTest(SSHCase): "roster": "cache", "client": "ssh", "tgt": "root|id>{} #@127.0.0.1".format(path), "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "fun": "test.ping", "eauth": "auto", ...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "xx", "eauth": "xx", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "ssh_options": ["|id>{} #".f...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "test.ping", "eauth": "auto", "username": "saltdev_auto", "password": "saltdev", "roster_file": "/tmp/salt-tests-tmpdir/c...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "xx", "eauth": "xx", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "ssh_port": "hhhhh|id>{} #"....
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "test.ping", "eauth": "auto", "username": "saltdev_auto", "password": "saltdev", "roster_file": "/tmp/salt-tests-tmpdir/c...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "xx", "eauth": "xx", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "ssh_remote_port_forwards": ...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "test.ping", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "ssh_remote_port_forwards": "hhhhh|id>{} #, lol"...
from synapse.http.server import finish_request, respond_with_json from synapse.http.site import SynapseRequest from synapse.logging.context import make_deferred_yieldable from synapse.util.stringutils import is_ascii logger = logging.getLogger(__name__)
from synapse.http.server import finish_request, respond_with_json from synapse.http.site import SynapseRequest from synapse.logging.context import make_deferred_yieldable from synapse.util.stringutils import is_ascii, parse_and_validate_server_name logger = logging.getLogger(__name__)
def parse_media_id(request: Request) -> Tuple[str, str, Optional[str]]: try: # The type on postpath seems incorrect in Twisted 21.2.0. postpath: List[bytes] = request.postpath # type: ignore
def parse_media_id(request: Request) -> Tuple[str, str, Optional[str]]: """Parses the server name, media ID and optional file name from the request URI Also performs some rough validation on the server name. Args: request: The `Request`. Returns: A tuple containing the parsed server...
def parse_media_id(request: Request) -> Tuple[str, str, Optional[str]]: server_name = server_name_bytes.decode("utf-8") media_id = media_id_bytes.decode("utf8") file_name = None if len(postpath) > 2: try:
def parse_media_id(request: Request) -> Tuple[str, str, Optional[str]]: server_name = server_name_bytes.decode("utf-8") media_id = media_id_bytes.decode("utf8") # Validate the server name, raising if invalid parse_and_validate_server_name(server_name) file_name = None i...
import functools import os import re from typing import Any, Callable, List, TypeVar, cast NEW_FORMAT_ID_RE = re.compile(r"^\d\d\d\d-\d\d-\d\d")
import functools import os import re import string from typing import Any, Callable, List, TypeVar, Union, cast NEW_FORMAT_ID_RE = re.compile(r"^\d\d\d\d-\d\d-\d\d")
def _wrapped(self: "MediaFilePaths", *args: Any, **kwargs: Any) -> str: return cast(F, _wrapped) class MediaFilePaths: """Describes where files are stored on disk.
def _wrapped(self: "MediaFilePaths", *args: Any, **kwargs: Any) -> str: return cast(F, _wrapped) GetPathMethod = TypeVar( "GetPathMethod", bound=Union[Callable[..., str], Callable[..., List[str]]] ) def _wrap_with_jail_check(func: GetPathMethod) -> GetPathMethod: """Wraps a path-returning method to chec...
class MediaFilePaths: def __init__(self, primary_base_path: str): self.base_path = primary_base_path def local_media_filepath_rel(self, media_id: str) -> str: return os.path.join("local_content", media_id[0:2], media_id[2:4], media_id[4:]) local_media_filepath = _wrap_in_base_path(local_me...
class MediaFilePaths: def __init__(self, primary_base_path: str): self.base_path = primary_base_path # The media store directory, with all symlinks resolved. self.real_base_path = os.path.realpath(primary_base_path) # Refuse to initialize if paths cannot be validated correctly for ...
def local_media_thumbnail_dir(self, media_id: str) -> str: return os.path.join( self.base_path, "local_thumbnails", media_id[0:2], media_id[2:4], media_id[4:], ) def remote_media_filepath_rel(self, server_name: str, file_id: str) -> str: ...
def local_media_thumbnail_dir(self, media_id: str) -> str: return os.path.join( self.base_path, "local_thumbnails", _validate_path_component(media_id[0:2]), _validate_path_component(media_id[2:4]), _validate_path_component(media_id[4:]), ) ...
def remote_media_thumbnail_rel( file_name = "%i-%i-%s-%s-%s" % (width, height, top_level_type, sub_type, method) return os.path.join( "remote_thumbnail", server_name, file_id[0:2], file_id[2:4], file_id[4:], file_name, ) ...
def remote_media_thumbnail_rel( file_name = "%i-%i-%s-%s-%s" % (width, height, top_level_type, sub_type, method) return os.path.join( "remote_thumbnail", _validate_path_component(server_name), _validate_path_component(file_id[0:2]), _validate_path_componen...
def remote_media_thumbnail_rel( # Legacy path that was used to store thumbnails previously. # Should be removed after some time, when most of the thumbnails are stored # using the new path. def remote_media_thumbnail_rel_legacy( self, server_name: str, file_id: str, width: int, height: int, cont...
def remote_media_thumbnail_rel( # Legacy path that was used to store thumbnails previously. # Should be removed after some time, when most of the thumbnails are stored # using the new path. @_wrap_with_jail_check def remote_media_thumbnail_rel_legacy( self, server_name: str, file_id: str, wi...
def remote_media_thumbnail_rel_legacy( file_name = "%i-%i-%s-%s" % (width, height, top_level_type, sub_type) return os.path.join( "remote_thumbnail", server_name, file_id[0:2], file_id[2:4], file_id[4:], file_name, ) de...
def remote_media_thumbnail_rel_legacy( file_name = "%i-%i-%s-%s" % (width, height, top_level_type, sub_type) return os.path.join( "remote_thumbnail", _validate_path_component(server_name), _validate_path_component(file_id[0:2]), _validate_path_component(fi...
def url_cache_thumbnail_rel( if NEW_FORMAT_ID_RE.match(media_id): return os.path.join( "url_cache_thumbnails", media_id[:10], media_id[11:], file_name ) else: return os.path.join( "url_cache_thumbnails", media_id[0:2], ...
def url_cache_thumbnail_rel( if NEW_FORMAT_ID_RE.match(media_id): return os.path.join( "url_cache_thumbnails", _validate_path_component(media_id[:10]), _validate_path_component(media_id[11:]), _validate_path_component(file_name), ...
def url_cache_thumbnail_dirs_to_delete(self, media_id: str) -> List[str]: if NEW_FORMAT_ID_RE.match(media_id): return [ os.path.join( self.base_path, "url_cache_thumbnails", media_id[:10], media_id[11:] ), os.path.join(self.base_pat...
def url_cache_thumbnail_dirs_to_delete(self, media_id: str) -> List[str]: if NEW_FORMAT_ID_RE.match(media_id): return [ os.path.join( self.base_path, "url_cache_thumbnails", _validate_path_component(media_id[:10]), ...
from collections.abc import Iterable from typing import Optional, Tuple from synapse.api.errors import Codes, SynapseError _string_with_symbols = string.digits + string.ascii_letters + ".,;:^&*-_+=#~@"
from collections.abc import Iterable from typing import Optional, Tuple from netaddr import valid_ipv6 from synapse.api.errors import Codes, SynapseError _string_with_symbols = string.digits + string.ascii_letters + ".,;:^&*-_+=#~@"
def parse_server_name(server_name: str) -> Tuple[str, Optional[int]]: raise ValueError("Invalid server name '%s'" % server_name) VALID_HOST_REGEX = re.compile("\\A[0-9a-zA-Z.-]+\\Z") def parse_and_validate_server_name(server_name: str) -> Tuple[str, Optional[int]]:
def parse_server_name(server_name: str) -> Tuple[str, Optional[int]]: raise ValueError("Invalid server name '%s'" % server_name) # An approximation of the domain name syntax in RFC 1035, section 2.3.1. # NB: "\Z" is not equivalent to "$". # The latter will match the position before a "\n" at the end of a ...
def parse_and_validate_server_name(server_name: str) -> Tuple[str, Optional[int] if host[0] == "[": if host[-1] != "]": raise ValueError("Mismatched [...] in server name '%s'" % (server_name,)) return host, port # otherwise it should only be alphanumerics. if not VALID_HOST_REGE...
def parse_and_validate_server_name(server_name: str) -> Tuple[str, Optional[int] if host[0] == "[": if host[-1] != "]": raise ValueError("Mismatched [...] in server name '%s'" % (server_name,)) # valid_ipv6 raises when given an empty string ipv6_address = host[1:-1] if n...
def test_validate_bad_server_names(self): "localhost:http", # non-numeric port "1234]", # smells like ipv6 literal but isn't "[1234", "underscore_.com", "percent%65.com", "1234:5678:80", # too many colons ] for i in test_data:
def test_validate_bad_server_names(self): "localhost:http", # non-numeric port "1234]", # smells like ipv6 literal but isn't "[1234", "[1.2.3.4]", "underscore_.com", "percent%65.com", "newline.com\n", ".empty-label.com", ...
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from synapse.rest.media.v1.filepath import MediaFilePaths from tests import unittest
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import inspect from typing import Iterable from synapse.rest.media.v1.filepath import MediaFilePaths from tests import unittest
def test_url_cache_thumbnail_dirs_to_delete_legacy(self): "/media_store/url_cache_thumbnails/Ge", ], )
def test_url_cache_thumbnail_dirs_to_delete_legacy(self): "/media_store/url_cache_thumbnails/Ge", ], ) def test_server_name_validation(self): """Test validation of server names""" self._test_path_validation( [ "remote_media_filepath_re...
class AsyncClientMixin(object): low['__user__'] = user low['__tag__'] = tag return self.low(fun, low, full_return=False) def cmd_async(self, low): '''
class AsyncClientMixin(object): low['__user__'] = user low['__tag__'] = tag try: return self.cmd_sync(low) except salt.exceptions.EauthAuthenticationError as exc: log.error(exc) def cmd_async(self, low): '''
class ClearFuncs(TransportMethods): ''' Send a master control function back to the wheel system ''' # All wheel ops pass through eauth auth_type, err_name, key, sensitive_load_keys = self._prep_auth_info(clear_load)
class ClearFuncs(TransportMethods): ''' Send a master control function back to the wheel system ''' jid = clear_load.get('__jid__', salt.utils.jid.gen_jid(self.opts)) # All wheel ops pass through eauth auth_type, err_name, key, sensitive_load_keys = self._prep_auth_info(c...
class ClearFuncs(TransportMethods): if error: # Authentication error occurred: do not continue. return {'error': error} # Authorize
class ClearFuncs(TransportMethods): if error: # Authentication error occurred: do not continue. data = {'error': error, 'jid': jid} self.event.fire_event(data, tagify([jid, "new"], "wheel")) return {'error': error} # Authorize
class ClearFuncs(TransportMethods): clear_load.get('kwarg', {}) ) if not wheel_check: return {'error': {'name': err_name, 'message': 'Authentication failure of type "{0}" occurred for ' ...
class ClearFuncs(TransportMethods): clear_load.get('kwarg', {}) ) if not wheel_check: err_data = { 'name': err_name, 'message': 'Authentication failure of type "{0}" occurred for ' 'user {1}.'.format(auth...
class ClearFuncs(TransportMethods): # Authorized. Do the job! try: jid = salt.utils.jid.gen_jid(self.opts) fun = clear_load.pop('fun') tag = tagify(jid, prefix='wheel') data = {'fun': "wheel.{0}".format(fun),
class ClearFuncs(TransportMethods): # Authorized. Do the job! try: fun = clear_load.pop('fun') tag = tagify(jid, prefix='wheel') data = {'fun': "wheel.{0}".format(fun),
class WheelClient(salt.client.mixins.SyncClientMixin, }) {'jid': '20131219224744416681', 'tag': 'salt/wheel/20131219224744416681'} ''' fun = low.pop('fun') return self.asynchronous(fun, low) def cmd(self, fun, arg=None, pub_data=None, kwarg=None, print_event=True, fu...
class WheelClient(salt.client.mixins.SyncClientMixin, }) {'jid': '20131219224744416681', 'tag': 'salt/wheel/20131219224744416681'} ''' fun = low.get('fun') return self.asynchronous(fun, low) def cmd(self, fun, arg=None, pub_data=None, kwarg=None, print_event=True, fu...
class NetapiClientTest(TestCase): def test_wheel_async(self): # Give this test a little breathing room time.sleep(3) low = {'client': 'wheel_async', 'fun': 'key.list_all'} low.update(self.eauth_creds) ret = self.netapi.run(low) self.assertIn('jid', ret) self....
class NetapiClientTest(TestCase): def test_wheel_async(self): # Give this test a little breathing room time.sleep(3) timeout = 60 opts = salt.config.master_config(os.path.join(RUNTIME_VARS.TMP_CONF_DIR, 'master')) with salt.utils.event.get_event("master", opts=opts) as event:...
def _unstack_multiple(data, clocs, fill_value=None): comp_ids, obs_ids = compress_group_index(group_index, sort=False) recons_codes = decons_obs_group_ids(comp_ids, obs_ids, shape, ccodes, xnull=False) if rlocs == []: # Everything is in clocs, so the dummy df has a regular index dummy_index...
def _unstack_multiple(data, clocs, fill_value=None): comp_ids, obs_ids = compress_group_index(group_index, sort=False) recons_codes = decons_obs_group_ids(comp_ids, obs_ids, shape, ccodes, xnull=False) if not rlocs: # Everything is in clocs, so the dummy df has a regular index dummy_index =...
def _unstack_multiple(data, clocs, fill_value=None): for i in range(len(clocs)): val = clocs[i] result = result.unstack(val, fill_value=fill_value) clocs = [v if i > v else v - 1 for v in clocs] return result
def _unstack_multiple(data, clocs, fill_value=None): for i in range(len(clocs)): val = clocs[i] result = result.unstack(val, fill_value=fill_value) clocs = [v if v < val else v - 1 for v in clocs] return result
class TestDataFrameReshape: expected.index = expected.index.droplevel("C") tm.assert_frame_equal(result, expected) def test_unstack_nan_index(self): # GH7466 def cast(val): val_str = "" if val != val else val
class TestDataFrameReshape: expected.index = expected.index.droplevel("C") tm.assert_frame_equal(result, expected) def test_unstack_long_index(self): # PH 32624: Error when using a lot of indices to unstack. # The error occurred only, if a lot of indices are used. df = pd.Da...
def gunzip(data): # contains the whole page content if output or getattr(f, 'extrabuf', None): try: output += f.extrabuf finally: break else:
def gunzip(data): # contains the whole page content if output or getattr(f, 'extrabuf', None): try: output += f.extrabuf[-f.extrasize:] finally: break else:
import unittest from os.path import join from scrapy.utils.gz import gunzip, is_gzipped from scrapy.http import Response, Headers from tests import tests_datadir
import unittest from os.path import join from w3lib.encoding import html_to_unicode from scrapy.utils.gz import gunzip, is_gzipped from scrapy.http import Response, Headers from tests import tests_datadir
class GunzipTest(unittest.TestCase): hdrs = Headers({"Content-Type": "application/x-gzip;charset=utf-8"}) r1 = Response("http://www.example.com", headers=hdrs) self.assertTrue(is_gzipped(r1))
class GunzipTest(unittest.TestCase): hdrs = Headers({"Content-Type": "application/x-gzip;charset=utf-8"}) r1 = Response("http://www.example.com", headers=hdrs) self.assertTrue(is_gzipped(r1)) def test_gunzip_illegal_eof(self): with open(join(SAMPLEDIR, 'unexpected-eof.gz'), 'rb') as...
def do_client_test(options, conn): For example to delete the client XYZ in the realm ABC: {prog_name} -s http://example.com:8080 -p password client delete -r ABC -c XYZ where 'client' is the noun, 'delete' is the verb and -r ABC -c XYZ are arguments to the delete action.
def do_client_test(options, conn): For example to delete the client XYZ in the realm ABC: echo password | {prog_name} -s http://example.com:8080 -P - client delete -r ABC -c XYZ where 'client' is the noun, 'delete' is the verb and -r ABC -c XYZ are arguments to the delete action.
def main(): default='admin', help='admin user name (default: admin)') group.add_argument('-p', '--admin-password', required=True, help='admin password') group.add_argument('--admin-realm', defaul...
def main(): default='admin', help='admin user name (default: admin)') group.add_argument('-P', '--admin-password-file', type=argparse.FileType('rb'), help=('file containing admin password ' '(or...
def main(): if options.permit_insecure_transport: os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1' try: anonymous_conn = KeycloakAnonymousConnection(options.server, options.tls_verify)
def main(): if options.permit_insecure_transport: os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1' # Get admin password options.admin_password = None # 1. Try password file if options.admin_password_file is not None: options.admin_password = options.keycloak_admin_password_file.read...
class Index(IndexOpsMixin, PandasObject): return CategoricalIndex(data, dtype=dtype, copy=copy, name=name, **kwargs) # interval elif ( is_interval_dtype(data) or is_interval_dtype(dtype) ) and not is_object_dtype(dtype): closed = kwargs.get("closed", None) ...
class Index(IndexOpsMixin, PandasObject): return CategoricalIndex(data, dtype=dtype, copy=copy, name=name, **kwargs) # interval elif is_interval_dtype(data) or is_interval_dtype(dtype): closed = kwargs.pop("closed", None) if is_dtype_equal(_o_dtype, dtype): ...
class Index(IndexOpsMixin, PandasObject): else: return TimedeltaIndex(data, copy=copy, name=name, dtype=dtype, **kwargs) elif is_period_dtype(data) and not is_object_dtype(dtype): return PeriodIndex(data, copy=copy, name=name, **kwargs) # extension dtype ...
class Index(IndexOpsMixin, PandasObject): else: return TimedeltaIndex(data, copy=copy, name=name, dtype=dtype, **kwargs) elif is_period_dtype(data) or is_period_dtype(dtype): if is_dtype_equal(_o_dtype, dtype): return PeriodIndex(data, copy=False, name=na...
from pandas.core.dtypes.dtypes import PeriodDtype import pandas as pd from pandas import Index, Period, PeriodIndex, Series, date_range, offsets, period_range import pandas.core.indexes.period as period import pandas.util.testing as tm class TestPeriodIndex: def setup_method(self, method): pass def ...
from pandas.core.dtypes.dtypes import PeriodDtype import pandas as pd from pandas import Index, Period, PeriodIndex, Series, date_range, offsets, period_range from pandas.core.arrays import PeriodArray import pandas.util.testing as tm class TestPeriodIndex: def test_construction_base_constructor(self): #...
class TestPeriodIndex: pd.Index(np.array(arr)), pd.Index(np.array(arr), dtype=object) ) def test_constructor_use_start_freq(self): # GH #1118 p = Period("4/2/2012", freq="B")
class TestPeriodIndex: pd.Index(np.array(arr)), pd.Index(np.array(arr), dtype=object) ) def test_base_constructor_with_period_dtype(self): dtype = PeriodDtype("D") values = ["2011-01-01", "2012-03-04", "2014-05-01"] result = pd.Index(values, dtype=dtype) expecte...
class TestPeriodIndex: assert res.dtype == "period[M]" msg = "specified freq and dtype are different" with pytest.raises(period.IncompatibleFrequency, match=msg): PeriodIndex(["2011-01"], freq="M", dtype="period[D]") def test_constructor_empty(self):
class TestPeriodIndex: assert res.dtype == "period[M]" msg = "specified freq and dtype are different" with pytest.raises(IncompatibleFrequency, match=msg): PeriodIndex(["2011-01"], freq="M", dtype="period[D]") def test_constructor_empty(self):
class TestPeriodIndex: def test_constructor_incompat_freq(self): msg = "Input has different freq=D from PeriodIndex\\(freq=M\\)" with pytest.raises(period.IncompatibleFrequency, match=msg): PeriodIndex( [Period("2011-01", freq="M"), pd.NaT, Period("2011-01", freq="D")] ...
class TestPeriodIndex: def test_constructor_incompat_freq(self): msg = "Input has different freq=D from PeriodIndex\\(freq=M\\)" with pytest.raises(IncompatibleFrequency, match=msg): PeriodIndex( [Period("2011-01", freq="M"), pd.NaT, Period("2011-01", freq="D")] ...
class TestPeriodIndex: ) # first element is pd.NaT with pytest.raises(period.IncompatibleFrequency, match=msg): PeriodIndex( [pd.NaT, Period("2011-01", freq="M"), Period("2011-01", freq="D")] ) with pytest.raises(period.IncompatibleFrequency,...
class TestPeriodIndex: ) # first element is pd.NaT with pytest.raises(IncompatibleFrequency, match=msg): PeriodIndex( [pd.NaT, Period("2011-01", freq="M"), Period("2011-01", freq="D")] ) with pytest.raises(IncompatibleFrequency, match=msg): ...
ASCTIME_DATE = _lazy_re_compile(r"^\w{3} %s %s %s %s$" % (__M, __D2, __T, __Y)) RFC3986_GENDELIMS = ":/?#[]@" RFC3986_SUBDELIMS = "!$&'()*+,;=" def urlencode(query, doseq=False): """
ASCTIME_DATE = _lazy_re_compile(r"^\w{3} %s %s %s %s$" % (__M, __D2, __T, __Y)) RFC3986_GENDELIMS = ":/?#[]@" RFC3986_SUBDELIMS = "!$&'()*+,;=" # TODO: Remove when dropping support for PY38. # Unsafe bytes to be removed per WHATWG spec. _UNSAFE_URL_BYTES_TO_REMOVE = ["\t", "\r", "\n"] def urlencode(query, doseq=Fals...
def url_has_allowed_host_and_scheme(url, allowed_hosts, require_https=False): ) # Copied from urllib.parse.urlparse() but uses fixed urlsplit() function. def _urlparse(url, scheme="", allow_fragments=True): """Parse a URL into 6 components:
def url_has_allowed_host_and_scheme(url, allowed_hosts, require_https=False): ) # TODO: Remove when dropping support for PY38. # Copied from urllib.parse.urlparse() but uses fixed urlsplit() function. def _urlparse(url, scheme="", allow_fragments=True): """Parse a URL into 6 components:
def _urlparse(url, scheme="", allow_fragments=True): return _coerce_result(result) # Copied from urllib.parse.urlsplit() with # https://github.com/python/cpython/pull/661 applied. def _urlsplit(url, scheme="", allow_fragments=True): """Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fra...
def _urlparse(url, scheme="", allow_fragments=True): return _coerce_result(result) # TODO: Remove when dropping support for PY38. def _remove_unsafe_bytes_from_url(url): for b in _UNSAFE_URL_BYTES_TO_REMOVE: url = url.replace(b, "") return url # TODO: Remove when dropping support for PY38. # Bac...
def _urlsplit(url, scheme="", allow_fragments=True): Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.""" url, scheme, _coerce_result = _coerce_args(url, scheme) netloc = query = fragment = "" i = url.find(":") if i > 0:
def _urlsplit(url, scheme="", allow_fragments=True): Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.""" url, scheme, _coerce_result = _coerce_args(url, scheme) url = _remove_unsafe_bytes_from_url(url) scheme = _remove_unsafe_...
class URLHasAllowedHostAndSchemeTests(unittest.TestCase): r"http:/\example.com", 'javascript:alert("XSS")', "\njavascript:alert(x)", "\x08//example.com", r"http://otherserver\@example.com", r"http:\\testserver\@example.com",
class URLHasAllowedHostAndSchemeTests(unittest.TestCase): r"http:/\example.com", 'javascript:alert("XSS")', "\njavascript:alert(x)", "java\nscript:alert(x)", "\x08//example.com", r"http://otherserver\@example.com", r"http:\\testserver\@...
Make api awesomeness """ from __future__ import absolute_import, print_function, unicode_literals # Import Python libs import inspect import os import salt.client import salt.client.ssh.client import salt.config import salt.exceptions # Import Salt libs
Make api awesomeness """ from __future__ import absolute_import, print_function, unicode_literals import copy # Import Python libs import inspect import logging import os import salt.auth import salt.client import salt.client.ssh.client import salt.config import salt.daemons.masterapi import salt.exceptions # Impor...
import salt.log # pylint: disable=W0611 import salt.runner import salt.syspaths import salt.utils.args import salt.wheel # Import third party libs from salt.ext import six class NetapiClient(object): """
import salt.log # pylint: disable=W0611 import salt.runner import salt.syspaths import salt.utils.args import salt.utils.minions import salt.wheel from salt.defaults import DEFAULT_TARGET_DELIM # Import third party libs from salt.ext import six log = logging.getLogger(__name__) class NetapiClient(object): """
class NetapiClient(object): def __init__(self, opts): self.opts = opts def _is_master_running(self): """
class NetapiClient(object): def __init__(self, opts): self.opts = opts self.loadauth = salt.auth.LoadAuth(opts) self.key = salt.daemons.masterapi.access_keys(self.opts) minopts = copy.deepcopy(self.opts) minopts["enable_ssh_minions"] = True self.ckminions = salt.util...
class NetapiClient(object): ipc_file = "workers.ipc" return os.path.exists(os.path.join(self.opts["sock_dir"], ipc_file)) def run(self, low): """ Execute the specified function in the specified client by passing the
class NetapiClient(object): ipc_file = "workers.ipc" return os.path.exists(os.path.join(self.opts["sock_dir"], ipc_file)) def _prep_auth_info(self, clear_load): sensitive_load_keys = [] key = None if "token" in clear_load: auth_type = "token" err_...
class NetapiClient(object): "Raw shell option not allowed." ) l_fun = getattr(self, low["client"]) f_call = salt.utils.args.format_call(l_fun, low) return l_fun(*f_call.get("args", ()), **f_call.get("kwargs", {}))
class NetapiClient(object): "Raw shell option not allowed." ) if low["client"] == "ssh": self._authorize_ssh(low) l_fun = getattr(self, low["client"]) f_call = salt.utils.args.format_call(l_fun, low) return l_fun(*f_call.get("args", ()), **f_call...
# encoding: utf-8 from __future__ import absolute_import, print_function, unicode_literals import logging import os import time
# encoding: utf-8 from __future__ import absolute_import, print_function, unicode_literals import copy import logging import os import time
import pytest import salt.config import salt.netapi import salt.utils.files from salt.exceptions import EauthAuthenticationError from tests.support.case import SSHCase from tests.support.helpers import ( SaveRequestsPostHandler, Webserver,
import pytest import salt.config import salt.netapi import salt.utils.files import salt.utils.platform import salt.utils.pycrypto from salt.exceptions import EauthAuthenticationError from tests.support.case import ModuleCase, SSHCase from tests.support.helpers import ( SaveRequestsPostHandler, Webserver,
class NetapiSSHClientTest(SSHCase): """ opts = salt.config.client_config(os.path.join(TMP_CONF_DIR, "master")) self.netapi = salt.netapi.NetapiClient(opts) self.priv_file = os.path.join(RUNTIME_VARS.TMP_CONF_DIR, "key_test") self.rosters = os.path.join(RUNTIME_VARS.TMP_CONF_DIR)...
class NetapiSSHClientTest(SSHCase): """ opts = salt.config.client_config(os.path.join(TMP_CONF_DIR, "master")) self.netapi = salt.netapi.NetapiClient(opts) self.priv_file = os.path.join(RUNTIME_VARS.TMP_CONF_DIR, "key_test") self.rosters = os.path.join(RUNTIME_VARS.TMP_CONF_DIR) ...
class NetapiSSHClientTest(SSHCase): "roster": "cache", "client": "ssh", "tgt": "www.zerodayinitiative.com", "fun": "xx", "eauth": "xx", "ssh_priv": "aaa|id>{} #".format(path), } ret = self.netapi.run(low) self.assertFalse(os...
class NetapiSSHClientTest(SSHCase): "roster": "cache", "client": "ssh", "tgt": "www.zerodayinitiative.com", "ssh_priv": "aaa|id>{} #".format(path), "fun": "test.ping", "eauth": "auto", "username": "saltdev_auto", "password":...
class NetapiSSHClientTest(SSHCase): "roster": "cache", "client": "ssh", "tgt": "root|id>{} #@127.0.0.1".format(path), "fun": "xx", "eauth": "xx", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", } ...
class NetapiSSHClientTest(SSHCase): "roster": "cache", "client": "ssh", "tgt": "root|id>{} #@127.0.0.1".format(path), "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "fun": "test.ping", "eauth": "auto", ...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "xx", "eauth": "xx", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "ssh_options": ["|id>{} #".f...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "test.ping", "eauth": "auto", "username": "saltdev_auto", "password": "saltdev", "roster_file": "/tmp/salt-tests-tmpdir/c...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "xx", "eauth": "xx", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "ssh_port": "hhhhh|id>{} #"....
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "test.ping", "eauth": "auto", "username": "saltdev_auto", "password": "saltdev", "roster_file": "/tmp/salt-tests-tmpdir/c...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "xx", "eauth": "xx", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "ssh_remote_port_forwards": ...
class NetapiSSHClientTest(SSHCase): "client": "ssh", "tgt": "127.0.0.1", "renderer": "cheetah", "fun": "test.ping", "roster_file": "/tmp/salt-tests-tmpdir/config/roaster", "rosters": "/", "ssh_remote_port_forwards": "hhhhh|id>{} #, lol"...
class IOLoop(Configurable): if IOLoop.current(instance=False) is None: self.make_current() elif make_current: if IOLoop.current(instance=False) is None: raise RuntimeError("current IOLoop already exists") self.make_current()
class IOLoop(Configurable): if IOLoop.current(instance=False) is None: self.make_current() elif make_current: if IOLoop.current(instance=False) is not None: raise RuntimeError("current IOLoop already exists") self.make_current()
class TestIOLoop(AsyncTestCase): # automatically set as current. class TestIOLoopCurrent(unittest.TestCase): def setUp(self): self.io_loop = IOLoop() def tearDown(self): self.io_loop.close() def test_current(self): def f(): self.current_io_loop = IOLoop.current() ...
class TestIOLoop(AsyncTestCase): # automatically set as current. class TestIOLoopCurrent(unittest.TestCase): def setUp(self): self.io_loop = None IOLoop.clear_current() def tearDown(self): if self.io_loop is not None: self.io_loop.close() def test_default_current(self):...
class BaseGrouper: pass else: raise return self._aggregate_series_pure_python(obj, func) def _aggregate_series_fast(self, obj, func): func = self._is_builtin_func(func)
class BaseGrouper: pass else: raise except TypeError as err: if "ndarray" in str(err): # raised in libreduction if obj's values is no ndarray pass else: raise return self._aggregate_series...