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
tx_processor.rs
// Copyright 2018 Mozilla // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software...
/// Implementors must specify type of the "receiver report" which /// they will produce once processor is finished. pub trait TxReceiver<RR> { /// Called for each transaction, with an iterator over its datoms. fn tx<T: Iterator<Item=TxPart>>(&mut self, tx_id: Entid, d: &mut T) -> Result<()>; /// Called once...
TxPart, };
random_line_split
tx_processor.rs
// Copyright 2018 Mozilla // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software...
} impl<'dbtx, 't, T> Iterator for DatomsIterator<'dbtx, 't, T> where T: Sized + Iterator<Item=Result<TxPart>> + 't { type Item = TxPart; fn next(&mut self) -> Option<Self::Item> { if self.at_last { return None; } if self.at_first { self.at_first = false; ...
{ DatomsIterator { at_first: true, at_last: false, first: first, rows: rows, } }
identifier_body
init-aws.js
const AWS = require('aws-sdk') const initAws = (options) => { AWS.config.update({ accessKeyId: options.s3AccessKeyId, secretAccessKey: options.s3SecretAccessKey, sslEnabled: options.s3SSLEnabled, s3ForcePathStyle: options.s3ForcePathStyle }) if (options.s3Endpoint != null) { AWS.config.update(...
} }) } if (options.s3Configs) { AWS.config.update(options.s3Configs) } } module.exports = initAws
if (options.customBackoff) { AWS.config.update({ retryDelayOptions: { customBackoff: retryCount => Math.max(retryCount * 100, 3000)
random_line_split
init-aws.js
const AWS = require('aws-sdk') const initAws = (options) => { AWS.config.update({ accessKeyId: options.s3AccessKeyId, secretAccessKey: options.s3SecretAccessKey, sslEnabled: options.s3SSLEnabled, s3ForcePathStyle: options.s3ForcePathStyle }) if (options.s3Endpoint != null) { AWS.config.update(...
} module.exports = initAws
{ AWS.config.update(options.s3Configs) }
conditional_block
home-actions.js
import { SWITCH_SECTION, TOGGLE_NAV, SET_ACTIVE_SECTION, EXTEND_PORTFOLIO_SECTION, TOGGLE_SKILLS_ROW, LOAD_PORTOFOLIO_IMAGES, UNSET_SCROLL_TRIGGERED } from './types'; export function switchSectionTo(newSection) { return { type: SWITCH_SECTION, payload: newSection } } export function
(newSection) { return { type: SET_ACTIVE_SECTION, payload: newSection } } export function toggleNav(setAsOpen) { return { type: TOGGLE_NAV, payload: setAsOpen } } export function extendPortfolio() { return { type: EXTEND_PORTFOLIO_SECTION } } export function toggleSkillsRow(rowName) { return { typ...
setActiveSection
identifier_name
home-actions.js
import { SWITCH_SECTION, TOGGLE_NAV, SET_ACTIVE_SECTION, EXTEND_PORTFOLIO_SECTION, TOGGLE_SKILLS_ROW, LOAD_PORTOFOLIO_IMAGES, UNSET_SCROLL_TRIGGERED } from './types'; export function switchSectionTo(newSection) { return { type: SWITCH_SECTION, payload: newSection } } export function setActiveSection(newS...
export function unsetScrollTriggered() { return { type: UNSET_SCROLL_TRIGGERED, payload: false } }
type: LOAD_PORTOFOLIO_IMAGES, } }
random_line_split
home-actions.js
import { SWITCH_SECTION, TOGGLE_NAV, SET_ACTIVE_SECTION, EXTEND_PORTFOLIO_SECTION, TOGGLE_SKILLS_ROW, LOAD_PORTOFOLIO_IMAGES, UNSET_SCROLL_TRIGGERED } from './types'; export function switchSectionTo(newSection) { return { type: SWITCH_SECTION, payload: newSection } } export function setActiveSection(newS...
export function extendPortfolio() { return { type: EXTEND_PORTFOLIO_SECTION } } export function toggleSkillsRow(rowName) { return { type: TOGGLE_SKILLS_ROW, payload: rowName } } export function loadPortfolioImages() { return { type: LOAD_PORTOFOLIO_IMAGES, } } export function unsetScrollTriggered() {...
{ return { type: TOGGLE_NAV, payload: setAsOpen } }
identifier_body
adminsite.py
# Copyright 2015 Rémy Lapeyrade <remy at lapeyrade dot net> # Copyright 2015 LAAS-CNRS # # # This file is part of TouSIX-Manager. # # TouSIX-Manager 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 Founda...
AdminSite): """ Special admin site, created for display widgets in the main panel. """ site_header = "TouIX - Administration de TouSIX" site_title = "TouIX" index_template = "index_touSIX.html" admin_tousix = TouSIXAdmin(name='Administration')
ouSIXAdmin(
identifier_name
adminsite.py
# Copyright 2015 Rémy Lapeyrade <remy at lapeyrade dot net> # Copyright 2015 LAAS-CNRS # # # This file is part of TouSIX-Manager. # # TouSIX-Manager 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 Founda...
admin_tousix = TouSIXAdmin(name='Administration')
"" Special admin site, created for display widgets in the main panel. """ site_header = "TouIX - Administration de TouSIX" site_title = "TouIX" index_template = "index_touSIX.html"
identifier_body
adminsite.py
# Copyright 2015 Rémy Lapeyrade <remy at lapeyrade dot net> # Copyright 2015 LAAS-CNRS # # # This file is part of TouSIX-Manager. # # TouSIX-Manager 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 Founda...
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with TouSIX-Manager. If not, see <http://www.gnu.org/licenses/>. from django.contrib.admin import AdminSite class TouSIXAdmin(AdminSite): """ Special admin site, created for d...
# (at your option) any later version. # # TouSIX-Manager 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
random_line_split
extern-crate-referenced-by-self-path.rs
// Copyright 2018 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(); }
main
identifier_name
extern-crate-referenced-by-self-path.rs
// Copyright 2018 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(); }
identifier_body
extern-crate-referenced-by-self-path.rs
// Copyright 2018 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(); }
random_line_split
export.py
from pykintone.base_api import BaseAPI import pykintone.user_api.user_api_result as ur class Export(BaseAPI): def __init__(self, account, requests_options=()): super(Export, self).__init__(account=account, requests_options=requests_options) def get_users(self, ids=(), codes=(), offset=-1, size=0): ...
(self, code): url = "https://{0}.cybozu.com/v1/user/organizations.json".format(self.account.domain) params = { "code": code } resp = self._request("GET", url, params_or_data=params) r = ur.UserOrganizationTitlesResult(resp) return r def get_user_groups(...
get_user_organization_titles
identifier_name
export.py
from pykintone.base_api import BaseAPI import pykintone.user_api.user_api_result as ur class Export(BaseAPI): def __init__(self, account, requests_options=()): super(Export, self).__init__(account=account, requests_options=requests_options) def get_users(self, ids=(), codes=(), offset=-1, size=0): ...
return r def get_user_organization_titles(self, code): url = "https://{0}.cybozu.com/v1/user/organizations.json".format(self.account.domain) params = { "code": code } resp = self._request("GET", url, params_or_data=params) r = ur.UserOrganizationTitlesR...
if size > 0: params["size"] = size resp = self._request("GET", url, params_or_data=params) r = ur.GetUsersResult(resp)
random_line_split
export.py
from pykintone.base_api import BaseAPI import pykintone.user_api.user_api_result as ur class Export(BaseAPI):
def get_user_organization_titles(self, code): url = "https://{0}.cybozu.com/v1/user/organizations.json".format(self.account.domain) params = { "code": code } resp = self._request("GET", url, params_or_data=params) r = ur.UserOrganizationTitlesResult(resp) ...
def __init__(self, account, requests_options=()): super(Export, self).__init__(account=account, requests_options=requests_options) def get_users(self, ids=(), codes=(), offset=-1, size=0): url = "https://{0}.cybozu.com/v1/users.json".format(self.account.domain) params = {} if len(i...
identifier_body
export.py
from pykintone.base_api import BaseAPI import pykintone.user_api.user_api_result as ur class Export(BaseAPI): def __init__(self, account, requests_options=()): super(Export, self).__init__(account=account, requests_options=requests_options) def get_users(self, ids=(), codes=(), offset=-1, size=0): ...
if offset > -1: params["offset"] = offset if size > 0: params["size"] = size resp = self._request("GET", url, params_or_data=params) r = ur.GetUsersResult(resp) return r def get_user_organization_titles(self, code): url = "https://{0}.cybozu...
params["codes"] = codes
conditional_block
breweriesController.js
Hilary.scope('node-example').register({ name: 'breweriesController', dependencies: ['newGidgetModule', 'GidgetRoute', 'viewEngine'], factory: function (self, GidgetRoute, viewEngine) { 'use strict'; self.get['/breweries/:brewery'] = new GidgetRoute({ routeHandler: function (err,...
next(err, req); }, before: function (err, req, next) { console.log('before breweries route', req); next(err, req); }, after: function (err, req, next) { console.log('after breweries route', req); ...
} });
random_line_split
C.js
/** * +--------------------------------------------------------------------+ * | This HTML_CodeSniffer file is Copyright (c) | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | * +--------------------------------------------------------------------+ * | IMPORTANT: Your...
* @param {DOMNode} element The element registered. * @param {DOMNode} top The top element of the tested code. */ process: function(element, top) { HTMLCS.addMessage(HTMLCS.NOTICE, top, '色が情報を伝える、あるいは視覚的な要素を判別するための唯一の視覚的手段になっていないことを確認してください。 Ensure that any information conveyed using c...
* Process the registered element. *
random_line_split
barelog__device__mem__manager_8h.js
var barelog__device__mem__manager_8h = [ [ "barelog_device_mem_manager_t", "structbarelog__device__mem__manager__t.html", "structbarelog__device__mem__manager__t" ], [ "BARELOG_DEBUG", "barelog__device__mem__manager_8h.html#af7df0739b5e31f131926969c00d0ed27", null ], [ "barelog_debug_log", "barelog__device_...
[ "device_mem_manager_init", "barelog__device__mem__manager_8h.html#a83f4e8c498c12b53d513f31d04629050", null ], [ "device_mem_manager_is_buffer_full", "barelog__device__mem__manager_8h.html#a59cc512d952adbc5d520c3681d7ca33a", null ], [ "device_mem_manager_write_buffer", "barelog__device__mem__manager_8h.htm...
[ "device_mem_manager_clean_buffer", "barelog__device__mem__manager_8h.html#aa8aaa019e14ff7168ef1583f2cefbace", null ], [ "device_mem_manager_clean_memory", "barelog__device__mem__manager_8h.html#a0fa6e5c257acb2c1f33bb0dd40acc64f", null ], [ "device_mem_manager_flush", "barelog__device__mem__manager_8h.html...
random_line_split
select.js
'use strict' var Atomic = require('./component') var sender = require('../bridge/sender') // attrs: // - options: the options to be listed, as a array of strings. // - selectedIndex: the selected options' index number. // - disabled function Select (data)
Select.prototype = Object.create(Atomic.prototype) Select.prototype.create = function () { var node = document.createElement('select') var uuid = Math.floor(10000000000000 * Math.random()) + Date.now() this.className = 'weex-slct-' + uuid this.styleId = 'weex-style-' + uuid node.classList.add(this.classNam...
{ var attrs = data.attr || {} this.options = [] this.selectedIndex = 0 Atomic.call(this, data) }
identifier_body
select.js
'use strict' var Atomic = require('./component') var sender = require('../bridge/sender') // attrs: // - options: the options to be listed, as a array of strings. // - selectedIndex: the selected options' index number. // - disabled function
(data) { var attrs = data.attr || {} this.options = [] this.selectedIndex = 0 Atomic.call(this, data) } Select.prototype = Object.create(Atomic.prototype) Select.prototype.create = function () { var node = document.createElement('select') var uuid = Math.floor(10000000000000 * Math.random()) + Date.now()...
Select
identifier_name
select.js
'use strict' var Atomic = require('./component') var sender = require('../bridge/sender') // attrs: // - options: the options to be listed, as a array of strings. // - selectedIndex: the selected options' index number. // - disabled function Select (data) { var attrs = data.attr || {} this.options = [] th...
this.node.appendChild(optDoc) } module.exports = Select
{ opt = document.createElement('option') opt.appendChild(document.createTextNode(opts[i])) optDoc.appendChild(opt) }
conditional_block
select.js
'use strict' var Atomic = require('./component') var sender = require('../bridge/sender') // attrs: // - options: the options to be listed, as a array of strings. // - selectedIndex: the selected options' index number. // - disabled function Select (data) { var attrs = data.attr || {} this.options = [] th...
}.bind(this)) } } Select.prototype.createOptions = function (opts) { var optDoc = document.createDocumentFragment() var opt for (var i = 0, l = opts.length; i < l; i++) { opt = document.createElement('option') opt.appendChild(document.createTextNode(opts[i])) optDoc.appendChild(opt) } this....
sender.fireEvent(this.data.ref, 'change', e)
random_line_split
instanceApiTokens.js
/** * The MIT License (MIT) * * Copyright (c) 2022 Losant IoT, Inc. * * 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...
if ('undefined' !== typeof params._embedded) { req.params._embedded = params._embedded; } req.url = tpl.expand(pathParams); return client.request(req, opts, cb); }; /** * Create a new API token for an instance * * Authentication: * The client must be configured with a valid api * access ...
if ('undefined' !== typeof params.filterField) { req.params.filterField = params.filterField; } if ('undefined' !== typeof params.filter) { req.params.filter = params.filter; } if ('undefined' !== typeof params.losantdomain) { req.headers.losantdomain = params.losantdomain; } if ('undefined' !== typeof ...
random_line_split
instanceApiTokens.js
/** * The MIT License (MIT) * * Copyright (c) 2022 Losant IoT, Inc. * * 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...
if ('undefined' !== typeof params.losantdomain) { req.headers.losantdomain = params.losantdomain; } if ('undefined' !== typeof params._actions) { req.params._actions = params._actions; } if ('undefined' !== typeof params._links) { req.params._links = params._links; } if ('undefined' !== typeof params._...
{ req.params.filter = params.filter; }
conditional_block
Gruntfile.js
/*global module:false*/ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ // Metadata. pkg: grunt.file.readJSON('package.json'), banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + '<%= pkg.homep...
//grunt.loadNpmTasks('grunt-contrib-qunit'); //grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-sass'); // Default task. //grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']); };
// These plugins provide necessary tasks. //grunt.loadNpmTasks('grunt-contrib-concat'); //grunt.loadNpmTasks('grunt-contrib-uglify');
random_line_split
confirm-abort-dialog.tsx
interface IConfirmAbortDialogProps { /** * This is expected to be capitalized for correct output on windows and macOs. * * Examples: * - Rebase * - Cherry-pick * - Squash */ readonly operation: string readonly onReturnToConflicts: () => void readonly onConfirmAbort: () => Promise<void> }...
import * as React from 'react' import { Dialog, DialogContent, DialogFooter } from '../../dialog' import { OkCancelButtonGroup } from '../../dialog/ok-cancel-button-group'
random_line_split
confirm-abort-dialog.tsx
import * as React from 'react' import { Dialog, DialogContent, DialogFooter } from '../../dialog' import { OkCancelButtonGroup } from '../../dialog/ok-cancel-button-group' interface IConfirmAbortDialogProps { /** * This is expected to be capitalized for correct output on windows and macOs. * * Examples: ...
() { const { operation } = this.props return ( <Dialog id="abort-warning" title={ __DARWIN__ ? `Confirm Abort ${operation}` : `Confirm abort ${operation.toLowerCase()}` } onDismissed={this.onCancel} onSubmit={this.onSubmit} ...
render
identifier_name
defines_15.js
var searchData= [ ['undefined_5fband',['UNDEFINED_BAND',['../a01181.html#a9efc501b4bfd07c8e00e55bbb5f28690',1,'blkocc.h']]],
['uni_5fmax_5flegal_5futf32',['UNI_MAX_LEGAL_UTF32',['../a00614.html#a98a2f50a1ca513613316ffd384dd1bfb',1,'unichar.cpp']]], ['unichar_5flen',['UNICHAR_LEN',['../a00617.html#a902bc40c9d89802bc063afe30ce9e708',1,'unichar.h']]], ['unlikely_5fnum_5ffeat',['UNLIKELY_NUM_FEAT',['../a00659.html#a17b4f36c5132ab55beb280e0...
random_line_split
run.ts
import { Client } from 'elasticsearch' import { YcbDownloader } from "./index" import * as path from "path" import * as fs from "fs" main(); function main() { let folder; buildOutputFolder() .then(outputFolder => folder = outputFolder) .then(executeDownload) .catch(downloadFailure) ...
function writeFileError(err) { console.log("Could not write file"); console.error(err); process.exit(2); } function writeDataToFile({programs, programMappings, queries, queryMappings, screener, screenerMappings}, folder: string) { const programPath = path.resolve(folder, 'programs.json'); const ...
{ console.log("Could not download"); console.error(err); process.exit(1); }
identifier_body
run.ts
import { Client } from 'elasticsearch' import { YcbDownloader } from "./index" import * as path from "path" import * as fs from "fs" main(); function main() { let folder; buildOutputFolder() .then(outputFolder => folder = outputFolder) .then(executeDownload) .catch(downloadFailure) ...
(err) { console.log("Could not download"); console.error(err); process.exit(1); } function writeFileError(err) { console.log("Could not write file"); console.error(err); process.exit(2); } function writeDataToFile({programs, programMappings, queries, queryMappings, screener, screenerMappings}...
downloadFailure
identifier_name
run.ts
import { Client } from 'elasticsearch' import { YcbDownloader } from "./index" import * as path from "path" import * as fs from "fs" main(); function main() { let folder; buildOutputFolder() .then(outputFolder => folder = outputFolder) .then(executeDownload) .catch(downloadFailure) ...
const folder = args[0] ? path.resolve( __dirname, '..', args[0]) : path.resolve(__dirname, 'data'); if (!fs.existsSync(folder)) { fs.mkdirSync(folder) } return Promise.resolve(folder) } function writeToFilePromise(path, data): Promise<boolean> { return new Promise((resolve, reject) => { ...
random_line_split
14.codec.js
#!/usr/bin/env mocha -R spec var assert = require("assert"); var msgpackJS = "../index"; var isBrowser = ("undefined" !== typeof window); var msgpack = isBrowser && window.msgpack || require(msgpackJS); var TITLE = __filename.replace(/^.*\//, ""); var HAS_UINT8ARRAY = ("undefined" !== typeof Uint8Array); describe(TI...
function myClassPacker(obj) { return new Buffer([obj.value]); } function myClassUnpacker(buffer) { return new MyClass(buffer[0]); } function toArray(array) { if (HAS_UINT8ARRAY && array instanceof ArrayBuffer) array = new Uint8Array(array); return Array.prototype.slice.call(array); }
{ this.value = value & 0xFF; }
identifier_body
14.codec.js
#!/usr/bin/env mocha -R spec var assert = require("assert"); var msgpackJS = "../index"; var isBrowser = ("undefined" !== typeof window); var msgpack = isBrowser && window.msgpack || require(msgpackJS); var TITLE = __filename.replace(/^.*\//, ""); var HAS_UINT8ARRAY = ("undefined" !== typeof Uint8Array); describe(TI...
assert.equal(decoded.type, 0x0D); }); }); function MyClass(value) { this.value = value & 0xFF; } function myClassPacker(obj) { return new Buffer([obj.value]); } function myClassUnpacker(buffer) { return new MyClass(buffer[0]); } function toArray(array) { if (HAS_UINT8ARRAY && array instanceof ArrayBuf...
decoded = msgpack.decode(encoded, options2); assert.ok(!(decoded instanceof Date));
random_line_split
14.codec.js
#!/usr/bin/env mocha -R spec var assert = require("assert"); var msgpackJS = "../index"; var isBrowser = ("undefined" !== typeof window); var msgpack = isBrowser && window.msgpack || require(msgpackJS); var TITLE = __filename.replace(/^.*\//, ""); var HAS_UINT8ARRAY = ("undefined" !== typeof Uint8Array); describe(TI...
(type) { // fixext 1 -- 0xd4 var source = new Buffer([0xd4, type, type]); var decoded = msgpack.decode(source, options); assert.equal(decoded.type, type); assert.equal(decoded.buffer.length, 1); var encoded = msgpack.encode(decoded, options); assert.deepEqual(toArray(encoded), ...
test
identifier_name
14.codec.js
#!/usr/bin/env mocha -R spec var assert = require("assert"); var msgpackJS = "../index"; var isBrowser = ("undefined" !== typeof window); var msgpack = isBrowser && window.msgpack || require(msgpackJS); var TITLE = __filename.replace(/^.*\//, ""); var HAS_UINT8ARRAY = ("undefined" !== typeof Uint8Array); describe(TI...
function test(type) { // fixext 1 -- 0xd4 var source = new Buffer([0xd4, type, type]); var decoded = msgpack.decode(source, options); assert.equal(decoded.type, type); assert.equal(decoded.buffer.length, 1); var encoded = msgpack.encode(decoded, options); assert.deepEqual...
{ test(i); }
conditional_block
lib.rs
extern crate num; use num::traits::identities::Zero; use std::cmp::PartialOrd; pub struct Triangle<T: Zero + PartialOrd + Copy>([T; 3]); impl<T: Zero + PartialOrd + Copy> Triangle<T> { pub fn build(lengths: [T; 3]) -> Result<Triangle<T>, &'static str> { if lengths[0] <= T::zero() || lengths[1] <= T::zero...
// two sides are equal, but not all three !self.is_equilateral() && (self.0[0] == self.0[1] || self.0[1] == self.0[2] || self.0[2] == self.0[0]) } pub fn is_scalene(&self) -> bool { // all sides differently, no two sides equal self.0[0] != self.0[1] && self.0[1] != self.0...
pub fn is_isosceles(&self) -> bool {
random_line_split
lib.rs
extern crate num; use num::traits::identities::Zero; use std::cmp::PartialOrd; pub struct
<T: Zero + PartialOrd + Copy>([T; 3]); impl<T: Zero + PartialOrd + Copy> Triangle<T> { pub fn build(lengths: [T; 3]) -> Result<Triangle<T>, &'static str> { if lengths[0] <= T::zero() || lengths[1] <= T::zero() || lengths[2] <= T::zero() { Err("Zero sized sides are illegal") } else if !(...
Triangle
identifier_name
lib.rs
extern crate num; use num::traits::identities::Zero; use std::cmp::PartialOrd; pub struct Triangle<T: Zero + PartialOrd + Copy>([T; 3]); impl<T: Zero + PartialOrd + Copy> Triangle<T> { pub fn build(lengths: [T; 3]) -> Result<Triangle<T>, &'static str> { if lengths[0] <= T::zero() || lengths[1] <= T::zero...
else if !(lengths[0] + lengths[1] > lengths[2] && lengths[1] + lengths[2] > lengths[0] && lengths[2] + lengths[0] > lengths[1]) { Err("Triangle inequality does not hold") } else { Ok(Triangle(lengths)) } } pub fn is_equilateral(&self) -> bool { ...
{ Err("Zero sized sides are illegal") }
conditional_block
lib.rs
extern crate num; use num::traits::identities::Zero; use std::cmp::PartialOrd; pub struct Triangle<T: Zero + PartialOrd + Copy>([T; 3]); impl<T: Zero + PartialOrd + Copy> Triangle<T> { pub fn build(lengths: [T; 3]) -> Result<Triangle<T>, &'static str> { if lengths[0] <= T::zero() || lengths[1] <= T::zero...
pub fn is_scalene(&self) -> bool { // all sides differently, no two sides equal self.0[0] != self.0[1] && self.0[1] != self.0[2] && self.0[2] != self.0[0] } }
{ // two sides are equal, but not all three !self.is_equilateral() && (self.0[0] == self.0[1] || self.0[1] == self.0[2] || self.0[2] == self.0[0]) }
identifier_body
build.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const config_1 = require("../models/config"); const version_1 = require("../upgrade/version"); const common_tags_1 = require("common-tags"); const Command = require('../ember-cli/lib/models/command'); const config = config_1.CliConfig.fromProj...
aliases: ['b'], availableOptions: exports.baseBuildCommandOptions.concat([ { name: 'stats-json', type: Boolean, default: false, description: common_tags_1.oneLine `Generates a \`stats.json\` file which can be analyzed using tools such as: \`webpack-...
} ]; const BuildCommand = Command.extend({ name: 'build', description: 'Builds your app and places it into the output path (dist/ by default).',
random_line_split
wordcount_test.py
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "L...
if __name__ == '__main__': logging.getLogger().setLevel(logging.INFO) unittest.main()
temp_path = self.create_temp_file(self.SAMPLE_TEXT) expected_words = collections.defaultdict(int) for word in re.findall(r'[\w]+', self.SAMPLE_TEXT): expected_words[word] += 1 wordcount.run(['--input=%s*' % temp_path, '--output=%s.result' % temp_path]) # Parse result file and compare. results ...
identifier_body
wordcount_test.py
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "L...
a b c loooooonger words """ def create_temp_file(self, contents): with tempfile.NamedTemporaryFile(delete=False) as f: f.write(contents.encode('utf-8')) return f.name def test_basics(self): temp_path = self.create_temp_file(self.SAMPLE_TEXT) expected_words = collections.defaultdict(i...
a b
random_line_split
wordcount_test.py
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "L...
(self, contents): with tempfile.NamedTemporaryFile(delete=False) as f: f.write(contents.encode('utf-8')) return f.name def test_basics(self): temp_path = self.create_temp_file(self.SAMPLE_TEXT) expected_words = collections.defaultdict(int) for word in re.findall(r'[\w]+', self.SAMPLE_TEXT...
create_temp_file
identifier_name
wordcount_test.py
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "L...
elif line.strip(): self.assertEqual(line.strip(), 'word,count') self.assertEqual(sorted(results), sorted(expected_words.items())) if __name__ == '__main__': logging.getLogger().setLevel(logging.INFO) unittest.main()
results.append((match.group(1), int(match.group(2))))
conditional_block
test_api.py
Public License # along with Zenodo; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307, USA. # # In applying this license, CERN does not # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit i...
(app, db, minimal_record, users, g_users, g_remoteaccounts): """Test new version creation permissions for GitHub records.""" old_owner, new_owner = [User.query.get(u['id']) for u in g_users] # Create repository, and set owner to `old_owner` repo = Repository.crea...
test_github_newversion_permissions
identifier_name
test_api.py
Public License # along with Zenodo; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307, USA. # # In applying this license, CERN does not # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit i...
zgh.model.repository.releases.filter_by().count.return_value = 0 datacite_task_mock = MagicMock() # We have to make the call to the task synchronous datacite_task_mock.delay = datacite_register.apply with patch('zenodo.modules.deposit.tasks.datacite_register', new=datacite_task_mock)...
"""Test basic GitHub payload.""" data = b'foobar' resp = Mock() resp.headers = {'Content-Length': len(data)} resp.raw = BytesIO(b'foobar') resp.status_code = 200 gh3mock = MagicMock() gh3mock.api.session.get = Mock(return_value=resp) gh3mock.account.user.email = 'foo@baz.bar' release...
identifier_body
test_api.py
Public License # along with Zenodo; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307, USA. # # In applying this license, CERN does not # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit i...
assert has_update_permission(old_owner, r1) assert has_newversion_permission(old_owner, r1) with set_identity(new_owner): assert is_github_owner(new_owner, recid1) # `new_owner` can't edit the `old_owner`'s record assert not has_update_permission(new_...
assert not is_github_owner(old_owner, recid1) # `old_owner` can edit his record of course
random_line_split
enum_type_wrapper.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
raise ValueError('Enum %s has no value defined for name %s' % ( self._enum_type.name, name)) def keys(self): """Return a list of the string names in the enum. These are returned in the order they were defined in the .proto file. """ return [value_descriptor.name for value_d...
return self._enum_type.values_by_name[name].number
conditional_block
enum_type_wrapper.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
(self): """Return a list of the integer values in the enum. These are returned in the order they were defined in the .proto file. """ return [value_descriptor.number for value_descriptor in self._enum_type.values] def items(self): """Return a list of the (name, value) pairs of the e...
values
identifier_name
enum_type_wrapper.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
self._enum_type.name, number)) def Value(self, name): """Returns the value coresponding to the given enum name.""" if name in self._enum_type.values_by_name: return self._enum_type.values_by_name[name].number raise ValueError('Enum %s has no value defined for name %s' % ( self._enum...
return self._enum_type.values_by_number[number].name raise ValueError('Enum %s has no name defined for value %d' % (
random_line_split
enum_type_wrapper.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
def Name(self, number): """Returns a string containing the name of an enum value.""" if number in self._enum_type.values_by_number: return self._enum_type.values_by_number[number].name raise ValueError('Enum %s has no name defined for value %d' % ( self._enum_type.name, number)) def Val...
"""Inits EnumTypeWrapper with an EnumDescriptor.""" self._enum_type = enum_type self.DESCRIPTOR = enum_type;
identifier_body
utils.py
from __future__ import print_function import datetime from collections import OrderedDict from django.urls import reverse from django.http import JsonResponse from django.utils.translation import get_language, activate from wagtail.core import blocks from wagtail.core.models import Page from wagtail.core.rich_text imp...
return article_translations def get_unique_photographers(album): photographers = [] for slide in album.slides.all(): photographers.extend(slide.image.photographers.all()) return set(photographers) def get_slide_detail(album): response_data = {} response_data['slides'] = [] photo...
article_translations[article] = get_translations_for_page(article)
conditional_block
utils.py
from __future__ import print_function import datetime from collections import OrderedDict from django.urls import reverse from django.http import JsonResponse from django.utils.translation import get_language, activate from wagtail.core import blocks from wagtail.core.models import Page from wagtail.core.rich_text imp...
for translation in translations: if translation.language == get_language(): translated_page = translation return translated_page def filter_by_language(request, *items_to_filter): lang = get_language() filtered_list = [] if request.GET.get("lang"): lang = request.GET["l...
def get_translated_or_default_page(default_page, translations): translated_page = default_page
random_line_split
utils.py
from __future__ import print_function import datetime from collections import OrderedDict from django.urls import reverse from django.http import JsonResponse from django.utils.translation import get_language, activate from wagtail.core import blocks from wagtail.core.models import Page from wagtail.core.rich_text imp...
(object): TITLE = 6 AUTHOR = 5 LOCATION = 4 DESCRIPTION = 3 CONTENT = 2 def construct_guidelines(guideline_content): guideline_dict = OrderedDict() for content in guideline_content: if content.block_type == "heading_title": current_heading = content.value gu...
SearchBoost
identifier_name
utils.py
from __future__ import print_function import datetime from collections import OrderedDict from django.urls import reverse from django.http import JsonResponse from django.utils.translation import get_language, activate from wagtail.core import blocks from wagtail.core.models import Page from wagtail.core.rich_text imp...
slide_dict['slide_photographer'] = photographers_of_album photographers.extend(set(slide.image.photographers.all())) if album.first_published_at: published_date = datetime.datetime.strptime(str(album.first_published_at)[:10], "%Y-%m-%d") else: published_date =...
response_data = {} response_data['slides'] = [] photographers = [] slide_photo_graphers = [] for slide in album.slides.all(): slide_photo_graphers.extend(map(lambda photographer_name: photographer_name.name, slide.image.photographers.all())) photograph...
identifier_body
functions_bak.js
log.enableAll(); (function(){ function
() { requestAnimationFrame(animate); TWEEN.update(); } animate(); })(); var transform = getStyleProperty('transform'); var getStyle = ( function() { var getStyleFn = getComputedStyle ? function( elem ) { return getComputedStyle( elem, null ); } : function(...
animate
identifier_name
functions_bak.js
log.enableAll(); (function(){ function animate() { requestAnimationFrame(animate); TWEEN.update(); } animate(); })(); var transform = getStyleProperty('transform'); var getStyle = ( function() { var getStyleFn = getComputedStyle ? function( elem ) { return getComputed...
}; orientationControl.listen(orientationFunc); }) .catch(function(e){ log.error(e); }); }; var initTouch = function(){ var mc = new Hammer.Manager($el.main.get(0)); var pan = new Hammer.Pan(); $el.main.on('touchstart', function (evt) { if (...
{ var length = cache.imgW / 360 * -(cache.deg - cache.rotationOffsetDeg) + cache.panOffsetX; cache.runDeg = cache.deg; cache.nowOffset = length; animOffset(length); }
conditional_block
functions_bak.js
log.enableAll(); (function(){ function animate()
animate(); })(); var transform = getStyleProperty('transform'); var getStyle = ( function() { var getStyleFn = getComputedStyle ? function( elem ) { return getComputedStyle( elem, null ); } : function( elem ) { return elem.currentStyle; }; return fun...
{ requestAnimationFrame(animate); TWEEN.update(); }
identifier_body
functions_bak.js
log.enableAll(); (function(){ function animate() { requestAnimationFrame(animate); TWEEN.update(); } animate(); })(); var transform = getStyleProperty('transform'); var getStyle = ( function() { var getStyleFn = getComputedStyle ? function( elem ) { return getComputed...
}); $panoramaBox.css({ width: elW / scal, height: opts.height, transform: 'scale3d(' + scal + ',' + scal + ',' + scal + ')', 'transform-origin': '0 0' }); util.setTranslateX($panoramaItem.get(0), 0); util.setTranslateX($panoramaItem.get(1), -opts.width); $el.appen...
height: opts.height
random_line_split
content_view.py
# -*- coding: utf-8 -*- # # Copyright 2013 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should hav...
return views[0] else: return None def update(self, org_id, cv_id, label, description): view = {} view = update_dict_unless_none(view, "label", label) view = update_dict_unless_none(view, "description", description) path = "/api/organizations/%s/conte...
views = self.server.GET(path, {"label": view_label})[1] if len(views) > 0:
random_line_split
content_view.py
# -*- coding: utf-8 -*- # # Copyright 2013 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should hav...
else: return None def update(self, org_id, cv_id, label, description): view = {} view = update_dict_unless_none(view, "label", label) view = update_dict_unless_none(view, "description", description) path = "/api/organizations/%s/content_views/%s" % (org_id, cv_...
return views[0]
conditional_block
content_view.py
# -*- coding: utf-8 -*- # # Copyright 2013 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should hav...
(self, org_id, view_label): path = "/api/organizations/%s/content_views/" % (org_id) views = self.server.GET(path, {"label": view_label})[1] if len(views) > 0: return views[0] else: return None def update(self, org_id, cv_id, label, description): view...
content_view_by_label
identifier_name
content_view.py
# -*- coding: utf-8 -*- # # Copyright 2013 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should hav...
params = {"environment_id": environment_id} view = self.server.GET(path, params)[1] return view def content_view_by_label(self, org_id, view_label): path = "/api/organizations/%s/content_views/" % (org_id) views = self.server.GET(path, {"label": view_label})[1] if le...
""" Connection class to access content_view calls """ def content_views_by_org(self, org_id, env=None): path = "/api/organizations/%s/content_views" % org_id params = {"environment_id": env["id"]} if env else {} views = self.server.GET(path, params)[1] return views def v...
identifier_body
js.js
var login = new Object(); jQuery.extend(login, { init: function(formulario) { login.peticion(formulario); }, peticion: function(formulario) { jQuery.ajax({ url : "{{ RUTA_APP|e }}/Index/Index/autenticacion", async : false, data : jQuery(formulario).serialize(), dataType : "json", ...
} } });
location.href = info.data; } else { swal("Error!", info.data, "error");
random_line_split
gotoDefinitionLinkTag1.ts
///<reference path="fourslash.ts" /> // @Filename: foo.ts //// interface [|/*def1*/Foo|] { //// foo: string //// } //// namespace NS { //// export interface [|/*def2*/Bar|] { //// baz: Foo //// } //// }
//// /** {@link NS./*use2*/[|Bar|]} ns.bar*/ //// const b = "" //// /** {@link /*use3*/[|Foo|] f1}*/ //// const c = "" //// /** {@link NS./*use4*/[|Bar|] ns.bar}*/ //// const [|/*def3*/d|] = "" //// /** {@link /*use5*/[|d|] }dd*/ //// const e = "" // Without lookahead, ambiguous between suffix type and link tag //...
//// /** {@link /*use1*/[|Foo|]} foooo*/ //// const a = ""
random_line_split
index.js
const fs = require('fs'); const dns = require('dns'); const argv = require('yargs').argv; const Seismometer = require('./seismometer'); const Communicator = require('./communicator'); function assertOnline() { return new Promise((fulfill, reject) => { dns.resolve('www.google.com', err => { if (err) { ...
if (argv.port) { if (!fs.existsSync(argv.port)) { console.error(`Port "${argv.port}" does not exist.`); process.exit(1); } } const communicator = new Communicator(); const seismometer = new Seismometer(); seismometer.watch(); assertOnline() .then(() => communicator.connect(argv....
{ console.log('usage: npm run [--port /dev/port]'); process.exit(0); }
conditional_block
index.js
const fs = require('fs'); const dns = require('dns'); const argv = require('yargs').argv; const Seismometer = require('./seismometer'); const Communicator = require('./communicator'); function assertOnline() { return new Promise((fulfill, reject) => { dns.resolve('www.google.com', err => { if (err) { ...
}); console.log('Watching for quakes...'); }) .catch(err => { console.error(err); process.exit(1); }); } main();
console.log('Connected to', communicator.port.path); seismometer.on('quake', info => { console.log(`Quake! At ${info.date} with a magnitude of ${info.magnitude}`); communicator.send(info);
random_line_split
index.js
const fs = require('fs'); const dns = require('dns'); const argv = require('yargs').argv; const Seismometer = require('./seismometer'); const Communicator = require('./communicator'); function assertOnline() { return new Promise((fulfill, reject) => { dns.resolve('www.google.com', err => { if (err) { ...
.then(() => { console.log('Connected to', communicator.port.path); seismometer.on('quake', info => { console.log(`Quake! At ${info.date} with a magnitude of ${info.magnitude}`); communicator.send(info); }); console.log('Watching for quakes...'); }) .catch(err => { ...
{ if (argv.help) { console.log('usage: npm run [--port /dev/port]'); process.exit(0); } if (argv.port) { if (!fs.existsSync(argv.port)) { console.error(`Port "${argv.port}" does not exist.`); process.exit(1); } } const communicator = new Communicator(); const seismometer = new...
identifier_body
index.js
const fs = require('fs'); const dns = require('dns'); const argv = require('yargs').argv; const Seismometer = require('./seismometer'); const Communicator = require('./communicator'); function assertOnline() { return new Promise((fulfill, reject) => { dns.resolve('www.google.com', err => { if (err) { ...
() { if (argv.help) { console.log('usage: npm run [--port /dev/port]'); process.exit(0); } if (argv.port) { if (!fs.existsSync(argv.port)) { console.error(`Port "${argv.port}" does not exist.`); process.exit(1); } } const communicator = new Communicator(); const seismometer = ...
main
identifier_name
tasks.ts
import request from './request' export type UUID = string export type DateTime = string // for options see class names here: https://github.com/GothenburgBitFactory/taskwarrior/blob/01696a307b6785be973e3e6428e6ade2a3872c1e/src/columns/ColUDA.h#L36 export type TaskwarriorDataType = 'string' | 'numeric' | 'date' | 'dur...
status: 'pending' | 'completed' | 'deleted' | 'recurring' | 'waiting' urgency: number description: string project?: string due?: DateTime entry: DateTime modified: DateTime start?: DateTime end?: DateTime wait?: DateTime until?: DateTime scheduled?: DateTime depends?: UUID[] blocks?: UUID[] ...
id: UUID uuid: UUID // Same as 'id' short_id: number // status: for options see https://github.com/GothenburgBitFactory/taskwarrior/blob/6727d08da05b1090e0eda2270bc35d09a4528e87/src/Task.h#L71
random_line_split
tasks.ts
import request from './request' export type UUID = string export type DateTime = string // for options see class names here: https://github.com/GothenburgBitFactory/taskwarrior/blob/01696a307b6785be973e3e6428e6ade2a3872c1e/src/columns/ColUDA.h#L36 export type TaskwarriorDataType = 'string' | 'numeric' | 'date' | 'dur...
export async function updateTask(task: Task): Promise<void> { return request<void>('PUT', `tasks/${task.uuid}`, { data: task, }) } export async function completeTask(uuid: UUID): Promise<void> { return request<void>('DELETE', `tasks/${uuid}`, {}) } export async function deleteTask(uuid: UUID): Promise<voi...
{ return request<Task>('POST', `tasks`, { data: task, }) }
identifier_body
tasks.ts
import request from './request' export type UUID = string export type DateTime = string // for options see class names here: https://github.com/GothenburgBitFactory/taskwarrior/blob/01696a307b6785be973e3e6428e6ade2a3872c1e/src/columns/ColUDA.h#L36 export type TaskwarriorDataType = 'string' | 'numeric' | 'date' | 'dur...
(uuid: UUID): Promise<void> { return request<void>('POST', `tasks/${uuid}/start`, {}) } export async function stopTask(uuid: UUID): Promise<void> { return request<void>('POST', `tasks/${uuid}/stop`, {}) }
startTask
identifier_name
config.js
'use strict'; export default { browserPort: 3000,
sourceDir: './app/', buildDir: './build/', styles: { src: 'app/styles/**/*.scss', dest: 'build/css', prodSourcemap: false, sassIncludePaths: [] }, scripts: { src: 'app/js/**/*.js', dest: 'build/js', test: 'test/**/*.js', gulp: 'gulp/**/*.js' }, images: { src: 'app/im...
UIPort: 3001, testPort: 3002,
random_line_split
content.ts
import Genet from './genet' import Style from './style' import api from '@genet/api' import m from 'mithril' import path from 'path' const { shell, webFrame } = require('electron') export default class Content { constructor(private view: object, private css: string, private argv: object = {}) { } async load() {...
...JSON.parse(decodeURIComponent(location.search.substr(1))), ...this.argv, } api.init(new Genet(argv)) m.mount(document.body, this.view) await (document as any).fonts.ready } }
const argv = {
random_line_split
content.ts
import Genet from './genet' import Style from './style' import api from '@genet/api' import m from 'mithril' import path from 'path' const { shell, webFrame } = require('electron') export default class
{ constructor(private view: object, private css: string, private argv: object = {}) { } async load() { webFrame.setVisualZoomLevelLimits(1, 1) document.addEventListener('dragover', (event) => { event.preventDefault() return false }, false) document.addEventListener('drop', (event) ...
Content
identifier_name
content.ts
import Genet from './genet' import Style from './style' import api from '@genet/api' import m from 'mithril' import path from 'path' const { shell, webFrame } = require('electron') export default class Content { constructor(private view: object, private css: string, private argv: object = {}) { } async load() {...
}) await new Promise((res) => { document.addEventListener('DOMContentLoaded', res) }) const loader = new Style() loader.applyTheme(document) loader.applyCommon(document) await loader.applyCss(document, path.join(__dirname, this.css)) const argv = { ...JSON.parse(decodeURI...
{ event.preventDefault() shell.openExternal(event.target.href) event.preventDefault() }
conditional_block
content.ts
import Genet from './genet' import Style from './style' import api from '@genet/api' import m from 'mithril' import path from 'path' const { shell, webFrame } = require('electron') export default class Content { constructor(private view: object, private css: string, private argv: object = {})
async load() { webFrame.setVisualZoomLevelLimits(1, 1) document.addEventListener('dragover', (event) => { event.preventDefault() return false }, false) document.addEventListener('drop', (event) => { event.preventDefault() return false }, false) document.addEventLis...
{ }
identifier_body
MapTourHelper.js
> -1 ) return true; // Created with 2.1 // Or created prior 2.1 but updated with 2.1 // - prior 2.1 get templateCreation = 2.1 when app was saved through builder // - prior 2.1 that will be saved with 2.2+ doesn't have video yet -> video will have #isVideo if( WebApplicationData.getT...
type = "normal"; } if( $("body").hasClass("side-panel") ) { if(color != "r" && color != "g" && color != "b" && color != "p") color = APPCFG.PIN_DEFAULT_CFG; var newColor = this.getCustomColor((color || APPCFG.PIN_DEFAULT_CFG), type); var newCanvas = document.createElement('canv...
getSymbol: function(color, number, type, doNotAllowStatic) { var symbol = null; color = color && typeof color == "string" ? color.toLowerCase() : 'r'; if(!type){
random_line_split
MapTourHelper.js
+ '//' + document.location.host + document.location.pathname.split('/').slice(0,-1).join('/') + '/resources/icons/picture-not-available.png'; }, /* * Name/description manipulation introduced in 2.2 * - text need to be encoded to be properly saved in FS * - using decodeURI on a...
{ return; }
conditional_block
fnv.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! This file stolen wholesale from rustc/src/librustc/util/nodemap.rs use std::default::Default; use std::hash::...
() -> FnvHasher { FnvHasher(0xcbf29ce484222325) } } impl Hasher for FnvHasher { type Output = u64; fn reset(&mut self) { *self = Default::default(); } fn finish(&self) -> u64 { self.0 } } impl Writer for FnvHasher { fn write(&mut self, bytes: &[u8]) { let FnvHasher(mut hash) = *self; f...
default
identifier_name
fnv.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! This file stolen wholesale from rustc/src/librustc/util/nodemap.rs use std::default::Default; use std::hash::...
} impl Hasher for FnvHasher { type Output = u64; fn reset(&mut self) { *self = Default::default(); } fn finish(&self) -> u64 { self.0 } } impl Writer for FnvHasher { fn write(&mut self, bytes: &[u8]) { let FnvHasher(mut hash) = *self; for byte in bytes.iter() { hash = hash...
{ FnvHasher(0xcbf29ce484222325) }
identifier_body
fnv.rs
/* This Source Code Form is subject to the terms of the Mozilla Public
//! This file stolen wholesale from rustc/src/librustc/util/nodemap.rs use std::default::Default; use std::hash::{Hasher, Writer}; /// A speedy hash algorithm for node ids and def ids. The hashmap in /// libcollections by default uses SipHash which isn't quite as speedy as we /// want. In the compiler we're not reall...
* License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
random_line_split
common.py
#!/usr/bin/python """ Copyright 2014 The Trustees of Princeton University 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 ...
sealed_slice_secret_b64 = base64.b64encode( sealed_slice_secret ) return sealed_slice_secret_b64 #------------------------------- def decrypt_slice_secret( observer_pkey_pem, sealed_slice_secret_b64 ): """ Unserialize and decrypt a slice secret """ # get the public key ...
logger.error("Failed to encrypt slice secret") return None
random_line_split
common.py
#!/usr/bin/python """ Copyright 2014 The Trustees of Princeton University 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 ...
return slice_secret
logger.error("Failed to decrypt '%s', rc = %d" % (sealed_slice_secret_b64, rc)) return None
conditional_block
common.py
#!/usr/bin/python """ Copyright 2014 The Trustees of Princeton University 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 ...
( observer_pkey_pem, sealed_slice_secret_b64 ): """ Unserialize and decrypt a slice secret """ # get the public key try: observer_pubkey_pem = CryptoKey.importKey( observer_pkey_pem ).publickey().exportKey() except Exception, e: logger.exception(e) logger.error("Fai...
decrypt_slice_secret
identifier_name
common.py
#!/usr/bin/python """ Copyright 2014 The Trustees of Princeton University 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 ...
return sealed_slice_secret_b64 #------------------------------- def decrypt_slice_secret( observer_pkey_pem, sealed_slice_secret_b64 ): """ Unserialize and decrypt a slice secret """ # get the public key try: observer_pubkey_pem = CryptoKey.importKey( observer_pkey_pe...
""" Encrypt and serialize the slice secret with the Observer private key """ # get the public key try: observer_pubkey_pem = CryptoKey.importKey( observer_pkey_pem ).publickey().exportKey() except Exception, e: logger.exception(e) logger.error("Failed to derive public key f...
identifier_body
logic.py
# This file is part of Korman. # # Korman 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. # # Korman is distributed i...
(idprops.IDPropMixin, bpy.types.PropertyGroup): name = StringProperty(name="Name") version = EnumProperty(name="Version", description="Plasma versions this node tree exports under", items=game_versions, options={"ENUM_FLAG"}, ...
PlasmaVersionedNodeTree
identifier_name
logic.py
# This file is part of Korman. # # Korman 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. # # Korman is distributed i...
class PlasmaAdvancedLogic(PlasmaModifierProperties): pl_id = "advanced_logic" bl_category = "Logic" bl_label = "Advanced" bl_description = "Plasma Logic Nodes" bl_icon = "NODETREE" logic_groups = CollectionProperty(type=PlasmaVersionedNodeTree) active_group_index = IntProperty(options={...
return {"node_tree_name": bpy.data.node_groups}
identifier_body
logic.py
# This file is part of Korman. # # Korman 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. # # Korman is distributed i...
def harvest_actors(self): actors = set() for i in self.logic_groups: actors.update(i.node_tree.harvest_actors()) return actors class PlasmaSpawnPoint(PlasmaModifierProperties): pl_id = "spawnpoint" bl_category = "Logic" bl_label = "Spawn Point" bl_description...
exporter.node_trees_exported.add(i.node_tree.name) i.node_tree.export(exporter, bo, so)
conditional_block
logic.py
# This file is part of Korman. # # Korman 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. # # Korman is distributed i...
return {"node_tree": "node_tree_name"} def _idprop_sources(self): return {"node_tree_name": bpy.data.node_groups} class PlasmaAdvancedLogic(PlasmaModifierProperties): pl_id = "advanced_logic" bl_category = "Logic" bl_label = "Advanced" bl_description = "Plasma Logic Nodes" bl...
@classmethod def _idprop_mapping(cls):
random_line_split
setup.py
from __future__ import unicode_literals, print_function, absolute_import from setuptools import setup, find_packages import giles setup( author="Anthony Almarza", name="giles", version=giles.__version__, packages=find_packages(exclude=["test*", ]), url="https://github.com/anthonyalmarza/giles", ...
'PyGithub', 'pychalk', 'slackclient', 'urllib3[secure]' ], extras_require={'dev': ['ipdb', 'mock', 'tox', 'coverage']}, include_package_data=True, scripts=[ 'bin/giles', 'bin/jira', 'bin/github', ] )
'jira', 'GitPython',
random_line_split
lib.rs
] extern crate error_chain; /// This crate's error-related code, generated by `error-chain`. mod errors { // Create the Error, ErrorKind, ResultExt, and Result types error_chain! {} } pub use errors::*; extern crate shlex; #[macro_use] extern crate slog; use slog::Logger; extern crate rust_htslib; use rust...
(header: &bcf::header::HeaderView, field_type: &str) -> BTreeSet<String> { let mut result: BTreeSet<String> = BTreeSet::new(); for record in header.header_records() { match record { bcf::HeaderRecord::Format { key: _, values } => match values.get("Type") { Some(this_type) =>...
get_field_names
identifier_name
lib.rs
] extern crate error_chain; /// This crate's error-related code, generated by `error-chain`. mod errors { // Create the Error, ErrorKind, ResultExt, and Result types error_chain! {} } pub use errors::*; extern crate shlex; #[macro_use] extern crate slog; use slog::Logger; extern crate rust_htslib; use rust...
else { let num_samples = reader.header(i).sample_count(); for _j in 0..num_samples { values_v.push(b"".to_vec()); } } } let values: Vec<&[u8]> = values_v .iter() ....
{ let mut rec_in = reader .record(i) .expect("We just checked that the record should be there!"); let mut tmp_v = rec_in .format(&key_b) .string() .unwrap_or_el...
conditional_block
lib.rs
] extern crate error_chain; /// This crate's error-related code, generated by `error-chain`. mod errors { // Create the Error, ErrorKind, ResultExt, and Result types error_chain! {} } pub use errors::*; extern crate shlex; #[macro_use] extern crate slog; use slog::Logger; extern crate rust_htslib; use rust...
} assert!(first.is_some()); let record = first.as_mut().unwrap(); // Push GT, always no-call for coverage records. let values = (0..(1 * num_samples)) .map(|_| bcf::GT_MISSING) .collect::<Vec<i32>>(); record .push_format_integer(b"GT"...
{ while reader .read_next() .chain_err(|| "Problem reading from input BCF files")? != 0 { // TODO: also merge INFO values? // Locate first record; will copy INFO from there; FORMAT comes later. let mut first: Option<bcf::Record> = None; let num_samples = w...
identifier_body
lib.rs
] extern crate error_chain; /// This crate's error-related code, generated by `error-chain`. mod errors { // Create the Error, ErrorKind, ResultExt, and Result types error_chain! {} } pub use errors::*; extern crate shlex; #[macro_use] extern crate slog; use slog::Logger; extern crate rust_htslib; use rust...
.iter() .map(|v| v.as_slice()) .collect::<Vec<&[u8]>>(); record .push_format_string(key_b, values.as_slice()) .chain_err(|| format!("Could not write FORMAT/{}", key))?; } // Collect input FORMAT Float fields and...
values_v.push(b"".to_vec()); } } } let values: Vec<&[u8]> = values_v
random_line_split
iterable.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {getSymbolIterator} from './symbol'; export function isIterable(obj: any): obj is Iterable<any> { return ...
(obj: any): boolean { if (!isJsObject(obj)) return false; return Array.isArray(obj) || (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v] getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop } export function areIterablesEqual( a: any, b: any, c...
isListLikeIterable
identifier_name
iterable.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {getSymbolIterator} from './symbol'; export function isIterable(obj: any): obj is Iterable<any> { return ...
}
return o !== null && (typeof o === 'function' || typeof o === 'object');
random_line_split
iterable.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {getSymbolIterator} from './symbol'; export function isIterable(obj: any): obj is Iterable<any> { return ...
{ return o !== null && (typeof o === 'function' || typeof o === 'object'); }
identifier_body