Team Ai
Datasetpublic

NTUYG/CommitPack_long_CL

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes26downloads
test.csv161673 linesDownload Raw Back to root
1text,positive,negative
2Increase log verbosity on exception,"from bs4 import BeautifulSoup3import logging4 5from jetcomcrawl import browser6import jetcomcrawl.libs.queue7 8 9class Worker(object):10    def __init__(self):11        self.queue_categories = jetcomcrawl.libs.queue.Queue('queue_categories')12        self.queue_items = jetcomcrawl.libs.queue.Queue('queue_items')13 14    def work(self):15        '''Keeps running indefinitely, retrieving jobs from sqs'''16        while True:17            # TODO: Handle no items left in queue18            data = self.queue_categories.retrieve()19            cid = data['cid']20            page = data['page']21            logging.info('Finding products for category {}, page {}'.format(cid, page))22            html = browser.get('https://jet.com/search/results?category={}&page={}'.format(cid, page))23            try:24                soup = BeautifulSoup(html.text, 'html.parser')25 26                results = []27                for item in soup.find('div', {'class': 'products'}).findAll('div', {'class': 'product mobile'}):28                    url = item.a['href']29                    uid = url.split('/')[-1]30                    results.append({'uid': uid, 'url': url})31            except:32                logging.info(html.text)33                raise34 35            logging.info('{} products found for category {}, page {}, inserting into sqs'.format(len(results), cid, page))36            self.queue_items.insert_bulk(results)37 38            self.queue_categories.remove_processed()39","from bs4 import BeautifulSoup40import logging41 42from jetcomcrawl import browser43import jetcomcrawl.libs.queue44 45 46class Worker(object):47    def __init__(self):48        self.queue_categories = jetcomcrawl.libs.queue.Queue('queue_categories')49        self.queue_items = jetcomcrawl.libs.queue.Queue('queue_items')50 51    def work(self):52        '''Keeps running indefinitely, retrieving jobs from sqs'''53        while True:54            # TODO: Handle no items left in queue55            data = self.queue_categories.retrieve()56            cid = data['cid']57            page = data['page']58            logging.info('Finding products for category {}, page {}'.format(cid, page))59            html = browser.get('https://jet.com/search/results?category={}&page={}'.format(cid, page))60            soup = BeautifulSoup(html.text, 'html.parser')61 62            results = []63            for item in soup.find('div', {'class': 'products'}).findAll('div', {'class': 'product mobile'}):64                url = item.a['href']65                uid = url.split('/')[-1]66                results.append({'uid': uid, 'url': url})67 68            logging.info('{} products found for category {}, page {}, inserting into sqs'.format(len(results), cid, page))69            self.queue_items.insert_bulk(results)70 71            self.queue_categories.remove_processed()72"
73Update format type in View Index User,"<?php74 75use yii\helpers\Html;76use yii\grid\GridView;77 78/* @var $this yii\web\View */79/* @var $dataProvider yii\data\ActiveDataProvider */80 81$this->title = 'Users';82$this->params['breadcrumbs'][] = $this->title;83?>84<div class=""user-index"">85 86    <h1><?= Html::encode($this->title) ?></h1>87 88    <p>89        <?= Html::a('Create User', ['create'], ['class' => 'btn btn-success']) ?>90    </p>91 92    <?=93        GridView::widget([94            'dataProvider' => $dataProvider,95            'columns' => [96                'user_id',97                'user_name',98                'user_email:email',99                'user_birthday',100                ['class' => 'yii\grid\ActionColumn'],101                array(102                    'format'  =>  'html',103                    'attribute' => 'user_name',104                    'value'=>function($data){105                        return $data->user_name;106                    }107                )108            ]109        ]);110    ?>111 112</div>113","<?php114 115use yii\helpers\Html;116use yii\grid\GridView;117 118/* @var $this yii\web\View */119/* @var $dataProvider yii\data\ActiveDataProvider */120 121$this->title = 'Users';122$this->params['breadcrumbs'][] = $this->title;123?>124<div class=""user-index"">125 126    <h1><?= Html::encode($this->title) ?></h1>127 128    <p>129        <?= Html::a('Create User', ['create'], ['class' => 'btn btn-success']) ?>130    </p>131 132    <?=133        GridView::widget([134            'dataProvider' => $dataProvider,135            'columns' => [136                'user_id',137                'user_name',138                'user_email:email',139                'user_birthday',140                ['class' => 'yii\grid\ActionColumn'],141                array(142                    'format'  =>  'image',143                    'attribute' => 'user_name',144                    'value'=>function($data){145                        return $data->user_name;146                    }147                )148            ]149        ]);150    ?>151 152</div>153"
154Test the replacement method too,"<?php155 156namespace tests\Http\Discovery;157 158use Http\Discovery\Exception\NotFoundException;159use Http\Discovery\Psr17FactoryDiscovery;160use PHPUnit\Framework\TestCase;161use Psr\Http\Message\RequestFactoryInterface;162use Psr\Http\Message\ResponseFactoryInterface;163use Psr\Http\Message\ServerRequestFactoryInterface;164use Psr\Http\Message\StreamFactoryInterface;165use Psr\Http\Message\UploadedFileFactoryInterface;166use Psr\Http\Message\UriFactoryInterface;167 168class Psr17FactoryDiscoveryTest extends TestCase169{170    /**171     * @dataProvider getFactories172     */173    public function testFind($method, $interface)174    {175        $callable = [Psr17FactoryDiscovery::class, $method];176        $client = $callable();177        $this->assertInstanceOf($interface, $client);178    }179 180    /**181     * @group NothingInstalled182     * @dataProvider getFactories183     */184    public function testNotFound($method)185    {186        $callable = [Psr17FactoryDiscovery::class, $method];187        $this->expectException(NotFoundException::class);188        $callable();189    }190 191    public function getFactories()192    {193        yield ['findRequestFactory', RequestFactoryInterface::class];194        yield ['findResponseFactory', ResponseFactoryInterface::class];195        yield ['findServerRequestFactory', ServerRequestFactoryInterface::class];196        yield ['findStreamFactory', StreamFactoryInterface::class];197        yield ['findUploadedFileFactory', UploadedFileFactoryInterface::class];198        yield ['findUriFactory', UriFactoryInterface::class];199        yield ['findUrlFactory', UriFactoryInterface::class];200    }201}202","<?php203 204namespace tests\Http\Discovery;205 206use Http\Discovery\Exception\NotFoundException;207use Http\Discovery\Psr17FactoryDiscovery;208use PHPUnit\Framework\TestCase;209use Psr\Http\Message\RequestFactoryInterface;210use Psr\Http\Message\ResponseFactoryInterface;211use Psr\Http\Message\ServerRequestFactoryInterface;212use Psr\Http\Message\StreamFactoryInterface;213use Psr\Http\Message\UploadedFileFactoryInterface;214use Psr\Http\Message\UriFactoryInterface;215 216class Psr17FactoryDiscoveryTest extends TestCase217{218    /**219     * @dataProvider getFactories220     */221    public function testFind($method, $interface)222    {223        $callable = [Psr17FactoryDiscovery::class, $method];224        $client = $callable();225        $this->assertInstanceOf($interface, $client);226    }227 228    /**229     * @group NothingInstalled230     * @dataProvider getFactories231     */232    public function testNotFound($method)233    {234        $callable = [Psr17FactoryDiscovery::class, $method];235        $this->expectException(NotFoundException::class);236        $callable();237    }238 239    public function getFactories()240    {241        yield ['findRequestFactory', RequestFactoryInterface::class];242        yield ['findResponseFactory', ResponseFactoryInterface::class];243        yield ['findServerRequestFactory', ServerRequestFactoryInterface::class];244        yield ['findStreamFactory', StreamFactoryInterface::class];245        yield ['findUploadedFileFactory', UploadedFileFactoryInterface::class];246        yield ['findUrlFactory', UriFactoryInterface::class];247    }248}249"
250Change to react from react-with-addons,"var path = require(""path"");251 252module.exports = {253    cache: true,254    entry: ""./js/main.js"",255    devtool: ""#source-map"",256    output: {257        path: path.resolve(""./build""),258        filename: ""bundle.js"",259        sourceMapFilename: ""[file].map"",260        publicPath: ""/build/"",261        stats: { colors: true },262    },263    module: {264        noParse: [/node_modules\/react/,265                  /node_modules\/jquery/,266                  /bower_components\/MathJax/,267                  /bower_components\/KAS/,268                  /node_modules\/underscore/],269        loaders: [270            {271                //tell webpack to use jsx-loader for all *.jsx files272                test: /\.js$/,273                loader: ""regenerator-loader""274            },275            {276                //tell webpack to use jsx-loader for all *.jsx files277                test: /\.js$/,278                loader: ""jsx-loader?insertPragma=React.DOM&harmony&stripTypes""279            }280        ],281    },282    resolve: {283        alias: {284            ""react"": path.resolve(""node_modules/react/dist/react.js""),285            ""underscore"": path.resolve(""node_modules/underscore/underscore-min.js""),286            ""jquery"": path.resolve(""node_modules/jquery/dist/jquery.min.js""),287            ""katex"": path.resolve(""bower_components/katex/build/katex.min.js""),288        },289        extensions: ["""", "".js"", "".jsx""]290    }291}292","var path = require(""path"");293 294module.exports = {295    cache: true,296    entry: ""./js/main.js"",297    devtool: ""#source-map"",298    output: {299        path: path.resolve(""./build""),300        filename: ""bundle.js"",301        sourceMapFilename: ""[file].map"",302        publicPath: ""/build/"",303        stats: { colors: true },304    },305    module: {306        noParse: [/node_modules\/react/,307                  /node_modules\/jquery/,308                  /bower_components\/MathJax/,309                  /bower_components\/KAS/,310                  /node_modules\/underscore/],311        loaders: [312            {313                //tell webpack to use jsx-loader for all *.jsx files314                test: /\.js$/,315                loader: ""regenerator-loader""316            },317            {318                //tell webpack to use jsx-loader for all *.jsx files319                test: /\.js$/,320                loader: ""jsx-loader?insertPragma=React.DOM&harmony&stripTypes""321            }322        ],323    },324    resolve: {325        alias: {326            ""react"": path.resolve(""node_modules/react/dist/react-with-addons.js""),327            ""underscore"": path.resolve(""node_modules/underscore/underscore-min.js""),328            ""jquery"": path.resolve(""node_modules/jquery/dist/jquery.min.js""),329            ""katex"": path.resolve(""bower_components/katex/build/katex.min.js""),330        },331        extensions: ["""", "".js"", "".jsx""]332    }333}334"
335Change config path to public path,"<?php336 337/*338 * This file is part of the Laravel Facebook Account-Kit package.339 *340 * (c) Ibraheem Adeniyi <ibonly01@gmail.com>341 *342 * For the full copyright and license information, please view the LICENSE343 * file that was distributed with this source code.344 */345 346namespace Ibonly\FacebookAccountKit;347 348use Illuminate\Support\ServiceProvider;349 350class FacebookAccountKitServiceProvider extends ServiceProvider351{352    /**353     * Indicates if loading of the provider is deferred.354     *355     * @var bool356     */357    protected $defer = false;358 359    /**360     * Publishes all the config file this package needs to function361     */362    public function boot()363    {364        $config = realpath(__DIR__ . '/../resources/config/facebookAccountKit.php');365 366        $js = realpath(__DIR__ . '/../resources/config/accountkit.js');367 368        $this->publishes([369            $config => config_path('AccountKit.php')370        ], 'config');371 372        $this->publishes([373            $js => public_path('public/js/accountkit.js')374        ], 'public');375    }376 377    /**378     * Register the application services.379     */380    public function register()381    {382        $this->app->singleton('AccountKit', function() {383 384            return new FacebookAccountKit;385 386        });387    }388 389    /**390     * Get the services provided by the provider391     * @return array392     */393    public function provides()394    {395        return ['AccountKit'];396    }397}398","<?php399 400/*401 * This file is part of the Laravel Facebook Account-Kit package.402 *403 * (c) Ibraheem Adeniyi <ibonly01@gmail.com>404 *405 * For the full copyright and license information, please view the LICENSE406 * file that was distributed with this source code.407 */408 409namespace Ibonly\FacebookAccountKit;410 411use Illuminate\Support\ServiceProvider;412 413class FacebookAccountKitServiceProvider extends ServiceProvider414{415    /**416     * Indicates if loading of the provider is deferred.417     *418     * @var bool419     */420    protected $defer = false;421 422    /**423     * Publishes all the config file this package needs to function424     */425    public function boot()426    {427        $config = realpath(__DIR__ . '/../resources/config/facebookAccountKit.php');428 429        $js = realpath(__DIR__ . '/../resources/config/accountkit.js');430 431        $this->publishes([432            $config => config_path('AccountKit.php')433        ], 'config');434 435        $this->publishes([436            $js => config_path('accountkit.js')437        ], 'public/js/');438    }439 440    /**441     * Register the application services.442     */443    public function register()444    {445        $this->app->singleton('AccountKit', function() {446 447            return new FacebookAccountKit;448 449        });450    }451 452    /**453     * Get the services provided by the provider454     * @return array455     */456    public function provides()457    {458        return ['AccountKit'];459    }460}461"
462Allow to set link target (_self to change current window's location),"require(['gitbook'], function(gitbook) {463 464    gitbook.events.bind('start', function(e, config) {465        var opts = config.toolbar;466        467        if (!opts || !opts.buttons) return;468        469        var buttons = opts.buttons.slice(0);470        buttons.reverse();471        472        buttons.forEach(function(button) {473            gitbook.toolbar.createButton({474                icon: button.icon || ""fa fa-external-link"",475                label: button.label || ""Link"",476                position: 'right',477                onClick: function(e) {478                    e.preventDefault();479                    var mapping = {480                        ""{{title}}"": encodeURIComponent(document.title),481                        ""{{url}}"": encodeURIComponent(location.href)482                    };483                    var re = RegExp(Object.keys(mapping).join(""|""), ""g"");484                    var url = button.url.replace(re, function(matched) {485                        return mapping[matched];486                    });487                    if (button.target == ""_self"") {488                        window.location = url;489                    } else {490                        window.open(url, button.target || ""_blank"");491                    }492                }493            });494        });495    });496});497","require(['gitbook'], function(gitbook) {498 499    gitbook.events.bind('start', function(e, config) {500        var opts = config.toolbar;501        502        if (!opts || !opts.buttons) return;503        504        var buttons = opts.buttons.slice(0);505        buttons.reverse();506        507        buttons.forEach(function(button) {508            gitbook.toolbar.createButton({509                icon: button.icon || ""fa fa-external-link"",510                label: button.label || ""Link"",511                position: 'right',512                onClick: function(e) {513                    e.preventDefault();514                    var mapping = {515                        ""{{title}}"": encodeURIComponent(document.title),516                        ""{{url}}"": encodeURIComponent(location.href)517                    };518                    var re = RegExp(Object.keys(mapping).join(""|""), ""g"");519                    window.open(button.url.replace(re, function(matched) {520                        return mapping[matched];521                    }));522                }523            });524        });525    });526});527"
528Add optional importUrl to Shapefile signature,"L.Shapefile =L.GeoJSON.extend({529    initialize: function (file, options, importUrl) {530        if(typeof cw !== 'undefined'){531            if (typeof importUrl === 'undefined') {532            	importUrl = 'shp.js';533            }534            this.worker = cw(function(data,cb){535                importScripts(importUrl);536	            shp(data).then(cb);537            });538        }539        L.GeoJSON.prototype.initialize.call(this,{features:[]},options);540        this.addFileData(file);541    },542    addFileData:function(file){543        var self = this;544        self.fire('data:loading');545        if(typeof file !== 'string' && !('byteLength' in file)){546            var data = self.addData(file);547            self.fire('data:loaded');548            return data;549        }550        if(self.worker){551            self.worker.data(cw.makeUrl(file)).then(function(data){552                self.addData(data);553                self.fire('data:loaded');554                self.worker.close();555            });556        }else{557            shp(file).then(function(data){558                self.addData(data);559                self.fire('data:loaded');560            });561        }562        return this;563    }564});565 566L.shapefile= function(a,b,c){567    return new L.Shapefile(a,b,c);568}569","L.Shapefile =L.GeoJSON.extend({570    initialize: function (file, options) {571        if(typeof cw !== 'undefined'){572            this.worker = cw(function(data,cb){573                importScripts('shp.js');574	            shp(data).then(cb);575            });576        }577        L.GeoJSON.prototype.initialize.call(this,{features:[]},options);578        this.addFileData(file);579    },580    addFileData:function(file){581        var self = this;582        self.fire('data:loading');583        if(typeof file !== 'string' && !('byteLength' in file)){584            var data = self.addData(file);585            self.fire('data:loaded');586            return data;587        }588        if(self.worker){589            self.worker.data(cw.makeUrl(file)).then(function(data){590                self.addData(data);591                self.fire('data:loaded');592                self.worker.close();593            });594        }else{595            shp(file).then(function(data){596                self.addData(data);597                self.fire('data:loaded');598            });599        }600        return this;601    }602});603 604L.shapefile= function(a,b){605    return new L.Shapefile(a,b);606}607"
608"Correct a straggling CLI format string after ref selector changes609 610Summary: Ref T13589. This is missing a ""%s"" conversion.611 612Test Plan: Will view a commit with a diff.613 614Maniphest Tasks: T13589615 616Differential Revision: https://secure.phabricator.com/D21512","<?php617 618final class DiffusionGitRawDiffQuery extends DiffusionRawDiffQuery {619 620  protected function newQueryFuture() {621    $drequest = $this->getRequest();622    $repository = $drequest->getRepository();623 624    $commit = $this->getAnchorCommit();625 626    $options = array(627      '-M',628      '-C',629      '--no-ext-diff',630      '--no-color',631      '--src-prefix=a/',632      '--dst-prefix=b/',633      '-U'.(int)$this->getLinesOfContext(),634    );635 636    $against = $this->getAgainstCommit();637    if ($against === null) {638      // Check if this is the root commit by seeing if it has parents, since639      // `git diff X^ X` does not work if ""X"" is the initial commit.640      list($parents) = $repository->execxLocalCommand(641        'log -n 1 %s %s --',642        '--format=%P',643        gitsprintf('%s', $commit));644 645      if (strlen(trim($parents))) {646        $against = $commit.'^';647      } else {648        $against = ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT;649      }650    }651 652    $path = $drequest->getPath();653    if (!strlen($path)) {654      $path = '.';655    }656 657    return $repository->getLocalCommandFuture(658      'diff %Ls %s %s -- %s',659      $options,660      gitsprintf('%s', $against),661      gitsprintf('%s', $commit),662      $path);663  }664 665}666","<?php667 668final class DiffusionGitRawDiffQuery extends DiffusionRawDiffQuery {669 670  protected function newQueryFuture() {671    $drequest = $this->getRequest();672    $repository = $drequest->getRepository();673 674    $commit = $this->getAnchorCommit();675 676    $options = array(677      '-M',678      '-C',679      '--no-ext-diff',680      '--no-color',681      '--src-prefix=a/',682      '--dst-prefix=b/',683      '-U'.(int)$this->getLinesOfContext(),684    );685 686    $against = $this->getAgainstCommit();687    if ($against === null) {688      // Check if this is the root commit by seeing if it has parents, since689      // `git diff X^ X` does not work if ""X"" is the initial commit.690      list($parents) = $repository->execxLocalCommand(691        'log -n 1 %s --',692        '--format=%P',693        gitsprintf('%s', $commit));694 695      if (strlen(trim($parents))) {696        $against = $commit.'^';697      } else {698        $against = ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT;699      }700    }701 702    $path = $drequest->getPath();703    if (!strlen($path)) {704      $path = '.';705    }706 707    return $repository->getLocalCommandFuture(708      'diff %Ls %s %s -- %s',709      $options,710      gitsprintf('%s', $against),711      gitsprintf('%s', $commit),712      $path);713  }714 715}716"
717Print stacktrace when security exception thrown,"package org.example;718 719import javax.script.ScriptEngine;720import javax.script.ScriptEngineManager;721import java.security.AccessControlContext;722import java.security.AccessController;723import java.security.AllPermission;724import java.security.CodeSource;725import java.security.Permissions;726import java.security.Policy;727import java.security.PrivilegedActionException;728import java.security.PrivilegedExceptionAction;729import java.security.ProtectionDomain;730import java.security.cert.Certificate;731 732public class Sandbox {733 734    public void runNashornScriptInSandbox(String source) throws Exception {735        ScriptEngineManager manager = new ScriptEngineManager();736        ScriptEngine engine = manager.getEngineByName(""nashorn"");737 738        Object result = sandbox(() -> {739            return engine.eval(source);740        });741        System.out.println(String.format(""result is '%s'"", result));742    }743 744    private Object sandbox(PrivilegedExceptionAction<Object> action) throws PrivilegedActionException {745        Policy.setPolicy(new java.security.Policy() {746            @Override747            public java.security.PermissionCollection getPermissions(ProtectionDomain domain) {748                Permissions permissions = new Permissions();749                permissions.add(new AllPermission());750                return permissions;751            }752        });753        System.setSecurityManager(new SecurityManager());754 755        ProtectionDomain domain = new ProtectionDomain(new CodeSource(null, (Certificate[]) null), new Permissions());756        final AccessControlContext context = new AccessControlContext(new ProtectionDomain[]{domain});757 758        try {759            return AccessController.doPrivileged(action, context);760        } finally {761            try {762                System.setSecurityManager(null);763            } catch (SecurityException e) {764                e.printStackTrace();765                throw e;766            }767        }768    }769}770","package org.example;771 772import javax.script.ScriptEngine;773import javax.script.ScriptEngineManager;774import java.security.AccessControlContext;775import java.security.AccessController;776import java.security.AllPermission;777import java.security.CodeSource;778import java.security.Permissions;779import java.security.Policy;780import java.security.PrivilegedActionException;781import java.security.PrivilegedExceptionAction;782import java.security.ProtectionDomain;783import java.security.cert.Certificate;784 785public class Sandbox {786 787    public void runNashornScriptInSandbox(String source) throws Exception {788        ScriptEngineManager manager = new ScriptEngineManager();789        ScriptEngine engine = manager.getEngineByName(""nashorn"");790 791        Object result = sandbox(() -> {792            return engine.eval(source);793        });794        System.out.println(String.format(""result is '%s'"", result));795    }796 797    private Object sandbox(PrivilegedExceptionAction<Object> action) throws PrivilegedActionException {798        Policy.setPolicy(new java.security.Policy() {799            @Override800            public java.security.PermissionCollection getPermissions(ProtectionDomain domain) {801                Permissions permissions = new Permissions();802                permissions.add(new AllPermission());803                return permissions;804            }805        });806        System.setSecurityManager(new SecurityManager());807 808        ProtectionDomain domain = new ProtectionDomain(new CodeSource(null, (Certificate[]) null), new Permissions());809        final AccessControlContext context = new AccessControlContext(new ProtectionDomain[]{domain});810 811        try {812            return AccessController.doPrivileged(action, context);813        } finally {814            System.setSecurityManager(null);815        }816    }817}818"
819Allow linking to own page when link is in content,"<?php820class Kwc_Basic_LinkTag_Intern_Form extends Kwc_Abstract_Form821{822    public function __construct($name, $class, $id = null)823    {824        parent::__construct($name, $class, $id);825 826        $this->add(new Kwf_Form_Field_PageSelect('target', trlKwf('Target')))827            ->setControllerUrl(Kwc_Admin::getInstance($class)->getControllerUrl('Pages'))828            ->setWidth(233)829            ->setAllowBlank(false);830 831        $this->add(new Kwf_Form_Field_Select('anchor', trlKwf('Anchor')))832            ->setValues(Kwc_Admin::getInstance($class)->getControllerUrl('Anchors') . '/json-data')833            ->setShowNoSelection(true);834    }835 836    public function prepareSave($parentRow, $postData)837    {838        if ($parentRow) {839            // Limit 1 weil alle komponenten die hier zurรผck kommen, dieselbe url840            // haben und es wird ja รผberprรผft ob zu sich selbst gelinkt wird841            $data = Kwf_Component_Data_Root::getInstance()->getComponentByDbId(842                $parentRow->component_id, array('limit' => 1, 'ignoreVisible' => true)843            );844            if (isset($postData[$this->fields['target']->getFieldName()]) &&845                $data && $data->isPage && $data->getPage() &&846                $data->getPage()->dbId == $postData[$this->fields['target']->getFieldName()]847            ) {848                throw new Kwf_ClientException(trlKwf('Link cannot link to itself'));849            }850        }851        parent::prepareSave($parentRow, $postData);852    }853}854","<?php855class Kwc_Basic_LinkTag_Intern_Form extends Kwc_Abstract_Form856{857    public function __construct($name, $class, $id = null)858    {859        parent::__construct($name, $class, $id);860 861        $this->add(new Kwf_Form_Field_PageSelect('target', trlKwf('Target')))862            ->setControllerUrl(Kwc_Admin::getInstance($class)->getControllerUrl('Pages'))863            ->setWidth(233)864            ->setAllowBlank(false);865 866        $this->add(new Kwf_Form_Field_Select('anchor', trlKwf('Anchor')))867            ->setValues(Kwc_Admin::getInstance($class)->getControllerUrl('Anchors') . '/json-data')868            ->setShowNoSelection(true);869    }870 871    public function prepareSave($parentRow, $postData)872    {873        if ($parentRow) {874            // Limit 1 weil alle komponenten die hier zurรผck kommen, dieselbe url875            // haben und es wird ja รผberprรผft ob zu sich selbst gelinkt wird876            $data = Kwf_Component_Data_Root::getInstance()->getComponentByDbId(877                $parentRow->component_id, array('limit' => 1)878            );879            if (isset($postData[$this->fields['target']->getFieldName()]) &&880                    $data && $data->getPage() && $data->getPage()->dbId == $postData[$this->fields['target']->getFieldName()]) {881                throw new Kwf_ClientException(trlKwf('Link cannot link to itself'));882            }883        }884        parent::prepareSave($parentRow, $postData);885    }886}887"
888Remove innerHTML from the code,"window.addEventListener('click', function(event) {889    var target = event.target;890    891    if (target.id == 'forcarProxy' || target.id == 'listaSites') {892        self.port.emit('daNovoProxy', target.toString());893    }894    895    if (target.id == 'verSites') {896        self.port.emit('openTabSites', target.toString());897    }898    899    if (target.id == 'mensagem') {900        self.port.emit('openTabLink', target.toString());901    }902}, false);903 904self.on('message', function(data){905    if(data.hasOwnProperty('host') && data.hasOwnProperty('port')) {906       document.getElementById(""proxyaddr"").firstChild.nodeValue = data.host + ':' + data.port;907    }908    909    if(data.hasOwnProperty('version')) {910        document.getElementById(""ahoy-version"").firstChild.nodeValue = data.version;911    }912})913 914self.port.on('currentURL', function( currentURL, blockedSites ) {  915    var cleanURL = currentURL.replace(/.*?:\/\/www.|.*?:\/\//g,"""").replace(/\//g,"""");916 917    if ( blockedSites.indexOf(cleanURL) != -1 ) {918       document.getElementById('status-inactivo').style.display = ""none"";919       document.getElementById('status-activo').style.display = """";920    } else {921       document.getElementById('status-inactivo').style.display = """";922       document.getElementById('status-activo').style.display = ""none"";    923   }924});","window.addEventListener('click', function(event) {925    var target = event.target;926    927    if (target.id == 'forcarProxy' || target.id == 'listaSites') {928        self.port.emit('daNovoProxy', target.toString());929    }930    931    if (target.id == 'verSites') {932        self.port.emit('openTabSites', target.toString());933    }934    935    if (target.id == 'mensagem') {936        self.port.emit('openTabLink', target.toString());937    }938}, false);939 940self.on('message', function(data){941    if(data.hasOwnProperty('host') && data.hasOwnProperty('port')) {942       document.getElementById(""proxyaddr"").innerHTML = data.host + ':' + data.port;943    }944    945    if(data.hasOwnProperty('version')) {946        document.getElementById(""ahoy-version"").innerHTML = data.version;947    }948})949 950self.port.on('currentURL', function( currentURL, blockedSites ) {  951    var cleanURL = currentURL.replace(/.*?:\/\/www.|.*?:\/\//g,"""").replace(/\//g,"""");952    953    if ( blockedSites.indexOf(cleanURL) != -1 ) {954       document.getElementById('status-inactivo').style.display = ""none"";955       document.getElementById('status-activo').style.display = """";956    } else {957       document.getElementById('status-inactivo').style.display = """";958       document.getElementById('status-activo').style.display = ""none"";    959   }960});"
961Call function with full path and leading backslash,"<?php962 963namespace Politix\PolitikportalBundle\Controller;964 965use Symfony\Bundle\FrameworkBundle\Controller\Controller;966// use Politix\PolitikportalBundle\Model;967 968 969class SourcesController extends Controller {970    971    public function indexAction($name) {972		973		$out['items'] = $this->getSource('tagesschau');974		$out['name'] = $name;975		976        return $this->render('PolitikportalBundle:Default:items.html.twig', $out);977        978    }979    980    981    function getSourceAction($source) {982    983    	$out['source'] = $source;984		985    	$sql = 'SELECT * FROM rss_items WHERE source LIKE ""' . $source . '"" ORDER BY pubDate DESC LIMIT 0,10';986    	$out['items'] = $this->getDB($sql);987		988        return $this->render('PolitikportalBundle:Default:items.html.twig', $out);    989    	990    }991    992    993    function getSourcesAction() {994    995    	require ('/var/www/vhosts/politikportal.eu/subdomains/new/httpdocs/politix/src/Politix/PolitikportalBundle/Model/SourceModel.php');996    	$db = new \Politix\PolitikportalBundle\Model\SourceModel();997    	$out['sources'] = $db->getSources;998    	999    	return $this->render('PolitikportalBundle:Default:sources.html.twig', $out);1000 1001    }1002 1003    1004    1005    function getDB($sql) {1006    1007    	$conn = $this->container->get('database_connection');1008		return $conn->query($sql);1009    1010    }1011    1012    1013}1014","<?php1015 1016namespace Politix\PolitikportalBundle\Controller;1017 1018use Symfony\Bundle\FrameworkBundle\Controller\Controller;1019use Politix\PolitikportalBundle\Model;1020 1021 1022class SourcesController extends Controller {1023    1024    public function indexAction($name) {1025		1026		$out['items'] = $this->getSource('tagesschau');1027		$out['name'] = $name;1028		1029        return $this->render('PolitikportalBundle:Default:items.html.twig', $out);1030        1031    }1032    1033    1034    function getSourceAction($source) {1035    1036    	$out['source'] = $source;1037		1038    	$sql = 'SELECT * FROM rss_items WHERE source LIKE ""' . $source . '"" ORDER BY pubDate DESC LIMIT 0,10';1039    	$out['items'] = $this->getDB($sql);1040		1041        return $this->render('PolitikportalBundle:Default:items.html.twig', $out);    1042    	1043    }1044    1045    1046    function getSourcesAction() {1047    1048    	require ('/var/www/vhosts/politikportal.eu/subdomains/new/httpdocs/politix/src/Politix/PolitikportalBundle/Model/SourceModel.php');1049    	$db = new Politix\PolitikportalBundle\Model\SourceModel();1050    	$out['sources'] = $db->getSources;1051    	1052    	return $this->render('PolitikportalBundle:Default:sources.html.twig', $out);1053 1054    }1055 1056    1057    1058    function getDB($sql) {1059    1060    	$conn = $this->container->get('database_connection');1061		return $conn->query($sql);1062    1063    }1064    1065    1066}1067"
1068"Increase the required version of requests.1069 1070Versions of the requests library prior to 2.20.0 have a known1071security vulnerability (CVE-2018-18074).","import sys1072 1073 1074try:1075  from setuptools import setup1076except ImportError:1077  from distutils.core import setup1078 1079 1080if sys.version_info <= (2, 4):1081  error = 'Requires Python Version 2.5 or above... exiting.'1082  print >> sys.stderr, error1083  sys.exit(1)1084 1085 1086requirements = [1087    'requests>=2.20.0,<3.0',1088]1089 1090setup(name='googlemaps',1091      version='3.0.2',1092      description='Python client library for Google Maps API Web Services',1093      scripts=[],1094      url='https://github.com/googlemaps/google-maps-services-python',1095      packages=['googlemaps'],1096      license='Apache 2.0',1097      platforms='Posix; MacOS X; Windows',1098      setup_requires=requirements,1099      install_requires=requirements,1100      test_suite='googlemaps.test',1101      classifiers=['Development Status :: 4 - Beta',1102                   'Intended Audience :: Developers',1103                   'License :: OSI Approved :: Apache Software License',1104                   'Operating System :: OS Independent',1105                   'Programming Language :: Python :: 2.7',1106                   'Programming Language :: Python :: 3.2',1107                   'Programming Language :: Python :: 3.4',1108                   'Programming Language :: Python :: 3.5',1109                   'Programming Language :: Python :: 3.6',1110                   'Topic :: Internet',1111                   ]1112      )1113","import sys1114 1115 1116try:1117  from setuptools import setup1118except ImportError:1119  from distutils.core import setup1120 1121 1122if sys.version_info <= (2, 4):1123  error = 'Requires Python Version 2.5 or above... exiting.'1124  print >> sys.stderr, error1125  sys.exit(1)1126 1127 1128requirements = [1129    'requests>=2.11.1,<3.0',1130]1131 1132setup(name='googlemaps',1133      version='3.0.2',1134      description='Python client library for Google Maps API Web Services',1135      scripts=[],1136      url='https://github.com/googlemaps/google-maps-services-python',1137      packages=['googlemaps'],1138      license='Apache 2.0',1139      platforms='Posix; MacOS X; Windows',1140      setup_requires=requirements,1141      install_requires=requirements,1142      test_suite='googlemaps.test',1143      classifiers=['Development Status :: 4 - Beta',1144                   'Intended Audience :: Developers',1145                   'License :: OSI Approved :: Apache Software License',1146                   'Operating System :: OS Independent',1147                   'Programming Language :: Python :: 2.7',1148                   'Programming Language :: Python :: 3.2',1149                   'Programming Language :: Python :: 3.4',1150                   'Programming Language :: Python :: 3.5',1151                   'Programming Language :: Python :: 3.6',1152                   'Topic :: Internet',1153                   ]1154      )1155"
1156Remove deprecated notes from PropTypes helper,"(function() {1157  window.shared || (window.shared = {});1158 1159  // Allow a prop to be null, if the prop type explicitly allows this.1160  // Then fall back to another validator if a value is passed.1161  var nullable = function(validator) {1162    return function(props, propName, componentName) {1163      if (props[propName] === null) return null;1164      return validator(props, propName, componentName);1165    };1166  };1167 1168  var PropTypes = window.shared.PropTypes = {1169    nullable: nullable,1170 1171    // UI actions, stepping stone to Flux1172    actions: React.PropTypes.shape({1173      onColumnClicked: React.PropTypes.func.isRequired,1174      onClickSaveNotes: React.PropTypes.func.isRequired,1175      onClickSaveService: React.PropTypes.func.isRequired,1176      onClickDiscontinueService: React.PropTypes.func.isRequired1177    }),1178    requests: React.PropTypes.shape({1179      saveNotes: nullable(React.PropTypes.string).isRequired1180    }),1181    api: React.PropTypes.shape({1182      saveNotes: React.PropTypes.func.isRequired1183    }),1184 1185    // The feed of all notes and data entered in Student Insights for1186    // a student.1187    feed: React.PropTypes.shape({1188      event_notes: React.PropTypes.array.isRequired,1189      services: React.PropTypes.shape({1190        active: React.PropTypes.array.isRequired,1191        discontinued: React.PropTypes.array.isRequired1192      }),1193      deprecated: React.PropTypes.shape({1194        interventions: React.PropTypes.array.isRequired1195      })1196    })1197  };1198})();1199","(function() {1200  window.shared || (window.shared = {});

Showing the first 1,200 of 161673 lines. Download the file for the rest.