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
drift_utils_test.py
# Copyright 2021 DeepMind Technologies Limited and 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 applic...
absltest.main()
conditional_block
drift_utils_test.py
# Copyright 2021 DeepMind Technologies Limited and 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 applic...
self.assertEqual(drift_coeffs.gen.self_norm, 0.5 * gen_lr) self.assertEqual(drift_coeffs.gen.other_norm, 0.0) self.assertEqual(drift_coeffs.gen.other_dot_prod, 0.5 * gen_lr) @parameterized.parameters(LEARNING_RATE_TUPLES) def test_alt_updates(self, disc_lr, gen_lr): learning_rates = gan.GANTuple(di...
"""Test class to ensure drift coefficients are computed correctly. Ensures that the drift coefficients in two-player games are computed as for the math for: * simultaneous updates. * alternating updates (for both player orders). """ @parameterized.parameters(LEARNING_RATE_TUPLES) def test_sim_update...
identifier_body
drift_utils_test.py
# Copyright 2021 DeepMind Technologies Limited and 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 applic...
(self, disc_lr, gen_lr): learning_rates = gan.GANTuple(disc=disc_lr, gen=gen_lr) num_updates = gan.GANTuple(disc=1, gen=1) drift_coeffs = drift_utils.get_dd_coeffs( drift_utils.PlayerOrder.disc_first, False, learning_rates, num_updates=num_updates) self.assertEqual(drift_coeffs.disc.sel...
test_alt_updates
identifier_name
dart_tree.ts
/// <reference path="../../typings/node/node.d.ts" /> /// <reference path="../angular_builder.d.ts" /> 'use strict'; import {MultiCopy} from './../multi_copy'; import destCopy from '../broccoli-dest-copy'; var Funnel = require('broccoli-funnel'); var glob = require('glob'); import mergeTrees from '../broccoli-merge-tr...
function getSourceTree() { // Transpile everything in 'modules' except for rtts_assertions. var tsInputTree = modulesFunnel(['**/*.js', '**/*.ts', '**/*.dart'], ['rtts_assert/**/*']); var transpiled = ts2dart(tsInputTree, {generateLibraryName: true, generateSourceMap: false}); // Native sources, dart only exa...
{ if (!relativePath.match(/^modules\//)) { throw new Error('Expected path to root at modules/: ' + relativePath); } return relativePath.replace(/^modules\//, ''); }
identifier_body
dart_tree.ts
/// <reference path="../../typings/node/node.d.ts" /> /// <reference path="../angular_builder.d.ts" /> 'use strict'; import {MultiCopy} from './../multi_copy'; import destCopy from '../broccoli-dest-copy'; var Funnel = require('broccoli-funnel'); var glob = require('glob'); import mergeTrees from '../broccoli-merge-tr...
(content: string, relativePath: string): string { var scriptTags = ''; if (relativePath.match(/^benchmarks/)) { scriptTags += '<script src="url_params_to_form.js" type="text/javascript"></script>\n'; } var scriptName = relativePath.replace(/.*\/([^/]+)\.html$/, '$1.dart'); scriptTags += '<script src="' + ...
replaceScriptTagInHtml
identifier_name
dart_tree.ts
/// <reference path="../../typings/node/node.d.ts" /> /// <reference path="../angular_builder.d.ts" /> 'use strict'; import {MultiCopy} from './../multi_copy'; import destCopy from '../broccoli-dest-copy'; var Funnel = require('broccoli-funnel'); var glob = require('glob'); import mergeTrees from '../broccoli-merge-tr...
parts.splice(1, 0, repl.insertion); return path.join.apply(path, parts); } } throw new Error('Failed to match any path: ' + relativePath); }); } function getHtmlSourcesTree() { // Replace $SCRIPT$ markers in HTML files. var htmlSrcsTree = stew.map(modulesFunnel(['*/src/**/*.html']),...
random_line_split
dart_tree.ts
/// <reference path="../../typings/node/node.d.ts" /> /// <reference path="../angular_builder.d.ts" /> 'use strict'; import {MultiCopy} from './../multi_copy'; import destCopy from '../broccoli-dest-copy'; var Funnel = require('broccoli-funnel'); var glob = require('glob'); import mergeTrees from '../broccoli-merge-tr...
return relativePath.replace(/^modules\//, ''); } function getSourceTree() { // Transpile everything in 'modules' except for rtts_assertions. var tsInputTree = modulesFunnel(['**/*.js', '**/*.ts', '**/*.dart'], ['rtts_assert/**/*']); var transpiled = ts2dart(tsInputTree, {generateLibraryName: true, generateSou...
{ throw new Error('Expected path to root at modules/: ' + relativePath); }
conditional_block
gpdb_data_source.js
chorus.models.GpdbDataSource = chorus.models.DataSource.extend({
showUrlTemplate: "data_sources/{{id}}/databases", parameterWrapper: "data_source", defaults: { entityType: 'gpdb_data_source' }, databases: function() { this._databases || (this._databases = new chorus.collections.DatabaseSet([], {dataSourceId: this.get("id")})); return th...
constructorName: "GpdbDataSource", urlTemplate: "data_sources/{{id}}", nameAttribute: 'name', entityType: "gpdb_data_source",
random_line_split
enum_iterator.rs
#[macro_use] extern crate custom_derive; macro_rules! EnumIterator { (() $(pub)* enum $name:ident { $($body:tt)* }) => { EnumIterator! { @collect_variants ($name), ($($body)*,) -> () } }; ( @collect_variants ($name:ident), ($(,)*) -> ($($var_names:id...
} #[test] fn test_enum_iterator() { let vs: Vec<_> = Get::iter_variant_names().zip(Get::iter_variants()).collect(); assert_eq!(&*vs, &[("Up", Get::Up), ("Down", Get::Down), ("AllAround", Get::AllAround)]); }
random_line_split
enum_iterator.rs
#[macro_use] extern crate custom_derive; macro_rules! EnumIterator { (() $(pub)* enum $name:ident { $($body:tt)* }) => { EnumIterator! { @collect_variants ($name), ($($body)*,) -> () } }; ( @collect_variants ($name:ident), ($(,)*) -> ($($var_names:id...
{ let vs: Vec<_> = Get::iter_variant_names().zip(Get::iter_variants()).collect(); assert_eq!(&*vs, &[("Up", Get::Up), ("Down", Get::Down), ("AllAround", Get::AllAround)]); }
identifier_body
enum_iterator.rs
#[macro_use] extern crate custom_derive; macro_rules! EnumIterator { (() $(pub)* enum $name:ident { $($body:tt)* }) => { EnumIterator! { @collect_variants ($name), ($($body)*,) -> () } }; ( @collect_variants ($name:ident), ($(,)*) -> ($($var_names:id...
() { let vs: Vec<_> = Get::iter_variant_names().zip(Get::iter_variants()).collect(); assert_eq!(&*vs, &[("Up", Get::Up), ("Down", Get::Down), ("AllAround", Get::AllAround)]); }
test_enum_iterator
identifier_name
de.py
'%d.%m.%Y': '%d.%m.%Y', '%s %%(shop)': '%s %%(shop)', '%s %%(shop[0])': '%s %%(shop[0])', '%s %%{quark[0]}': '%s %%{quark[0]}', '%s %%{row} deleted': '%s %%{row} gelöscht', '%s %%{row} updated': '%s %%{row} aktualisiert', '%s %%{shop[0]}': '%s %%{shop[0]}', '%s %%{shop}': '%s %%{shop}', '%s selected': '%s ausgewählt', ...
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '""Update" ist ein optionaler Ausdruck wie "Feld1 = \'newvalue". JOIN Ergebnisse können nicht aktualisiert oder gelöscht werden', '%(nrows)s records found': '%(nrows)s Einträge gefunden',
random_line_split
auth-guard.service.ts
'use strict'; import { Injectable } from '@angular/core'; import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, } from '@angular/router'; import { Observable } from 'rxjs'; import { AuthService } from './auth.service'; /** * This guard ensures that: * 1. Only authenticated users can access...
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> { if (this.authService.authenticated) { if (route.url.length && route.url[0].path === 'admin') { return this.authService.user.flatMap(user => { return user.admin ? Observable.of(true) : this.router.navi...
{ }
identifier_body
auth-guard.service.ts
'use strict'; import { Injectable } from '@angular/core'; import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, } from '@angular/router'; import { Observable } from 'rxjs'; import { AuthService } from './auth.service'; /** * This guard ensures that: * 1. Only authenticated users can access...
this.authService.login(state.url); return Promise.resolve(false); } }
{ if (route.url.length && route.url[0].path === 'admin') { return this.authService.user.flatMap(user => { return user.admin ? Observable.of(true) : this.router.navigate(['/error', 401], { skipLocationChange: true }); }).first().toPromise(); } else { return Promise.resolve(true); } ...
conditional_block
auth-guard.service.ts
'use strict'; import { Injectable } from '@angular/core'; import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, } from '@angular/router'; import { Observable } from 'rxjs'; import { AuthService } from './auth.service'; /** * This guard ensures that: * 1. Only authenticated users can access...
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> { if (this.authService.authenticated) { if (route.url.length && route.url[0].path === 'admin') { return this.authService.user.flatMap(user => { return user.admin ? Observable.of(true) : this.router.navigate(['/error'...
canActivate
identifier_name
auth-guard.service.ts
'use strict'; import { Injectable } from '@angular/core'; import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, } from '@angular/router'; import { Observable } from 'rxjs'; import { AuthService } from './auth.service'; /** * This guard ensures that: * 1. Only authenticated users can access...
}
random_line_split
parser_test.py
# Copyright 2017 The TensorFlow Authors. 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 required by applica...
def test_parse_entity(self): def f(x): return x + 1 mod, _ = parser.parse_entity(f) self.assertEqual('f', mod.body[0].name) def test_parse_str(self): mod = parser.parse_str( textwrap.dedent(""" def f(x): return x + 1 """)) self.assertEqual('f', mod....
random_line_split
parser_test.py
# Copyright 2017 The TensorFlow Authors. 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 required by applica...
(self): def f(x): return x + 1 mod, _ = parser.parse_entity(f) self.assertEqual('f', mod.body[0].name) def test_parse_str(self): mod = parser.parse_str( textwrap.dedent(""" def f(x): return x + 1 """)) self.assertEqual('f', mod.body[0].name) def te...
test_parse_entity
identifier_name
parser_test.py
# Copyright 2017 The TensorFlow Authors. 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 required by applica...
mod, _ = parser.parse_entity(f) self.assertEqual('f', mod.body[0].name) def test_parse_str(self): mod = parser.parse_str( textwrap.dedent(""" def f(x): return x + 1 """)) self.assertEqual('f', mod.body[0].name) def test_parse_expression(self): node = par...
return x + 1
identifier_body
parser_test.py
# Copyright 2017 The TensorFlow Authors. 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 required by applica...
test.main()
conditional_block
gps.js
var GPSClient = {}; GPSClient.send = function(exeurl, latitude,longitude,actionname,username) { var client = Titanium.Network.createHTTPClient({timeout : 100000}); var paramater = '&intaliouser=' + username + '&parameter=latitude:' + longitude + ','; //var paramater = '&username=' + username + '&parameter=latitude:...
} var dialog = Titanium.UI.createAlertDialog({}); dialog.title = Titanium.Locale.getString("gps_network_title"); dialog.message = Titanium.Locale.getString("gps_network_message"); dialog.show(); return; }; client.send(); };
dialog.message = Titanium.Locale.getString("gps_connect_message"); dialog.show(); return;
random_line_split
gps.js
var GPSClient = {}; GPSClient.send = function(exeurl, latitude,longitude,actionname,username) { var client = Titanium.Network.createHTTPClient({timeout : 100000}); var paramater = '&intaliouser=' + username + '&parameter=latitude:' + longitude + ','; //var paramater = '&username=' + username + '&parameter=latitude:...
} catch (e) { Titanium.API.error(e); var dialog = Titanium.UI.createAlertDialog({}); dialog.title = Titanium.Locale.getString("gps_catch_title"); dialog.message = Titanium.Locale.getString("gps_catch_message"); dialog.show(); return; } }; client.onerror = function() { if (client.status == 40...
{ return; }
conditional_block
elixirSenseSignatureHelpProvider.ts
import { join, sep } from 'path'; import * as vscode from 'vscode'; import { ElixirSenseClient } from './elixirSenseClient'; import { checkElixirSenseClientInitialized, checkTokenCancellation } from './elixirSenseValidations'; function validateResultIsNotNone(result: any) { if (result === 'none') { throw new Err...
genParameterInfo(param): vscode.ParameterInformation { return new vscode.ParameterInformation(param); } }
return si; }
random_line_split
elixirSenseSignatureHelpProvider.ts
import { join, sep } from 'path'; import * as vscode from 'vscode'; import { ElixirSenseClient } from './elixirSenseClient'; import { checkElixirSenseClientInitialized, checkTokenCancellation } from './elixirSenseValidations'; function validateResultIsNotNone(result: any) { if (result === 'none') { throw new Err...
const payload = { buffer: document.getText(), line: position.line + 1, column: position.character + 1 }; return resultPromise .then((elixirSenseClient: ElixirSenseClient) => elixirSenseClient.send('signature', payload)) .then(result => checkTokenCancellation(t...
{ return new Promise((resolve, reject) => { let elixirSenseClientError; const resultPromise = Promise.resolve(this.elixirSenseClient) .then(elixirSenseClient => checkElixirSenseClientInitialized(elixirSenseClient)) .catch(err => { elixirSenseClientError = err; }); ...
identifier_body
elixirSenseSignatureHelpProvider.ts
import { join, sep } from 'path'; import * as vscode from 'vscode'; import { ElixirSenseClient } from './elixirSenseClient'; import { checkElixirSenseClientInitialized, checkTokenCancellation } from './elixirSenseValidations'; function validateResultIsNotNone(result: any) { if (result === 'none') { throw new Err...
(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Thenable<vscode.SignatureHelp> { return new Promise((resolve, reject) => { let elixirSenseClientError; const resultPromise = Promise.resolve(this.elixirSenseClient) .then(elixirSenseClient => checkElixir...
provideSignatureHelp
identifier_name
elixirSenseSignatureHelpProvider.ts
import { join, sep } from 'path'; import * as vscode from 'vscode'; import { ElixirSenseClient } from './elixirSenseClient'; import { checkElixirSenseClientInitialized, checkTokenCancellation } from './elixirSenseValidations'; function validateResultIsNotNone(result: any) { if (result === 'none') { throw new Err...
} const vsSigs = this.processSignatures(signatures); const signatureHelper = new vscode.SignatureHelp(); signatureHelper.activeParameter = paramPosition; signatureHelper.activeSignature = 0; signatureHelper.signatures = vsSigs; resolve(signatureHe...
{ paramPosition = signatures[0].params.length - 1; }
conditional_block
ports_list.py
# -*- coding: utf-8 -*- # # This file is part of Glances. # # Copyright (C) 2016 Nicolargo <nicolas@nicolargo.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
self, config): """Load the ports list from the configuration file.""" ports_list = [] if config is None: logger.debug("No configuration file available. Cannot load ports list.") elif not config.has_section(self._section): logger.debug("No [%s] section in the conf...
oad(
identifier_name
ports_list.py
# -*- coding: utf-8 -*- # # This file is part of Glances. # # Copyright (C) 2016 Nicolargo <nicolas@nicolargo.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
"""Set the key to the value for the pos (position in the list).""" self._ports_list[pos][key] = value
def get_ports_list(self): """Return the current server list (dict of dict).""" return self._ports_list def set_server(self, pos, key, value):
random_line_split
ports_list.py
# -*- coding: utf-8 -*- # # This file is part of Glances. # # Copyright (C) 2016 Nicolargo <nicolas@nicolargo.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
""Set the key to the value for the pos (position in the list).""" self._ports_list[pos][key] = value
identifier_body
ports_list.py
# -*- coding: utf-8 -*- # # This file is part of Glances. # # Copyright (C) 2016 Nicolargo <nicolas@nicolargo.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
# Refresh rate in second new_port['refresh'] = refresh # Timeout in second new_port['timeout'] = int(config.get_value(self._section, '%stimeout' % postfix, ...
ew_port = {} postfix = 'port_%s_' % str(i) # Read mandatories configuration key: host new_port['host'] = config.get_value(self._section, '%s%s' % (postfix, 'host')) if new_port['host'] is None: continue # Read optiona...
conditional_block
common.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
/** * Given events that occurred, applies some rules to normalize the events */ export function normalize(changes: IRawFileChange[]): IRawFileChange[] { // Build deltas let normalizer = new EventNormalizer(); for (let i = 0; i < changes.length; i++) { let event = changes[i]; normalizer.processEvent(event); ...
{ // map to file changes event that talks about URIs return new FileChangesEvent(changes.map((c) => { return { type: c.type, resource: uri.file(c.path) }; })); }
identifier_body
common.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
// flatten DELETE followed by CREATE into CHANGE else if (currentChangeType === FileChangeType.DELETED && newChangeType === FileChangeType.ADDED) { existingEvent.type = FileChangeType.UPDATED; } // Do nothing. Keep the created event else if (currentChangeType === FileChangeType.ADDED && newChangeTyp...
this.normalized.splice(this.normalized.indexOf(existingEvent), 1); }
random_line_split
common.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} // Otherwise Store else { this.normalized.push(event); this.mapPathToChange[event.path] = event; } } public normalize(): IRawFileChange[] { let addedChangeEvents: IRawFileChange[] = []; let deletedPaths: string[] = []; // This algorithm will remove all DELETE events up to the root folder /...
{ existingEvent.type = newChangeType; }
conditional_block
common.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
{ private normalized: IRawFileChange[]; private mapPathToChange: { [path: string]: IRawFileChange }; constructor() { this.normalized = []; this.mapPathToChange = Object.create(null); } public processEvent(event: IRawFileChange): void { // Event path already exists let existingEvent = this.mapPathToChan...
EventNormalizer
identifier_name
testConfiguration.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(): IEnvConfiguration { return { extraEditorClassName: '', outerWidth: 100, outerHeight: 100, emptySelectionClipboard: true, pixelRatio: 1, zoomLevel: 0, accessibilitySupport: AccessibilitySupport.Unknown }; } protected readConfiguration(styling: BareFontInfo): FontInfo { return new FontIn...
_getEnvConfiguration
identifier_name
testConfiguration.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
protected _getEnvConfiguration(): IEnvConfiguration { return { extraEditorClassName: '', outerWidth: 100, outerHeight: 100, emptySelectionClipboard: true, pixelRatio: 1, zoomLevel: 0, accessibilitySupport: AccessibilitySupport.Unknown }; } protected readConfiguration(styling: BareFontInfo)...
random_line_split
testConfiguration.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
protected readConfiguration(styling: BareFontInfo): FontInfo { return new FontInfo({ zoomLevel: 0, fontFamily: 'mockFont', fontWeight: 'normal', fontSize: 14, lineHeight: 19, letterSpacing: 1.5, isMonospace: true, typicalHalfwidthCharacterWidth: 10, typicalFullwidthCharacterWidth: 20, ...
{ return { extraEditorClassName: '', outerWidth: 100, outerHeight: 100, emptySelectionClipboard: true, pixelRatio: 1, zoomLevel: 0, accessibilitySupport: AccessibilitySupport.Unknown }; }
identifier_body
productionOrStagingEndpointInfo.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
/** * Defines the metadata of ProductionOrStagingEndpointInfo * * @returns {object} metadata of ProductionOrStagingEndpointInfo * */ mapper() { return { required: false, serializedName: 'ProductionOrStagingEndpointInfo', type: { name: 'Composite', className: 'P...
{ super(); }
identifier_body
productionOrStagingEndpointInfo.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
/** * Class representing a ProductionOrStagingEndpointInfo. * @extends models['EndpointInfo'] */ class ProductionOrStagingEndpointInfo extends models['EndpointInfo'] { /** * Create a ProductionOrStagingEndpointInfo. */ constructor() { super(); } /** * Defines the metadata of ProductionOrStagin...
random_line_split
productionOrStagingEndpointInfo.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
() { super(); } /** * Defines the metadata of ProductionOrStagingEndpointInfo * * @returns {object} metadata of ProductionOrStagingEndpointInfo * */ mapper() { return { required: false, serializedName: 'ProductionOrStagingEndpointInfo', type: { name: 'Composite', ...
constructor
identifier_name
lib.rs
// Copyright 2015 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 ...
<T: Hash>(t: &T) -> u64 { let mut s = DefaultHasher::new(); t.hash(&mut s); s.finish() } // FIXME: Instantiated functions with i128 in the signature is not supported in Emscripten. // See https://github.com/kripken/emscripten-fastcomp/issues/169 #[cfg(not(target_os = "emscripten"))] #[test] fn test_boxed_h...
hash
identifier_name
lib.rs
// Copyright 2015 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 ...
// FIXME: Instantiated functions with i128 in the signature is not supported in Emscripten. // See https://github.com/kripken/emscripten-fastcomp/issues/169 #[cfg(not(target_os = "emscripten"))] #[test] fn test_boxed_hasher() { let ordinary_hash = hash(&5u32); let mut hasher_1 = Box::new(DefaultHasher::new()...
{ let mut s = DefaultHasher::new(); t.hash(&mut s); s.finish() }
identifier_body
lib.rs
// Copyright 2015 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 ...
mod arc; mod binary_heap; mod btree; mod cow_str; mod fmt; mod heap; mod linked_list; mod rc; mod slice; mod str; mod string; mod vec_deque; mod vec; fn hash<T: Hash>(t: &T) -> u64 { let mut s = DefaultHasher::new(); t.hash(&mut s); s.finish() } // FIXME: Instantiated functions with i128 in the signature ...
random_line_split
gh-path.js
import {helper} from 'ember-helper'; import {htmlSafe} from 'ember-string'; import ghostPaths from 'ghost-admin/utils/ghost-paths'; // Handlebars Helper {{gh-path}} // Usage: Assume 'http://www.myghostblog.org/myblog/' // {{gh-path}} or {{gh-path 'blog'}} for Ghost's root (/myblog/) // {{gh-path 'admin'}} for Ghost's ...
base = base + url; } return htmlSafe(base); });
if (url[0] === '/') { url = url.substr(1); }
random_line_split
gh-path.js
import {helper} from 'ember-helper'; import {htmlSafe} from 'ember-string'; import ghostPaths from 'ghost-admin/utils/ghost-paths'; // Handlebars Helper {{gh-path}} // Usage: Assume 'http://www.myghostblog.org/myblog/' // {{gh-path}} or {{gh-path 'blog'}} for Ghost's root (/myblog/) // {{gh-path 'admin'}} for Ghost's ...
return htmlSafe(base); });
{ if (url[0] === '/') { url = url.substr(1); } base = base + url; }
conditional_block
lib.rs
pub fn sing(start: i32, end: i32) -> String { let mut out = String::new(); let mut count = start; while count >= end { out.push_str(verse(count).as_str()); out.push('\n'); count -= 1; } out.pop(); return out; } pub fn
(num: i32) -> String { let mut out = String::new(); match num { 0 => { out.push_str(format!("No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n").as_str()); }, 1 => { out.push_str(fo...
verse
identifier_name
lib.rs
pub fn sing(start: i32, end: i32) -> String
pub fn verse(num: i32) -> String { let mut out = String::new(); match num { 0 => { out.push_str(format!("No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n").as_str()); }, 1 => { o...
{ let mut out = String::new(); let mut count = start; while count >= end { out.push_str(verse(count).as_str()); out.push('\n'); count -= 1; } out.pop(); return out; }
identifier_body
lib.rs
pub fn sing(start: i32, end: i32) -> String { let mut out = String::new(); let mut count = start; while count >= end { out.push_str(verse(count).as_str()); out.push('\n'); count -= 1; } out.pop(); return out; } pub fn verse(num: i32) -> String { let mut out = Strin...
, 1 => { out.push_str(format!("{x} bottle of beer on the wall, {x} bottle of beer.\n", x = num).as_str()); out.push_str(format!("Take it down and pass it around, no more bottles of beer on the wall.\n").as_str()); }, 2 => { out.push_str(format!("{x} bottles of...
{ out.push_str(format!("No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n").as_str()); }
conditional_block
lib.rs
pub fn sing(start: i32, end: i32) -> String { let mut out = String::new(); let mut count = start; while count >= end { out.push_str(verse(count).as_str()); out.push('\n'); count -= 1; } out.pop(); return out; } pub fn verse(num: i32) -> String { let mut out = Strin...
2 => { out.push_str(format!("{x} bottles of beer on the wall, {x} bottles of beer.\n", x = num).as_str()); out.push_str(format!("Take one down and pass it around, {x} bottle of beer on the wall.\n", x = num - 1).as_str()); }, _ => { out.push_str(format!("{x} b...
},
random_line_split
type_filter.rs
use std::collections::HashSet; use botocore::{Service, ShapeType, Shape}; use super::mutate_type_name; pub fn filter_types(service: &Service) -> (HashSet<String>, HashSet<String>) { let mut deserialized_types: HashSet<String> = HashSet::new(); let mut serialized_types: HashSet<String> = HashSet::new(); for...
_ => {} } } // output shapes with a payload blob don't get deserialized // unless they have non-payload elements from the headers etc. fn can_skip_deserializer(service: &Service, output_shape: &Shape) -> bool { match output_shape.payload { None => false, Some(ref payload_member) => { ...
{ recurse_find_shapes(service, types, shape.member_type()); }
conditional_block
type_filter.rs
use std::collections::HashSet; use botocore::{Service, ShapeType, Shape}; use super::mutate_type_name; pub fn filter_types(service: &Service) -> (HashSet<String>, HashSet<String>) { let mut deserialized_types: HashSet<String> = HashSet::new(); let mut serialized_types: HashSet<String> = HashSet::new(); for...
member.location != Some("headers".to_owned()) && !types.contains(&member.shape) { recurse_find_shapes(service, types, &member.shape); } } } } ShapeType::Map => { recurse_find...
member.location != Some("header".to_owned()) &&
random_line_split
type_filter.rs
use std::collections::HashSet; use botocore::{Service, ShapeType, Shape}; use super::mutate_type_name; pub fn
(service: &Service) -> (HashSet<String>, HashSet<String>) { let mut deserialized_types: HashSet<String> = HashSet::new(); let mut serialized_types: HashSet<String> = HashSet::new(); for operation in service.operations.values() { if let Some(ref output) = operation.output { let output_sh...
filter_types
identifier_name
type_filter.rs
use std::collections::HashSet; use botocore::{Service, ShapeType, Shape}; use super::mutate_type_name; pub fn filter_types(service: &Service) -> (HashSet<String>, HashSet<String>) { let mut deserialized_types: HashSet<String> = HashSet::new(); let mut serialized_types: HashSet<String> = HashSet::new(); for...
ShapeType::List => { recurse_find_shapes(service, types, shape.member_type()); } _ => {} } } // output shapes with a payload blob don't get deserialized // unless they have non-payload elements from the headers etc. fn can_skip_deserializer(service: &Service, output_shape: &Sha...
{ types.insert(mutate_type_name(shape_name).to_owned()); let shape = service.shapes.get(shape_name).expect("Shape type missing from service definition"); match shape.shape_type { ShapeType::Structure => { if let Some(ref members) = shape.members { for member in members.va...
identifier_body
ixio.py
import logging import re from datetime import datetime from typing import List, Any, Dict, Union, Pattern from pastehunter.common import base62_decode, base62_encode from pastehunter.inputs.base_input import BasePasteSite logger = logging.getLogger('pastehunter') class IxDotIoSite(BasePasteSite): # Yeah, yeah, ...
# populate vars from config return site.get_recent_items(input_history)
def recent_pastes(conf, input_history): site = IxDotIoSite(conf)
random_line_split
ixio.py
import logging import re from datetime import datetime from typing import List, Any, Dict, Union, Pattern from pastehunter.common import base62_decode, base62_encode from pastehunter.inputs.base_input import BasePasteSite logger = logging.getLogger('pastehunter') class IxDotIoSite(BasePasteSite): # Yeah, yeah, ...
(self, paste_id: Any) -> str: self.make_request(self.raw_pattern.format(paste_id)) def get_paste_id(self, paste_obj: Dict[str, Any]) -> str: decoded = paste_obj.get('pasteid') return base62_encode(decoded) def get_recent_items(self, input_history: List[str]): history = [] ...
get_paste_for_id
identifier_name
ixio.py
import logging import re from datetime import datetime from typing import List, Any, Dict, Union, Pattern from pastehunter.common import base62_decode, base62_encode from pastehunter.inputs.base_input import BasePasteSite logger = logging.getLogger('pastehunter') class IxDotIoSite(BasePasteSite): # Yeah, yeah, ...
def get_data_for_page(self, page_data: str) -> List[Dict[str, Union[int, str]]]: page: List[Dict[str, Union[int, str]]] = [] last_item_id = -1 regex_matches = self._ITEM_ID_RE.findall(page_data) # We are going to reverse the order because ix pages are structured newest -> oldest, a...
history = [] paste_list = [] try: recent_page = self.make_request(self.url_recent) item_data = self.get_data_for_page(recent_page.text) for val in item_data: # Track paste ids to prevent dupes pid = val['pid'] history.a...
identifier_body
ixio.py
import logging import re from datetime import datetime from typing import List, Any, Dict, Union, Pattern from pastehunter.common import base62_decode, base62_encode from pastehunter.inputs.base_input import BasePasteSite logger = logging.getLogger('pastehunter') class IxDotIoSite(BasePasteSite): # Yeah, yeah, ...
last_item_id = item_id else: # If there's no delta, just add this nromally page.append({'pid': item_id, 'date': created_at}) last_item_id = item_id return page def recent_pastes(conf, input_history): site = IxDotIoSite(conf) ...
page.append({'pid': i, 'date': created_at})
conditional_block
Function.js
import { Function as FunctionToken, RightParenthesis } from '../../tokenizer/index.js'; export const name = 'Function'; export const walkContext = 'function'; export const structure = { name: String, children: [[]] }; // <function-token> <sequence> ) export function parse(readSequence, recognizer) { ...
export function generate(node) { this.token(FunctionToken, node.name + '('); this.children(node); this.token(RightParenthesis, ')'); }
children }; }
random_line_split
Function.js
import { Function as FunctionToken, RightParenthesis } from '../../tokenizer/index.js'; export const name = 'Function'; export const walkContext = 'function'; export const structure = { name: String, children: [[]] }; // <function-token> <sequence> ) export function parse(readSequence, recognizer) { ...
return { type: 'Function', loc: this.getLocation(start, this.tokenStart), name, children }; } export function generate(node) { this.token(FunctionToken, node.name + '('); this.children(node); this.token(RightParenthesis, ')'); }
{ this.eat(RightParenthesis); }
conditional_block
Function.js
import { Function as FunctionToken, RightParenthesis } from '../../tokenizer/index.js'; export const name = 'Function'; export const walkContext = 'function'; export const structure = { name: String, children: [[]] }; // <function-token> <sequence> ) export function parse(readSequence, recognizer) { ...
(node) { this.token(FunctionToken, node.name + '('); this.children(node); this.token(RightParenthesis, ')'); }
generate
identifier_name
Function.js
import { Function as FunctionToken, RightParenthesis } from '../../tokenizer/index.js'; export const name = 'Function'; export const walkContext = 'function'; export const structure = { name: String, children: [[]] }; // <function-token> <sequence> ) export function parse(readSequence, recognizer) { ...
{ this.token(FunctionToken, node.name + '('); this.children(node); this.token(RightParenthesis, ')'); }
identifier_body
renderTarget.js
var pex = pex || require('../../build/pex'); pex.sys.Window.create({ settings: { width: 1280, height: 720, type: '3d', vsync: true, multisample: true, fullscreen: false, center: true, canvas : pex.sys.Platform.isBrowser ? document.getElementById('canvas') : null }, init: function(...
} });
this.cubeMesh.draw(this.camera);
random_line_split
lint-unnecessary-parens.rs
// Copyright 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-MIT or ...
if (true) {} //~ ERROR unnecessary parentheses around `if` condition while (true) {} //~ ERROR unnecessary parentheses around `while` condition match (true) { //~ ERROR unnecessary parentheses around `match` head expression _ => {} } }
random_line_split
lint-unnecessary-parens.rs
// Copyright 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-MIT or ...
{ foo(); if (true) {} //~ ERROR unnecessary parentheses around `if` condition while (true) {} //~ ERROR unnecessary parentheses around `while` condition match (true) { //~ ERROR unnecessary parentheses around `match` head expression _ => {} } }
identifier_body
lint-unnecessary-parens.rs
// Copyright 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-MIT or ...
} }
{}
conditional_block
lint-unnecessary-parens.rs
// Copyright 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-MIT or ...
() { foo(); if (true) {} //~ ERROR unnecessary parentheses around `if` condition while (true) {} //~ ERROR unnecessary parentheses around `while` condition match (true) { //~ ERROR unnecessary parentheses around `match` head expression _ => {} } }
main
identifier_name
en_US.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _moment = require('moment'); var _moment2 = _interopRequireDefault(_moment); var _en_US = require('rc-pagination/lib/locale/en_US'); var _en_US2 = _interopRequireDefault(_en_US); var _en_US3 = require('../date-picker/locale/en_US...
(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _moment2['default'].locale('en'); exports['default'] = { locale: 'en', Pagination: _en_US2['default'], DatePicker: _en_US4['default'], TimePicker: _en_US6['default'], Calendar: _en_US8['default'], Table: { filterTitle: '...
_interopRequireDefault
identifier_name
en_US.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _moment = require('moment'); var _moment2 = _interopRequireDefault(_moment); var _en_US = require('rc-pagination/lib/locale/en_US'); var _en_US2 = _interopRequireDefault(_en_US); var _en_US3 = require('../date-picker/locale/en_US...
_moment2['default'].locale('en'); exports['default'] = { locale: 'en', Pagination: _en_US2['default'], DatePicker: _en_US4['default'], TimePicker: _en_US6['default'], Calendar: _en_US8['default'], Table: { filterTitle: 'Filter menu', filterConfirm: 'OK', filterReset: 'R...
{ return obj && obj.__esModule ? obj : { 'default': obj }; }
identifier_body
en_US.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _moment = require('moment'); var _moment2 = _interopRequireDefault(_moment); var _en_US = require('rc-pagination/lib/locale/en_US'); var _en_US2 = _interopRequireDefault(_en_US); var _en_US3 = require('../date-picker/locale/en_US...
_moment2['default'].locale('en'); exports['default'] = { locale: 'en', Pagination: _en_US2['default'], DatePicker: _en_US4['default'], TimePicker: _en_US6['default'], Calendar: _en_US8['default'], Table: { filterTitle: 'Filter menu', filterConfirm: 'OK', filterReset: 'Re...
var _en_US8 = _interopRequireDefault(_en_US7); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
random_line_split
stringjumble.py
""" stringjumble.py Author: Eric Credit: Me! Assignment: The purpose of this challenge is to gain proficiency with manipulating lists. Write and submit a Python program that accepts a string from the user and prints it back in three different ways: * With all letters in reverse. * With words in reverse order, but...
Please enter a string of text (the bigger the better): There are a few techniques or tricks that you may find handy You entered "There are a few techniques or tricks that you may find handy". Now jumble it: ydnah dnif yam uoy taht skcirt ro seuqinhcet wef a era erehT handy find may you that tricks or techniques few a ...
the words. Output of your program should look like this:
random_line_split
stringjumble.py
""" stringjumble.py Author: Eric Credit: Me! Assignment: The purpose of this challenge is to gain proficiency with manipulating lists. Write and submit a Python program that accepts a string from the user and prints it back in three different ways: * With all letters in reverse. * With words in reverse order, but...
print ((i[::-1]), end=" ")
conditional_block
FileSaver.js
.org/1999/xhtml", "a") , can_use_save_link = !view.externalHost && "download" in save_link , click = function (node) { var event = doc.createEvent("MouseEvents"); event.initMouseEvent( "click", true, false, view, 0, 0, 0, 0, 0 , false, ...
if (!fileName.endsWithAny('.txt')) fileName += '.txt'; doc.write(textContent); doc.close(); }
conditional_block
FileSaver.js
laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */ /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ var saveAs = saveAs // IE 10+ (native saveAs) || (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigato...
} catch (ex) { throw_outside(ex); } } } } , FileSaver = function (blob, name) { // First try a.download, then web filesystem, then object URLs var fil...
listener.call(filesaver, event || filesaver);
random_line_split
common.py
# -*- mode: python; coding: utf-8; -*- import os APP_NAME = "SLog" VERSION = "0.9.4" WEBSITE = "http://vialinx.org" LICENSE = """ SLog is a PyGTK-based GUI for the LightLang SL dictionary. Copyright 2007 Nasyrov Renat <renatn@gmail.com> This file is part of SLog. SLog is free software; you can redistribute it and/...
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. along with SLog; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ INSTALL_PREFIX = "@prefix@" PIXMAP_DIR = os.path.join(INSTALL_PREFIX, "share", ...
SLog is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
random_line_split
common.py
# -*- mode: python; coding: utf-8; -*- import os APP_NAME = "SLog" VERSION = "0.9.4" WEBSITE = "http://vialinx.org" LICENSE = """ SLog is a PyGTK-based GUI for the LightLang SL dictionary. Copyright 2007 Nasyrov Renat <renatn@gmail.com> This file is part of SLog. SLog is free software; you can redistribute it and/...
(filename): return os.path.join(PIXMAP_DIR, filename)
get_icon
identifier_name
common.py
# -*- mode: python; coding: utf-8; -*- import os APP_NAME = "SLog" VERSION = "0.9.4" WEBSITE = "http://vialinx.org" LICENSE = """ SLog is a PyGTK-based GUI for the LightLang SL dictionary. Copyright 2007 Nasyrov Renat <renatn@gmail.com> This file is part of SLog. SLog is free software; you can redistribute it and/...
return os.path.join(PIXMAP_DIR, filename)
identifier_body
prepaid-card-pattern-serializer.ts
import { inject } from '@cardstack/di'; import DatabaseManager from '@cardstack/db'; import { JSONAPIDocument } from '../../utils/jsonapi-document'; interface PrepaidCardPattern { id: string; patternUrl?: string; description: string; } export default class PrepaidCardPatternSerializer { databaseManager: Databa...
(content: string | PrepaidCardPattern): Promise<JSONAPIDocument> { if (typeof content === 'string') { content = await this.loadPrepaidCardPattern(content); } let data = { id: content.id, type: 'prepaid-card-patterns', attributes: { 'pattern-url': content.patternUrl, d...
serialize
identifier_name
prepaid-card-pattern-serializer.ts
import { inject } from '@cardstack/di'; import DatabaseManager from '@cardstack/db'; import { JSONAPIDocument } from '../../utils/jsonapi-document'; interface PrepaidCardPattern { id: string; patternUrl?: string; description: string; } export default class PrepaidCardPatternSerializer { databaseManager: Databa...
} declare module '@cardstack/di' { interface KnownServices { 'prepaid-card-pattern-serializer': PrepaidCardPatternSerializer; } }
{ let db = await this.databaseManager.getClient(); let queryResult = await db.query('SELECT id, pattern_url, description FROM prepaid_card_patterns WHERE id = $1', [ id, ]); if (queryResult.rowCount === 0) { return Promise.reject(new Error(`No prepaid_card_pattern record found with id ${id}`...
identifier_body
prepaid-card-pattern-serializer.ts
import { inject } from '@cardstack/di'; import DatabaseManager from '@cardstack/db'; import { JSONAPIDocument } from '../../utils/jsonapi-document'; interface PrepaidCardPattern { id: string; patternUrl?: string; description: string; } export default class PrepaidCardPatternSerializer { databaseManager: Databa...
'prepaid-card-pattern-serializer': PrepaidCardPatternSerializer; } }
declare module '@cardstack/di' { interface KnownServices {
random_line_split
prepaid-card-pattern-serializer.ts
import { inject } from '@cardstack/di'; import DatabaseManager from '@cardstack/db'; import { JSONAPIDocument } from '../../utils/jsonapi-document'; interface PrepaidCardPattern { id: string; patternUrl?: string; description: string; } export default class PrepaidCardPatternSerializer { databaseManager: Databa...
let data = { id: content.id, type: 'prepaid-card-patterns', attributes: { 'pattern-url': content.patternUrl, description: content.description, }, }; let result = { data, } as JSONAPIDocument; return result; } async loadPrepaidCardPattern(id: string...
{ content = await this.loadPrepaidCardPattern(content); }
conditional_block
system-panel.js
import { ipcRenderer } from 'electron'; import React from 'react'; import PropTypes from 'prop-types'; import { Checkbox } from '@blueprintjs/core'; import { isWindows } from 'utils/platform.util'; import { ElectronSettingsPaths } from 'enums'; import { DESTROY_TRAY_ICON } from 'channels';
openGeneralAlert, showTimerByTray, showTrayIcon, toggleMinimizeToTray, toggleShowTimerByTray, toggleShowTrayIcon, }) => ( <div className="mt-1"> <Checkbox label="Show tray icon" checked={showTrayIcon} onChange={e => { const checked = e.target.checked; o...
const SystemPanel = ({ minimizeToTray, onSettingsChange,
random_line_split
system-panel.js
import { ipcRenderer } from 'electron'; import React from 'react'; import PropTypes from 'prop-types'; import { Checkbox } from '@blueprintjs/core'; import { isWindows } from 'utils/platform.util'; import { ElectronSettingsPaths } from 'enums'; import { DESTROY_TRAY_ICON } from 'channels'; const SystemPanel = ({ min...
if (!checked) { ipcRenderer.send(DESTROY_TRAY_ICON); } }} /> <Checkbox label="Show timer by tray icon" checked={showTimerByTray} onChange={e => { onSettingsChange( ElectronSettingsPaths.SHOW_TIMER_BY_TRAY, e....
{ openGeneralAlert('Tray icon will appear after restart'); }
conditional_block
hiphopabotamus.rs
regex::Regex; use rand::{thread_rng, Rng}; use std::ascii::AsciiExt; use std::env; use std::str::FromStr; use std::sync::{Arc, Mutex}; extern crate env_logger; extern crate getopts; extern crate irc; extern crate postgres; extern crate rand; extern crate regex; #[macro_use] extern crate log; fn init_pg_tables() -> ...
fn main() { env_logger::init().unwrap(); let mut opts = getopts::Options::new(); opts.reqopt("", "host", "irc server hostname", "HOSTNAME"); opts.optopt("", "port", "irc server port", "PORT"); opts.reqopt("n", "nick", "nickname", "NICK"); opts.optmulti("c", "chan", "channels to join", "CHAN")...
{ let pg = Connection::connect("postgres://leif@localhost", &SslMode::None).unwrap(); pg.execute("CREATE TABLE IF NOT EXISTS knowledge ( key VARCHAR, val VARCHAR, PRIMARY KEY(key, val) )", &[]).unwrap(); pg.execute("CREATE TABLE IF NOT EX...
identifier_body
hiphopabotamus.rs
regex::Regex; use rand::{thread_rng, Rng}; use std::ascii::AsciiExt; use std::env; use std::str::FromStr; use std::sync::{Arc, Mutex}; extern crate env_logger; extern crate getopts; extern crate irc; extern crate postgres; extern crate rand; extern crate regex; #[macro_use] extern crate log; fn init_pg_tables() -> ...
() { env_logger::init().unwrap(); let mut opts = getopts::Options::new(); opts.reqopt("", "host", "irc server hostname", "HOSTNAME"); opts.optopt("", "port", "irc server port", "PORT"); opts.reqopt("n", "nick", "nickname", "NICK"); opts.optmulti("c", "chan", "channels to join", "CHAN"); le...
main
identifier_name
hiphopabotamus.rs
regex::Regex; use rand::{thread_rng, Rng}; use std::ascii::AsciiExt; use std::env; use std::str::FromStr; use std::sync::{Arc, Mutex}; extern crate env_logger; extern crate getopts; extern crate irc; extern crate postgres; extern crate rand; extern crate regex; #[macro_use] extern crate log; fn init_pg_tables() -> ...
; if count == 0 { conn.execute(sql!("INSERT INTO karma (nick, karma) VALUES ($1, $2)"), &[&n, &change]).unwrap(); } else { conn.execute(sql!("UPDATE karma SET karma = karma + $2 WHERE nick = $1"), &[&n, &change]).unwrap(); } ...
{ -1 }
conditional_block
hiphopabotamus.rs
use regex::Regex; use rand::{thread_rng, Rng}; use std::ascii::AsciiExt; use std::env; use std::str::FromStr; use std::sync::{Arc, Mutex}; extern crate env_logger; extern crate getopts; extern crate irc; extern crate postgres; extern crate rand; extern crate regex; #[macro_use] extern crate log; fn init_pg_tables() ...
} } Response::nothing() }; let join_nick = nick.clone(); let join_handler = box move |line: &str| { if let Some(pm) = protocol::Privmsg::parse(line).and_then(|pm| pm.targeted_msg(&join_nick)) { if let Some(c) = regex!(r"^(join|part) (#[^\s]+)").captures(pm.ms...
.into_iter().next().and_then(|r| r.get(0)).or(Some(0)).unwrap(); return Response::respond(protocol::Privmsg::new(reply_to, &format!("{}: {}", n, k)).format()) }
random_line_split
test_press_dups.py
# coding=utf-8 """ Tests for wham_rad. """ import unittest import os from md_utils.md_common import silent_remove, diff_lines from md_utils.press_dups import avg_rows, compress_dups, main __author__ = 'mayes' DATA_DIR = os.path.join(os.path.dirname(__file__), 'test_data') DUPS_DIR = os.path.join(DATA_DIR, 'press_du...
class TestPressDups(unittest.TestCase): def testThree(self): data = [{"a": 1.3, "b": 3.0, "c": 8.5}, {"a": 1.3, "b": 1.0, "c": -4.2}, {"a": 1.3, "b": 2.2, "c": 19.0}, {"a": 99, "b": 1.0, "c": -4.2}, {"a": -22, "b": 1.0, "c": -4.2}] avg = compress_dups(data, "a") ...
data = [{"a": 1.3, "b": 3.0, "c": 8.5}, {"a": 1.3, "b": 1.0, "c": -4.2}, {"a": 1.3, "b": 2.2, "c": 19.0}] avg = avg_rows(data) self.assertAlmostEqual(avg['a'], 1.3) self.assertAlmostEqual(avg['b'], 2.066666666666) self.assertAlmostEqual(avg['c'], 7.766666666666)
identifier_body
test_press_dups.py
# coding=utf-8 """ Tests for wham_rad. """ import unittest import os from md_utils.md_common import silent_remove, diff_lines from md_utils.press_dups import avg_rows, compress_dups, main __author__ = 'mayes' DATA_DIR = os.path.join(os.path.dirname(__file__), 'test_data') DUPS_DIR = os.path.join(DATA_DIR, 'press_du...
(self): data = [{"a": 1.3, "b": 3.0, "c": 8.5}, {"a": 1.3, "b": 1.0, "c": -4.2}, {"a": 1.3, "b": 2.2, "c": 19.0}] avg = avg_rows(data) self.assertAlmostEqual(avg['a'], 1.3) self.assertAlmostEqual(avg['b'], 2.066666666666) self.assertAlmostEqual(avg['c'], 7.7666666...
testThree
identifier_name
test_press_dups.py
# coding=utf-8 """ Tests for wham_rad. """ import unittest import os from md_utils.md_common import silent_remove, diff_lines from md_utils.press_dups import avg_rows, compress_dups, main __author__ = 'mayes' DATA_DIR = os.path.join(os.path.dirname(__file__), 'test_data') DUPS_DIR = os.path.join(DATA_DIR, 'press_du...
finally: silent_remove(HEAD_PRESS) # pass
random_line_split
trainer_test.py
# Copyright 2017 The TensorFlow Authors. 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 required by applica...
(self, inputs): """Input preprocessing, resizes images to 28x28. Args: inputs: a [batch, height_in, width_in, channels] float32 tensor representing a batch of images with values between 0 and 255.0. Returns: preprocessed_inputs: a [batch, 28, 28, channels] float32 tensor. """ r...
preprocess
identifier_name
trainer_test.py
# Copyright 2017 The TensorFlow Authors. 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 required by applica...
def predict(self, preprocessed_inputs): """Prediction tensors from inputs tensor. Args: preprocessed_inputs: a [batch, 28, 28, channels] float32 tensor. Returns: prediction_dict: a dictionary holding prediction tensors to be passed to the Loss or Postprocess functions. """ ...
"""Input preprocessing, resizes images to 28x28. Args: inputs: a [batch, height_in, width_in, channels] float32 tensor representing a batch of images with values between 0 and 255.0. Returns: preprocessed_inputs: a [batch, 28, 28, channels] float32 tensor. """ return tf.image.resiz...
identifier_body
trainer_test.py
# Copyright 2017 The TensorFlow Authors. 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 required by applica...
"""A function to get test inputs. Returns an image with one box.""" image = tf.random_uniform([32, 32, 3], dtype=tf.float32) class_label = tf.random_uniform( [1], minval=0, maxval=NUMBER_OF_CLASSES, dtype=tf.int32) box_label = tf.random_uniform( [1, 4], minval=0.4, maxval=0.6, dtype=tf.float32) r...
def get_input_function():
random_line_split
trainer_test.py
# Copyright 2017 The TensorFlow Authors. 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 required by applica...
tf.test.main()
conditional_block
default.py
''' Copyright 2011 Mikel Azkolain This file is part of Spotimc. Spotimc 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 3 of the License, or (at your option) any later version. Spotimc ...
#print "tracked modules after: %d" % len(_tracked_modules) #import objgraph #objgraph.show_backrefs(_tracked_modules, max_depth=5) except (SystemExit, Exception) as ex: if str(ex) != '': dlg = xbmcgui.Dialog() dlg.ok(ex.__class__.__name__, str(ex)) traceback.print_...
random_line_split
default.py
''' Copyright 2011 Mikel Azkolain This file is part of Spotimc. Spotimc 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 3 of the License, or (at your option) any later version. Spotimc ...
if fm is not None: del fm #Close the background loading window loadingwin.close()
del im
conditional_block
list-stack.po.js
/* * Copyright (c) 2015-2018 Red Hat, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red H...
this.getListItemElementByName = (name) => { return this.listItemElements.filter((elem, index) => { return elem.element(by.cssContainingText('.stack-item-name', name)).isPresent().then(isPresent => isPresent); }).first(); }; }; module.exports = new ListStacks();
description: elem.$('.stack-item-description'), components: elem.$('.stack-item-description'), actions: elem.$('.stack-item-actions') }; };
random_line_split
controller.settingctrl.js
angular.module('controller.settingctrl', []) .controller('SettingCtrl', function($scope, $rootScope, Util, Purchase, $ionicHistory, $translate, $ionicSideMenuDelegate, $ionicPopup, $location) { var menuContent = null; var strOkay = "OK"; var strCancel...
pe.clickMenu = function (menu) { if (ionic.Platform.isIOS()) { if (menuContent !== null && menuContent.hasClass('keyboard-up')) { return; } } if (menu === 'sendMail') { $ionicSideMenuDelegate.toggleLeft(); ...
{ if (ionic.Platform.isIOS()) { menuContent = angular.element(document.getElementsByClassName('menu-content')[0]); } $scope.startupPage = localStorage.getItem("startupPage"); if ($scope.startupPage === null) { $scope.startupPage = "0"; //시...
identifier_body
controller.settingctrl.js
angular.module('controller.settingctrl', []) .controller('SettingCtrl', function($scope, $rootScope, Util, Purchase, $ionicHistory, $translate, $ionicSideMenuDelegate, $ionicPopup, $location) { var menuContent = null; var strOkay = "OK"; var strCancel...
() { if (ionic.Platform.isIOS()) { menuContent = angular.element(document.getElementsByClassName('menu-content')[0]); } $scope.startupPage = localStorage.getItem("startupPage"); if ($scope.startupPage === null) { $scope.startupPage = "0"; ...
init
identifier_name
controller.settingctrl.js
angular.module('controller.settingctrl', []) .controller('SettingCtrl', function($scope, $rootScope, Util, Purchase, $ionicHistory, $translate, $ionicSideMenuDelegate, $ionicPopup, $location) { var menuContent = null; var strOkay = "OK"; var strCancel...
callback(res); }); }; init(); });
console.log("You are not sure"); }
conditional_block
controller.settingctrl.js
angular.module('controller.settingctrl', []) .controller('SettingCtrl', function($scope, $rootScope, Util, Purchase, $ionicHistory, $translate, $ionicSideMenuDelegate, $ionicPopup, $location) { var menuContent = null; var strOkay = "OK"; var strCancel...
openInfo(); } else { $ionicSideMenuDelegate.toggleLeft(); $location.path('/' + menu); } }; $scope.setStartupPage = function(startupPage) { localStorage.setItem("startupPage", startupPage); }; $scope.set...
random_line_split