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 |
|---|---|---|---|---|
Svg.ts | import h from './h'
function | (tagName: string) {
return h.bind(null, tagName)
}
export default Object.freeze({
a : f('a'),
altGlyph : f('altGlyph'),
altGlyphDef : f('altGlyphDef'),
altGlyphItem : f('altGlyphItem'),
animate : f('animate'),
animateColor : f('animateColor'),
animateMotion : f('animateMotion'),
animateTransform : f(... | f | identifier_name |
Svg.ts | import h from './h'
function f(tagName: string) {
return h.bind(null, tagName)
}
export default Object.freeze({
a : f('a'),
altGlyph : f('altGlyph'),
altGlyphDef : f('altGlyphDef'),
altGlyphItem : f('altGlyphItem'),
animate : f('animate'),
animateColor : f('animateColor'),
animateMotion : f('animateMo... | feDiffuseLighting : f('feDiffuseLighting'),
feDisplacementMap : f('feDisplacementMap'),
feDistantLight : f('feDistantLight'),
feFlood : f('feFlood'),
feFuncA : f('feFuncA'),
feFuncB : f('feFuncB'),
feFuncG : f('feFuncG'),
feFuncR : f('feFuncR'),
feGaussianBlur : f('feGaussianBlur'),
feImage : f('feI... | random_line_split | |
Svg.ts | import h from './h'
function f(tagName: string) |
export default Object.freeze({
a : f('a'),
altGlyph : f('altGlyph'),
altGlyphDef : f('altGlyphDef'),
altGlyphItem : f('altGlyphItem'),
animate : f('animate'),
animateColor : f('animateColor'),
animateMotion : f('animateMotion'),
animateTransform : f('animateTransform'),
circle : f('circle'),
clipP... | {
return h.bind(null, tagName)
} | identifier_body |
tier.js | 'use strict';
var mongoose = require('mongoose');
var mongoose_uuid = require('mongoose-uuid');
var mongoose_relationship = require('mongoose-relationship');
function tierModel () {
var tierSchema = mongoose.Schema({
environment: { type: String, ref: 'Environment', childPath: 'tiers', index: true },
platfo... |
tier.system_name = tier.name.toLowerCase().replace(/\s+/g, '_');
next();
});
return mongoose.model('Tier', tierSchema);
}
module.exports = new tierModel();
| {
next();
return;
} | conditional_block |
tier.js | 'use strict';
var mongoose = require('mongoose');
var mongoose_uuid = require('mongoose-uuid');
var mongoose_relationship = require('mongoose-relationship');
function tierModel () {
var tierSchema = mongoose.Schema({
environment: { type: String, ref: 'Environment', childPath: 'tiers', index: true },
platfo... | networks: [{ type: String }]
}, { _id: false, versionKey: false });
tierSchema.plugin(mongoose_uuid.plugin, 'Tier');
tierSchema.plugin(mongoose_relationship, {
relationshipPathName: [ 'environment', 'platform' ]
});
tierSchema.pre('save', function (next) {
var tier = this;
if (tier.system_n... | home_network: { type: String }, | random_line_split |
tier.js | 'use strict';
var mongoose = require('mongoose');
var mongoose_uuid = require('mongoose-uuid');
var mongoose_relationship = require('mongoose-relationship');
function tierModel () | tierSchema.pre('save', function (next) {
var tier = this;
if (tier.system_name && tier.system_name.length > 0) {
next();
return;
}
tier.system_name = tier.name.toLowerCase().replace(/\s+/g, '_');
next();
});
return mongoose.model('Tier', tierSchema);
}
module.exports = new ti... | {
var tierSchema = mongoose.Schema({
environment: { type: String, ref: 'Environment', childPath: 'tiers', index: true },
platform: { type: String, ref: 'Platform', childPath: 'tiers', index: true },
machines: [{ type: String, ref: 'Machine' }],
cfpersonas: { type: String, ref: 'CfPersonas', index: tru... | identifier_body |
tier.js | 'use strict';
var mongoose = require('mongoose');
var mongoose_uuid = require('mongoose-uuid');
var mongoose_relationship = require('mongoose-relationship');
function | () {
var tierSchema = mongoose.Schema({
environment: { type: String, ref: 'Environment', childPath: 'tiers', index: true },
platform: { type: String, ref: 'Platform', childPath: 'tiers', index: true },
machines: [{ type: String, ref: 'Machine' }],
cfpersonas: { type: String, ref: 'CfPersonas', index:... | tierModel | identifier_name |
HTPGeoprocessor.py | """
/***************************************************************************
Name : HTP Geoprocessor
Description : Tools for processing HTP geospatial data
Date : 29/Mar/12
copyright : (C) 2012 by Dr. Kelly Thorp, USDA-ARS
email : kelly.thorp@... |
else:
QMessageBox.critical(self.iface.mainWindow(),'Help','Error opening document. Look in plug-in install directory for PDF.')
| os.startfile(path+"\\HTP Geoprocessor README.pdf") | conditional_block |
HTPGeoprocessor.py | """
/***************************************************************************
Name : HTP Geoprocessor
Description : Tools for processing HTP geospatial data
Date : 29/Mar/12
copyright : (C) 2012 by Dr. Kelly Thorp, USDA-ARS
email : kelly.thorp@... | def Geoprocess(self):
# create and show the dialog
dlg = GeoprocessorDlg(self.iface)
# show the dialog
#dlg.show() #Modeless dialog
dlg.exec_() #Modal dialog
def Help(self):
path = os.path.dirname(sys.modules[__name__].__file__)
if sys... | dlg = PreprocessorDlg()
dlg.exec_()
| random_line_split |
HTPGeoprocessor.py | """
/***************************************************************************
Name : HTP Geoprocessor
Description : Tools for processing HTP geospatial data
Date : 29/Mar/12
copyright : (C) 2012 by Dr. Kelly Thorp, USDA-ARS
email : kelly.thorp@... |
def Geoprocess(self):
# create and show the dialog
dlg = GeoprocessorDlg(self.iface)
# show the dialog
#dlg.show() #Modeless dialog
dlg.exec_() #Modal dialog
def Help(self):
path = os.path.dirname(sys.modules[__name__].__file__)
... | dlg = PreprocessorDlg()
dlg.exec_() | identifier_body |
HTPGeoprocessor.py | """
/***************************************************************************
Name : HTP Geoprocessor
Description : Tools for processing HTP geospatial data
Date : 29/Mar/12
copyright : (C) 2012 by Dr. Kelly Thorp, USDA-ARS
email : kelly.thorp@... | (self):
path = os.path.dirname(sys.modules[__name__].__file__)
if sys.platform == 'linux':
os.system(path+"//HTP Geoprocessor README.pdf")
elif sys.platform == 'win32':
os.startfile(path+"\\HTP Geoprocessor README.pdf")
else:
QMessageBox.critica... | Help | identifier_name |
private-match.js | (function(){
'use strict';
var _ = require('lodash');
var PrivateMatch = function() {
this.waitingText = null; | this.nextDot = 0;
};
PrivateMatch.prototype.create = function() {
this.game.socketHandler.startPrivateMatch();
this.game.stage.backgroundColor = '#C8F7C5';
this.sendLinkText = this.add.text(
this.world.centerX,
this.world.centerY - 150,
'Send this link to your opponent:',
{
font: '45pt h... |
this.dots = 0; | random_line_split |
private-match.js | (function(){
'use strict';
var _ = require('lodash');
var PrivateMatch = function() {
this.waitingText = null;
this.dots = 0;
this.nextDot = 0;
};
PrivateMatch.prototype.create = function() {
this.game.socketHandler.startPrivateMatch();
this.game.stage.backgroundColor = '#C8F7C5';
this.sendLinkText = ... |
};
PrivateMatch.prototype.shutdown = function() {
this.matchInput.style.display = 'none';
};
PrivateMatch.prototype.startMenu = function() {
this.game.socketHandler.stopPrivateMatch();
window.location.hash = '';
this.game.state.start('Menu');
};
module.exports = PrivateMatch;
})();
| {
if (this.dots === 3) {
this.dots = 0;
}
this.dots++;
var dotString = '';
for (var i = 0; i < this.dots; i++) {
dotString += '.';
}
this.waitingText.setText('Waiting for a player to join' + dotString);
this.nextDot = this.time.now + 500;
} | conditional_block |
menudata.js | /*
@licstart The following is the entire license notice for the
JavaScript code in this file.
Copyright (C) 1997-2019 by Dimitri van Heesch | This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this prog... |
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
| random_line_split |
poly.py | #!/usr/bin/env python
from sys import path
import os.path
thisrep = os.path.dirname(os.path.abspath(__file__))
path.append(os.path.dirname(thisrep))
from random import randint
from pygame import *
from pygame import gfxdraw
from EasyGame import pathgetter,confirm
controls = """hold the left mouse button to draw
d = u... |
if ev.type == MOUSEBUTTONUP and ev.button == 1:
if len(a[-1]) >= 2:
draw.aaline(scr,color,a[-1][0],a[-1][-1],1)
gfxdraw.filled_polygon(scr,a[-1],color)
display.flip()
color = [randint(0,255) for i in (1,2,3)]+[50]
if ev.type == QUIT: break
if ev.type ==... | a[-1].append(ev.pos)
if len(a[-1]) >= 2:
draw.aaline(scr,color,a[-1][-1],a[-1][-2],1)
display.flip() | conditional_block |
poly.py | #!/usr/bin/env python
from sys import path
import os.path
thisrep = os.path.dirname(os.path.abspath(__file__))
path.append(os.path.dirname(thisrep))
from random import randint
from pygame import *
from pygame import gfxdraw
from EasyGame import pathgetter,confirm
controls = """hold the left mouse button to draw
d = u... | display.flip()
if ev.type == MOUSEBUTTONUP and ev.button == 1:
if len(a[-1]) >= 2:
draw.aaline(scr,color,a[-1][0],a[-1][-1],1)
gfxdraw.filled_polygon(scr,a[-1],color)
display.flip()
color = [randint(0,255) for i in (1,2,3)]+[50]
if ev.type == QUI... | draw.aaline(scr,color,a[-1][-1],a[-1][-2],1) | random_line_split |
add_multi_asset_responsive_display_ad.py | #!/usr/bin/env python
#
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | }],
'squareMarketingImages': [{
'asset': {
'xsi_type': 'ImageAsset',
'assetId': UploadImageAsset(client, 'https://goo.gl/mtt54n')
}
}],
# Optional values
'finalUrls': ['http://www.example.com'],
'callToActionText': 'Shop Now',
# S... | 'asset': {
'xsi_type': 'ImageAsset',
'assetId': UploadImageAsset(client, 'https://goo.gl/3b9Wfh')
} | random_line_split |
add_multi_asset_responsive_display_ad.py | #!/usr/bin/env python
#
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
if __name__ == '__main__':
# Initialize client object.
adwords_client = adwords.AdWordsClient.LoadFromStorage()
main(adwords_client, AD_GROUP_ID)
| print 'No ads were added.' | conditional_block |
add_multi_asset_responsive_display_ad.py | #!/usr/bin/env python
#
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | (client, ad_group_id):
# Initialize appropriate service.
ad_group_ad_service = client.GetService('AdGroupAdService', version='v201809')
# Create the ad.
multi_asset_responsive_display_ad = {
'xsi_type': 'MultiAssetResponsiveDisplayAd',
'headlines': [{
'asset': {
'xsi_type': ... | main | identifier_name |
add_multi_asset_responsive_display_ad.py | #!/usr/bin/env python
#
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | # 'assetName': 'Image asset ' + str(uuid.uuid4()),
}
# Create the operation.
operation = {
'operator': 'ADD',
'operand': image_asset
}
# Create the asset and return the ID.
result = asset_service.mutate([operation])
return result['value'][0]['assetId']
def main(client, ad_group_id)... | """Uploads the image from the specified url.
Args:
client: An AdWordsClient instance.
url: The image URL.
Returns:
The ID of the uploaded image.
"""
# Initialize appropriate service.
asset_service = client.GetService('AssetService', version='v201809')
# Download the image.
image_request = r... | identifier_body |
content-object-list.component.spec.ts | '../../core/shared/model/config';
import { ContentObjectListComponent } from './content-object-list.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Field } from '../../core/shared/model/field';
import { User } from '../../user/shared/user';
import { MatButtonModule } from '@angu... | extends ContentService {
constructor() {
super(null, null, null);
}
create(contentItem: ContentItem, file: File): Observable<ContentItem> {
return of(contentItem);
}
getFileUrl({ itemId, webViewable, useOriginalFilename, disposition }: FileUrlParameters): string {
return 'testUrl/' + itemId;
... | MockContentService | identifier_name |
content-object-list.component.spec.ts | '../../core/shared/model/config';
import { ContentObjectListComponent } from './content-object-list.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Field } from '../../core/shared/model/field';
import { User } from '../../user/shared/user';
import { MatButtonModule } from '@angu... | }
class MockUserService extends UserService {
constructor() {
super(null, null, null);
}
getUser(): User {
return new User('testUser');
}
}
describe('ContentObjectList', () => {
let mockContentService: ContentService;
let mockUserService: MockUserService;
let activatedRoute: ActivatedRouteStub;... |
getFileUrl({ itemId, webViewable, useOriginalFilename, disposition }: FileUrlParameters): string {
return 'testUrl/' + itemId;
} | random_line_split |
sim.worker.jetstream.js | null // with attributes per sector
;
function vec3toLat (v, radius) {return 90 - (Math.acos(v.y / radius)) * 180 / PI;}
function vec3toLon (v, radius) {return ((270 + (Math.atan2(v.x , v.z)) * 180 / PI) % 360);}
function vector3ToLatLong (v, radius) {
return {
lat: 90 - (Math.acos(v.y / radius... | widths[i].push(width);
spcl.setFromVector3(vec3);
spcl.theta += u * cfg.factor; // east-direction
spcl.phi -= v * cfg.factor; // north-direction
vec3 = vec3.setFromSpherical(spcl).clone();
lat = vec3toLat(ve... | positions[i].push(vec3);
colors[i].push(color); | random_line_split |
sim.worker.jetstream.js | null // with attributes per sector
;
function vec3toLat (v, radius) {return 90 - (Math.acos(v.y / radius)) * 180 / PI;}
function vec3toLon (v, radius) {return ((270 + (Math.atan2(v.x , v.z)) * 180 / PI) % 360);}
function vector3ToLatLong (v, radius) {
return {
lat: 90 - (Math.acos(v.y / radius... |
positions[i].push(vec3);
colors[i].push(color);
widths[i].push(width);
spcl.setFromVector3(vec3);
spcl.theta += u * cfg.factor; // east-direction
spcl.phi -= v * cfg.factor; // north-direction
ve... | {
lat = pool[i].lat;
lon = pool[i].lon;
vec3 = latLonRadToVector3(lat, lon, cfg.radius);
// keep start point
seeds.push(vec3.x, vec3.y, vec3.z);
// over vertices
for (j=0; j<length; j++) {
u = datagrams.ugrdprs.linearXY(doe, lat... | conditional_block |
sim.worker.jetstream.js | null // with attributes per sector
;
function vec3toLat (v, radius) {return 90 - (Math.acos(v.y / radius)) * 180 / PI;}
function vec3toLon (v, radius) {return ((270 + (Math.atan2(v.x , v.z)) * 180 / PI) % 360);}
function vector3ToLatLong (v, radius) {
return {
lat: 90 - (Math.acos(v.y / radius... | (sector, amount) {
var i, j = 0, coord, out = [], len = pool.length;
for (i=0; j<amount && i<len; i++) {
coord = pool[i];
if (
coord.lat < sector[0] &&
coord.lon > sector[1] &&
coord.lat > sector[2] &&
coord.lon < sector[3]
) {
... | filterPool | identifier_name |
sim.worker.jetstream.js | null // with attributes per sector
;
function vec3toLat (v, radius) {return 90 - (Math.acos(v.y / radius)) * 180 / PI;}
function vec3toLon (v, radius) {return ((270 + (Math.atan2(v.x , v.z)) * 180 / PI) % 360);}
function vector3ToLatLong (v, radius) |
function latLonRadToVector3 (lat, lon, radius) {
var phi = lat * Math.PI / 180;
var theta = (lon - 180) * Math.PI / 180;
var x = -radius * Math.cos(phi) * Math.cos(theta);
var y = radius * Math.sin(phi);
var z = radius * Math.cos(phi) * Math.sin(theta);
return new Vector3(x, y, z);
... | {
return {
lat: 90 - (Math.acos(v.y / radius)) * 180 / Math.PI,
lon: ((270 + (Math.atan2(v.x , v.z)) * 180 / Math.PI) % 360)
};
} | identifier_body |
Material.d.ts | import { Base } from './core/Base';
import { IDictionary } from './core/container';
import { Shader, IShaderUniform } from './Shader';
import { Renderer } from './Renderer';
interface IMaterialOption {
name?: string;
shader?: Shader;
depthTest?: boolean;
depthMask?: boolean;
transparent?: boolean;
... |
uniforms: IDictionary<IShaderUniform>;
shader: Shader;
depthTest: boolean;
depthMask: boolean;
transparent: boolean;
precision: string;
blend: (renderer: Renderer) => void;
bind(renderer: Renderer): void;
setUniform(symbol: string, value: any): void;
setUniforms(object:... | random_line_split | |
Material.d.ts | import { Base } from './core/Base';
import { IDictionary } from './core/container';
import { Shader, IShaderUniform } from './Shader';
import { Renderer } from './Renderer';
interface IMaterialOption {
name?: string;
shader?: Shader;
depthTest?: boolean;
depthMask?: boolean;
transparent?: boolean;
... | extends Base {
constructor(option?: IMaterialOption);
name: string;
uniforms: IDictionary<IShaderUniform>;
shader: Shader;
depthTest: boolean;
depthMask: boolean;
transparent: boolean;
precision: string;
blend: (renderer: Renderer) => void;
bind(renderer: Renderer): vo... | Material | identifier_name |
hearthisat.py | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
HEADRequest,
KNOWN_EXTENSIONS,
sanitized_Request,
str_to_int,
urlencode_postdata,
urlhandle_detect_ext,
)
class HearThisAtIE(InfoExtractor):
_VALID_UR... | 'vcodec': 'none',
'acodec': 'mp3',
'url': mp3_url,
})
download_path = self._search_regex(
r'<a class="[^"]*download_fct[^"]*"\s+href="([^"]+)"',
webpage, 'download URL', default=None)
if download_path:
download_url = compat_urlparse.urljoin(url, download_path)
ext_req = HEADRequest(downlo... | r'(?s)<a class="player-link"\s+(?:[a-zA-Z0-9_:-]+="[^"]+"\s+)*?data-mp3="([^"]+)"',
webpage, 'mp3 URL', fatal=False)
if mp3_url:
formats.append({
'format_id': 'mp3', | random_line_split |
hearthisat.py | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
HEADRequest,
KNOWN_EXTENSIONS,
sanitized_Request,
str_to_int,
urlencode_postdata,
urlhandle_detect_ext,
)
class HearThisAtIE(InfoExtractor):
_VALID_UR... |
self._sort_formats(formats)
return {
'id': track_id,
'display_id': display_id,
'title': title,
'formats': formats,
'thumbnail': thumbnail,
'description': description,
'duration': duration,
'timestamp': timestamp,
'view_count': view_count,
'comment_count': comment_count,
'like_coun... | download_url = compat_urlparse.urljoin(url, download_path)
ext_req = HEADRequest(download_url)
ext_handle = self._request_webpage(
ext_req, display_id, note='Determining extension')
ext = urlhandle_detect_ext(ext_handle)
if ext in KNOWN_EXTENSIONS:
formats.append({
'format_id': 'download',
... | conditional_block |
hearthisat.py | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
HEADRequest,
KNOWN_EXTENSIONS,
sanitized_Request,
str_to_int,
urlencode_postdata,
urlhandle_detect_ext,
)
class HearThisAtIE(InfoExtractor):
_VALID_UR... | (self, url):
m = re.match(self._VALID_URL, url)
display_id = '{artist:s} - {title:s}'.format(**m.groupdict())
webpage = self._download_webpage(url, display_id)
track_id = self._search_regex(
r'intTrackId\s*=\s*(\d+)', webpage, 'track ID')
payload = urlencode_postdata({'tracks[]': track_id})
req = sanit... | _real_extract | identifier_name |
hearthisat.py | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
HEADRequest,
KNOWN_EXTENSIONS,
sanitized_Request,
str_to_int,
urlencode_postdata,
urlhandle_detect_ext,
)
class HearThisAtIE(InfoExtractor):
_VALID_UR... |
meta_span = r'<span[^>]+class="%s".*?</i>([^<]+)</span>'
view_count = str_to_int(self._search_regex(
meta_span % 'plays_count', webpage, 'view count', fatal=False))
like_count = str_to_int(self._search_regex(
meta_span % 'likes_count', webpage, 'like count', fatal=False))
comment_count = str_to_int(self.... | m = re.match(self._VALID_URL, url)
display_id = '{artist:s} - {title:s}'.format(**m.groupdict())
webpage = self._download_webpage(url, display_id)
track_id = self._search_regex(
r'intTrackId\s*=\s*(\d+)', webpage, 'track ID')
payload = urlencode_postdata({'tracks[]': track_id})
req = sanitized_Request(se... | identifier_body |
webpack.config.js | const path = require('path')
module.exports = {
context: __dirname,
entry: './js/ClientApp.js',
devtool: 'eval',
output: {
path: path.join(__dirname, '/public'),
publicPath: '/public/',
filename: 'bundle.js'
},
devServer: {
publicPath: '/public/',
historyApiFallback: true
},
resolve... | options: {
url: false
}
}
]
},
{
test: /\.scss$/,
loader: 'style-loader!css-loader!autoprefixer-loader!sass-loader'
},
{
test: /\.otf$/,
loader: 'file-loader?name=fonts/[name].[ext]'
}
]
}
} | {
loader: 'css-loader', | random_line_split |
FieldWithComponentProp.js | import React from 'react';
import {
Box,
Button,
CheckBox,
FileInput, | Form,
FormField,
Grommet,
RadioButtonGroup,
RangeInput,
Select,
TextArea,
} from 'grommet';
import { grommet } from 'grommet/themes';
export const FieldWithComponentProp = () => (
<Grommet full theme={grommet}>
<Box fill overflow="auto" align="center" justify="center" pad="large">
<Box flex={... | random_line_split | |
queues.js | import React from "react";
import {map, sortBy, filter} from "lodash";
import BaseComponent from "../base-component";
import Config from "../../tools/config";
const cx = require("classnames");
var navigate = require('react-mini-router').navigate;
const EMPTY_QUEUE_CONFIG_KEY = "home.queues.empty";
export default cla... |
changeEmpty() {
this.assignState({empty: !this.state.empty}, ()=> {
Config.set(EMPTY_QUEUE_CONFIG_KEY, this.state.empty)
})
}
render() {
let failedClasses = cx('clickable', {danger: this.props.failed > 0, info: this.props.failed === 0});
return (
<div className="queue-list">
... | {
if (this.state.query === "") {
return true
}
let q = this.state.query.toLowerCase();
let name = queue.name.toLowerCase();
return name.indexOf(q) > -1
} | identifier_body |
queues.js | import React from "react";
import {map, sortBy, filter} from "lodash";
import BaseComponent from "../base-component";
import Config from "../../tools/config";
const cx = require("classnames");
var navigate = require('react-mini-router').navigate;
const EMPTY_QUEUE_CONFIG_KEY = "home.queues.empty";
export default cla... |
let q = this.state.query.toLowerCase();
let name = queue.name.toLowerCase();
return name.indexOf(q) > -1
}
changeEmpty() {
this.assignState({empty: !this.state.empty}, ()=> {
Config.set(EMPTY_QUEUE_CONFIG_KEY, this.state.empty)
})
}
render() {
let failedClasses = cx('clickable',... | {
return true
} | conditional_block |
queues.js | import React from "react";
import {map, sortBy, filter} from "lodash";
import BaseComponent from "../base-component";
import Config from "../../tools/config";
const cx = require("classnames");
var navigate = require('react-mini-router').navigate;
const EMPTY_QUEUE_CONFIG_KEY = "home.queues.empty";
export default cla... |
onRowClick(queue) {
navigate(`/queues/${queue.name}`)
}
getQueueRows() {
if (!this.props.queues) {
return <tr/>
}
let queues = this.props.queues;
if (!this.state.empty) {
queues = filter(queues, (q)=> {
return q.size > 0
})
}
queues = sortBy(queues, "size")... | onQueryChange(query) {
this.assignState({query: query});
} | random_line_split |
queues.js | import React from "react";
import {map, sortBy, filter} from "lodash";
import BaseComponent from "../base-component";
import Config from "../../tools/config";
const cx = require("classnames");
var navigate = require('react-mini-router').navigate;
const EMPTY_QUEUE_CONFIG_KEY = "home.queues.empty";
export default cla... | (props) {
super(props);
this.state = {
query: "",
empty: Config.get(EMPTY_QUEUE_CONFIG_KEY, false)
};
this.bindThiz("getQueueRows", "doesQueueMatchQuery", "onQueryChange", "onRowClick", "changeEmpty")
}
onQueryChange(query) {
this.assignState({query: query});
}
onRowClick(queu... | constructor | identifier_name |
acfun.py | #!/usr/bin/env python
__all__ = ['acfun_download']
from ..common import *
from .letv import letvcloud_download_by_vu
from .qq import qq_download_by_vid
from .sina import sina_download_by_vid
from .tudou import tudou_download_by_iid
from .youku import youku_download_by_vid
import json, re
def get_srt_json(id):
... |
elif sourceType == 'tudou':
tudou_download_by_iid(sourceId, title, output_dir=output_dir, merge=merge, info_only=info_only)
elif sourceType == 'qq':
qq_download_by_vid(sourceId, title, output_dir=output_dir, merge=merge, info_only=info_only)
elif sourceType == 'letv':
letvcloud_down... | youku_download_by_vid(sourceId, title=title, output_dir=output_dir, merge=merge, info_only=info_only, **kwargs) | conditional_block |
acfun.py | #!/usr/bin/env python
__all__ = ['acfun_download']
from ..common import * |
from .letv import letvcloud_download_by_vu
from .qq import qq_download_by_vid
from .sina import sina_download_by_vid
from .tudou import tudou_download_by_iid
from .youku import youku_download_by_vid
import json, re
def get_srt_json(id):
url = 'http://danmu.aixifan.com/V2/%s' % id
return get_html(url)
def ac... | random_line_split | |
acfun.py | #!/usr/bin/env python
__all__ = ['acfun_download']
from ..common import *
from .letv import letvcloud_download_by_vu
from .qq import qq_download_by_vid
from .sina import sina_download_by_vid
from .tudou import tudou_download_by_iid
from .youku import youku_download_by_vid
import json, re
def get_srt_json(id):
... | nfo = "AcFun.tv"
download = acfun_download
download_playlist = playlist_not_supported('acfun')
| assert re.match(r'http://[^\.]+.acfun.[^\.]+/\D/\D\D(\d+)', url)
html = get_html(url)
title = r1(r'<h1 id="txt-title-view">([^<>]+)<', html)
title = unescape_html(title)
title = escape_file_path(title)
assert title
videos = re.findall("data-vid=\"(\d+)\".*href=\"[^\"]+\".*title=\"([^\"]+)\"", ... | identifier_body |
acfun.py | #!/usr/bin/env python
__all__ = ['acfun_download']
from ..common import *
from .letv import letvcloud_download_by_vu
from .qq import qq_download_by_vid
from .sina import sina_download_by_vid
from .tudou import tudou_download_by_iid
from .youku import youku_download_by_vid
import json, re
def get_srt_json(id):
... | (url, output_dir='.', merge=True, info_only=False, **kwargs):
assert re.match(r'http://[^\.]+.acfun.[^\.]+/\D/\D\D(\d+)', url)
html = get_html(url)
title = r1(r'<h1 id="txt-title-view">([^<>]+)<', html)
title = unescape_html(title)
title = escape_file_path(title)
assert title
videos = re.f... | acfun_download | identifier_name |
one-use-in-struct.rs | // Copyright 2016 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-MIT or ... | data: &'f u32
}
enum Bar<'f> {
Data(&'f u32)
}
trait Baz<'f> { }
fn main() { } | #![allow(dead_code)]
#![allow(unused_variables)]
struct Foo<'f> { | random_line_split |
one-use-in-struct.rs | // Copyright 2016 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-MIT or ... | () { }
| main | identifier_name |
widgetfactory.ts | // Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
import {
IKernelId
} from 'jupyter-js-services';
import {
IWidgetFactory, IDocumentContext, findKernel
} from 'jupyter-js-ui/lib/docmanager';
import {
RenderMime
} from 'jupyter-js-ui/lib/render... | import {
INotebookModel
} from './model';
import {
NotebookPanel
} from './panel';
/**
* A widget factory for notebook panels.
*/
export
class NotebookWidgetFactory implements IWidgetFactory<NotebookPanel> {
/**
* Construct a new notebook widget factory.
*/
constructor(rendermime: RenderMime<Widget>,... | random_line_split | |
widgetfactory.ts | // Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
import {
IKernelId
} from 'jupyter-js-services';
import {
IWidgetFactory, IDocumentContext, findKernel
} from 'jupyter-js-ui/lib/docmanager';
import {
RenderMime
} from 'jupyter-js-ui/lib/render... |
/**
* Create a new widget.
*/
createNew(model: INotebookModel, context: IDocumentContext, kernel?: IKernelId): NotebookPanel {
let rendermime = this._rendermime.clone();
if (kernel) {
context.changeKernel(kernel);
} else {
let name = findKernel(model.defaultKernelName, model.defaultK... | {
this._rendermime = null;
this._clipboard = null;
} | identifier_body |
widgetfactory.ts | // Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
import {
IKernelId
} from 'jupyter-js-services';
import {
IWidgetFactory, IDocumentContext, findKernel
} from 'jupyter-js-ui/lib/docmanager';
import {
RenderMime
} from 'jupyter-js-ui/lib/render... | (rendermime: RenderMime<Widget>, clipboard: IClipboard) {
this._rendermime = rendermime.clone();
this._clipboard = clipboard;
}
/**
* Get whether the factory has been disposed.
*/
get isDisposed(): boolean {
return this._rendermime === null;
}
/**
* Dispose of the resources used by the ... | constructor | identifier_name |
widgetfactory.ts | // Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
import {
IKernelId
} from 'jupyter-js-services';
import {
IWidgetFactory, IDocumentContext, findKernel
} from 'jupyter-js-ui/lib/docmanager';
import {
RenderMime
} from 'jupyter-js-ui/lib/render... |
let panel = new NotebookPanel(model, rendermime, context, this._clipboard);
ToolbarItems.populateDefaults(panel);
return panel;
}
/**
* Take an action on a widget before closing it.
*
* @returns A promise that resolves to true if the document should close
* and false otherwise.
*/
b... | {
let name = findKernel(model.defaultKernelName, model.defaultKernelLanguage, context.kernelspecs);
context.changeKernel({ name });
} | conditional_block |
test_pdfbase_encodings.py | :x[1:-1], found)
def subsetToUnicode(ttf, subsetCodeStr):
"""Return unicode string represented by given subsetCode string
as found when TrueType font rendered to PDF, ttf must be the font
object that was used."""
# This relies on TTFont internals and uses the first document
# and subset it finds
... |
return u''.join(chrs)
class TextEncodingTestCase(NearTestCase):
"""Tests of expected Unicode and encoding behaviour
"""
def setUp(self):
self.luxi = TTFont("Luxi", "luxiserif.ttf")
pdfmetrics.registerFont(self.luxi)
self.styNormal = ParagraphStyle(name='Helvetica', fontName='H... | if codeStr:
chrs.append(unichr(subset[int(codeStr[1:], 8)])) | conditional_block |
test_pdfbase_encodings.py | self.assertNear(pdfmetrics.stringWidth(testUni, 'Luxi', 10),224.638671875)
def testUtf8Canvas(self):
"""Verify canvas declared as utf8 autoconverts.
This assumes utf8 input. It converts to the encoding of the
underlying font, so both text lines APPEAR the same."""
c = Canvas(out... | return makeSuiteForClasses(
TextEncodingTestCase,
#FontEncodingTestCase - nobbled for now due to old stuff which needs removing.
) | identifier_body | |
test_pdfbase_encodings.py | found = textPat.findall(pdfOps)
#chop off '(' and ')'
return map(lambda x:x[1:-1], found)
def subsetToUnicode(ttf, subsetCodeStr):
"""Return unicode string represented by given subsetCode string
as found when TrueType font rendered to PDF, ttf must be the font
object that was used."""
# Thi... |
PDF will show a string draw as something like "(Hello World) Tj"
i.e. text is in curved brackets. Crude and dirty, probably fails
on escaped brackets.
""" | random_line_split | |
test_pdfbase_encodings.py | :x[1:-1], found)
def | (ttf, subsetCodeStr):
"""Return unicode string represented by given subsetCode string
as found when TrueType font rendered to PDF, ttf must be the font
object that was used."""
# This relies on TTFont internals and uses the first document
# and subset it finds
subset = ttf.state.values()[0].subs... | subsetToUnicode | identifier_name |
user_defined.py | # Author: Prabhu Ramachandran <prabhu [at] aero . iitb . ac . in>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from tvtk.tools.tvtk_doc import TVTKFilterChooser, TVTK_FILTERS
# Local imports.
from mayavi.filters.filter_base import FilterBase
from mayavi.core.common import ... |
######################################################################
# Non-public interface.
######################################################################
def _choose_filter(self):
chooser = TVTKFilterChooser()
chooser.edit_traits(kind='livemodal')
obj = chooser.obje... | """Setup the filter if none has been set or check it if it
already has been."""
obj = self.filter
if not self._check_object(obj):
if obj is not None:
cname = obj.__class__.__name__
error('Invalid filter %s chosen! Try again!'%cname)
obj = ... | identifier_body |
user_defined.py | # Author: Prabhu Ramachandran <prabhu [at] aero . iitb . ac . in>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from tvtk.tools.tvtk_doc import TVTKFilterChooser, TVTK_FILTERS
# Local imports.
from mayavi.filters.filter_base import FilterBase
from mayavi.core.common import ... | cname = obj.__class__.__name__
error('Invalid filter %s chosen! Try again!'%cname)
obj = self._choose_filter()
self.filter = obj
######################################################################
# Non-public interface.
##########################... | """Setup the filter if none has been set or check it if it
already has been."""
obj = self.filter
if not self._check_object(obj):
if obj is not None: | random_line_split |
user_defined.py | # Author: Prabhu Ramachandran <prabhu [at] aero . iitb . ac . in>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from tvtk.tools.tvtk_doc import TVTKFilterChooser, TVTK_FILTERS
# Local imports.
from mayavi.filters.filter_base import FilterBase
from mayavi.core.common import ... | (self):
chooser = TVTKFilterChooser()
chooser.edit_traits(kind='livemodal')
obj = chooser.object
if obj is None:
error('Invalid filter chosen! Try again!')
return obj
def _check_object(self, obj):
if obj is None:
return False
if obj._... | _choose_filter | identifier_name |
user_defined.py | # Author: Prabhu Ramachandran <prabhu [at] aero . iitb . ac . in>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from tvtk.tools.tvtk_doc import TVTKFilterChooser, TVTK_FILTERS
# Local imports.
from mayavi.filters.filter_base import FilterBase
from mayavi.core.common import ... |
obj = self._choose_filter()
self.filter = obj
######################################################################
# Non-public interface.
######################################################################
def _choose_filter(self):
chooser = TVTKFilterChooser()
... | cname = obj.__class__.__name__
error('Invalid filter %s chosen! Try again!'%cname) | conditional_block |
_hasnotematchingsubstringof.py | #
# gPrime - A web-based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your optio... | #-------------------------------------------------------------------------
#
# Gprime modules
#
#-------------------------------------------------------------------------
from .._hasnotesubstrbase import HasNoteSubstrBase
#-------------------------------------------------------------------------
# "Media having notes ... | _ = glocale.translation.gettext
| random_line_split |
_hasnotematchingsubstringof.py | #
# gPrime - A web-based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your optio... | (HasNoteSubstrBase):
"""Media having notes containing <substring>"""
name = _('Media objects having notes containing <substring>')
description = _("Matches media objects whose notes contain text "
"matching a substring")
| HasNoteMatchingSubstringOf | identifier_name |
_hasnotematchingsubstringof.py | #
# gPrime - A web-based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your optio... | """Media having notes containing <substring>"""
name = _('Media objects having notes containing <substring>')
description = _("Matches media objects whose notes contain text "
"matching a substring") | identifier_body | |
membership.js | import React, { Component } from 'react';
import { Menu, Dropdown, Button, Icon, message } from 'antd';
import { Link } from 'react-router';
import EmployeeTable from './table';
import { memberShip, employee, columns } from '../../accessConfig/employeeList';
import DropdownList from './../../commons/dropdown';
import {... | </Button>
</Dropdown>
<Link to="/setemployee">link</Link>
<DropdownList dropdownList={memberShipStore.toJS()} mode={1} />
<Link to=""><Button type="primary">新增员工</Button></Link>
<EmployeeTable columns={columns} dataSource={employee}/>
</div>
)
}
} | return (
<div>
<Dropdown overlay={menu}>
<Button type="ghost" style={{ marginLeft: 8 }}>
Button <Icon type="down" /> | random_line_split |
membership.js | import React, { Component } from 'react';
import { Menu, Dropdown, Button, Icon, message } from 'antd';
import { Link } from 'react-router';
import EmployeeTable from './table';
import { memberShip, employee, columns } from '../../accessConfig/employeeList';
import DropdownList from './../../commons/dropdown';
import {... | (e) {
console.log('click ', e);
this.setState({
current: e.key,
});
}
render() {
const { memberShipStore } = this.props.store;
return (
<div>
<Dropdown overlay={menu}>
<Button type="ghost" style={{ marginLeft: 8 }}>
Button <Icon type="down" />
... | handleClick | identifier_name |
membership.js | import React, { Component } from 'react';
import { Menu, Dropdown, Button, Icon, message } from 'antd';
import { Link } from 'react-router';
import EmployeeTable from './table';
import { memberShip, employee, columns } from '../../accessConfig/employeeList';
import DropdownList from './../../commons/dropdown';
import {... | {
const { memberShipStore } = this.props.store;
return (
<div>
<Dropdown overlay={menu}>
<Button type="ghost" style={{ marginLeft: 8 }}>
Button <Icon type="down" />
</Button>
</Dropdown>
<Link to="/setemployee">link</Link>
<DropdownList dropd... | identifier_body | |
ed_handler.py | # Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | logging.getLogger(__name__).info('loading {}'.format(data_dirs))
for d in data_dirs:
import_data(d, ed_db_params, ed_component_path)
def update_db(db_params, alembic_path):
"""
enable postgis on the db and update it's scheme
"""
cnx_string = db_params.cnx_string()
# we need to en... | random_line_split | |
ed_handler.py | # Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | (db_params, alembic_path):
"""
enable postgis on the db and update it's scheme
"""
cnx_string = db_params.cnx_string()
# we need to enable postgis on the db
cnx = psycopg2.connect(
database=db_params.dbname, user=db_params.user, password=db_params.password, host=db_params.host
)
... | update_db | identifier_name |
ed_handler.py | # Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... |
if launch_exec(
import_component, ["-i", file_to_load, "--connection-string", db_params.old_school_cnx_string()], log
):
raise Exception('Error: problem with running {}, stoping'.format(import_component))
def load_cities(cities_file, cities_db_params, cities_exec_path):
logger = logging.... | zip_file = zipfile.ZipFile(file_to_load)
zip_file.extractall(path=data_dir)
file_to_load = data_dir | conditional_block |
ed_handler.py | # Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... |
def load_data(data_dirs, ed_db_params, ed_component_path):
logging.getLogger(__name__).info('loading {}'.format(data_dirs))
for d in data_dirs:
import_data(d, ed_db_params, ed_component_path)
def update_db(db_params, alembic_path):
"""
enable postgis on the db and update it's scheme
""... | logger = logging.getLogger(__name__)
cities_exec = os.path.join(cities_exec_path, 'cities')
if launch_exec(
cities_exec, ["-i", cities_file, "--connection-string", cities_db_params.old_school_cnx_string()], logger
):
raise Exception('Error: problem with running {}, stoping'.format(cities_e... | identifier_body |
MasterRegistry.ts | import { Reducer, ReducersMapObject, ActionCreatorsMapObject } from "redux";
import { store } from "../store/store";
import combineReducersWithRoot from "./combineReducersWithRoot";
import SeqPartRegistry from "./SeqPartRegistry";
import SeqPart from "../seqpart/SeqPart";
import PluginRegistry from "./PluginRegistry";
... |
// this file has a method also called "addPlugin"
// so we'll rename it to avoid confusion.
const addPluginAction = addPlugin;
const removePluginAction = removePlugin;
/**
* Calls the appropriate sub-registries
* and adds new items to the state and reducers map
*
* This is not derived from AbstractRegistry,
* it... | import rootReducer from "../store/rootReducer";
import { addPlugin, addPart, removePlugin, removePart, connectAudioNodes } from "../store/rootActions"; | random_line_split |
MasterRegistry.ts | import { Reducer, ReducersMapObject, ActionCreatorsMapObject } from "redux";
import { store } from "../store/store";
import combineReducersWithRoot from "./combineReducersWithRoot";
import SeqPartRegistry from "./SeqPartRegistry";
import SeqPart from "../seqpart/SeqPart";
import PluginRegistry from "./PluginRegistry";
... | (): void {
const pluginReducers: ReducersMapObject = this.plugins.getAllSubReducers();
const seqPartReducers: ReducersMapObject = this.seqParts.getAllSubReducers();
const subReducers: ReducersMapObject = this.getSubReducer(pluginReducers, seqPartReducers);
const reducerTree: Reducer = t... | replaceReducer | identifier_name |
MasterRegistry.ts | import { Reducer, ReducersMapObject, ActionCreatorsMapObject } from "redux";
import { store } from "../store/store";
import combineReducersWithRoot from "./combineReducersWithRoot";
import SeqPartRegistry from "./SeqPartRegistry";
import SeqPart from "../seqpart/SeqPart";
import PluginRegistry from "./PluginRegistry";
... |
}
| {
return combineReducersWithRoot(subReducers, rootReducer);
} | identifier_body |
MasterRegistry.ts | import { Reducer, ReducersMapObject, ActionCreatorsMapObject } from "redux";
import { store } from "../store/store";
import combineReducersWithRoot from "./combineReducersWithRoot";
import SeqPartRegistry from "./SeqPartRegistry";
import SeqPart from "../seqpart/SeqPart";
import PluginRegistry from "./PluginRegistry";
... | else {
newPart = this.seqParts.add();
}
// build a new root reducer and replace the current one
this.replaceReducer();
store.dispatch(addPart(newPart.uid));
// make the new item observe the store
newPart.unsubscribe = this.seqParts.observeStore(store, newP... | {
newPart = this.seqParts.add(lengthInStepsPerBar);
} | conditional_block |
code_input.ts | // Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
imp... |
clearInput() {
this.$.accessCodeInput.value = '';
}
focusInput() {
this.$.accessCodeInput.focusInput();
}
private handleInput() {
this.$.accessCodeInput.value = this.$.accessCodeInput.value.toUpperCase();
this.dispatchEvent(new CustomEvent('access-code-input', {
detail: {value: this.... | {
super.ready();
this.$.accessCodeInput.addEventListener('input', () => {
this.handleInput();
});
} | identifier_body |
code_input.ts | // Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
imp... | () {
return 'c2c-code-input';
}
static get template() {
return html`{__html_template__}`;
}
static get properties() {
return {
length: Number,
value: {
type: String,
value: '',
}
};
}
get crInput() {
return this.$.accessCodeInput;
}
value: string... | is | identifier_name |
code_input.ts | // Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
imp... | private handleInput() {
this.$.accessCodeInput.value = this.$.accessCodeInput.value.toUpperCase();
this.dispatchEvent(new CustomEvent('access-code-input', {
detail: {value: this.$.accessCodeInput.value}
}));
}
}
customElements.define(CodeInputElement.is, CodeInputElement); |
focusInput() {
this.$.accessCodeInput.focusInput();
}
| random_line_split |
gc_engine.py | ("|")))
else:
xErr.aSuggestions = tuple(m.expand(sRepl).split("|"))
# Message
if sMsg[0:1] == "=":
sMessage = _GLOBALS[sMsg[1:]](s, m)
else:
sMessage = m.expand(sMsg)
xErr.aShortComment = sMessage # sMessage.split("|")[0] # in context menu
xErr.aFullCom... | osition, word), returns True if not sNegPattern in word morphologies and sPattern in word morphologies (disambiguation on)"
if not tWord:
return bNoWord
if tWord[1] not in _dAnalyses and not _storeMorphFromFSA(tWord[1]):
return False
lMorph = dDA[tWord[0]] if tWord[0] in dDA else _dAnalyse... | identifier_body | |
gc_engine.py | IgnoredRules:
for m in zRegex.finditer(s):
for sFuncCond, cActionType, sWhat, *eAct in lActions:
# action in lActions: [ condition, action type, replacement/suggestion/action[, iGroup[, message, URL]] ]
try:
... | lParagraphRules
def _loadRules2 ():
from itertools import chain
from . import gc_rules
global _rules
_rules = gc_rules
# compile rules regex
for rule in chain(_rules.lParagraphRules, _rules.lSentenceRules):
try:
rule[1] = re.compile(rule[1])
except:
echo... | enceRules
return _rules. | conditional_block |
gc_engine.py | aIgnoredRules:
for m in zRegex.finditer(s):
for sFuncCond, cActionType, sWhat, *eAct in lActions:
# action in lActions: [ condition, action type, replacement/suggestion/action[, iGroup[, message, URL]] ]
try:
... | _GLOBALS[sWhat](s, m, dDA)
if bDebug:
echo(u"= " + m.group(0) + " # " + sRuleId + "\nDA: " + str(dDA))
else:
echo("# er... | random_line_split | |
gc_engine.py | ):
if cActionType == "-":
# grammar error
# (text, replacement, nOffset, m, iGroup, sId, bUppercase, sURL, bIdRule)
aErrs.append(_createError(s, sWhat, nOffset, m, ... | "retur | identifier_name | |
_stream_transform.js | // Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modi... | this._transformState = new TransformState(options, this);
// when the writable side finishes, then flush out anything remaining.
var stream = this;
// start out asking for a readable event once data is transformed.
this._readableState.needReadable = true;
// we have implemented the _read method, and done... | random_line_split | |
_stream_transform.js | // Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modi... | (stream, er, data) {
var ts = stream._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (!cb)
return stream.emit('error', new Error('no writecb in Transform class'));
ts.writechunk = null;
ts.writecb = null;
if (!util.isNullOrUndefined(data))
stream.push(data);
if (cb)
cb... | afterTransform | identifier_name |
_stream_transform.js | // Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modi... |
function afterTransform(stream, er, data) {
var ts = stream._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (!cb)
return stream.emit('error', new Error('no writecb in Transform class'));
ts.writechunk = null;
ts.writecb = null;
if (!util.isNullOrUndefined(data))
stream.push... | {
this.afterTransform = function(er, data) {
return afterTransform(stream, er, data);
};
this.needTransform = false;
this.transforming = false;
this.writecb = null;
this.writechunk = null;
} | identifier_body |
hours.ts | import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-hours',
templateUrl: 'hours.html',
})
export class HoursPage {
started: boolean = false;
stopped: boolean = true;
constructor(public navCtrl: NavControl... | } | } | random_line_split |
hours.ts | import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-hours',
templateUrl: 'hours.html',
})
export class HoursPage {
started: boolean = false;
stopped: boolean = true;
constructor(public navCtrl: NavControl... | ionViewDidLoad() {
}
startstop() {
this.started = !this.started;
this.stopped = !this.stopped;
var date = new Date();
var month = date.getMonth() + 1;
var year = date.getFullYear();
var day = date.getUTCDate();
var hour = date.getHours();
var mins = date.getMinutes();
var t... | }
| identifier_body |
hours.ts | import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-hours',
templateUrl: 'hours.html',
})
export class Ho |
started: boolean = false;
stopped: boolean = true;
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
}
startstop() {
this.started = !this.started;
this.stopped = !this.stopped;
var date = new Date();
var month = date.getMonth() + 1;
... | ursPage { | identifier_name |
scheduler.py | from future import standard_library
standard_library.install_aliases()
from builtins import object
import threading
from time import time
import random
import queue
from ..common import log
class Scheduler(object):
"""
A simple scheduler which schedules the periodic or once event
"""
import sortedcon... |
def _wakeup(self):
self._wakeup_q.put(None)
def _do_execution(self, jobs):
for job in jobs:
job()
| self.max_delay_time = 1 | identifier_body |
scheduler.py | from future import standard_library
standard_library.install_aliases()
from builtins import object
import threading
from time import time
import random
import queue
from ..common import log
class Scheduler(object):
"""
A simple scheduler which schedules the periodic or once event
"""
import sortedcon... | sleep_time = 1
with self._lock:
job_set = self._jobs
total_jobs = len(job_set)
for job in job_set:
if job.get_expiration() <= now:
ready_jobs.append(job)
if ready_jobs:
del job_set[:len(ready_jobs)]
... | random_line_split | |
scheduler.py | from future import standard_library
standard_library.install_aliases()
from builtins import object
import threading
from time import time
import random
import queue
from ..common import log
class Scheduler(object):
"""
A simple scheduler which schedules the periodic or once event
"""
import sortedcon... |
if ready_jobs:
del job_set[:len(ready_jobs)]
for job in ready_jobs:
if job.get_interval() != 0 and not job.stopped():
# repeated job, calculate next due time and enqueue
job.update_expiration()
job_set... | if job.get_expiration() <= now:
ready_jobs.append(job) | conditional_block |
scheduler.py | from future import standard_library
standard_library.install_aliases()
from builtins import object
import threading
from time import time
import random
import queue
from ..common import log
class | (object):
"""
A simple scheduler which schedules the periodic or once event
"""
import sortedcontainers as sc
max_delay_time = 60
def __init__(self):
self._jobs = Scheduler.sc.SortedSet()
self._wakeup_q = queue.Queue()
self._lock = threading.Lock()
self._thr = ... | Scheduler | identifier_name |
cmake.py | www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and... |
def on_stdout_received(self, data):
self.send_progress(data)
data = self._decode(data)
if data.startswith('-- run_tests.py: execute command'):
self.in_test_output = True
elif data.startswith('-- run_tests.py: verify result'):
self.in_test_output = False
... | super(CMakeMakeRunTestsIOBufferProtocol, self).__init__(
label, job_id, stage_label, event_queue, log_path, *args, **kwargs)
# Line formatting filters
# Each is a 2-tuple:
# - regular expression
# - output formatting line
self.filters = [
(re.compile(r'... | identifier_body |
cmake.py | www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and... |
return cline + '\n'
class CMakeMakeIOBufferProtocol(IOBufferProtocol):
"""An IOBufferProtocol which parses CMake's progress prefixes and emits corresponding STAGE_PROGRESS events."""
def __init__(self, label, job_id, stage_label, event_queue, log_path, *args, **kwargs):
super(CMakeMakeIOBu... | for p, r, f in self.filters:
match = p.match(cline)
if match is not None:
cline = fmt(r, reset=False)
if f is not None:
cline = cline.format(*f(match.groups()))
else:
cline = cline... | conditional_block |
cmake.py | .apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# ... | (IOBufferProtocol):
"""An asyncio protocol that collects stdout and stderr.
This class also generates `stdout` and `stderr` events.
Since the underlying asyncio API constructs the actual protocols, this
class provides a factory method to inject the job and stage information
into the created proto... | CMakeIOBufferProtocol | identifier_name |
cmake.py | www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and... | """An asyncio protocol that collects stdout and stderr.
This class also generates `stdout` and `stderr` events.
Since the underlying asyncio API constructs the actual protocols, this
class provides a factory method to inject the job and stage information
into the created protocol.
"""
def... | random_line_split | |
dstr-dflt-obj-ptrn-id-init-fn-name-class.js | // This file was procedurally generated from the following sources:
// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
// - src/dstr-binding/default/async-gen-func-decl-dflt.template
/*---
description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function declaration (default paramete... | }).then($DONE, $DONE); | random_line_split | |
dstr-dflt-obj-ptrn-id-init-fn-name-class.js | // This file was procedurally generated from the following sources:
// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
// - src/dstr-binding/default/async-gen-func-decl-dflt.template
/*---
description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function declaration (default paramete... | () {} } } = {}) {
assert.sameValue(cls.name, 'cls');
assert.notSameValue(xCls.name, 'xCls');
assert.notSameValue(xCls2.name, 'xCls2');
callCount = callCount + 1;
};
f().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
| name | identifier_name |
dstr-dflt-obj-ptrn-id-init-fn-name-class.js | // This file was procedurally generated from the following sources:
// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
// - src/dstr-binding/default/async-gen-func-decl-dflt.template
/*---
description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function declaration (default paramete... | } } = {}) {
assert.sameValue(cls.name, 'cls');
assert.notSameValue(xCls.name, 'xCls');
assert.notSameValue(xCls2.name, 'xCls2');
callCount = callCount + 1;
};
f().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
| {} | identifier_body |
general-benefits.tsx | import {
isBusinessPlan,
isCompletePlan,
isJetpackPlanSlug,
isPersonalPlan,
isPremiumPlan,
isSecurityDailyPlan,
isSecurityRealTimePlan,
} from '@automattic/calypso-products';
import { useTranslate } from 'i18n-calypso';
import * as React from 'react';
/*
* Show a list of Jetpack benefits that do not depend on ... | hasBusinessPlan
) {
benefits.push(
<React.Fragment>
{ translate( 'The ability to {{strong}}collect payments{{/strong}}.', {
components: {
strong: <strong />,
},
} ) }
</React.Fragment>
);
benefits.push(
<React.Fragment>
{ translate( 'The {{strong}}Ad program{{/strong}} for ... | if (
hasSecurityDailyPlan ||
hasSecurityRealTimePlan ||
hasCompletePlan ||
hasPremiumPlan || | random_line_split |
iRowModel.d.ts | import { RowNode } from "../entities/rowNode";
export interface RowBounds {
rowTop: number;
rowHeight: number;
rowIndex?: number;
}
export interface IRowModel {
/** Returns the rowNode at the given index. */
getRow(index: number): RowNode | null;
/** Returns the rowNode for given id. */
getR... | /** Returns row top and bottom for a given row */
getRowBounds(index: number): RowBounds | null;
/** Returns true if this model has no rows, regardless of model filter. EG if rows present, but filtered
* out, this still returns false. If it returns true, then the grid shows the 'no rows' overlay - but ... | getCurrentPageHeight(): number;
/** Returns true if the provided rowNode is in the list of rows to render */
isRowPresent(rowNode: RowNode): boolean; | random_line_split |
feedbackStatusbarItem.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
}
public render(element: HTMLElement): IDisposable {
if (product.sendASmile) {
this.dropdown = this.instantiationService.createInstance(FeedbackDropdown, element, {
contextViewProvider: this.contextViewService,
feedbackService: this.instantiationService.createInstance(TwitterFeedbackService)
});
... | {
this.dropdown.label.style('background-color', this.getColor(this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY ? STATUS_BAR_FOREGROUND : STATUS_BAR_NO_FOLDER_FOREGROUND));
} | conditional_block |
feedbackStatusbarItem.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
public getCharacterLimit(sentiment: number): number {
let length: number = 0;
if (sentiment === 1) {
TwitterFeedbackService.HASHTAGS.forEach(element => {
length += element.length + 2;
});
}
if (TwitterFeedbackService.VIA_NAME) {
length += ` via @${TwitterFeedbackService.VIA_NAME}`.length;
}
... | {
const queryString = `?${feedback.sentiment === 1 ? `hashtags=${this.combineHashTagsAsString()}&` : null}ref_src=twsrc%5Etfw&related=twitterapi%2Ctwitter&text=${feedback.feedback}&tw_p=tweetbutton&via=${TwitterFeedbackService.VIA_NAME}`;
const url = TwitterFeedbackService.TWITTER_URL + queryString;
window.open(... | identifier_body |
feedbackStatusbarItem.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | (
@IInstantiationService private instantiationService: IInstantiationService,
@IContextViewService private contextViewService: IContextViewService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IThemeService themeService: IThemeService
) {
super(themeService);
this.registerL... | constructor | identifier_name |
feedbackStatusbarItem.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | return null;
}
} | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.