Best Python code snippet using fMBT_python
cube.py
Source:cube.py  
...100                mat[i][j] = mat[N - i - 1][j]101                mat[N - i - 1][j] = temp    102    def rotateR(self, rotation, total):103        if(rotation == "R"):104            ext = [total[3][0][0].getColor(), total[3][0][1].getColor(), total[3][0][2].getColor()]105            for i in range(3):106                total[3][0][i].setColor(total[5][2][2 - i].getColor())107            108            for i in range(3):109                total[5][2][i].setColor(total[1][2][i].getColor())110            for i in range(3):111                total[1][2][i].setColor(total[4][2][i].getColor())112            113            for i in range(3):114                total[4][2][i].setColor(ext[2 - i])115                116            self.rotateFaceAntiClockwise(total[2], 3)117            118        else:119            ext = [total[1][2][0].getColor(), total[1][2][1].getColor(), total[1][2][2].getColor()]120            for i in range(3):121                total[1][2][i].setColor(total[5][2][i].getColor())      122            for i in range(3):123                total[5][2][i].setColor(total[3][0][2 - i].getColor())124            for i in range(3):125                total[3][0][i].setColor(total[4][2][2 - i].getColor())126              127            for i in range(3):128                total[4][2][i].setColor(ext[i])129            self.rotateFaceClockwise(total[2], 3)130    def rotateL(self, rotation, total):131        if(rotation == "L"):132            ext = [total[1][0][0].getColor(), total[1][0][1].getColor(), total[1][0][2].getColor()]133            for i in range(3):134                total[1][0][i].setColor(total[5][0][i].getColor())      135            for i in range(3):136                total[5][0][i].setColor(total[3][2][2 - i].getColor())137            for i in range(3):138                total[3][2][i].setColor(total[4][0][2 - i].getColor())139              140            for i in range(3):141                total[4][0][i].setColor(ext[i])142            143            self.rotateFaceAntiClockwise(total[0], 3)144        else:145            ext = [total[3][2][0].getColor(), total[3][2][1].getColor(), total[3][2][2].getColor()]146            for i in range(3):147                total[3][2][i].setColor(total[5][0][2 - i].getColor())148            149            for i in range(3):150                total[5][0][i].setColor(total[1][0][i].getColor())151            for i in range(3):152                total[1][0][i].setColor(total[4][0][i].getColor())153            154            for i in range(3):155                total[4][0][i].setColor(ext[2 - i])156            157            self.rotateFaceClockwise(total[0], 3)158    def rotateU(self, rotation, total):159        if(rotation == "U"):160            ext = [total[2][0][0].getColor(), total[2][1][0].getColor(), total[2][2][0].getColor()]161            for i in range(3):       162                total[2][i][0].setColor(total[3][i][0].getColor())  163            164            for i in range(3):165                total[3][i][0].setColor(total[0][i][0].getColor())166            for i in range(3):167                total[0][i][0].setColor(total[1][i][0].getColor())168            for i in range(3):169                total[1][i][0].setColor(ext[i])170            self.rotateFaceAntiClockwise(total[5], 3)171        else:172            ext = [total[0][0][0].getColor(), total[0][1][0].getColor(), total[0][2][0].getColor()]173            for i in range(3):174                total[0][i][0].setColor(total[3][i][0].getColor())  175            176            for i in range(3):177                total[3][i][0].setColor(total[2][i][0].getColor())178            179            for i in range(3):180                total[2][i][0].setColor(total[1][i][0].getColor())181            182            for i in range(3):183                total[1][i][0].setColor(ext[i])184            self.rotateFaceClockwise(total[5], 3)185    def rotateD(self, rotation, total):186        if(rotation == "D"):187            ext = [total[0][0][2].getColor(), total[0][1][2].getColor(), total[0][2][2].getColor()]188            for i in range(3):189                total[0][i][2].setColor(total[3][i][2].getColor())  190            191            for i in range(3):192                total[3][i][2].setColor(total[2][i][2].getColor())193            194            for i in range(3):195                total[2][i][2].setColor(total[1][i][2].getColor())196            197            for i in range(3):198                total[1][i][2].setColor(ext[i])199            self.rotateFaceAntiClockwise(total[4], 3)200        else:201            ext = [total[2][0][2].getColor(), total[2][1][2].getColor(), total[2][2][2].getColor()]202            for i in range(3):       203                total[2][i][2].setColor(total[3][i][2].getColor())  204            205            for i in range(3):206                total[3][i][2].setColor(total[0][i][2].getColor())207            for i in range(3):208                total[0][i][2].setColor(total[1][i][2].getColor())209            for i in range(3):210                total[1][i][2].setColor(ext[i])211            self.rotateFaceClockwise(total[4], 3)212    def rotateF(self, rotation, total):213        if(rotation == "F"):214            ext = [total[2][0][0].getColor(), total[2][0][1].getColor(), total[2][0][2].getColor()]215            for i in range(3):216                total[2][0][i].setColor(total[5][i][2].getColor())217            for i in range(3):       218                total[5][i][2].setColor(total[0][2][2 - i].getColor())  219                220            for i in range(3):221                total[0][2][i].setColor(total[4][i][0].getColor())   222            for i in range(3):223                total[4][2 - i][0].setColor(ext[i])224            225            self.rotateFaceAntiClockwise(total[1], 3)226        else:227            ext = [total[0][2][0].getColor(), total[0][2][1].getColor(), total[0][2][2].getColor()]228            for i in range(3):229                total[0][2][2 - i].setColor(total[5][i][2].getColor())230            for i in range(3):       231                total[5][i][2].setColor(total[2][0][i].getColor())  232                233            for i in range(3):234                total[2][0][2 - i].setColor(total[4][i][0].getColor())   235            for i in range(3):236                total[4][i][0].setColor(ext[i])237            self.rotateFaceClockwise(total[1], 3)238    def rotateB(self, rotation, total):239        if(rotation == "B"):240            ext = [total[0][0][0].getColor(), total[0][0][1].getColor(), total[0][0][2].getColor()]241            for i in range(3):242                total[0][0][2 - i].setColor(total[5][i][0].getColor())243            for i in range(3):       244                total[5][i][0].setColor(total[2][2][i].getColor())  245                246            for i in range(3):247                total[2][2][2 - i].setColor(total[4][i][2].getColor())   248            for i in range(3):249                total[4][i][2].setColor(ext[i])250            251            self.rotateFaceAntiClockwise(total[3], 3)252            253        else:254            ext = [total[2][2][0].getColor(), total[2][2][1].getColor(), total[2][2][2].getColor()]255            for i in range(3):256                total[2][2][i].setColor(total[5][i][0].getColor())257            for i in range(3):       258                total[5][2 - i][0].setColor(total[0][0][i].getColor())  259                260            for i in range(3):261                total[0][0][i].setColor(total[4][i][2].getColor())   262            for i in range(3):263                total[4][2 - i][2].setColor(ext[i])264            self.rotateFaceClockwise(total[3], 3)265        266    def rotateM(self, rotation, total):267        if(rotation == "M"):268            ext = [total[3][1][0].getColor(), total[3][1][1].getColor(), total[3][1][2].getColor()]269            for i in range(3):270                total[3][1][i].setColor(total[5][1][2 - i].getColor())271            272            for i in range(3):273                total[5][1][i].setColor(total[1][1][i].getColor())274            for i in range(3):275                total[1][1][i].setColor(total[4][1][i].getColor())276            277            for i in range(3):278                total[4][1][i].setColor(ext[2 - i])279                280            281        else:282            ext = [total[1][1][0].getColor(), total[1][1][1].getColor(), total[1][1][2].getColor()]283            for i in range(3):284                total[1][1][i].setColor(total[5][1][i].getColor())      285            for i in range(3):286                total[5][1][i].setColor(total[3][1][2 - i].getColor())287            for i in range(3):288                total[3][1][i].setColor(total[4][1][2 - i].getColor())289              290            for i in range(3):...sparkline-init.js
Source:sparkline-init.js  
1var gridbordercolor = "#eee";2var InitiateSparklineCharts = function () {3    return {4        init: function () {5            /*Bar*/6            var sparklinebars = $('[data-sparkline=bar]');7            $.each(sparklinebars, function () {8                $(this).sparkline('html', {9                    type: 'bar',10                    disableHiddenCheck: true,11                    height: $(this).data('height'),12                    width: $(this).data('width'),13                    barColor: getcolor($(this).data('barcolor')),14                    negBarColor: getcolor($(this).data('negbarcolor')),15                    zeroColor: getcolor($(this).data('zerocolor')),16                    barWidth: $(this).data('barwidth'),17                    barSpacing: $(this).data('barspacing'),18                    stackedBarColor: $(this).data('stackedbarcolor')19                });20            });21            /*Line*/22            var sparklinelines = $('[data-sparkline=line]');23            $.each(sparklinelines, function () {24                $(this).sparkline('html', {25                    type: 'line',26                    disableHiddenCheck: true,27                    height: $(this).data('height'),28                    width: $(this).data('width'),29                    fillColor: getcolor($(this).data('fillcolor')),30                    lineColor: getcolor($(this).data('linecolor')),31                    spotRadius: $(this).data('spotradius'),32                    lineWidth: $(this).data('linewidth'),33                    spotColor: getcolor($(this).data('spotcolor')),34                    minSpotColor: getcolor($(this).data('minspotcolor')),35                    maxSpotColor: getcolor($(this).data('maxspotcolor')),36                    highlightSpotColor: getcolor($(this).data('highlightspotcolor')),37                    highlightLineColor: getcolor($(this).data('highlightlinecolor'))38                });39            });40            /*Composite Line*/41            var sparklinecompositelines = $('[data-sparkline=compositeline]');42            $.each(sparklinecompositelines, function () {43                $(this).sparkline('html', {44                    type: 'line',45                    disableHiddenCheck: true,46                    height: $(this).data('height'),47                    width: $(this).data('width'),48                    lineColor: getcolor($(this).data('linecolor')),49                    fillColor: getcolor($(this).data('fillcolor')),50                    spotRadius: $(this).data('spotradius'),51                    lineWidth: $(this).data('linewidth'),52                    spotColor: getcolor($(this).data('spotcolor')),53                    minSpotColor: getcolor($(this).data('minspotcolor')),54                    maxSpotColor: getcolor($(this).data('maxspotcolor')),55                    highlightSpotColor: getcolor($(this).data('highlightspotcolor')),56                    highlightLineColor: getcolor($(this).data('highlightlinecolor'))57                });58                $(this).sparkline(stringtoarray($(this).attr("data-composite")), {59                    type: 'line',60                    disableHiddenCheck: true,61                    height: $(this).data('height'),62                    width: $(this).data('width'),63                    lineColor: getcolor($(this).data('secondlinecolor')),64                    fillColor: getcolor($(this).data('secondfillcolor')),65                    lineWidth: $(this).data('secondlinewidth'),66                    spotRadius: $(this).data('spotradius'),67                    spotColor: getcolor($(this).data('spotcolor')),68                    minSpotColor: getcolor($(this).data('minspotcolor')),69                    maxSpotColor: getcolor($(this).data('maxspotcolor')),70                    highlightSpotColor: getcolor($(this).data('highlightspotcolor')),71                    highlightLineColor: getcolor($(this).data('highlightlinecolor')),72                    composite: true73                });74            });75            /*Composite Bar*/76            var sparklinecompositebars = $('[data-sparkline=compositebar]');77            $.each(sparklinecompositebars, function () {78                $(this).sparkline('html', {79                    type: 'bar',80                    disableHiddenCheck: true,81                    height: $(this).data('height'),82                    width: $(this).data('width'),83                    barColor: getcolor($(this).data('barcolor')),84                    negBarColor: getcolor($(this).data('negbarcolor')),85                    zeroColor: getcolor($(this).data('zerocolor')),86                    barWidth: $(this).data('barwidth'),87                    barSpacing: $(this).data('barspacing'),88                    stackedBarColor: getcolor($(this).data('stackedbarcolor'))89                });90                $(this).sparkline(stringtoarray($(this).attr("data-composite")), {91                    type: 'line',92                    height: $(this).data('height'),93                    disableHiddenCheck: true,94                    width: $(this).data('width'),95                    lineColor: getcolor($(this).data('linecolor')),96                    fillColor: getcolor($(this).data('fillcolor')),97                    spotRadius: $(this).data('spotradius'),98                    lineWidth: $(this).data('linewidth'),99                    spotRadius: $(this).data('spotradius'),100                    spotColor: getcolor($(this).data('spotcolor')),101                    minSpotColor: getcolor($(this).data('minspotcolor')),102                    maxSpotColor: getcolor($(this).data('maxspotcolor')),103                    highlightSpotColor: getcolor($(this).data('highlightspotcolor')),104                    highlightLineColor: getcolor($(this).data('highlightlinecolor')),105                    composite: true106                });107            });108            /*Tristate*/109            var sparklinetristates = $('[data-sparkline=tristate]');110            $.each(sparklinetristates, function () {111                $(this).sparkline('html', {112                    type: 'tristate',113                    disableHiddenCheck: true,114                    height: $(this).data('height'),115                    width: $(this).data('width'),116                    posBarColor: getcolor($(this).data('posbarcolor')),117                    negBarColor: getcolor($(this).data('negbarcolor')),118                    zeroBarColor: getcolor($(this).data('zerobarcolor')),119                    barWidth: $(this).data('barwidth'),120                    barSpacing: $(this).data('barspacing'),121                    zeroAxis: $(this).data('zeroaxis')122                });123            });124            /*Descrete*/125            var sparklinediscretes = $('[data-sparkline=discrete]');126            $.each(sparklinediscretes, function () {127                $(this).sparkline('html', {128                    type: 'discrete',129                    disableHiddenCheck: true,130                    lineHeight: $(this).data('lineheight'),131                    lineColor: getcolor($(this).data('linecolor')),132                    thresholdValue: $(this).data('thresholdvalue'),133                    thresholdColor: $(this).data('thresholdcolor')134                });135            });136            /*Bullet*/137            var sparklinebullets = $('[data-sparkline=bullet]');138            $.each(sparklinebullets, function () {139                $(this).sparkline('html', {140                    type: 'bullet',141                    disableHiddenCheck: true,142                    targetColor: $(this).data('targetcolor'),143                    performanceColor: $(this).data('performancecolor'),144                    rangeColors: $(this).data('rangecolors')145                });146            });147            /*Box Plot*/148            var sparklinebox = $('[data-sparkline=box]');149            $.each(sparklinebox, function () {150                $(this).sparkline('html', {151                    type: 'box',152                    disableHiddenCheck: true,153                });154            });155            /*Pie*/156            var sparklinepie = $('[data-sparkline=pie]');157            $.each(sparklinepie, function () {158                $(this).sparkline('html', {159                    type: 'pie',160                    disableHiddenCheck: true,161                    width: $(this).data('width'),162                    height: $(this).data('height'),163                    sliceColors: $(this).data('slicecolors'),164                    borderColor: getcolor($(this).data('bordercolor'))165                });166            });167        }168    };169}();170function stringtoarray(str) {171    var myArray = str.split(",");172    for (var i = 0; i < myArray.length; i++) {173        myArray[i] = +myArray[i];174    }175    for (var i = 0; i < myArray.length; i++) {176        myArray[i] = parseInt(myArray[i], 10);177    }178    return myArray;...rootcolors.py
Source:rootcolors.py  
1from ROOT import TColor, gROOT2kWhite      = 0     #FFFFFF3kBlack      = 1     #0000004kGray       = 920   #CCCCCC5kRed        = 632   #FF00006kPink       = 900   #FF00337kMagenta    = 616   #FF00FF8kViolet     = 880   #CC00FF9kBlue       = 600   #0000FF10kAzure      = 860   #0033FF11kCyan       = 432   #00FFFF12kTeal       = 840   #00FFCC13kGreen      = 416   #00FF0014kSpring     = 820   #33FF0015kYellow     = 400   #FFFF0016kOrange     = 800   #FFCC0017kBird       = 5718kViridis    = 11219def get_color_hex(col):20    return gROOT.GetColor(col).AsHexString()21def lighten_color(col, percent):22    # This is not accurate. If accuracy is important, convert to HSL23    col_hex = get_color_hex(col)24    col_hex = int(col_hex.replace('#','0x'),16)25    r = (col_hex >> 16) + round(percent * 0.01 * 255)26    g = ((col_hex >> 8) & 0xFF) + round(percent * 0.01 * 255)27    b = (col_hex & 0xFF) + round(percent * 0.01 * 255)28    r = 0 if r<0 else 255 if r>255 else r29    g = 0 if g<0 else 255 if g>255 else g30    b = 0 if b<0 else 255 if b>255 else b31    col_hex = '#%02x%02x%02x' % (r,g,b)32    return TColor.GetColor(col_hex)33def darken_color(col, percent):34    return lighten_color(col, -percent)35#TColor.InitializeColors()36kRed2       = TColor.GetColor("#C02020")37kGreen2     = TColor.GetColor("#20C020")38kBlue2      = TColor.GetColor("#2020C0")39kCyan2      = TColor.GetColor("#20C0C0")40kMagenta2   = TColor.GetColor("#C020C0")41kYellow2    = TColor.GetColor("#C0C020")42kOrange2    = TColor.GetColor("#FFA533")43kGray2      = TColor.GetColor("#E8E8E8")44kYellow3    = TColor.GetColor("#BFAF00")45kOrange3    = TColor.GetColor("#FF9900")46kPurple2    = TColor.GetColor("#800080")47kOlive2     = TColor.GetColor("#808000")48kTeal2      = TColor.GetColor("#008080")49kMaroon2    = TColor.GetColor("#800000")50kNavy2      = TColor.GetColor("#000080")51kLime2      = TColor.GetColor("#008000")52kGold2      = TColor.GetColor("#DAA520")53kSalmon2    = TColor.GetColor("#FA8072")54kPistachio2 = TColor.GetColor("#93C572")55kBrown2     = TColor.GetColor("#964B00")56kCocoa2     = TColor.GetColor("#D2691E")57kTurquoise2 = TColor.GetColor("#40E0D0")58kQuark      = TColor.GetColor("#EA6699")59kLepton     = TColor.GetColor("#608060")60kBoson      = TColor.GetColor("#20ABBF")61kFermion    = TColor.GetColor("#D67F20")62# from http://ethanschoonover.com/solarized63# https://github.com/altercation/ethanschoonover.com/blob/master/resources/css/style.css64sBase03     = TColor.GetColor("#002b36")65sBase02     = TColor.GetColor("#073642")66sBase01     = TColor.GetColor("#586e75")67sBase00     = TColor.GetColor("#657b83")68sBase0      = TColor.GetColor("#839496")69sBase1      = TColor.GetColor("#93a1a1")70sBase2      = TColor.GetColor("#eee8d5")71sBase3      = TColor.GetColor("#fdf6e3")72sYellow     = TColor.GetColor("#b58900")73sOrange     = TColor.GetColor("#cb4b16")74sRed        = TColor.GetColor("#dc322f")75sMagenta    = TColor.GetColor("#d33682")76sViolet     = TColor.GetColor("#6c71c4")77sBlue       = TColor.GetColor("#268bd2")78sCyan       = TColor.GetColor("#2aa198")79sGreen      = TColor.GetColor("#859900")80ssBase3     = TColor.GetColor("#E3EAFD")81ssBase4     = TColor.GetColor("#FCF8E3")82ssBase5     = TColor.GetColor("#FDE3F8")83ssBase6     = TColor.GetColor("#EAFDE3")84#blkrgb      = (kBlack, kBlue, kRed, kGreen)85#blkrgb      = (kBlack, kNavy2, kMaroon2, kLime2)86blkrgb       = map(lambda x: TColor.GetColor(x), ("#333333", "#0571b0", "#ca0020", "#008837", "#7b3294", "#e66101"))87# Very nice color palette stolen from tkgeometry88# https://code.google.com/p/tkgeometry/source/browse/trunk/src/Palette.cc89palette      = map(lambda x: TColor.GetColor(x), ("#004586","#FF420E","#FFD320","#579D1C","#7E0021","#83CAFF","#314004","#AECF00","#4B1F6F","#FF950E","#C5000B","#0084D1"))90lightpalette = map(lambda x: TColor.GetColor(x), ("#79B7F2","#F29379","#FFEDA6","#B1F279","#F27999","#C2DEF2","#D4F279","#DFF279","#C791F2","#F2BD79","#F27980","#AAD7F2"))91# CTA blue, red, brown, green, orange, purple, pink, yellow92ctapalette = map(lambda x: TColor.GetColor(x), ("#00A2DF", "#D30D2B", "#653C20", "#00943D", "#FF460F", "#3B2C82", "#EE81A8", "#FFD500"))93#paletteSet1      = map(lambda x: TColor.GetColor(x), ("#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"))94#lightpaletteSet1 = map(lambda x: TColor.GetColor(x), ("#f28d8e", "#9bbfdc", "#a6d7a5", "#cca7d1", "#ffbf80", "#ffff99", "#d3ab94", "#fbc0df", "#cccccc"))95paletteSet1      = map(lambda x: TColor.GetColor(x), ("#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#a65628", "#f781bf", "#999999"))...alerts.ts
Source:alerts.ts  
...18            fontWeight: 50019          }20        },21        standardSuccess: {22          color: getColor(theme.palette.success.main, 0.12),23          backgroundColor: hexToRGBA(theme.palette.success.main, 0.12),24          '& .MuiAlertTitle-root': {25            color: getColor(theme.palette.success.main, 0.12)26          },27          '& .MuiAlert-icon': {28            color: getColor(theme.palette.success.main, 0.12)29          }30        },31        standardInfo: {32          color: getColor(theme.palette.info.main, 0.12),33          backgroundColor: hexToRGBA(theme.palette.info.main, 0.12),34          '& .MuiAlertTitle-root': {35            color: getColor(theme.palette.info.main, 0.12)36          },37          '& .MuiAlert-icon': {38            color: getColor(theme.palette.info.main, 0.12)39          }40        },41        standardWarning: {42          color: getColor(theme.palette.warning.main, 0.12),43          backgroundColor: hexToRGBA(theme.palette.warning.main, 0.12),44          '& .MuiAlertTitle-root': {45            color: getColor(theme.palette.warning.main, 0.12)46          },47          '& .MuiAlert-icon': {48            color: getColor(theme.palette.warning.main, 0.12)49          }50        },51        standardError: {52          color: getColor(theme.palette.error.main, 0.12),53          backgroundColor: hexToRGBA(theme.palette.error.main, 0.12),54          '& .MuiAlertTitle-root': {55            color: getColor(theme.palette.error.main, 0.12)56          },57          '& .MuiAlert-icon': {58            color: getColor(theme.palette.error.main, 0.12)59          }60        },61        outlinedSuccess: {62          borderColor: theme.palette.success.main,63          color: getColor(theme.palette.success.main, 0.12),64          '& .MuiAlertTitle-root': {65            color: getColor(theme.palette.success.main, 0.12)66          },67          '& .MuiAlert-icon': {68            color: getColor(theme.palette.success.main, 0.12)69          }70        },71        outlinedInfo: {72          borderColor: theme.palette.info.main,73          color: getColor(theme.palette.info.main, 0.12),74          '& .MuiAlertTitle-root': {75            color: getColor(theme.palette.info.main, 0.12)76          },77          '& .MuiAlert-icon': {78            color: getColor(theme.palette.info.main, 0.12)79          }80        },81        outlinedWarning: {82          borderColor: theme.palette.warning.main,83          color: getColor(theme.palette.warning.main, 0.12),84          '& .MuiAlertTitle-root': {85            color: getColor(theme.palette.warning.main, 0.12)86          },87          '& .MuiAlert-icon': {88            color: getColor(theme.palette.warning.main, 0.12)89          }90        },91        outlinedError: {92          borderColor: theme.palette.error.main,93          color: getColor(theme.palette.error.main, 0.12),94          '& .MuiAlertTitle-root': {95            color: getColor(theme.palette.error.main, 0.12)96          },97          '& .MuiAlert-icon': {98            color: getColor(theme.palette.error.main, 0.12)99          }100        },101        filled: {102          fontWeight: 400103        }104      }105    }106  }107}...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!!
