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
jflapfile.py
from filetypes.basefile import BaseFile from filetypes.plainfile import PlainFile from filetypes.plainfile import ReviewTest import filetypes class JFLAPReviewTest(ReviewTest):
def __init__(self, dict_, file_type): super().__init__(dict_, file_type) def run(self, path): """A JFLAP review test calls the ReviewTest run() method but suppresses printing the file. """ return super().run(path, False) class JFLAPFile(PlainFile): yaml_type = 'jf...
random_line_split
can_deactivate_example.ts
import {provide, Component, ComponentRef} from '@angular/core'; import {bootstrap} from '@angular/platform-browser-dynamic'; import { CanDeactivate, RouteConfig, RouteParams, ComponentInstruction, ROUTER_DIRECTIVES } from '@angular/router-deprecated'; import {APP_BASE_HREF} from '@angular/common'; // #docreg...
template: ` <h1>My App</h1> <router-outlet></router-outlet> `, directives: [ROUTER_DIRECTIVES] }) @RouteConfig([ {path: '/note/:id', component: NoteCmp, name: 'NoteCmp'}, {path: '/', component: NoteIndexCmp, name: 'NoteIndexCmp'} ]) export class AppCmp { } export function main(): Promise<ComponentRe...
@Component({ selector: 'example-app',
random_line_split
can_deactivate_example.ts
import {provide, Component, ComponentRef} from '@angular/core'; import {bootstrap} from '@angular/platform-browser-dynamic'; import { CanDeactivate, RouteConfig, RouteParams, ComponentInstruction, ROUTER_DIRECTIVES } from '@angular/router-deprecated'; import {APP_BASE_HREF} from '@angular/common'; // #docreg...
implements CanDeactivate { id: string; constructor(params: RouteParams) { this.id = params.get('id'); } routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) { return confirm('Are you sure you want to leave?'); } } // #enddocregion @Component({ selector: 'note-index-cmp', temp...
NoteCmp
identifier_name
Assembly_it.ts
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="it" sourcelanguage="en"> <context> <name>AssemblyGui::Workbench</name> <message> <location filename="../../Workbench.cpp" line="+50"/> <source>Assembly</source> <translation>Assembly</translation> </mess...
</TS>
</context>
random_line_split
boilerpipe-parser.ts
import { browser } from 'webextension-polyfill-ts'; import { FailOverlay, GenericOverlay } from '../overlay'; import { Parser } from './parser'; export class BoilerpipeParser extends Parser { constructor(url: string, overlay: GenericOverlay) { const encodedUrl = encodeURIComponent(url); const boil...
public getResponseError(response: Response): string { if (response.status === 503) { console.log('[FullyFeedly] Boilerpipe API exceeded quota'); return 'Boilerpipe API exceeded quota'; } else { return this.getGenericError(); } } }
random_line_split
boilerpipe-parser.ts
import { browser } from 'webextension-polyfill-ts'; import { FailOverlay, GenericOverlay } from '../overlay'; import { Parser } from './parser'; export class BoilerpipeParser extends Parser { constructor(url: string, overlay: GenericOverlay) { const encodedUrl = encodeURIComponent(url); const boil...
// Get the content of the article const articleContent = data.response.content; return articleContent; } public getResponseError(response: Response): string { if (response.status === 503) { console.log('[FullyFeedly] Boilerpipe API exceeded quota'); re...
{ throw false; }
conditional_block
boilerpipe-parser.ts
import { browser } from 'webextension-polyfill-ts'; import { FailOverlay, GenericOverlay } from '../overlay'; import { Parser } from './parser'; export class
extends Parser { constructor(url: string, overlay: GenericOverlay) { const encodedUrl = encodeURIComponent(url); const boilerpipeUrl = `https://boilerpipe-web.appspot.com/extract?url=${encodedUrl}&extractor=ArticleExtractor&output=json&extractImages=`; super(boilerpipeUrl, overlay); } ...
BoilerpipeParser
identifier_name
mod.rs
This invariant is enforced by the lint in //! `plugins::lints::inheritance_integrity`. //! //! Interfaces which either derive from or are derived by other interfaces //! implement the `Castable` trait, which provides three methods `is::<T>()`, //! `downcast::<T>()` and `upcast::<T>()` to cast across the type hierarchy...
pub mod htmlstyleelement; pub mod htmltablecaptionelement; pub mod htmltablecellelement;
random_line_split
index.ts
import type { FormatLong } from '../../../types' import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index' const dateFormats = { full: 'eeee d. MMMM y', long: 'd. MMMM y', medium: 'd. MMM y', short: 'd.M.y', } const timeFormats = { full: 'HH.mm.ss zzzz', long: 'HH.mm.ss z', medium: 'HH.mm.ss...
long: "{{date}} 'klo' {{time}}", medium: '{{date}} {{time}}', short: '{{date}} {{time}}', } const formatLong: FormatLong = { date: buildFormatLongFn({ formats: dateFormats, defaultWidth: 'full', }), time: buildFormatLongFn({ formats: timeFormats, defaultWidth: 'full', }), dateTime: bu...
random_line_split
iscroll-lite.d.ts
// Type definitions for iScroll Lite 4.1 // Project: http://cubiq.org/iscroll-4 // Definitions by: Boris Yankov <https://github.com/borisyankov/> // Definitions: https://github.com/borisyankov/DefinitelyTyped
} interface iScrollOptions { hScroll?: boolean; vScroll?: boolean; x?: number; y?: number; bounce?: boolean; bounceLock?: boolean; momentum?: boolean; lockDirection?: boolean; useTransform?: boolean; useTransition?: boolean; // Events onRefresh?: iScrollE...
interface iScrollEvent { (e: Event): void;
random_line_split
iscroll-lite.d.ts
// Type definitions for iScroll Lite 4.1 // Project: http://cubiq.org/iscroll-4 // Definitions by: Boris Yankov <https://github.com/borisyankov/> // Definitions: https://github.com/borisyankov/DefinitelyTyped interface iScrollEvent { (e: Event): void; } interface iScrollOptions { hScroll?: boolean...
{ constructor (element: string); constructor (element: string, options: iScrollOptions); destroy(): void; refresh(): void; scrollTo(x: number, y: number, time: number, relative: boolean): void; scrollToElement(element: string, time: number): void; disable(): void; enalbe(): ...
iScroll
identifier_name
app.component.ts
Encapsulation, OnInit, OnDestroy, ViewChildren, AfterViewInit, QueryList, ElementRef } from '@angular/core'; import { Router, NavigationStart } from '@angular/router'; import { ToastaService, ToastaConfig, ToastOptions, ToastData } from 'ngx-toasta'; import { ModalDirective } from 'ngx-bootstrap/modal'; import { Alert...
if (e) { dialog.okCallback(); } else { if (dialog.cancelCallback) { dialog.cancelCallback(); } } }); break; case DialogType.prompt: alertify .prompt(dialog.message, (e, val) => { ...
alertify .confirm(dialog.message, (e) => {
random_line_split
app.component.ts
apsulation, OnInit, OnDestroy, ViewChildren, AfterViewInit, QueryList, ElementRef } from '@angular/core'; import { Router, NavigationStart } from '@angular/router'; import { ToastaService, ToastaConfig, ToastOptions, ToastData } from 'ngx-toasta'; import { ModalDirective } from 'ngx-bootstrap/modal'; import { AlertSer...
} }); }); } onLoginModalShown() { this.alertService.showStickyMessage('Session Expired', 'Your Session has expired. Please log in again', MessageSeverity.info); } onLoginModalHidden() { this.alertService.resetStickyMessage(); this.loginControl.reset(); this.shouldShowLogin...
{ this.loginModal = control; this.loginModal.show(); }
conditional_block
app.component.ts
apsulation, OnInit, OnDestroy, ViewChildren, AfterViewInit, QueryList, ElementRef } from '@angular/core'; import { Router, NavigationStart } from '@angular/router'; import { ToastaService, ToastaConfig, ToastOptions, ToastData } from 'ngx-toasta'; import { ModalDirective } from 'ngx-bootstrap/modal'; import { AlertSer...
implements OnInit, AfterViewInit, OnDestroy { isAppLoaded: boolean; isUserLoggedIn: boolean; shouldShowLoginModal: boolean; removePrebootScreen: boolean; newNotificationCount = 0; appTitle = 'QuickApp'; stickyToasties: number[] = []; dataLoadingConsecutiveFailures = 0; notificationsLoadingSubscrip...
AppComponent
identifier_name
app.component.ts
apsulation, OnInit, OnDestroy, ViewChildren, AfterViewInit, QueryList, ElementRef } from '@angular/core'; import { Router, NavigationStart } from '@angular/router'; import { ToastaService, ToastaConfig, ToastOptions, ToastData } from 'ngx-toasta'; import { ModalDirective } from 'ngx-bootstrap/modal'; import { AlertSer...
markNotificationsAsRead() { const recentNotifications = this.notificationService.recentNotifications; if (recentNotifications.length) { this.notificationService.readUnreadNotification(recentNotifications.map(n => n.id), true) .subscribe(response => { for (const n of recentNotifica...
{ this.notificationsLoadingSubscription = this.notificationService.getNewNotificationsPeriodically() .subscribe(notifications => { this.dataLoadingConsecutiveFailures = 0; this.newNotificationCount = notifications.filter(n => !n.isRead).length; }, error => { this.alert...
identifier_body
empty_type_args.d.ts
declare namespace ಠ_ಠ.clutz.empty_type_args { interface ITemplated < T > { } } declare module 'goog:empty_type_args.ITemplated' { import alias = ಠ_ಠ.clutz.empty_type_args.ITemplated; export default alias; } declare namespace ಠ_ಠ.clutz.empty_type_args { class NoMoreTemplateArgs extends NoMoreTemplateArgs_Insta...
s X_Instance { private noStructuralTyping_: any; constructor (a : ಠ_ಠ.clutz.empty_type_args.NoMoreTemplateArgs ) ; } } declare namespace ಠ_ಠ.clutz.goog { function require(name: 'empty_type_args.X'): typeof ಠ_ಠ.clutz.empty_type_args.X; } declare module 'goog:empty_type_args.X' { import alias = ಠ_ಠ.clutz.em...
s
identifier_name
empty_type_args.d.ts
declare namespace ಠ_ಠ.clutz.empty_type_args { interface ITemplated < T > { } } declare module 'goog:empty_type_args.ITemplated' { import alias = ಠ_ಠ.clutz.empty_type_args.ITemplated; export default alias; } declare namespace ಠ_ಠ.clutz.empty_type_args { class NoMoreTemplateArgs extends NoMoreTemplateArgs_Insta...
function require(name: 'empty_type_args.X'): typeof ಠ_ಠ.clutz.empty_type_args.X; } declare module 'goog:empty_type_args.X' { import alias = ಠ_ಠ.clutz.empty_type_args.X; export default alias; }
declare namespace ಠ_ಠ.clutz.goog {
random_line_split
test_static.py
import pytest import sys import unittest from ..backends import static # There aren't many tests here because it turns out to be way more convenient to # use test_serializer for the majority of cases @pytest.mark.xfail(sys.version[0] == "3", reason="wptmanifest.parser doesn't support py3") class ...
def test_get_4(self): data = """key: if not a: value_1 value_2 """ manifest = self.compile(data, {"a": True}) self.assertEquals(manifest.get("key"), "value_2") manifest = self.compile(data, {"a": False}) self.assertEquals(manifest.get("key"), "value_1") def test_a...
data = """key: if a == "1": value_1 if a[0] == "ab"[0]: value_2 """ manifest = self.compile(data, {"a": "1"}) self.assertEquals(manifest.get("key"), "value_1") manifest = self.compile(data, {"a": "ac"}) self.assertEquals(manifest.get("key"), "value_2")
identifier_body
test_static.py
import pytest import sys import unittest from ..backends import static # There aren't many tests here because it turns out to be way more convenient to # use test_serializer for the majority of cases @pytest.mark.xfail(sys.version[0] == "3", reason="wptmanifest.parser doesn't support py3") class ...
(self): data = """key: if a == 1.5: value_1 value_2 key_1: other_value """ manifest = self.compile(data, {"a": 1.5}) self.assertFalse(manifest.is_empty) self.assertEquals(manifest.root, manifest) self.assertTrue(manifest.has_key("key_1")) self.assertFalse(manifest.ha...
test_api
identifier_name
test_static.py
import pytest import sys import unittest from ..backends import static # There aren't many tests here because it turns out to be way more convenient to # use test_serializer for the majority of cases @pytest.mark.xfail(sys.version[0] == "3", reason="wptmanifest.parser doesn't support py3") class ...
""" manifest = self.compile(data, {"a": True}) self.assertEquals(manifest.get("key"), "value_2") manifest = self.compile(data, {"a": False}) self.assertEquals(manifest.get("key"), "value_1") def test_api(self): data = """key: if a == 1.5: value_1 value_2 key_1: other_va...
if not a: value_1 value_2
random_line_split
libraryloader.py
LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY,...
# errors mode = ctypes.RTLD_GLOBAL def getplatformpaths(self, libname): if os.path.pathsep in libname: names = [libname] else: names = [fmt % libname for fmt in self.name_formats] for directory in self.getdirs(libname): for name in names:...
"""Library loader for MacOS""" name_formats = [ "lib%s.dylib", "lib%s.so", "lib%s.bundle", "%s.dylib", "%s.so", "%s.bundle", "%s", ] class Lookup(LibraryLoader.Lookup): """ Looking up library files for this platform (Darwin aka MacOS)...
identifier_body
libraryloader.py
OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # ---------------------------------------------------------------------------- import ctypes import ctypes.util import glob import os.path import platform import re import sys def _environ_path(name...
unix_lib_dirs_list += ["/lib/x86_64-linux-gnu", "/usr/lib/x86_64-linux-gnu"]
conditional_block
libraryloader.py
BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILI...
name_formats = ["%s"] class Lookup(object): # pylint: disable=useless-object-inheritance ## (needed for py27) """Looking up calling conventions for a platform""" mode = ctypes.DEFAULT_MODE def __init__(self, path): super(LibraryLoader.Lookup, self).__init__() ...
random_line_split
libraryloader.py
LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY,...
(self, name, calling_convention="cdecl"): """Return the given name according to the selected calling convention""" if calling_convention not in self.access: raise LookupError( "Unknown calling convention '{}' for function '{}'".format( ...
get
identifier_name
ilm.py
#!/usr/bin/env python from cogent.app.util import CommandLineApplication,\ CommandLineAppResult, ResultPath from cogent.app.parameters import Parameter,ValuedParameter,Parameters __author__ = "Shandy Wikman" __copyright__ = "Copyright 2007-2012, The Cogent Project" __contributors__ = ["Shandy Wikman"] __license__...
Compute a helix plot score matrix from a sequence alignment Options: -b B: Set bad pair penalty to B (Default = 2) -g G: Set good pair score to G (Default = 1) -h H: Set minimum helix length to H (Default = 2) -l L: Set minimum loop length to L (D...
class hlxplot(CommandLineApplication): """Application controller hlxplot application
random_line_split
ilm.py
#!/usr/bin/env python from cogent.app.util import CommandLineApplication,\ CommandLineAppResult, ResultPath from cogent.app.parameters import Parameter,ValuedParameter,Parameters __author__ = "Shandy Wikman" __copyright__ = "Copyright 2007-2012, The Cogent Project" __contributors__ = ["Shandy Wikman"] __license__...
(CommandLineApplication): """Application controller hlxplot application Compute a helix plot score matrix from a sequence alignment Options: -b B: Set bad pair penalty to B (Default = 2) -g G: Set good pair score to G (Default = 1) -h H: Set minimum helix length to H ...
hlxplot
identifier_name
ilm.py
#!/usr/bin/env python from cogent.app.util import CommandLineApplication,\ CommandLineAppResult, ResultPath from cogent.app.parameters import Parameter,ValuedParameter,Parameters __author__ = "Shandy Wikman" __copyright__ = "Copyright 2007-2012, The Cogent Project" __contributors__ = ["Shandy Wikman"] __license__...
_parameters = { '-b':ValuedParameter(Prefix='-',Name='b',Delimiter=' '), '-g':ValuedParameter(Prefix='-',Name='g',Delimiter=' '), '-h':ValuedParameter(Prefix='-',Name='h',Delimiter=' '), '-l':ValuedParameter(Prefix='-',Name='l',Delimiter=' '), '-s':ValuedParameter(Prefix='-'...
"""Application controller hlxplot application Compute a helix plot score matrix from a sequence alignment Options: -b B: Set bad pair penalty to B (Default = 2) -g G: Set good pair score to G (Default = 1) -h H: Set minimum helix length to H (Default = 2) -l...
identifier_body
no_0501_find_mode_in_binary_search_tree.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Answer { base: i32, count: u32, max_count: u32, v: Vec<i32>, } impl Answer { fn new() -> Self { Answer { base: 0, count: 0, max_count: 0, v: Vec::new(), } ...
od tests { use super::*; use crate::common::tree_node; #[test] fn test_find_mode() { let root = tree_node(TreeNode { val: 1, left: None, right: tree_node(TreeNode { val: 2, left: tree_node(TreeNode::new(2)), rig...
ome(r) = root { Self::mid_order(&r.borrow().left, ans); ans.update(r.borrow().val); Self::mid_order(&r.borrow().right, ans); } } } #[cfg(test)] m
identifier_body
no_0501_find_mode_in_binary_search_tree.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Answer { base: i32, count: u32, max_count: u32, v: Vec<i32>, } impl Answer { fn new() -> Self { Answer { base: 0, count: 0, max_count: 0, v: Vec::new(), } ...
ns = Answer::new(); Self::mid_order(&root, &mut ans); ans.v } fn mid_order(root: &Option<Rc<RefCell<TreeNode>>>, ans: &mut Answer) { if let Some(r) = root { Self::mid_order(&r.borrow().left, ans); ans.update(r.borrow().val); Self::mid_order(&r.borrow(...
rn vec![]; } let mut a
conditional_block
no_0501_find_mode_in_binary_search_tree.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Answer { base: i32, count: u32, max_count: u32, v: Vec<i32>, } impl Answer { fn new() -> Self { Answer { base: 0, count: 0, max_count: 0, v: Vec::new(), } ...
Self::mid_order(&r.borrow().right, ans); } } } #[cfg(test)] mod tests { use super::*; use crate::common::tree_node; #[test] fn test_find_mode() { let root = tree_node(TreeNode { val: 1, left: None, right: tree_node(TreeNode { ...
Self::mid_order(&r.borrow().left, ans); ans.update(r.borrow().val);
random_line_split
no_0501_find_mode_in_binary_search_tree.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Answer { base: i32, count: u32, max_count: u32, v: Vec<i32>, } impl Answer { fn
() -> Self { Answer { base: 0, count: 0, max_count: 0, v: Vec::new(), } } fn update(&mut self, n: i32) { if self.base == n { self.count += 1; } else { self.base = n; self.count = 1; } ...
new
identifier_name
CopyTokenDialog.tsx
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope tha...
export default CopyTokenDialog;
{ const { token, onCopy, ...rest } = props; return ( <EnhancedDialog title={<FormattedMessage id="copyTokenDialog.title" defaultMessage="Access Token Created" />} maxWidth="xs" {...rest} > <CopyTokenContainer token={token} onCopy={onCopy} /> </EnhancedDialog> ); }
identifier_body
CopyTokenDialog.tsx
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope tha...
<EnhancedDialog title={<FormattedMessage id="copyTokenDialog.title" defaultMessage="Access Token Created" />} maxWidth="xs" {...rest} > <CopyTokenContainer token={token} onCopy={onCopy} /> </EnhancedDialog> ); } export default CopyTokenDialog;
return (
random_line_split
CopyTokenDialog.tsx
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope tha...
(props: CopyTokenProps) { const { token, onCopy, ...rest } = props; return ( <EnhancedDialog title={<FormattedMessage id="copyTokenDialog.title" defaultMessage="Access Token Created" />} maxWidth="xs" {...rest} > <CopyTokenContainer token={token} onCopy={onCopy} /> </EnhancedDial...
CopyTokenDialog
identifier_name
compare.py
import sparse_interaction from sklearn.datasets import fetch_20newsgroups_vectorized from sklearn.cross_validation import StratifiedKFold from sklearn.linear_model import SGDClassifier from sklearn.metrics import f1_score dat = fetch_20newsgroups_vectorized() X = dat.data Y = dat.target cv = StratifiedKFold(Y) X = X[...
print sum(scores), sum(scores_i)
clf.fit(X[train], Y[train]) scores.append(f1_score(Y[test], clf.predict(X[test]), average='macro', pos_label=None)) clf.fit(X_i[train], Y[train]) scores_i.append(f1_score(Y[test], clf.predict(X_i[test]), average='macro', pos_label=None))
conditional_block
compare.py
import sparse_interaction
from sklearn.datasets import fetch_20newsgroups_vectorized from sklearn.cross_validation import StratifiedKFold from sklearn.linear_model import SGDClassifier from sklearn.metrics import f1_score dat = fetch_20newsgroups_vectorized() X = dat.data Y = dat.target cv = StratifiedKFold(Y) X = X[:, :20000] si = sparse_in...
random_line_split
toc.js
import * as util from "./util"; const path = require("path"); /** * Creates a toc object * @param {Array} items All items of the toc * @param {Array} root Only the root items * @return {Object} Toc object */ const createToc = function (items, root) { if (items == null) items = []; if (r...
if (level == null) level = 0; if (items == null) items = toc.root; items.forEach(function (itemId) { let item = toc.items[itemId]; item.level = level; if (item.children != null) { calculateItemLevels(toc, item.children, level + 1); } }); return toc; }; export const getHtmlChapters = fu...
}; export const calculateItemLevels = function (toc, items, level) {
random_line_split
test-app.js
require('dotenv').config({silent:true}); var feathers = require('feathers'); var bodyParser = require('body-parser'); var rest = require('feathers-rest'); var socketio = require('feathers-socketio'); var fms = require('../lib'); var AutoService = fms.AutoService; const hooks = require('feathers-hooks'); const errorHan...
layout : 'Todos', idField : 'id' }; // Create a feathers instance. const app = feathers() .configure(hooks()) // Enable REST services .configure(rest()) // Enable REST services .configure(socketio()) // Turn on JSON parser for REST services .use(bodyParser.json()) // Turn on URL-encoded parser for RE...
const model = {
random_line_split
test_metadata.py
import os from shutil import copyfile from photomanip.metadata import ImageExif, SetExifTool from nose import tools ORIGINAL_IMAGE_FILENAME = 'photomanip/tests/turd_ferguson.jpeg' TEST_IMAGE_FILENAME = 'photomanip/tests/image_exif_test.jpg' ORIGINAL_PHOTO_FILENAME = 'photomanip/tests/test_photo_0.jpg' TEST_PHOTO_01...
meta_list[1].pop('SourceFile') tools.eq_(meta_list[0], meta_list[1])
random_line_split
test_metadata.py
import os from shutil import copyfile from photomanip.metadata import ImageExif, SetExifTool from nose import tools ORIGINAL_IMAGE_FILENAME = 'photomanip/tests/turd_ferguson.jpeg' TEST_IMAGE_FILENAME = 'photomanip/tests/image_exif_test.jpg' ORIGINAL_PHOTO_FILENAME = 'photomanip/tests/test_photo_0.jpg' TEST_PHOTO_01...
def test_set_image_metadata(self): output_meta = { "name": "Terd Ferguson", "keywords": "one, two, three", "caption": "suck it, trebeck", } result = self.image_exif.set_image_metadata(TEST_IMAGE_FILENAME, ...
get_list = self.image_exif.get_list # test get list tag_list = self.image_exif._generate_tag_list(get_list) tools.eq_(set(tag_list), set([ 'EXIF:DateTimeOriginal', 'File:ImageHeight', 'IPTC:Keywords', 'EXIF:ExposureTime', 'File:ImageWid...
identifier_body
test_metadata.py
import os from shutil import copyfile from photomanip.metadata import ImageExif, SetExifTool from nose import tools ORIGINAL_IMAGE_FILENAME = 'photomanip/tests/turd_ferguson.jpeg' TEST_IMAGE_FILENAME = 'photomanip/tests/image_exif_test.jpg' ORIGINAL_PHOTO_FILENAME = 'photomanip/tests/test_photo_0.jpg' TEST_PHOTO_01...
def test_calculate_exposure_time(self): tag_list = self.image_exif._generate_tag_list(['exposure_time']) stored_tags = self.get_stored_tags(tag_list, TEST_PHOTO_01_FILENAME) tools.eq_(stored_tags['EXIF:ExposureTime'], 0.001333333333) def test_get_tags_containing(self): tag_lis...
mapped_key = self.image_exif.metadata_map[key] tools.eq_(val, stored_tags[mapped_key])
conditional_block
test_metadata.py
import os from shutil import copyfile from photomanip.metadata import ImageExif, SetExifTool from nose import tools ORIGINAL_IMAGE_FILENAME = 'photomanip/tests/turd_ferguson.jpeg' TEST_IMAGE_FILENAME = 'photomanip/tests/image_exif_test.jpg' ORIGINAL_PHOTO_FILENAME = 'photomanip/tests/test_photo_0.jpg' TEST_PHOTO_01...
(self): fname_list = [TEST_PHOTO_01_FILENAME, TEST_PHOTO_02_FILENAME] meta_list = self.image_exif.get_metadata_batch(fname_list) meta_list[0].pop('SourceFile') meta_list[1].pop('SourceFile') tools.eq_(meta_list[0], meta_list[1])
test_get_metadata_batch
identifier_name
AddCaseDataToDatabase.py
""" Application-class that implements pyFoamAddCaseDataToDatabase.py """ from optparse import OptionGroup from .PyFoamApplication import PyFoamApplication from PyFoam.Basics.RunDatabase import RunDatabase from os import path from PyFoam.ThirdParty.six.moves import cPickle as pickle from PyFoam.ThirdParty.six import ...
self.parser.add_option_group(how) how.add_option("--create", action="store_true", dest="create", default=False, help="Create a new database file. Fail if it already exists") how.add_option("--verbose", ...
def __init__(self, args=None, **kwargs): description="""\ Adds the content of a number of pickledData-files to a sqlite database """ PyFoamApplication.__init__(self, args=args, description=description...
identifier_body
AddCaseDataToDatabase.py
""" Application-class that implements pyFoamAddCaseDataToDatabase.py """ from optparse import OptionGroup from .PyFoamApplication import PyFoamApplication from PyFoam.Basics.RunDatabase import RunDatabase from os import path from PyFoam.ThirdParty.six.moves import cPickle as pickle from PyFoam.ThirdParty.six import ...
try: data=pickle.Unpickler(open(s)).load() except (IOError,pickle.UnpicklingError): e = sys.exc_info()[1] # Needed because python 2.5 does not support 'as e' if self.opts.skipMissing: self.warning("File",s,"missing") ...
print_("\nProcessing file",s)
conditional_block
AddCaseDataToDatabase.py
""" Application-class that implements pyFoamAddCaseDataToDatabase.py """ from optparse import OptionGroup from .PyFoamApplication import PyFoamApplication from PyFoam.Basics.RunDatabase import RunDatabase from os import path from PyFoam.ThirdParty.six.moves import cPickle as pickle from PyFoam.ThirdParty.six import ...
(self): how=OptionGroup(self.parser, "Behavior", "How the application should behave") self.parser.add_option_group(how) how.add_option("--create", action="store_true", dest="create", ...
addOptions
identifier_name
AddCaseDataToDatabase.py
""" Application-class that implements pyFoamAddCaseDataToDatabase.py """ from optparse import OptionGroup from .PyFoamApplication import PyFoamApplication from PyFoam.Basics.RunDatabase import RunDatabase from os import path from PyFoam.ThirdParty.six.moves import cPickle as pickle from PyFoam.ThirdParty.six import ...
e = sys.exc_info()[1] # Needed because python 2.5 does not support 'as e' if self.opts.skipMissing: self.warning("File",s,"missing") continue else: self.error("There was a problem reading file",s, ...
random_line_split
lib.rs
#![deny(missing_docs)] #![allow(dead_code)] //! The Essence language compiler //! //! Contains modules for each compiler phase //! //! # Phases //! //! Most of the phases are contained in their own modules. //! //! Tokenize -> Parse -> Analyze -> Macro Expand -> Type Check -> Optimize -> //! Codegen //! //! ## `tokeni...
mod error; mod context; /// Tokenizer phase. pub mod tokenizer; /// Parser phase. pub mod parser; mod analyzer; mod macro_expander; mod type_checker; mod code_gen; /// A compiler pub struct Compiler;
//! ## `code_gen` //! //! This module contains the default code generator implementation.
random_line_split
lib.rs
#![deny(missing_docs)] #![allow(dead_code)] //! The Essence language compiler //! //! Contains modules for each compiler phase //! //! # Phases //! //! Most of the phases are contained in their own modules. //! //! Tokenize -> Parse -> Analyze -> Macro Expand -> Type Check -> Optimize -> //! Codegen //! //! ## `tokeni...
;
Compiler
identifier_name
core.module.ts
import { ModuleWithProviders, NgModule, Optional, SkipSelf, } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { RouterModule } from '@angular/router'; import { EventService } from...
static forRoot(): ModuleWithProviders { return { ngModule: CoreModule, providers: [], }; } constructor( @Optional() @SkipSelf() parentModule: CoreModule) { if (parentModule) { throw new Error( 'CoreModule is already loaded. Import it in the AppModule only'); } } }
random_line_split
core.module.ts
import { ModuleWithProviders, NgModule, Optional, SkipSelf, } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { RouterModule } from '@angular/router'; import { EventService } from...
{ static forRoot(): ModuleWithProviders { return { ngModule: CoreModule, providers: [], }; } constructor( @Optional() @SkipSelf() parentModule: CoreModule) { if (parentModule) { throw new Error( 'CoreModule is already loaded. Import it in the AppModule only'); } } }...
CoreModule
identifier_name
core.module.ts
import { ModuleWithProviders, NgModule, Optional, SkipSelf, } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { RouterModule } from '@angular/router'; import { EventService } from...
}
{ if (parentModule) { throw new Error( 'CoreModule is already loaded. Import it in the AppModule only'); } }
identifier_body
core.module.ts
import { ModuleWithProviders, NgModule, Optional, SkipSelf, } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { RouterModule } from '@angular/router'; import { EventService } from...
} }
{ throw new Error( 'CoreModule is already loaded. Import it in the AppModule only'); }
conditional_block
unique-swap.rs
// Copyright 2012 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 ...
() { let mut i: Box<_> = box 100; let mut j: Box<_> = box 200; swap(&mut i, &mut j); assert_eq!(i, box 200); assert_eq!(j, box 100); }
main
identifier_name
unique-swap.rs
// Copyright 2012 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 ...
{ let mut i: Box<_> = box 100; let mut j: Box<_> = box 200; swap(&mut i, &mut j); assert_eq!(i, box 200); assert_eq!(j, box 100); }
identifier_body
unique-swap.rs
// Copyright 2012 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 ...
let mut i: Box<_> = box 100; let mut j: Box<_> = box 200; swap(&mut i, &mut j); assert_eq!(i, box 200); assert_eq!(j, box 100); }
random_line_split
testing.py
import numpy as np import theano import theano.tensor as T theano.config.exception_verbosity = 'high' theano.config.compute_test_value = 'warn' floatX = theano.config.floatX def iscalar(name=None): Av = 1 A = T.iscalar(name=name) A.tag.test_value = Av return A, Av def fscalar(name=None): Av...
(size, name=None): Av = np.zeros(size, dtype=floatX) A = T.fscalar(name=name) A.tag.test_value = Av return A, Av def imatrix(shape, name=None): Av = np.zeros(shape, dtype=np.int) A = T.imatrix(name=name) A.tag.test_value = Av return A, Av def fmatrix(shape, name=None): Av = np.ze...
fvector
identifier_name
testing.py
import numpy as np import theano import theano.tensor as T theano.config.exception_verbosity = 'high' theano.config.compute_test_value = 'warn' floatX = theano.config.floatX def iscalar(name=None): Av = 1 A = T.iscalar(name=name) A.tag.test_value = Av return A, Av
A = T.fscalar(name=name) A.tag.test_value = Av return A, Av def ivector(size, name=None): Av = np.zeros(size, dtype=np.int) A = T.iscalar(name=name) A.tag.test_value = Av return A, Av def fvector(size, name=None): Av = np.zeros(size, dtype=floatX) A = T.fscalar(name=name) A....
def fscalar(name=None): Av = 1.23
random_line_split
testing.py
import numpy as np import theano import theano.tensor as T theano.config.exception_verbosity = 'high' theano.config.compute_test_value = 'warn' floatX = theano.config.floatX def iscalar(name=None): Av = 1 A = T.iscalar(name=name) A.tag.test_value = Av return A, Av def fscalar(name=None):
def ivector(size, name=None): Av = np.zeros(size, dtype=np.int) A = T.iscalar(name=name) A.tag.test_value = Av return A, Av def fvector(size, name=None): Av = np.zeros(size, dtype=floatX) A = T.fscalar(name=name) A.tag.test_value = Av return A, Av def imatrix(shape, name=None): ...
Av = 1.23 A = T.fscalar(name=name) A.tag.test_value = Av return A, Av
identifier_body
editor.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* Top-level react component for editing MediaWiki documents */ import { createEditor } from "../frame-tree/editor"; import { aux_file } from "../frame-tree/util"; import { se...
fullscreen_style: { // set via jquery "max-width": "900px", margin: "auto", }, }, terminal, settings: SETTINGS_SPEC, time_travel, }; export const Editor = createEditor({ format_bar: true, editor_spec: EDITOR_SPEC, display_name: "WikiEditor", });
return aux_file(path, "html"); },
identifier_body
editor.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* Top-level react component for editing MediaWiki documents */ import { createEditor } from "../frame-tree/editor"; import { aux_file } from "../frame-tree/util"; import { se...
th) { return aux_file(path, "html"); }, fullscreen_style: { // set via jquery "max-width": "900px", margin: "auto", }, }, terminal, settings: SETTINGS_SPEC, time_travel, }; export const Editor = createEditor({ format_bar: true, editor_spec: EDITOR_SPEC, display_name...
h(pa
identifier_name
editor.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* Top-level react component for editing MediaWiki documents */ import { createEditor } from "../frame-tree/editor"; import { aux_file } from "../frame-tree/util"; import { se...
component: IFrameHTML, buttons: set([ "print", "decrease_font_size", "increase_font_size", "save", "time_travel", "reload", ]), path(path) { return aux_file(path, "html"); }, fullscreen_style: { // set via jquery "max-width": "900px", m...
html: { short: "HTML", name: "Rendered HTML (pandoc)", icon: "html5",
random_line_split
visualMapContinuous.ts
/* * 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"); you may no...
import { use } from '../extension'; import { install } from './visualMap/installVisualMapContinuous'; use(install);
* specific language governing permissions and limitations * under the License. */
random_line_split
AssignmentRounded.js
import createSvgIcon from './utils/createSvgIcon'; import { jsx as _jsx } from "react/jsx-runtime"; export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M19 3h-4.18C14.4 1.84 13.3 1 12 1s-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm1 14H8c-.55 0-1-.45-1-1s.45-1 1-1h5c.55 0 1 .45 1 1s-.45 1-1 1zm3-4H8c-.55 0-1-.45-1-1s.45-1 1-1h8c.55 0 1 .45 1 1s-.45 1-1 1zm0-4H8c-.55 0-1...
random_line_split
InputBase.d.ts
import * as React from 'react'; import { StandardProps } from '..'; export interface InputBaseProps extends StandardProps< React.HTMLAttributes<HTMLDivElement>, InputBaseClassKey, /* * `onChange`, `onKeyUp`, `onKeyDown`, `onBlur`, `onFocus` are applied to the inner `InputComponent`, * which by ...
*/ autoComplete?: string; /** * If `true`, the `input` element will be focused during the first mount. */ autoFocus?: boolean; /** * The color of the component. It supports those theme colors that make sense for this component. */ color?: 'primary' | 'secondary'; /** * The default `input` ...
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
random_line_split
eventsController.js
var fs=require('fs'); module.exports.get=function(req,res){
var event=fs.readFileSync('app/data/event/'+req.params.id+'.json','utf8'); res.setHeader("Content-Type","application/json"); res.send(event); } module.exports.save=function(req,res){ var event=req.body; debugger; fs.writeFileSync('app/data/event/'+req.params.id+'.json',JSON.stringify(event...
random_line_split
eventsController.js
var fs=require('fs'); module.exports.get=function(req,res){ var event=fs.readFileSync('app/data/event/'+req.params.id+'.json','utf8'); res.setHeader("Content-Type","application/json"); res.send(event); } module.exports.save=function(req,res){ var event=req.body; debugger; fs.writeFileSync...
=results.substr(0,results.length-1); results+="]"; res.setHeader("Content-Type","application/json"); res.send(results); res.end(); }
(files[i].indexOf(".json")==files[i].length-5){ results+=fs.readFileSync(path+"/"+files[i])+","; } } results
conditional_block
change_detection.ts
/** * @module * @public * @description * Change detection enables data binding in Angular. */ export { ASTWithSource, AST, AstTransformer, AccessMember, LiteralArray, ImplicitReceiver } from './src/change_detection/parser/ast'; export {Lexer} from './src/change_detection/parser/lexer'; export {Parser...
} from './src/change_detection/exceptions'; export { ProtoChangeDetector, ChangeDispatcher, ChangeDetector, ChangeDetection, ChangeDetectorDefinition } from './src/change_detection/interfaces'; export { CHECK_ONCE, CHECK_ALWAYS, DETACHED, CHECKED, ON_PUSH, DEFAULT } from './src/change_detection/co...
ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError
random_line_split
audio.py
""" Care about audio fileformat """ try: from mutagen.flac import FLAC from mutagen.oggvorbis import OggVorbis except ImportError: pass import parser import mutagenstripper class MpegAudioStripper(parser.GenericParser): """ Represent mpeg audio file (mp3, ...) """ def _should_remove(self, fi...
class OggStripper(mutagenstripper.MutagenStripper): """ Represent an ogg vorbis file """ def _create_mfile(self): self.mfile = OggVorbis(self.filename) class FlacStripper(mutagenstripper.MutagenStripper): """ Represent a Flac audio file """ def _create_mfile(self): self.mfil...
return field.name in ("id3v1", "id3v2")
identifier_body
audio.py
""" Care about audio fileformat """ try: from mutagen.flac import FLAC from mutagen.oggvorbis import OggVorbis except ImportError: pass import parser import mutagenstripper class MpegAudioStripper(parser.GenericParser): """ Represent mpeg audio file (mp3, ...) """ def _should_remove(self, fi...
""" return super(FlacStripper, self).is_clean() and not self.mfile.pictures def get_meta(self): """ Return the content of the metadata block if present """ metadata = super(FlacStripper, self).get_meta() if self.mfile.pictures: metadata['picture:'] = 'yes...
""" Check if the "metadata" block is present in the file
random_line_split
audio.py
""" Care about audio fileformat """ try: from mutagen.flac import FLAC from mutagen.oggvorbis import OggVorbis except ImportError: pass import parser import mutagenstripper class MpegAudioStripper(parser.GenericParser): """ Represent mpeg audio file (mp3, ...) """ def _should_remove(self, fi...
(self): """ Return the content of the metadata block if present """ metadata = super(FlacStripper, self).get_meta() if self.mfile.pictures: metadata['picture:'] = 'yes' return metadata
get_meta
identifier_name
audio.py
""" Care about audio fileformat """ try: from mutagen.flac import FLAC from mutagen.oggvorbis import OggVorbis except ImportError: pass import parser import mutagenstripper class MpegAudioStripper(parser.GenericParser): """ Represent mpeg audio file (mp3, ...) """ def _should_remove(self, fi...
return metadata
metadata['picture:'] = 'yes'
conditional_block
java.sql.Time.d.ts
declare namespace java { namespace sql { class Time extends java.util.Date { static readonly serialVersionUID: long public constructor(arg0: number | java.lang.Integer, arg1: number | java.lang.Integer, arg2: number | java.lang.Integer) public constructor(arg0: number | java.lang.Long) pu...
public getDate(): number public setYear(arg0: number | java.lang.Integer): void public setMonth(arg0: number | java.lang.Integer): void public setDate(arg0: number | java.lang.Integer): void public static valueOf(arg0: java.time.LocalTime): java.sql.Time public toLocalTime(): java.ti...
random_line_split
java.sql.Time.d.ts
declare namespace java { namespace sql { class
extends java.util.Date { static readonly serialVersionUID: long public constructor(arg0: number | java.lang.Integer, arg1: number | java.lang.Integer, arg2: number | java.lang.Integer) public constructor(arg0: number | java.lang.Long) public setTime(arg0: number | java.lang.Long): void pu...
Time
identifier_name
puremask.js
/* ======================================================================== * Pure Mask JS: puremask.js v0.1 * http://romulobrasil.com * Copyright (c) 2014 Rômulo Brasil * ======================================================================== */ 'use strict'; var PureMask = function() { return { ...
mask) { var text = ''; var data = el.value; var c, m, i, x; for (i = 0, x = 1; x && i < mask.length; ++i) { c = data.charAt(i); m = mask.charAt(i); switch (m...
ormato(
identifier_name
puremask.js
/* ======================================================================== * Pure Mask JS: puremask.js v0.1 * http://romulobrasil.com * Copyright (c) 2014 Rômulo Brasil * ======================================================================== */ 'use strict'; var PureMask = function() { return { ...
} }; }();
var text = ''; var data = el.value; var c, m, i, x; for (i = 0, x = 1; x && i < mask.length; ++i) { c = data.charAt(i); m = mask.charAt(i); switch (mask.cha...
identifier_body
puremask.js
/* ======================================================================== * Pure Mask JS: puremask.js v0.1 * http://romulobrasil.com * Copyright (c) 2014 Rômulo Brasil * ======================================================================== */ 'use strict'; var PureMask = function() { return { ...
} el.value = text; } } }; }();
random_line_split
CloudProviderRegistry.ts
/* tslint:disable: no-console */ import { cloneDeep, get, isNil, set } from 'lodash'; import { SETTINGS } from '../config/settings'; export interface ICloudProviderLogo { path: string; } export interface ICloudProviderConfig { name: string; logo?: ICloudProviderLogo; [attribute: string]: any; } export class...
(cloudProvider: string, key: string) { return this.providers.has(cloudProvider) && this.getValue(cloudProvider, key) !== null; } public static getValue(cloudProvider: string, key: string): any { return get(this.getProvider(cloudProvider), key) ?? null; } public static isDisabled(cloudProvider: string)...
hasValue
identifier_name
CloudProviderRegistry.ts
/* tslint:disable: no-console */ import { cloneDeep, get, isNil, set } from 'lodash'; import { SETTINGS } from '../config/settings'; export interface ICloudProviderLogo { path: string; } export interface ICloudProviderConfig { name: string; logo?: ICloudProviderLogo; [attribute: string]: any; } export class...
} public static getProvider(cloudProvider: string): ICloudProviderConfig { return this.providers.has(cloudProvider) ? cloneDeep(this.providers.get(cloudProvider)) : null; } public static listRegisteredProviders(): string[] { return Array.from(this.providers.keys()); } public static overrideValue...
{ this.providers.set(cloudProvider, config); }
conditional_block
CloudProviderRegistry.ts
/* tslint:disable: no-console */ import { cloneDeep, get, isNil, set } from 'lodash'; import { SETTINGS } from '../config/settings'; export interface ICloudProviderLogo { path: string; } export interface ICloudProviderConfig { name: string; logo?: ICloudProviderLogo; [attribute: string]: any; } export class...
} public static overrideValue(cloudProvider: string, key: string, overrideValue: any) { if (!this.providers.has(cloudProvider)) { console.warn(`Cannot override "${key}" for provider "${cloudProvider}" (provider not registered)`); return; } set(this.providers.get(cloudProvider), key, overrid...
return this.providers.has(cloudProvider) ? cloneDeep(this.providers.get(cloudProvider)) : null; } public static listRegisteredProviders(): string[] { return Array.from(this.providers.keys());
random_line_split
CloudProviderRegistry.ts
/* tslint:disable: no-console */ import { cloneDeep, get, isNil, set } from 'lodash'; import { SETTINGS } from '../config/settings'; export interface ICloudProviderLogo { path: string; } export interface ICloudProviderConfig { name: string; logo?: ICloudProviderLogo; [attribute: string]: any; } export class...
}
{ // If the adHocInfrastructureWritesEnabled flag when registering provider is not set // Infrastructure writes will be enabled (Action buttons will not be disabled) if (isNil(CloudProviderRegistry.getValue(cloudProvider, 'adHocInfrastructureWritesEnabled'))) { return false; } return CloudProv...
identifier_body
private-inferred-type-1.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 ...
(&self) {} } impl ::TyParam for Option<Priv> { fn ty_param_secret(&self) {} } } fn main() { [].arr0_secret(); //~ ERROR type `m::Priv` is private None.ty_param_secret(); //~ ERROR type `m::Priv` is private }
arr0_secret
identifier_name
private-inferred-type-1.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 ...
None.ty_param_secret(); //~ ERROR type `m::Priv` is private }
impl ::TyParam for Option<Priv> { fn ty_param_secret(&self) {} } } fn main() { [].arr0_secret(); //~ ERROR type `m::Priv` is private
random_line_split
index.js
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as MentorshipActionCreators from './actions'; import cssModules from 'react-css-modules'; import styles from './index.module.scss'; import Heading from 'grommet-udacity/components/Headin...
extends Component { // eslint-disable-line react/prefer-stateless-function render() { return ( <div className={styles.mentorship}> <Hero backgroundImage={MentorshipPageImage} > <Headline strong> Udacity Mentorship </Headline> <Heading tag=...
Mentorship
identifier_name
index.js
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as MentorshipActionCreators from './actions'; import cssModules from 'react-css-modules'; import styles from './index.module.scss'; import Heading from 'grommet-udacity/components/Headin...
render() { return ( <div className={styles.mentorship}> <Hero backgroundImage={MentorshipPageImage} > <Headline strong> Udacity Mentorship </Headline> <Heading tag="h2" strong> Together, we are stronger </Heading> ...
import Headline from 'grommet-udacity/components/Headline'; import { MartinRulz } from 'components'; const MentorshipPageImage = 'https://github.com/RyanCCollins/cdn/blob/master/alumni-webapp/mentoring.jpg?raw=true'; class Mentorship extends Component { // eslint-disable-line react/prefer-stateless-function
random_line_split
colors.js
({ // local representation of all CSS3 named colors, companion to dojo.colors. To be used where descriptive information // is required for each color, such as a palette widget, and not for specifying color programatically. //Note: due to the SVG 1.0 spec additions, some of these are alternate spellings for the same c...
ghostwhite: "أبيض شفاف", gold: "ذهبي", goldenrod: "أصفر ذهبي ", gray: "رمادي", green: "أخضر", greenyellow: "أخضر مائل للأصفر", grey: "رمادي", // same as gray honeydew: "أبيض مائل للأخضر ", hotpink: "أحمر وردي زاهي", indianred: "أحمر هندي", indigo: "نيلي", ivory: "عاجي", khaki: "كاكي", lavender: "أرجواني شاحب", lavender...
random_line_split
da2013.rs
use std::os::unix::io; use byteorder::{LittleEndian, WriteBytesExt}; use nix; use nix::fcntl; use nix::sys::stat::Mode; use nix::unistd; mod hid_ioctl { const HID_IOC_MAGIC: u8 = b'H'; const HID_IOC_NR_SFEATURE: u8 = 0x06; const HID_IOC_NR_GFEATURE: u8 = 0x07; ioctl!(readwrite buf sfeature with HID_I...
} impl Drop for Da2013 { fn drop(&mut self) { unistd::close(self.fd).expect("Failed to close device"); } }
{ let (arg0, arg1, footer) = match (led, state) { (Led::Logo, true) => (0x0401, 1, 0x04), (Led::Logo, false) => (0x0401, 0, 0x05), (Led::Wheel, true) => (0x0101, 1, 0x01), (Led::Wheel, false) => (0x0101, 0, 0x00), }; self.do_cmd(DA2013_CMD_SET, DA...
identifier_body
da2013.rs
use std::os::unix::io; use byteorder::{LittleEndian, WriteBytesExt}; use nix; use nix::fcntl; use nix::sys::stat::Mode; use nix::unistd; mod hid_ioctl { const HID_IOC_MAGIC: u8 = b'H'; const HID_IOC_NR_SFEATURE: u8 = 0x06; const HID_IOC_NR_GFEATURE: u8 = 0x07; ioctl!(readwrite buf sfeature with HID_I...
buf.write_u16::<LittleEndian>(arg1).unwrap(); // Padding let mut zeros = vec![0; 76]; buf.append(&mut zeros); buf.push(footer); // Padding buf.push(0); // Errors here are considered non-critical // We try multiple times to make sure the device ...
random_line_split
da2013.rs
use std::os::unix::io; use byteorder::{LittleEndian, WriteBytesExt}; use nix; use nix::fcntl; use nix::sys::stat::Mode; use nix::unistd; mod hid_ioctl { const HID_IOC_MAGIC: u8 = b'H'; const HID_IOC_NR_SFEATURE: u8 = 0x06; const HID_IOC_NR_GFEATURE: u8 = 0x07; ioctl!(readwrite buf sfeature with HID_I...
(&mut self) { unistd::close(self.fd).expect("Failed to close device"); } }
drop
identifier_name
bc-tabs.js
/** * @module components * */ import $ from 'jquery'; import { assert } from '@ember/debug'; import { dasherize } from '@ember/string'; import EmberObject, { get, set } from '@ember/object'; import { isNone, isEmpty } from '@ember/utils'; import Component from '@ember/component'; import { inject as service } from '@...
, on: elData.on, }); // register for child events data.on('change', () => { this.buildTabData(); }); model.push(data); }); if (get(model, 'length') > 0) { // sort models by tabIndex model = model.sortBy('tabIndex'); } set(this, 'model', model); return model; }, handleHash()...
{ set(this, 'active', false); elData.hideTab(); }
identifier_body
bc-tabs.js
/** * @module components * */ import $ from 'jquery'; import { assert } from '@ember/debug'; import { dasherize } from '@ember/string'; import EmberObject, { get, set } from '@ember/object'; import { isNone, isEmpty } from '@ember/utils'; import Component from '@ember/component'; import { inject as service } from '@...
} } }, buildTabData() { assert('buildTabData must be called after render', this.$().length > 0); let model = []; this.$(TAB_CONTENT).children().each((index, el) => { let elData = $(el).data(); let data = EmberObject.create({ el, id: elData.id, active: false, tabName: elData.tabName, ...
{ if (isEmpty(get(this, 'defaultTab'))) { let ftab = model.filterBy('isViewable', true).get('firstObject'); set(this, 'defaultTab', get(ftab, 'id')); } let activeTab; if (!isEmpty(get(this, 'hashName'))) { activeTab = model.findBy('id', get(this, 'hashName')); } if (isNone(activ...
conditional_block
bc-tabs.js
/** * @module components * */ import $ from 'jquery'; import { assert } from '@ember/debug'; import { dasherize } from '@ember/string'; import EmberObject, { get, set } from '@ember/object'; import { isNone, isEmpty } from '@ember/utils'; import Component from '@ember/component'; import { inject as service } from '@...
() { this._super(...arguments); const router = get(this, 'router._router'); if (router && router.off) { router.off('didTransition', this, this.triggerTabChange); } }, actions: { changeTab(tab) { this.openTab(tab); } } });
willDestroyElement
identifier_name
bc-tabs.js
/** * @module components * */ import $ from 'jquery'; import { assert } from '@ember/debug'; import { dasherize } from '@ember/string'; import EmberObject, { get, set } from '@ember/object'; import { isNone, isEmpty } from '@ember/utils'; import Component from '@ember/component'; import { inject as service } from '@...
} if (isNone(activeTab) && !isEmpty(get(this, 'defaultTab'))) { activeTab = model.findBy('id', get(this, 'defaultTab')); if (isNone(activeTab)) { activeTab = model.filterBy('isViewable', true).get('firstObject'); set(this, 'defaultTab', get(activeTab, 'id')); } } this.openTa...
activeTab = model.findBy('id', get(this, 'hashName'));
random_line_split
lib.rs
#![feature(plugin_registrar, quote, rustc_private, box_patterns)] extern crate rustc_plugin; #[macro_use] pub extern crate syntax; extern crate rustc_errors as errors; extern crate peg; use syntax::ast; use syntax::codemap; use syntax::codemap::FileName; use syntax::ext::base::{ExtCtxt, MacResult, MacEager, DummyResu...
reg.register_syntax_extension( Symbol::intern("peg_file"), syntax::ext::base::IdentTT(Box::new(expand_peg_file), None, false)); } fn expand_peg_str<'s>(cx: &'s mut ExtCtxt, sp: codemap::Span, ident: ast::Ident, tts: Vec<TokenTree>) -> Box<MacResult + 's> { let (source, span) = match pa...
Symbol::intern("peg"), syntax::ext::base::IdentTT(Box::new(expand_peg_str), None, false));
random_line_split
lib.rs
#![feature(plugin_registrar, quote, rustc_private, box_patterns)] extern crate rustc_plugin; #[macro_use] pub extern crate syntax; extern crate rustc_errors as errors; extern crate peg; use syntax::ast; use syntax::codemap; use syntax::codemap::FileName; use syntax::ext::base::{ExtCtxt, MacResult, MacEager, DummyResu...
fn expand_peg_file<'s>(cx: &'s mut ExtCtxt, sp: codemap::Span, ident: ast::Ident, tts: Vec<TokenTree>) -> Box<MacResult + 's> { let fname = match parse_arg(cx, &tts) { Some((fname, _)) => fname, None => return DummyResult::any(sp), }; let path = match cx.codemap().span_to_filename(sp) { ...
{ let (source, span) = match parse_arg(cx, &tts) { Some((source, span)) => (source, span), None => return DummyResult::any(sp), }; let loc = cx.codemap().lookup_char_pos(span.lo()); let fname = loc.file.name.to_string(); // Make PEG line numbers match source line numbers let so...
identifier_body
lib.rs
#![feature(plugin_registrar, quote, rustc_private, box_patterns)] extern crate rustc_plugin; #[macro_use] pub extern crate syntax; extern crate rustc_errors as errors; extern crate peg; use syntax::ast; use syntax::codemap; use syntax::codemap::FileName; use syntax::ext::base::{ExtCtxt, MacResult, MacEager, DummyResu...
(cx: &mut ExtCtxt, tts: &[TokenTree]) -> Option<(String, codemap::Span)> { use syntax::print::pprust; let mut parser = parse::new_parser_from_tts(cx.parse_sess(), tts.to_vec()); // The `expand_expr` method is called so that any macro calls in the // parsed expression are expanded. let arg = cx.expa...
parse_arg
identifier_name
comment-view.component.spec.ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { CommentViewComponent } from './comment-view.component'; import { Comment } from './comment'; import { AuthService } from '../user/auth.servi...
it('emits onDeleteSuccess event', () => { spyOn(component.onDeleteSuccess, 'emit'); component.deleteComment(); expect(component.onDeleteSuccess.emit).toHaveBeenCalled(); }); }); describe('#onCommentCancel()', () => { it('sets commentIsBeingEdited to false', () => { component.co...
spyOn(blogService, 'deleteComment').and.callThrough(); component.deleteComment(); expect(blogService.deleteComment).toHaveBeenCalledWith(component.comment); });
random_line_split
HappyDNS.py
#!/usr/bin/env python3 # # Copyright (c) 2016-2017 Nest Labs, Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
def __add_node_dns(self, node_id): nspath = self.nsroot + "/" + self.uniquePrefix(node_id) resolv_path = nspath + "/" + "resolv.conf" if not os.path.isdir(nspath): cmd = "mkdir -p " + nspath cmd = self.runAsRoot(cmd) ret = self.CallAtHost(cmd) ...
if not IP.isIpv4(dns_addr): emsg = "DNS %s is not a valid IPv4 address." % (dns_addr) self.logger.error("[localhost] HappyDNS: %s" % (emsg)) self.exit()
conditional_block
HappyDNS.py
#!/usr/bin/env python3 # # Copyright (c) 2016-2017 Nest Labs, Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
cmd = "touch " + resolv_path cmd = self.runAsRoot(cmd) ret = self.CallAtHost(cmd) cmd = "chmod 666 " + resolv_path cmd = self.runAsRoot(cmd) ret = self.CallAtHost(cmd) with open(resolv_path, 'w') as res: for dns_addr in self.dns: ...
if not os.path.exists(resolv_path):
random_line_split
HappyDNS.py
#!/usr/bin/env python3 # # Copyright (c) 2016-2017 Nest Labs, Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
(self): if not self.node_id: if self.add: self.setGlobalDNS(self.dns) else: self.removeGlobalDNS() def run(self): with self.getStateLockManager(): self.__pre_check() self.__update_nodes_dns() self.__dns_s...
__dns_state
identifier_name
HappyDNS.py
#!/usr/bin/env python3 # # Copyright (c) 2016-2017 Nest Labs, Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
def __add_node_dns(self, node_id): nspath = self.nsroot + "/" + self.uniquePrefix(node_id) resolv_path = nspath + "/" + "resolv.conf" if not os.path.isdir(nspath): cmd = "mkdir -p " + nspath cmd = self.runAsRoot(cmd) ret = self.CallAtHost(cmd) ...
if not self.delete: self.add = True if not self.dns: if "happy_dns" in list(os.environ.keys()): self.dns = os.environ['happy_dns'].split() if self.add and self.dns is None: emsg = "No DNS servers listed." self.logger.error("[localhost] Ha...
identifier_body