Best Python code snippet using fMBT_python
test_pipeline.py
Source:test_pipeline.py  
1# -*- coding: utf-8 -*-2# python std lib3from __future__ import with_statement4import re5# rediscluster imports6from rediscluster.client import StrictRedisCluster7from rediscluster.connection import ClusterConnectionPool, ClusterReadOnlyConnectionPool8from rediscluster.exceptions import RedisClusterException9from tests.conftest import _get_client10# 3rd party imports11import pytest12from mock import patch13from redis._compat import b, u, unichr, unicode14from redis.exceptions import WatchError, ResponseError, ConnectionError15class TestPipeline(object):16    """17    """18    def test_pipeline(self, r):19        with r.pipeline() as pipe:20            pipe.set('a', 'a1').get('a').zadd('z', z1=1).zadd('z', z2=4)21            pipe.zincrby('z', 'z1').zrange('z', 0, 5, withscores=True)22            assert pipe.execute() == [23                True,24                b('a1'),25                True,26                True,27                2.0,28                [(b('z1'), 2.0), (b('z2'), 4)],29            ]30    def test_pipeline_length(self, r):31        with r.pipeline() as pipe:32            # Initially empty.33            assert len(pipe) == 034            assert not pipe35            # Fill 'er up!36            pipe.set('a', 'a1').set('b', 'b1').set('c', 'c1')37            assert len(pipe) == 338            assert pipe39            # Execute calls reset(), so empty once again.40            pipe.execute()41            assert len(pipe) == 042            assert not pipe43    def test_pipeline_no_transaction(self, r):44        with r.pipeline(transaction=False) as pipe:45            pipe.set('a', 'a1').set('b', 'b1').set('c', 'c1')46            assert pipe.execute() == [True, True, True]47            assert r['a'] == b('a1')48            assert r['b'] == b('b1')49            assert r['c'] == b('c1')50    def test_pipeline_eval(self, r):51        with r.pipeline(transaction=False) as pipe:52            pipe.eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "A{foo}", "B{foo}", "first", "second")53            res = pipe.execute()[0]54            assert res[0] == b('A{foo}')55            assert res[1] == b('B{foo}')56            assert res[2] == b('first')57            assert res[3] == b('second')58    @pytest.mark.xfail(reason="unsupported command: watch")59    def test_pipeline_no_transaction_watch(self, r):60        r['a'] = 061        with r.pipeline(transaction=False) as pipe:62            pipe.watch('a')63            a = pipe.get('a')64            pipe.multi()65            pipe.set('a', int(a) + 1)66            assert pipe.execute() == [True]67    @pytest.mark.xfail(reason="unsupported command: watch")68    def test_pipeline_no_transaction_watch_failure(self, r):69        r['a'] = 070        with r.pipeline(transaction=False) as pipe:71            pipe.watch('a')72            a = pipe.get('a')73            r['a'] = 'bad'74            pipe.multi()75            pipe.set('a', int(a) + 1)76            with pytest.raises(WatchError):77                pipe.execute()78            assert r['a'] == b('bad')79    def test_exec_error_in_response(self, r):80        """81        an invalid pipeline command at exec time adds the exception instance82        to the list of returned values83        """84        r['c'] = 'a'85        with r.pipeline() as pipe:86            pipe.set('a', 1).set('b', 2).lpush('c', 3).set('d', 4)87            result = pipe.execute(raise_on_error=False)88            assert result[0]89            assert r['a'] == b('1')90            assert result[1]91            assert r['b'] == b('2')92            # we can't lpush to a key that's a string value, so this should93            # be a ResponseError exception94            assert isinstance(result[2], ResponseError)95            assert r['c'] == b('a')96            # since this isn't a transaction, the other commands after the97            # error are still executed98            assert result[3]99            assert r['d'] == b('4')100            # make sure the pipe was restored to a working state101            assert pipe.set('z', 'zzz').execute() == [True]102            assert r['z'] == b('zzz')103    def test_exec_error_raised(self, r):104        r['c'] = 'a'105        with r.pipeline() as pipe:106            pipe.set('a', 1).set('b', 2).lpush('c', 3).set('d', 4)107            with pytest.raises(ResponseError) as ex:108                pipe.execute()109            assert unicode(ex.value).startswith('Command # 3 (LPUSH c 3) of '110                                                'pipeline caused error: ')111            # make sure the pipe was restored to a working state112            assert pipe.set('z', 'zzz').execute() == [True]113            assert r['z'] == b('zzz')114    def test_parse_error_raised(self, r):115        with r.pipeline() as pipe:116            # the zrem is invalid because we don't pass any keys to it117            pipe.set('a', 1).zrem('b').set('b', 2)118            with pytest.raises(ResponseError) as ex:119                pipe.execute()120            assert unicode(ex.value).startswith('Command # 2 (ZREM b) of '121                                                'pipeline caused error: ')122            # make sure the pipe was restored to a working state123            assert pipe.set('z', 'zzz').execute() == [True]124            assert r['z'] == b('zzz')125    @pytest.mark.xfail(reason="unsupported command: watch")126    def test_watch_succeed(self, r):127        r['a'] = 1128        r['b'] = 2129        with r.pipeline() as pipe:130            pipe.watch('a', 'b')131            assert pipe.watching132            a_value = pipe.get('a')133            b_value = pipe.get('b')134            assert a_value == b('1')135            assert b_value == b('2')136            pipe.multi()137            pipe.set('c', 3)138            assert pipe.execute() == [True]139            assert not pipe.watching140    @pytest.mark.xfail(reason="unsupported command: watch")141    def test_watch_failure(self, r):142        r['a'] = 1143        r['b'] = 2144        with r.pipeline() as pipe:145            pipe.watch('a', 'b')146            r['b'] = 3147            pipe.multi()148            pipe.get('a')149            with pytest.raises(WatchError):150                pipe.execute()151            assert not pipe.watching152    @pytest.mark.xfail(reason="unsupported command: watch")153    def test_unwatch(self, r):154        r['a'] = 1155        r['b'] = 2156        with r.pipeline() as pipe:157            pipe.watch('a', 'b')158            r['b'] = 3159            pipe.unwatch()160            assert not pipe.watching161            pipe.get('a')162            assert pipe.execute() == [b('1')]163    @pytest.mark.xfail(reason="unsupported command: watch")164    def test_transaction_callable(self, r):165        r['a'] = 1166        r['b'] = 2167        has_run = []168        def my_transaction(pipe):169            a_value = pipe.get('a')170            assert a_value in (b('1'), b('2'))171            b_value = pipe.get('b')172            assert b_value == b('2')173            # silly run-once code... incr's "a" so WatchError should be raised174            # forcing this all to run again. this should incr "a" once to "2"175            if not has_run:176                r.incr('a')177                has_run.append('it has')178            pipe.multi()179            pipe.set('c', int(a_value) + int(b_value))180        result = r.transaction(my_transaction, 'a', 'b')181        assert result == [True]182        assert r['c'] == b('4')183    def test_exec_error_in_no_transaction_pipeline(self, r):184        r['a'] = 1185        with r.pipeline(transaction=False) as pipe:186            pipe.llen('a')187            pipe.expire('a', 100)188            with pytest.raises(ResponseError) as ex:189                pipe.execute()190            assert unicode(ex.value).startswith('Command # 1 (LLEN a) of '191                                                'pipeline caused error: ')192        assert r['a'] == b('1')193    def test_exec_error_in_no_transaction_pipeline_unicode_command(self, r):194        key = unichr(3456) + u('abcd') + unichr(3421)195        r[key] = 1196        with r.pipeline(transaction=False) as pipe:197            pipe.llen(key)198            pipe.expire(key, 100)199            with pytest.raises(ResponseError) as ex:200                pipe.execute()201            expected = unicode('Command # 1 (LLEN {0}) of pipeline caused error: ').format(key)202            assert unicode(ex.value).startswith(expected)203        assert r[key] == b('1')204    def test_blocked_methods(self, r):205        """206        Currently some method calls on a Cluster pipeline207        is blocked when using in cluster mode.208        They maybe implemented in the future.209        """210        pipe = r.pipeline(transaction=False)211        with pytest.raises(RedisClusterException):212            pipe.multi()213        with pytest.raises(RedisClusterException):214            pipe.immediate_execute_command()215        with pytest.raises(RedisClusterException):216            pipe._execute_transaction(None, None, None)217        with pytest.raises(RedisClusterException):218            pipe.load_scripts()219        with pytest.raises(RedisClusterException):220            pipe.watch()221        with pytest.raises(RedisClusterException):222            pipe.unwatch()223        with pytest.raises(RedisClusterException):224            pipe.script_load_for_pipeline(None)225        with pytest.raises(RedisClusterException):226            pipe.transaction(None)227    def test_blocked_arguments(self, r):228        """229        Currently some arguments is blocked when using in cluster mode.230        They maybe implemented in the future.231        """232        with pytest.raises(RedisClusterException) as ex:233            r.pipeline(transaction=True)234        assert unicode(ex.value).startswith("transaction is deprecated in cluster mode"), True235        with pytest.raises(RedisClusterException) as ex:236            r.pipeline(shard_hint=True)237        assert unicode(ex.value).startswith("shard_hint is deprecated in cluster mode"), True238    def test_redis_cluster_pipeline(self):239        """240        Test that we can use a pipeline with the RedisCluster class241        """242        r = _get_client(cls=None)243        with r.pipeline(transaction=False) as pipe:244            pipe.get("foobar")245    def test_mget_disabled(self, r):246        with r.pipeline(transaction=False) as pipe:247            with pytest.raises(RedisClusterException):248                pipe.mget(['a'])249    def test_mset_disabled(self, r):250        with r.pipeline(transaction=False) as pipe:251            with pytest.raises(RedisClusterException):252                pipe.mset({'a': 1, 'b': 2})253    def test_rename_disabled(self, r):254        with r.pipeline(transaction=False) as pipe:255            with pytest.raises(RedisClusterException):256                pipe.rename('a', 'b')257    def test_renamenx_disabled(self, r):258        with r.pipeline(transaction=False) as pipe:259            with pytest.raises(RedisClusterException):260                pipe.renamenx('a', 'b')261    def test_delete_single(self, r):262        r['a'] = 1263        with r.pipeline(transaction=False) as pipe:264            pipe.delete('a')265            assert pipe.execute(), True266    def test_multi_delete_unsupported(self, r):267        with r.pipeline(transaction=False) as pipe:268            r['a'] = 1269            r['b'] = 2270            with pytest.raises(RedisClusterException):271                pipe.delete('a', 'b')272    def test_brpoplpush_disabled(self, r):273        with r.pipeline(transaction=False) as pipe:274            with pytest.raises(RedisClusterException):275                pipe.brpoplpush()276    def test_rpoplpush_disabled(self, r):277        with r.pipeline(transaction=False) as pipe:278            with pytest.raises(RedisClusterException):279                pipe.rpoplpush()280    def test_sort_disabled(self, r):281        with r.pipeline(transaction=False) as pipe:282            with pytest.raises(RedisClusterException):283                pipe.sort()284    def test_sdiff_disabled(self, r):285        with r.pipeline(transaction=False) as pipe:286            with pytest.raises(RedisClusterException):287                pipe.sdiff()288    def test_sdiffstore_disabled(self, r):289        with r.pipeline(transaction=False) as pipe:290            with pytest.raises(RedisClusterException):291                pipe.sdiffstore()292    def test_sinter_disabled(self, r):293        with r.pipeline(transaction=False) as pipe:294            with pytest.raises(RedisClusterException):295                pipe.sinter()296    def test_sinterstore_disabled(self, r):297        with r.pipeline(transaction=False) as pipe:298            with pytest.raises(RedisClusterException):299                pipe.sinterstore()300    def test_smove_disabled(self, r):301        with r.pipeline(transaction=False) as pipe:302            with pytest.raises(RedisClusterException):303                pipe.smove()304    def test_sunion_disabled(self, r):305        with r.pipeline(transaction=False) as pipe:306            with pytest.raises(RedisClusterException):307                pipe.sunion()308    def test_sunionstore_disabled(self, r):309        with r.pipeline(transaction=False) as pipe:310            with pytest.raises(RedisClusterException):311                pipe.sunionstore()312    def test_spfmerge_disabled(self, r):313        with r.pipeline(transaction=False) as pipe:314            with pytest.raises(RedisClusterException):315                pipe.pfmerge()316    def test_multi_key_operation_with_shared_shards(self, r):317        pipe = r.pipeline(transaction=False)318        pipe.set('a{foo}', 1)319        pipe.set('b{foo}', 2)320        pipe.set('c{foo}', 3)321        pipe.set('bar', 4)322        pipe.set('bazz', 5)323        pipe.get('a{foo}')324        pipe.get('b{foo}')325        pipe.get('c{foo}')326        pipe.get('bar')327        pipe.get('bazz')328        res = pipe.execute()329        assert res == [True, True, True, True, True, b'1', b'2', b'3', b'4', b'5']330    @pytest.mark.xfail(reson="perform_execute_pipeline is not used any longer")331    def test_connection_error(self, r):332        test = self333        test._calls = []334        def perform_execute_pipeline(pipe):335            if not test._calls:336                e = ConnectionError('test')337                test._calls.append({'exception': e})338                return [e]339            result = pipe.execute(raise_on_error=False)340            test._calls.append({'result': result})341            return result342        pipe = r.pipeline(transaction=False)343        orig_perform_execute_pipeline = pipe.perform_execute_pipeline344        pipe.perform_execute_pipeline = perform_execute_pipeline345        try:346            pipe.set('foo', 1)347            res = pipe.execute()348            assert res, [True]349            assert isinstance(test._calls[0]['exception'], ConnectionError)350            if len(test._calls) == 2:351                assert test._calls[1] == {'result': [True]}352            else:353                assert isinstance(test._calls[1]['result'][0], ResponseError)354                assert test._calls[2] == {'result': [True]}355        finally:356            pipe.perform_execute_pipeline = orig_perform_execute_pipeline357            del test._calls358    @pytest.mark.xfail(reson="perform_execute_pipeline is not used any longer")359    def test_asking_error(self, r):360        test = self361        test._calls = []362        def perform_execute_pipeline(pipe):363            if not test._calls:364                e = ResponseError("ASK {0} 127.0.0.1:7003".format(r.keyslot('foo')))365                test._calls.append({'exception': e})366                return [e, e]367            result = pipe.execute(raise_on_error=False)368            test._calls.append({'result': result})369            return result370        pipe = r.pipeline(transaction=False)371        orig_perform_execute_pipeline = pipe.perform_execute_pipeline372        pipe.perform_execute_pipeline = perform_execute_pipeline373        try:374            pipe.set('foo', 1)375            pipe.get('foo')376            res = pipe.execute()377            assert res == [True, b'1']378            assert isinstance(test._calls[0]['exception'], ResponseError)379            assert re.match("ASK", str(test._calls[0]['exception']))380            assert isinstance(test._calls[1]['result'][0], ResponseError)381            assert re.match("MOVED", str(test._calls[1]['result'][0]))382            assert test._calls[2] == {'result': [True, b'1']}383        finally:384            pipe.perform_execute_pipeline = orig_perform_execute_pipeline385            del test._calls386    def test_empty_stack(self, r):387        """388        If pipeline is executed with no commands it should389        return a empty list.390        """391        p = r.pipeline()392        result = p.execute()393        assert result == []394class TestReadOnlyPipeline(object):395    def test_pipeline_readonly(self, r, ro):396        """397        On readonly mode, we supports get related stuff only.398        """399        r.set('foo71', 'a1')   # we assume this key is set on 127.0.0.1:7001400        r.zadd('foo88', z1=1)  # we assume this key is set on 127.0.0.1:7002401        r.zadd('foo88', z2=4)402        with ro.pipeline() as readonly_pipe:403            readonly_pipe.get('foo71').zrange('foo88', 0, 5, withscores=True)404            assert readonly_pipe.execute() == [405                b('a1'),406                [(b('z1'), 1.0), (b('z2'), 4)],407            ]408    def assert_moved_redirection_on_slave(self, connection_pool_cls, cluster_obj):409        with patch.object(connection_pool_cls, 'get_node_by_slot') as return_slave_mock:410            with patch.object(ClusterConnectionPool, 'get_master_node_by_slot') as return_master_mock:411                def get_mock_node(role, port):412                    return {413                        'name': '127.0.0.1:{0}'.format(port),414                        'host': '127.0.0.1',415                        'port': port,416                        'server_type': role,417                    }418                return_slave_mock.return_value = get_mock_node('slave', 7005)419                return_master_mock.return_value = get_mock_node('slave', 7001)420                with cluster_obj.pipeline() as pipe:421                    # we assume this key is set on 127.0.0.1:7001(7004)422                    pipe.get('foo87').get('foo88').execute() == [None, None]423    def test_moved_redirection_on_slave_with_default(self):424        """425        On Pipeline, we redirected once and finally get from master with426        readonly client when data is completely moved.427        """428        self.assert_moved_redirection_on_slave(429            ClusterConnectionPool,430            StrictRedisCluster(host="127.0.0.1", port=7000, reinitialize_steps=1)431        )432    def test_moved_redirection_on_slave_with_readonly_mode_client(self):433        """434        Ditto with READONLY mode.435        """436        self.assert_moved_redirection_on_slave(437            ClusterReadOnlyConnectionPool,438            StrictRedisCluster(host="127.0.0.1", port=7000, readonly_mode=True, reinitialize_steps=1)439        )440    def test_access_correct_slave_with_readonly_mode_client(self, sr):441        """442        Test that the client can get value normally with readonly mode443        when we connect to correct slave.444        """445        # we assume this key is set on 127.0.0.1:7001446        sr.set('foo87', 'foo')447        sr.set('foo88', 'bar')448        import time449        time.sleep(1)450        with patch.object(ClusterReadOnlyConnectionPool, 'get_node_by_slot') as return_slave_mock:451            return_slave_mock.return_value = {452                'name': '127.0.0.1:7004',453                'host': '127.0.0.1',454                'port': 7004,455                'server_type': 'slave',456            }457            master_value = {'host': '127.0.0.1', 'name': '127.0.0.1:7001', 'port': 7001, 'server_type': 'master'}458            with patch.object(459                    ClusterConnectionPool,460                    'get_master_node_by_slot',461                    return_value=master_value) as return_master_mock:462                readonly_client = StrictRedisCluster(host="127.0.0.1", port=7000, readonly_mode=True)463                with readonly_client.pipeline() as readonly_pipe:...internal.js
Source:internal.js  
...42      Packaged43  ---------------*/44  gulp.task('package uncompressed css', function() {45    return gulp.src(output.uncompressed + '/**/' + globs.components + globs.ignored + '.css')46      .pipe(plumber())47      .pipe(dedupe())48      .pipe(replace(assets.uncompressed, assets.packaged))49      .pipe(concatCSS(filenames.concatenatedCSS))50        .pipe(gulpif(config.hasPermission, chmod(config.permission)))51        .pipe(header(banner, settings.header))52        .pipe(gulp.dest(output.packaged))53        .pipe(print(log.created))54    ;55  });56  gulp.task('package compressed css', function() {57    return gulp.src(output.uncompressed + '/**/' + globs.components + globs.ignored + '.css')58      .pipe(plumber())59      .pipe(dedupe())60      .pipe(replace(assets.uncompressed, assets.packaged))61      .pipe(concatCSS(filenames.concatenatedMinifiedCSS))62        .pipe(gulpif(config.hasPermission, chmod(config.permission)))63        .pipe(minifyCSS(settings.concatMinify))64        .pipe(header(banner, settings.header))65        .pipe(gulp.dest(output.packaged))66        .pipe(print(log.created))67    ;68  });69  gulp.task('package uncompressed js', function() {70    return gulp.src(output.uncompressed + '/**/' + globs.components + globs.ignored + '.js')71      .pipe(plumber())72      .pipe(dedupe())73      .pipe(replace(assets.uncompressed, assets.packaged))74      .pipe(concat(filenames.concatenatedJS))75        .pipe(header(banner, settings.header))76        .pipe(gulpif(config.hasPermission, chmod(config.permission)))77        .pipe(gulp.dest(output.packaged))78        .pipe(print(log.created))79    ;80  });81  gulp.task('package compressed js', function() {82    return gulp.src(output.uncompressed + '/**/' + globs.components + globs.ignored + '.js')83      .pipe(plumber())84      .pipe(dedupe())85      .pipe(replace(assets.uncompressed, assets.packaged))86      .pipe(concat(filenames.concatenatedMinifiedJS))87        .pipe(uglify(settings.concatUglify))88        .pipe(header(banner, settings.header))89        .pipe(gulpif(config.hasPermission, chmod(config.permission)))90        .pipe(gulp.dest(output.packaged))91        .pipe(print(log.created))92    ;93  });94  /*--------------95        RTL96  ---------------*/97  if(config.rtl) {98    gulp.task('package uncompressed rtl css', function () {99      return gulp.src(output.uncompressed + '/**/' + globs.components + globs.ignoredRTL + '.rtl.css')100        .pipe(dedupe())101        .pipe(replace(assets.uncompressed, assets.packaged))102        .pipe(concatCSS(filenames.concatenatedRTLCSS))103          .pipe(gulpif(config.hasPermission, chmod(config.permission)))104          .pipe(header(banner, settings.header))105          .pipe(gulp.dest(output.packaged))106          .pipe(print(log.created))107      ;108    });109    gulp.task('package compressed rtl css', function () {110      return gulp.src(output.uncompressed + '/**/' + globs.components + globs.ignoredRTL + '.rtl.css')111        .pipe(dedupe())112        .pipe(replace(assets.uncompressed, assets.packaged))113        .pipe(concatCSS(filenames.concatenatedMinifiedRTLCSS))114          .pipe(gulpif(config.hasPermission, chmod(config.permission)))115          .pipe(minifyCSS(settings.concatMinify))116          .pipe(header(banner, settings.header))117          .pipe(gulp.dest(output.packaged))118          .pipe(print(log.created))119      ;120    });121    gulp.task('package uncompressed docs css', function() {122      return gulp.src(output.uncompressed + '/**/' + globs.components + globs.ignored + '.css')123        .pipe(dedupe())124        .pipe(plumber())125        .pipe(replace(assets.uncompressed, assets.packaged))126        .pipe(concatCSS(filenames.concatenatedCSS))127          .pipe(gulpif(config.hasPermission, chmod(config.permission)))128          .pipe(gulp.dest(output.packaged))129          .pipe(print(log.created))130      ;131    });132    gulp.task('package compressed docs css', function() {133      return gulp.src(output.uncompressed + '/**/' + globs.components + globs.ignored + '.css')134        .pipe(dedupe())135        .pipe(plumber())136        .pipe(replace(assets.uncompressed, assets.packaged))137        .pipe(concatCSS(filenames.concatenatedMinifiedCSS))138          .pipe(minifyCSS(settings.concatMinify))139          .pipe(header(banner, settings.header))140          .pipe(gulpif(config.hasPermission, chmod(config.permission)))141          .pipe(gulp.dest(output.packaged))142          .pipe(print(log.created))143      ;144    });145  }146  /*--------------147        Docs148  ---------------*/149  var150    docsOutput = docsConfig.paths.output151  ;152  gulp.task('package uncompressed docs css', function() {153    return gulp.src(docsOutput.uncompressed + '/**/' + globs.components + globs.ignored + '.css')154      .pipe(dedupe())155      .pipe(plumber())156      .pipe(replace(assets.uncompressed, assets.packaged))157      .pipe(concatCSS(filenames.concatenatedCSS))158        .pipe(gulpif(config.hasPermission, chmod(config.permission)))159        .pipe(gulp.dest(docsOutput.packaged))160        .pipe(print(log.created))161    ;162  });163  gulp.task('package compressed docs css', function() {164    return gulp.src(docsOutput.uncompressed + '/**/' + globs.components + globs.ignored + '.css')165      .pipe(dedupe())166      .pipe(plumber())167      .pipe(replace(assets.uncompressed, assets.packaged))168      .pipe(concatCSS(filenames.concatenatedMinifiedCSS))169        .pipe(minifyCSS(settings.concatMinify))170        .pipe(header(banner, settings.header))171        .pipe(gulpif(config.hasPermission, chmod(config.permission)))172        .pipe(gulp.dest(docsOutput.packaged))173        .pipe(print(log.created))174    ;175  });176  gulp.task('package uncompressed docs js', function() {177    return gulp.src(docsOutput.uncompressed + '/**/' + globs.components + globs.ignored + '.js')178      .pipe(dedupe())179      .pipe(plumber())180      .pipe(replace(assets.uncompressed, assets.packaged))181      .pipe(concat(filenames.concatenatedJS))182        .pipe(header(banner, settings.header))183        .pipe(gulpif(config.hasPermission, chmod(config.permission)))184        .pipe(gulp.dest(docsOutput.packaged))185        .pipe(print(log.created))186    ;187  });188  gulp.task('package compressed docs js', function() {189    return gulp.src(docsOutput.uncompressed + '/**/' + globs.components + globs.ignored + '.js')190      .pipe(dedupe())191      .pipe(plumber())192      .pipe(replace(assets.uncompressed, assets.packaged))193      .pipe(concat(filenames.concatenatedMinifiedJS))194        .pipe(uglify(settings.concatUglify))195        .pipe(header(banner, settings.header))196        .pipe(gulpif(config.hasPermission, chmod(config.permission)))197        .pipe(gulp.dest(docsOutput.packaged))198        .pipe(print(log.created))199    ;200  });...partition_tearing_test_3.py
Source:partition_tearing_test_3.py  
...20    Inf.append(influent())21    Inf[i].set_flow(10)#TODO: Units to be noted in ''' ''' if a function asks for params22    Eff.append(effluent())23for i in range(35):24    Pipe.append(pipe())25    26for i in range(11):27    Splt.append(splitter())28for i in range(7):29    React.append(asm_reactor())30Splt[0].__name__ = 'C'31Splt[1].__name__ = 'F'32Splt[2].__name__ = 'G'33Splt[3].__name__ = 'R'34Splt[4].__name__ = 'S'35Splt[5].__name__ = 'O'36Splt[6].__name__ = 'L'37Splt[7].__name__ = 'M'38Splt[8].__name__ = 'K'...pipes.module.ts
Source:pipes.module.ts  
1import { CommonModule, DatePipe } from '@angular/common';2import { NgModule } from '@angular/core';3import { ArrayPipe } from './array.pipe';4import { BooleanTextPipe } from './boolean-text.pipe';5import { BooleanPipe } from './boolean.pipe';6import { CdDatePipe } from './cd-date.pipe';7import { CephReleaseNamePipe } from './ceph-release-name.pipe';8import { CephShortVersionPipe } from './ceph-short-version.pipe';9import { DimlessBinaryPerSecondPipe } from './dimless-binary-per-second.pipe';10import { DimlessBinaryPipe } from './dimless-binary.pipe';11import { DimlessPipe } from './dimless.pipe';12import { DurationPipe } from './duration.pipe';13import { EmptyPipe } from './empty.pipe';14import { EncodeUriPipe } from './encode-uri.pipe';15import { FilterPipe } from './filter.pipe';16import { HealthColorPipe } from './health-color.pipe';17import { IopsPipe } from './iops.pipe';18import { IscsiBackstorePipe } from './iscsi-backstore.pipe';19import { JoinPipe } from './join.pipe';20import { LogPriorityPipe } from './log-priority.pipe';21import { MapPipe } from './map.pipe';22import { MillisecondsPipe } from './milliseconds.pipe';23import { NotAvailablePipe } from './not-available.pipe';24import { OrdinalPipe } from './ordinal.pipe';25import { RbdConfigurationSourcePipe } from './rbd-configuration-source.pipe';26import { RelativeDatePipe } from './relative-date.pipe';27import { RoundPipe } from './round.pipe';28import { SanitizeHtmlPipe } from './sanitize-html.pipe';29import { TruncatePipe } from './truncate.pipe';30import { UpperFirstPipe } from './upper-first.pipe';31@NgModule({32  imports: [CommonModule],33  declarations: [34    ArrayPipe,35    BooleanPipe,36    BooleanTextPipe,37    DimlessBinaryPipe,38    DimlessBinaryPerSecondPipe,39    HealthColorPipe,40    DimlessPipe,41    CephShortVersionPipe,42    CephReleaseNamePipe,43    RelativeDatePipe,44    IscsiBackstorePipe,45    JoinPipe,46    LogPriorityPipe,47    FilterPipe,48    CdDatePipe,49    EmptyPipe,50    EncodeUriPipe,51    RoundPipe,52    OrdinalPipe,53    MillisecondsPipe,54    NotAvailablePipe,55    IopsPipe,56    UpperFirstPipe,57    RbdConfigurationSourcePipe,58    DurationPipe,59    MapPipe,60    TruncatePipe,61    SanitizeHtmlPipe62  ],63  exports: [64    ArrayPipe,65    BooleanPipe,66    BooleanTextPipe,67    DimlessBinaryPipe,68    DimlessBinaryPerSecondPipe,69    HealthColorPipe,70    DimlessPipe,71    CephShortVersionPipe,72    CephReleaseNamePipe,73    RelativeDatePipe,74    IscsiBackstorePipe,75    JoinPipe,76    LogPriorityPipe,77    FilterPipe,78    CdDatePipe,79    EmptyPipe,80    EncodeUriPipe,81    RoundPipe,82    OrdinalPipe,83    MillisecondsPipe,84    NotAvailablePipe,85    IopsPipe,86    UpperFirstPipe,87    RbdConfigurationSourcePipe,88    DurationPipe,89    MapPipe,90    TruncatePipe,91    SanitizeHtmlPipe92  ],93  providers: [94    ArrayPipe,95    BooleanPipe,96    BooleanTextPipe,97    DatePipe,98    CephShortVersionPipe,99    CephReleaseNamePipe,100    DimlessBinaryPipe,101    DimlessBinaryPerSecondPipe,102    DimlessPipe,103    RelativeDatePipe,104    IscsiBackstorePipe,105    JoinPipe,106    LogPriorityPipe,107    CdDatePipe,108    EmptyPipe,109    EncodeUriPipe,110    OrdinalPipe,111    IopsPipe,112    MillisecondsPipe,113    NotAvailablePipe,114    UpperFirstPipe,115    MapPipe,116    TruncatePipe,117    SanitizeHtmlPipe118  ]119})...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
