Team Ai
Datasetpublic

NTUYG/CommitPack_long_CL

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes26downloads
validation.csv162159 linesDownload Raw Back to root
1text,positive,negative
2Add contributing author to article query,"export default `3  id4  title5  search_title6  social_title7  description8  search_description9  social_description10  thumbnail_image11  thumbnail_title12  social_image13  published_at14  slug15  layout16  featured17  channel_id18  partner_channel_id19  indexable20  keywords21  published22  postscript23  is_super_article24  is_super_sub_article25  super_article {26    partner_link27    partner_link_title28    partner_logo29    partner_logo_link30    partner_fullscreen_header_logo31    secondary_partner_logo32    secondary_logo_text33    secondary_logo_link34    footer_blurb35    footer_title36    related_articles37  }38  email_metadata {39    headline40    author41    credit_line42    credit_url43    image_url44  }45  authors {46    image_url47    twitter_handle48    name49    id50    bio51  }52  contributing_authors {53    name54  }55  vertical {56    name57    id58  }59  hero_section {60    ...Image61    ...Video62    ...on FeatureHeader {63      type64      title65      url66    }67  }68  sections {69    ... on Text {70      type71      body72    }73    ... on Embed {74      type75      url76      height77      mobile_height78      layout79    }80    ...Video81    ... on Callout {82      type83    }84    ... on ImageCollection {85      type86      layout87      images {88        ...Artwork89        ...Image90      }91    }92    ... on ImageSet {93      type94      title95      layout96      images {97        ...Image98        ...Artwork99      }100    }101  }102`103","export default `104  id105  title106  search_title107  social_title108  description109  search_description110  social_description111  thumbnail_image112  thumbnail_title113  social_image114  published_at115  slug116  layout117  featured118  channel_id119  partner_channel_id120  indexable121  keywords122  published123  postscript124  is_super_article125  is_super_sub_article126  super_article {127    partner_link128    partner_link_title129    partner_logo130    partner_logo_link131    partner_fullscreen_header_logo132    secondary_partner_logo133    secondary_logo_text134    secondary_logo_link135    footer_blurb136    footer_title137    related_articles138  }139  email_metadata {140    headline141    author142    credit_line143    credit_url144    image_url145  }146  authors {147    image_url148    twitter_handle149    name150    id151    bio152  }153  vertical {154    name155    id156  }157  hero_section {158    ...Image159    ...Video160    ...on FeatureHeader {161      type162      title163      url164    }165  }166  sections {167    ... on Text {168      type169      body170    }171    ... on Embed {172      type173      url174      height175      mobile_height176      layout177    }178    ...Video179    ... on Callout {180      type181    }182    ... on ImageCollection {183      type184      layout185      images {186        ...Artwork187        ...Image188      }189    }190    ... on ImageSet {191      type192      title193      layout194      images {195        ...Image196        ...Artwork197      }198    }199  }200`201"
202Refactor calculating date string into nice method,"(function(){203  'use strict';204 205  angular.module('events')206         .service('eventService', ['$q', '$http', '$filter', 'ApiUrl', EventService]);207 208  /**209   * Events DataService210   * Events embedded, hard-coded data model; acts asynchronously to simulate211   * remote data service call(s).212   *213   * @returns {{loadAll: Function}}214   * @constructor215   */216  function EventService($q, $http, $filter, ApiUrl){217 218	var getQueryDateString = function(startDate){219		/*copy startDate b/c manipulations we need to make will affect the UI if we don't*/220		var queryDate = new Date(startDate);221		222		/*get the offset in hours from UTC*/	223		var offsetHours = queryDate.getTimezoneOffset() / 60;224		225		/* set the time to midnight of the day we want to retrieve data for */226		queryDate.setHours(offsetHours,0,0,0);227		228		return $filter('date')(queryDate,'yyyy-MM-ddTHH:mm:ss') + 'Z';229	}230	231	this.get = function(startDate, pageSize, pageStart) {232		var deferredEvents = $q.defer();233		234 235	    var config = {236	    	params: {237				size : pageSize || 50,238				start : pageStart || 0	239			}240		};241		242	    $http.get(ApiUrl.get() + 'startDate/' + getQueryDateString(startDate), config)243    		.then(function(data) {244    			deferredEvents.resolve(data);245	    	}, function(reason) {246    			deferredEvents.reject(reason);247    		});248    	249    	return deferredEvents.promise;250	};251  }252 253})();254","(function(){255  'use strict';256 257  angular.module('events')258         .service('eventService', ['$q', '$http', '$filter', 'ApiUrl', EventService]);259 260  /**261   * Events DataService262   * Events embedded, hard-coded data model; acts asynchronously to simulate263   * remote data service call(s).264   *265   * @returns {{loadAll: Function}}266   * @constructor267   */268  function EventService($q, $http, $filter, ApiUrl){269 270	this.get = function(startDate, pageSize, pageStart) {271		var deferredEvents = $q.defer();272		273		/*copy startDate b/c manipulations we need to make will affect the UI if we don't*/274		var queryDate = new Date(startDate);275		276		/*get the offset in hours from UTC*/	277		var offsetHours = queryDate.getTimezoneOffset() / 60;278		279		/* set the time to midnight of the day we want to retrieve data for */280		queryDate.setHours(offsetHours,0,0,0);281		282	    var isoQueryDate = $filter('date')(queryDate,'yyyy-MM-ddTHH:mm:ss');283	    284	    var config = {285	    	params: {286				size : pageSize || 50,287				start : pageStart || 0	288			}289		};290		291	    $http.get(ApiUrl.get() + 'startDate/' + isoQueryDate + 'Z', config)292    		.then(function(data) {293    			deferredEvents.resolve(data);294	    	}, function(reason) {295    			deferredEvents.reject(reason);296    		});297    	298    	return deferredEvents.promise;299	};300  }301 302})();303"
304search: Change the CreateOrUpdateSearchService and it's response,"package search305 306import ""github.com/jen20/riviera/azure""307 308type CreateOrUpdateSearchServiceResponse struct {309	ID                 *string             `mapstructure:""id""`310	Name               *string             `mapstructure:""name""`311	Location           *string             `mapstructure:""location""`312	Tags               *map[string]*string `mapstructure:""tags""`313	Sku                *string             `json:""sku,omitempty""`314	ReplicaCount       *string             `json:""replicaCount,omitempty""`315	PartitionCount     *string             `json:""partitionCount,omitempty""`316	Status             *string             `mapstructure:""status""`317	StatusDetails      *string             `mapstructure:""statusDetails""`318	ProvisioningStatus *string             `mapstructure:""provisioningStatus""`319}320 321type CreateOrUpdateSearchService struct {322	Name              string             `json:""-""`323	ResourceGroupName string             `json:""-""`324	Location          string             `json:""-"" riviera:""location""`325	Tags              map[string]*string `json:""-"" riviera:""tags""`326	Sku               *string            `json:""sku,omitempty""`327	ReplicaCount      *string            `json:""replicaCount,omitempty""`328	PartitionCount    *string            `json:""partitionCount,omitempty""`329}330 331func (s CreateOrUpdateSearchService) APIInfo() azure.APIInfo {332	return azure.APIInfo{333		APIVersion:  apiVersion,334		Method:      ""PUT"",335		URLPathFunc: searchServiceDefaultURLPath(s.ResourceGroupName, s.Name),336		ResponseTypeFunc: func() interface{} {337			return &CreateOrUpdateSearchServiceResponse{}338		},339	}340}341","package search342 343import ""github.com/jen20/riviera/azure""344 345type CreateOrUpdateSearchServiceResponse struct {346	ID       *string             `mapstructure:""id""`347	Name     *string             `mapstructure:""name""`348	Location *string             `mapstructure:""location""`349	Tags     *map[string]*string `mapstructure:""tags""`350}351 352type CreateOrUpdateSearchService struct {353	Name               string             `json:""-""`354	ResourceGroupName  string             `json:""-""`355	Location           string             `json:""-"" riviera:""location""`356	Tags               map[string]*string `json:""-"" riviera:""tags""`357	Sku                *string            `json:""sku,omitempty""`358	ReplicaCount       *string            `json:""replicaCount,omitempty""`359	PartitionCount     *string            `json:""partitionCount,omitempty""`360	Status             *string            `mapstructure:""status""`361	StatusDetails      *string            `mapstructure:""statusDetails""`362	ProvisioningStatus *string            `mapstructure:""provisioningStatus""`363}364 365func (s CreateOrUpdateSearchService) APIInfo() azure.APIInfo {366	return azure.APIInfo{367		APIVersion:  apiVersion,368		Method:      ""PUT"",369		URLPathFunc: searchServiceDefaultURLPath(s.ResourceGroupName, s.Name),370		ResponseTypeFunc: func() interface{} {371			return &CreateOrUpdateSearchServiceResponse{}372		},373	}374}375"
376Add some air to the code,"angular.module('ngJustGage', [])377  .directive('justGage', ['$timeout', function ($timeout) {378    return {379      restrict: 'EA',380      scope: {381        id: '@',382        class: '@',383        min: '=',384        max: '=',385        title: '@',386        value: '=',387        options: '='388      },389      template: '<div id=""{{id}}-justgage"" class=""{{class}}""></div>',390      link: function (scope, element, attrs) {391        $timeout(function () {392          var options = {393            id: scope.id + '-justgage',394            min: scope.min,395            max: scope.max,396            title: scope.title,397            value: scope.value398          };399 400          if (scope.options) {401              for (var key in scope.options) {402                  options[key] = scope.options[key];403              }404          }405 406          var graph = new JustGage(options);407 408          scope.$watch('max', function (updatedMax) {409            if (updatedMax !== undefined) {410              graph.refresh(scope.value, updatedMax);411            }412          }, true);413 414          scope.$watch('value', function (updatedValue) {415            if (updatedValue !== undefined) {416              graph.refresh(updatedValue);417            }418          }, true);419        });420      }421    };422  }]);423","angular.module('ngJustGage', [])424  .directive('justGage', ['$timeout', function ($timeout) {425    return {426      restrict: 'EA',427      scope: {428        id: '@',429        class: '@',430        min: '=',431        max: '=',432        title: '@',433        value: '=',434        options: '='435      },436      template: '<div id=""{{id}}-justgage"" class=""{{class}}""></div>',437      link: function (scope, element, attrs) {438        $timeout(function () {439          var options = {440            id: scope.id + '-justgage',441            min: scope.min,442            max: scope.max,443            title: scope.title,444            value: scope.value445          };446          if (scope.options) {447              for (var key in scope.options) {448                  options[key] = scope.options[key];449              }450          }451          var graph = new JustGage(options);452 453          scope.$watch('max', function (updatedMax) {454            if (updatedMax !== undefined) {455              graph.refresh(scope.value, updatedMax);456            }457          }, true);458 459          scope.$watch('value', function (updatedValue) {460            if (updatedValue !== undefined) {461              graph.refresh(updatedValue);462            }463          }, true);464        });465      }466    };467  }]);468"
469Add hook to get DOM from Angular,"define(function(require) {470  var module = require(""ui/modules"").get(""kibana-chord"");471 472  module.controller(""ChordController"", function($scope, Private, $element) {473    var div = $element[0];474 475    $scope.$watch(""esResponse"", function(response) {476      $scope.dataDump = JSON.stringify(response, null, 2);477    });478  });479 480  function ChordProvider(Private) {481    var TemplateVisType = Private(require(""ui/template_vis_type/TemplateVisType""));482    var Schemas = Private(require(""ui/Vis/Schemas""));483 484    return new TemplateVisType({485      name: ""chord"",486      title: ""Chord Diagram"",487      icon: ""fa-pie-chart"", // TODO make this look like a chord diagram488      description: ""Visualize network flows with a Chord Diagram."",489      requiresSearch: true,490      template: require(""plugins/kibana-chord/chord.html""),491      schemas: new Schemas([492        {493          group: ""metrics"",494          name: ""weight"",495          title: ""Chord Weight"",496          min: 1,497          max: 1,498          aggFilter: [""count"", ""sum""]499        },500        {501          group: ""buckets"",502          name: ""src"",503          title: ""Chord Sources"",504          min: 1,505          max: 1,506          aggFilter: ""terms""507        },508        {509          group: ""buckets"",510          name: ""dest"",511          title: ""Chord Destinations"",512          min: 1,513          max: 1,514          aggFilter: ""terms""515        }516      ])517    });518  }519 520  require(""ui/registry/vis_types"").register(ChordProvider);521 522  return ChordProvider;523 524});525","define(function(require) {526  var module = require(""ui/modules"").get(""kibana-chord"");527 528  module.controller(""ChordController"", function($scope, Private) {529    $scope.$watch(""esResponse"", function(response) {530      $scope.dataDump = JSON.stringify(response, null, 2);531    });532  });533 534  function ChordProvider(Private) {535    var TemplateVisType = Private(require(""ui/template_vis_type/TemplateVisType""));536    var Schemas = Private(require(""ui/Vis/Schemas""));537 538    return new TemplateVisType({539      name: ""chord"",540      title: ""Chord Diagram"",541      icon: ""fa-pie-chart"", // TODO make this look like a chord diagram542      description: ""Visualize network flows with a Chord Diagram."",543      requiresSearch: true,544      template: require(""plugins/kibana-chord/chord.html""),545      schemas: new Schemas([546        {547          group: ""metrics"",548          name: ""weight"",549          title: ""Chord Weight"",550          min: 1,551          max: 1,552          aggFilter: [""count"", ""sum""]553        },554        {555          group: ""buckets"",556          name: ""src"",557          title: ""Chord Sources"",558          min: 1,559          max: 1,560          aggFilter: ""terms""561        },562        {563          group: ""buckets"",564          name: ""dest"",565          title: ""Chord Destinations"",566          min: 1,567          max: 1,568          aggFilter: ""terms""569        }570      ])571    });572  }573 574  require(""ui/registry/vis_types"").register(ChordProvider);575 576  return ChordProvider;577 578});579"
580"BB-4210: Add validation functionality to RuleEditorComponent581- extended typeahead plugin;582- changed autocomplete init script;583- added typeahead behavior ะฐั‰ะบ empty value;","define(function(require) {584    'use strict';585 586    var $ = require('jquery');587    require('bootstrap');588 589    /**590     * This customization allows to define own focus, click, render, show, lookup functions for Typeahead591     */592    var Typeahead;593    var origTypeahead = $.fn.typeahead.Constructor;594    var origFnTypeahead = $.fn.typeahead;595 596    Typeahead = function(element, options) {597        var opts = $.extend({}, $.fn.typeahead.defaults, options);598        this.focus = opts.focus || this.focus;599        this.render = opts.render || this.render;600        this.show = opts.show || this.show;601        this.lookup = opts.lookup || this.lookup;602        origTypeahead.apply(this, arguments);603    };604 605    Typeahead.prototype = origTypeahead.prototype;606    Typeahead.prototype.constructor = Typeahead;607 608    $.fn.typeahead = function(option) {609        return this.each(function() {610            var $this = $(this);611            var data = $this.data('typeahead');612            var options = typeof option === 'object' && option;613            if (!data) {614                $this.data('typeahead', (data = new Typeahead(this, options)));615            }616            if (typeof option === 'string') {617                data[option]();618            }619        });620    };621 622    $.fn.typeahead.defaults = origFnTypeahead.defaults;623    $.fn.typeahead.Constructor = Typeahead;624    $.fn.typeahead.noConflict = origFnTypeahead.noConflict;625});626","define(function(require) {627    'use strict';628 629    var $ = require('jquery');630    require('bootstrap');631 632    /**633     * This customization allows to define own click, render, show functions for Typeahead634     */635    var Typeahead;636    var origTypeahead = $.fn.typeahead.Constructor;637    var origFnTypeahead = $.fn.typeahead;638 639    Typeahead = function(element, options) {640        var opts = $.extend({}, $.fn.typeahead.defaults, options);641        this.click = opts.click || this.click;642        this.render = opts.render || this.render;643        this.show = opts.show || this.show;644        origTypeahead.apply(this, arguments);645    };646 647    Typeahead.prototype = origTypeahead.prototype;648    Typeahead.prototype.constructor = Typeahead;649 650    $.fn.typeahead = function(option) {651        return this.each(function() {652            var $this = $(this);653            var data = $this.data('typeahead');654            var options = typeof option === 'object' && option;655            if (!data) {656                $this.data('typeahead', (data = new Typeahead(this, options)));657            }658            if (typeof option === 'string') {659                data[option]();660            }661        });662    };663 664    $.fn.typeahead.defaults = origFnTypeahead.defaults;665    $.fn.typeahead.Constructor = Typeahead;666    $.fn.typeahead.noConflict = origFnTypeahead.noConflict;667});668"
669Increase perfs when loading a product's page,"'use strict';670 671var set_taxon_select = function(selector){672  if ($(selector).length > 0) {673    $(selector).select2({674      placeholder: Spree.translations.taxon_placeholder,675      multiple: true,676      initSelection: function (element, callback) {677        var url = Spree.url(Spree.routes.taxons_search, {678          ids: element.val(),679          without_children: true,680          token: Spree.api_key681        });682        return $.getJSON(url, null, function (data) {683          return callback(data['taxons']);684        });685      },686      ajax: {687        url: Spree.routes.taxons_search,688        datatype: 'json',689        data: function (term, page) {690          return {691            per_page: 50,692            page: page,693            without_children: true,694            q: {695              name_cont: term696            },697            token: Spree.api_key698          };699        },700        results: function (data, page) {701          var more = page < data.pages;702          return {703            results: data['taxons'],704            more: more705          };706        }707      },708      formatResult: function (taxon) {709        return taxon.pretty_name;710      },711      formatSelection: function (taxon) {712        return taxon.pretty_name;713      }714    });715  }716}717 718$(document).ready(function () {719  set_taxon_select('#product_taxon_ids')720});721","'use strict';722 723var set_taxon_select = function(selector){724  if ($(selector).length > 0) {725    $(selector).select2({726      placeholder: Spree.translations.taxon_placeholder,727      multiple: true,728      initSelection: function (element, callback) {729        var url = Spree.url(Spree.routes.taxons_search, {730          ids: element.val(),731          token: Spree.api_key732        });733        return $.getJSON(url, null, function (data) {734          return callback(data['taxons']);735        });736      },737      ajax: {738        url: Spree.routes.taxons_search,739        datatype: 'json',740        data: function (term, page) {741          return {742            per_page: 50,743            page: page,744            without_children: true,745            q: {746              name_cont: term747            },748            token: Spree.api_key749          };750        },751        results: function (data, page) {752          var more = page < data.pages;753          return {754            results: data['taxons'],755            more: more756          };757        }758      },759      formatResult: function (taxon) {760        return taxon.pretty_name;761      },762      formatSelection: function (taxon) {763        return taxon.pretty_name;764      }765    });766  }767}768 769$(document).ready(function () {770  set_taxon_select('#product_taxon_ids')771});772"
773Change package name to tingbot-python for submission to PyPI,"#!/usr/bin/env python774# -*- coding: utf-8 -*-775 776try:777    from setuptools import setup778except ImportError:779    from distutils.core import setup780 781with open('README.rst') as readme_file:782    readme = readme_file.read()783 784requirements = [785    'pyzmq',786    'docopt',787    'virtualenv',788    'requests',789    'Pillow',790]791 792setup(793    name='tingbot-python',794    version='0.3.0',795    description=""Python APIs to write apps for Tingbot"",796    long_description=readme,797    author=""Joe Rickerby"",798    author_email='joerick@mac.com',799    url='https://github.com/tingbot/tingbot-python',800    packages=[801        'tingbot',802        'tbtool'803    ],804    package_dir={'tingbot': 'tingbot',805                 'tbtool': 'tbtool'},806    include_package_data=True,807    install_requires=requirements,808    license=""BSD"",809    zip_safe=False,810    keywords='tingbot',811    classifiers=[812        'Intended Audience :: Developers',813        'Natural Language :: English',814        ""Programming Language :: Python :: 2"",815        'Programming Language :: Python :: 2.7',816    ],817    entry_points={818        'console_scripts': [819            'tbtool = tbtool.__main__:main',820        ],821    },822    test_suite='tests',823    tests_require=['httpretty','mock'],824)825","#!/usr/bin/env python826# -*- coding: utf-8 -*-827 828try:829    from setuptools import setup830except ImportError:831    from distutils.core import setup832 833with open('README.rst') as readme_file:834    readme = readme_file.read()835 836requirements = [837    'pyzmq',838    'docopt',839    'virtualenv',840    'requests',841    'Pillow',842]843 844setup(845    name='tingbot',846    version='0.3.0',847    description=""Python APIs to write apps for Tingbot"",848    long_description=readme,849    author=""Joe Rickerby"",850    author_email='joerick@mac.com',851    url='https://github.com/tingbot/tingbot-python',852    packages=[853        'tingbot',854        'tbtool'855    ],856    package_dir={'tingbot': 'tingbot',857                 'tbtool': 'tbtool'},858    include_package_data=True,859    install_requires=requirements,860    license=""BSD"",861    zip_safe=False,862    keywords='tingbot',863    classifiers=[864        'Intended Audience :: Developers',865        'Natural Language :: English',866        ""Programming Language :: Python :: 2"",867        'Programming Language :: Python :: 2.7',868    ],869    entry_points={870        'console_scripts': [871            'tbtool = tbtool.__main__:main',872        ],873    },874    test_suite='tests',875    tests_require=['httpretty','mock'],876)877"
878Add carriage return for symmetry,"import getpass879from distutils.command import upload as orig880 881 882class upload(orig.upload):883    """"""884    Override default upload behavior to obtain password885    in a variety of different ways.886    """"""887 888    def finalize_options(self):889        orig.upload.finalize_options(self)890        # Attempt to obtain password. Short circuit evaluation at the first891        # sign of success.892        self.password = (893            self.password or894            self._load_password_from_keyring() or895            self._prompt_for_password()896        )897 898    def _load_password_from_keyring(self):899        """"""900        Attempt to load password from keyring. Suppress Exceptions.901        """"""902        try:903            keyring = __import__('keyring')904            password = keyring.get_password(self.repository, self.username)905        except Exception:906            password = None907        finally:908            return password909 910    def _prompt_for_password(self):911        """"""912        Prompt for a password on the tty. Suppress Exceptions.913        """"""914        password = None915        try:916            while not password:917                password = getpass.getpass()918        except (Exception, KeyboardInterrupt):919            password = None920        finally:921            return password922","import getpass923from distutils.command import upload as orig924 925 926class upload(orig.upload):927    """"""928    Override default upload behavior to obtain password929    in a variety of different ways.930    """"""931 932    def finalize_options(self):933        orig.upload.finalize_options(self)934        # Attempt to obtain password. Short circuit evaluation at the first935        # sign of success.936        self.password = (937            self.password or self._load_password_from_keyring() or938            self._prompt_for_password()939        )940 941    def _load_password_from_keyring(self):942        """"""943        Attempt to load password from keyring. Suppress Exceptions.944        """"""945        try:946            keyring = __import__('keyring')947            password = keyring.get_password(self.repository, self.username)948        except Exception:949            password = None950        finally:951            return password952 953    def _prompt_for_password(self):954        """"""955        Prompt for a password on the tty. Suppress Exceptions.956        """"""957        password = None958        try:959            while not password:960                password = getpass.getpass()961        except (Exception, KeyboardInterrupt):962            password = None963        finally:964            return password965"
966Add getDimensions to Bike model,"const imageSize = require('image-size')967 968module.exports = function (sequelize, DataTypes) {969  const Bike = sequelize.define('Bike', {970    id: {971      primaryKey: true,972      type: DataTypes.UUID,973      defaultValue: DataTypes.UUIDV4974    },975    name: {976      type: DataTypes.STRING,977      allowNull: false,978      validate: {979        notEmpty: true980      }981    },982    width: {983      type: DataTypes.INTEGER,984      allowNull: false985    },986    height: {987      type: DataTypes.INTEGER,988      allowNull: false989    },990    size: {991      type: DataTypes.INTEGER,992      allowNull: false,993      validate: {994        max: 5000000,995        min: 0996      }997    },998    type: {999      type: DataTypes.ENUM([1000        'image/png',1001        'image/jpeg'1002      ]),1003      allowNull: false,1004      validate: {1005        isIn: [['image/png', 'image/jpeg']]1006      }1007    },1008    BikeshedId: {1009      type: DataTypes.UUID,1010      allowNull: false1011    }1012  }, {1013    classMethods: {1014      associate (models) {1015        Bike.belongsTo(models.Bikeshed)1016        Bike.hasMany(models.Rating)1017      },1018 1019      /**1020       * Get dimensions1021       * Returns width and height1022       * @param {string} File path1023       * @returns {Promise<Object>} File dimensions promise1024       */1025      getDimensions (path) {1026        return new Promise((resolve, reject) => {1027          imageSize(path, (err, result) => {1028            err ? reject(err) : resolve(result)1029          })1030        })1031      },1032      }1033    }1034  })1035 1036  return Bike1037}1038","module.exports = function (sequelize, DataTypes) {1039  const Bike = sequelize.define('Bike', {1040    id: {1041      primaryKey: true,1042      type: DataTypes.UUID,1043      defaultValue: DataTypes.UUIDV41044    },1045    name: {1046      type: DataTypes.STRING,1047      allowNull: false,1048      validate: {1049        notEmpty: true1050      }1051    },1052    width: {1053      type: DataTypes.INTEGER,1054      allowNull: false1055    },1056    height: {1057      type: DataTypes.INTEGER,1058      allowNull: false1059    },1060    size: {1061      type: DataTypes.INTEGER,1062      allowNull: false,1063      validate: {1064        max: 5000000,1065        min: 01066      }1067    },1068    type: {1069      type: DataTypes.ENUM([1070        'image/png',1071        'image/jpeg'1072      ]),1073      allowNull: false,1074      validate: {1075        isIn: [['image/png', 'image/jpeg']]1076      }1077    },1078    BikeshedId: {1079      type: DataTypes.UUID,1080      allowNull: false1081    }1082  }, {1083    classMethods: {1084      associate (models) {1085        Bike.belongsTo(models.Bikeshed)1086        Bike.hasMany(models.Rating)1087      }1088    }1089  })1090 1091  return Bike1092}1093"
1094Fix error in docstring example.,"__all__ = (1095    'Category',1096)1097 1098 1099class Category(tuple):1100    """"""1101    This type acts as tuple with one key difference - two instances of it are1102    equal only when they have the same type. This allows you to easily mitigate1103    collisions when using common types (like string) in a dict or as a Wiring1104    :term:`specification`.1105 1106    Example::1107 1108        from wiring import Graph, Category1109 1110        class Public(Category):1111            pass1112 1113        class Secret(Category):1114            pass1115 1116        graph = Graph()1117        graph.register_instance(Public('database', 1), 'db://public/1')1118        graph.register_instance(Secret('database', 1), 'db://private/1')1119 1120        assert Public('database', 1) != Private('database', 1)1121        assert (1122            graph.get(Public('database', 1))1123                != graph.get(Private('database', 1))1124        )1125    """"""1126 1127    def __new__(cls, *args):1128        return super(Category, cls).__new__(cls, args)1129 1130    def __repr__(self):1131        return type(self).__name__ + super(Category, self).__repr__()1132 1133    def __str__(self):1134        return repr(self)1135 1136    def __eq__(self, other):1137        return (1138            type(self) == type(other) and super(Category, self).__eq__(other)1139        )1140 1141    def __ne__(self, other):1142        return not self.__eq__(other)1143 1144    def __hash__(self):1145        return hash((1146            type(self),1147            super(Category, self).__hash__()1148        ))1149","__all__ = (1150    'Category',1151)1152 1153 1154class Category(tuple):1155    """"""1156    This type acts as tuple with one key difference - two instances of it are1157    equal only when they have the same type. This allows you to easily mitigate1158    collisions when using common types (like string) in a dict or as a Wiring1159    :term:`specification`.1160 1161    Example::1162 1163        from wiring import Graph, Category1164 1165        class Public(Category):1166            pass1167 1168        class Secret(Category):1169            pass1170 1171        graph = Graph()1172        graph.register_instance(Public('database', 1), 'db://public/1')1173        graph.register_instance(Private('database', 1), 'db://private/1')1174 1175        assert Public('database', 1) != Private('database', 1)1176        assert (1177            graph.get(Public('database', 1))1178                != graph.get(Private('database', 1))1179        )1180    """"""1181 1182    def __new__(cls, *args):1183        return super(Category, cls).__new__(cls, args)1184 1185    def __repr__(self):1186        return type(self).__name__ + super(Category, self).__repr__()1187 1188    def __str__(self):1189        return repr(self)1190 1191    def __eq__(self, other):1192        return (1193            type(self) == type(other) and super(Category, self).__eq__(other)1194        )1195 1196    def __ne__(self, other):1197        return not self.__eq__(other)1198 1199    def __hash__(self):1200        return hash((

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