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
activation_manager.rs
use crate::joint::{JointConstraint, JointConstraintSet}; use crate::object::{Body, BodyHandle, BodySet, ColliderSet}; use crate::utils::union_find; use crate::utils::union_find::UnionFindSet; use crate::world::GeometricalWorld; use na::{self, RealField}; /// Structure that monitors island-based activation/deactivation...
for (_, c1, _, c2, _, manifold) in gworld.contact_pairs(colliders, false) { if manifold.len() > 0 { make_union(bodies, c1.body(), c2.body(), &mut self.ufind) } } constraints.foreach(|_, c| { if !c.is_broken() { let (b1, b2) =...
{ let b1 = try_ret!(bodies.get(b1)); let b2 = try_ret!(bodies.get(b2)); if (b1.status_dependent_ndofs() != 0 || b1.is_kinematic()) && (b2.status_dependent_ndofs() != 0 || b2.is_kinematic()) { union_find::union(b1.companion_id(), b2.companio...
identifier_body
activation_manager.rs
use crate::joint::{JointConstraint, JointConstraintSet}; use crate::object::{Body, BodyHandle, BodySet, ColliderSet}; use crate::utils::union_find; use crate::utils::union_find::UnionFindSet; use crate::world::GeometricalWorld; use na::{self, RealField}; /// Structure that monitors island-based activation/deactivation...
<N: RealField, Handle: BodyHandle> { mix_factor: N, ufind: Vec<UnionFindSet>, can_deactivate: Vec<bool>, to_activate: Vec<Handle>, id_to_body: Vec<Handle>, } impl<N: RealField, Handle: BodyHandle> ActivationManager<N, Handle> { /// Creates a new `ActivationManager2`. /// /// # Arguments...
ActivationManager
identifier_name
activation_manager.rs
use crate::joint::{JointConstraint, JointConstraintSet}; use crate::object::{Body, BodyHandle, BodySet, ColliderSet}; use crate::utils::union_find; use crate::utils::union_find::UnionFindSet; use crate::world::GeometricalWorld; use na::{self, RealField}; /// Structure that monitors island-based activation/deactivation...
self.can_deactivate[root] = match status.deactivation_threshold() { Some(threshold) => self.can_deactivate[root] && status.energy() < threshold, None => false, }; } // Activate/deactivate islands. for i in 0usize..self.ufind.len() { ...
// FIXME: avoid the Copy when NLL lands ? let status = *body.activation_status();
random_line_split
activation_manager.rs
use crate::joint::{JointConstraint, JointConstraintSet}; use crate::object::{Body, BodyHandle, BodySet, ColliderSet}; use crate::utils::union_find; use crate::utils::union_find::UnionFindSet; use crate::world::GeometricalWorld; use na::{self, RealField}; /// Structure that monitors island-based activation/deactivation...
else if !body.is_kinematic() { // Everybody in this set must be reactivated. active_bodies.push(handle); // FIXME: avoid the Copy when NLL lands ? let status = *body.activation_status(); if !status.is_active() && status.deactivation_thre...
{ // Everybody in this set can be deactivacted. if body.is_active() { body.deactivate(); } }
conditional_block
test_textfield.py
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2012 Canonical # # 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. """Tests for the TextInput Qml...
(TavastiaTestCase): """Tests for TextField component.""" test_qml_file = "%s/%s.qml" % (os.path.dirname(os.path.realpath(__file__)),"TextFieldTests") def test_can_select_textfield(self): """Must be able to select the Qml TextField component.""" obj = self.app.select_single('TextField') ...
TextFieldTests
identifier_name
test_textfield.py
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2012 Canonical # # 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. """Tests for the TextInput Qml...
from textwrap import dedent from testtools.matchers import Is, Not, Equals from testtools import skip import os from tavastia.tests import TavastiaTestCase class TextFieldTests(TavastiaTestCase): """Tests for TextField component.""" test_qml_file = "%s/%s.qml" % (os.path.dirname(os.path.realpath(__file__)),"T...
from autopilot.matchers import Eventually
random_line_split
test_textfield.py
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2012 Canonical # # 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. """Tests for the TextInput Qml...
"""Must be able to select the Qml TextField component.""" obj = self.app.select_single('TextField') self.assertThat(obj, Not(Is(None)))
identifier_body
StatementParser.ts
import StatementItem from "./../StatementItem"; export default class StatementParser { public parse(statementText: string[]): StatementItem[] { let items = [], cardNumber = null, startIndex = this.indexOfNextTransactionRow(statementText, 0); while (startIndex > -1) { let index = startIndex; wh...
(text: string): boolean { return text.startsWith("Foreign Amount "); } private textIsInternationTransanctionFee(text: string): boolean { return /AUD (\d)*.\d\d includes International Transaction fee AUD (\d)*.\d\d/.test(text); } }
textIsForeignCurrencyAmount
identifier_name
StatementParser.ts
import StatementItem from "./../StatementItem"; export default class StatementParser { public parse(statementText: string[]): StatementItem[] { let items = [], cardNumber = null, startIndex = this.indexOfNextTransactionRow(statementText, 0); while (startIndex > -1) { let index = startIndex; wh...
if (this.textIsRowEnding(statementText[index]) || this.textIsTransactionsEnd(statementText[index])) { break; } let date = statementText[index], transactionDetails = statementText[index + 1], amount = statementText[index + 2], referenceNumber = statementText[index + 3], forei...
{ index += 1; }
conditional_block
StatementParser.ts
import StatementItem from "./../StatementItem"; export default class StatementParser { public parse(statementText: string[]): StatementItem[] { let items = [], cardNumber = null, startIndex = this.indexOfNextTransactionRow(statementText, 0); while (startIndex > -1) { let index = startIndex; wh...
private parseCardNumber(text: string): string { return text.match(/Card Number (\d\d\d\d \d\d\d\d \d\d\d\d \d\d\d\d)/)[1]; } private textIsRowEnding(text: string): boolean { return text === "(Continued next page)"; } private textIsTransactionsEnd(text: string): boolean { return text === "Closing Balance"...
{ return /Card Number (\d\d\d\d \d\d\d\d \d\d\d\d \d\d\d\d)/.test(text); }
identifier_body
StatementParser.ts
import StatementItem from "./../StatementItem"; export default class StatementParser { public parse(statementText: string[]): StatementItem[] { let items = [], cardNumber = null, startIndex = this.indexOfNextTransactionRow(statementText, 0); while (startIndex > -1) { let index = startIndex; wh...
statementText[i + 1] == "Date" && statementText[i + 2] == "Transaction Details" && statementText[i + 3] == "Reference Number" && statementText[i + 4] == "Amount") { return i + 5; } } return index; } private textIsCardNumber(text: string): boolean { return /Card Number (\d\d\d\d \d\d\...
random_line_split
live-list-manager.js
src/document-fetcher'; import {getMode} from '../../../src/mode'; import {getServicePromiseForDoc} from '../../../src/service'; import {toArray} from '../../../src/types'; import {userAssert} from '../../../src/log'; /** @const {string} */ export const SERVICE_ID = 'liveListManager'; const TRANSFORMED_PREFIX = 'googl...
!liveList.hasAttribute('disabled') && // When the live list is an amp-story, we use an amp-story specific // attribute so publishers can disable the live story functionality. !liveList.hasAttribute('live-story-disabled') ); if (inClientDomLiveList.isEnabled()) { return inCli...
{ // amp-live-list elements can be appended dynamically in the client by // another component using the `i-amphtml-` + `other-component-id` + // `-dynamic-list` combination as the ID of the amp-live-list. // // The fact that we know how this ID is built allows us to find the // amp-live-list ele...
identifier_body
live-list-manager.js
src/document-fetcher'; import {getMode} from '../../../src/mode'; import {getServicePromiseForDoc} from '../../../src/service'; import {toArray} from '../../../src/types'; import {userAssert} from '../../../src/log'; /** @const {string} */ export const SERVICE_ID = 'liveListManager'; const TRANSFORMED_PREFIX = 'googl...
this.poller_ = new Poller(this.ampdoc.win, this.interval_, this.work_); // If no live-list is active on dom ready, we don't need to poll at all. if (this.ampdoc.isVisible() && this.hasActiveLiveLists_()) { this.poller_.start(); } this.setupVisibilityHandler_(); }); } /*...
{ const path = this.ampdoc.win.location.pathname; if ( path.indexOf('/examples/live-list-update.amp.html') != -1 || path.indexOf('/examples/live-blog.amp.html') != -1 || path.indexOf('/examples/live-blog-non-floating-button.amp.html') != -1 ) { this.interv...
conditional_block
live-list-manager.js
'../../../src/document-fetcher'; import {getMode} from '../../../src/mode'; import {getServicePromiseForDoc} from '../../../src/service'; import {toArray} from '../../../src/types'; import {userAssert} from '../../../src/log'; /** @const {string} */ export const SERVICE_ID = 'liveListManager'; const TRANSFORMED_PREF...
() { return this.ampdoc.whenReady(); } /** * Listens to he doc visibility changed event. * @private */ setupVisibilityHandler_() { // Polling should
whenDocReady_
identifier_name
live-list-manager.js
'../../../src/document-fetcher'; import {getMode} from '../../../src/mode'; import {getServicePromiseForDoc} from '../../../src/service'; import {toArray} from '../../../src/types'; import {userAssert} from '../../../src/log'; /** @const {string} */ export const SERVICE_ID = 'liveListManager'; const TRANSFORMED_PREF...
* Gets all live lists and updates them with their corresponding counterparts. * Saves latest update time. * * @param {!Document} doc * @private */ updateLiveLists_(doc) { this.installExtensionsForDoc_(doc); const allLiveLists = this.getLiveLists_(doc).concat( this.getCustomSlots_(doc) ...
/**
random_line_split
Data.py
#!/usr/bin/env python # This file is part of nexdatas - Tango Server for NeXus data writer # # Copyright (C) 2014-2017 DESY, Jan Kotanski <jkotan@mail.desy.de> # # nexdatas is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the ...
@Qt.pyqtSlot() def __setDirty(self): """ emits the `dirty` signal """ self.dirty.emit()
""" recreates widget GUI """ self.createGUI()
identifier_body
Data.py
#!/usr/bin/env python # This file is part of nexdatas - Tango Server for NeXus data writer # # Copyright (C) 2014-2017 DESY, Jan Kotanski <jkotan@mail.desy.de> # # nexdatas is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the ...
""" constructor :param ui: ui instance :type ui: :class:`taurus.qt.qtgui.util.ui.__UI` :param state: server state :type state: :class:`nxsselector.ServerState.ServerState` :param simpleMode: if simple display mode :type simpleMode: :obj:`bool` """ ...
#: (:class:`taurus.qt.Qt.pyqtSignal`) dirty signal dirty = Qt.pyqtSignal() def __init__(self, ui, state=None, simpleMode=False):
random_line_split
Data.py
#!/usr/bin/env python # This file is part of nexdatas - Tango Server for NeXus data writer # # Copyright (C) 2014-2017 DESY, Jan Kotanski <jkotan@mail.desy.de> # # nexdatas is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the ...
self.form.dirty.connect(self.__setDirty) def reset(self): """ recreates widget GUI """ self.createGUI() @Qt.pyqtSlot() def __setDirty(self): """ emits the `dirty` signal """ self.dirty.emit()
self.ui.data.show()
conditional_block
Data.py
#!/usr/bin/env python # This file is part of nexdatas - Tango Server for NeXus data writer # # Copyright (C) 2014-2017 DESY, Jan Kotanski <jkotan@mail.desy.de> # # nexdatas is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the ...
(self): """ emits the `dirty` signal """ self.dirty.emit()
__setDirty
identifier_name
StartScreen.py
from graphics import * from Button import * from CreateNewUserScreen import * from ChangePasswordScreen import * import os class StartScreen: def is_game_in_progress(self,gid): for filename in os.listdir("games"): if str(gid) == filename: return True return Fa...
message.setText("Invalid user/password or game ID") elif new_button.clicked(p): screen = CreateNewUserScreen() screen.create_new_user(db) elif change_button.clicked(p): screen = ChangePasswordScreen() scree...
p = win.getMouse() if login_button.clicked(p): user1 = user_entry.getText() password1 = password_entry.getText() if db.valid_user(user1,password1): self.player = db.get_user(user1) win.close() ...
conditional_block
StartScreen.py
from graphics import * from Button import * from CreateNewUserScreen import * from ChangePasswordScreen import * import os class StartScreen: def is_game_in_progress(self,gid): for filename in os.listdir("games"): if str(gid) == filename: return True return Fa...
login_button = Button("New game",Point(5,50),Point(35,60)) login_button.draw(win) continue_button = Button("Continue game",Point(5,35),Point(50,45)) continue_button.draw(win) game_id_entry = Entry(Point(70,40),10) game_id_entry.draw(win) new_button = But...
message.draw(win) # Create a login button and a quit button
random_line_split
StartScreen.py
from graphics import * from Button import * from CreateNewUserScreen import * from ChangePasswordScreen import * import os class StartScreen: def is_game_in_progress(self,gid):
def __init__(self): self.player = None def getPlayer(self): return self.player def login(self,db): win = GraphWin("CofC Scrabble",300,300) win.setCoords(0,0,100,100) Text(Point(17,80),"User: ").draw(win) Text(Point(17,70),"Passwor...
for filename in os.listdir("games"): if str(gid) == filename: return True return False
identifier_body
StartScreen.py
from graphics import * from Button import * from CreateNewUserScreen import * from ChangePasswordScreen import * import os class StartScreen: def is_game_in_progress(self,gid): for filename in os.listdir("games"): if str(gid) == filename: return True return Fa...
(self): self.player = None def getPlayer(self): return self.player def login(self,db): win = GraphWin("CofC Scrabble",300,300) win.setCoords(0,0,100,100) Text(Point(17,80),"User: ").draw(win) Text(Point(17,70),"Password: ").draw(win) ...
__init__
identifier_name
All.js
/* * /MathJax/jax/output/HTML-CSS/fonts/STIX/IntegralsUpSm/Regular/All.js * * Copyright (c) 2010 Design Science, Inc. * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0;
*/ MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.STIXIntegralsUpSm,{32:[0,0,250,0,0],160:[0,0,250,0,0],8748:[690,189,587,52,605],8749:[690,189,817,52,835],8751:[690,189,682,52,642],8752:[690,189,909,52,869],8753:[690,189,480,52,447],8754:[690,189,480,52,448],8755:[690,189,480,52,470],10763:[694,190,...
* you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0
random_line_split
file_codec.py
#!/usr/bin/python # Copyright 2014 Google. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
else: return filecmp.cmp(old_encoded_file, new_encoded_file)
old_checksum = subprocess.check_output((encoder.Tool('vpxdec'), '--md5', old_encoded_file)) new_checksum = subprocess.check_output((encoder.Tool('vpxdec'), '--md5', ...
conditional_block
file_codec.py
#!/usr/bin/python # Copyright 2014 Google. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
'--md5', new_encoded_file)) return old_checksum == new_checksum else: return filecmp.cmp(old_encoded_file, new_encoded_file)
random_line_split
file_codec.py
#!/usr/bin/python # Copyright 2014 Google. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
(self, parameters, bitrate, videofile, workdir): encodedfile = os.path.join(workdir, '%s.%s' % (videofile.basename, self.extension)) subprocess_cpu, elapsed_clock = self._EncodeFile(parameters, bitrate, videofile, encodedfile) ...
Execute
identifier_name
file_codec.py
#!/usr/bin/python # Copyright 2014 Google. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
def FfmpegFrameInfo(encodedfile): # Uses the ffprobe tool to give frame info. commandline = '%s -loglevel warning -show_frames -of json %s' % ( encoder.Tool('ffprobe'), encodedfile) ffprobeinfo = subprocess.check_output(commandline, shell=True) probeinfo = json.loads(ffprobeinfo) previous_position = ...
commandline = 'mkvinfo -v %s' % encodedfile print commandline mkvinfo = subprocess.check_output(commandline, shell=True) frameinfo = [] for line in mkvinfo.splitlines(): match = re.search(r'Frame with size (\d+)', line) if match: # The mkvinfo tool gives frame size in bytes. We want bits. fr...
identifier_body
calendar.d.ts
import { SSOAgent } from '../../internal/esi-agent'; import { Responses } from '../../../gen/esi'; /** * An api adapter that provides functions for accessing various details for a * specific event specified by id via functions in the * [calendar](https://esi.evetech.net/latest/#/Calendar) ESI endpoints. */ export i...
* * @param char The character access information * @returns An Calendar API instance */ export declare function makeCalendar(char: SSOAgent): Calendar;
random_line_split
test-src-sk_puppeteer_test.ts
import { expect } from 'chai'; import fetchMock from 'fetch-mock'; import { loadCachedTestBed, takeScreenshot, TestBed, } from '../../../puppeteer-tests/util'; fetchMock.config.overwriteRoutes = true; describe('test-src-sk', () => { let testBed: TestBed; before(async () => { testBed = await loadCachedTest...
}); }); });
describe('screenshots', () => { it('shows the default view', async () => { await takeScreenshot(testBed.page, 'fiddle', 'test-src-sk');
random_line_split
plugin.py
import gettext ################################################ def localeInit(): lang = language.getLanguage() environ["LANGUAGE"] = lang[:2] gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE)) gettext.textdomain("enigma2") gettext.bindtextdomain("ZapHistoryBrowser", "%s%s" % (resolveFilename(SC...
def zap(self): length = len(self.servicelist.history) if length > 0: self.servicelist.history_pos = (length - self["
self["list"].setList(list)
random_line_split
plugin.py
.history.append(tmp) hlen = len(instance.history) if hlen > config.plugins.ZapHistoryConfigurator.maxEntries_zap_history.value: del instance.history[0] hlen -= 1 instance.history_pos = hlen-1 ChannelSelection.addToHistory = addToHistory ################################################ class ZapHistoryCon...
main
identifier_name
plugin.py
import gettext ################################################ def localeInit(): lang = language.getLanguage() environ["LANGUAGE"] = lang[:2] gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE)) gettext.textdomain("enigma2") gettext.bindtextdomain("ZapHistoryBrowser", "%s%s" % (resolveFilename(SC...
else: self.l.setItemHeight(21) self.l.setFont(0, gFont("Regular", 21)) self.l.setFont(1, gFont("Regular", 16)) def ZapHistoryBrowserListEntry(serviceName, eventName): desktopSize = getDesktop(0).size() if desktopSize.width() == 1920: res = [serviceName] res.append(MultiContentEntryText(pos=(0, 0), ...
self.l.setItemHeight(21) self.l.setFont(0, gFont("Regular", 21)) self.l.setFont(1, gFont("Regular", 16))
conditional_block
plugin.py
urator.enable_zap_history.value == "parental_lock": if parentalControl.getProtectionLevel(ref.toCompareString()) != -1: return if instance.servicePath is not None: tmp = instance.servicePath[:] tmp.append(ref) try: del instance.history[instance.history_pos+1:] except: pass instance.history.append(tmp) ...
if self.allowChanges: self.session.open(ZapHistoryConfigurator)
identifier_body
AbilityModule.e2e.spec.ts
import { PureAbility } from '@casl/ability' import { TestBed } from '@angular/core/testing' import { createApp, createComponent, configureTestingModule, Post } from './spec_helper' const AppWithAblePipe = createApp('{{ \'read\' | able: post }}') const AppWithAblePurePipe = createApp('{{ \'read\' | ablePure: post | asy...
}) describe('module', () => { it('provides deprecated impure `can` pipe', () => { configureTestingModule([AppWithAblePurePipe]) fixture = createComponent(AppWithAblePurePipe) expect(fixture.nativeElement.textContent).toBe('false') }) it('provides impure `able` pipe', () => { c...
{ fixture.destroy() }
conditional_block
AbilityModule.e2e.spec.ts
import { PureAbility } from '@casl/ability' import { TestBed } from '@angular/core/testing' import { createApp, createComponent, configureTestingModule, Post } from './spec_helper' const AppWithAblePipe = createApp('{{ \'read\' | able: post }}') const AppWithAblePurePipe = createApp('{{ \'read\' | ablePure: post | asy...
it('provides impure `able` pipe', () => { configureTestingModule([AppWithAblePipe]) fixture = createComponent(AppWithAblePipe) expect(fixture.nativeElement.textContent).toBe('false') }) }) describe('`able` pipe', () => { behavesLikeAbilityPipe(AppWithAblePipe) }) describe('`ableP...
random_line_split
AbilityModule.e2e.spec.ts
import { PureAbility } from '@casl/ability' import { TestBed } from '@angular/core/testing' import { createApp, createComponent, configureTestingModule, Post } from './spec_helper' const AppWithAblePipe = createApp('{{ \'read\' | able: post }}') const AppWithAblePurePipe = createApp('{{ \'read\' | ablePure: post | asy...
}) it('returns `true` if object attribute equals to specified value', () => { expect(fixture.nativeElement.textContent).toBe('true') }) if (App !== AppWithAblePurePipe) { it('updates template when object attribute is changed', () => { post.author = 'not me' ...
{ beforeEach(() => { configureTestingModule([App]) ability = TestBed.inject(PureAbility) post = new Post({ author: 'me' }) }) it('updates template when `ability` is updated', () => { fixture = createComponent(App, { post }) ability.update([{ subject: Post.name, action: 'read' ...
identifier_body
AbilityModule.e2e.spec.ts
import { PureAbility } from '@casl/ability' import { TestBed } from '@angular/core/testing' import { createApp, createComponent, configureTestingModule, Post } from './spec_helper' const AppWithAblePipe = createApp('{{ \'read\' | able: post }}') const AppWithAblePurePipe = createApp('{{ \'read\' | ablePure: post | asy...
(App) { beforeEach(() => { configureTestingModule([App]) ability = TestBed.inject(PureAbility) post = new Post({ author: 'me' }) }) it('updates template when `ability` is updated', () => { fixture = createComponent(App, { post }) ability.update([{ subject: Post.name, action: '...
behavesLikeAbilityPipe
identifier_name
sv.py
# Author: Adam Chodorowski # Contact: chodorowski@users.sourceforge.net # Revision: $Revision: 2224 $ # Date: $Date: 2004-06-05 21:40:46 +0200 (Sat, 05 Jun 2004) $ # Copyright: This module has been placed in the public domain. # New language mappings are welcome. Before doing a new translation, please # re...
u'adress': 'address', u'kontakt': 'contact', u'version': 'version', u'revision': 'revision', u'status': 'status', u'datum': 'date', u'copyright': 'copyright', u'dedikation': 'dedication', u'sammanfattning': 'abstract' } ...
u'organisation': 'organization',
random_line_split
issue-2804.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-M...
(table: json::Object, key: String, default: String) -> String { match table.find(&key.to_string()) { option::Option::Some(&Json::String(ref s)) => { s.to_string() } option::Option::Some(value) => { println!("{} was expected to be a string but is a {}", key, value); ...
lookup
identifier_name
issue-2804.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-M...
{}
identifier_body
issue-2804.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-M...
} } fn add_interfaces(store: int, managed_ip: String, device: HashMap<String, json::Json>) -> Vec<(String, object)> { match device["interfaces".to_string()] { Json::Array(ref interfaces) => { interfaces.iter().map(|interface| { add_interface(store, managed_ip.clon...
{ println!("Expected dict for {} interfaces, found {}", managed_ip, data); ("gnos:missing-interface".to_string(), object::bool_value(true)) }
conditional_block
issue-2804.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...
} fn lookup(table: json::Object, key: String, default: String) -> String { match table.find(&key.to_string()) { option::Option::Some(&Json::String(ref s)) => { s.to_string() } option::Option::Some(value) => { println!("{} was expected to be a string but is a {}", key...
use std::option; enum object { bool_value(bool), int_value(i64),
random_line_split
intersectdialog.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from PyQt4.QtCore import * from PyQt4.QtGui import * from froi.algorithm import imtool class IntersectDialog(QDialog): """A dialog for action of intersection.""" def __init__(self, model, parent...
source_row = self.source_combo.currentIndex() mask_row = self.mask_combo.currentIndex() source_data = self._model.data(self._model.index(source_row), Qt.UserRole + 4) mask_data = self._model.data(self._model.index(mask_row), ...
QMessageBox.critical(self, "No output volume name", "Please specify output volume's name!") return
conditional_block
intersectdialog.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from PyQt4.QtCore import * from PyQt4.QtGui import * from froi.algorithm import imtool class IntersectDialog(QDialog): """A dialog for action of intersection.""" def __init__(self, model, parent...
def _create_output(self): source_name = self.source_combo.currentText() mask_name = self.mask_combo.currentText() output_name = '_'.join([str(source_name), str(mask_name)]) self.out_edit.setText(output_name) def _run_intersect(self): """Run an intersecting processing."...
self.source_combo.currentIndexChanged.connect(self._create_output) self.mask_combo.currentIndexChanged.connect(self._create_output) self.run_button.clicked.connect(self._run_intersect) self.cancel_button.clicked.connect(self.done)
identifier_body
intersectdialog.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from PyQt4.QtCore import * from PyQt4.QtGui import * from froi.algorithm import imtool class IntersectDialog(QDialog): """A dialog for action of intersection.""" def __init__(self, model, parent...
if not vol_name: QMessageBox.critical(self, "No output volume name", "Please specify output volume's name!") return source_row = self.source_combo.currentIndex() mask_row = self.mask_combo.currentIndex() source_data = self._model.data(s...
def _run_intersect(self): """Run an intersecting processing.""" vol_name = str(self.out_edit.text())
random_line_split
intersectdialog.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from PyQt4.QtCore import * from PyQt4.QtGui import * from froi.algorithm import imtool class IntersectDialog(QDialog): """A dialog for action of intersection.""" def __init__(self, model, parent...
(self): """Initialize GUI.""" # set dialog title self.setWindowTitle("Intersect") # initialize widgets source_label = QLabel("Source") self.source_combo = QComboBox() mask_label = QLabel("Mask") self.mask_combo = QComboBox() vol_list = self._model...
_init_gui
identifier_name
destructuringParameterDeclaration2.ts
// A parameter declaration may specify either an identifier or a binding pattern. // The identifiers specified in parameter declarations and binding patterns // in a parameter list must be unique within that parameter list. // If the declaration includes a type annotation, the parameter is of that type function ...
[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { } b1("string", { x: "string", y: true }); // Error // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) function c0({z: {x, y: {j}}}) { } function c1({z} = { z:...
([
identifier_name
destructuringParameterDeclaration2.ts
// A parameter declaration may specify either an identifier or a binding pattern. // The identifiers specified in parameter declarations and binding patterns // in a parameter list must be unique within that parameter list. // If the declaration includes a type annotation, the parameter is of that type function ...
interface F2 { d3([a, b, c]?); d4({x, y, z}?); e0([a, b, c]); } class C4 implements F2 { d3([a, b, c]?) { } // Error, binding pattern can't be optional in implementation signature d4({x, y, c}) { } e0([a, b, q]) { } } // Destructuring parameter declarations do not permit type ann...
} // Error, binding pattern can't be optional in implementation signature
identifier_body
destructuringParameterDeclaration2.ts
// A parameter declaration may specify either an identifier or a binding pattern. // The identifiers specified in parameter declarations and binding patterns // in a parameter list must be unique within that parameter list. // If the declaration includes a type annotation, the parameter is of that type function ...
function c5([a, b, [[c]]]) { } function c6([a, b, [[c = 1]]]) { } c0({ z: 1 }); // Error, implied type is { z: {x: any, y: {j: any}} } c1({}); // Error, implied type is {z:number}? c1({ z: true }); // Error, implied type is {z:number}? c2({ z: false }); // Error, implied type is {z?: number} ...
function c2({z = 10}) { } function c3({b}: { b: number|string } = { b: "hello" }) { } function c4([z], z: number) { } // Error Duplicate identifier
random_line_split
sdiv.rs
use num::Num; #[inline] pub fn sdiv<'a, 'b, T: Copy + Num>(out: &'a mut [T; 9], a: &'b [T; 9], s: T) -> &'a mut [T; 9] { let not_zero = s != T::zero(); out[0] = if not_zero {a[0] / s} else {T::zero()}; out[1] = if not_zero {a[1] / s} else
; out[2] = if not_zero {a[2] / s} else {T::zero()}; out[3] = if not_zero {a[3] / s} else {T::zero()}; out[4] = if not_zero {a[4] / s} else {T::zero()}; out[5] = if not_zero {a[5] / s} else {T::zero()}; out[6] = if not_zero {a[6] / s} else {T::zero()}; out[7] = if not_zero {a[7] / s} else {...
{T::zero()}
conditional_block
sdiv.rs
use num::Num; #[inline]
out[1] = if not_zero {a[1] / s} else {T::zero()}; out[2] = if not_zero {a[2] / s} else {T::zero()}; out[3] = if not_zero {a[3] / s} else {T::zero()}; out[4] = if not_zero {a[4] / s} else {T::zero()}; out[5] = if not_zero {a[5] / s} else {T::zero()}; out[6] = if not_zero {a[6] / s} else {T:...
pub fn sdiv<'a, 'b, T: Copy + Num>(out: &'a mut [T; 9], a: &'b [T; 9], s: T) -> &'a mut [T; 9] { let not_zero = s != T::zero(); out[0] = if not_zero {a[0] / s} else {T::zero()};
random_line_split
sdiv.rs
use num::Num; #[inline] pub fn sdiv<'a, 'b, T: Copy + Num>(out: &'a mut [T; 9], a: &'b [T; 9], s: T) -> &'a mut [T; 9] { let not_zero = s != T::zero(); out[0] = if not_zero {a[0] / s} else {T::zero()}; out[1] = if not_zero {a[1] / s} else {T::zero()}; out[2] = if not_zero {a[2] / s} else {T::zero(...
{ let mut v = [0, 0, 0, 0, 0, 0, 0, 0, 0]; sdiv(&mut v, &[1, 0, 0, 0, 1, 0, 0, 0, 1], 1); assert!(v == [1, 0, 0, 0, 1, 0, 0, 0, 1]); }
identifier_body
sdiv.rs
use num::Num; #[inline] pub fn sdiv<'a, 'b, T: Copy + Num>(out: &'a mut [T; 9], a: &'b [T; 9], s: T) -> &'a mut [T; 9] { let not_zero = s != T::zero(); out[0] = if not_zero {a[0] / s} else {T::zero()}; out[1] = if not_zero {a[1] / s} else {T::zero()}; out[2] = if not_zero {a[2] / s} else {T::zero(...
() { let mut v = [0, 0, 0, 0, 0, 0, 0, 0, 0]; sdiv(&mut v, &[1, 0, 0, 0, 1, 0, 0, 0, 1], 1); assert!(v == [1, 0, 0, 0, 1, 0, 0, 0, 1]); }
test_sdiv
identifier_name
google-custom-search.component.ts
import { Component, EventEmitter, Output } from '@angular/core'; import { GoogleCustomSearchService } from '../../shared/google-custom-search.service'; import { PreviewMediaDialogComponent } from '../../edit-thing/preview-media-dialog/preview-media-dialog.component'; import { MdDialog } from '@angular/material'; @Comp...
} } getMore() { if (this.searchBoxInput !== '') { this.searchResultPageIndex += this.imageResults.length; this.searchGoogleImages(this.searchBoxInput); } } selectImage(image: Link) { const dialogRef = this.dialog.open(PreviewMediaDialogComponent); dialogRef.componentInstance.u...
{ if (term !== this.searchBoxInput) { this.imageResults = []; } this.searchBoxInput = term; this.isSearching = true; this.googleCustomSearh.search(term, this.searchResultPageIndex).subscribe(data => { this.isSearching = false; try { const json: GoogleRes...
conditional_block
google-custom-search.component.ts
import { Component, EventEmitter, Output } from '@angular/core'; import { GoogleCustomSearchService } from '../../shared/google-custom-search.service'; import { PreviewMediaDialogComponent } from '../../edit-thing/preview-media-dialog/preview-media-dialog.component'; import { MdDialog } from '@angular/material'; @Comp...
}); } } getMore() { if (this.searchBoxInput !== '') { this.searchResultPageIndex += this.imageResults.length; this.searchGoogleImages(this.searchBoxInput); } } selectImage(image: Link) { const dialogRef = this.dialog.open(PreviewMediaDialogComponent); dialogRef.componentI...
random_line_split
google-custom-search.component.ts
import { Component, EventEmitter, Output } from '@angular/core'; import { GoogleCustomSearchService } from '../../shared/google-custom-search.service'; import { PreviewMediaDialogComponent } from '../../edit-thing/preview-media-dialog/preview-media-dialog.component'; import { MdDialog } from '@angular/material'; @Comp...
{ items: Link[]; } class Link { link: string; }
GoogleResults
identifier_name
comment.d.ts
// Type definitions for codemirror // Project: https://github.com/marijnh/CodeMirror // Definitions by: Nikolaj Kappler <https://github.com/nkappler> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // See docs https://codemirror.net/doc/manual.html#addon_comment // Todo: add 'toggleComment' command...
/** Try to uncomment the given range. Returns `true` if a comment range was found and removed, `false` otherwise. */ uncomment(from: Position, to: Position, options?: CommentOptions): boolean; } interface CommentOptions { /** Override the [comment string properties](https://codemirror.n...
/** Set the lines in the given range to be line comments. Will fall back to `blockComment` when no line comment style is defined for the mode. */ lineComment(from: Position, to: Position, options?: CommentOptions): void; /** Wrap the code in the given range in a block comment. Will fall back to ...
random_line_split
response.rs
6 // Jeff Nettleton // // Licensed under the MIT license (http://opensource.org/licenses/MIT). This // file may not be copied, modified, or distributed except according to those // terms use std::collections::BTreeMap; use chrono::Utc; use serde_json; use serde::Serialize; const VERSION: &str = env!("CARGO_PKG_VERSIO...
(&mut self, ctype: &str) { self.ctype = String::from(ctype); } /// Adds a header to the HTTP response. /// /// # Examples /// /// ```rust /// use canteen::Response; /// /// let mut res = Response::new(); /// res.add_header("Content-Type", "text/html"); /// ``` pu...
set_content_type
identifier_name
response.rs
6 // Jeff Nettleton // // Licensed under the MIT license (http://opensource.org/licenses/MIT). This // file may not be copied, modified, or distributed except according to those // terms use std::collections::BTreeMap; use chrono::Utc; use serde_json; use serde::Serialize; const VERSION: &str = env!("CARGO_PKG_VERSIO...
/// Adds a header to the HTTP response. /// /// # Examples /// /// ```rust /// use canteen::Response; /// /// let mut res = Response::new(); /// res.add_header("Content-Type", "text/html"); /// ``` pub fn add_header(&mut self, key: &str, value: &str) { if !self.head...
{ self.ctype = String::from(ctype); }
identifier_body
response.rs
6 // Jeff Nettleton // // Licensed under the MIT license (http://opensource.org/licenses/MIT). This // file may not be copied, modified, or distributed except according to those // terms use std::collections::BTreeMap; use chrono::Utc; use serde_json; use serde::Serialize; const VERSION: &str = env!("CARGO_PKG_VERSIO...
status: u16, cmsg: String, ctype: String, headers: BTreeMap<String, String>, payload: Vec<u8>, } impl Response { /// Create a new, empty Response. pub fn new() -> Response { let mut res = Response { status: 200, cmsg: String::fr...
} /// This struct reprsents the response to an HTTP client. #[derive(Debug, Default)] pub struct Response {
random_line_split
lock.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::fs; use std::fs::File; use std::io; use std::path::Path; use fs2::FileExt; /// RAII lock on a filesystem path. pub struct PathLock...
(&mut self) { self.file.unlock().expect("unlock"); } } #[cfg(test)] mod tests { use super::*; use std::sync::mpsc::channel; use std::thread; #[test] fn test_path_lock() -> io::Result<()> { let dir = tempfile::tempdir()?; let path = dir.path().join("a"); let (tx,...
drop
identifier_name
lock.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::fs; use std::fs::File; use std::io; use std::path::Path; use fs2::FileExt; /// RAII lock on a filesystem path. pub struct PathLock...
Ok(PathLock { file }) } } impl Drop for PathLock { fn drop(&mut self) { self.file.unlock().expect("unlock"); } } #[cfg(test)] mod tests { use super::*; use std::sync::mpsc::channel; use std::thread; #[test] fn test_path_lock() -> io::Result<()> { let dir = temp...
file.lock_exclusive()?;
random_line_split
app.module.ts
import { NgModule, ApplicationRef, CUSTOM_ELEMENTS_SCHEMA, APP_INITIALIZER } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule } from '@angular/http'; import { FormsModule } from '@angular/forms'; import { BrowserAnimationsModule } from '@angular/platform-browser/anima...
@NgModule({ bootstrap: [AppComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [ AppComponent, PlanetsList, AppHeaderComponent ], providers: [ { provide: APP_INITIALIZER, useFactory: initConfiguration, deps: [ngrxStore.Store], multi: true } ], imports...
{ return () => store.dispatch(new PlanetsFetchAction()); }
identifier_body
app.module.ts
import { NgModule, ApplicationRef, CUSTOM_ELEMENTS_SCHEMA, APP_INITIALIZER } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule } from '@angular/http'; import { FormsModule } from '@angular/forms'; import { BrowserAnimationsModule } from '@angular/platform-browser/anima...
{ }
AppModule
identifier_name
app.module.ts
import { NgModule, ApplicationRef, CUSTOM_ELEMENTS_SCHEMA, APP_INITIALIZER } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule } from '@angular/http'; import { FormsModule } from '@angular/forms'; import { BrowserAnimationsModule } from '@angular/platform-browser/anima...
PlanetsList, AppHeaderComponent ], providers: [ { provide: APP_INITIALIZER, useFactory: initConfiguration, deps: [ngrxStore.Store], multi: true } ], imports: [ BrowserModule, HttpModule, BrowserAnimationsModule, ExpandableListModule, FormsModule, A...
random_line_split
constants.js
'use strict'; const path = require('path'); const WIN_SLASH = '\\\\/'; const WIN_NO_SLASH = `[^${WIN_SLASH}]`; /** * Posix glob regex */ const DOT_LITERAL = '\\.'; const PLUS_LITERAL = '\\+'; const QMARK_LITERAL = '\\?'; const SLASH_LITERAL = '\\/'; const ONE_CHAR = '(?=.)'; const QMARK = '[^/]'; const END_ANCHOR ...
/** * Windows glob regex */ const WINDOWS_CHARS = { ...POSIX_CHARS, SLASH_LITERAL: `[${WIN_SLASH}]`, QMARK: WIN_NO_SLASH, STAR: `${WIN_NO_SLASH}*?`, DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, NO_DOT: `(?!${DOT_LITERAL})`, NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH...
};
random_line_split
constants.js
'use strict'; const path = require('path'); const WIN_SLASH = '\\\\/'; const WIN_NO_SLASH = `[^${WIN_SLASH}]`; /** * Posix glob regex */ const DOT_LITERAL = '\\.'; const PLUS_LITERAL = '\\+'; const QMARK_LITERAL = '\\?'; const SLASH_LITERAL = '\\/'; const ONE_CHAR = '(?=.)'; const QMARK = '[^/]'; const END_ANCHOR ...
};
{ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; }
identifier_body
constants.js
'use strict'; const path = require('path'); const WIN_SLASH = '\\\\/'; const WIN_NO_SLASH = `[^${WIN_SLASH}]`; /** * Posix glob regex */ const DOT_LITERAL = '\\.'; const PLUS_LITERAL = '\\+'; const QMARK_LITERAL = '\\?'; const SLASH_LITERAL = '\\/'; const ONE_CHAR = '(?=.)'; const QMARK = '[^/]'; const END_ANCHOR ...
(chars) { return { '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, '?': { type: 'qmark', open: '(?:', close: ')?' }, '+': { type: 'plus', open: '(?:', close: ')+' }, '*': { type: 'star', open: '(?:', close: ')*' }, '@': { type: 'at', open: '(?:', close: ')' } ...
extglobChars
identifier_name
start_parallel_jobs.py
#!/usr/bin/env python # File created on 10 Mar 2010 from __future__ import division __author__ = "Greg Caporaso" __copyright__ = "Copyright 2011-2013, The PICRUSt Project" __credits__ = ["Greg Caporaso","Morgan Langille"] __license__ = "GPL" __version__ = "1.1.0" __maintainer__ = "Greg Caporaso" __email__ = "gregcapor...
script_info['script_usage'] = [\ ("Example",\ "Start each command listed in test_jobs.txt in parallel. The run id for these jobs will be RUNID. ",\ "%prog -ms test_jobs.txt RUNID")] script_info['output_description']= "No output is created." script_info['required_options'] = [] script_info['optional_options'] = [\ m...
script_info['brief_description'] = "Starts multiple jobs in parallel on multicore or multiprocessor systems." script_info['script_description'] = "This script is designed to start multiple jobs in parallel on systems with no queueing system, for example a multiple processor or multiple core laptop/desktop machine. This...
random_line_split
start_parallel_jobs.py
#!/usr/bin/env python # File created on 10 Mar 2010 from __future__ import division __author__ = "Greg Caporaso" __copyright__ = "Copyright 2011-2013, The PICRUSt Project" __credits__ = ["Greg Caporaso","Morgan Langille"] __license__ = "GPL" __version__ = "1.1.0" __maintainer__ = "Greg Caporaso" __email__ = "gregcapor...
(): option_parser, opts, args =\ parse_command_line_parameters(**script_info) if opts.submit_jobs and not opts.make_jobs: option_parser.error('Must pass -m if passing -s. (Sorry about this, '+\ 'it\'s for backwards-compatibility.)') min_args = 2 if len(args) < min_args: ...
main
identifier_name
start_parallel_jobs.py
#!/usr/bin/env python # File created on 10 Mar 2010 from __future__ import division __author__ = "Greg Caporaso" __copyright__ = "Copyright 2011-2013, The PICRUSt Project" __credits__ = ["Greg Caporaso","Morgan Langille"] __license__ = "GPL" __version__ = "1.1.0" __maintainer__ = "Greg Caporaso" __email__ = "gregcapor...
f.close() chmod(job_fp, S_IRWXU) job_fps.append(job_fp) return job_fps, paths_to_remove def run_commands(output_dir,commands,run_id,submit_jobs,keep_temp,num_jobs=4): """ """ # Popen is not a big fan of how we join commands with semi-colons, # so each command is writte...
f.write('\n'.join([subcommand \ for subcommand in command.split(';') if subcommand.strip() not in ignored_subcommands]))
conditional_block
start_parallel_jobs.py
#!/usr/bin/env python # File created on 10 Mar 2010 from __future__ import division __author__ = "Greg Caporaso" __copyright__ = "Copyright 2011-2013, The PICRUSt Project" __credits__ = ["Greg Caporaso","Morgan Langille"] __license__ = "GPL" __version__ = "1.1.0" __maintainer__ = "Greg Caporaso" __email__ = "gregcapor...
rmtree(p) return def main(): option_parser, opts, args =\ parse_command_line_parameters(**script_info) if opts.submit_jobs and not opts.make_jobs: option_parser.error('Must pass -m if passing -s. (Sorry about this, '+\ 'it\'s for backwards-compatibility.)') ...
""" """ # Popen is not a big fan of how we join commands with semi-colons, # so each command is written to a shell script which is then called # by Popen job_fps, paths_to_remove = write_job_files(output_dir,commands,run_id,num_jobs=num_jobs) # Call the jobs if submit_jobs: for...
identifier_body
Vector.js
// Generated by CoffeeScript 1.4.0 /* 2D Vector */ var Vector; Vector = (function() { /* Adds two vectors and returns the product. */ Vector.add = function(v1, v2) { return new Vector(v1.x + v2.x, v1.y + v2.y); }; /* Subtracts v2 from v1 and returns the product. */ Vector.sub = function(v1, v2) ...
return dx * dx + dy * dy; }; /* Normalises the vector, making it a unit vector (of length 1). */ Vector.prototype.norm = function() { var m; m = Math.sqrt(this.x * this.x + this.y * this.y); this.x /= m; this.y /= m; return this; }; /* Limits the vector length to a given amount. ...
Vector.prototype.distSq = function(v) { var dx, dy; dx = v.x - this.x; dy = v.y - this.y;
random_line_split
Vector.js
// Generated by CoffeeScript 1.4.0 /* 2D Vector */ var Vector; Vector = (function() { /* Adds two vectors and returns the product. */ Vector.add = function(v1, v2) { return new Vector(v1.x + v2.x, v1.y + v2.y); }; /* Subtracts v2 from v1 and returns the product. */ Vector.sub = function(v1, v2) ...
}; /* Copies components from another vector. */ Vector.prototype.copy = function(v) { this.x = v.x; this.y = v.y; return this; }; /* Clones this vector to a new itentical one. */ Vector.prototype.clone = function() { return new Vector(this.x, this.y); }; /* Resets the vector ...
{ m = Math.sqrt(mSq); this.x /= m; this.y /= m; this.x *= l; this.y *= l; return this; }
conditional_block
Vector.js
// Generated by CoffeeScript 1.4.0 /* 2D Vector */ var Vector; Vector = (function() { /* Adds two vectors and returns the product. */ Vector.add = function(v1, v2) { return new Vector(v1.x + v2.x, v1.y + v2.y); }; /* Subtracts v2 from v1 and returns the product. */ Vector.sub = function(v1, v2) ...
(x, y) { this.x = x != null ? x : 0.0; this.y = y != null ? y : 0.0; } /* Sets the components of this vector. */ Vector.prototype.set = function(x, y) { this.x = x; this.y = y; return this; }; /* Add a vector to this one. */ Vector.prototype.add = function(v) { this.x += v....
Vector
identifier_name
Vector.js
// Generated by CoffeeScript 1.4.0 /* 2D Vector */ var Vector; Vector = (function() { /* Adds two vectors and returns the product. */ Vector.add = function(v1, v2) { return new Vector(v1.x + v2.x, v1.y + v2.y); }; /* Subtracts v2 from v1 and returns the product. */ Vector.sub = function(v1, v2) ...
/* Sets the components of this vector. */ Vector.prototype.set = function(x, y) { this.x = x; this.y = y; return this; }; /* Add a vector to this one. */ Vector.prototype.add = function(v) { this.x += v.x; this.y += v.y; return this; }; /* Subtracts a vector from this o...
{ this.x = x != null ? x : 0.0; this.y = y != null ? y : 0.0; }
identifier_body
index.d.ts
lineItems */ addVariants(item: Item, nextItem?: Array<Item>): Promise<Cart>; /** * Remove a line item from cart based on line item id */ removeLineItems(checkoutId: string | number, lineItemIds: string[]): Promise<Cart>; /** * Remove discounts from ...
id: string | number; created_at: string; position: number;
random_line_split
prof-router.ts
//prof-router.ts /// <reference path="../../../../typings/aurelia/aurelia-framework.d.ts"/> /// <reference path="../../../../typings/aurelia/aurelia-router.d.ts"/> /// import * as mrouter from 'aurelia-router';
const HOME_MODULE: string = '../welcome'; // @autoinject export class ProfRouter extends BaseView { public router: mrouter.Router; public heading: string = 'Devoirs'; // constructor(userinfo: userinf.UserInfo) { super(userinfo); }// constructor // public configureRouter(config, route...
import {autoinject} from 'aurelia-framework'; import {BaseView} from '../../viewmodel/baseview'; import * as userinf from '../../viewmodel/userinfo'; //
random_line_split
prof-router.ts
//prof-router.ts /// <reference path="../../../../typings/aurelia/aurelia-framework.d.ts"/> /// <reference path="../../../../typings/aurelia/aurelia-router.d.ts"/> /// import * as mrouter from 'aurelia-router'; import {autoinject} from 'aurelia-framework'; import {BaseView} from '../../viewmodel/baseview'; import * as ...
(userinfo: userinf.UserInfo) { super(userinfo); }// constructor // public configureRouter(config, router: mrouter.Router): any { config.map([ { route: ['', 'welcome'], moduleId: HOME_MODULE, nav: true, title: 'Accueil' }, { route: 'semestres-notes', moduleId: './notes-mat...
constructor
identifier_name
vehicleType_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: vehicleType.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message a...
_descriptor.EnumValueDescriptor( name='Ambulance', index=2, number=2, options=None, type=None), _descriptor.EnumValueDescriptor( name='Taxi', index=3, number=3, options=None, type=None), ], containing_type=None, options=None, serialized_start=21, serialized_end=80, ...
type=None), _descriptor.EnumValueDescriptor( name='TPMR', index=1, number=1, options=None, type=None),
random_line_split
angular-gantt-resizeSensor-plugin.js
/* Project: angular-gantt v1.3.2 - Gantt chart component for AngularJS Authors: Marco Schweighauser, Rémi Alvergnat License: MIT Homepage: https://www.angular-gantt.com Github: https://github.com/angular-gantt/angular-gantt.git */ (function(){ /* global ResizeSensor: false */ /* global ElementQueries: false */ ...
var style = getComputedStyle(el); height = height - parseInt(style.marginTop) - parseInt(style.marginBottom); ganttCtrl.gantt.$scope.ganttContainerHeight = height; var width = el.offsetWidth; styl...
var ganttElement = ganttCtrl.gantt.$element[0]; var ganttSensor = new ResizeSensor(ganttElement, function() { // See issue #664 var changed = false; if (Math.abs(ganttElement.clientWidth - ganttCtrl.gantt.$s...
identifier_body
angular-gantt-resizeSensor-plugin.js
/* Project: angular-gantt v1.3.2 - Gantt chart component for AngularJS Authors: Marco Schweighauser, Rémi Alvergnat License: MIT Homepage: https://www.angular-gantt.com Github: https://github.com/angular-gantt/angular-gantt.git */ (function(){ /* global ResizeSensor: false */ /* global ElementQueries: false */ ...
detach(sensors); sensors = []; } } }); } }; }]); }()); angular.module('gantt.resizeSensor.templates', []).run(['$templateCache', function ($templateCache) { }]); //# sourceMapp...
} else if (!newValue) {
random_line_split
angular-gantt-resizeSensor-plugin.js
/* Project: angular-gantt v1.3.2 - Gantt chart component for AngularJS Authors: Marco Schweighauser, Rémi Alvergnat License: MIT Homepage: https://www.angular-gantt.com Github: https://github.com/angular-gantt/angular-gantt.git */ (function(){ /* global ResizeSensor: false */ /* global ElementQueries: false */ ...
}); scope.$watch('enabled', function(newValue) { if (rendered) { if (newValue) { ElementQueries.update(); sensors = buildSensors(); } else if (!newValue) { ...
ElementQueries.update(); sensors = buildSensors(); }
conditional_block
angular-gantt-resizeSensor-plugin.js
/* Project: angular-gantt v1.3.2 - Gantt chart component for AngularJS Authors: Marco Schweighauser, Rémi Alvergnat License: MIT Homepage: https://www.angular-gantt.com Github: https://github.com/angular-gantt/angular-gantt.git */ (function(){ /* global ResizeSensor: false */ /* global ElementQueries: false */ ...
) { var ganttElement = ganttCtrl.gantt.$element[0]; var ganttSensor = new ResizeSensor(ganttElement, function() { // See issue #664 var changed = false; if (Math.abs(ganttElement.clientWidth - ganttCtrl.gantt...
uildSensors(
identifier_name
__init__.py
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify...
def __repr__(self): formatstr = "[{0}] ({1}) matched {2}:{3} {4}" return formatstr.format(self.rule.id, self.message, self.filename, self.linenumber, self.line) class Runner: def __init__(self, rules, playbooks, tags, skip_tags): self.rules = rules ...
self.filename = filename self.rule = rule self.message = message or rule.shortdesc
random_line_split
__init__.py
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify...
file['path'], self, message)) return matches def matchtask(self, file="", task=None): return [] def matchtasks(self, file, text): matches = [] yaml = ansiblelint.utils.parse_yaml_linenumbers(text) if yaml: for task in ansibleli...
def __repr__(self): return self.id + ": " + self.shortdesc def verbose(self): return self.id + ": " + self.shortdesc + "\n " + self.description def match(self, file="", line=""): return [] def matchlines(self, file, text): matches = [] # arrays are 0-based, line n...
identifier_body
__init__.py
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify...
return matches def matchyaml(self, file, text): matches = [] yaml = ansiblelint.utils.parse_yaml_linenumbers(text) if yaml and hasattr(self, 'matchplay'): for play in yaml: result = self.matchplay(file, play) if result: ...
message = None if isinstance(result, str): message = result taskstr = "Task/Handler: " + ansiblelint.utils.task_to_str(task) matches.append(Match(task[ansiblelint.utils.LINE_NUMBER_KEY], taskstr, ...
conditional_block
__init__.py
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify...
: def __init__(self, rules, playbooks, tags, skip_tags): self.rules = rules self.playbooks = set() for pb in playbooks: self.playbooks.add((pb, 'playbook')) self.tags = tags self.skip_tags = skip_tags def run(self): files = list() for playboo...
Runner
identifier_name
systemLogs.component.ts
import { Component, ChangeDetectionStrategy, OnInit, ViewChild } from '@angular/core'; import { Router, ActivatedRoute, Params } from '@angular/router'; import { HelperService } from '../../services/helper.service'; import { ModalDirective } from 'ng2-bootstrap/components/modal/modal.component'; @Component({ moduleId...
(pageNo:number):void { this.currentPage = pageNo; }; public pageChanged(event:any):void { console.log('Page changed to: ' + event.page); console.log('Number items per page: ' + event.itemsPerPage); this._helperService.getUserList(event.itemsPerPage, event.page) .subscribe(data => this.users = data.result)...
setPage
identifier_name
systemLogs.component.ts
import { Component, ChangeDetectionStrategy, OnInit, ViewChild } from '@angular/core'; import { Router, ActivatedRoute, Params } from '@angular/router'; import { HelperService } from '../../services/helper.service'; import { ModalDirective } from 'ng2-bootstrap/components/modal/modal.component'; @Component({ moduleId...
public pageChanged(event:any):void { console.log('Page changed to: ' + event.page); console.log('Number items per page: ' + event.itemsPerPage); this._helperService.getUserList(event.itemsPerPage, event.page) .subscribe(data => this.users = data.result); }; public viewProduct(productId:any):void{ console...
this.currentPage = pageNo; };
random_line_split
wechat.js
(url) 使用浏览器打开网址 * WeixinJS.jumpToBizProfile(username) 跳转到指定公众账号页面 * WeixinJS.sendEmail(title,content) 发送邮件 * WeixinJS.openProductView(latitude,longitude,name,address,scale,infoUrl) 查看地图 * WeixinJS.addContact(username) 添加微信账号 * WeixinJS.imagePreview(urls,current) 调出微信内图片预览 * WeixinJS.payCallback(appId,package,time...
WeixinJS.sendEmail=function(title,content){ if (typeof WeixinJSBridge!='undefined') WeixinJSBridge.invoke("sendEmail",{ "title" : title, "content" : content }); }; //查看地图 WeixinJS.openProductView=function(latitude,longitude,name,address,scale,infoUrl){ if (typeof WeixinJSBridge!='undefined') WeixinJSBridge...
random_line_split
crlist.component.spec.ts
/** * Copyright 2016 Sven Loesekann Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
import { Component } from '@angular/core'; import { By } from '@angular/platform-browser'; import { CrlistComponent } from './crlist.component'; //describe('Component: MyComponent', () => { // it('should create an instance', () => { // let component = new LsddetailComponent(null,null,null); // expect(component)...
*/ /* eslint-disable @typescript-eslint/no-unused-vars */ import { TestBed, waitForAsync } from '@angular/core/testing';
random_line_split
test_joins.py
import relations
employees = relations.Relation('name', 'emp_id', 'dept_name') employees.add(name='Harry', emp_id=3415, dept_name='Finance') employees.add(name='Sally', emp_id=2241, dept_name='Sales') employees.add(name='George', emp_id=3401, dept_name='Finance') employees.add(name='Harriet', emp_id=2202, dept_name='Sales') department...
random_line_split
test_joins.py
import relations employees = relations.Relation('name', 'emp_id', 'dept_name') employees.add(name='Harry', emp_id=3415, dept_name='Finance') employees.add(name='Sally', emp_id=2241, dept_name='Sales') employees.add(name='George', emp_id=3401, dept_name='Finance') employees.add(name='Harriet', emp_id=2202, dept_name='...
def test_natural_join_on_disjoint_relations_is_cartesian_product(): joined = employees.project('name', 'emp_id').natural_join(departments) assert len(joined) == (len(employees) * len(departments))
joined = employees.natural_join(departments) assert len(joined) == 4
identifier_body
test_joins.py
import relations employees = relations.Relation('name', 'emp_id', 'dept_name') employees.add(name='Harry', emp_id=3415, dept_name='Finance') employees.add(name='Sally', emp_id=2241, dept_name='Sales') employees.add(name='George', emp_id=3401, dept_name='Finance') employees.add(name='Harriet', emp_id=2202, dept_name='...
(): joined = employees.project('name', 'emp_id').natural_join(departments) assert len(joined) == (len(employees) * len(departments))
test_natural_join_on_disjoint_relations_is_cartesian_product
identifier_name
electronFilesWorker.js
const fs = require('fs'); const path = require('path'); const { COPYFILE_EXCL } = fs.constants; function isConflict(origStat, stat) { return stat != null && origStat != null && stat.mtimeMs != origStat.mtimeMs; }; function saveFile(fileObject, data, origStat, overwrite, defEnc, reqId) { var retryCount = 0; var bac...
} }); } }; function doSaveFile() { //Copy file to backup file (after conflict and stat is checked) fs.copyFile(fileObject.path, fileObject.bkpPath, COPYFILE_EXCL, (err) => { if (!err) { backupCreated = true; } writeFile(); }); }; if (overwrite) { doSaveFile...
} });
random_line_split
electronFilesWorker.js
const fs = require('fs'); const path = require('path'); const { COPYFILE_EXCL } = fs.constants; function
(origStat, stat) { return stat != null && origStat != null && stat.mtimeMs != origStat.mtimeMs; }; function saveFile(fileObject, data, origStat, overwrite, defEnc, reqId) { var retryCount = 0; var backupCreated = false; var writeFile = function() { if (data == null || data.length == 0) { postMessage({err...
isConflict
identifier_name
electronFilesWorker.js
const fs = require('fs'); const path = require('path'); const { COPYFILE_EXCL } = fs.constants; function isConflict(origStat, stat) { return stat != null && origStat != null && stat.mtimeMs != origStat.mtimeMs; }; function saveFile(fileObject, data, origStat, overwrite, defEnc, reqId) { var retryCount = 0; var bac...
; if (overwrite) { doSaveFile(); } else { //TODO Using stat before write is not recommended, we can check the error code from writeFile fs.stat(fileObject.path, function(err, stat) { if (isConflict(origStat, stat)) { postMessage({error: true, msg: 'conflict', e: {isConflicted: true}, reqId: ...
{ //Copy file to backup file (after conflict and stat is checked) fs.copyFile(fileObject.path, fileObject.bkpPath, COPYFILE_EXCL, (err) => { if (!err) { backupCreated = true; } writeFile(); }); }
identifier_body
electronFilesWorker.js
const fs = require('fs'); const path = require('path'); const { COPYFILE_EXCL } = fs.constants; function isConflict(origStat, stat) { return stat != null && origStat != null && stat.mtimeMs != origStat.mtimeMs; }; function saveFile(fileObject, data, origStat, overwrite, defEnc, reqId) { var retryCount = 0; var bac...
}; //TODO handle reqId better onmessage = function(e) { switch(e.data.action) { case 'saveFile': saveFile(e.data.fileObject, e.data.data, e.data.origStat, e.data.overwrite, e.data.defEnc, e.data.reqId); break; }; };
{ //TODO Using stat before write is not recommended, we can check the error code from writeFile fs.stat(fileObject.path, function(err, stat) { if (isConflict(origStat, stat)) { postMessage({error: true, msg: 'conflict', e: {isConflicted: true}, reqId: reqId}); } else if (err != null && err.code...
conditional_block