Best Python code snippet using localstack_python
env_json_fmarket.py
Source:env_json_fmarket.py  
1def ret():2    return {3        "name": "fmarket",4        "type": "env",5        "duration": 9223372036854775805,6        "pos": None,7        "attrs": {},8        "groups": [],9        "active": True,10        "type_sig": 0,11        "prim_group": None,12        "locator": None,13        "neighbors": None,14        "action_key": None,15        "members": {16            "value_investors": {17                "name": "value_investors",18                "type": "composite",19                "duration": 9223372036854775805,20                "pos": None,21                "attrs": {22                    "color": "blue"23                },24                "groups": [25                    "env"26                ],27                "active": True,28                "type_sig": 0,29                "prim_group": "env",30                "locator": None,31                "neighbors": None,32                "action_key": None,33                "members": {34                    "value_investors0": {35                        "name": "value_investors0",36                        "type": "agent",37                        "duration": 9223372036854775805,38                        "pos": [39                            23,40                            32341                        ],42                        "attrs": {43                            "low_price": 9.697977068257789,44                            "high_price": 10.76435978230952,45                            "capital": 836.0,46                            "num_stock": 2047                        },48                        "groups": [49                            "value_investors"50                        ],51                        "active": True,52                        "type_sig": 0,53                        "prim_group": "value_investors",54                        "locator": "env",55                        "neighbors": None,56                        "action_key": "value_investor_action"57                    },58                    "value_investors1": {59                        "name": "value_investors1",60                        "type": "agent",61                        "duration": 9223372036854775805,62                        "pos": [63                            254,64                            61365                        ],66                        "attrs": {67                            "low_price": 9.797890780155528,68                            "high_price": 10.7313892228899,69                            "capital": 836.0,70                            "num_stock": 2071                        },72                        "groups": [73                            "value_investors"74                        ],75                        "active": True,76                        "type_sig": 0,77                        "prim_group": "value_investors",78                        "locator": "env",79                        "neighbors": None,80                        "action_key": "value_investor_action"81                    },82                    "value_investors2": {83                        "name": "value_investors2",84                        "type": "agent",85                        "duration": 9223372036854775805,86                        "pos": [87                            840,88                            63689                        ],90                        "attrs": {91                            "low_price": 9.202257747042168,92                            "high_price": 10.356250610992745,93                            "capital": 836.0,94                            "num_stock": 2095                        },96                        "groups": [97                            "value_investors"98                        ],99                        "active": True,100                        "type_sig": 0,101                        "prim_group": "value_investors",102                        "locator": "env",103                        "neighbors": None,104                        "action_key": "value_investor_action"105                    },106                    "value_investors3": {107                        "name": "value_investors3",108                        "type": "agent",109                        "duration": 9223372036854775805,110                        "pos": [111                            848,112                            624113                        ],114                        "attrs": {115                            "low_price": 9.740326831366012,116                            "high_price": 10.217631217626241,117                            "capital": 836.0,118                            "num_stock": 20119                        },120                        "groups": [121                            "value_investors"122                        ],123                        "active": True,124                        "type_sig": 0,125                        "prim_group": "value_investors",126                        "locator": "env",127                        "neighbors": None,128                        "action_key": "value_investor_action"129                    },130                    "value_investors4": {131                        "name": "value_investors4",132                        "type": "agent",133                        "duration": 9223372036854775805,134                        "pos": [135                            581,136                            737137                        ],138                        "attrs": {139                            "low_price": 9.8110052760191,140                            "high_price": 10.282545981033952,141                            "capital": 836.0,142                            "num_stock": 20143                        },144                        "groups": [145                            "value_investors"146                        ],147                        "active": True,148                        "type_sig": 0,149                        "prim_group": "value_investors",150                        "locator": "env",151                        "neighbors": None,152                        "action_key": "value_investor_action"153                    },154                    "value_investors5": {155                        "name": "value_investors5",156                        "type": "agent",157                        "duration": 9223372036854775805,158                        "pos": [159                            589,160                            423161                        ],162                        "attrs": {163                            "low_price": 9.635799956537047,164                            "high_price": 10.212944807598168,165                            "capital": 836.0,166                            "num_stock": 20167                        },168                        "groups": [169                            "value_investors"170                        ],171                        "active": True,172                        "type_sig": 0,173                        "prim_group": "value_investors",174                        "locator": "env",175                        "neighbors": None,176                        "action_key": "value_investor_action"177                    },178                    "value_investors6": {179                        "name": "value_investors6",180                        "type": "agent",181                        "duration": 9223372036854775805,182                        "pos": [183                            949,184                            823185                        ],186                        "attrs": {187                            "low_price": 9.568596834001106,188                            "high_price": 10.649874090786597,189                            "capital": 836.0,190                            "num_stock": 20191                        },192                        "groups": [193                            "value_investors"194                        ],195                        "active": True,196                        "type_sig": 0,197                        "prim_group": "value_investors",198                        "locator": "env",199                        "neighbors": None,200                        "action_key": "value_investor_action"201                    },202                    "value_investors7": {203                        "name": "value_investors7",204                        "type": "agent",205                        "duration": 9223372036854775805,206                        "pos": [207                            566,208                            427209                        ],210                        "attrs": {211                            "low_price": 9.847792774398034,212                            "high_price": 10.241025624202916,213                            "capital": 836.0,214                            "num_stock": 20215                        },216                        "groups": [217                            "value_investors"218                        ],219                        "active": True,220                        "type_sig": 0,221                        "prim_group": "value_investors",222                        "locator": "env",223                        "neighbors": None,224                        "action_key": "value_investor_action"225                    },226                    "value_investors8": {227                        "name": "value_investors8",228                        "type": "agent",229                        "duration": 9223372036854775805,230                        "pos": [231                            654,232                            786233                        ],234                        "attrs": {235                            "low_price": 9.555661118756213,236                            "high_price": 10.157313061273394,237                            "capital": 836.0,238                            "num_stock": 20239                        },240                        "groups": [241                            "value_investors"242                        ],243                        "active": True,244                        "type_sig": 0,245                        "prim_group": "value_investors",246                        "locator": "env",247                        "neighbors": None,248                        "action_key": "value_investor_action"249                    },250                    "value_investors9": {251                        "name": "value_investors9",252                        "type": "agent",253                        "duration": 9223372036854775805,254                        "pos": [255                            201,256                            641257                        ],258                        "attrs": {259                            "low_price": 8.925377950028146,260                            "high_price": 10.042021835758668,261                            "capital": 836.0,262                            "num_stock": 20263                        },264                        "groups": [265                            "value_investors"266                        ],267                        "active": True,268                        "type_sig": 0,269                        "prim_group": "value_investors",270                        "locator": "env",271                        "neighbors": None,272                        "action_key": "value_investor_action"273                    }274                }275            },276            "trend_followers": {277                "name": "trend_followers",278                "type": "composite",279                "duration": 9223372036854775805,280                "pos": None,281                "attrs": {282                    "color": "red"283                },284                "groups": [285                    "env"286                ],287                "active": True,288                "type_sig": 0,289                "prim_group": "env",290                "locator": None,291                "neighbors": None,292                "action_key": None,293                "members": {294                    "trend_followers0": {295                        "name": "trend_followers0",296                        "type": "agent",297                        "duration": 9223372036854775805,298                        "pos": [299                            855,300                            36301                        ],302                        "attrs": {303                            "change_period": 3.074875542987271,304                            "capital": 1000,305                            "num_stock": 0306                        },307                        "groups": [308                            "trend_followers"309                        ],310                        "active": True,311                        "type_sig": 0,312                        "prim_group": "trend_followers",313                        "locator": "env",314                        "neighbors": None,315                        "action_key": "trend_follower_action"316                    },317                    "trend_followers1": {318                        "name": "trend_followers1",319                        "type": "agent",320                        "duration": 9223372036854775805,321                        "pos": [322                            703,323                            379324                        ],325                        "attrs": {326                            "change_period": 3.0647943035419467,327                            "capital": 1000,328                            "num_stock": 0329                        },330                        "groups": [331                            "trend_followers"332                        ],333                        "active": True,334                        "type_sig": 0,335                        "prim_group": "trend_followers",336                        "locator": "env",337                        "neighbors": None,338                        "action_key": "trend_follower_action"339                    },340                    "trend_followers2": {341                        "name": "trend_followers2",342                        "type": "agent",343                        "duration": 9223372036854775805,344                        "pos": [345                            694,346                            285347                        ],348                        "attrs": {349                            "change_period": 2.996366873333262,350                            "capital": 1000,351                            "num_stock": 0352                        },353                        "groups": [354                            "trend_followers"355                        ],356                        "active": True,357                        "type_sig": 0,358                        "prim_group": "trend_followers",359                        "locator": "env",360                        "neighbors": None,361                        "action_key": "trend_follower_action"362                    },363                    "trend_followers3": {364                        "name": "trend_followers3",365                        "type": "agent",366                        "duration": 9223372036854775805,367                        "pos": [368                            270,369                            658370                        ],371                        "attrs": {372                            "change_period": 3.048043216214639,373                            "capital": 1000,374                            "num_stock": 0375                        },376                        "groups": [377                            "trend_followers"378                        ],379                        "active": True,380                        "type_sig": 0,381                        "prim_group": "trend_followers",382                        "locator": "env",383                        "neighbors": None,384                        "action_key": "trend_follower_action"385                    },386                    "trend_followers4": {387                        "name": "trend_followers4",388                        "type": "agent",389                        "duration": 9223372036854775805,390                        "pos": [391                            449,392                            816393                        ],394                        "attrs": {395                            "change_period": 2.957194807550735,396                            "capital": 1000,397                            "num_stock": 0398                        },399                        "groups": [400                            "trend_followers"401                        ],402                        "active": True,403                        "type_sig": 0,404                        "prim_group": "trend_followers",405                        "locator": "env",406                        "neighbors": None,407                        "action_key": "trend_follower_action"408                    },409                    "trend_followers5": {410                        "name": "trend_followers5",411                        "type": "agent",412                        "duration": 9223372036854775805,413                        "pos": [414                            854,415                            228416                        ],417                        "attrs": {418                            "change_period": 3.0860292998837804,419                            "capital": 1000,420                            "num_stock": 0421                        },422                        "groups": [423                            "trend_followers"424                        ],425                        "active": True,426                        "type_sig": 0,427                        "prim_group": "trend_followers",428                        "locator": "env",429                        "neighbors": None,430                        "action_key": "trend_follower_action"431                    },432                    "trend_followers6": {433                        "name": "trend_followers6",434                        "type": "agent",435                        "duration": 9223372036854775805,436                        "pos": [437                            667,438                            72439                        ],440                        "attrs": {441                            "change_period": 3.0165944064781414,442                            "capital": 1000,443                            "num_stock": 0444                        },445                        "groups": [446                            "trend_followers"447                        ],448                        "active": True,449                        "type_sig": 0,450                        "prim_group": "trend_followers",451                        "locator": "env",452                        "neighbors": None,453                        "action_key": "trend_follower_action"454                    },455                    "trend_followers7": {456                        "name": "trend_followers7",457                        "type": "agent",458                        "duration": 9223372036854775805,459                        "pos": [460                            388,461                            697462                        ],463                        "attrs": {464                            "change_period": 3.0688350539583027,465                            "capital": 1000,466                            "num_stock": 0467                        },468                        "groups": [469                            "trend_followers"470                        ],471                        "active": True,472                        "type_sig": 0,473                        "prim_group": "trend_followers",474                        "locator": "env",475                        "neighbors": None,476                        "action_key": "trend_follower_action"477                    },478                    "trend_followers8": {479                        "name": "trend_followers8",480                        "type": "agent",481                        "duration": 9223372036854775805,482                        "pos": [483                            913,484                            823485                        ],486                        "attrs": {487                            "change_period": 3.0765623690389745,488                            "capital": 1000,489                            "num_stock": 0490                        },491                        "groups": [492                            "trend_followers"493                        ],494                        "active": True,495                        "type_sig": 0,496                        "prim_group": "trend_followers",497                        "locator": "env",498                        "neighbors": None,499                        "action_key": "trend_follower_action"500                    },501                    "trend_followers9": {502                        "name": "trend_followers9",503                        "type": "agent",504                        "duration": 9223372036854775805,505                        "pos": [506                            59,507                            628508                        ],509                        "attrs": {510                            "change_period": 2.9597196644664754,511                            "capital": 1000,512                            "num_stock": 0513                        },514                        "groups": [515                            "trend_followers"516                        ],517                        "active": True,518                        "type_sig": 0,519                        "prim_group": "trend_followers",520                        "locator": "env",521                        "neighbors": None,522                        "action_key": "trend_follower_action"523                    },524                    "trend_followers10": {525                        "name": "trend_followers10",526                        "type": "agent",527                        "duration": 9223372036854775805,528                        "pos": [529                            545,530                            590531                        ],532                        "attrs": {533                            "change_period": 2.9907449888493165,534                            "capital": 1000,535                            "num_stock": 0536                        },537                        "groups": [538                            "trend_followers"539                        ],540                        "active": True,541                        "type_sig": 0,542                        "prim_group": "trend_followers",543                        "locator": "env",544                        "neighbors": None,545                        "action_key": "trend_follower_action"546                    },547                    "trend_followers11": {548                        "name": "trend_followers11",549                        "type": "agent",550                        "duration": 9223372036854775805,551                        "pos": [552                            133,553                            744554                        ],555                        "attrs": {556                            "change_period": 2.990277188037477,557                            "capital": 1000,558                            "num_stock": 0559                        },560                        "groups": [561                            "trend_followers"562                        ],563                        "active": True,564                        "type_sig": 0,565                        "prim_group": "trend_followers",566                        "locator": "env",567                        "neighbors": None,568                        "action_key": "trend_follower_action"569                    },570                    "trend_followers12": {571                        "name": "trend_followers12",572                        "type": "agent",573                        "duration": 9223372036854775805,574                        "pos": [575                            322,576                            510577                        ],578                        "attrs": {579                            "change_period": 3.0411885087116777,580                            "capital": 1000,581                            "num_stock": 0582                        },583                        "groups": [584                            "trend_followers"585                        ],586                        "active": True,587                        "type_sig": 0,588                        "prim_group": "trend_followers",589                        "locator": "env",590                        "neighbors": None,591                        "action_key": "trend_follower_action"592                    },593                    "trend_followers13": {594                        "name": "trend_followers13",595                        "type": "agent",596                        "duration": 9223372036854775805,597                        "pos": [598                            847,599                            197600                        ],601                        "attrs": {602                            "change_period": 2.9859549017098455,603                            "capital": 1000,604                            "num_stock": 0605                        },606                        "groups": [607                            "trend_followers"608                        ],609                        "active": True,610                        "type_sig": 0,611                        "prim_group": "trend_followers",612                        "locator": "env",613                        "neighbors": None,614                        "action_key": "trend_follower_action"615                    },616                    "trend_followers14": {617                        "name": "trend_followers14",618                        "type": "agent",619                        "duration": 9223372036854775805,620                        "pos": [621                            199,622                            810623                        ],624                        "attrs": {625                            "change_period": 3.004223188810017,626                            "capital": 1000,627                            "num_stock": 0628                        },629                        "groups": [630                            "trend_followers"631                        ],632                        "active": True,633                        "type_sig": 0,634                        "prim_group": "trend_followers",635                        "locator": "env",636                        "neighbors": None,637                        "action_key": "trend_follower_action"638                    },639                    "trend_followers15": {640                        "name": "trend_followers15",641                        "type": "agent",642                        "duration": 9223372036854775805,643                        "pos": [644                            27,645                            931646                        ],647                        "attrs": {648                            "change_period": 2.921949748423732,649                            "capital": 1000,650                            "num_stock": 0651                        },652                        "groups": [653                            "trend_followers"654                        ],655                        "active": True,656                        "type_sig": 0,657                        "prim_group": "trend_followers",658                        "locator": "env",659                        "neighbors": None,660                        "action_key": "trend_follower_action"661                    },662                    "trend_followers16": {663                        "name": "trend_followers16",664                        "type": "agent",665                        "duration": 9223372036854775805,666                        "pos": [667                            306,668                            841669                        ],670                        "attrs": {671                            "change_period": 3.0221248716646105,672                            "capital": 1000,673                            "num_stock": 0674                        },675                        "groups": [676                            "trend_followers"677                        ],678                        "active": True,679                        "type_sig": 0,680                        "prim_group": "trend_followers",681                        "locator": "env",682                        "neighbors": None,683                        "action_key": "trend_follower_action"684                    },685                    "trend_followers17": {686                        "name": "trend_followers17",687                        "type": "agent",688                        "duration": 9223372036854775805,689                        "pos": [690                            730,691                            256692                        ],693                        "attrs": {694                            "change_period": 3.002940455245435,695                            "capital": 1000,696                            "num_stock": 0697                        },698                        "groups": [699                            "trend_followers"700                        ],701                        "active": True,702                        "type_sig": 0,703                        "prim_group": "trend_followers",704                        "locator": "env",705                        "neighbors": None,706                        "action_key": "trend_follower_action"707                    },708                    "trend_followers18": {709                        "name": "trend_followers18",710                        "type": "agent",711                        "duration": 9223372036854775805,712                        "pos": [713                            762,714                            833715                        ],716                        "attrs": {717                            "change_period": 3.070466591299514,718                            "capital": 1000,719                            "num_stock": 0720                        },721                        "groups": [722                            "trend_followers"723                        ],724                        "active": True,725                        "type_sig": 0,726                        "prim_group": "trend_followers",727                        "locator": "env",728                        "neighbors": None,729                        "action_key": "trend_follower_action"730                    },731                    "trend_followers19": {732                        "name": "trend_followers19",733                        "type": "agent",734                        "duration": 9223372036854775805,735                        "pos": [736                            772,737                            428738                        ],739                        "attrs": {740                            "change_period": 3.001088920677305,741                            "capital": 1000,742                            "num_stock": 0743                        },744                        "groups": [745                            "trend_followers"746                        ],747                        "active": True,748                        "type_sig": 0,749                        "prim_group": "trend_followers",750                        "locator": "env",751                        "neighbors": None,752                        "action_key": "trend_follower_action"753                    }754                }755            },756            "market_maker": {757                "name": "market_maker",758                "type": "agent",759                "duration": 9223372036854775805,760                "pos": [761                    285,762                    332763                ],764                "attrs": {765                    "buy": 0,766                    "sell": 0,767                    "asset_price": 8.8,768                    "prev_asset_price": 8.4,769                    "price_hist": [770                        8,771                        8.4,772                        8.8773                    ]774                },775                "groups": [776                    "env"777                ],778                "active": True,779                "type_sig": 0,780                "prim_group": "env",781                "locator": "env",782                "neighbors": None,783                "action_key": "market_maker_action"784            }785        },786        "width": 1000,787        "height": 1000,788        "locations": {789            "value_investors0": [790                23,791                323792            ],793            "value_investors1": [794                254,795                613796            ],797            "value_investors2": [798                840,799                636800            ],801            "value_investors3": [802                848,803                624804            ],805            "value_investors4": [806                581,807                737808            ],809            "value_investors5": [810                589,811                423812            ],813            "value_investors6": [814                949,815                823816            ],817            "value_investors7": [818                566,819                427820            ],821            "value_investors8": [822                654,823                786824            ],825            "value_investors9": [826                201,827                641828            ],829            "trend_followers0": [830                855,831                36832            ],833            "trend_followers1": [834                703,835                379836            ],837            "trend_followers2": [838                694,839                285840            ],841            "trend_followers3": [842                270,843                658844            ],845            "trend_followers4": [846                449,847                816848            ],849            "trend_followers5": [850                854,851                228852            ],853            "trend_followers6": [854                667,855                72856            ],857            "trend_followers7": [858                388,859                697860            ],861            "trend_followers8": [862                913,863                823864            ],865            "trend_followers9": [866                59,867                628868            ],869            "trend_followers10": [870                545,871                590872            ],873            "trend_followers11": [874                133,875                744876            ],877            "trend_followers12": [878                322,879                510880            ],881            "trend_followers13": [882                847,883                197884            ],885            "trend_followers14": [886                199,887                810888            ],889            "trend_followers15": [890                27,891                931892            ],893            "trend_followers16": [894                306,895                841896            ],897            "trend_followers17": [898                730,899                256900            ],901            "trend_followers18": [902                762,903                833904            ],905            "trend_followers19": [906                772,907                428908            ],909            "market_maker": [910                285,911                332912            ]913        },914        "user": {915            "user_msgs": "",916            "name": "ziruizhou"917        },918        "census_func": None,919        "plot_title": "env",920        "props": {921            "value_investors": {922                "val": 10,923                "question": "How many value investors do you want?",924                "atype": "INT",925                "lowval": 1,926                "hival": 1000927            },928            "discount": {929                "val": 0.01,930                "question":931                    "What % discount from 'True value' do the value investors "932                    "want?",933                "atype": "DBL",934                "lowval": 0.01,935                "hival": 0.5936            },937            "deviation_investor": {938                "val": 0.05,939                "question": "What is the std deviation of that discount?",940                "atype": "DBL",941                "lowval": 0.001,942                "hival": 0.5943            },944            "trend_followers": {945                "val": 20,946                "question": "How many trend followers do you want?",947                "atype": "INT",948                "lowval": 1,949                "hival": 1000950            },951            "average_period": {952                "val": 3.0,953                "question":954                    "What average number of periods do the trend followers "955                    "want?",956                "atype": "DBL",957                "lowval": 1,958                "hival": 100959            },960            "deviation_follower": {961                "val": 0.05,962                "question":963                    "What is the std deviation of that average number of "964                    "periods?",965                "atype": "DBL",966                "lowval": 0.001,967                "hival": 0.5968            },969            "use_scatter": {970                "val": True,971                "question": None,972                "atype": None,973                "lowval": None,974                "hival": None975            },976            "user_type": {977                "val": "terminal",978                "question": None,979                "atype": None,980                "lowval": None,981                "hival": None982            },983            "OS": {984                "val": "Darwin",985                "question": None,986                "atype": None,987                "lowval": None,988                "hival": None989            },990            "use_line": {991                "val": True,992                "question": None,993                "atype": None,994                "lowval": None,995                "hival": None996            }997        },998        "pop_hist": {999            "periods": 2,1000            "pops": {1001                "value_investors": [1002                    10,1003                    10,1004                    101005                ],1006                "trend_followers": [1007                    20,1008                    20,1009                    201010                ],1011                "market_maker": [1012                    1,1013                    0,1014                    01015                ]1016            }1017        },1018        "womb": [],1019        "switches": [],1020        "data_func": None,1021        "registry": {}...gui.py
Source:gui.py  
...21                self.no_refresh.acquire()22            time.sleep(self.period)23            data.update()24    @Slot(float)25    def change_period(self, period):26        print(period)27        # JeÅli timer jest zatrzymany to go wznawiam28        if self.period == 0 and period != 0:29            self.no_refresh.release()30        self.period = period31    @Slot()32    def refresh_now(self):33        data.update()34class MainWindow(QMainWindow):35    """ GÅówne okno aplikacji """36    WINDOW_TITLE = "Task Manager"37    WINDOW_WIDTH = 100038    WINDOW_HEIGHT = 60039    def __init__(self):...masking_rules.py
Source:masking_rules.py  
1import random2import numpy as np3from abc import ABC, abstractmethod4class MaskingRule(ABC):5    @abstractmethod6    def mask(self, spec: np.array) -> np.array:7        pass8    @abstractmethod9    def unmask(self, spec: np.array) -> np.array:10        pass11class OffsetMaskingRule(MaskingRule):12    def __init__(self, offset):13        if offset <= 0:14            raise Exception(f"Offset must be positive! Received {offset}")15        self.offset = offset16    def mask(self, spec: np.array) -> np.array:17        spec[:-self.offset] = spec[self.offset:]18        spec[-self.offset:] = 019        return spec20    def unmask(self, spec: np.array) -> np.array:21        spec[self.offset:] = spec[:-self.offset]22        spec[:self.offset] = 023        return spec24class RandomOffsetMaskingRule(MaskingRule):25    def __init__(self, offset_min, offset_max, change_period):26        if offset_min <= 0 or offset_max <= 0:27            raise Exception(f"Offset must be positive! Received {offset_min}, {offset_max}")28        if change_period <= 0:29            raise Exception(f"Change period must be positive! Received {change_period}")30        self.offset_min = offset_min31        self.offset_max = offset_max32        self.change_period = change_period33        self._prev_offset = None34        self._next_offset = None35        self._current_step = 036        self.__generate_offset()37    def mask(self, spec: np.array) -> np.array:38        if self._current_step == self.change_period:39            self.__generate_offset()40        offset = self.__get_current_offset()41        offset = random.randint(self.offset_min, self.offset_max)42        self._current_step += 143        spec[:-offset] = spec[offset:]44        spec[-offset:] = 045        return spec46    def unmask(self, spec: np.array) -> np.array:47        offset = (self.offset_min + self.offset_max) // 248        spec[offset:] = spec[:-offset]49        spec[:offset] = 050        return spec51    def __get_current_offset(self):52        range = self._next_offset - self._prev_offset53        delta = int(range * self._current_step / self.change_period)54        return self._prev_offset + delta55    def __generate_offset(self):56        self._prev_offset = self._next_offset57        self._next_offset = random.randint(self.offset_min, self.offset_max)58        if not self._prev_offset:59            self._prev_offset = random.randint(self.offset_min, self.offset_max)...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!!
