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
app.po.ts
import { browser, element, by, ElementFinder, ExpectedConditions } from 'protractor'; const githubRegex = /https:\/\/github.com\/angular\/angular\//; export class SitePage { links = element.all(by.css('md-toolbar a')); homeLink = element(by.css('a.home')); docsMenuLink = element(by.cssContainingText('aio-top-m...
() { return this.docViewer.getText(); } getInnerHtml(elementFinder: ElementFinder) { // `getInnerHtml` was removed from webDriver and this is the workaround. // See https://github.com/angular/protractor/blob/master/CHANGELOG.md#breaking-changes return browser.executeScript('return arguments[0].inne...
getDocViewerText
identifier_name
app.po.ts
import { browser, element, by, ElementFinder, ExpectedConditions } from 'protractor'; const githubRegex = /https:\/\/github.com\/angular\/angular\//; export class SitePage { links = element.all(by.css('md-toolbar a')); homeLink = element(by.css('a.home')); docsMenuLink = element(by.cssContainingText('aio-top-m...
async enterSearch(query: string) { const input = element(by.css('.search-container input[type=search]')); await input.clear(); await input.sendKeys(query); } async getSearchResults() { const results = element.all(by.css('.search-results li')); await browser.wait(ExpectedConditions.presenceO...
{ await elementFinder.click(); await browser.waitForAngular(); }
identifier_body
Header.tsx
import { FC, memo } from 'react' // import IconButton from '@/widgets/Buttons/IconButton' import type { TCommunityView, TTexts } from '../spec' import { Wrapper, Title } from '../styles/community_setter/header' // import { useStore } from '../logic' // import { LavaLampLoading } from '@/widgets/dynamic' type TProps...
export default memo(Header)
random_line_split
script.js
// Navigation menu affix AffixMenu: function() { var navMenu = '<nav id="navigation_affix">'; navMenu += $('#navigation').html(); navMenu += '</nav>'; $('#header').before(navMenu); $('#navigation').waypoint(function() { $('#navigation_affix').removeClass('show'); }, { offset: -89 ...
random_line_split
script.js
ffixMenu: function() { var navMenu = '<nav id="navigation_affix">'; navMenu += $('#navigation').html(); navMenu += '</nav>'; $('#header').before(navMenu); $('#navigation').waypoint(function() { $('#navigation_affix').removeClass('show'); }, { offset: -89 }); $('#navigation'...
{ setTimeout(function() { $element.addClass('animated ' + $element.attr('data-animation')); }, delay); }
conditional_block
range-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { // Mixed types. let _ = 0u32..10i32; //~^ ERROR mismatched types // Bool => does not implement iterator. for i in false..true {} //~^ ERROR `bool: std::iter::Step` is not satisfied // Unsized type. let arr: &[_] = &[1, 2, 3]; let range = *arr..; //~^ ERROR the ...
// option. This file may not be copied, modified, or distributed // except according to those terms. // Test range syntax - type errors.
random_line_split
range-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { // Mixed types. let _ = 0u32..10i32; //~^ ERROR mismatched types // Bool => does not implement iterator. for i in false..true {} //~^ ERROR `bool: std::iter::Step` is not satisfied // Unsized type. let arr: &[_] = &[1, 2, 3]; let range = *arr..; //~^ ERROR the size for val...
main
identifier_name
range-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ // Mixed types. let _ = 0u32..10i32; //~^ ERROR mismatched types // Bool => does not implement iterator. for i in false..true {} //~^ ERROR `bool: std::iter::Step` is not satisfied // Unsized type. let arr: &[_] = &[1, 2, 3]; let range = *arr..; //~^ ERROR the size for values...
identifier_body
x86.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 ...
(target_triple: StrBuf, target_os: abi::Os) -> target_strs::t { return target_strs::t { module_asm: "".to_strbuf(), meta_sect_name: meta_section_name(cfg_os_to_meta_os(target_os)).to_strbuf(), data_layout: match target_os { abi::OsMacos => { ...
get_target_strs
identifier_name
x86.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 ...
abi::OsFreebsd => { "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() } }, target_triple: target_triple, cc_args: vec!("-m32".to_strbuf()), }; }
}
random_line_split
x86.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 ...
abi::OsLinux => { "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() } abi::OsAndroid => { "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() } abi::OsFreebsd => { "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:1...
{ return target_strs::t { module_asm: "".to_strbuf(), meta_sect_name: meta_section_name(cfg_os_to_meta_os(target_os)).to_strbuf(), data_layout: match target_os { abi::OsMacos => { "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16\ -i32:32:32-i64:32:64\...
identifier_body
x86.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 ...
abi::OsAndroid => { "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() } abi::OsFreebsd => { "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() } }, target_triple: target_triple, cc_args: vec!("-m32".to_s...
{ "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() }
conditional_block
definition.spec.ts
import * as expect from "expect" import { definitionDone, definitionError, definitionStart } from "../../src/actions/definition" import { createEntry } from "../../src/api/Entry" import { definitionReducer, IDefinitionState } from "../../src/reducers/definition" describe("Definition reducer", () => { const id = "tes...
it("handles DEFINITION_DONE actions", () => { const entries = [ createEntry("a", "a:1", { "@n": "1", "@id": "a:1", "form": { orth: "A" }, "sense": [] }) ] const action = definitionDone(entries) const actualState = definitionReducer(initialState, action) expect(actualState).toNotEqual(initialState) ...
expect(actualState).toNotEqual(initialState) expect(actualState.isLoading).toBe(true) })
random_line_split
servicebusmanagementservice-tests.js
// // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requi...
function waitForNamespaceToActivate(namespaceName, callback) { var poll = function () { service.getNamespace(namespaceName, function (err, ns) { if (err) { callback(err); } else if (ns.Status === 'Activating') { setTimeout(poll, (suiteUtil.isMocked && !suiteUtil.isRec...
{ if (namespaces.length === 0) { return callback(); } var numDeleted = 0; namespaces.forEach(function (namespaceName) { service.deleteNamespace(namespaceName, function () { ++numDeleted; if (numDeleted === namespaces.length) { callback(); } }); }); }
identifier_body
servicebusmanagementservice-tests.js
// // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requi...
function waitForNamespaceToActivate(namespaceName, callback) { var poll = function () { service.getNamespace(namespaceName, function (err, ns) { if (err) { callback(err); } else if (ns.Status === 'Activating') { setTimeout(poll, (suiteUtil.isMocked && !suiteUtil.isReco...
}); }); }
random_line_split
servicebusmanagementservice-tests.js
// // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requi...
waitForNamespaceToActivate(name, function (err) { if (err) { return done(err); }; service.deleteNamespace(name, done); }); }); }); }); describe('Get regions', function() { it('should return array of available regions', function (done) { service.getRegions(f...
{ return done(err); }
conditional_block
servicebusmanagementservice-tests.js
// // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requi...
() { return testutil.generateId('nodesdk-', namespacesToClean, suiteUtil.isMocked); } describe('List Namespaces', function () { beforeEach(function (done) { service.listNamespaces(function (err, namespaces) { namespacesBefore = namespaces; done(); }); }); describe('whe...
newName
identifier_name
water_thief.py
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from java.util import Vector def addTemplate(core): mobileTemplate = MobileTemplate() mobi...
mobileTemplate.setDefaultAttack('saberhit') mobileTemplate.setAttacks(attacks) core.spawnService.addMobileTemplate('water_thief', mobileTemplate) return
random_line_split
water_thief.py
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from java.util import Vector def addTemplate(core):
weapontemplate = WeaponTemplate('object/weapon/melee/sword/shared_sword_01.iff', WeaponType.ONEHANDEDMELEE, 1.0, 5, 'kinetic') weaponTemplates.add(weapontemplate) mobileTemplate.setWeaponTemplateVector(weaponTemplates) attacks = Vector() mobileTemplate.setDefaultAttack('saberhit') mobileTemplate.setAttacks(atta...
mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('water_thief') mobileTemplate.setLevel(5) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) mobileTemplate.setMaxSpawnDistance(8) mobileTemplate.setDeathblow(False) mobileTemplate.setScale(1) mobileTemplate.s...
identifier_body
water_thief.py
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from java.util import Vector def
(core): mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('water_thief') mobileTemplate.setLevel(5) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) mobileTemplate.setMaxSpawnDistance(8) mobileTemplate.setDeathblow(False) mobileTemplate.setScale(1) mobileT...
addTemplate
identifier_name
macro.rs
//! [マクロクラブ Rust支部 | κeenのHappy Hacκing Blog](https://keens.github.io/blog/2018/02/17/makurokurabu_rustshibu/) macro_rules! double_println { ($ex: expr) => ( println!("{}{}", $ex, $ex); // セミコロンなしでも可 ); } macro_rules! simple_macro { // `()` はマクロが引数をとらないことを示す () => ( println!("Hello Macro!"); ); } macro_rul...
identifier_name
macro.rs
//! [マクロクラブ Rust支部 | κeenのHappy Hacκing Blog](https://keens.github.io/blog/2018/02/17/makurokurabu_rustshibu/) macro_rules! double_println { ($ex: expr) => ( println!("{}{}", $ex, $ex); // セミコロンなしでも可 ); } macro_rules! simple_macro { // `()` はマクロが引数をとらないことを示す () => (
); } macro_rules! name { // expr: 式文 ($x: expr) => ( println!("{}", $x); // 複数書く場合はセミコロン必須 // 忘れないように書いててもいいっぽい ); ($x: expr, $($y: expr), +) => ( println!("{}", $x); name!($($y), +) ); } macro_rules! fnction { // ident: 関数・変数名に使用する ($fn_name: ident) => ( fn $fn_name() { // stringify! はidentを文字列に...
println!("Hello Macro!");
random_line_split
macro.rs
//! [マクロクラブ Rust支部 | κeenのHappy Hacκing Blog](https://keens.github.io/blog/2018/02/17/makurokurabu_rustshibu/) macro_rules! double_println { ($ex: expr) => ( println!("{}{}", $ex, $ex); // セミコロンなしでも可 ); } macro_rules! simple_macro { // `()` はマクロが引数をとらないことを示す () => ( println!("Hello Macro!"); ); } macro_rul...
identifier_body
pelicanconf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = 'KMOL' SITENAME = '2016Fall 課程網誌 (虎尾科大MDE)' # 不要用文章所在目錄作為類別 USE_FOLDER_AS_CATEGORY = False #PATH = 'content' #OUTPUT_PATH = 'output' TIMEZONE = 'Asia/Taipei' DEFAULT_LANG = 'en' # Feed generation is usually not desire...
('Tipue search', 'https://github.com/Tipue/Tipue-Search'),) # Social widget #SOCIAL = (('You can add links in your config file', '#'),('Another social link', '#'),) DEFAULT_PAGINATION = 10 # Uncomment following line if you want document-relative URLs when developing #RELATIVE_URLS = True # 必須絕對目錄或相對於設定檔案所在...
LINKS = (('Pelican', 'http://getpelican.com/'), ('pelican-bootstrap3', 'https://github.com/DandyDev/pelican-bootstrap3/'), ('pelican-plugins', 'https://github.com/getpelican/pelican-plugins'),
random_line_split
switch.py
"""Support for Firmata switch output.""" import logging from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from .const import ( CONF_INITIAL_STATE, CONF_NEGATE_STA...
@property def is_on(self) -> bool: """Return true if switch is on.""" return self._api.is_on async def async_turn_on(self, **kwargs) -> None: """Turn on switch.""" _LOGGER.debug("Turning switch %s on", self._name) await self._api.turn_on() self.async_write_...
"""Set up a switch.""" await self._api.start_pin() self.async_write_ha_state()
identifier_body
switch.py
"""Support for Firmata switch output.""" import logging from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry
CONF_INITIAL_STATE, CONF_NEGATE_STATE, CONF_PIN, CONF_PIN_MODE, DOMAIN, ) from .entity import FirmataPinEntity from .pin import FirmataBinaryDigitalOutput, FirmataPinUsedException _LOGGER = logging.getLogger(__name__) async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry...
from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from .const import (
random_line_split
switch.py
"""Support for Firmata switch output.""" import logging from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from .const import ( CONF_INITIAL_STATE, CONF_NEGATE_STA...
if new_entities: async_add_entities(new_entities) class FirmataSwitch(FirmataPinEntity, SwitchEntity): """Representation of a switch on a Firmata board.""" async def async_added_to_hass(self) -> None: """Set up a switch.""" await self._api.start_pin() self.async_write_ha...
pin = switch[CONF_PIN] pin_mode = switch[CONF_PIN_MODE] initial = switch[CONF_INITIAL_STATE] negate = switch[CONF_NEGATE_STATE] api = FirmataBinaryDigitalOutput(board, pin, pin_mode, initial, negate) try: api.setup() except FirmataPinUsedException: ...
conditional_block
switch.py
"""Support for Firmata switch output.""" import logging from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from .const import ( CONF_INITIAL_STATE, CONF_NEGATE_STA...
(FirmataPinEntity, SwitchEntity): """Representation of a switch on a Firmata board.""" async def async_added_to_hass(self) -> None: """Set up a switch.""" await self._api.start_pin() self.async_write_ha_state() @property def is_on(self) -> bool: """Return true if switch...
FirmataSwitch
identifier_name
call.js
const expect = require('chai').expect const supertest = require('supertest') const cheerio = require('cheerio'); const app = require('../app.js'); describe('call', function () { describe('POST to /call/connect', function () { context('when connecting from a phone number', function () { it('response verb D...
}) .expect(function (res) { var $ = cheerio.load(res.text); expect($('Dial').children('Number').length).to.equal(1); expect($('Dial').children('Number').text()).to.equal(phoneNumber); }) .expect(200, done); }); }); context('when connecting fro...
agent .post('/call/connect') .send({ phoneNumber: phoneNumber,
random_line_split
sqlstring_test.py
import unittest import wire class TestSQLString(unittest.TestCase): def setUp(self): '''Sets up the test case''' self.sql = wire.SQLString def test_pragma(self): '''Tests the PRAGMA SQL generation''' self.assertEqual(self.sql.pragma("INTEGRITY_CHECK(10)"), "PRAGMA INTEGRITY_CHECK(10)") self.assertEqual(s...
unittest.main()
conditional_block
sqlstring_test.py
import unittest import wire class TestSQLString(unittest.TestCase): def setUp(self): '''Sets up the test case''' self.sql = wire.SQLString def test_pragma(self): '''Tests the PRAGMA SQL generation''' self.assertEqual(self.sql.pragma("INTEGRITY_CHECK(10)"), "PRAGMA INTEGRITY_CHECK(10)") self.assertEqual(s...
if __name__ == '__main__': unittest.main()
'''Tests the ALTER TABLE RENAME SQL generation''' self.assertEqual(self.sql.rename("orig_table", "new_table"), "ALTER TABLE orig_table RENAME TO new_table")
identifier_body
sqlstring_test.py
import unittest import wire class TestSQLString(unittest.TestCase): def setUp(self): '''Sets up the test case''' self.sql = wire.SQLString def test_pragma(self): '''Tests the PRAGMA SQL generation''' self.assertEqual(self.sql.pragma("INTEGRITY_CHECK(10)"), "PRAGMA INTEGRITY_CHECK(10)")
def test_createTable(self): '''Tests the CREATE TABLE SQL generation''' table_outputs = ["CREATE TABLE test (id INT NOT NULL,username VARCHAR(255) DEFAULT 'default_user')", "CREATE TABLE test (username VARCHAR(255) DEFAULT 'default_user',id INT NOT NULL)"] temp_table_outputs = ["CREATE TEMPORARY TABLE test_te...
self.assertEqual(self.sql.checkIntegrity(5), "PRAGMA INTEGRITY_CHECK(5)")
random_line_split
sqlstring_test.py
import unittest import wire class TestSQLString(unittest.TestCase): def setUp(self): '''Sets up the test case''' self.sql = wire.SQLString def
(self): '''Tests the PRAGMA SQL generation''' self.assertEqual(self.sql.pragma("INTEGRITY_CHECK(10)"), "PRAGMA INTEGRITY_CHECK(10)") self.assertEqual(self.sql.checkIntegrity(5), "PRAGMA INTEGRITY_CHECK(5)") def test_createTable(self): '''Tests the CREATE TABLE SQL generation''' table_outputs = ["CREATE TABL...
test_pragma
identifier_name
HTTP.test.js
* HTTP.test */ "use strict"; /* Node modules */ /* Third-party modules */ var steeplejack = require("steeplejack"); /* Files */ describe("HTTPError test", function () { var HTTPError; beforeEach(function () { injector(function (_HTTPError_) { HTTPError = _HTTPError_; });...
/**
random_line_split
facebook_mysql.py
# __author__ = MelissaChan # -*- coding: utf-8 -*- # 16-4-16 下午10:53 import MySQLdb def connect(id,name,gender,region,status,date,inter): try:
conn.close() print 'insert ok~' except MySQLdb.Error,msg: print "MySQL Error %d: %s" %(msg.args[0],msg.args[1])
conn = MySQLdb.connect(host='localhost',user='root',passwd=' ',port=3306) cur = conn.cursor() # cur.execute('create database if not exists PythonDB') conn.select_db('Facebook') # cur.execute('create table Test(id int,name varchar(20),info varchar(20))') value = [id,nam...
identifier_body
facebook_mysql.py
# __author__ = MelissaChan # -*- coding: utf-8 -*- # 16-4-16 下午10:53 import MySQLdb def connect(id,name,gender,region,status,date,inter): try: conn = MySQLdb.connect(host='localhost',user='root',passwd=' ',port=3306) cur = conn.cursor() # cur.execute('create database if not exists PythonD...
print 'insert ok~' except MySQLdb.Error,msg: print "MySQL Error %d: %s" %(msg.args[0],msg.args[1])
random_line_split
facebook_mysql.py
# __author__ = MelissaChan # -*- coding: utf-8 -*- # 16-4-16 下午10:53 import MySQLdb def conn
name,gender,region,status,date,inter): try: conn = MySQLdb.connect(host='localhost',user='root',passwd=' ',port=3306) cur = conn.cursor() # cur.execute('create database if not exists PythonDB') conn.select_db('Facebook') # cur.execute('create table Test(id int,name varchar(2...
ect(id,
identifier_name
view_container_ref.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {Injector} from '../di/injector'; import {ComponentFactory, ComponentRef} from './component_factory'; import ...
* * If `index` is not specified, the last View in the container will be removed. */ abstract remove(index?: number): void; /** * Use along with {@link #insert} to move a View within the current container. * * If the `index` param is omitted, the last {@link ViewRef} is detached. */ abstract ...
random_line_split
layout.ctrl.js
'use strict'; angular.module('com.module.core') /** * @ngdoc function * @name com.module.core.controller:LayoutCtrl * @description Layout controller * @requires $scope * @requires $rootScope * @requires CoreService * @requires gettextCatalog **/ .controller('LayoutCtrl', function($scope, $ro...
else { // Else, enable content streching $('.left-side').toggleClass('collapse-left'); $('.right-side').toggleClass('strech'); } }; $scope.settings = $rootScope.settings; $rootScope.loadSettings(); });
{ $('.row-offcanvas').toggleClass('active'); $('.left-side').removeClass('collapse-left'); $('.right-side').removeClass('strech'); $('.row-offcanvas').toggleClass('relative'); }
conditional_block
layout.ctrl.js
'use strict'; angular.module('com.module.core') /** * @ngdoc function * @name com.module.core.controller:LayoutCtrl * @description Layout controller * @requires $scope * @requires $rootScope * @requires CoreService * @requires gettextCatalog **/ .controller('LayoutCtrl', function($scope, $ro...
'name': 'Blue', 'class': 'skin-blue' }]; $scope.appLayout = ''; $scope.appLayouts = [{ 'name': 'Fixed', 'class': 'fixed' }, { 'name': 'Scrolling', 'class': 'not-fixed' }]; $scope.toggleSidebar = function() { var $ = angular.element; if ($(window)....
'class': 'skin-black' }, {
random_line_split
outputStatusCache.ts
/** * Cases to handle: * - If the file updates we need to check if it is in the active project * If it is then we need to update the output status for that file * - If the active project changes we need to update *all* the statuses * - whenever the output status *changes* we need to send it to the client. * * ...
console.log('[EMIT] Starting emit'); outputStatusCache = {}; const srcFiles = proj.getProjectSourceFiles(); srcFiles.forEach((sf,i)=>{ const filePath = sf.fileName; const res = projectService.getJSOutputStatus({ filePath }); outputStatusCache[filePath] = res.outputStatus; ...
}, 1000); export const doCompleteProjectCacheUpdate = (proj: project.Project) => {
random_line_split
redundant_else.rs
use clippy_utils::diagnostics::span_lint_and_help; use rustc_ast::ast::{Block, Expr, ExprKind, Stmt, StmtKind}; use rustc_ast::visit::{walk_expr, Visitor}; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy...
(&mut self, cx: &EarlyContext<'_>, stmt: &Stmt) { if in_external_macro(cx.sess, stmt.span) { return; } // Only look at expressions that are a whole statement let expr: &Expr = match &stmt.kind { StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr, _ =>...
check_stmt
identifier_name
redundant_else.rs
use clippy_utils::diagnostics::span_lint_and_help; use rustc_ast::ast::{Block, Expr, ExprKind, Stmt, StmtKind}; use rustc_ast::visit::{walk_expr, Visitor}; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy...
// else if else ExprKind::If(_, next_then, Some(next_els)) => { then = next_then; els = next_els; continue; }, // else if without else ExprKind::If(..) => return, /...
{ if in_external_macro(cx.sess, stmt.span) { return; } // Only look at expressions that are a whole statement let expr: &Expr = match &stmt.kind { StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr, _ => return, }; // if else l...
identifier_body
redundant_else.rs
use clippy_utils::diagnostics::span_lint_and_help; use rustc_ast::ast::{Block, Expr, ExprKind, Stmt, StmtKind}; use rustc_ast::visit::{walk_expr, Visitor}; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy...
}
}
random_line_split
debug.rs
use winapi::um::{d3d11, d3d11_1, d3dcommon}; use wio::{com::ComPtr, wide::ToWide}; use std::{env, ffi::OsStr, fmt}; #[must_use] pub struct DebugScope { annotation: ComPtr<d3d11_1::ID3DUserDefinedAnnotation>, } impl DebugScope { // TODO: Not used currently in release, will be used in the future #[allow(d...
(&mut self) { unsafe { self.annotation.EndEvent(); } } } pub fn debug_marker(context: &ComPtr<d3d11::ID3D11DeviceContext>, name: &str) { // same here if unsafe { context.GetType() } == d3d11::D3D11_DEVICE_CONTEXT_DEFERRED { if env::var("GFX_NO_RENDERDOC").is_ok() { ...
drop
identifier_name
debug.rs
use winapi::um::{d3d11, d3d11_1, d3dcommon}; use wio::{com::ComPtr, wide::ToWide}; use std::{env, ffi::OsStr, fmt}; #[must_use] pub struct DebugScope { annotation: ComPtr<d3d11_1::ID3DUserDefinedAnnotation>, } impl DebugScope { // TODO: Not used currently in release, will be used in the future #[allow(d...
pub fn verify_debug_ascii(name: &str) -> bool { let res = name.is_ascii(); if !res { error!("DX11 buffer names must be ASCII"); } res } /// Set the debug name of a resource. /// /// Must be ASCII. /// /// SetPrivateData will copy the data internally so the data doesn't need to live. pub fn se...
{ // same here if unsafe { context.GetType() } == d3d11::D3D11_DEVICE_CONTEXT_DEFERRED { if env::var("GFX_NO_RENDERDOC").is_ok() { return; } } let annotation = context .cast::<d3d11_1::ID3DUserDefinedAnnotation>() .unwrap(); let msg: &OsStr = name.as_ref(...
identifier_body
debug.rs
use winapi::um::{d3d11, d3d11_1, d3dcommon}; use wio::{com::ComPtr, wide::ToWide}; use std::{env, ffi::OsStr, fmt}; #[must_use] pub struct DebugScope { annotation: ComPtr<d3d11_1::ID3DUserDefinedAnnotation>, } impl DebugScope { // TODO: Not used currently in release, will be used in the future #[allow(d...
res } /// Set the debug name of a resource. /// /// Must be ASCII. /// /// SetPrivateData will copy the data internally so the data doesn't need to live. pub fn set_debug_name(resource: &d3d11::ID3D11DeviceChild, name: &str) { unsafe { resource.SetPrivateData( (&d3dcommon::WKPDID_D3DDebugO...
{ error!("DX11 buffer names must be ASCII"); }
conditional_block
debug.rs
use winapi::um::{d3d11, d3d11_1, d3dcommon}; use wio::{com::ComPtr, wide::ToWide}; use std::{env, ffi::OsStr, fmt}; #[must_use] pub struct DebugScope { annotation: ComPtr<d3d11_1::ID3DUserDefinedAnnotation>, } impl DebugScope { // TODO: Not used currently in release, will be used in the future #[allow(d...
/// Must be ASCII. /// /// The given string will be mutated to add the suffix, then restored to it's original state. /// This saves an allocation. SetPrivateData will copy the data internally so the data doesn't need to live. pub fn set_debug_name_with_suffix( resource: &d3d11::ID3D11DeviceChild, name: &mut Str...
/// Set the debug name of a resource with a given suffix. ///
random_line_split
2d0ce3ee5bdc_added_passphrase_hash_column_to_.py
"""added passphrase_hash column to journalists table Revision ID: 2d0ce3ee5bdc Revises: fccf57ceef02 Create Date: 2018-06-08 15:08:37.718268
""" from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2d0ce3ee5bdc' down_revision = 'fccf57ceef02' branch_labels = None depends_on = None def upgrade(): op.add_column('journalists', sa.Column('passphrase_hash', sa.String(length=256), nullable=True)) def downgr...
random_line_split
2d0ce3ee5bdc_added_passphrase_hash_column_to_.py
"""added passphrase_hash column to journalists table Revision ID: 2d0ce3ee5bdc Revises: fccf57ceef02 Create Date: 2018-06-08 15:08:37.718268 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2d0ce3ee5bdc' down_revision = 'fccf57ceef02' branch_labels = None depe...
(): # sqlite has no `drop column` command, so we recreate the original table # then load it from a temp table op.rename_table('journalists', 'journalists_tmp') op.create_table('journalists', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=255), nul...
downgrade
identifier_name
2d0ce3ee5bdc_added_passphrase_hash_column_to_.py
"""added passphrase_hash column to journalists table Revision ID: 2d0ce3ee5bdc Revises: fccf57ceef02 Create Date: 2018-06-08 15:08:37.718268 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2d0ce3ee5bdc' down_revision = 'fccf57ceef02' branch_labels = None depe...
INSERT INTO journalists SELECT id, username, pw_salt, pw_hash, is_admin, otp_secret, is_totp, hotp_counter, last_token, created_on, last_access FROM journalists_tmp ''') op.drop_table('journalists_tmp')
op.rename_table('journalists', 'journalists_tmp') op.create_table('journalists', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=255), nullable=False), sa.Column('pw_salt', sa.Binary(), nullable=True), sa.Column('pw_hash', sa.Binary(), nullable=...
identifier_body
edge-trigger-test.rs
/// Ensure all sockets operate on edge trigger mode. extern crate amy; use std::net::{TcpListener, TcpStream}; use std::thread; use std::str; use std::io::{Read, Write}; use amy::{ Poller, Event, }; const IP: &'static str = "127.0.0.1:10008"; /// This test ensures that only one write event is received, eve...
sock.set_nonblocking(true).unwrap(); // Create the poller and registrar let mut poller = Poller::new().unwrap(); let registrar = poller.get_registrar(); // The socket should become writable once it's connected let id = registrar.register(&sock, Event::Write).unwrap(); let notifications = p...
{ // Spawn a listening thread and accept one connection thread::spawn(|| { let listener = TcpListener::bind(IP).unwrap(); let (mut sock, _) = listener.accept().unwrap(); // When the test completes, the client will send a "stop" message to shutdown the server. let mut buf = Strin...
identifier_body
edge-trigger-test.rs
/// Ensure all sockets operate on edge trigger mode. extern crate amy; use std::net::{TcpListener, TcpStream}; use std::thread; use std::str; use std::io::{Read, Write}; use amy::{ Poller, Event, }; const IP: &'static str = "127.0.0.1:10008"; /// This test ensures that only one write event is received, eve...
() { // Spawn a listening thread and accept one connection thread::spawn(|| { let listener = TcpListener::bind(IP).unwrap(); let (mut sock, _) = listener.accept().unwrap(); // When the test completes, the client will send a "stop" message to shutdown the server. let mut buf = St...
edge_trigger
identifier_name
edge-trigger-test.rs
/// Ensure all sockets operate on edge trigger mode. extern crate amy; use std::net::{TcpListener, TcpStream}; use std::thread; use std::str; use std::io::{Read, Write}; use amy::{ Poller, Event,
/// triggered system, write events would come on every poll. #[test] fn edge_trigger() { // Spawn a listening thread and accept one connection thread::spawn(|| { let listener = TcpListener::bind(IP).unwrap(); let (mut sock, _) = listener.accept().unwrap(); // When the test completes, th...
}; const IP: &'static str = "127.0.0.1:10008"; /// This test ensures that only one write event is received, even if no data is written. On a level
random_line_split
edge-trigger-test.rs
/// Ensure all sockets operate on edge trigger mode. extern crate amy; use std::net::{TcpListener, TcpStream}; use std::thread; use std::str; use std::io::{Read, Write}; use amy::{ Poller, Event, }; const IP: &'static str = "127.0.0.1:10008"; /// This test ensures that only one write event is received, eve...
} sock.set_nonblocking(true).unwrap(); // Create the poller and registrar let mut poller = Poller::new().unwrap(); let registrar = poller.get_registrar(); // The socket should become writable once it's connected let id = registrar.register(&sock, Event::Write).unwrap(); let notificati...
{ sock = s; break; }
conditional_block
spotify.py
""" Controller to interface with Spotify. """ import logging import threading from . import BaseController from ..config import APP_SPOTIFY from ..error import LaunchError APP_NAMESPACE = "urn:x-cast:com.spotify.chromecast.secure.v1" TYPE_GET_INFO = "getInfo" TYPE_GET_INFO_RESPONSE = "getInfoResponse" TYPE_SET_CREDEN...
self.device = None self.credential_error = False self.waiting.clear() self.launch(callback_function=callback) # Need to wait for Spotify to be launched on Chromecast completely self.waiting.wait(timeout) if not self.is_launched: raise LaunchError( ...
"""Callback function""" self.send_message( { "type": TYPE_SET_CREDENTIALS, "credentials": self.access_token, "expiresIn": self.expires, } )
identifier_body
spotify.py
""" Controller to interface with Spotify. """ import logging import threading from . import BaseController from ..config import APP_SPOTIFY from ..error import LaunchError APP_NAMESPACE = "urn:x-cast:com.spotify.chromecast.secure.v1" TYPE_GET_INFO = "getInfo"
# pylint: disable=too-many-instance-attributes class SpotifyController(BaseController): """ Controller to interact with Spotify namespace. """ # pylint: disable=useless-super-delegation # The pylint rule useless-super-delegation doesn't realize # we are setting default values here. def __init__(s...
TYPE_GET_INFO_RESPONSE = "getInfoResponse" TYPE_SET_CREDENTIALS = "setCredentials" TYPE_SET_CREDENTIALS_ERROR = "setCredentialsError" TYPE_SET_CREDENTIALS_RESPONSE = "setCredentialsResponse"
random_line_split
spotify.py
""" Controller to interface with Spotify. """ import logging import threading from . import BaseController from ..config import APP_SPOTIFY from ..error import LaunchError APP_NAMESPACE = "urn:x-cast:com.spotify.chromecast.secure.v1" TYPE_GET_INFO = "getInfo" TYPE_GET_INFO_RESPONSE = "getInfoResponse" TYPE_SET_CREDEN...
raise LaunchError( "Timeout when waiting for status response from Spotify app" )
conditional_block
spotify.py
""" Controller to interface with Spotify. """ import logging import threading from . import BaseController from ..config import APP_SPOTIFY from ..error import LaunchError APP_NAMESPACE = "urn:x-cast:com.spotify.chromecast.secure.v1" TYPE_GET_INFO = "getInfo" TYPE_GET_INFO_RESPONSE = "getInfoResponse" TYPE_SET_CREDEN...
(self, access_token, expires): super(SpotifyController, self).__init__(APP_NAMESPACE, APP_SPOTIFY) if access_token is None or expires is None: raise ValueError("access_token and expires cannot be empty") self.logger = logging.getLogger(__name__) self.session_started = False ...
__init__
identifier_name
sbang.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
short_line = "#!/this/is/short/bin/bash\n" long_line = "#!/this/" + ('x' * 200) + "/is/long\n" lua_line = "#!/this/" + ('x' * 200) + "/is/lua\n" lua_in_text = ("line\n") * 100 + "lua\n" + ("line\n" * 100) lua_line_patched = "--!/this/" + ('x' * 200) + "/is/lua\n" node_line = "#!/...
random_line_split
sbang.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
def test_shebang_handling(script_dir): assert shebang_too_long(script_dir.lua_shebang) assert shebang_too_long(script_dir.long_shebang) assert not shebang_too_long(script_dir.short_shebang) assert not shebang_too_long(script_dir.has_sbang) assert not shebang_too_long(script_dir.binary) asser...
sdir = ScriptDirectory() yield sdir sdir.destroy()
identifier_body
sbang.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(): sdir = ScriptDirectory() yield sdir sdir.destroy() def test_shebang_handling(script_dir): assert shebang_too_long(script_dir.lua_shebang) assert shebang_too_long(script_dir.long_shebang) assert not shebang_too_long(script_dir.short_shebang) assert not shebang_too_long(script_dir.has_s...
script_dir
identifier_name
webpack.config.prod.js
/** * @file Webpack configuration file for production. */ const webpack = require('webpack'); const TerserWebpackPlugin = require('terser-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const StyleLintPlugin = require('stylelint-bare-webpack-plugin'); const ManifestPlugin = require...
}), ]; config.optimization = { minimize: true, minimizer: [ new TerserWebpackPlugin({ terserOptions: { compress: { comparisons: false, warnings: false, }, mangle: { safari10: true, }, output: { comments: false, as...
fileName: 'manifest.json',
random_line_split
iter.rs
//! Collection of iterators over a graph. //! //! This module contains various iterators, meant to be returned from the different //! iterator functions. use std::collections::HashMap; use std::collections::btree_map::Iter as BTreeIter; use std::cell::Ref; use graph::graph::Element; use vec_map::Keys; macro_rules! i...
res } }
{self.start = t;}
conditional_block
iter.rs
//! Collection of iterators over a graph. //! //! This module contains various iterators, meant to be returned from the different //! iterator functions. use std::collections::HashMap; use std::collections::btree_map::Iter as BTreeIter; use std::cell::Ref; use graph::graph::Element; use vec_map::Keys; macro_rules! i...
(tree : Ref<'a, HashMap<usize, Option<usize>>>, start : usize) -> Root<'a> { Root {tree : tree, start : start} } } impl<'a, E : 'a> Iterator for ConnIdVal<'a, E> { type Item = (usize, &'a E); fn next(&mut self) -> Option<(usize, &'a E)> { self.element.next().map(|(&n, e)| (n, e)) } } i...
new
identifier_name
iter.rs
//! Collection of iterators over a graph. //! //! This module contains various iterators, meant to be returned from the different //! iterator functions. use std::collections::HashMap; use std::collections::btree_map::Iter as BTreeIter; use std::cell::Ref; use graph::graph::Element; use vec_map::Keys; macro_rules! i...
} impl<'a, E : 'a> Iterator for ConnIdVal<'a, E> { type Item = (usize, &'a E); fn next(&mut self) -> Option<(usize, &'a E)> { self.element.next().map(|(&n, e)| (n, e)) } } impl<'a, E : 'a> Iterator for IterEdges<'a, E> { type Item = &'a E; fn next(&mut self) -> Option<&'a E> { sel...
{ Root {tree : tree, start : start} }
identifier_body
iter.rs
//! Collection of iterators over a graph. //! //! This module contains various iterators, meant to be returned from the different //! iterator functions. use std::collections::HashMap; use std::collections::btree_map::Iter as BTreeIter; use std::cell::Ref; use graph::graph::Element; use vec_map::Keys; macro_rules! i...
impl<'a, V : 'a, E : 'a> Iterator for ListIds<'a, V, E> { type Item = usize; fn next(&mut self) -> Option<usize> { self.element.next() } } impl<'a> Iterator for Root<'a> { type Item = usize; fn next(&mut self) -> Option<usize> { let res = self.tree.get(&self.start).and_then(|&t| t);...
random_line_split
hidclass.rs
// 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. // All files in the project carrying such notice may not be copied, modified, or distributed // except according ...
reportId: UCHAR, }} pub type PHID_XFER_PACKET = *mut HID_XFER_PACKET; //FIXME Stuff for NT_INCLUDED STRUCT!{struct HID_COLLECTION_INFORMATION { DescriptorSize: ULONG, Polled: BOOLEAN, Reserved1: [UCHAR; 1], VendorID: USHORT, ProductID: USHORT, VersionNumber: USHORT, }} pub type PHID_COLLECTI...
random_line_split
termbox.rs
#[link(name = "termbox", vers = "0.1.0")]; #[crate_type = "lib"]; /*! * * A lightweight curses alternative wrapping the termbox library. * * # SYNOPSIS * * A hello world for the terminal: * * extern mod std; * extern mod termbox; * * use tb = termbox; * * fn main() { * tb::init();...
() { ff::tb_shutdown(); } pub fn width() -> uint { ff::tb_width() as uint } pub fn height() -> uint { ff::tb_height() as uint } /** * Clear buffer. */ pub fn clear() { ff::tb_clear(); } /** * Write buffer to terminal. */ pub fn present() { ff::tb_present(); } pub fn set_cursor(cx: int...
shutdown
identifier_name
termbox.rs
#[link(name = "termbox", vers = "0.1.0")]; #[crate_type = "lib"]; /*! * * A lightweight curses alternative wrapping the termbox library. * * # SYNOPSIS * * A hello world for the terminal: * * extern mod std; * extern mod termbox; * * use tb = termbox; * * fn main() { * tb::init();...
pub fn height() -> uint { ff::tb_height() as uint } /** * Clear buffer. */ pub fn clear() { ff::tb_clear(); } /** * Write buffer to terminal. */ pub fn present() { ff::tb_present(); } pub fn set_cursor(cx: int, cy: int) { ff::tb_set_cursor(cx as c_int, cy as c_int); } // low-level wrappe...
{ ff::tb_width() as uint }
identifier_body
termbox.rs
#[link(name = "termbox", vers = "0.1.0")]; #[crate_type = "lib"]; /*! * * A lightweight curses alternative wrapping the termbox library. * * # SYNOPSIS * * A hello world for the terminal: * * extern mod std; * extern mod termbox; * * use tb = termbox; * * fn main() { * tb::init();...
fn tb_peek_event(ev: *raw_event, timeout: c_uint) -> c_int; fn tb_poll_event(ev: *raw_event) -> c_int; } pub fn init() -> int { ff::tb_init() as int } pub fn shutdown() { ff::tb_shutdown(); } pub fn width() -> uint { ff::tb_width() as uint } pub fn height() -> uint { ff::tb_height() as ...
fn tb_change_cell(x: c_uint, y: c_uint, ch: u32, fg: u16, bg: u16); fn tb_select_input_mode(mode: c_int) -> c_int; fn tb_set_clear_attributes(fg: u16, bg: u16);
random_line_split
search.ts
import { Component, ChangeDetectorRef} from '@angular/core'; import { UserService } from "../../providers/session/UserService"; import { NavController } from 'ionic-angular'; import {Events} from "ionic-angular/index"; import {User} from "../../model/user"; import {MovieService} from "../../providers/movie/MovieService...
} } chooseUser(user) { console.log(user); let modal = this.modalCtrl.create(ViewProfile, {uid: user.uid}); modal.present(); } chooseMovie(movie) { console.log(movie);//todo } }
{ this.users = []; }
conditional_block
search.ts
import { Component, ChangeDetectorRef} from '@angular/core'; import { UserService } from "../../providers/session/UserService"; import { NavController } from 'ionic-angular'; import {Events} from "ionic-angular/index"; import {User} from "../../model/user"; import {MovieService} from "../../providers/movie/MovieService...
() { this.events.unsubscribe('movie:search:result'); this.events.unsubscribe('user:search:result'); } searchQuery:string; movies:Movie[]; users:string[]; searchType:string; getItems(ev:any) { let val = ev ? ev.target.value : this.searchQuery; this.searchQuery =...
ionViewWillLeave
identifier_name
search.ts
import { Component, ChangeDetectorRef} from '@angular/core'; import { UserService } from "../../providers/session/UserService"; import { NavController } from 'ionic-angular'; import {Events} from "ionic-angular/index"; import {User} from "../../model/user"; import {MovieService} from "../../providers/movie/MovieService...
constructor(public navCtrl:NavController, private cd:ChangeDetectorRef, public events:Events, public modalCtrl:ModalController, public userService:UserService, public movieService:MovieService) { this.events = events; t...
export class SearchPage {
random_line_split
search.ts
import { Component, ChangeDetectorRef} from '@angular/core'; import { UserService } from "../../providers/session/UserService"; import { NavController } from 'ionic-angular'; import {Events} from "ionic-angular/index"; import {User} from "../../model/user"; import {MovieService} from "../../providers/movie/MovieService...
searchQuery:string; movies:Movie[]; users:string[]; searchType:string; getItems(ev:any) { let val = ev ? ev.target.value : this.searchQuery; this.searchQuery = val; console.log('searching for ' + val.toLowerCase()); if (this.searchType == 'movies') { t...
{ this.events.unsubscribe('movie:search:result'); this.events.unsubscribe('user:search:result'); }
identifier_body
user.js
var sage = require('../../../build/sage'); var Schema = sage.Schema; var UserSchema = new Schema({ USER_ID: { type: "number",
readonly: true }, USERNAME: { type: "varchar" }, POSTS: { type: "association", joinType: "hasMany", joinsWith: "SAGE_TEST.POSTS", foreignKeys: { mine: "USER_ID", theirs: "USER_ID" }, model: "SAGE_TEST.POSTS" }, PROFILE: { type: "association", joinType: "ha...
readonly: true }, CREATED_AT: { type: "timestamp",
random_line_split
SearchHistory.tsx
import { Search } from '@destinyitemmanager/dim-api-types'; import { saveSearch, searchDeleted } from 'app/dim-api/basic-actions'; import { recentSearchesSelector } from 'app/dim-api/selectors'; import { t } from 'app/i18next-t'; import { AppIcon, closeIcon, starIcon, starOutlineIcon } from 'app/shell/icons'; import { ...
.map((search) => ( <tr key={search.query}> <td> <button type="button" onClick={(e) => deleteSearch(e, search)} title={t('Header.DeleteSearch')} className={styles.iconButton} ...
{recentSearches .filter((s) => s.usageCount > 0) .sort(searchComparator)
random_line_split
new-expression.ts
import * as babylon from 'babylon'; import {Expression} from './expression'; import {Node} from './node'; import {Identifier} from './identifier'; import * as th from '../type-helper'; export class NewExpression extends Expression<babylon.NewExpression> { private _callee: Node<any>; private _arguments: Identifie...
return this._callee; } get arguments() { if (typeof this._arguments == 'undefined') { this._arguments = this.raw.arguments.map(argument => <Identifier>th.convert(argument, this)); } return this._arguments; } public visit(fn: (node: Node<any>) => void): void { fn(this); this.call...
{ this._callee = th.convert(this.raw.callee, this); }
conditional_block
new-expression.ts
import * as babylon from 'babylon'; import {Expression} from './expression'; import {Node} from './node'; import {Identifier} from './identifier'; import * as th from '../type-helper'; export class NewExpression extends Expression<babylon.NewExpression> { private _callee: Node<any>; private _arguments: Identifie...
}
random_line_split
new-expression.ts
import * as babylon from 'babylon'; import {Expression} from './expression'; import {Node} from './node'; import {Identifier} from './identifier'; import * as th from '../type-helper'; export class NewExpression extends Expression<babylon.NewExpression> { private _callee: Node<any>; private _arguments: Identifie...
() { if (typeof this._callee == 'undefined') { this._callee = th.convert(this.raw.callee, this); } return this._callee; } get arguments() { if (typeof this._arguments == 'undefined') { this._arguments = this.raw.arguments.map(argument => <Identifier>th.convert(argument, this)); } ...
callee
identifier_name
DDTownLoader.py
import TownLoader import DDStreet from toontown.suit import Suit class DDTownLoader(TownLoader.TownLoader): def __init__(self, hood, parentFSM, doneEvent): TownLoader.TownLoader.__init__(self, hood, parentFSM, doneEvent) self.streetClass = DDStreet.DDStreet self.musicFile = 'phase_6/audio/...
(self, requestStatus): TownLoader.TownLoader.enter(self, requestStatus) def exit(self): TownLoader.TownLoader.exit(self)
enter
identifier_name
DDTownLoader.py
import TownLoader import DDStreet from toontown.suit import Suit class DDTownLoader(TownLoader.TownLoader): def __init__(self, hood, parentFSM, doneEvent): TownLoader.TownLoader.__init__(self, hood, parentFSM, doneEvent) self.streetClass = DDStreet.DDStreet self.musicFile = 'phase_6/audio/...
def exit(self): TownLoader.TownLoader.exit(self)
random_line_split
DDTownLoader.py
import TownLoader import DDStreet from toontown.suit import Suit class DDTownLoader(TownLoader.TownLoader): def __init__(self, hood, parentFSM, doneEvent):
def load(self, zoneId): TownLoader.TownLoader.load(self, zoneId) Suit.loadSuits(2) dnaFile = 'phase_6/dna/donalds_dock_' + str(self.canonicalBranchZone) + '.pdna' self.createHood(dnaFile) def unload(self): Suit.unloadSuits(2) TownLoader.TownLoader.unload(self) ...
TownLoader.TownLoader.__init__(self, hood, parentFSM, doneEvent) self.streetClass = DDStreet.DDStreet self.musicFile = 'phase_6/audio/bgm/DD_SZ.ogg' self.activityMusicFile = 'phase_6/audio/bgm/DD_SZ_activity.ogg' self.townStorageDNAFile = 'phase_6/dna/storage_DD_town.pdna'
identifier_body
tombstone.py
config = { "name": "Tombstone counter", # plugin name "type": "receiver", #plugin type "description": ["counts tombstones in a world"] #description } import database as db # import terraria database class Receiver(): # required class to be called by plugin manager def __init__(self): #do any ini...
def rec_tiles(self, tiles): #called when tiles are ready x = 0 #our counter variable for column in tiles: # tiles come as 2D list for tile in column: #so we need to get tiles like this if tile[0] == self.tile_id: #tile[0] is the tile_id x += 1 ...
print("Counting Tombstones for %s" % header["name"]) #so we print the name from header
identifier_body
tombstone.py
config = { "name": "Tombstone counter", # plugin name "type": "receiver", #plugin type "description": ["counts tombstones in a world"] #description } import database as db # import terraria database class Receiver(): # required class to be called by plugin manager def __init__(self): #do any ini...
print("Found %d Tombstones" % (x // 4)) #divide counter by 4, because each tombstone consists of 4 "sub tiles" return False #signal plugin manager we are done and dont need any further data
if tile[0] == self.tile_id: #tile[0] is the tile_id x += 1 #increment counter for each found tombstone tile
conditional_block
tombstone.py
config = { "name": "Tombstone counter", # plugin name "type": "receiver", #plugin type "description": ["counts tombstones in a world"] #description } import database as db # import terraria database class Receiver(): # required class to be called by plugin manager def __init__(self): #do any ini...
(self, header): #this is called by plugin manager when the header is read print("Counting Tombstones for %s" % header["name"]) #so we print the name from header def rec_tiles(self, tiles): #called when tiles are ready x = 0 #our counter variable for column in tiles: # tiles come as 2D ...
rec_header
identifier_name
tombstone.py
config = { "name": "Tombstone counter", # plugin name "type": "receiver", #plugin type "description": ["counts tombstones in a world"] #description } import database as db # import terraria database class Receiver(): # required class to be called by plugin manager def __init__(self): #do any ini...
for column in tiles: # tiles come as 2D list for tile in column: #so we need to get tiles like this if tile[0] == self.tile_id: #tile[0] is the tile_id x += 1 #increment counter for each found tombstone tile print("Found %d Tombstones" % (x // 4)) #di...
def rec_header(self, header): #this is called by plugin manager when the header is read print("Counting Tombstones for %s" % header["name"]) #so we print the name from header def rec_tiles(self, tiles): #called when tiles are ready x = 0 #our counter variable
random_line_split
mod_resolver.rs
use std::io; use std::path::PathBuf; use super::read_config; use crate::{FileName, Input, Session}; fn verify_mod_resolution(input_file_name: &str, exp_misformatted_files: &[&str]) { let input_file = PathBuf::from(input_file_name); let config = read_config(&input_file); let mut session = Session::<io::St...
() { // See also https://github.com/rust-lang/rustfmt/issues/5063 verify_mod_resolution( "tests/mod-resolver/issue-5063/main.rs", &[ "tests/mod-resolver/issue-5063/foo/bar/baz.rs", "tests/mod-resolver/issue-5063/foo.rs", ], ); }
out_of_line_nested_inline_within_out_of_line
identifier_name
mod_resolver.rs
use std::io; use std::path::PathBuf; use super::read_config; use crate::{FileName, Input, Session}; fn verify_mod_resolution(input_file_name: &str, exp_misformatted_files: &[&str]) { let input_file = PathBuf::from(input_file_name); let config = read_config(&input_file); let mut session = Session::<io::St...
#[test] fn out_of_line_nested_inline_within_out_of_line() { // See also https://github.com/rust-lang/rustfmt/issues/5063 verify_mod_resolution( "tests/mod-resolver/issue-5063/main.rs", &[ "tests/mod-resolver/issue-5063/foo/bar/baz.rs", "tests/mod-resolver/issue-5063/foo...
{ // See also https://github.com/rust-lang/rustfmt/issues/4874 verify_mod_resolution( "tests/mod-resolver/issue-4874/main.rs", &[ "tests/mod-resolver/issue-4874/bar/baz.rs", "tests/mod-resolver/issue-4874/foo/qux.rs", ], ); }
identifier_body
mod_resolver.rs
use std::io; use std::path::PathBuf; use super::read_config; use crate::{FileName, Input, Session}; fn verify_mod_resolution(input_file_name: &str, exp_misformatted_files: &[&str]) { let input_file = PathBuf::from(input_file_name); let config = read_config(&input_file); let mut session = Session::<io::St...
); } #[test] fn out_of_line_nested_inline_within_out_of_line() { // See also https://github.com/rust-lang/rustfmt/issues/5063 verify_mod_resolution( "tests/mod-resolver/issue-5063/main.rs", &[ "tests/mod-resolver/issue-5063/foo/bar/baz.rs", "tests/mod-resolver/issue-...
"tests/mod-resolver/issue-4874/bar/baz.rs", "tests/mod-resolver/issue-4874/foo/qux.rs", ],
random_line_split
process_document_splitter_sample.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
def page_refs_to_string(page_refs: dict) -> str: """ Converts a page ref to a string describing the page or page range.""" if len(page_refs) == 1: num = str(int(page_refs[0].page) + 1) return f"page {num} is" else: start = str(int(page_refs[0].page) + 1) end = str(int(page...
conf_percent = "{:.1%}".format(entity.confidence) pages_range = page_refs_to_string(entity.page_anchor.page_refs) # Print subdocument type information, if available try: doctype = entity.type print( f'{conf_percent} confident that {pages_range} a "{doctype...
conditional_block
process_document_splitter_sample.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
(page_refs: dict) -> str: """ Converts a page ref to a string describing the page or page range.""" if len(page_refs) == 1: num = str(int(page_refs[0].page) + 1) return f"page {num} is" else: start = str(int(page_refs[0].page) + 1) end = str(int(page_refs[1].page) + 1) ...
page_refs_to_string
identifier_name
process_document_splitter_sample.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
def process_document_splitter_sample( project_id: str, location: str, processor_id: str, file_path: str ): from google.cloud import documentai_v1beta3 as documentai # You must set the api_endpoint if you use a location other than 'us', e.g.: opts = {} if location == "eu": opts = {"api_end...
# location = 'YOUR_PROJECT_LOCATION' # Format is 'us' or 'eu' # processor_id = 'YOUR_PROCESSOR_ID' # Create processor in Cloud Console # file_path = '/path/to/local/pdf'
random_line_split
process_document_splitter_sample.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Configure the process request request = {"name": name, "raw_document": document} # Recognizes text entities in the PDF document result = client.process_document(request=request) print("Document processing complete.\n") # Read the splitter output from the document splitter processor: # h...
from google.cloud import documentai_v1beta3 as documentai # You must set the api_endpoint if you use a location other than 'us', e.g.: opts = {} if location == "eu": opts = {"api_endpoint": "eu-documentai.googleapis.com"} client = documentai.DocumentProcessorServiceClient(client_options=opts) ...
identifier_body
filecache_test.rs
// // Copyright (c) Pirmin Kalberer. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. // use crate::cache::cache::Cache; use crate::cache::filecache::Filecache; use std::fs; use std::path::Path; #[test] fn test_dircache() { use std::env; ...
let _ = f.read_to_string(&mut s); }); assert_eq!(&s, "0123456789"); }
let mut s = String::new(); cache.read(path, |f| {
random_line_split
filecache_test.rs
// // Copyright (c) Pirmin Kalberer. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. // use crate::cache::cache::Cache; use crate::cache::filecache::Filecache; use std::fs; use std::path::Path; #[test] fn
() { use std::env; let mut dir = env::temp_dir(); dir.push("t_rex_test"); let basepath = format!("{}", &dir.display()); let _ = fs::remove_dir_all(&basepath); let cache = Filecache { basepath: basepath, baseurl: Some("http://localhost:6767".to_string()), }; let path = "...
test_dircache
identifier_name
filecache_test.rs
// // Copyright (c) Pirmin Kalberer. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. // use crate::cache::cache::Cache; use crate::cache::filecache::Filecache; use std::fs; use std::path::Path; #[test] fn test_dircache()
let _ = cache.write(path, obj.as_bytes()); assert!(Path::new(&fullpath).exists()); // Cache hit assert_eq!(cache.read(path, |_| {}), true); // Read from cache let mut s = String::new(); cache.read(path, |f| { let _ = f.read_to_string(&mut s); }); assert_eq!(&s, "0123456789"...
{ use std::env; let mut dir = env::temp_dir(); dir.push("t_rex_test"); let basepath = format!("{}", &dir.display()); let _ = fs::remove_dir_all(&basepath); let cache = Filecache { basepath: basepath, baseurl: Some("http://localhost:6767".to_string()), }; let path = "til...
identifier_body
Progress.py
import os from PodSix.Resource import * from PodSix.Concurrent import Concurrent class Progress(Concurrent): def __init__(self): Concurrent.__init__(self) self.sprite = Image(file=os.path.join("resources", "progress.png")) self.showing = False self.maximum = 1 self.value = 0 self.width = 142 self.heig...
def Show(self, maximum=None): if not maximum is None: self.maximum = maximum self.showing = True def Hide(self): if self.showing: self.showing = False def Value(self, val, maximum=None): if not maximum is None: self.maximum = maximum self.value = val
gfx.screen.fill([80, 80, 80], special_flags=BLEND_SUB) gfx.BlitImage(self.sprite, center=[gfx.width / 2, gfx.height / 2]) gfx.DrawRect((gfx.width / 2 - self.width / 2, gfx.height / 2 - self.height / 2, self.width * (1 - float(self.value) / self.maximum), self.height), [255, 0, 0], 0)
conditional_block
Progress.py
import os from PodSix.Resource import * from PodSix.Concurrent import Concurrent class Progress(Concurrent): def __init__(self):
def Draw(self): if self.showing: gfx.screen.fill([80, 80, 80], special_flags=BLEND_SUB) gfx.BlitImage(self.sprite, center=[gfx.width / 2, gfx.height / 2]) gfx.DrawRect((gfx.width / 2 - self.width / 2, gfx.height / 2 - self.height / 2, self.width * (1 - float(self.value) / self.maximum), self.height), [25...
Concurrent.__init__(self) self.sprite = Image(file=os.path.join("resources", "progress.png")) self.showing = False self.maximum = 1 self.value = 0 self.width = 142 self.height = 20 self.priority = 5
identifier_body
Progress.py
import os from PodSix.Resource import *
from PodSix.Concurrent import Concurrent class Progress(Concurrent): def __init__(self): Concurrent.__init__(self) self.sprite = Image(file=os.path.join("resources", "progress.png")) self.showing = False self.maximum = 1 self.value = 0 self.width = 142 self.height = 20 self.priority = 5 def Draw(se...
random_line_split