file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
resolver.js
"use strict"; var Resolver = require("enhanced-resolve/lib/Resolver"); var SyncNodeJsInputFileSystem = require("enhanced-resolve/lib/SyncNodeJsInputFileSystem"); var CachedInputFileSystem = require("enhanced-resolve/lib/CachedInputFileSystem"); var UnsafeCachePlugin = require("enhanced-resolve/lib/UnsafeCachePlugin");...
Object.defineProperty(exports, "__esModule", { value: true }); exports.default = makeResolver; //# sourceMappingURL=resolver.js.map
{ var fileSystem = new CachedInputFileSystem(new SyncNodeJsInputFileSystem(), 60000); var resolver = new Resolver(fileSystem); resolver.apply(new UnsafeCachePlugin(options.resolve.unsafeCache), options.resolve.packageAlias ? new DirectoryDescriptionFileFieldAliasPlugin("package.json", options.resolve.packag...
identifier_body
_gatebody.py
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
(Node): """Node for an OPENQASM custom gate body. children is a list of gate operation nodes. These are one of barrier, custom_unitary, U, or CX. """ def __init__(self, children): """Create the gatebody node.""" Node.__init__(self, 'gate_body', children, None) def qasm(self, p...
GateBody
identifier_name
_gatebody.py
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
def calls(self): """Return a list of custom gate names in this gate body.""" lst = [] for children in self.children: if children.type == "custom_unitary": lst.append(children.name) return lst
"""Return the corresponding OPENQASM string.""" string = "" for children in self.children: string += " " + children.qasm(prec) + "\n" return string
identifier_body
_gatebody.py
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
return lst
lst.append(children.name)
conditional_block
_gatebody.py
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
These are one of barrier, custom_unitary, U, or CX. """ def __init__(self, children): """Create the gatebody node.""" Node.__init__(self, 'gate_body', children, None) def qasm(self, prec=15): """Return the corresponding OPENQASM string.""" string = "" for childr...
class GateBody(Node): """Node for an OPENQASM custom gate body. children is a list of gate operation nodes.
random_line_split
zigbeeoutputstep_test.py
''' Created on Mar 8, 2013 @author: Gary ''' import unittest from housemonitor.outputs.zigbee.zigbeecontrol import ZigBeeControl from housemonitor.outputs.zigbee.zigbeeoutputstep import ZigBeeOutputStep from housemonitor.outputs.zigbee.zigbeeoutputthread import ZigBeeOutputThread from housemonitor.lib.hmqueue import H...
def tearDown( self ): pass def test_logger_name( self ): queue = HMQueue() zig = ZigBeeOutputStep( queue ) self.assertEqual( Constants.LogKeys.outputsZigBee, zig.logger_name ) def test_topic_name( self ): queue = HMQueue() zig = ZigBeeOutputStep( queue ) ...
def setUp( self ): logging.config.fileConfig( "unittest_logging.conf" )
random_line_split
zigbeeoutputstep_test.py
''' Created on Mar 8, 2013 @author: Gary ''' import unittest from housemonitor.outputs.zigbee.zigbeecontrol import ZigBeeControl from housemonitor.outputs.zigbee.zigbeeoutputstep import ZigBeeOutputStep from housemonitor.outputs.zigbee.zigbeeoutputthread import ZigBeeOutputThread from housemonitor.lib.hmqueue import H...
unittest.main()
conditional_block
zigbeeoutputstep_test.py
''' Created on Mar 8, 2013 @author: Gary ''' import unittest from housemonitor.outputs.zigbee.zigbeecontrol import ZigBeeControl from housemonitor.outputs.zigbee.zigbeeoutputstep import ZigBeeOutputStep from housemonitor.outputs.zigbee.zigbeeoutputthread import ZigBeeOutputThread from housemonitor.lib.hmqueue import H...
( self ): queue = HMQueue() zig = ZigBeeOutputStep( queue ) self.assertEqual( Constants.LogKeys.outputsZigBee, zig.logger_name ) def test_topic_name( self ): queue = HMQueue() zig = ZigBeeOutputStep( queue ) self.assertEqual( Constants.TopicNames.ZigBeeOutput, zig.to...
test_logger_name
identifier_name
zigbeeoutputstep_test.py
''' Created on Mar 8, 2013 @author: Gary ''' import unittest from housemonitor.outputs.zigbee.zigbeecontrol import ZigBeeControl from housemonitor.outputs.zigbee.zigbeeoutputstep import ZigBeeOutputStep from housemonitor.outputs.zigbee.zigbeeoutputthread import ZigBeeOutputThread from housemonitor.lib.hmqueue import H...
def test_topic_name( self ): queue = HMQueue() zig = ZigBeeOutputStep( queue ) self.assertEqual( Constants.TopicNames.ZigBeeOutput, zig.topic_name ) def test_step( self ): value = 5 data = {Constants.DataPacket.device: 'device', Constants.DataPacket.por...
queue = HMQueue() zig = ZigBeeOutputStep( queue ) self.assertEqual( Constants.LogKeys.outputsZigBee, zig.logger_name )
identifier_body
setup.py
#!/usr/bin/env python #------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #----------------------------------------------------------------...
# Exclude packages that will be covered by PEP420 or nspkg 'azure', 'azure.mgmt', ]), install_requires=[ 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.3.0,<2.0.0', ], python_requires=">=3.6" )
random_line_split
setup.py
#!/usr/bin/env python #------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #----------------------------------------------------------------...
with open('README.md', encoding='utf-8') as f: readme = f.read() with open('CHANGELOG.md', encoding='utf-8') as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), long_description=readme + ...
raise RuntimeError('Cannot find version information')
conditional_block
phone.js
import React from 'react'
import Icon from 'react-icon-base' const FaPhone = props => ( <Icon viewBox="0 0 40 40" {...props}> <g><path d="m35.9 27.7q0 0.6-0.2 1.6t-0.5 1.5q-0.4 1.1-2.7 2.3-2.1 1.2-4.1 1.2-0.6 0-1.2-0.1t-1.3-0.3-1.1-0.3-1.2-0.5-1.1-0.4q-2.2-0.7-3.9-1.8-2.8-1.8-5.9-4.8t-4.8-5.9q-1.1-1.7-1.9-3.9 0-0.2-0.4-1.1t-0.4-1.3...
random_line_split
visualization.py
get_temp_markers(year, attacks): """ Gives all the information about the markers needed for the year passed in argument. """ data_given_year = attacks[attacks['Year'] == year].reset_index() num_markers = data_given_year.shape[0] markers = np.zeros(num_markers, dtype=[('Longitude', float, 1), ...
(attacks): """ Zooms in the particular location of the attacks perpetrated by the Taliban group showing the intensity of the attacks. """ fig = plt.figure(figsize=(15,15)) ax = fig.add_subplot(111) cmap = plt.get_cmap('inferno') plt.title('Intensity of attacks perpetrated by the Taliban group\n') #...
zoom_taliban_intensity
identifier_name
visualization.py
get_temp_markers(year, attacks): """ Gives all the information about the markers needed for the year passed in argument. """ data_given_year = attacks[attacks['Year'] == year].reset_index() num_markers = data_given_year.shape[0] markers = np.zeros(num_markers, dtype=[('Longitude', float, 1), ...
scat = map.scatter(xs, ys, s=temp_markers['Size'], c=temp_markers['Color'], cmap=cmap, marker='o', alpha=0.3, zorder=10) year_text = plt.text(-170, 80, str(frames[0]),fontsize=15) cbar = map.colorbar(scat, location='bottom') cbar.set_label('number of killed people 0.0 = min [0] 1.0 = max [{}]' .format(_MA...
""" Creates an animation where we see the evolution of the worldwide terrorist attacks among the available years. """ fig = plt.figure(figsize=(10, 10)) cmap = plt.get_cmap('inferno') # create the map map = Basemap(projection='cyl') map.drawmapboundary() map.fillcontinents(color='lightgray', zorder=...
identifier_body
visualization.py
from mpl_toolkits.axes_grid1.inset_locator import mark_inset from pca import create_handles import warnings warnings.filterwarnings('ignore') def get_temp_markers(year, attacks): """ Gives all the information about the markers needed for the year passed in argument. """ data_given_year = attacks[attacks[...
from mpl_toolkits.basemap import Basemap from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
random_line_split
conf.py
import django.conf class AppSettings(object): """ A holder for app-specific default settings that allows overriding via the project's settings. """ def __getattribute__(self, attr): if attr == attr.upper(): try: return getattr(django.conf.settings, attr) ...
Some examples: "Bolivia" instead of "Bolivia, Plurinational State of" "South Korea" instead of "Korea (the Republic of)" "Taiwan" instead of "Taiwan (Province of China)" """ COUNTRIES_OVERRIDE = {} """ A dictionary of names to override the defaults. Note that you will n...
COUNTRIES_FLAG_URL = 'flags/{code}.gif' """ The URL for a flag. It can either be relative to the static url, or an absolute url. The location is parsed using Python's string formatting and is passed the following arguments: * code * code_upper For example: ``COUNTRIES_FLAG_UR...
identifier_body
conf.py
import django.conf class AppSettings(object): """ A holder for app-specific default settings that allows overriding via the project's settings. """ def __getattribute__(self, attr): if attr == attr.upper(): try: return getattr(django.conf.settings, attr) ...
countries. """ COUNTRIES_FIRST_SORT = False """ Countries listed in :attr:`COUNTRIES_FIRST` will be alphanumerically sorted based on their translated name instead of relying on their order in :attr:`COUNTRIES_FIRST`. """ settings = Settings()
random_line_split
conf.py
import django.conf class AppSettings(object): """ A holder for app-specific default settings that allows overriding via the project's settings. """ def __getattribute__(self, attr): if attr == attr.upper():
return super(AppSettings, self).__getattribute__(attr) class Settings(AppSettings): COUNTRIES_FLAG_URL = 'flags/{code}.gif' """ The URL for a flag. It can either be relative to the static url, or an absolute url. The location is parsed using Python's string formatting and is passed the ...
try: return getattr(django.conf.settings, attr) except AttributeError: pass
conditional_block
conf.py
import django.conf class
(object): """ A holder for app-specific default settings that allows overriding via the project's settings. """ def __getattribute__(self, attr): if attr == attr.upper(): try: return getattr(django.conf.settings, attr) except AttributeError: ...
AppSettings
identifier_name
debug_element_view_listener.ts
import { CONST_EXPR, isPresent, NumberWrapper, StringWrapper, RegExpWrapper } from 'angular2/src/facade/lang'; import {MapWrapper, Map, ListWrapper, List} from 'angular2/src/facade/collection'; import {Injectable, bind, Binding} from 'angular2/di'; import {AppViewListener} from 'angular2/src/core/compiler/vie...
var _nextId = 0; function _setElementId(element, indices: List<number>) { if (isPresent(element)) { DOM.setData(element, NG_ID_PROPERTY, ListWrapper.join(indices, NG_ID_SEPARATOR)); } } function _getElementId(element): List<number> { var elId = DOM.getData(element, NG_ID_PROPERTY); if (isPresent(elId)) {...
var NG_ID_SEPARATOR = '#'; // Need to keep the views in a global Map so that multiple angular apps are supported var _allIdsByView = new Map<AppView, number>(); var _allViewsById = new Map<number, AppView>();
random_line_split
debug_element_view_listener.ts
import { CONST_EXPR, isPresent, NumberWrapper, StringWrapper, RegExpWrapper } from 'angular2/src/facade/lang'; import {MapWrapper, Map, ListWrapper, List} from 'angular2/src/facade/collection'; import {Injectable, bind, Binding} from 'angular2/di'; import {AppViewListener} from 'angular2/src/core/compiler/vie...
implements AppViewListener { constructor(private _renderer: Renderer) { DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); } viewCreated(view: AppView) { var viewId = _nextId++; _allViewsById.set(viewId, view); _allIdsByView.set(view, viewId); for (var i = 0; i < view.elementRefs.l...
DebugElementViewListener
identifier_name
debug_element_view_listener.ts
import { CONST_EXPR, isPresent, NumberWrapper, StringWrapper, RegExpWrapper } from 'angular2/src/facade/lang'; import {MapWrapper, Map, ListWrapper, List} from 'angular2/src/facade/collection'; import {Injectable, bind, Binding} from 'angular2/di'; import {AppViewListener} from 'angular2/src/core/compiler/vie...
return null; } @Injectable() export class DebugElementViewListener implements AppViewListener { constructor(private _renderer: Renderer) { DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); } viewCreated(view: AppView) { var viewId = _nextId++; _allViewsById.set(viewId, view); _allI...
{ var view = _allViewsById.get(elId[0]); if (isPresent(view)) { return new DebugElement(view, elId[1]); } }
conditional_block
presentation.module.js
'use strict'; import { module } from 'angular'; import { AUTO_SCROLL_DIRECTIVE } from './autoScroll/autoScroll.directive'; import { ANY_FIELD_FILTER } from './anyFieldFilter/anyField.filter'; import { LINK_WITH_CLIPBOARD } from './linkWithClipboard.component'; import { PAGE_NAVIGATOR_COMPONENT } from './navigation/pa...
ROBOT_TO_HUMAN_FILTER, CORE_PRESENTATION_SORTTOGGLE_SORTTOGGLE_DIRECTIVE, CORE_PRESENTATION_PERCENT_FILTER, REPLACE_FILTER, ]).run(domPurifyOpenLinksInNewWindow);
random_line_split
regexdna.rs
use test::Bencher; use {Regex, Text}; // USAGE: dna!(name, pattern, count) // // This is same as bench_find, except it always uses the regexdna haystack. macro_rules! dna { ($name:ident, $pattern:expr, $count:expr) => { bench_find!( $name, $pattern, $count, ...
dna!(variant7, r"agggt[cgt]aa|tt[acg]accct", 137); dna!(variant8, r"agggta[cgt]a|t[acg]taccct", 139); dna!(variant9, r"agggtaa[cgt]|[acg]ttaccct", 197); dna!(subst1, r"B", 29963); dna!(subst2, r"D", 29987); dna!(subst3, r"H", 30004); dna!(subst4, r"K", 29974); dna!(subst5, r"M", 29979); dna!(subst6, r"N", 29959); dna!(...
dna!(variant5, r"agg[act]taaa|ttta[agt]cct", 466); dna!(variant6, r"aggg[acg]aaa|ttt[cgt]ccct", 135);
random_line_split
jquery.gallery.js
/** * Edeco's gallery * * @author LMV <luis.montealegre@mandragora-web.systems> * @copyright Mandrágora Web-Based Systems * @version SVN: $Id$ * @package Edeco */ (function($) { $.gallery = function(properties, options) { var defaults = { galleryDirectory: '/images/gallery/', ...
}; /** * @return void */ var _replaceTitle = function(propertyName) { var title = $('<h2></h2>').append(propertyName) .attr('id', 'gallery-property-name'); $('#gallery-property-name').replaceWith(title); ...
var property = properties[i]; if (property.id == id) { $('#gallery-current').fadeOut('slow'); _replaceTitle(property.name); _replaceImage(property.Picture); _replaceDescription(property); ...
conditional_block
jquery.gallery.js
/** * Edeco's gallery * * @author LMV <luis.montealegre@mandragora-web.systems>
* @package Edeco */ (function($) { $.gallery = function(properties, options) { var defaults = { galleryDirectory: '/images/gallery/', imagesDirectory: '/images/properties/', propertyDetailUrl: '/' }; options = $.extend(defaults, options); /**...
* @copyright Mandrágora Web-Based Systems * @version SVN: $Id$
random_line_split
script.py
def get_data(): import pickle with open('data.p', 'rb') as f: return pickle.load(f) if __name__ == '__main__': import praw import os, os.path from datetime import datetime, timedelta # Change the working directory to the script directory os.chdir(os.path.dirname(os.pat...
post_date, submission.score, submission.title, submission.author)[0:300], url = submission.url.replace('www', 'np', 1), send_replies = False)) for post in posts: b...
title = '[{}, +{}] "{}" by /u/{}'.format(
random_line_split
script.py
def get_data():
if __name__ == '__main__': import praw import os, os.path from datetime import datetime, timedelta # Change the working directory to the script directory os.chdir(os.path.dirname(os.path.abspath(__file__))) reddit = praw.Reddit(**get_data()) bons = reddit.subreddit('best_of_no...
import pickle with open('data.p', 'rb') as f: return pickle.load(f)
identifier_body
script.py
def
(): import pickle with open('data.p', 'rb') as f: return pickle.load(f) if __name__ == '__main__': import praw import os, os.path from datetime import datetime, timedelta # Change the working directory to the script directory os.chdir(os.path.dirname(os.path.abspath(__...
get_data
identifier_name
script.py
def get_data(): import pickle with open('data.p', 'rb') as f: return pickle.load(f) if __name__ == '__main__': import praw import os, os.path from datetime import datetime, timedelta # Change the working directory to the script directory os.chdir(os.path.dirname(os.pat...
for post in posts: bons.submit(**post)
posts.insert(0, dict( title = '[{}, +{}] "{}" by /u/{}'.format( post_date, submission.score, submission.title, submission.author)[0:300], url = submission.url.re...
conditional_block
inkCssRipple.js
angular.module('material.animations') .directive('inkRipple', [ '$materialInkRipple', InkRippleDirective ]) .factory('$materialInkRipple', [ '$window', '$$rAF', '$materialEffects', '$timeout', InkRippleService ]); function InkRippleDirective($materialInkRipple) { return function(scope, element, attr...
function rippleIsAllowed() { return !Util.isParentDisabled(element); } function createRipple(left, top, positionsAreAbsolute) { var rippleEl = angular.element('<div class="material-ripple">') .css($materialEffects.ANIMATION_DURATION, options.animationDuration + 'ms') ...
{ element[shouldListen ? 'on' : 'off'](POINTERDOWN_EVENT, onPointerDown); }
identifier_body
inkCssRipple.js
angular.module('material.animations') .directive('inkRipple', [ '$materialInkRipple', InkRippleDirective ]) .factory('$materialInkRipple', [ '$window', '$$rAF', '$materialEffects', '$timeout', InkRippleService ]); function InkRippleDirective($materialInkRipple) { return function(scope, element, attr)...
$window.getComputedStyle(node).color, 'border-radius': (containerWidth / 2) + 'px', left: (left - containerWidth / 2) + 'px', width: containerWidth + 'px', top: (top - containerWidth / 2) + 'px', height: containerWidth + 'px' }; css[$materialEffects.ANIMAT...
var css = { 'background-color': $window.getComputedStyle(rippleEl[0]).color ||
random_line_split
inkCssRipple.js
angular.module('material.animations') .directive('inkRipple', [ '$materialInkRipple', InkRippleDirective ]) .factory('$materialInkRipple', [ '$window', '$$rAF', '$materialEffects', '$timeout', InkRippleService ]); function InkRippleDirective($materialInkRipple) { return function(scope, element, attr...
(left, top, positionsAreAbsolute) { var rippleEl = angular.element('<div class="material-ripple">') .css($materialEffects.ANIMATION_DURATION, options.animationDuration + 'ms') .css($materialEffects.ANIMATION_NAME, options.animationName) .css($materialEffects.ANIMATION_TIMING, ...
createRipple
identifier_name
inkCssRipple.js
angular.module('material.animations') .directive('inkRipple', [ '$materialInkRipple', InkRippleDirective ]) .factory('$materialInkRipple', [ '$window', '$$rAF', '$materialEffects', '$timeout', InkRippleService ]); function InkRippleDirective($materialInkRipple) { return function(scope, element, attr...
}; } function InkRippleService($window, $$rAF, $materialEffects, $timeout) { // TODO fix this. doesn't support touch AND click devices (eg chrome pixel) var hasTouch = !!('ontouchend' in document); var POINTERDOWN_EVENT = hasTouch ? 'touchstart' : 'mousedown'; var POINTERUP_EVENT = hasTouch ? 'touchend tou...
{ $materialInkRipple.attachButtonBehavior(element); }
conditional_block
index.js
} hexDigest () { return this.digest && Buffer.from(this.digest, 'base64').toString('hex') } toJSON () { return this.toString() } toString (opts) { if (opts && opts.strict) { // Strict mode enforces the standard as close to the foot of the // letter as it can. if (!( // T...
module.exports.checkData = checkData function checkData (data, sri, opts) { opts = opts || {} sri = parse(sri, opts) if (!Object.keys(sri).length) { if (opts.error) { throw Object.assign( new Error('No valid integrity hashes to check against'), { code: 'EINTEGRITY' } ) ...
{ opts = opts || {} const P = opts.Promise || Promise const istream = integrityStream(opts) return new P((resolve, reject) => { stream.pipe(istream) stream.on('error', reject) istream.on('error', reject) let sri istream.on('integrity', s => { sri = s }) istream.on('end', () => resolve(sr...
identifier_body
index.js
} hexDigest () { return this.digest && Buffer.from(this.digest, 'base64').toString('hex') } toJSON () { return this.toString() } toString (opts) { if (opts && opts.strict) { // Strict mode enforces the standard as close to the foot of the // letter as it can. if (!( // ...
sep = sep.replace(/\S+/g, ' ') } return Object.keys(this).map(k => { return this[k].map(hash => { return Hash.prototype.toString.call(hash, opts) }).filter(x => x.length).join(sep) }).filter(x => x.length).join(sep) } concat (integrity, opts) { const other = typeof integrit...
toString (opts) { opts = opts || {} let sep = opts.sep || ' ' if (opts.strict) { // Entries must be separated by whitespace, according to spec.
random_line_split
index.js
} hexDigest () { return this.digest && Buffer.from(this.digest, 'base64').toString('hex') } toJSON () { return this.toString() } toString (opts) { if (opts && opts.strict) { // Strict mode enforces the standard as close to the foot of the // letter as it can. if (!( // ...
(integrity, opts) { const other = parse(integrity, opts) const algo = other.pickAlgorithm(opts) return ( this[algo] && other[algo] && this[algo].find(hash => other[algo].find(otherhash => hash.digest === otherhash.digest ) ) ) || false } pickAlgorit...
match
identifier_name
index.js
} hexDigest () { return this.digest && Buffer.from(this.digest, 'base64').toString('hex') } toJSON () { return this.toString() } toString (opts) { if (opts && opts.strict) { // Strict mode enforces the standard as close to the foot of the // letter as it can. if (!( // T...
else { return false } } const algorithm = sri.pickAlgorithm(opts) const digest = crypto.createHash(algorithm).update(data).digest('base64') const newSri = parse({algorithm, digest}) const match = newSri.match(sri, opts) if (match || !opts.error) { return match } else if (typeof opts.size ==...
{ throw Object.assign( new Error('No valid integrity hashes to check against'), { code: 'EINTEGRITY' } ) }
conditional_block
header.js
'use strict'; class Header extends React.Component { constructor(props) { super(props); this.state = { doneFilters: false }; } componentDidUpdate() { if (this.props.filters && !this.state.doneFilters) { $('.button-collapse').sideNav(); this.setState({ doneFilters: true }); ...
if (!this.props.filters) { buttonClasses += ' hidden'; } else { filters = React.createElement(Filters, this.props); } return React.createElement( 'nav', { className: 'red', role: 'navigation' }, React.createElement( 'div', { className: 'nav-wrapper container...
} render() { var buttonClasses = 'button-collapse'; var filters = null;
random_line_split
header.js
'use strict'; class
extends React.Component { constructor(props) { super(props); this.state = { doneFilters: false }; } componentDidUpdate() { if (this.props.filters && !this.state.doneFilters) { $('.button-collapse').sideNav(); this.setState({ doneFilters: true }); } } render() { var...
Header
identifier_name
header.js
'use strict'; class Header extends React.Component { constructor(props) { super(props); this.state = { doneFilters: false }; } componentDidUpdate() { if (this.props.filters && !this.state.doneFilters) { $('.button-collapse').sideNav(); this.setState({ doneFilters: true }); ...
else { filters = React.createElement(Filters, this.props); } return React.createElement( 'nav', { className: 'red', role: 'navigation' }, React.createElement( 'div', { className: 'nav-wrapper container' }, React.createElement( 'a', { id: 'logo...
{ buttonClasses += ' hidden'; }
conditional_block
header.js
'use strict'; class Header extends React.Component { constructor(props) { super(props); this.state = { doneFilters: false }; } componentDidUpdate() { if (this.props.filters && !this.state.doneFilters) { $('.button-collapse').sideNav(); this.setState({ doneFilters: true }); ...
'div', { id: 'slide-out', className: 'side-nav' }, filters ), React.createElement( 'a', { href: '#', 'data-activates': 'slide-out', className: buttonClasses }, React.createElement('i', { className: 'mdi-navig...
{ var buttonClasses = 'button-collapse'; var filters = null; if (!this.props.filters) { buttonClasses += ' hidden'; } else { filters = React.createElement(Filters, this.props); } return React.createElement( 'nav', { className: 'red', role: 'navigation' }, React.crea...
identifier_body
__init__.py
#!/usr/bin/python # -*- coding: utf-8 -*- """zigzi, Platform independent binary instrumentation module. Copyright (c) 2016-2017 hanbum park <kese111@gmail.com> All rights reserved. For detailed copyright information see the file COPYING in the root of the distribution archive. """ import argparse from PEInstrume...
(): simple_indirect_branch_counting_function_instrument() pe_instrument.register_pre_indirect_branch( simple_indirect_branch_counting_function_call_instrument ) def do_return_address_verifier(pe_instrument, pe_manager, fn_rva): simple_instrument_error_handler(pe_instrument, pe_manager, fn_rva...
do_indirect_branch_counting
identifier_name
__init__.py
#!/usr/bin/python # -*- coding: utf-8 -*- """zigzi, Platform independent binary instrumentation module. Copyright (c) 2016-2017 hanbum park <kese111@gmail.com> All rights reserved. For detailed copyright information see the file COPYING in the root of the distribution archive. """ import argparse from PEInstrume...
# pe_manager.adjust_file_layout() output_filename = filename[:-4] + "_after_test.exe" pe_manager.writefile(output_filename) pe_instrument._save_instruction_log() # C:\work\python\zigzi\tests\simple_echo_server.exe
random_line_split
__init__.py
#!/usr/bin/python # -*- coding: utf-8 -*- """zigzi, Platform independent binary instrumentation module. Copyright (c) 2016-2017 hanbum park <kese111@gmail.com> All rights reserved. For detailed copyright information see the file COPYING in the root of the distribution archive. """ import argparse from PEInstrume...
def do_return_address_verifier(pe_instrument, pe_manager, fn_rva): simple_instrument_error_handler(pe_instrument, pe_manager, fn_rva) pe_instrument.register_after_relative_branch( simple_instrument_return_address_at_after_branch ) pe_instrument.register_after_indirect_branch( simple_i...
simple_indirect_branch_counting_function_instrument() pe_instrument.register_pre_indirect_branch( simple_indirect_branch_counting_function_call_instrument )
identifier_body
__init__.py
#!/usr/bin/python # -*- coding: utf-8 -*- """zigzi, Platform independent binary instrumentation module. Copyright (c) 2016-2017 hanbum park <kese111@gmail.com> All rights reserved. For detailed copyright information see the file COPYING in the root of the distribution archive. """ import argparse from PEInstrume...
pe_manager = PEManager(filename) # add api window_api_helper = WindowAPIHelper(pe_manager) message_box_fn_rva = window_api_helper.add_message_box() # set new instrumentation pe_instrument = PEInstrument(pe_manager) do_return_address_verifier(pe_instrument, pe_manager, message_box_fn_rva) ...
parser.print_help() exit()
conditional_block
process-model-container.component.ts
import { Component } from '@angular/core';
import { IContainer } from '../../../../../../../model/IContainer'; import { Process } from '../../../../../../../model/Process'; import { Id } from '../../../../../../../util/id'; import { Type } from '../../../../../../../util/type'; import { SpecmateDataService } from '../../../../../../data/modules/data-service...
import { TranslateService } from '@ngx-translate/core'; import { ModelFactoryBase } from '../../../../../../../factory/model-factory-base'; import { ProcessFactory } from '../../../../../../../factory/process-factory';
random_line_split
process-model-container.component.ts
import { Component } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { ModelFactoryBase } from '../../../../../../../factory/model-factory-base'; import { ProcessFactory } from '../../../../../../../factory/process-factory'; import { IContainer } from '../../../../../../../model...
extends TestSpecificationContentContainerBase<Process> { constructor(dataService: SpecmateDataService, navigator: NavigatorService, translate: TranslateService, modal: ConfirmationModal, additionalInformationService: AdditionalInformationService, contentService: Cont...
ProcessModelContainer
identifier_name
mon_stream.rs
//! TCP stream with flow statistic monitored use std::{ io::{self, IoSlice}, pin::Pin, sync::Arc, task::{Context, Poll}, }; use pin_project::pin_project; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use super::flow::FlowStat; /// Monitored `ProxyStream` #[pin_project] pub struct MonProxyStream<S...
(&self) -> &S { &self.stream } #[inline] pub fn get_mut(&mut self) -> &mut S { &mut self.stream } } impl<S> AsyncRead for MonProxyStream<S> where S: AsyncRead + Unpin, { #[inline] fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll<io::Re...
get_ref
identifier_name
mon_stream.rs
//! TCP stream with flow statistic monitored use std::{ io::{self, IoSlice}, pin::Pin, sync::Arc, task::{Context, Poll}, }; use pin_project::pin_project; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use super::flow::FlowStat; /// Monitored `ProxyStream` #[pin_project] pub struct MonProxyStream<S...
#[inline] fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> { self.project().stream.poll_flush(cx) } #[inline] fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> { self.project().stream.poll_shutdown(cx) } ...
{ let this = self.project(); match this.stream.poll_write(cx, buf) { Poll::Pending => Poll::Pending, Poll::Ready(Ok(n)) => { this.flow_stat.incr_tx(n as u64); Poll::Ready(Ok(n)) } Poll::Ready(Err(err)) => Poll::Ready(Err(err...
identifier_body
mon_stream.rs
//! TCP stream with flow statistic monitored use std::{ io::{self, IoSlice}, pin::Pin, sync::Arc, task::{Context, Poll}, }; use pin_project::pin_project; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use super::flow::FlowStat; /// Monitored `ProxyStream` #[pin_project] pub struct MonProxyStream<S...
Poll::Pending => Poll::Pending, Poll::Ready(Ok(n)) => { this.flow_stat.incr_tx(n as u64); Poll::Ready(Ok(n)) } Poll::Ready(Err(err)) => Poll::Ready(Err(err)), } } #[inline] fn poll_flush(self: Pin<&mut Self>, cx: &mut C...
random_line_split
brownian.rs
// Copyright 2013 The Noise-rs Developers. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ...
fn brownian4_for_image(seed: &Seed, point: &Point2<f32>) -> f32 { Brownian4::new(perlin4, 4).wavelength(16.0).apply(seed, &[point[0], point[1], 0.0, 0.0]) }
{ Brownian3::new(perlin3, 4).wavelength(16.0).apply(seed, &[point[0], point[1], 0.0]) }
identifier_body
brownian.rs
// Copyright 2013 The Noise-rs Developers. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ...
extern crate noise; use noise::{Brownian2, Brownian3, Brownian4, perlin2, perlin3, perlin4, Seed, Point2}; mod debug; fn main() { debug::render_png("brownian2.png", &Seed::new(0), 1024, 1024, brownian2_for_image); debug::render_png("brownian3.png", &Seed::new(0), 1024, 1024, brownian3_for_image); debug::...
random_line_split
brownian.rs
// Copyright 2013 The Noise-rs Developers. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ...
(seed: &Seed, point: &Point2<f32>) -> f32 { Brownian2::new(perlin2, 4).wavelength(16.0).apply(seed, point) } fn brownian3_for_image(seed: &Seed, point: &Point2<f32>) -> f32 { Brownian3::new(perlin3, 4).wavelength(16.0).apply(seed, &[point[0], point[1], 0.0]) } fn brownian4_for_image(seed: &Seed, point: &Point...
brownian2_for_image
identifier_name
get-memory-usage-chart.js
// @flow // // Copyright (c) 2018 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. import flatMapChanges from "@iml/flat-map-changes"; import getMemoryUsageStream from "./get-memory-usage-stream.js"; import { formatBytes } from "@iml/nu...
return formatBytes(number, 4); }); d3Chart.xAxis.showMaxMin(false); } } }; const config2$ = getStore.select("memoryUsageCharts"); config2$.through(getConf(page)).each((x: durationPayloadT) => { Object.assign(conf, x);...
if (number === 0) return number;
random_line_split
task.model.ts
import { some, Optional, none, mapper } from "../model/optional.model"; export class TaskSuccess<T> { readonly value: T; constructor(value: T) { this.value = value; } isSuccess(){ return true; }; isFailure(){ return false; } isPending(){ return false; ...
(): Optional<T> { return some(this.value); } } export class TaskFailure<T> { readonly error: Error; constructor(err: Error) { this.error = err; } isSuccess(){ return false; }; isFailure(){ return true; } isPending(){ return false; } ...
optional
identifier_name
task.model.ts
import { some, Optional, none, mapper } from "../model/optional.model"; export class TaskSuccess<T> { readonly value: T; constructor(value: T) { this.value = value; } isSuccess(){ return true; }; isFailure(){ return false; } isPending(){ return false; ...
export namespace TaskUtils { export const pending: TaskPending<never> = new TaskPending<never>(); export const success = <T>(result: T) => new TaskSuccess<T>(result); export const failure = <T>(error: Error) => new TaskFailure<T>(error); }
random_line_split
rx-imports.ts
/* -=- RxJs imports -=- * * Here you can place any RxJs imports so you don't have to constantly * import them throughout your App :) * * This file is automatically imported into `polyfills.ts` (which is imported into browser/server modules) */ // General Operators import 'rxjs/add/operator/map'; import 'rxjs/...
// Observable operators import 'rxjs/add/observable/fromEvent'; import 'rxjs/add/observable/interval'; import 'rxjs/add/observable/fromPromise'; import 'rxjs/add/observable/of'; import 'rxjs/add/observable/concat';
random_line_split
revalidate-tests.ts
import r = require("revalidate"); const isValidEmail = r.createValidator( message => value => { if (value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value)) { return message; } }, 'Invalid email address' ); const isGreaterThan = (n: any) => r.createValidator( message => value => { ...
}, field => `${field} must be greater than ${n}` ); const customIsRequired = r.isRequired({ message: 'Required' }); const lessThan = r.hasLengthLessThan(16)({ message: 'Must be 15 characters or less' }); const username = r.composeValidators( customIsRequired, lessThan )(); const email = r.composeValidators...
{ return message; }
conditional_block
revalidate-tests.ts
import r = require("revalidate"); const isValidEmail = r.createValidator( message => value => { if (value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value)) { return message; } }, 'Invalid email address' ); const isGreaterThan = (n: any) => r.createValidator( message => value => { ...
isValidEmail )(); const isNumber = r.isNumeric({ message: 'Must be a number' }); const isGreater = isGreaterThan(17)({ message: 'Sorry, you must be at least 18 years old' }); const age = r.composeValidators( customIsRequired, isNumber, isGreater )(); const validate = r.combineValidators({ username, ...
)(); const email = r.composeValidators( customIsRequired,
random_line_split
app.js
// Generated by CoffeeScript 1.6.3 (function() { var Backbone, Project, RESTController, app, async, bootstrap, express, kb, _ref, _ref1, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() {...
AppViewModel.prototype.onSave = function(vm) { return vm.model().save(function() {}); }; return AppViewModel; })(); } if (typeof window === "undefined" || window === null) { express = require('express'); app = express(); app.use(express.bodyParser()); app.use(expre...
{ var _this = this; this.projects = kb.collectionObservable(new Backbone.Collection()); Project.find({ $limit: 3, $sort: '-name' }, function(err, models) { return _this.projects.collection().reset(models); }); }
identifier_body
app.js
// Generated by CoffeeScript 1.6.3 (function() { var Backbone, Project, RESTController, app, async, bootstrap, express, kb, _ref, _ref1, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() {...
return Project; })(Backbone.Model); RESTController = require('backbone-rest'); new RESTController(app, { model_type: Project, route: '/projects' }); bootstrap = function(index, callback) { return Project.findOrCreate({ index: index, name: "Project " + index ...
{ express = require('express'); app = express(); app.use(express.bodyParser()); app.use(express["static"](__dirname)); app.get('/', function(req, res) { return res.sendfile('./index.html'); }); app.listen(3000); Project = (function(_super) { __extends(Project, _super); ...
conditional_block
app.js
// Generated by CoffeeScript 1.6.3 (function() { var Backbone, Project, RESTController, app, async, bootstrap, express, kb, _ref, _ref1,
Backbone = require('backbone'); async = require('async'); if (typeof window !== "undefined" && window !== null) { kb = require('knockback'); Project = (function(_super) { __extends(Project, _super); function Project() { _ref = Project.__super__.constructor.apply(this, arguments); ...
__hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return ch...
random_line_split
app.js
// Generated by CoffeeScript 1.6.3 (function() { var Backbone, Project, RESTController, app, async, bootstrap, express, kb, _ref, _ref1, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() {...
() { var _this = this; this.projects = kb.collectionObservable(new Backbone.Collection()); Project.find({ $limit: 3, $sort: '-name' }, function(err, models) { return _this.projects.collection().reset(models); }); } AppViewModel.prototype...
AppViewModel
identifier_name
views.py
from django.shortcuts import render from enfermeriaapp.models import Cola_Consulta, Cola_Enfermeria from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.utils import timezone import time from django.contrib import messages from django.contrib.auth.decorators import login_requir...
else: form=ColaEnfermeriaForm() info = "Ocurrio un error no se pudo eliminar el paciente de la cola" else: info="El paciente no existe en la cola" return render(request,"enfermeriaapp/cola_enfermeria_list.html",{'cola':cola}) #Muestra el listado de ...
existe.delete() info = "Datos eliminados exitosamente" return render(request,"enfermeriaapp/cola_enfermeria_list.html",{'cola':cola})
conditional_block
views.py
from django.shortcuts import render from enfermeriaapp.models import Cola_Consulta, Cola_Enfermeria from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.utils import timezone import time from django.contrib import messages from django.contrib.auth.decorators import login_requir...
import json from datospersonalesapp.models import Paciente from nuevoingresoapp.models import Expediente_Provisional from enfermeriaapp.forms import ColaEnfermeriaForm # Vista para poner un nuevo paciente en la cola para la toma de signos vitales @login_required(login_url='logins') def cola_enfermeria_nuevo(request,pk...
import datetime from django.db import connection
random_line_split
views.py
from django.shortcuts import render from enfermeriaapp.models import Cola_Consulta, Cola_Enfermeria from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.utils import timezone import time from django.contrib import messages from django.contrib.auth.decorators import login_requir...
else: form=ColaEnfermeriaForm() info = "Ocurrio un error los datos no se guardaron" return render(request,"datospersonales/paciente_list.html",{'personalpaciente':pacientes,'datoFacult':auxL,'informacion':info}) #Muestra el listado de pacientes en cola para tomarles sig...
info = "" pacientes=Paciente.objects.filter(estadoExpediente='A').order_by('facultadE') cursor = connection.cursor() cursor.execute('SELECT distinct(p.facultadE_id), f.nombreFacultad FROM datospersonalesapp_paciente as p, datospersonalesapp_facultad as f WHERE p.facultadE_id = f.codigoFacultad ORDER BY f.no...
identifier_body
views.py
from django.shortcuts import render from enfermeriaapp.models import Cola_Consulta, Cola_Enfermeria from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.utils import timezone import time from django.contrib import messages from django.contrib.auth.decorators import login_requir...
(request): cola=Cola_Enfermeria.objects.order_by('hora') return render(request,"enfermeriaapp/cola_enfermeria_list.html",{'cola':cola}) # Vista para borrar manualmente un paciente en la cola para la toma de signos vitales @login_required(login_url='logins') def cola_enfermeria_borrar(request,pk): cola=Cola...
cola_enfermeria_list
identifier_name
invoke.js
'use strict'; var path = require('path'); /** * Receives a `namespace`, and an Hash of `options` to invoke a given * generator. The usual list of arguments can be set with `options.args` * (ex. nopt's argv.remain array) * * @param {String} namespace * @param {Object} options * @param {Function} cb * * @mixin ...
return generator.run(cb); };
this.log.emit('up'); generator.on('end', this.log.emit.bind(this.log, 'down')); generator.on('end', this.log.emit.bind(this.log, 'down'));
random_line_split
main.js
import Ember from 'ember'; import ApplicationException from 'klondike/application-exception'; import describePromise from 'klondike/util/describe-promise'; var cache = {}; function
(funcName) { return function() { var name = arguments[0]; var args = Array.prototype.slice.call(arguments, 1); var adapter = this.container.lookup('adapter:' + name); if (!adapter) { throw new ApplicationException('The adapter "' + name + '" is not registered in containe...
createHandler
identifier_name
main.js
import Ember from 'ember'; import ApplicationException from 'klondike/application-exception'; import describePromise from 'klondike/util/describe-promise'; var cache = {}; function createHandler(funcName)
export default Ember.Object.extend({ find: function() { var name = arguments[0]; var args = Array.prototype.slice.call(arguments, 1); var id = args.join('::'); if (cache[name] && cache[name][id]) { return cache[name][id]; } var adapter = this.container...
{ return function() { var name = arguments[0]; var args = Array.prototype.slice.call(arguments, 1); var adapter = this.container.lookup('adapter:' + name); if (!adapter) { throw new ApplicationException('The adapter "' + name + '" is not registered in container.'); ...
identifier_body
main.js
import Ember from 'ember'; import ApplicationException from 'klondike/application-exception'; import describePromise from 'klondike/util/describe-promise'; var cache = {}; function createHandler(funcName) { return function() { var name = arguments[0]; var args = Array.prototype.slice.call(argument...
throw new ApplicationException('The adapter "' + name + '" is not registered in container.'); } var func = adapter[funcName]; if (func === undefined) { throw new ApplicationException('The adapter "' + name + '" does not have a method named "' + funcName + '"'); }...
if (!adapter) {
random_line_split
main.js
import Ember from 'ember'; import ApplicationException from 'klondike/application-exception'; import describePromise from 'klondike/util/describe-promise'; var cache = {}; function createHandler(funcName) { return function() { var name = arguments[0]; var args = Array.prototype.slice.call(argument...
var adapter = this.container.lookup('adapter:' + name); return adapter.find.apply(adapter, args).then(function(record) { cache[name] = cache[name] || {}; cache[name][id] = record; return record; }, null, describePromise(this, 'find', arguments) + ': Cache Re...
{ return cache[name][id]; }
conditional_block
index.js
var express = require('express'); var bodyParser = require('body-parser'); var fs = require('fs') var app = express(); var lostStolen = require('mastercard-lost-stolen'); var MasterCardAPI = lostStolen.MasterCardAPI; var dummyData = []; var dummyDataFiles = ['www/data/menu.json', 'www/data/account-number.json']; dumm...
res.json(dummyData[dummyDataFiles[1]][req.body.accountNumber]); } } else { var requestData = { "AccountInquiry": { "AccountNumber": req.body.accountNumber } }; lostStolen.AccountInquiry.update(requestData, function(error, data) { ...
random_line_split
index.js
var express = require('express'); var bodyParser = require('body-parser'); var fs = require('fs') var app = express(); var lostStolen = require('mastercard-lost-stolen'); var MasterCardAPI = lostStolen.MasterCardAPI; var dummyData = []; var dummyDataFiles = ['www/data/menu.json', 'www/data/account-number.json']; dumm...
else { console.log('has p12 file info, using MasterCardAPI') var authentication = new MasterCardAPI.OAuth(config.apiKey, config.p12file, config.p12alias, config.p12pwd); MasterCardAPI.init({ sandbox: 'true' === config.sandbox, authentication: authentication }); } app.use(bodyParser.jso...
{ console.log('p12 file info missing, using dummy data') }
conditional_block
Input.js
import React, { Component } from 'react'; import { View, TextInput, Text } from 'react-native'; const Input = ({ label, securetxt, maxlen, keytype, value, onChangeText, placeHolder }) => { return ( <View style={styles.containerStyle}> <Text style={styles.labelStyle}>{label}</Text> ...
containerStyle: { height: 40, flex: 1, flexDirection: 'row', alignItems: 'center' } }; export { Input }
labelStyle: { paddingLeft: 5, fontSize: 18, flex: 2 },
random_line_split
mod_dir_recursive.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{ assert_eq!(mod_dir_simple::load_another_mod::test::foo(), 10); }
identifier_body
mod_dir_recursive.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() { assert_eq!(mod_dir_simple::load_another_mod::test::foo(), 10); }
main
identifier_name
mod_dir_recursive.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
// ignore-fast // Testing that the parser for each file tracks its modules // and paths independently. The load_another_mod module should // not try to reuse the 'mod_dir_simple' path. mod mod_dir_simple { pub mod load_another_mod; } pub fn main() { assert_eq!(mod_dir_simple::load_another_mod::test::foo(), 1...
random_line_split
basicTimeSeries.js
if (Highcharts != null)
text: 'Sentiment' }, xAxis: { type: 'datetime' }, yAxis: { title: { text: 'Coefficient (m)' } }, tooltip: { shared: true }, legend: { enabled: false } } }
{ if (Highcharts.charts == null) { Highcharts.charts = {}; } if (Highcharts.getChart == null) { Highcharts.getChart = function(chartId, containerId) { var opts = Highcharts.charts[chartId]; opts.chart.renderTo = containerId; return opts; } } Highcharts.charts['basicTimeSeries'] = { chart: { ...
conditional_block
basicTimeSeries.js
Highcharts.charts = {}; } if (Highcharts.getChart == null) { Highcharts.getChart = function(chartId, containerId) { var opts = Highcharts.charts[chartId]; opts.chart.renderTo = containerId; return opts; } } Highcharts.charts['basicTimeSeries'] = { chart: { renderTo: 'container', type: 'sp...
if (Highcharts != null) { if (Highcharts.charts == null) {
random_line_split
tableHeading.component.tsx
/** * Copyright (C) 2017 3D Repo Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This pro...
<SortLabel active={activeSort} direction={sortOrder} onClick={onClick} > {label} </SortLabel> ); };
} return (
random_line_split
tableHeading.component.tsx
/** * Copyright (C) 2017 3D Repo Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This pro...
if (hideSortIcon) { return (<>{label}</>); } return ( <SortLabel active={activeSort} direction={sortOrder} onClick={onClick} > {label} </SortLabel> ); };
{ return (<></>); }
conditional_block
timer.rs
//! Timers that can invoke a callback on an interval. use widget_prelude::*; use ::callback::Callback; /// A timer that can invoke a callback on a configurable interval. /// /// ##Note: Not a Renderable Widget /// While this type can be dereferenced and converted to `BaseWidget`, it is *not* a renderable /// widget...
/// Stop the timer. The callback will not be invoked until the timer is restarted. pub fn stop(self) -> Self { self.set_bool_attribute(::attrs::RUN, false); self } } impl_widget! { Timer, "timer" } impl Destroy for Timer {}
{ self.set_bool_attribute(::attrs::RUN, true); self }
identifier_body
timer.rs
//! Timers that can invoke a callback on an interval. use widget_prelude::*; use ::callback::Callback; /// A timer that can invoke a callback on a configurable interval. /// /// ##Note: Not a Renderable Widget /// While this type can be dereferenced and converted to `BaseWidget`, it is *not* a renderable /// widget...
(self) -> Self { self.set_bool_attribute(::attrs::RUN, true); self } /// Stop the timer. The callback will not be invoked until the timer is restarted. pub fn stop(self) -> Self { self.set_bool_attribute(::attrs::RUN, false); self } } impl_widget! { Timer, "timer" } i...
start
identifier_name
timer.rs
//! Timers that can invoke a callback on an interval. use widget_prelude::*; use ::callback::Callback; /// A timer that can invoke a callback on a configurable interval. /// /// ##Note: Not a Renderable Widget /// While this type can be dereferenced and converted to `BaseWidget`, it is *not* a renderable /// widget...
/// Stop the timer. The callback will not be invoked until the timer is restarted. pub fn stop(self) -> Self { self.set_bool_attribute(::attrs::RUN, false); self } } impl_widget! { Timer, "timer" } impl Destroy for Timer {}
self.set_bool_attribute(::attrs::RUN, true); self }
random_line_split
align.rs
macro_rules! expand_align { () => { s! { #[cfg_attr(any(target_pointer_width = "32", target_arch = "x86_64", target_arch = "powerpc64", target_arch = "mips64", target_arch = "s390x", ...
#[repr(align(4))] pub struct pthread_condattr_t { size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], } } }; }
random_line_split
index.js
/* * Copyright (c) 2011-2013, Yahoo! Inc. All rights reserved. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ /*jslint anon:true, sloppy:true, nomen:true*/ YUI.add('scrollBinderIndex', function (Y, NAME) { Y.namespace('mojito.binders')[NAME] = { in...
minDistance:10, minVelocity:0.3, axis: "x" } }); scrollView.render(); // Prevent default image drag behavior scrollView.get("contentBox").delegate("mousedown", function(e) { e.pre...
id: 'scrollview', srcNode: node.one('#scrollview-content'), width: 320, flick: {
random_line_split
parseLatitudeLongitude.js
const DEGREES_SYMBOL = '\u00B0'; const MINUTES_SYMBOL = "'"; function parseLatitude(latitude) { return { degrees: parseInt(latitude.substring(0, 2), 10), minutes: parseInt(latitude.substring(2, 7), 10) / 1000.0, direction: latitude[latitude.length - 1] }; } function parseLongitude(longitude) { retu...
function formatDegreesMinutes(degMin) { let deg = degMin.degrees.toFixed(0); let min = degMin.minutes.toFixed(3); let direction = degMin.direction; return deg + DEGREES_SYMBOL + min + MINUTES_SYMBOL + direction; } export default function parseLatitudeLongitude(latLonString) { let latitude = parseLatitude(...
{ let direction = degreesAndMinutes.direction.toUpperCase(); let sign = (direction === 'N' || direction === 'E') ? 1 : -1; return sign * (degreesAndMinutes.degrees + degreesAndMinutes.minutes / 60.0); }
identifier_body
parseLatitudeLongitude.js
const DEGREES_SYMBOL = '\u00B0'; const MINUTES_SYMBOL = "'"; function parseLatitude(latitude) { return { degrees: parseInt(latitude.substring(0, 2), 10), minutes: parseInt(latitude.substring(2, 7), 10) / 1000.0, direction: latitude[latitude.length - 1] }; } function parseLongitude(longitude) { retu...
(latLonString) { let latitude = parseLatitude(latLonString.substring(0, 8)); let longitude = parseLongitude(latLonString.substring(8)); return { lat: toDecimalDegrees(latitude), lng: toDecimalDegrees(longitude), formatted: formatDegreesMinutes(latitude) + ", " + formatDegreesMinutes(longitude) }; }...
parseLatitudeLongitude
identifier_name
parseLatitudeLongitude.js
const DEGREES_SYMBOL = '\u00B0'; const MINUTES_SYMBOL = "'";
return { degrees: parseInt(latitude.substring(0, 2), 10), minutes: parseInt(latitude.substring(2, 7), 10) / 1000.0, direction: latitude[latitude.length - 1] }; } function parseLongitude(longitude) { return { degrees: parseInt(longitude.substring(0, 3), 10), minutes: parseInt(longitude.substr...
function parseLatitude(latitude) {
random_line_split
main.rs
use std::error::Error; use std::fs::File; use std::io::BufReader; use std::io::prelude::*; use std::path::Path; // Number of permutations summing to value N // Values: container sizes // target: remaining eggnog to be stored // prior_used: containers used prior to this call // hist: histogram of container counts fn ...
() { { let test_values = vec![20, 15, 10, 5, 5]; let mut hist = vec![0; test_values.len()]; //println!("{:?}", test_values); find_permutation_sums(&test_values[..], 25, 0, &mut hist); let num_permutations_25 = hist.iter().fold(0, |sum, x| sum + x); //println!("{:?}", hist); //println!("Number of test va...
main
identifier_name
main.rs
use std::error::Error; use std::fs::File; use std::io::BufReader; use std::io::prelude::*; use std::path::Path; // Number of permutations summing to value N // Values: container sizes // target: remaining eggnog to be stored // prior_used: containers used prior to this call // hist: histogram of container counts fn ...
else if i < values.len() - 1 { // Check this value plus the sum from remaining values let subslice = &values[i+1..values.len()]; find_permutation_sums(subslice, remaining_target, prior_used + 1, hist); } } } fn main() { { let test_values = vec![20, 15, 10, 5, 5]; let mut hist = vec![0; test_value...
{ // Number is just the right size. Don't check extra values. hist[prior_used + 1] += 1; // Record number of containers used continue; }
conditional_block
main.rs
use std::error::Error; use std::fs::File; use std::io::BufReader; use std::io::prelude::*; use std::path::Path; // Number of permutations summing to value N // Values: container sizes // target: remaining eggnog to be stored // prior_used: containers used prior to this call // hist: histogram of container counts fn f...
find_permutation_sums(&test_values[..], 25, 0, &mut hist); let num_permutations_25 = hist.iter().fold(0, |sum, x| sum + x); //println!("{:?}", hist); //println!("Number of test values summing to 25 is {}", num_permutations_25); assert_eq!(num_permutations_25, 4); } let path = Path::new("day17.txt"); ...
random_line_split
main.rs
use std::error::Error; use std::fs::File; use std::io::BufReader; use std::io::prelude::*; use std::path::Path; // Number of permutations summing to value N // Values: container sizes // target: remaining eggnog to be stored // prior_used: containers used prior to this call // hist: histogram of container counts fn ...
} } fn main() { { let test_values = vec![20, 15, 10, 5, 5]; let mut hist = vec![0; test_values.len()]; //println!("{:?}", test_values); find_permutation_sums(&test_values[..], 25, 0, &mut hist); let num_permutations_25 = hist.iter().fold(0, |sum, x| sum + x); //println!("{:?}", hist); //println!("Nu...
{ //let indent = 21-values.len(); //print!("{spacer:>0width$}", spacer=" ", width=indent); //println!("{:?} : {}", values, target); for i in 0..values.len() { let remaining_target = target - values[i]; if remaining_target < 0 { // Current value is too big continue; } else if remaining_target == 0 { ...
identifier_body
RefIndicator.tsx
from 'react'; import { Icons, WithTooltip, Spaced, TooltipLinkList } from '@storybook/components'; import { styled } from '@storybook/theming'; import { transparentize } from 'polished'; import { useStorybookApi } from '@storybook/api'; import { MenuItemIcon } from './Menu'; import { RefType } from './types'; import...
'& > svg': { marginTop: 3, width: 16, height: 16, marginRight: 10, flex: 'unset', }, })); export const MessageWrapper = styled.div({ width: 280, boxSizing: 'border-box', borderRadius: 8, overflow: 'hidden', }); const BlueIcon = styled(Icons)(({ theme }) => ({ color: theme.color.secon...
flex: 1, },
random_line_split
RefIndicator.tsx
from 'react'; import { Icons, WithTooltip, Spaced, TooltipLinkList } from '@storybook/components'; import { styled } from '@storybook/theming'; import { transparentize } from 'polished'; import { useStorybookApi } from '@storybook/api'; import { MenuItemIcon } from './Menu'; import { RefType } from './types'; import...
}, 1000); }, []); return ( <Message onClick={open}> <YellowIcon icon="lock" /> <div> <MessageTitle>Log in required</MessageTitle> <div>You need to authenticate to view this Storybook's components.</div> </div> </Message> ); }; const ReadDocsMessage: FunctionCompone...
{ clearInterval(timer); document.location.reload(); }
conditional_block
test_02_white2_W03c.py
# -*- coding: utf-8 -*- # Mathmaker creates automatically maths exercises sheets # with their answers # Copyright 2006-2018 Nicolas Hainaux <nh.techn@gmail.com> # This file is part of Mathmaker. # Mathmaker is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License...
(): """Check this sheet is generated without any error.""" shared.machine.write_out(str(Sheet('mental_calculation', '02_white2', 'W03c')), pdf_output=True)
test_W03c
identifier_name
test_02_white2_W03c.py
# -*- coding: utf-8 -*- # Mathmaker creates automatically maths exercises sheets # with their answers # Copyright 2006-2018 Nicolas Hainaux <nh.techn@gmail.com> # This file is part of Mathmaker. # Mathmaker is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License...
from mathmaker.lib.document.frames import Sheet def test_W03c(): """Check this sheet is generated without any error.""" shared.machine.write_out(str(Sheet('mental_calculation', '02_white2', 'W03c')), pdf...
from mathmaker.lib import shared
random_line_split
test_02_white2_W03c.py
# -*- coding: utf-8 -*- # Mathmaker creates automatically maths exercises sheets # with their answers # Copyright 2006-2018 Nicolas Hainaux <nh.techn@gmail.com> # This file is part of Mathmaker. # Mathmaker is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License...
"""Check this sheet is generated without any error.""" shared.machine.write_out(str(Sheet('mental_calculation', '02_white2', 'W03c')), pdf_output=True)
identifier_body