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
interfaceTest.js
/** * Created by dt on 2016/10/18. */ var utils = require('../tinyTool/utils.js'); var date = require('../tinyTool/date.js'); var http = require('http'); var urlParse = require('url').parse; var querystring = require('querystring'); var interfaceTestData = { data_URL : [], data_UserId : [], d...
var _postData = { "UserId": UserId, "FunctionId": FunctionId, "Time": time, "RequestData":postData, "Sign": sign }; //var postData = querystring.stringify({ // "UserId": UserId, // "FunctionId": FunctionId, // "Time": time, // ...
if(isMD5 ===true || isMD5 === "true"){ key = utils.toMD5(key); } var time = date.getFormatDate('yyyyMMddhhmmss'); var sign = utils.toMD5(UserId.toString() + key + FunctionId + time);
random_line_split
interfaceTest.js
/** * Created by dt on 2016/10/18. */ var utils = require('../tinyTool/utils.js'); var date = require('../tinyTool/date.js'); var http = require('http'); var urlParse = require('url').parse; var querystring = require('querystring'); var interfaceTestData = { data_URL : [], data_UserId : [], d...
UserId",UserId); insertData("data_FunctionId",FunctionId); insertData("data_key",key); console.log(interfaceTestData) //是否再加密 if(isMD5 ===true || isMD5 === "true"){ key = utils.toMD5(key); } var time = date.getFormatDate('yyyyMMddhhmmss'); var sign = utils.toMD5(UserId...
onsole.log(111) insertData("data_URL",url); insertData("data_
conditional_block
che-remote-recipe.ts
/* * Copyright (c) 2015-2018 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat, Inc. - initial API a...
{ $resource: ng.resource.IResourceService; authData: any; remoteRecipesAPI: any; /** * Default constructor that is using resource */ constructor($resource: ng.resource.IResourceService, authData: any) { this.$resource = $resource; this.authData = authData; // remote call ...
CheRemoteRecipe
identifier_name
che-remote-recipe.ts
/* * Copyright (c) 2015-2018 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat, Inc. - initial API a...
constructor($resource: ng.resource.IResourceService, authData: any) { this.$resource = $resource; this.authData = authData; // remote call this.remoteRecipesAPI = this.$resource('', {}, { create: {method: 'POST', url: authData.url + '/api/recipe?token=' + authData.token} }); ...
remoteRecipesAPI: any; /** * Default constructor that is using resource */
random_line_split
che-remote-recipe.ts
/* * Copyright (c) 2015-2018 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat, Inc. - initial API a...
/** * Create a recipe * @param {any} recipe the recipe to create * @returns {ng.IPromise<any>} */ create(recipe: any): ng.IPromise<any> { return this.remoteRecipesAPI.create(recipe).$promise; } }
{ this.$resource = $resource; this.authData = authData; // remote call this.remoteRecipesAPI = this.$resource('', {}, { create: {method: 'POST', url: authData.url + '/api/recipe?token=' + authData.token} }); }
identifier_body
inner.rs
use crate::types::*; use ndarray::*; /// Inner Product /// /// Differenct from `Dot` trait, this take complex conjugate of `self` elements /// pub trait InnerProduct { type Elem: Scalar; /// Inner product `(self.conjugate, rhs) fn inner<S>(&self, rhs: &ArrayBase<S, Ix1>) -> Self::Elem where S:...
<St: Data<Elem = A>>(&self, rhs: &ArrayBase<St, Ix1>) -> A { assert_eq!(self.len(), rhs.len()); Zip::from(self) .and(rhs) .fold_while(A::zero(), |acc, s, r| { FoldWhile::Continue(acc + s.conj() * *r) }) .into_inner() } }
inner
identifier_name
inner.rs
use crate::types::*; use ndarray::*; /// Inner Product /// /// Differenct from `Dot` trait, this take complex conjugate of `self` elements /// pub trait InnerProduct { type Elem: Scalar; /// Inner product `(self.conjugate, rhs) fn inner<S>(&self, rhs: &ArrayBase<S, Ix1>) -> Self::Elem where S:...
}
{ assert_eq!(self.len(), rhs.len()); Zip::from(self) .and(rhs) .fold_while(A::zero(), |acc, s, r| { FoldWhile::Continue(acc + s.conj() * *r) }) .into_inner() }
identifier_body
inner.rs
use crate::types::*; use ndarray::*; /// Inner Product /// /// Differenct from `Dot` trait, this take complex conjugate of `self` elements /// pub trait InnerProduct { type Elem: Scalar; /// Inner product `(self.conjugate, rhs) fn inner<S>(&self, rhs: &ArrayBase<S, Ix1>) -> Self::Elem where S:...
S: Data<Elem = A>, { type Elem = A; fn inner<St: Data<Elem = A>>(&self, rhs: &ArrayBase<St, Ix1>) -> A { assert_eq!(self.len(), rhs.len()); Zip::from(self) .and(rhs) .fold_while(A::zero(), |acc, s, r| { FoldWhile::Continue(acc + s.conj() * *r) ...
impl<A, S> InnerProduct for ArrayBase<S, Ix1> where A: Scalar,
random_line_split
mod.rs
//! A module for grouping things that handle serial data pub mod command; pub use self::command::*; use std::io::Write; use csv::Writer; use setup; use protocol::Message; use config::DataRecordingConfig; /// A struct to handle serial data pub struct SerialHandler { data_records: Writer<Box<Write>>, } impl Serial...
(config: &DataRecordingConfig) -> Self { SerialHandler { data_records: setup::data_recording(config) } } pub fn handle(&mut self, message: Message) { match message { Message::Command(command) => command::CommandHandler::handle(command), Message::Data(data) => { ...
new
identifier_name
mod.rs
//! A module for grouping things that handle serial data pub mod command; pub use self::command::*; use std::io::Write; use csv::Writer; use setup; use protocol::Message; use config::DataRecordingConfig; /// A struct to handle serial data pub struct SerialHandler { data_records: Writer<Box<Write>>, } impl Serial...
}
{ match message { Message::Command(command) => command::CommandHandler::handle(command), Message::Data(data) => { if let Err(error) = self.data_records.serialize(data) { error!( "Error serializing data to write to records: \"{:?...
identifier_body
mod.rs
//! A module for grouping things that handle serial data pub mod command; pub use self::command::*; use std::io::Write; use csv::Writer; use setup; use protocol::Message; use config::DataRecordingConfig; /// A struct to handle serial data pub struct SerialHandler { data_records: Writer<Box<Write>>, } impl Serial...
} } }
{ if let Err(error) = self.data_records.serialize(data) { error!( "Error serializing data to write to records: \"{:?}\"", error ); } else if let Err(error) = self.data_records.flush() { ...
conditional_block
mod.rs
//! A module for grouping things that handle serial data pub mod command; pub use self::command::*;
use setup; use protocol::Message; use config::DataRecordingConfig; /// A struct to handle serial data pub struct SerialHandler { data_records: Writer<Box<Write>>, } impl SerialHandler { pub fn new(config: &DataRecordingConfig) -> Self { SerialHandler { data_records: setup::data_recording(config) } ...
use std::io::Write; use csv::Writer;
random_line_split
app.js
import './init' import React from 'react' import ReactDom from 'react-dom' import Root from './root' import {APP_THEMES_LIGHT, APP_THEMES_DARK} from 'reducers/settings/constants' import LocalStorage from 'lib/localStorage' import {initializeStore} from './redux/store' import {initServiceWorker} from './swWindow' // ren...
return { settings: { theme: theme || APP_THEMES_LIGHT } } } // init store and start app const appRoot = document.getElementById('app-root') const store = initializeStore(prepareStoreData()) renderApp(Root, appRoot, store)
{ if (window.matchMedia('(prefers-color-scheme: dark)')?.matches) { theme = APP_THEMES_DARK } }
conditional_block
app.js
import './init' import React from 'react' import ReactDom from 'react-dom' import Root from './root' import {APP_THEMES_LIGHT, APP_THEMES_DARK} from 'reducers/settings/constants' import LocalStorage from 'lib/localStorage' import {initializeStore} from './redux/store' import {initServiceWorker} from './swWindow' // ren...
theme = APP_THEMES_DARK } } return { settings: { theme: theme || APP_THEMES_LIGHT } } } // init store and start app const appRoot = document.getElementById('app-root') const store = initializeStore(prepareStoreData()) renderApp(Root, appRoot, store)
random_line_split
application_window.rs
// This file was generated by gir (b7f5189) from gir-files (71d73f0) // DO NOT EDIT use Application; use Bin; use Container; #[cfg(feature = "v3_20")] use ShortcutsWindow; use Widget; use Window; use ffi; use gio; use gio_ffi; use glib::object::Downcast; use glib::translate::*; glib_wrapper! { pub struct Applicat...
}
{ unsafe { ffi::gtk_application_window_set_show_menubar(self.to_glib_none().0, show_menubar.to_glib()); } }
identifier_body
application_window.rs
// This file was generated by gir (b7f5189) from gir-files (71d73f0) // DO NOT EDIT use Application; use Bin; use Container; #[cfg(feature = "v3_20")] use ShortcutsWindow; use Widget; use Window; use ffi; use gio; use gio_ffi; use glib::object::Downcast; use glib::translate::*; glib_wrapper! { pub struct Applicat...
(&self) -> Option<ShortcutsWindow> { unsafe { from_glib_none(ffi::gtk_application_window_get_help_overlay(self.to_glib_none().0)) } } #[cfg(feature = "v3_6")] pub fn get_id(&self) -> u32 { unsafe { ffi::gtk_application_window_get_id(self.to_glib_none().0) ...
get_help_overlay
identifier_name
application_window.rs
// This file was generated by gir (b7f5189) from gir-files (71d73f0) // DO NOT EDIT use Application; use Bin; use Container; #[cfg(feature = "v3_20")] use ShortcutsWindow; use Widget; use Window; use ffi; use gio; use gio_ffi; use glib::object::Downcast; use glib::translate::*; glib_wrapper! {
Widget, gio::ActionGroup => gio_ffi::GActionGroup, gio::ActionMap => gio_ffi::GActionMap, ]; match fn { get_type => || ffi::gtk_application_window_get_type(), } } impl ApplicationWindow { pub fn new(application: &Application) -> ApplicationWindow { skip_assert_i...
pub struct ApplicationWindow(Object<ffi::GtkApplicationWindow>): [ Window, Bin, Container,
random_line_split
RadioManagement.py
from PyQt4.QtCore import * from PyQt4 import QtGui class RadioManagement (): def __init__ (self, radioCol, gridLayout): self.radioGroup = QtGui.QButtonGroup() # To store radio buttons. self.radioCol = radioCol self.gridLayout = gridLayout def initDelAndMovButtons (self, vLayout): # Add hbox for edit button...
# Finally, delete the last row. for i in range (self.gridLayout.columnCount()): widgetItem = self.gridLayout.itemAtPosition (rowCount, i) # Delete the widget. self.deleteWidgetItem (widgetItem) self.gridLayout.invalidate() def swapRows (self, row1, row2): row1Widgets = {} for i in range (self...
# We'll also need to remove the radio button's reference from "radioGroup". lastRadioButon = self.gridLayout.itemAtPosition (rowCount, self.radioCol) self.radioGroup.removeButton (lastRadioButon.widget())
random_line_split
RadioManagement.py
from PyQt4.QtCore import * from PyQt4 import QtGui class RadioManagement (): def __init__ (self, radioCol, gridLayout): self.radioGroup = QtGui.QButtonGroup() # To store radio buttons. self.radioCol = radioCol self.gridLayout = gridLayout def initDelAndMovButtons (self, vLayout): # Add hbox for edit button...
(self, widgetItem, posX, posY): if widgetItem == None: return widget = widgetItem.widget() if widget != None: # Looks like we're processing a widget. self.gridLayout.addWidget (widget, posX, posY) return # We otherwise assume it's a layout. layout = widgetItem.layout() # Bug in PyQt. Cause...
addWidgetItem
identifier_name
RadioManagement.py
from PyQt4.QtCore import * from PyQt4 import QtGui class RadioManagement (): def __init__ (self, radioCol, gridLayout): self.radioGroup = QtGui.QButtonGroup() # To store radio buttons. self.radioCol = radioCol self.gridLayout = gridLayout def initDelAndMovButtons (self, vLayout): # Add hbox for edit button...
widgetItem = self.gridLayout.itemAtPosition (rowNum, i) # Delete the widget. self.deleteWidgetItem (widgetItem) # Next, move everything up row by row. +1 is to offset from the row we just deleted. for i in range (rowNum + 1, rowCount + 1): for j in range (self.gridLayout.columnCount()): if j ==...
continue
conditional_block
RadioManagement.py
from PyQt4.QtCore import * from PyQt4 import QtGui class RadioManagement (): def __init__ (self, radioCol, gridLayout): self.radioGroup = QtGui.QButtonGroup() # To store radio buttons. self.radioCol = radioCol self.gridLayout = gridLayout def initDelAndMovButtons (self, vLayout): # Add hbox for edit button...
continue widgetItem = self.gridLayout.itemAtPosition (i, j) self.addWidgetItem (widgetItem, i - 1, j) # We'll also need to remove the radio button's reference from "radioGroup". lastRadioButon = self.gridLayout.itemAtPosition (rowCount, self.radioCol) self.radioGroup.removeButton (lastRadioButon.w...
rowCount = self.getRowCount() # What we'll actually do, is leave the radio buttons in tact, but # delete all the other widgets in the row. Then we'll move everything # else up, and finally delete the last radio button. for i in range (self.gridLayout.columnCount()): # Skip the radio button's column. ...
identifier_body
traversal.rs
TraversalData; use wrapper::{GetRawData, LayoutNodeLayoutData}; use wrapper::ThreadSafeLayoutNodeHelpers; pub struct RecalcStyleAndConstructFlows<'a> { context: LayoutContext<'a>, } impl<'a> RecalcStyleAndConstructFlows<'a> { pub fn layout_context(&self) -> &LayoutContext<'a> { &self.context } } ...
<F>(&self, traversal_data: &PerLevelTraversalData, context: &mut StyleContext<E>, node: E::ConcreteNode, note_child: F) where F: FnMut(E::ConcreteNode) { // FIXME(pcwalton): Stop allocating here. Ideally this should just be // done by the...
process_preorder
identifier_name
traversal.rs
RecalcStyleAndConstructFlows<'a> { pub fn layout_context(&self) -> &LayoutContext<'a> { &self.context } } impl<'a> RecalcStyleAndConstructFlows<'a> { /// Creates a traversal context, taking ownership of the shared layout context. pub fn new(context: LayoutContext<'a>) -> Self { RecalcS...
{ return }
conditional_block
traversal.rs
TraversalData; use wrapper::{GetRawData, LayoutNodeLayoutData}; use wrapper::ThreadSafeLayoutNodeHelpers; pub struct RecalcStyleAndConstructFlows<'a> { context: LayoutContext<'a>, } impl<'a> RecalcStyleAndConstructFlows<'a> { pub fn layout_context(&self) -> &LayoutContext<'a> { &self.context } } ...
#[inline] fn process(&self, flow: &mut Flow) { flow.bubble_inline_sizes(); flow::mut_base(flow).restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES); } #[inline] fn should_process(&self, flow: &mut Flow) -> bool { flow::base(flow).restyle_damage.contains(ServoRestyleDama...
impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
random_line_split
DocumentAttachmentPanel.tsx
import React, { FC, memo, useCallback } from 'react'; import { Panel } from 'react-bootstrap'; import { FileAttachmentForm } from '@labkey/components'; import { Map } from 'immutable'; import produce, { Draft } from 'immer'; import { DocumentAttachmentModel } from '../model'; interface Props { model: DocumentAtt...
}, [model, onInputChange] ); return ( <> <Panel className="panel panel-default" expanded={true} onToggle={function () {}} // this is added to suppress JS warning about providing an expanded prop without onToggle > ...
{ window.open(attachment[0].href, 'popwin'); }
conditional_block
DocumentAttachmentPanel.tsx
import React, { FC, memo, useCallback } from 'react'; import { Panel } from 'react-bootstrap'; import { FileAttachmentForm } from '@labkey/components'; import { Map } from 'immutable'; import produce, { Draft } from 'immer'; import { DocumentAttachmentModel } from '../model'; interface Props { model: DocumentAtt...
<> <Panel className="panel panel-default" expanded={true} onToggle={function () {}} // this is added to suppress JS warning about providing an expanded prop without onToggle > <div className="bg-primary"> ...
[model, onInputChange] ); return (
random_line_split
lib.rs
extern crate pcap; use pcap::{Active, Activated, Offline, Capture}; use std::path::Path; #[test] fn read_packet_with_full_data() {
#[test] fn read_packet_with_truncated_data() { let mut capture = capture_from_test_file("packet_snaplen_20.pcap"); assert_eq!(capture.next().unwrap().len(), 20); } fn capture_from_test_file(file_name: &str) -> Capture<Offline> { let path = Path::new("tests/data/").join(file_name); Capture::from_file(pa...
let mut capture = capture_from_test_file("packet_snaplen_65535.pcap"); assert_eq!(capture.next().unwrap().len(), 98); }
random_line_split
lib.rs
extern crate pcap; use pcap::{Active, Activated, Offline, Capture}; use std::path::Path; #[test] fn read_packet_with_full_data() { let mut capture = capture_from_test_file("packet_snaplen_65535.pcap"); assert_eq!(capture.next().unwrap().len(), 98); } #[test] fn read_packet_with_truncated_data() { let mut...
(file_name: &str) -> Capture<Offline> { let path = Path::new("tests/data/").join(file_name); Capture::from_file(path).unwrap() } #[test] fn unify_activated() { #![allow(dead_code)] fn test1() -> Capture<Active> { loop{} } fn test2() -> Capture<Offline> { loop{} } fn maybe(a: bool) -> Capture<Activ...
capture_from_test_file
identifier_name
lib.rs
extern crate pcap; use pcap::{Active, Activated, Offline, Capture}; use std::path::Path; #[test] fn read_packet_with_full_data() { let mut capture = capture_from_test_file("packet_snaplen_65535.pcap"); assert_eq!(capture.next().unwrap().len(), 98); } #[test] fn read_packet_with_truncated_data() { let mut...
else { test2().into() } } fn also_maybe(a: &mut Capture<Activated>) { a.filter("whatever filter string, this won't be run anyway").unwrap(); } }
{ test1().into() }
conditional_block
lib.rs
extern crate pcap; use pcap::{Active, Activated, Offline, Capture}; use std::path::Path; #[test] fn read_packet_with_full_data() { let mut capture = capture_from_test_file("packet_snaplen_65535.pcap"); assert_eq!(capture.next().unwrap().len(), 98); } #[test] fn read_packet_with_truncated_data() { let mut...
#[test] fn unify_activated() { #![allow(dead_code)] fn test1() -> Capture<Active> { loop{} } fn test2() -> Capture<Offline> { loop{} } fn maybe(a: bool) -> Capture<Activated> { if a { test1().into() } else { test2().into() } } fn also_maybe(a: &mut Capture<Activated>) { a.filter("whateve...
{ let path = Path::new("tests/data/").join(file_name); Capture::from_file(path).unwrap() }
identifier_body
unique-vec-res.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct r { i: @mu...
// http://rust-lang.org/COPYRIGHT. //
random_line_split
unique-vec-res.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 ...
} fn f<T>(_i: ~[T], _j: ~[T]) { } fn main() { let i1 = @mut 0; let i2 = @mut 1; let r1 = ~[~r { i: i1 }]; let r2 = ~[~r { i: i2 }]; f(copy r1, copy r2); //~^ ERROR copying a value of non-copyable type //~^^ ERROR copying a value of non-copyable type info!((r2, *i1)); info!((r1, *i...
{ unsafe { *(self.i) = *(self.i) + 1; } }
identifier_body
unique-vec-res.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 ...
(&self) { unsafe { *(self.i) = *(self.i) + 1; } } } fn f<T>(_i: ~[T], _j: ~[T]) { } fn main() { let i1 = @mut 0; let i2 = @mut 1; let r1 = ~[~r { i: i1 }]; let r2 = ~[~r { i: i2 }]; f(copy r1, copy r2); //~^ ERROR copying a value of non-copyable type //~^^ E...
drop
identifier_name
selectors.test.ts
import { getApiKeys } from './selectors'; import { getMultipleMockKeys } from '../__mocks__/apiKeysMock'; import { ApiKeysState } from 'app/types'; describe('API Keys selectors', () => { describe('Get API Keys', () => { const mockKeys = getMultipleMockKeys(5); it('should return all keys if no search query'...
expect(keys.length).toEqual(1); }); }); });
const keys = getApiKeys(mockState);
random_line_split
database.js
/** * Created by Samuel Schmid on 23.03.14. * * Class for Database Handling * * Containing * - App Config * - Database Information * * @type {Database} */ module.exports = Database; Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] === obj) { ...
(grunt) { this.grunt = grunt; this.appconfig = grunt.config().appconfig; this.db = this.appconfig.db; } /** * delete Database Schemes of Docs * * @param docs */ Database.prototype.deleteSchemes = function(docs) { var grunt = this.grunt; grunt.log.debug("start "); if(docs.docs.length > 0) { ...
Database
identifier_name
database.js
/** * Created by Samuel Schmid on 23.03.14. * * Class for Database Handling * * Containing * - App Config * - Database Information * * @type {Database} */ module.exports = Database; Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] === obj) { ...
/** * delete Database Schemes of Docs * * @param docs */ Database.prototype.deleteSchemes = function(docs) { var grunt = this.grunt; grunt.log.debug("start "); if(docs.docs.length > 0) { var firstDoc = docs.docs[0]; var rootfolder = firstDoc.schemefolder.split("/")[0]; grunt....
{ this.grunt = grunt; this.appconfig = grunt.config().appconfig; this.db = this.appconfig.db; }
identifier_body
database.js
/** * Created by Samuel Schmid on 23.03.14. * * Class for Database Handling * * Containing * - App Config * - Database Information * * @type {Database} */ module.exports = Database; Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] === obj) { ...
} } provider.writeLib(); } else { grunt.log.write("cannot create schemes for database " + this.db.name + ", because there we can't use the provider "+this.db.provider+" for it."); } } else { grunt.log.write("cannot create schemes for d...
provider.writeScheme(doc);
random_line_split
database.js
/** * Created by Samuel Schmid on 23.03.14. * * Class for Database Handling * * Containing * - App Config * - Database Information * * @type {Database} */ module.exports = Database; Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] === obj) { ...
} provider.writeLib(); } else { grunt.log.write("cannot create schemes for database " + this.db.name + ", because there we can't use the provider "+this.db.provider+" for it."); } } else { grunt.log.write("cannot create schemes for database " + this.d...
{ provider.writeScheme(doc); }
conditional_block
models.py
= urlparams(django_reverse('desktop.user', args=[self.user.username])) return absolute_url(url) def _social_sharing_url(self, service): # django_reverse used instead of reverse because we don't want a locale preprended to sharing links. url = urlparams(django_reverse('desktop....
Meta
identifier_name
models.py
url = urlparams(django_reverse('desktop.user', args=[self.user.username]), f=service) return absolute_url(url) @property def twitter_sharing_url(self): return self._social_sharing_url('t') @property def facebook_sharin...
class UserNode(MPTTModel): """ Represents a user in the Spark sharing hierarchy.
random_line_split
models.py
property def poster_sharing_url(self): return self._social_sharing_url('p') @property def badges(self): """Returns a list of dicts used for badge list rendering. They represent all badges earned by the user in the Spark game. """ badges = [] completed_cha...
pass
identifier_body
models.py
') new_challenges = models.BooleanField(default=False) # Boost 1/2 boost1_completed = models.BooleanField(default=False) latitude = models.FloatField(blank=True, null=True) longitude = models.FloatField(blank=True, null=True) major_city = models.ForeignKey(City, blank=True, null=True) c...
def trigger_multisparker_badge(self): from challenges.tasks import update_completed_challenges if self.login_desktop and self.login_mobile: update_completed_challenges(self.user.id) def update_ancestors_longest_chain(self): """Updates 'longest ch...
try: # If the completed challenge is from an upper level and not an easter egg, we keep the badge hidden. # This is done by setting the date_badge_earned to NULL. date = None if self.level < challenge.level and not challenge.easter_egg else datetime.datetime.n...
conditional_block
number.rs
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at ...
} } /// A convenience function to create CFNumbers. pub fn number(value: i64) -> CFNumber { FromPrimitive::from_i64(value).unwrap() } #[link(name = "CoreFoundation", kind = "framework")] extern { /* * CFNumber.h */ fn CFNumberCreate(allocator: CFAllocatorRef, theType: CFNumberType, valuePt...
kCFNumberFloat64Type, mem::transmute(&value)); Some(TCFType::wrap_under_create_rule(number_ref)) }
random_line_split
number.rs
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at ...
(obj: CFNumberRef) -> CFNumber { CFNumber { obj: obj, } } #[inline] fn type_id(_: Option<CFNumber>) -> CFTypeID { unsafe { CFNumberGetTypeID() } } } // TODO(pcwalton): Floating point. impl ToPrimitive for CFNumber { #[inline] fn to_i64(&s...
wrap_under_create_rule
identifier_name
number.rs
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at ...
} /// A convenience function to create CFNumbers. pub fn number(value: i64) -> CFNumber { FromPrimitive::from_i64(value).unwrap() } #[link(name = "CoreFoundation", kind = "framework")] extern { /* * CFNumber.h */ fn CFNumberCreate(allocator: CFAllocatorRef, theType: CFNumberType, valuePtr: *c...
{ unsafe { let number_ref = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloat64Type, mem::transmute(&value)); Some(TCFType::wrap_under_create_rule(number_ref)) } }
identifier_body
launchbar.py
# Copyright (c) 2014 Tycho Andersen # Copyright (c) 2014 dequis # Copyright (c) 2014-2015 Joseph Razik # Copyright (c) 2014 Sean Vig # Copyright (c) 2015 reus # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal ...
(self, progs=None, width=bar.CALCULATED, **config): base._Widget.__init__(self, width, **config) if progs is None: progs = [] self.add_defaults(LaunchBar.defaults) self.surfaces = {} self.icons_files = {} self.icons_widths = {} self.icons_offsets = {} ...
__init__
identifier_name
launchbar.py
# Copyright (c) 2014 Tycho Andersen # Copyright (c) 2014 dequis # Copyright (c) 2014-2015 Joseph Razik # Copyright (c) 2014 Sean Vig # Copyright (c) 2015 reus # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal ...
def lookup_icons(self): """ Search for the icons corresponding to the commands to execute. """ if self.default_icon is not None: if not os.path.isfile(self.default_icon): # if the default icon provided is not found, switch to # text mode ...
""" Search for the icon corresponding to one command. """ self.icons_files[name] = None # if the software_name is directly an absolute path icon file if os.path.isabs(name): # name start with '/' thus it's an absolute path root, ext = os.path.splitext(name) if...
identifier_body
launchbar.py
# Copyright (c) 2014 Tycho Andersen # Copyright (c) 2014 dequis # Copyright (c) 2014-2015 Joseph Razik # Copyright (c) 2014 Sean Vig # Copyright (c) 2015 reus # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal ...
# if no icon is found and no default icon was set, we just # print the name, based on a textbox. textbox = base._TextBox() textbox._configure(self.qtile, self.bar) textbox.layout = self.drawer.textlayout( textbox.text, ...
for img_name, iconfile in self.icons_files.items(): if iconfile is None: logger.warning( 'No icon found for application "%s" (%s) switch to text mode', img_name, iconfile)
random_line_split
launchbar.py
# Copyright (c) 2014 Tycho Andersen # Copyright (c) 2014 dequis # Copyright (c) 2014-2015 Joseph Razik # Copyright (c) 2014 Sean Vig # Copyright (c) 2015 reus # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal ...
# no search method found an icon, so default icon if self.icons_files[name] is None: self.icons_files[name] = self.default_icon def lookup_icons(self): """ Search for the icons corresponding to the commands to execute. """ if self.default_icon is not None: i...
self.icons_files[name] = getIconPath(name)
conditional_block
index.d.ts
// Type definitions for domtagger 0.5 // Project: https://github.com/WebReflection/domtagger
declare namespace domtagger { interface Options { /** * The type of content to create. * * When `'svg'`, the generated template function returns `SVGElement` instances. * * @default 'html' */ type?: string; /** * Used to provide...
// Definitions by: ExE Boss <https://github.com/ExE-Boss> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace domtagger;
random_line_split
windows.rs
use winapi::um::processenv::GetStdHandle; use winapi::um::winbase::STD_OUTPUT_HANDLE; use winapi::um::wincon::GetConsoleScreenBufferInfo; use winapi::um::wincon::{CONSOLE_SCREEN_BUFFER_INFO, COORD, SMALL_RECT}; /// Query the current processes's output, returning its width and height as a /// number of characters. ///...
} /// Query the current processes's output, returning its width and height as a /// number of characters. Returns `None` if the output isn't to a terminal. /// /// # Errors /// /// Returns `None` if the output isn't to a terminal. /// /// # Example /// /// To get the dimensions of your terminal window, simply use ...
{ None }
conditional_block
windows.rs
use winapi::um::processenv::GetStdHandle; use winapi::um::winbase::STD_OUTPUT_HANDLE; use winapi::um::wincon::GetConsoleScreenBufferInfo; use winapi::um::wincon::{CONSOLE_SCREEN_BUFFER_INFO, COORD, SMALL_RECT}; /// Query the current processes's output, returning its width and height as a /// number of characters. ///...
srWindow: null_smallrect, dwMaximumWindowSize: null_coord, }; if unsafe { GetConsoleScreenBufferInfo(stdout_h, &mut console_data) } != 0 { Some(((console_data.srWindow.Right - console_data.srWindow.Left) as usize, (console_data.srWindow.Bottom - console_data.srWindow.Top...
dwCursorPosition: null_coord, wAttributes: 0,
random_line_split
windows.rs
use winapi::um::processenv::GetStdHandle; use winapi::um::winbase::STD_OUTPUT_HANDLE; use winapi::um::wincon::GetConsoleScreenBufferInfo; use winapi::um::wincon::{CONSOLE_SCREEN_BUFFER_INFO, COORD, SMALL_RECT}; /// Query the current processes's output, returning its width and height as a /// number of characters. ///...
() -> Option<(usize, usize)> { dimensions() } /// This isn't implemented for Windows /// /// # Panics /// /// This function `panic!`s unconditionally with the `unimplemented!` /// macro pub fn dimensions_stdin() -> Option<(usize, usize)> { unimplemented!() } /// This isn't implemented for Windows /// /// # Panics ...
dimensions_stdout
identifier_name
windows.rs
use winapi::um::processenv::GetStdHandle; use winapi::um::winbase::STD_OUTPUT_HANDLE; use winapi::um::wincon::GetConsoleScreenBufferInfo; use winapi::um::wincon::{CONSOLE_SCREEN_BUFFER_INFO, COORD, SMALL_RECT}; /// Query the current processes's output, returning its width and height as a /// number of characters. ///...
{ unimplemented!() }
identifier_body
boyer_moore_search.py
""" The algorithm finds the pattern in given text using following rule. The bad-character rule considers the mismatched character in Text. The next occurrence of that character to the left in Pattern is found, If the mismatched character occurs to the left in Pattern, a shift is proposed that aligns text block and pa...
text = "ABAABA" pattern = "AB" bms = BoyerMooreSearch(text, pattern) positions = bms.bad_character_heuristic() if len(positions) == 0: print("No match found") else: print("Pattern found in following positions: ") print(positions)
positions = [] for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if mismatch_index == -1: positions.append(i) else: match_index = self.match_in_pattern(self.text[mismatch_index]) i = ( ...
identifier_body
boyer_moore_search.py
""" The algorithm finds the pattern in given text using following rule. The bad-character rule considers the mismatched character in Text. The next occurrence of that character to the left in Pattern is found, If the mismatched character occurs to the left in Pattern, a shift is proposed that aligns text block and pa...
return -1 def bad_character_heuristic(self) -> list[int]: # searches pattern in text and returns index positions positions = [] for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if mismatch_index == -1: ...
if self.pattern[i] != self.text[currentPos + i]: return currentPos + i
conditional_block
boyer_moore_search.py
""" The algorithm finds the pattern in given text using following rule. The bad-character rule considers the mismatched character in Text. The next occurrence of that character to the left in Pattern is found, If the mismatched character occurs to the left in Pattern, a shift is proposed that aligns text block and pa...
(self) -> list[int]: # searches pattern in text and returns index positions positions = [] for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if mismatch_index == -1: positions.append(i) else: ...
bad_character_heuristic
identifier_name
boyer_moore_search.py
""" The algorithm finds the pattern in given text using following rule. The bad-character rule considers the mismatched character in Text. The next occurrence of that character to the left in Pattern is found, If the mismatched character occurs to the left in Pattern, a shift is proposed that aligns text block and pa...
return currentPos + i return -1 def bad_character_heuristic(self) -> list[int]: # searches pattern in text and returns index positions positions = [] for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if ...
random_line_split
test_forin.py
import unittest from rx import Observable from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable from rx.disposables import Disposable, SerialDisposable on_next = ReactiveTest.on_next on_completed = ReactiveTest.on_completed on_error = ReactiveTest.on_error subscribe = ReactiveTest.subscribe sub...
return scheduler.create_cold_observable(on_next(x * 100 + 10, x * 10 + 1), on_next(x * 100 + 20, x * 10 + 2), on_next(x * 100 + 30, x * 10 + 3), on_completed(x * 100 + 40)) return Observable.for_in([1, 2, 3], selector) results = scheduler.start(create=create) ...
def test_for_basic(self): scheduler = TestScheduler() def create(): def selector(x):
random_line_split
test_forin.py
import unittest from rx import Observable from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable from rx.disposables import Disposable, SerialDisposable on_next = ReactiveTest.on_next on_completed = ReactiveTest.on_completed on_error = ReactiveTest.on_error subscribe = ReactiveTest.subscribe sub...
return Observable.for_in([1, 2, 3], selector) results = scheduler.start(create=create) results.messages.assert_equal(on_next(310, 11), on_next(320, 12), on_next(330, 13), on_next(550, 21), on_next(560, 22), on_next(570, 23), on_next(890, 31), on_next(900, 32), on_next(910, ...
return scheduler.create_cold_observable(on_next(x * 100 + 10, x * 10 + 1), on_next(x * 100 + 20, x * 10 + 2), on_next(x * 100 + 30, x * 10 + 3), on_completed(x * 100 + 40))
identifier_body
test_forin.py
import unittest from rx import Observable from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable from rx.disposables import Disposable, SerialDisposable on_next = ReactiveTest.on_next on_completed = ReactiveTest.on_completed on_error = ReactiveTest.on_error subscribe = ReactiveTest.subscribe sub...
(self): scheduler = TestScheduler() def create(): def selector(x): return scheduler.create_cold_observable(on_next(x * 100 + 10, x * 10 + 1), on_next(x * 100 + 20, x * 10 + 2), on_next(x * 100 + 30, x * 10 + 3), on_completed(x * 100 + 40)) return Observab...
test_for_basic
identifier_name
computed.ts
import { expect } from "chai"; import { Component } from "../../src"; import Vue from "vue"; export default function () { describe("Computed Properties", () => { it("Should be bound to the instance", async () => { let result: any = undefined; @Component({ template: "...
extends Vue { public set test(v: number) { result = this; } public get test() { return 1; } } const a = new A(); const el = document.createElement("div"); a.$mount(el...
A
identifier_name
computed.ts
import { expect } from "chai"; import { Component } from "../../src"; import Vue from "vue"; export default function () { describe("Computed Properties", () => { it("Should be bound to the instance", async () => {
@Component({ template: "<div>{{test}}</div>" }) class A extends Vue { public get test() { result = this; return "test"; } } const a = new A(); const el = document.createEl...
let result: any = undefined;
random_line_split
say.py
from command import Command, is_command from event import Event class Say(Command): shortname = 'say' name = 'Say something to someone, or in the public chat' @is_command def say(self, player, *args): if args[0] in self.world.players: prefix = "(private) <%s> " % player.name ...
prefix = "<%s> " % player.name msg_base = ' '.join(args) msg = prefix + ' '.join(args) for p in self.world.players: self.tell_player(p, msg) self.world.emit_scripting_event('say', { 'source': player.to_dict(), 'target': pla...
conditional_block
say.py
from command import Command, is_command from event import Event class Say(Command):
msg = prefix + ' '.join(args) for p in self.world.players: self.tell_player(p, msg) self.world.emit_scripting_event('say', { 'source': player.to_dict(), 'target': player.location.to_dict(), 'msg': msg_base }...
shortname = 'say' name = 'Say something to someone, or in the public chat' @is_command def say(self, player, *args): if args[0] in self.world.players: prefix = "(private) <%s> " % player.name # a message to a user msg_base = ' '.join(args[1:]) msg = p...
identifier_body
say.py
from command import Command, is_command from event import Event class Say(Command): shortname = 'say'
@is_command def say(self, player, *args): if args[0] in self.world.players: prefix = "(private) <%s> " % player.name # a message to a user msg_base = ' '.join(args[1:]) msg = prefix + ' '.join(args[1:]) target_player = self.find_player(args[0]...
name = 'Say something to someone, or in the public chat'
random_line_split
say.py
from command import Command, is_command from event import Event class Say(Command): shortname = 'say' name = 'Say something to someone, or in the public chat' @is_command def
(self, player, *args): if args[0] in self.world.players: prefix = "(private) <%s> " % player.name # a message to a user msg_base = ' '.join(args[1:]) msg = prefix + ' '.join(args[1:]) target_player = self.find_player(args[0]) self.tell_play...
say
identifier_name
index.component.js
/* global angular, require */ import translate from '../core/services/translate.service.js'; import platformInfo from '../core/services/platform-info.js'; export default class
{ /* @ngInject */ constructor($ionicLoading, Commands, Wallet) { this.$ionicLoading = $ionicLoading; this.Commands = Commands; this.Wallet = Wallet; this.physicalScreenWidth = window.innerWidth; angular.element(window).bind('resize', () => { this.physicalScreenWidth = window.innerWidth; }); } onQ...
IndexController
identifier_name
index.component.js
/* global angular, require */ import translate from '../core/services/translate.service.js'; import platformInfo from '../core/services/platform-info.js'; export default class IndexController { /* @ngInject */ constructor($ionicLoading, Commands, Wallet) { this.$ionicLoading = $ionicLoading; this.Commands = Co...
} copyToClipboard(text) { if (platformInfo.isCordova) { window.cordova.plugins.clipboard.copy(text); this.showPopover(); } else if (platformInfo.isElectron) { const electron = require('electron'); electron.clipboard.writeText(text); this.showPopover(); } } hasAccount() { return this.Wall...
onQrCodeScanned(data) { this.Commands.onQrCodeScanned(data);
random_line_split
index.component.js
/* global angular, require */ import translate from '../core/services/translate.service.js'; import platformInfo from '../core/services/platform-info.js'; export default class IndexController { /* @ngInject */ constructor($ionicLoading, Commands, Wallet) { this.$ionicLoading = $ionicLoading; this.Commands = Co...
else if (platformInfo.isElectron) { const electron = require('electron'); electron.clipboard.writeText(text); this.showPopover(); } } hasAccount() { return this.Wallet.accountList.length !== 0; } showPopover() { const text = translate.instant('page.receive.copy'); return this.$ionicLoading.sh...
{ window.cordova.plugins.clipboard.copy(text); this.showPopover(); }
conditional_block
local_sched.rs
// Copyright 2013 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 scheduler = ~UvEventLoop::new_scheduler(); put(scheduler); let _scheduler = take(); let scheduler = ~UvEventLoop::new_scheduler(); put(scheduler); let _scheduler = take(); } #[test] fn borrow_smoke_test() { let scheduler = ~UvEventLoop::new_scheduler(); put(scheduler); unsa...
thread_local_scheduler_two_instances
identifier_name
local_sched.rs
// Copyright 2013 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 ...
/// Borrow a mutable reference to the thread-local Scheduler /// /// # Safety Note /// /// Because this leaves the Scheduler in thread-local storage it is possible /// For the Scheduler pointer to be aliased pub unsafe fn unsafe_borrow() -> &mut Scheduler { let key = tls_key(); let mut void_sched: *mut c_void...
{ let mut sched = take(); f(sched); put(sched); }
identifier_body
local_sched.rs
// Copyright 2013 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 ...
} } /// Take ownership of the Scheduler from thread-local storage pub fn take() -> ~Scheduler { unsafe { let key = tls_key(); let void_sched: *mut c_void = tls::get(key); assert!(void_sched.is_not_null()); let sched = transmute::<*mut c_void, ~Scheduler>(void_sched); tls...
let key = tls_key(); let void_sched: *mut c_void = transmute::<~Scheduler, *mut c_void>(sched); tls::set(key, void_sched);
random_line_split
local_sched.rs
// Copyright 2013 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 ...
} } extern { fn rust_get_sched_tls_key() -> *mut c_void; } #[test] fn thread_local_scheduler_smoke_test() { let scheduler = ~UvEventLoop::new_scheduler(); put(scheduler); let _scheduler = take(); } #[test] fn thread_local_scheduler_two_instances() { let scheduler = ~UvEventLoop::new_schedule...
{ return None; }
conditional_block
remote_info.rs
use helpers; use regex::Regex; use slog::Logger; use std::io; use std::process::Command; pub struct RemoteInfo { pub is_remote: bool, pub path: String, pub user: String, pub host: String, pub port: String, } impl RemoteInfo { pub fn build(remote_dir: &str, port: Option<&str>) -> Self { ...
pub fn full_path(&self) -> String { if self.is_remote { format!("{}@{}:{}", self.user, self.host, self.path) } else { self.path.clone() } } pub fn full_path_trailing_slash(&self) -> String { format!("{}/", self.full_path()) } pub fn check_cm...
random_line_split
remote_info.rs
use helpers; use regex::Regex; use slog::Logger; use std::io; use std::process::Command; pub struct RemoteInfo { pub is_remote: bool, pub path: String, pub user: String, pub host: String, pub port: String, } impl RemoteInfo { pub fn build(remote_dir: &str, port: Option<&str>) -> Self { ...
} } pub fn get_cmd_output(&self, cmd: &str) -> Result<String, io::Error> { let output = self.generate_command(&mut self.base_command(cmd), cmd) .output()?; Ok(String::from_utf8_lossy(&output.stdout).trim().to_owned()) } pub fn run_cmd(&self, cmd: &str) -> bool { ...
{ helpers::log_error_and_exit(log, &format!("Failed to run '{}' on remote: {}", cmd, e)); panic!(); // For compilation }
conditional_block
remote_info.rs
use helpers; use regex::Regex; use slog::Logger; use std::io; use std::process::Command; pub struct RemoteInfo { pub is_remote: bool, pub path: String, pub user: String, pub host: String, pub port: String, } impl RemoteInfo { pub fn build(remote_dir: &str, port: Option<&str>) -> Self { ...
<'a>(&self, command: &'a mut Command, cmd: &str) -> &'a mut Command { if self.is_remote { command .arg("-q") .arg(format!("{}@{}", self.user, self.host)) .arg("-p") .arg(&self.port) .arg("-C") .arg(cmd) ...
generate_command
identifier_name
signupController.ts
module myApp{ export class SignupCtrl implements ISignupCtrl { static $inject=[ '$scope', '$location', '$auth', 'toastService', '$timeout', '$window' ];
(public $scope:ng.IScope, public $location:any, public $auth:any, public Toast:any, public $timeout:any, protected $window:any ){ } public signup(user){ ...
constructor
identifier_name
signupController.ts
module myApp{
'$location', '$auth', 'toastService', '$timeout', '$window' ]; constructor(public $scope:ng.IScope, public $location:any, public $auth:any, public Toast:any, ...
export class SignupCtrl implements ISignupCtrl { static $inject=[ '$scope',
random_line_split
signupController.ts
module myApp{ export class SignupCtrl implements ISignupCtrl { static $inject=[ '$scope', '$location', '$auth', 'toastService', '$timeout', '$window' ]; constructor(public $scope:ng.IScope, ...
} angular.module('myApp').controller('myApp.SignupCtrl',SignupCtrl); }
{ this.$auth.signup(user) .then((response) => { //this.$auth.setToken(response.data.token); //this.$auth.login(user); this.$timeout(() => { this.$location.path('/'); this.$wind...
identifier_body
index.d.ts
/** Check if your code is running as an [npm](https://docs.npmjs.com/misc/scripts) or [yarn](https://yarnpkg.com/lang/en/docs/cli/run/) script. @example ``` import {isNpmOrYarn} from 'is-npm'; if (isNpmOrYarn) { console.log('Running as an npm or yarn script!'); } ``` */ export const isNpmOrYarn: boolean; /** Check ...
@example ``` import {isYarn} from 'is-npm'; if (isYarn) { console.log('Running as a yarn script!'); } ``` */ export const isYarn: boolean;
*/ export const isNpm: boolean; /** Check if your code is running as a [yarn](https://yarnpkg.com/lang/en/docs/cli/run/) script.
random_line_split
webpack.config.js
const path = require('path'); const env = require('yargs').argv.mode; const webpack = require('webpack'); const projectRoot = path.resolve(__dirname, '/'); const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin; const libraryName = '<%= libraryName %>'; const plugins = []; let outputFile; if (env === 'build...
else { outputFile = `${libraryName}.js`; } const config = { entry: `${__dirname}/src/index.js`, devtool: 'source-map', output: { path: `${__dirname}/dist`, filename: outputFile, library: libraryName, libraryTarget: 'umd', umdNamedDefine: true }, module: { preLoaders: [ { ...
{ plugins.push(new UglifyJsPlugin({ minimize: true })); outputFile = `${libraryName}.min.js`; }
conditional_block
webpack.config.js
const path = require('path'); const env = require('yargs').argv.mode; const webpack = require('webpack'); const projectRoot = path.resolve(__dirname, '/'); const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin; const libraryName = '<%= libraryName %>'; const plugins = []; let outputFile; if (env === 'build...
devtool: 'source-map', output: { path: `${__dirname}/dist`, filename: outputFile, library: libraryName, libraryTarget: 'umd', umdNamedDefine: true }, module: { preLoaders: [ { test: /(\.jsx|\.js)$/, loader: 'eslint', include: projectRoot, exclude: /(...
const config = { entry: `${__dirname}/src/index.js`,
random_line_split
api.js
var fs = require ('fs'); var path = require('path'); var _ = require('underscore'); var apiGen = require('../src/apiGen'); var objectifyTree = require('../src/objectifyTree'); module.exports = function (grunt) { grunt.registerMultiTask ('api', 'Generates api docs', function () { grunt.log.writeln ("Starti...
var outputPath = path.resolve(configDir, options.outPath); var tree = JSON.parse(fs.readFileSync (apiMeta, 'utf-8')); var constantsPath = path.resolve (configDir, options.constantsPath); var constantsObj = JSON.parse (fs.readFileSync (constantsPath, 'utf-8')); tree = objectifyTre...
random_line_split
test_tensor.py
# ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems Inc. # 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.o...
elif op == '/': C[:] = A / B elif op == '>': C[:] = A > B elif op == '>=': C[:] = A >= B elif op == '<': C[:] = A < B elif op == '<=': C[:] = A <= B return C def compare_helper(op, inA, inB, dtype): numpy_result = math_helper(np, op, inA, inB, dtype...
C[:] = A * B
conditional_block
test_tensor.py
# ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems Inc. # 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.o...
def pytest_generate_tests(metafunc): """ Build a list of test arguments. """ dims = [(64, 327), (64, 1), (1, 1023), (4, 3), ] dtypes = [np.float32, np.float16] if 'fargs_tests' in metafunc.fixturenames: fargs = itt.product(dims, dtypes...
if np.dtype(dtype).kind == 'f': return np.random.uniform(-1, 1, dims).astype(dtype) else: iinfo = np.iinfo(dtype) return np.around(np.random.uniform(iinfo.min, iinfo.max, dims)).clip(iinfo.min, iinfo.max)
identifier_body
test_tensor.py
# ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems Inc. # 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.o...
(fargs_tests): dims, dtype = fargs_tests gpu = NervanaGPU(default_dtype=dtype) cpu = NervanaCPU(default_dtype=dtype) array_np = np.random.uniform(-1, 1, dims).astype(dtype) array_ng = gpu.array(array_np, dtype=dtype) array_nc = cpu.array(array_np, dtype=dtype) assert_tensors_allclose(arra...
test_slicing
identifier_name
test_tensor.py
# ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems Inc. # 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.o...
Test of basic math operations on the Tensors and compare with numpy results The Tensor types includes GPU and CPU Tensors """ import numpy as np import itertools as itt from neon.backends.nervanagpu import NervanaGPU from neon.backends.nervanacpu import NervanaCPU from neon.backends.tests.utils import assert_tensors_a...
# limitations under the License. # ---------------------------------------------------------------------------- # pylint: skip-file """
random_line_split
pool_camera.py
import cv2, numpy as np from dolphintracker.singlecam_tracker.camera_filter.FindDolphin import SearchBlobs from dolphintracker.singlecam_tracker.camera_filter.BackGroundDetector import BackGroundDetector import datetime class PoolCamera(object): def __init__(self, videofile, name, scene, maskObjectsNames, filters, f...
@property def img_height(self): return int( self.videoCap.get(cv2.CAP_PROP_FRAME_HEIGHT) ) @property def fps(self): return int( self.videoCap.get(cv2.CAP_PROP_FPS) ) @property def frame_index(self): return int( self.videoCap.get(cv2.CAP_PROP_POS_FRAMES) ) @frame_index.setter def frame_index(self, value):...
return int( self.videoCap.get(cv2.CAP_PROP_FRAME_WIDTH) )
identifier_body
pool_camera.py
import cv2, numpy as np from dolphintracker.singlecam_tracker.camera_filter.FindDolphin import SearchBlobs from dolphintracker.singlecam_tracker.camera_filter.BackGroundDetector import BackGroundDetector
def __init__(self, videofile, name, scene, maskObjectsNames, filters, frames_range=None): self.name = name self.videoCap = cv2.VideoCapture(videofile) self.scene = scene self.filters = filters self.mask = self.create_mask(maskObjectsNames) self.frames_range = frames_range ...
import datetime class PoolCamera(object):
random_line_split
pool_camera.py
import cv2, numpy as np from dolphintracker.singlecam_tracker.camera_filter.FindDolphin import SearchBlobs from dolphintracker.singlecam_tracker.camera_filter.BackGroundDetector import BackGroundDetector import datetime class PoolCamera(object): def __init__(self, videofile, name, scene, maskObjectsNames, filters, f...
(self, points): cam = self.scene_camera; return [cam.calcPixel(*p) for p in points] @property def scene_camera(self): return self.scene.getCamera(self.name) @property def img_width(self): return int( self.videoCap.get(cv2.CAP_PROP_FRAME_WIDTH) ) @property def img_height(self): return int( self.videoCap.get(c...
points_projection
identifier_name
pool_camera.py
import cv2, numpy as np from dolphintracker.singlecam_tracker.camera_filter.FindDolphin import SearchBlobs from dolphintracker.singlecam_tracker.camera_filter.BackGroundDetector import BackGroundDetector import datetime class PoolCamera(object): def __init__(self, videofile, name, scene, maskObjectsNames, filters, f...
else: self.originalFrame = None return res def process(self): if len(self._backgrounds)==0: for i, colorFilter in enumerate(self.filters): firstFrame = self.frame_index bgDetector = BackGroundDetector(capture=self.videoCap, filterFunction=colorFilter.process) print('Background detection...
self.originalFrame = self.frame.copy()
conditional_block
bubble-sort.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' 冒泡排序(bubble sort):每个回合都从第一个元素开始和它后面的元素比较, 如果比它后面的元素更大的话就交换,一直重复,直到这个元素到了它能到达的位置。 每次遍历都将剩下的元素中最大的那个放到了序列的“最后”(除去了前面已经排好的那些元素)。 注意检测是否已经完成了排序,如果已完成就可以退出了。时间复杂度O(n2) ''' def short_bubble_sort(a_list): exchange = True pass_num = len(a_list) - 1 while pass_num...
+ 1] = a_list[i + 1], a_list[i] pass_num = pass_num - 1 if __name__ == '__main__': a_list = [20, 40, 50, 22, 100, 90] short_bubble_sort(a_list) print(a_list) # [20, 22, 40, 50, 90, 100]
conditional_block
bubble-sort.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' 冒泡排序(bubble sort):每个回合都从第一个元素开始和它后面的元素比较, 如果比它后面的元素更大的话就交换,一直重复,直到这个元素到了它能到达的位置。 每次遍历都将剩下的元素中最大的那个放到了序列的“最后”(除去了前面已经排好的那些元素)。 注意检测是否已经完成了排序,如果已完成就可以退出了。时间复杂度O(n2) ''' def short_bubble_sort(a_list): exchange = True pass_num = len(a_list) - 1 while pass_num...
] = a_list[i + 1] # a_list[i + 1] = temp a_list[i], a_list[i + 1] = a_list[i + 1], a_list[i] pass_num = pass_num - 1 if __name__ == '__main__': a_list = [20, 40, 50, 22, 100, 90] short_bubble_sort(a_list) print(a_list) # [20, 22, 40, 50, 90, 100]
identifier_body
bubble-sort.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' 冒泡排序(bubble sort):每个回合都从第一个元素开始和它后面的元素比较, 如果比它后面的元素更大的话就交换,一直重复,直到这个元素到了它能到达的位置。 每次遍历都将剩下的元素中最大的那个放到了序列的“最后”(除去了前面已经排好的那些元素)。 注意检测是否已经完成了排序,如果已完成就可以退出了。时间复杂度O(n2) ''' def short_bubble_sort(a_list): exchange = True pass_num = len(a_list) - 1 while pass_num...
# a_list[i] = a_list[i + 1] # a_list[i + 1] = temp a_list[i], a_list[i + 1] = a_list[i + 1], a_list[i] pass_num = pass_num - 1 if __name__ == '__main__': a_list = [20, 40, 50, 22, 100, 90] short_bubble_sort(a_list) print(a_list) # [20, 22, 40, 50, 9...
t[i]
identifier_name
bubble-sort.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' 冒泡排序(bubble sort):每个回合都从第一个元素开始和它后面的元素比较, 如果比它后面的元素更大的话就交换,一直重复,直到这个元素到了它能到达的位置。 每次遍历都将剩下的元素中最大的那个放到了序列的“最后”(除去了前面已经排好的那些元素)。 注意检测是否已经完成了排序,如果已完成就可以退出了。时间复杂度O(n2) ''' def short_bubble_sort(a_list): exchange = True pass_num = len(a_list) - 1 while pass_num...
if __name__ == '__main__': a_list = [20, 40, 50, 22, 100, 90] short_bubble_sort(a_list) print(a_list) # [20, 22, 40, 50, 90, 100]
random_line_split
referencesForStaticsAndMembersWithSameNames.ts
/// <reference path='fourslash.ts'/> ////module FindRef4 { //// module MixedStaticsClassTest { //// export class Foo { //// b/*3*/ar: Foo; //// static b/*4*/ar: Foo; //// //// public f/*1*/oo(): void { //// } //// public static f/*2*/oo(): void { //// } //// } //// } //// //// function test() { //// // ...
// References to a static property with the same name as a member. goTo.marker("4"); verify.referencesCountIs(2);
random_line_split
watch_zeromq.py
#!/usr/bin/env python # # Copyright (c) 2017 DevicePilot Ltd. # # 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, mo...
if __name__ == "__main__": zeromq_rx.init(printIt) print("Watching...") while True: time.sleep(1)
print(datetime.now(),str(params))
identifier_body
watch_zeromq.py
#!/usr/bin/env python # # Copyright (c) 2017 DevicePilot Ltd. # # 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, mo...
time.sleep(1)
conditional_block
watch_zeromq.py
#!/usr/bin/env python # # Copyright (c) 2017 DevicePilot Ltd. # # 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, mo...
(params): print(datetime.now(),str(params)) if __name__ == "__main__": zeromq_rx.init(printIt) print("Watching...") while True: time.sleep(1)
printIt
identifier_name