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
yubi.rs
use yubico::config::{Command, Config, Mode, Slot}; use yubico::configure::DeviceModeConfig; use yubico::hmacmode::HmacKey; use yubico::Yubico; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use hex; use std::ops::Deref; pub fn setup_secret() -> Result<(), String>
} else { return Ok(()); } } Err("Yubikey not found".into()) } pub fn retrieve_secret(token: [u8; 20]) -> Option<String> { let mut yubi = Yubico::new(); if let Ok(device) = yubi.find_yubikey() { let config = Config::default() .set_vendor_id(device.vendo...
{ let mut yubi = Yubico::new(); // We assume the first device if let Ok(device) = yubi.find_yubikey() { let config = Config::default() .set_vendor_id(device.vendor_id) .set_product_id(device.product_id) .set_command(Command::Configuration2); let mut rng ...
identifier_body
yubi.rs
use yubico::config::{Command, Config, Mode, Slot}; use yubico::configure::DeviceModeConfig; use yubico::hmacmode::HmacKey; use yubico::Yubico; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use hex; use std::ops::Deref; pub fn
() -> Result<(), String> { let mut yubi = Yubico::new(); // We assume the first device if let Ok(device) = yubi.find_yubikey() { let config = Config::default() .set_vendor_id(device.vendor_id) .set_product_id(device.product_id) .set_command(Command::Configuration...
setup_secret
identifier_name
phantom.rs
/* * Copyright 2017 Sreejith Krishnan R * * 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...
(&mut self, context: &Context, width_mode: &MeasureMode, height_mode: &MeasureMode) { if let Some(ref mut wrapped) = self.wrapped { wrapped.calculate(context, width_mode, height_mode); self.bounding_box = wrapped.bounding_box().clone(); } else { self.bounding_box = Bo...
calculate
identifier_name
phantom.rs
/* * Copyright 2017 Sreejith Krishnan R * * 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...
else { self.bounding_box = BoundingBox::default() } } fn bounding_box(&self) -> &BoundingBox { &self.bounding_box } }
{ wrapped.calculate(context, width_mode, height_mode); self.bounding_box = wrapped.bounding_box().clone(); }
conditional_block
phantom.rs
/* * Copyright 2017 Sreejith Krishnan R
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing ...
* * 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 *
random_line_split
http-tracker.js
const arrayRemove = require('unordered-array-remove') const bencode = require('bencode') const compact2string = require('compact2string')
const common = require('../common') const Tracker = require('./tracker') const HTTP_SCRAPE_SUPPORT = /\/(announce)[^/]*$/ /** * HTTP torrent tracker client (for an individual tracker) * * @param {Client} client parent bittorrent tracker client * @param {string} announceUrl announce url of tracker * @param...
const debug = require('debug')('bittorrent-tracker:http-tracker') const get = require('simple-get')
random_line_split
http-tracker.js
const arrayRemove = require('unordered-array-remove') const bencode = require('bencode') const compact2string = require('compact2string') const debug = require('debug')('bittorrent-tracker:http-tracker') const get = require('simple-get') const common = require('../common') const Tracker = require('./tracker') const H...
(client, announceUrl, opts) { super(client, announceUrl) debug('new http tracker %s', announceUrl) // Determine scrape url (if http tracker supports it) this.scrapeUrl = null const match = this.announceUrl.match(HTTP_SCRAPE_SUPPORT) if (match) { const pre = this.announceUrl.slice(0, ma...
constructor
identifier_name
http-tracker.js
const arrayRemove = require('unordered-array-remove') const bencode = require('bencode') const compact2string = require('compact2string') const debug = require('debug')('bittorrent-tracker:http-tracker') const get = require('simple-get') const common = require('../common') const Tracker = require('./tracker') const H...
scrape (opts) { if (this.destroyed) return if (!this.scrapeUrl) { this.client.emit('error', new Error(`scrape not supported ${this.announceUrl}`)) return } const infoHashes = (Array.isArray(opts.infoHash) && opts.infoHash.length > 0) ? opts.infoHash.map(infoHash => { retu...
{ if (this.destroyed) return const params = Object.assign({}, opts, { compact: (opts.compact == null) ? 1 : opts.compact, info_hash: this.client._infoHashBinary, peer_id: this.client._peerIdBinary, port: this.client._port }) if (this._trackerId) params.trackerid = this._trackerI...
identifier_body
http-tracker.js
const arrayRemove = require('unordered-array-remove') const bencode = require('bencode') const compact2string = require('compact2string') const debug = require('debug')('bittorrent-tracker:http-tracker') const get = require('simple-get') const common = require('../common') const Tracker = require('./tracker') const H...
} _onScrapeResponse (data) { // NOTE: the unofficial spec says to use the 'files' key, 'host' has been // seen in practice data = data.files || data.host || {} const keys = Object.keys(data) if (keys.length === 0) { this.client.emit('warning', new Error('invalid scrape response')) ...
{ // tracker returned normal response data.peers6.forEach(peer => { const ip = /^\[/.test(peer.ip) || !/:/.test(peer.ip) ? peer.ip /* ipv6 w/ brackets or domain name */ : `[${peer.ip}]` /* ipv6 without brackets */ this.client.emit('peer', `${ip}:${peer.port}`) }) ...
conditional_block
endpoints.py
# -*- coding: utf8 -*- # # Created by 'myth' on 6/27/15 from django.http import JsonResponse from oauth2_provider.decorators import protected_resource from apps.sso.userinfo import Onlineweb4Userinfo USERINFO_SCOPES = [ 'authentication.onlineuser.username.read', 'authentication.onlineuser.first_name.read', ...
(request): """ Basic user information provided based on the Bearer Token provided by an SSO application :param request: The Django Request object :return: An HTTP response """ return JsonResponse(status=200, data=Onlineweb4Userinfo(request.user).oauth2())
oauth2_provider_userinfo
identifier_name
endpoints.py
# -*- coding: utf8 -*- # # Created by 'myth' on 6/27/15
from django.http import JsonResponse from oauth2_provider.decorators import protected_resource from apps.sso.userinfo import Onlineweb4Userinfo USERINFO_SCOPES = [ 'authentication.onlineuser.username.read', 'authentication.onlineuser.first_name.read', 'authentication.onlineuser.last_name.read', 'authe...
random_line_split
endpoints.py
# -*- coding: utf8 -*- # # Created by 'myth' on 6/27/15 from django.http import JsonResponse from oauth2_provider.decorators import protected_resource from apps.sso.userinfo import Onlineweb4Userinfo USERINFO_SCOPES = [ 'authentication.onlineuser.username.read', 'authentication.onlineuser.first_name.read', ...
""" Basic user information provided based on the Bearer Token provided by an SSO application :param request: The Django Request object :return: An HTTP response """ return JsonResponse(status=200, data=Onlineweb4Userinfo(request.user).oauth2())
identifier_body
neon-shared-element-animation-behavior.js
/** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://...
console.warn(this.is + ':', !fromPage ? 'fromPage' : 'toPage', 'is undefined!'); return null; } ; if (!fromPage.sharedElements || !toPage.sharedElements) { console.warn(this.is + ':', 'sharedElements are undefined for', !fromPage.sharedElements ? fromPage : toPage); return null; ...
findSharedElements: function (config) { var fromPage = config.fromPage; var toPage = config.toPage; if (!fromPage || !toPage) {
random_line_split
neon-shared-element-animation-behavior.js
/** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://...
; if (!fromPage.sharedElements || !toPage.sharedElements) { console.warn(this.is + ':', 'sharedElements are undefined for', !fromPage.sharedElements ? fromPage : toPage); return null; } ; var from = fromPage.sharedElements[config.id]; var to = toPage.sharedElements[config.id]; ...
{ console.warn(this.is + ':', !fromPage ? 'fromPage' : 'toPage', 'is undefined!'); return null; }
conditional_block
main_col.js
(function() { loadOptions(); buttonHandler(); })(); function buttonHandler() { var $submitButton = $('#submitButton'); $submitButton.on('click', function() { console.log('Submit'); var return_to = getQueryParam('return_to', 'pebblejs://close#'); document.location = return_to + encodeURIComponent(JSON.stri...
$("input[name=datemode][value='" + $datemodeValue + "']").attr('checked', 'checked'); } function getAndStoreConfigData() { console.log('datemode value: ' + $datemodeValue); var options = { datemode: $datemodeValue }; localStorage.datemode = options.datemode; console.log('Got options: ' + JSON.stringify(...
{ $datemodeValue = 0; console.log('localStorage.datemode was undefined, now set to: ' + $datemodeValue); }
conditional_block
main_col.js
(function() { loadOptions(); buttonHandler(); })(); function buttonHandler() { var $submitButton = $('#submitButton'); $submitButton.on('click', function() { console.log('Submit'); var return_to = getQueryParam('return_to', 'pebblejs://close#'); document.location = return_to + encodeURIComponent(JSON.stri...
{ var query = location.search.substring(1); var vars = query.split('&'); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split('='); if (pair[0] === variable) { return decodeURIComponent(pair[1]); } } return defaultValue || false; }
identifier_body
main_col.js
(function() { loadOptions(); buttonHandler(); })(); function buttonHandler() { var $submitButton = $('#submitButton'); $submitButton.on('click', function() { console.log('Submit'); var return_to = getQueryParam('return_to', 'pebblejs://close#'); document.location = return_to + encodeURIComponent(JSON.stri...
(variable, defaultValue) { var query = location.search.substring(1); var vars = query.split('&'); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split('='); if (pair[0] === variable) { return decodeURIComponent(pair[1]); } } return defaultValue || false; }
getQueryParam
identifier_name
main_col.js
(function() { loadOptions(); buttonHandler(); })(); function buttonHandler() { var $submitButton = $('#submitButton'); $submitButton.on('click', function() { console.log('Submit'); var return_to = getQueryParam('return_to', 'pebblejs://close#'); document.location = return_to + encodeURIComponent(JSON.stri...
$datemodeValue = 0; console.log('localStorage.datemode was undefined, now set to: ' + $datemodeValue); } $("input[name=datemode][value='" + $datemodeValue + "']").attr('checked', 'checked'); } function getAndStoreConfigData() { console.log('datemode value: ' + $datemodeValue); var options = { datemode: $d...
random_line_split
htmlheadingelement.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/. */ use dom::bindings::codegen::Bindings::HTMLHeadingElementBinding; use dom::bindings::codegen::InheritTypes::HTMLHea...
(&self) -> bool { *self.type_id() == EventTargetTypeId::Node( NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadingElement))) } } impl HTMLHeadingElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, ...
is_htmlheadingelement
identifier_name
htmlheadingelement.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/. */ use dom::bindings::codegen::Bindings::HTMLHeadingElementBinding; use dom::bindings::codegen::InheritTypes::HTMLHea...
}
{ let element = HTMLHeadingElement::new_inherited(localName, prefix, document, level); Node::reflect_node(box element, document, HTMLHeadingElementBinding::Wrap) }
identifier_body
htmlheadingelement.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/. */ use dom::bindings::codegen::Bindings::HTMLHeadingElementBinding; use dom::bindings::codegen::InheritTypes::HTMLHea...
pub struct HTMLHeadingElement { htmlelement: HTMLElement, level: HeadingLevel, } impl HTMLHeadingElementDerived for EventTarget { fn is_htmlheadingelement(&self) -> bool { *self.type_id() == EventTargetTypeId::Node( NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElem...
Heading6, } #[dom_struct]
random_line_split
jquery.pagination.js
/** * simplePagination.js v1.5 * A simple jQuery pagination plugin. * http://flaviusmatis.github.com/simplePagination.js/ * * Copyright 2012, Flavius Matis * Released under the MIT license. * http://flaviusmatis.github.com/license.html */ (function($){ var methods = { init: function(options) { var o = $.extend(...
} else { $linkWrapper.addClass('active'); } $link = $('<span class="current">' + (options.text) + '</span>'); } else { $link = $('<a href="' + o.hrefTextPrefix + (pageIndex + 1) + o.hrefTextSuffix + '" class="page-link">' + (options.text) + '</a>'); $link.click(function(event){ return m...
}, opts || {}); if (pageIndex == o.currentPage || o.disabled) { if (o.disabled) { $linkWrapper.addClass('disabled');
random_line_split
jquery.pagination.js
/** * simplePagination.js v1.5 * A simple jQuery pagination plugin. * http://flaviusmatis.github.com/simplePagination.js/ * * Copyright 2012, Flavius Matis * Released under the MIT license. * http://flaviusmatis.github.com/license.html */ (function($){ var methods = { init: function(options) { var o = $.extend...
in = Math.max(o.pages - o.edges, interval.end); for (i = begin; i < o.pages; i++) { methods._appendItem.call(this, i); } } // Generate Next link if (o.nextText) { methods._appendItem.call(this, o.currentPage + 1, {text: o.nextText, classes: 'next'}); } }, _getInterval: function(o) { ...
ds._appendItem.call(this, interval.end++); } var beg
conditional_block
bestbuy-product.component.spec.ts
// angular import { Component } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { BaseRequestOptions, ConnectionBackend, Http } from '@angular/http'; import { MockBackend } from '@angular/http/testing'; // libs import { ...
fixture.detectChanges(); t.e(homeDOMEl.querySelectorAll('li').length).toEqual(1); t.e(homeDOMEl.querySelectorAll('li')[0].textContent).toEqual('Minko'); }); })); }); } @Component({ selector: 'test-cmp', template: '<sd-home></sd-home>' }) class TestComponent {...
{ t.describe('@Component: HomeComponent', () => { t.be(testModuleConfig); t.it('should work', t.async(() => { TestBed.compileComponents() .then(() => { let fixture = TestBed.createComponent(TestComponent); fixture.detectChanges(); let homeInstance...
identifier_body
bestbuy-product.component.spec.ts
// angular import { Component } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { BaseRequestOptions, ConnectionBackend, Http } from '@angular/http'; import { MockBackend } from '@angular/http/testing'; // libs import { ...
{ }
TestComponent
identifier_name
bestbuy-product.component.spec.ts
// angular import { Component } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { BaseRequestOptions, ConnectionBackend, Http } from '@angular/http'; import { MockBackend } from '@angular/http/testing'; // libs import { ...
import { LanguageProviders } from '../../modules/i18n/index'; import { SharedModule } from '../../modules/shared/index'; import { HomeComponent } from './bestbuy-product'; // test module configuration for each test const testModuleConfig = () => { TestBed.configureTestingModule({ imports: [ CoreModule, ...
import { NameListService, SampleEffects, reducer } from '../../modules/sample/index'; import { CoreModule } from '../../modules/core/core.module'; import { AnalyticsModule } from '../../modules/analytics/analytics.module'; import { MultilingualModule } from '../../modules/i18n/multilingual.module';
random_line_split
recursion_limit_macro.rs
// Copyright 2017 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 ...
() { recurse!(0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9); }
main
identifier_name
recursion_limit_macro.rs
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. //
// except according to those terms. // Test that the recursion limit can be changed and that the compiler // suggests a fix. In this case, we have a recursing macro that will // overflow if the number of arguments surpasses the recursion limit. #![allow(dead_code)] #![recursion_limit="10"] macro_rules! recurse { ...
// 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed
random_line_split
recursion_limit_macro.rs
// Copyright 2017 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 ...
{ recurse!(0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9); }
identifier_body
range-detector.py
# This was pulled from one of the python/opencv sites appearing
# USAGE: You need to specify a filter and "only one" image source # # (python) range-detector --filter RGB --image /path/to/image.png # or # (python) range-detector --filter HSV --webcam #!/usr/bin/env python import cv2 import argparse from operator import xor def callback(value): pass def setup_trackbars(range...
# in a Google search. Need to find site and add attribution! #!/usr/bin/env python # -*- coding: utf-8 -*-
random_line_split
range-detector.py
# This was pulled from one of the python/opencv sites appearing # in a Google search. Need to find site and add attribution! #!/usr/bin/env python # -*- coding: utf-8 -*- # USAGE: You need to specify a filter and "only one" image source # # (python) range-detector --filter RGB --image /path/to/image.png # or # (pytho...
if __name__ == '__main__': main()
ret, image = camera.read() if not ret: break if range_filter == 'RGB': frame_to_thresh = image.copy() else: frame_to_thresh = cv2.cvtColor(image, cv2.COLOR_BGR2HSV) v1_min, v2_min, v3_min, v1_max, v2_max, v3_max = get_trackbar_values(range_filter) ...
conditional_block
range-detector.py
# This was pulled from one of the python/opencv sites appearing # in a Google search. Need to find site and add attribution! #!/usr/bin/env python # -*- coding: utf-8 -*- # USAGE: You need to specify a filter and "only one" image source # # (python) range-detector --filter RGB --image /path/to/image.png # or # (pytho...
(range_filter): values = [] for i in ["MIN", "MAX"]: for j in range_filter: v = cv2.getTrackbarPos("%s_%s" % (j, i), "Trackbars") values.append(v) return values def main(): range_filter = 'HSV' camera = cv2.VideoCapture(1) setup_trackbars(range_filter) w...
get_trackbar_values
identifier_name
range-detector.py
# This was pulled from one of the python/opencv sites appearing # in a Google search. Need to find site and add attribution! #!/usr/bin/env python # -*- coding: utf-8 -*- # USAGE: You need to specify a filter and "only one" image source # # (python) range-detector --filter RGB --image /path/to/image.png # or # (pytho...
cv2.imshow("Original", image) cv2.imshow("Thresh", thresh) if cv2.waitKey(1) & 0xFF is ord('q'): break if __name__ == '__main__': main()
range_filter = 'HSV' camera = cv2.VideoCapture(1) setup_trackbars(range_filter) while True: ret, image = camera.read() if not ret: break if range_filter == 'RGB': frame_to_thresh = image.copy() else: frame_to_thresh = cv2.cvtColor(imag...
identifier_body
CaseDatatableController.js
({ doInit : function(component, event, helper) { let contactRecordId = [].concat(component.get("v.contactRecordId")); // guarantees array for idSet if (!$A.util.isEmpty(contactRecordId)) { let tableRequest = { queryString: "SELECT " + "Id, CaseNumber, CreatedDate, ClosedDate, ...
} }) ); } } })
{ helper.messageService(component).showToast({ message: error[0].message, variant: "error" }); }
conditional_block
extensions.py
# coding: utf-8 # # Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # # gitinspector 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 Lic...
def get_dict(): return __extensions_dict__ def define(string): global __extensions__ __extensions__ = string.split(",") def add_located(string): if len(string) == 0: __located_extensions__.add("*") else: __located_extensions__.add(string) def get_located(): return __locate...
eturn __extensions__
identifier_body
extensions.py
# coding: utf-8 # # Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # # gitinspector 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 Lic...
): return __located_extensions__
et_located(
identifier_name
extensions.py
# coding: utf-8 # # Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # # gitinspector 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 Lic...
# gitinspector is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along w...
#
random_line_split
extensions.py
# coding: utf-8 # # Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # # gitinspector 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 Lic...
def get_located(): return __located_extensions__
_located_extensions__.add(string)
conditional_block
currie.py
""" Currie -- you can do magic. Goal here is to have a thread launching piglets. And curio controlling the operation. Aim to use joy to control which widget loop to use. No piglets known to be harmed with this code. So there is a pig farm and piglets running everywhere. And currie doing magic. """ from collection...
print('building farm') farm.status() from karmapi.mclock2 import GuidoClock from karmapi.tankrain import TankRain from karmapi import diceware as dice from karmapi import talk if args.monitor: from karmapi import milk farm.add(milk.Curio) images = [ dict(image='...
farm = pigfarm.PigFarm()
random_line_split
currie.py
""" Currie -- you can do magic. Goal here is to have a thread launching piglets. And curio controlling the operation. Aim to use joy to control which widget loop to use. No piglets known to be harmed with this code. So there is a pig farm and piglets running everywhere. And currie doing magic. """ from collection...
farm.status() curio.run(farm.run(), with_monitor=args.nomon) if __name__ == '__main__': main()
if not args.nomick: farm.add_mick(hush.Connect()) farm.add_mick(hush.Wave(mode='square')) farm.add_mick(hush.Wave())
conditional_block
currie.py
""" Currie -- you can do magic. Goal here is to have a thread launching piglets. And curio controlling the operation. Aim to use joy to control which widget loop to use. No piglets known to be harmed with this code. So there is a pig farm and piglets running everywhere. And currie doing magic. """ from collection...
help="if you have a sense hat") parser.add_argument('--path') args = parser.parse_args() # import from pig stuff here, after talking to joy from karmapi import joy joy.set_backend(args.pig) from karmapi import piglet from karmapi import widgets from karmapi i...
import argparse parser = argparse.ArgumentParser() parser.add_argument('--pig', default='tk') parser.add_argument('--wave') parser.add_argument('--gallery', nargs='*', default=['.', '../gallery']) parser.add_argument('--images', default=False, action='store_true') parser.add_argument('--thres...
identifier_body
currie.py
""" Currie -- you can do magic. Goal here is to have a thread launching piglets. And curio controlling the operation. Aim to use joy to control which widget loop to use. No piglets known to be harmed with this code. So there is a pig farm and piglets running everywhere. And currie doing magic. """ from collection...
(): import argparse parser = argparse.ArgumentParser() parser.add_argument('--pig', default='tk') parser.add_argument('--wave') parser.add_argument('--gallery', nargs='*', default=['.', '../gallery']) parser.add_argument('--images', default=False, action='store_true') parser.add_argument...
main
identifier_name
polls.ts
/// <reference path="../_refs.ts" /> module MyVote.Controllers { 'use strict'; //Interface extends ng.IScope from angular.d.ts TypeScript definition file //This allows referencing properties on the Angular this object without the TypeScript compiler having issues with undefined properties
filters: Models.PollFilter[]; filterBy: Models.PollFilter; pollGroups: MyVote.Services.AppServer.Models.PollSummary[][]; responseText(count: number): string; addPoll(): void; viewPoll(id: number): void; getBackImg(imageLink: string): string; } export cla...
export interface PollsScope extends ng.IScope { message: string;
random_line_split
polls.ts
/// <reference path="../_refs.ts" /> module MyVote.Controllers { 'use strict'; //Interface extends ng.IScope from angular.d.ts TypeScript definition file //This allows referencing properties on the Angular this object without the TypeScript compiler having issues with undefined properties export inter...
($scope: PollsScope, $location: ng.ILocationService, myVoteService: Services.MyVoteService) { $scope.filters = Models.PollFilters; $scope.filterBy = $scope.filters[0]; $scope.$watch('filterBy', () => { $scope.pollGroups = null; $scope.message = 'Loadi...
constructor
identifier_name
trait-static-method-generic-inference.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 ...
(&self) { } } pub struct Foo { dummy: (), } impl HasNew<Foo> for Foo { fn new() -> Foo { Foo { dummy: () } } } } pub fn foo() { let _f: base::Foo = base::HasNew::new(); //~^ ERROR type annotations required } fn main() { }
dummy
identifier_name
trait-static-method-generic-inference.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 ...
fn main() { }
}
random_line_split
svm_classifier.py
from oct2py import octave from cvxopt import matrix, solvers from cvxpy import * import numpy as np def svm_classifier(X, y,mode):
A=temp_a else: A=np.concatenate((A,temp_a),axis=0) dum_concat=-np.concatenate((np.zeros((num_sample,d+1)),np.eye(num_sample)),axis=1) A=np.concatenate((A,dum_concat),axis=0); beq=np.zeros((1+d+num_sample,1)); Aeq=np.concatenate((np.zeros((d+1,1)),np.ones((num_sample,1))-mode_control),axis=0); Aeq=np.diag(A...
[num_sample,d]=X.shape mode_control=np.ones((num_sample,1)) for i in range(num_sample): if(mode==1): if(y[i]==-1): mode_control[i]=0; if(mode==2): if(y[i]==1): mode_control[i]=0; if(mode==4): mode_control[i]=0; #[G,beta]= octave.PWL_feature(X, M, beta_type); A=np.array...
identifier_body
svm_classifier.py
from oct2py import octave from cvxopt import matrix, solvers from cvxpy import * import numpy as np def svm_classifier(X, y,mode): [num_sample,d]=X.shape mode_control=np.ones((num_sample,1)) for i in range(num_sample):
if(y[i]==1): mode_control[i]=0; if(mode==4): mode_control[i]=0; #[G,beta]= octave.PWL_feature(X, M, beta_type); A=np.array([[]]) for i in range(num_sample): s=np.zeros((1,num_sample)); s[0,i]=1; temp_1=y[i]*np.concatenate((np.array([[1]]),[X[i,:]]),axis=1) temp_a=-np.concatenate((tem...
if(mode==1): if(y[i]==-1): mode_control[i]=0; if(mode==2):
random_line_split
svm_classifier.py
from oct2py import octave from cvxopt import matrix, solvers from cvxpy import * import numpy as np def
(X, y,mode): [num_sample,d]=X.shape mode_control=np.ones((num_sample,1)) for i in range(num_sample): if(mode==1): if(y[i]==-1): mode_control[i]=0; if(mode==2): if(y[i]==1): mode_control[i]=0; if(mode==4): mode_control[i]=0; #[G,beta]= octave.PWL_feature(X, M, beta_type...
svm_classifier
identifier_name
svm_classifier.py
from oct2py import octave from cvxopt import matrix, solvers from cvxpy import * import numpy as np def svm_classifier(X, y,mode): [num_sample,d]=X.shape mode_control=np.ones((num_sample,1)) for i in range(num_sample): if(mode==1):
if(mode==2): if(y[i]==1): mode_control[i]=0; if(mode==4): mode_control[i]=0; #[G,beta]= octave.PWL_feature(X, M, beta_type); A=np.array([[]]) for i in range(num_sample): s=np.zeros((1,num_sample)); s[0,i]=1; temp_1=y[i]*np.concatenate((np.array([[1]]),[X[i,:]]),axis=1) temp_a=-...
if(y[i]==-1): mode_control[i]=0;
conditional_block
tests.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest import slopos class TestTagger(unittest.TestCase): def setUp(self): slopos.load_from_path("slopos/sl-tagger.pickle") def
(self): tagged = slopos.tag("To je test.") self.assertEqual(tagged, [('To', 'ZK-SEI'), ('je', 'GP-STE-N'), ('test', 'SOMETN'), ('.', '-None-')]) def testListTagging(self): tagged = slopos.tag(["To", "je", "test"]) self.assertEqual(tagged, [('To', 'ZK-SEI'), ('je', 'GP-STE-N'), ('tes...
testSentenceTagging
identifier_name
tests.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest import slopos class TestTagger(unittest.TestCase): def setUp(self): slopos.load_from_path("slopos/sl-tagger.pickle") def testSentenceTagging(self):
def testListTagging(self): tagged = slopos.tag(["To", "je", "test"]) self.assertEqual(tagged, [('To', 'ZK-SEI'), ('je', 'GP-STE-N'), ('test', 'SOMETN')]) def testUnicodeSentenceTagging(self): tagged = slopos.tag("V kožuščku zelene lisice stopiclja jezen otrok.") self.assertEqu...
tagged = slopos.tag("To je test.") self.assertEqual(tagged, [('To', 'ZK-SEI'), ('je', 'GP-STE-N'), ('test', 'SOMETN'), ('.', '-None-')])
identifier_body
tests.py
# -*- coding: utf-8 -*-
def setUp(self): slopos.load_from_path("slopos/sl-tagger.pickle") def testSentenceTagging(self): tagged = slopos.tag("To je test.") self.assertEqual(tagged, [('To', 'ZK-SEI'), ('je', 'GP-STE-N'), ('test', 'SOMETN'), ('.', '-None-')]) def testListTagging(self): tagged = slo...
from __future__ import unicode_literals import unittest import slopos class TestTagger(unittest.TestCase):
random_line_split
tests.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest import slopos class TestTagger(unittest.TestCase): def setUp(self): slopos.load_from_path("slopos/sl-tagger.pickle") def testSentenceTagging(self): tagged = slopos.tag("To je test.") self.assertEqual(tagge...
st.main()
conditional_block
elemwise.py
"""Elementwise operators""" from __future__ import absolute_import as _abs import tvm from .. import tag from ..util import get_const_int @tvm.tag_scope(tag=tag.ELEMWISE) def relu(x): """Take relu of input x. Parameters ---------- x : tvm.Tensor Input argument. Returns ------- y :...
(x, slope, axis=1): """ PReLU. It accepts two arguments: an input ``x`` and a weight array ``W`` and computes the output as :math:`PReLU(x) y = x > 0 ? x : W * x`, where :math:`*` is an elementwise multiplication for each sample in the batch. Arguments: x : tvm.Tensor Input argument....
prelu
identifier_name
elemwise.py
"""Elementwise operators""" from __future__ import absolute_import as _abs import tvm from .. import tag from ..util import get_const_int @tvm.tag_scope(tag=tag.ELEMWISE) def relu(x): """Take relu of input x. Parameters ---------- x : tvm.Tensor Input argument. Returns ------- y :...
[http://arxiv.org/pdf/1502.01852v1.pdf] """ assert len(x.shape) == 4 and len(slope.shape) == 1 assert axis < len(x.shape) assert get_const_int(slope.shape[0]) == get_const_int(x.shape[axis]) def _compute_channelwise(*indices): return tvm.select(x(*indices) > 0, x(*indices), x(*indi...
""" PReLU. It accepts two arguments: an input ``x`` and a weight array ``W`` and computes the output as :math:`PReLU(x) y = x > 0 ? x : W * x`, where :math:`*` is an elementwise multiplication for each sample in the batch. Arguments: x : tvm.Tensor Input argument. slope : tvm.Tensor...
identifier_body
elemwise.py
"""Elementwise operators""" from __future__ import absolute_import as _abs import tvm from .. import tag from ..util import get_const_int @tvm.tag_scope(tag=tag.ELEMWISE) def relu(x): """Take relu of input x. Parameters ---------- x : tvm.Tensor Input argument. Returns ------- y :...
Channelised slope tensor for prelu axis : int The axis where the channel data needs to be applied Returns: y : tvm.Tensor The result. Links: [http://arxiv.org/pdf/1502.01852v1.pdf] """ assert len(x.shape) == 4 and len(slope.shape) == 1 assert axis < len(x....
Input argument. slope : tvm.Tensor
random_line_split
webpack.config.babel.js
/* eslint no-console:"off" */ const {resolve} = require('path'); const webpack = require('webpack'); const {getIfUtils, removeEmpty} = require('webpack-config-utils'); module.exports = env => { const {ifProd, ifNotProd} = getIfUtils(env); const config = { context: resolve('src'), entry: { app: './ind...
return config; };
{ console.log(config); debugger // eslint-disable-line }
conditional_block
webpack.config.babel.js
/* eslint no-console:"off" */ const {resolve} = require('path'); const webpack = require('webpack'); const {getIfUtils, removeEmpty} = require('webpack-config-utils'); module.exports = env => { const {ifProd, ifNotProd} = getIfUtils(env); const config = { context: resolve('src'), entry: { app: './ind...
library: 'TransifexApi', }, devtool: ifProd('source-map', 'eval'), module: { loaders: [ {test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/} ], }, plugins: removeEmpty([ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: ifProd('"pr...
}, output: { path: 'dist', filename: 'transifex-api.min.js', libraryTarget: 'umd',
random_line_split
class-implement-trait-cross-crate.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
how_hungry : int, name : String, } impl cat { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { println!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { println!("Not hungry!"); return false; } } }...
struct cat { meows: uint,
random_line_split
class-implement-trait-cross-crate.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
} } impl noisy for cat { fn speak(&mut self) { self.meow(); } } impl cat { fn meow(&mut self) { println!("Meow"); self.meows += 1u; if self.meows % 5u == 0u { self.how_hungry += 1; } } } fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { ...
{ println!("Not hungry!"); return false; }
conditional_block
class-implement-trait-cross-crate.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{ meows: uint, how_hungry : int, name : String, } impl cat { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { println!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { println!("Not hungry!"); return false...
cat
identifier_name
class-implement-trait-cross-crate.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{ let mut nyan = cat(0u, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); for _ in 1u..10u { nyan.speak(); }; assert!((nyan.eat())); }
identifier_body
platforms.js
/** 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 "License"...
version: '3.1.0' } }; var addModuleProperty = require('./src/util').addModuleProperty; Object.keys(module.exports).forEach(function(key) { var obj = module.exports[key]; if (obj.parser) { addModuleProperty(module, 'parser', obj.parser, false, obj); } });
random_line_split
platforms.js
/** 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 "License"...
});
{ addModuleProperty(module, 'parser', obj.parser, false, obj); }
conditional_block
index.d.ts
// Type definitions for jQuery Knob 1.2.13 // Project: http://anthonyterrien.com/knob/ // Definitions by: Iain Buchanan <https://github.com/iain8> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// <reference types="jquery" /> declare namespace JQueryKnob { export in...
/** * triggered on [esc] keydown */ cancel?: () => void; /** * allows to format output (add unit %, ms...) */ format?: (value: number) => void; } } interface JQuery { /** * Create a knob for the given input field, with optional options ...
change?: (value: number) => void; /** * when drawing the canvas */ draw?: () => void;
random_line_split
Type.py
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # Redistributions of source code must reta...
def get_type (type_id): q = "SELECT id, type "\ "FROM asset_types WHERE id=%(type_id)s;" % locals() query = Query(q) if len(query) != 1: return None ret = {'id': type_id, 'name': query['type'][0]} return ret def get_types (): q = "SELECT id, type "...
l = get_type (type_id) if not l: return None return l['name']
identifier_body
Type.py
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # Redistributions of source code must reta...
return ret def test (): import sys try: type_id = sys.argv[1] except IndexError: print 'Required test parameters: type_id' sys.exit(1) print 'Types:', get_types() print 'type_id %s, type_name %s' % (type_id, get_type_name(type_id)) print get_type(type_id), if __...
d={'id': query[x]['id'], 'name': query[x]['type']} ret.append(d)
conditional_block
Type.py
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # Redistributions of source code must reta...
try: type_id = sys.argv[1] except IndexError: print 'Required test parameters: type_id' sys.exit(1) print 'Types:', get_types() print 'type_id %s, type_name %s' % (type_id, get_type_name(type_id)) print get_type(type_id), if __name__ == '__main__': test()
random_line_split
Type.py
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # Redistributions of source code must reta...
(type_id): q = "SELECT id, type "\ "FROM asset_types WHERE id=%(type_id)s;" % locals() query = Query(q) if len(query) != 1: return None ret = {'id': type_id, 'name': query['type'][0]} return ret def get_types (): q = "SELECT id, type "\ "FRO...
get_type
identifier_name
test_set_start_page01.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013, John McNamara, jmcnamara@cpan.org # import unittest import os from ...workbook import Workbook from ..helperfunctions import _compare_xlsx_files class TestCompareXLSXFiles(unittest.TestC...
def test_create_file(self): """Test the creation of a simple XlsxWriter file with printer settings.""" filename = self.got_filename #################################################### workbook = Workbook(filename) worksheet = workbook.add_worksheet() worksheet....
self.maxDiff = None filename = 'set_start_page01.xlsx' test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename self.exp_filename = test_dir + 'xlsx_files/' + filename self.ignore_files = ['xl/printerSettings/printerSettings1.bin', ...
identifier_body
test_set_start_page01.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013, John McNamara, jmcnamara@cpan.org # import unittest import os from ...workbook import Workbook from ..helperfunctions import _compare_xlsx_files class TestCompareXLSXFiles(unittest.TestC...
unittest.main()
conditional_block
test_set_start_page01.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013, John McNamara, jmcnamara@cpan.org # import unittest import os from ...workbook import Workbook from ..helperfunctions import _compare_xlsx_files class TestCompareXLSXFiles(unittest.TestC...
worksheet = workbook.add_worksheet() worksheet.set_start_page(1) worksheet.set_paper(9) worksheet.write('A1', 'Foo') workbook.close() #################################################### got, exp = _compare_xlsx_files(self.got_filename, ...
workbook = Workbook(filename)
random_line_split
test_set_start_page01.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013, John McNamara, jmcnamara@cpan.org # import unittest import os from ...workbook import Workbook from ..helperfunctions import _compare_xlsx_files class
(unittest.TestCase): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.maxDiff = None filename = 'set_start_page01.xlsx' test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename se...
TestCompareXLSXFiles
identifier_name
mod.rs
// Copyright 2015-2017 Intecture Developers. // // Licensed under the Mozilla Public License 2.0 <LICENSE or // https://www.tldrlegal.com/l/mpl-2.0>. This file may not be copied, // modified, or distributed except according to those terms. //! Manages the connection between the API and a server. pub mod local; pub mo...
(&self, request: Request) -> Box<Future<Item = Message<Response, Body<Vec<u8>, io::Error>>, Error = Error>> { self.request_msg(Message::WithoutBody(request)) } #[doc(hidden)] fn request_msg(&self, Message<Request, Body<Vec<u8>, io::Error>>) -> Box<Future<Item = Message<Response, ...
request
identifier_name
mod.rs
// Copyright 2015-2017 Intecture Developers. // // Licensed under the Mozilla Public License 2.0 <LICENSE or // https://www.tldrlegal.com/l/mpl-2.0>. This file may not be copied, // modified, or distributed except according to those terms. //! Manages the connection between the API and a server. pub mod local; pub mo...
use tokio_core::reactor::Handle; use tokio_proto::streaming::{Body, Message}; /// Trait for local and remote host types. pub trait Host: Clone { /// Get `Telemetry` for this host. fn telemetry(&self) -> &Telemetry; /// Get `Handle` to Tokio reactor. fn handle(&self) -> &Handle; #[doc(hidden)] f...
use futures::Future; use remote::{Request, Response}; use std::io; use telemetry::Telemetry;
random_line_split
mod.rs
// Copyright 2015-2017 Intecture Developers. // // Licensed under the Mozilla Public License 2.0 <LICENSE or // https://www.tldrlegal.com/l/mpl-2.0>. This file may not be copied, // modified, or distributed except according to those terms. //! Manages the connection between the API and a server. pub mod local; pub mo...
#[doc(hidden)] fn request_msg(&self, Message<Request, Body<Vec<u8>, io::Error>>) -> Box<Future<Item = Message<Response, Body<Vec<u8>, io::Error>>, Error = Error>>; }
{ self.request_msg(Message::WithoutBody(request)) }
identifier_body
ui.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 ...
.subcommand(SubCommand::with_name("import") .about("Import contacts") .version("0.1") .arg(Arg::with_name("path") .index(1) .takes_value(true) .required(true) ...
{ app .subcommand(SubCommand::with_name("list") .about("List contacts") .version("0.1") .arg(Arg::with_name("filter") .index(1) .takes_value(true) .required(false) ...
identifier_body
ui.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 ...
.value_name("FORMAT") .help("Format to format the contact when printing it")) ) .subcommand(SubCommand::with_name("create") .about("Create a contact file (.vcf) and track it in imag.") .version("0.1") ...
.takes_value(true) .required(false) .multiple(false)
random_line_split
ui.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 ...
<'a>(app: App<'a, 'a>) -> App<'a, 'a> { app .subcommand(SubCommand::with_name("list") .about("List contacts") .version("0.1") .arg(Arg::with_name("filter") .index(1) .takes_value(true) ...
build_ui
identifier_name
tokens.ts
import { OpaqueToken } from '@angular/core'; import { APP_BASE_HREF } from '@angular/common'; export { APP_BASE_HREF } from '@angular/common'; // export const BASE_URL: OpaqueToken = APP_BASE_HREF; export const ORIGIN_URL: OpaqueToken = new OpaqueToken('ORIGIN_URL'); export const REQUEST_URL: OpaqueToken = new OpaqueT...
(config) { return getUrlConfig() .filter((provider) => (provider.useValue in config)) .map((provider) => { const key = provider.useValue; provider.useValue = config[key]; return provider; }); }
createUrlProviders
identifier_name
tokens.ts
import { OpaqueToken } from '@angular/core'; import { APP_BASE_HREF } from '@angular/common'; export { APP_BASE_HREF } from '@angular/common'; // export const BASE_URL: OpaqueToken = APP_BASE_HREF; export const ORIGIN_URL: OpaqueToken = new OpaqueToken('ORIGIN_URL'); export const REQUEST_URL: OpaqueToken = new OpaqueT...
export function getUrlConfig() { return [ { provide: APP_BASE_HREF, useValue: 'baseUrl' }, { provide: REQUEST_URL, useValue: 'requestUrl' }, { provide: ORIGIN_URL, useValue: 'originUrl' } ] } // @internal export function createUrlProviders(config) { return getUrlConfig() .filter((provider) => (pr...
// @internal
random_line_split
tokens.ts
import { OpaqueToken } from '@angular/core'; import { APP_BASE_HREF } from '@angular/common'; export { APP_BASE_HREF } from '@angular/common'; // export const BASE_URL: OpaqueToken = APP_BASE_HREF; export const ORIGIN_URL: OpaqueToken = new OpaqueToken('ORIGIN_URL'); export const REQUEST_URL: OpaqueToken = new OpaqueT...
// @internal export function createUrlProviders(config) { return getUrlConfig() .filter((provider) => (provider.useValue in config)) .map((provider) => { const key = provider.useValue; provider.useValue = config[key]; return provider; }); }
{ return [ { provide: APP_BASE_HREF, useValue: 'baseUrl' }, { provide: REQUEST_URL, useValue: 'requestUrl' }, { provide: ORIGIN_URL, useValue: 'originUrl' } ] }
identifier_body
css.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/. */ use cssparser::{Parser, serialize_identifier}; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding:...
(_: &Window, ident: DOMString) -> Fallible<DOMString> { let mut escaped = String::new(); serialize_identifier(&ident, &mut escaped).unwrap(); Ok(DOMString::from(escaped)) } /// https://drafts.csswg.org/css-conditional/#dom-css-supports pub fn Supports(win: &Window, property: DOMStri...
Escape
identifier_name
css.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/. */ use cssparser::{Parser, serialize_identifier}; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding:...
else { false } } }
{ let url = win.Document().url(); let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Supports), PARSING_MODE_DEFAULT, QuirksMode::NoQuirks); ...
conditional_block
css.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/. */ use cssparser::{Parser, serialize_identifier}; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding:...
pub fn Supports_(win: &Window, condition: DOMString) -> bool { let mut input = Parser::new(&condition); let cond = parse_condition_or_declaration(&mut input); if let Ok(cond) = cond { let url = win.Document().url(); let context = ParserContext::new_for_cssom(&url, win...
/// https://drafts.csswg.org/css-conditional/#dom-css-supports
random_line_split
title.rs
// Copyright 2013 The GLFW-RS Developers. For a full listing of the authors, // refer to the AUTHORS file at the top-level directory of this distribution. // // 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...
glfw::KeyEvent(glfw::KeyEscape, _, glfw::Press, _) => { window.set_should_close(true) } _ => {} } }
identifier_body
title.rs
// Copyright 2013 The GLFW-RS Developers. For a full listing of the authors, // refer to the AUTHORS file at the top-level directory of this distribution. // // 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...
} }
set_should_close(true) } _ => {}
conditional_block
title.rs
// Copyright 2013 The GLFW-RS Developers. For a full listing of the authors, // refer to the AUTHORS file at the top-level directory of this distribution. // // 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...
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. extern crate native; extern crate glfw; use glfw::Context; #[start] fn start(argc: int, argv: *const *const u8) -> int { native::sta...
// // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS,
random_line_split
title.rs
// Copyright 2013 The GLFW-RS Developers. For a full listing of the authors, // refer to the AUTHORS file at the top-level directory of this distribution. // // 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...
(argc: int, argv: *const *const u8) -> int { native::start(argc, argv, main) } fn main() { let glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap(); let (window, events) = glfw.create_window(400, 400, "English 日本語 русский язык 官話", glfw::Windowed) .expect("Failed to create GLFW window."); window....
start
identifier_name
formfields.py
# coding: utf-8 # Copyright (c) 2012, SciELO <scielo-dev@googlegroups.com> # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # Redistributions of source code must retain the above copyright not...
if value is not u'' and value is not None: result = re.match(self.regex, value) if result is None: raise forms.ValidationError(self.error_messages['invalid']) return value
identifier_body
formfields.py
# coding: utf-8 # Copyright (c) 2012, SciELO <scielo-dev@googlegroups.com> # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # Redistributions of source code must retain the above copyright not...
(forms.CharField): default_error_messages = { 'invalid': _('Enter a valid ISSN.') } regex = r'[0-9]{4}-[0-9]{3}[0-9X]{1}$' def clean(self, value): if value is not u'' and value is not None: result = re.match(self.regex, value) if result is None: rais...
ISSNField
identifier_name
formfields.py
# coding: utf-8 # Copyright (c) 2012, SciELO <scielo-dev@googlegroups.com>
# Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other mat...
# All rights reserved. # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met:
random_line_split
formfields.py
# coding: utf-8 # Copyright (c) 2012, SciELO <scielo-dev@googlegroups.com> # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # Redistributions of source code must retain the above copyright not...
return value
raise forms.ValidationError(self.error_messages['invalid'])
conditional_block
test_instrument.py
import os import json from nose.tools import assert_equal from .project import load_lsdsng from .utils import temporary_file SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) def _test_load_store_instrument(source_lsdsng, lsdinst_path, original_index):
def test_load_store_wave_instrument(): _test_load_store_instrument( os.path.join(SCRIPT_DIR, 'test_data', 'UNTOLDST.lsdsng'), os.path.join(SCRIPT_DIR, 'test_data', 'UNTOLDST_0x00_wave.lsdinst'), 0x00) def test_load_store_pulse_instrument(): _test_load_store_instrument( os.pat...
proj = load_lsdsng(source_lsdsng) proj.song.instruments.import_from_file(0x2a, lsdinst_path) target_instr = proj.song.instruments[0x2a] original_instr = proj.song.instruments[original_index] assert_equal(original_instr, target_instr) with temporary_file() as tmpfile: original_instr.export...
identifier_body
test_instrument.py
import os import json from nose.tools import assert_equal from .project import load_lsdsng from .utils import temporary_file SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) def _test_load_store_instrument(source_lsdsng, lsdinst_path, original_index): proj = load_lsdsng(source_lsdsng) proj.song.instr...
(): _test_load_store_instrument( os.path.join(SCRIPT_DIR, 'test_data', 'UNTOLDST.lsdsng'), os.path.join(SCRIPT_DIR, 'test_data', 'UNTOLDST_0x16_kit.lsdinst'), 0x16) def test_load_store_noise_instrument(): _test_load_store_instrument( os.path.join(SCRIPT_DIR, 'test_data', 'ANNARK...
test_load_store_kit_instrument
identifier_name
test_instrument.py
import os import json from nose.tools import assert_equal from .project import load_lsdsng from .utils import temporary_file SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
def _test_load_store_instrument(source_lsdsng, lsdinst_path, original_index): proj = load_lsdsng(source_lsdsng) proj.song.instruments.import_from_file(0x2a, lsdinst_path) target_instr = proj.song.instruments[0x2a] original_instr = proj.song.instruments[original_index] assert_equal(original_instr,...
random_line_split
addQuestion.component.ts
import { Component, Output, EventEmitter, AfterViewInit, OnInit, } from '@angular/core'; import { Router, ActivatedRoute, Params } from '@angular/router'; import { AuthService, ApiService, LoadingService, LoggerService, ErrorService, PopupService, } from "./../../../services"; import { Course,...
); } }
random_line_split
addQuestion.component.ts
import { Component, Output, EventEmitter, AfterViewInit, OnInit, } from '@angular/core'; import { Router, ActivatedRoute, Params } from '@angular/router'; import { AuthService, ApiService, LoadingService, LoggerService, ErrorService, PopupService, } from "./../../../services"; import { Course,...
.setCurtain(); this._courseLoading = true; this._api.postAddQuestion(this.course, this.question).subscribe( data => { this._logger.debug(data); this._router.navigateByUrl('courses/' + this.course.id); }, err => { this._error.errorInit(err); /** * Popu...
this._loading
identifier_name
font.rs
64; pub type FontTableTag = u32; trait FontTableTagConversions { fn tag_to_str(&self) -> String; } impl FontTableTagConversions for FontTableTag { fn tag_to_str(&self) -> String { let bytes = [(self >> 24) as u8, (self >> 16) as u8, (self >> 8) as u8, ...
else { "Didn't find" }; debug!("{} font table[{}] with family={}, face={}", status, tag.tag_to_str(), self.handle.family_name(), self.handle.face_name().unwrap_or("unavailable".to_owned())); result } #[inline] pub fn glyph_index(&self, codepoint: char) -> Op...
{ "Found" }
conditional_block