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
luhn_test.rs
// Implements http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers struct Digits { m: u64 } impl Iterator for Digits { type Item = u64; fn next(&mut self) -> Option<u64> { match self.m { 0 => None, n => { let ret = n % 10; self.m = n / 10...
assert!(!luhn_test(49927398717)); assert!(!luhn_test(1234567812345678)); assert!(luhn_test(1234567812345670)); }
fn test_inputs() { assert!(luhn_test(49927398716));
random_line_split
Route.tsx
/** * Taken from @taion as per example of how they actually use found-relay and * have default setup for each route. */ import { RouteSpinner } from "Artsy/Relay/renderWithLoadProgress" import { HttpError } from "found" import BaseRoute from "found/Route" import React from "react" type FetchIndicator = "spinner" |...
if (Component === undefined) { return undefined } // This should only ever show when doing client-side routing. if (!props) { if (fetchIndicator === "spinner") { return <RouteSpinner /> // TODO: At some point we might want to make this a little fancier. If // und...
{ return render(renderArgs) }
conditional_block
Route.tsx
/** * Taken from @taion as per example of how they actually use found-relay and * have default setup for each route. */ import { RouteSpinner } from "Artsy/Relay/renderWithLoadProgress" import { HttpError } from "found" import BaseRoute from "found/Route" import React from "react" type FetchIndicator = "spinner" |...
}
{ if (!(props.query || props.getQuery)) { super(props) return } super({ ...props, render: createRender(props), }) }
identifier_body
Route.tsx
/** * Taken from @taion as per example of how they actually use found-relay and * have default setup for each route. */ import { RouteSpinner } from "Artsy/Relay/renderWithLoadProgress" import { HttpError } from "found" import BaseRoute from "found/Route" import React from "react" type FetchIndicator = "spinner" |...
extends BaseRoute { constructor(props) { if (!(props.query || props.getQuery)) { super(props) return } super({ ...props, render: createRender(props), }) } }
Route
identifier_name
Route.tsx
/**
import { HttpError } from "found" import BaseRoute from "found/Route" import React from "react" type FetchIndicator = "spinner" | "overlay" interface CreateRenderProps { fetchIndicator?: FetchIndicator render?: (props) => React.ReactNode } interface RenderArgProps { Component: React.ComponentType props?: obj...
* Taken from @taion as per example of how they actually use found-relay and * have default setup for each route. */ import { RouteSpinner } from "Artsy/Relay/renderWithLoadProgress"
random_line_split
mapUtils.test.js
import deepFreeze from 'deep-freeze'; import { arrayToMap, mapKeysToArray } from './mapUtils'; describe('arrayToMap', () => { it('should create map from 2D array', () => { const a = [ ['key1', 'value1'], ['key2', 'value2'] ]; deepFreeze(a); const result = arrayToMap(a); expect(resu...
const map = new Map(); const result = mapKeysToArray(map); expect(result).toEqual([]); }); });
random_line_split
counted-cache.ts
export interface CacheItem<T> { count: number data: T } export class
<T = any> { private caches: { [key: string]: CacheItem<T> } = {} private count = 0 get length(): number { return this.count } // return Array<[key, {count: number, data: T}]> getAll(): Array<[string, CacheItem<T>]> { return Object.keys(this.caches).map( key => [key, this.caches[key]] as [str...
CountedCache
identifier_name
counted-cache.ts
export interface CacheItem<T> { count: number data: T } export class CountedCache<T = any> { private caches: { [key: string]: CacheItem<T> } = {} private count = 0 get length(): number { return this.count } // return Array<[key, {count: number, data: T}]> getAll(): Array<[string, CacheItem<T>]> {...
count: 1, data: value, } this.count++ } } get(key: string): T | null { const item = this.caches[key] if (item) { item.count++ return item.data } return null } remove(key: string): void { if (key in this.caches) { delete this.caches[key] ...
item.data = value } else { this.caches[key] = {
random_line_split
counted-cache.ts
export interface CacheItem<T> { count: number data: T } export class CountedCache<T = any> { private caches: { [key: string]: CacheItem<T> } = {} private count = 0 get length(): number { return this.count } // return Array<[key, {count: number, data: T}]> getAll(): Array<[string, CacheItem<T>]> {...
return null } remove(key: string): void { if (key in this.caches) { delete this.caches[key] this.count-- } } }
{ item.count++ return item.data }
conditional_block
counted-cache.ts
export interface CacheItem<T> { count: number data: T } export class CountedCache<T = any> { private caches: { [key: string]: CacheItem<T> } = {} private count = 0 get length(): number { return this.count } // return Array<[key, {count: number, data: T}]> getAll(): Array<[string, CacheItem<T>]> {...
remove(key: string): void { if (key in this.caches) { delete this.caches[key] this.count-- } } }
{ const item = this.caches[key] if (item) { item.count++ return item.data } return null }
identifier_body
default.py
(Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' base='' ADDON=xbmcaddon.Addon(id='plugin.video.mykodibuildwizard') dialog = xbmcgui.Dialog() VERSION = "1.0.1" PATH = "mykodibuildwizard" def CATEGORIES(): link = OPEN_URL('https://raw.githubusercontent.com/GhostT...
params=get_params() url=None name=None mode=None iconimage=None fanart=None description=None try: url=urllib.unquote_plus(params["url"]) except: pass try: name=urllib.unquote_plus(params["name"]) except: pass try: iconimage=urllib.unquote_plus(p...
param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') ...
identifier_body
default.py
(Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' base='' ADDON=xbmcaddon.Addon(id='plugin.video.mykodibuildwizard') dialog = xbmcgui.Dialog() VERSION = "1.0.1" PATH = "mykodibuildwizard" def CATEGORIES(): link = OPEN_URL('https://raw.githubusercontent.com/GhostT...
def addDir(name,url,mode,iconimage,fanart,description): u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)+"&fanart="+urllib.quote_plus(fanart)+"&description="+urllib.quote_plus(description) ok=True liz=x...
return 'ios'
conditional_block
default.py
(Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' base='' ADDON=xbmcaddon.Addon(id='plugin.video.mykodibuildwizard') dialog = xbmcgui.Dialog() VERSION = "1.0.1" PATH = "mykodibuildwizard" def CATEGORIES(): link = OPEN_URL('https://raw.githubusercontent.com/GhostT...
(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams...
get_params
identifier_name
default.py
(Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' base='' ADDON=xbmcaddon.Addon(id='plugin.video.mykodibuildwizard') dialog = xbmcgui.Dialog() VERSION = "1.0.1" PATH = "mykodibuildwizard" def CATEGORIES(): link = OPEN_URL('https://raw.githubusercontent.com/GhostT...
cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitpa...
param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2]
random_line_split
BranchAnalysisList-test.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
function mockBadge(offsetTop: string) { const element = document.createElement('div'); element.setAttribute('originOffsetTop', offsetTop); return element; }
{ return shallow<BranchAnalysisList>( <BranchAnalysisList analysis="analysis1" branch="master" component="project1" onSelectAnalysis={jest.fn()} {...props} /> ); }
identifier_body
BranchAnalysisList-test.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
(offsetTop: string) { const element = document.createElement('div'); element.setAttribute('originOffsetTop', offsetTop); return element; }
mockBadge
identifier_name
BranchAnalysisList-test.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
expect(wrapper.state().analyses).toHaveLength(4); }); it('should reload analyses after range change', () => { const wrapper = shallowRender(); wrapper.instance().handleRangeChange({ value: 30 }); expect(getProjectActivity).toBeCalledWith({ branch: 'master', project: 'project1', from: toShortNotSo...
await waitAndUpdate(wrapper); expect(getProjectActivity).toBeCalled();
random_line_split
FileTransformsUtility.ts
import tl = require('azure-pipelines-task-lib/task'); import { parse } from './ParameterParserUtility'; import { PackageType } from '../webdeployment-common/packageUtility'; var deployUtility = require('../webdeployment-common/utility.js'); var generateWebConfigUtil = require('../webdeployment-common/webconfigutil.js')...
else { tl.debug('File Tranformation not enabled'); } return webPackage; } }
{ var isFolderBasedDeployment: boolean = tl.stats(webPackage).isDirectory(); var folderPath = await deployUtility.generateTemporaryFolderForDeployment(isFolderBasedDeployment, webPackage, packageType); if (parameters) { tl.debug('parsing web.config parameters'); ...
conditional_block
FileTransformsUtility.ts
import tl = require('azure-pipelines-task-lib/task'); import { parse } from './ParameterParserUtility'; import { PackageType } from '../webdeployment-common/packageUtility'; var deployUtility = require('../webdeployment-common/utility.js'); var generateWebConfigUtil = require('../webdeployment-common/webconfigutil.js')...
private static rootDirectoryPath: string = "D:\\home\\site\\wwwroot"; public static async applyTransformations(webPackage: string, parameters: string, packageType: PackageType): Promise<string> { tl.debug("WebConfigParameters is "+ parameters); if (parameters) { var isFolderBasedDep...
random_line_split
FileTransformsUtility.ts
import tl = require('azure-pipelines-task-lib/task'); import { parse } from './ParameterParserUtility'; import { PackageType } from '../webdeployment-common/packageUtility'; var deployUtility = require('../webdeployment-common/utility.js'); var generateWebConfigUtil = require('../webdeployment-common/webconfigutil.js')...
{ private static rootDirectoryPath: string = "D:\\home\\site\\wwwroot"; public static async applyTransformations(webPackage: string, parameters: string, packageType: PackageType): Promise<string> { tl.debug("WebConfigParameters is "+ parameters); if (parameters) { var isFolderBased...
FileTransformsUtility
identifier_name
Security.ts
/** * @module Security * @preferred * @description Module for security related stuff */ /** */ // tslint:disable:naming-convention
/** * Provides metadata about permission level. */ export enum PermissionLevel { AllowedOrDenied, Allowed, Denied } /** * Type to provide an Object with the permission information that has to be set. */ export class PermissionRequestBody { public identity: string; public localOnly?: boolean; public Rest...
/** * Provides metadata about identity kind. */ export enum IdentityKind { All, Users, Groups, OrganizationalUnits, UsersAndGroups, UsersAndOrganizationalUnits, GroupsAndOrganizationalUnits }
random_line_split
Security.ts
/** * @module Security * @preferred * @description Module for security related stuff */ /** */ // tslint:disable:naming-convention /** * Provides metadata about identity kind. */ export enum IdentityKind { All, Users, Groups, OrganizationalUnits, UsersAndGroups, UsersAndOrganizationalUnits, GroupsAndOrganiz...
{ public identity: string; public localOnly?: boolean; public RestrictedPreview?: PermissionValues; public PreviewWithoutWatermakr?: PermissionValues; public PreviewWithoutRedaction?: PermissionValues; public Open?: PermissionValues; public OpenMinor?: PermissionValues; public Save?: Pe...
PermissionRequestBody
identifier_name
CheckoutButton.tsx
import { PAYMENT_METHOD_TYPE, PAYMENT_METHOD_TYPES } from '@proton/shared/lib/constants'; import { c } from 'ttag'; import { SubscriptionCheckResponse } from '@proton/shared/lib/interfaces'; import { PrimaryButton, StyledPayPalButton } from '@proton/components'; import { SignupPayPal } from './interfaces'; interface ...
<PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action') .t`Confirm`}</PrimaryButton> ); } return ( <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action') .t`Pay`}</...
random_line_split
mod.rs
//! Collectors will receive events from the contextual shard, check if the //! filter lets them pass, and collects if the receive, collect, or time limits //! are not reached yet. use std::sync::Arc; mod error; pub use error::Error as CollectorError; #[cfg(feature = "unstable_discord_api")] pub mod component_interac...
pub(crate) struct LazyArc<'a, T> { value: &'a T, arc: Option<Arc<T>>, } impl<'a, T: Clone> LazyArc<'a, T> { pub fn new(value: &'a T) -> Self { LazyArc { value, arc: None, } } pub fn as_arc(&mut self) -> Arc<T> { let value = self.value; self.a...
/// the value in filters while only cloning values that actually match. #[derive(Debug)]
random_line_split
mod.rs
//! Collectors will receive events from the contextual shard, check if the //! filter lets them pass, and collects if the receive, collect, or time limits //! are not reached yet. use std::sync::Arc; mod error; pub use error::Error as CollectorError; #[cfg(feature = "unstable_discord_api")] pub mod component_interac...
}
{ self.value }
identifier_body
mod.rs
//! Collectors will receive events from the contextual shard, check if the //! filter lets them pass, and collects if the receive, collect, or time limits //! are not reached yet. use std::sync::Arc; mod error; pub use error::Error as CollectorError; #[cfg(feature = "unstable_discord_api")] pub mod component_interac...
(&mut self) -> Arc<T> { let value = self.value; self.arc.get_or_insert_with(|| Arc::new(value.clone())).clone() } } impl<'a, T> std::ops::Deref for LazyArc<'a, T> { type Target = T; fn deref(&self) -> &Self::Target { self.value } }
as_arc
identifier_name
rgb-effect.js
function
() { this.canvas = new MEDIA.Canvas(); this.name = 'RGBEffect'; this.controls = { RedThreshold: { value: 128, min: 0, max: 255, step: 2 } }; } RGBEffect.prototype = { draw: function () { var canvas = this.canvas; var redThreshold = this.controls.RedThreshold.value; APP.drawImage(canvas); ...
RGBEffect
identifier_name
rgb-effect.js
function RGBEffect() { this.canvas = new MEDIA.Canvas(); this.name = 'RGBEffect'; this.controls = { RedThreshold: { value: 128, min: 0, max: 255, step: 2 } }; } RGBEffect.prototype = { draw: function () { var canvas = this.canvas; var redThreshold = this.controls.RedThreshold.value; APP.dr...
else { data[i] = 0; } } canvas.putImageData(img); } };
{ data[i] = r; }
conditional_block
rgb-effect.js
function RGBEffect() { this.canvas = new MEDIA.Canvas(); this.name = 'RGBEffect'; this.controls = { RedThreshold: { value: 128, min: 0, max: 255, step: 2 } }; } RGBEffect.prototype = { draw: function () { var canvas = this.canvas;
var img = canvas.getImageData(); var data = img.data; // Pixel data here // 0 red : 1st pixel (0 - 255) // 1 green : 1st pixel // 2 blue : 1st pixel // 3 alpha : 1st pixel // 4 red : 2nd pixel // 5 green : 2nd pixel // 6 blue : 2nd pixel // 7 alpha : 2nd pixel for (var i = 0, len =...
var redThreshold = this.controls.RedThreshold.value; APP.drawImage(canvas);
random_line_split
rgb-effect.js
function RGBEffect()
RGBEffect.prototype = { draw: function () { var canvas = this.canvas; var redThreshold = this.controls.RedThreshold.value; APP.drawImage(canvas); var img = canvas.getImageData(); var data = img.data; // Pixel data here // 0 red : 1st pixel (0 - 255) // 1 green : 1st pixel // 2 blue : 1st pi...
{ this.canvas = new MEDIA.Canvas(); this.name = 'RGBEffect'; this.controls = { RedThreshold: { value: 128, min: 0, max: 255, step: 2 } }; }
identifier_body
character-select.js
import {Buttons} from '../game/input'; import {Menu, MenuPage, ButtonMenuItem, LabelMenuItem} from './menu'; import {DummyInputTarget, ProxyInputTarget} from '../player'; import StageSelectMenuPage from './stage-selection'; import React from 'react'; import {BabylonJS} from '../react-babylonjs'; import BABYLON from 'ba...
componentDidMount() { this.props.players.setInputTargetFinder((i, player) => { const proxy = new ProxyInputTarget(new DummyInputTarget()); // setState is not synchronous. To mutate an array in it multiple // times before it applies the state update to this.state, must // use the callback ...
return acc; }, {}); this.props.menu.pushMenuPage(<StageSelectMenuPage game={this.props.game} playerInfo={playerInfo}/>); } }
random_line_split
character-select.js
import {Buttons} from '../game/input'; import {Menu, MenuPage, ButtonMenuItem, LabelMenuItem} from './menu'; import {DummyInputTarget, ProxyInputTarget} from '../player'; import StageSelectMenuPage from './stage-selection'; import React from 'react'; import {BabylonJS} from '../react-babylonjs'; import BABYLON from 'ba...
(props) { super(props); this.state = { players: [], }; this.playerRefs = []; } playerAskedForBack() { // Only go back out of this menu if all players are inactive. console.log(this); if (this.playerRefs.find(p => p.active)) { return; } this.props.menu.popMenuPage();...
constructor
identifier_name
character-select.js
import {Buttons} from '../game/input'; import {Menu, MenuPage, ButtonMenuItem, LabelMenuItem} from './menu'; import {DummyInputTarget, ProxyInputTarget} from '../player'; import StageSelectMenuPage from './stage-selection'; import React from 'react'; import {BabylonJS} from '../react-babylonjs'; import BABYLON from 'ba...
return proxy; }); } render() { return <div className="menu-page" style={styles.viewBlock}> {this.state.players.filter(player => player)} </div>; } }
{ this.props.players.setInputTargetFinder((i, player) => { const proxy = new ProxyInputTarget(new DummyInputTarget()); // setState is not synchronous. To mutate an array in it multiple // times before it applies the state update to this.state, must // use the callback pattern: http://stackov...
identifier_body
printer.py
printer", methods=["GET"]) def printerState(): if not printer.isOperational(): return make_response("Printer is not operational", 409) # process excludes excludes = [] if "exclude" in request.values: excludeStr = request.values["exclude"] if len(excludeStr.strip()) > 0: excludes = filter(lambda x: x in ["...
return NO_CONTENT @api.route("/printer/bed", methods=["GET"]) def printerBedState(): def deleteTools(x): data = dict(x) for k in data.keys(): if k.startswith("tool"): del data[k] return data return jsonify(_getTemperatureData(deleteTools)) ##~~ Print head @api.route("/printer/printhead", methods...
fset = data["offset"] # make sure the offset is valid if not isinstance(offset, (int, long, float)): return make_response("Not a number: %r" % offset, 400) if not -50 <= offset <= 50: return make_response("Offset not in range [-50, 50]: %f" % offset, 400) # set the offsets printer.setTemperatureOffset...
conditional_block
printer.py
printer", methods=["GET"]) def printerState(): if not printer.isOperational(): return make_response("Printer is not operational", 409) # process excludes excludes = [] if "exclude" in request.values: excludeStr = request.values["exclude"] if len(excludeStr.strip()) > 0: excludes = filter(lambda x: x in ["...
): data = dict(x) for k in data.keys(): if k.startswith("tool"): del data[k] return data return jsonify(_getTemperatureData(deleteTools)) ##~~ Print head @api.route("/printer/printhead", methods=["POST"]) @restricted_access def printerPrintheadCommand(): if not printer.isOperational() or printer.is...
leteTools(x
identifier_name
printer.py
("/printer", methods=["GET"]) def printerState(): if not printer.isOperational(): return make_response("Printer is not operational", 409) # process excludes excludes = [] if "exclude" in request.values: excludeStr = request.values["exclude"] if len(excludeStr.strip()) > 0: excludes = filter(lambda x: x in...
elif command == "offset": offsets = data["offsets"] # make sure the targets are valid, the values are numbers and in the range [-50, 50] validated_values = {} for tool, value in offsets.iteritems(): if re.match(validation_regex, tool) is None: return make_response("Invalid target for setting temperatur...
# perform the actual temperature commands for tool in validated_values.keys(): printer.setTemperature(tool, validated_values[tool]) ##~~ temperature offset
random_line_split
printer.py
Printer is not operational", 409) valid_commands = { "select": ["tool"], "target": ["targets"], "offset": ["offsets"], "extrude": ["amount"] } command, data, response = util.getJsonCommandFromRequest(request, valid_commands) if response is not None: return response validation_regex = re.compile("tool\d...
not printer.isOperational(): return make_response("Printer is not operational", 409) tempData = printer.getCurrentTemperatures() result = { "temps": filter(tempData) } if "history" in request.values.keys() and request.values["history"] in valid_boolean_trues: tempHistory = printer.getTemperatureHistory() ...
identifier_body
bibauthorid_prob_matrix.py
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2011, 2012 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your opt...
(self, cluster_set, use_cache=False, save_cache=False): ''' Constructs probability matrix. If use_cache is true, it will try to load old computations from the database. If save cache is true it will save the current results into the database. @param cluster_set: A cluster set obj...
__init__
identifier_name
bibauthorid_prob_matrix.py
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2011, 2012 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your opt...
if use_cache and old_matrix.load(cluster_set.last_name): cached_bibs = set(filter_modified_record_ids( old_matrix.get_keys(), old_matrix.creation_time)) else: cached_bibs = set() if save_cache: ...
''' Constructs probability matrix. If use_cache is true, it will try to load old computations from the database. If save cache is true it will save the current results into the database. @param cluster_set: A cluster set object, used to initialize the matrix. ''' ...
identifier_body
bibauthorid_prob_matrix.py
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2011, 2012 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your opt...
for cl2 in cluster_set.clusters: if id(cl1) < id(cl2) and not cl1.hates(cl2): for bib1 in cl1.bibs: for bib2 in cl2.bibs: if bib1 in cached_bibs and bib2 in cached_bibs: val = old_matrix[b...
random_line_split
bibauthorid_prob_matrix.py
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2011, 2012 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your opt...
if save_cache: creation_time = get_sql_time() cur_calc, opti = 0, 0 for cl1 in cluster_set.clusters: update_status((float(opti) + cur_calc) / expected, "Prob matrix: calc %d, opti %d." % (cur_calc, opti)) for cl2 in cluster_set.clusters: if ...
cached_bibs = set()
conditional_block
window_event.rs
#![allow(missing_docs)] #[derive(Copy, Clone, PartialEq, PartialOrd, Debug, Serialize, Deserialize)] pub enum WindowEvent { Pos(i32, i32), Size(u32, u32), Close, Refresh, Focus(bool), Iconify(bool), FramebufferSize(u32, u32), MouseButton(MouseButton, Action, Modifiers), CursorPos(f6...
(&self) -> bool { matches!( self, MouseButton(..) | CursorPos(..) | CursorEnter(..) | Scroll(..) ) } /// Tests if this event is related to the touch. pub fn is_touch_event(&self) -> bool { matches!(self, Touch(..)) } } // NOTE: list of keys inspired from...
is_mouse_event
identifier_name
window_event.rs
#![allow(missing_docs)] #[derive(Copy, Clone, PartialEq, PartialOrd, Debug, Serialize, Deserialize)] pub enum WindowEvent { Pos(i32, i32), Size(u32, u32), Close, Refresh, Focus(bool), Iconify(bool), FramebufferSize(u32, u32), MouseButton(MouseButton, Action, Modifiers), CursorPos(f6...
} use WindowEvent::*; impl WindowEvent { /// Tests if this event is related to the keyboard. pub fn is_keyboard_event(&self) -> bool { matches!(self, Key(..) | Char(..) | CharModifiers(..)) } /// Tests if this event is related to the mouse. pub fn is_mouse_event(&self) -> bool { ma...
CharModifiers(char, Modifiers), Touch(u64, f64, f64, TouchAction, Modifiers),
random_line_split
test_hgnc_client.py
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str from indra.databases import hgnc_client from indra.util import unicode_strs from nose.plugins.attrib import attr def test_get_uniprot_id(): hgnc_id = '6840' uniprot_id = hgnc_client.get_uniprot_id(hgnc_id) ...
(): hgnc_id = '123456' hgnc_name = hgnc_client.get_hgnc_name(hgnc_id) assert hgnc_name is None assert unicode_strs(hgnc_name) def test_entrez_hgnc(): entrez_id = '653509' hgnc_id = hgnc_client.get_hgnc_from_entrez(entrez_id) assert hgnc_id == '10798' def test_entrez_hgnc_none(): entr...
test_get_hgnc_name_nonexistent
identifier_name
test_hgnc_client.py
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str from indra.databases import hgnc_client from indra.util import unicode_strs from nose.plugins.attrib import attr def test_get_uniprot_id(): hgnc_id = '6840' uniprot_id = hgnc_client.get_uniprot_id(hgnc_id) ...
assert hgnc_client.is_transcription_factor('FOXO3') assert not hgnc_client.is_transcription_factor('AKT1') def test_get_current_id(): # Current symbol assert hgnc_client.get_current_hgnc_id('BRAF') == '1097' # Outdated symbol, one ID assert hgnc_client.get_current_hgnc_id('SEPT7') == '1717' ...
def test_is_category(): assert hgnc_client.is_kinase('MAPK1') assert not hgnc_client.is_kinase('EGF') assert hgnc_client.is_phosphatase('PTEN') assert not hgnc_client.is_phosphatase('KRAS')
random_line_split
test_hgnc_client.py
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str from indra.databases import hgnc_client from indra.util import unicode_strs from nose.plugins.attrib import attr def test_get_uniprot_id(): hgnc_id = '6840' uniprot_id = hgnc_client.get_uniprot_id(hgnc_id) ...
def test_is_category(): assert hgnc_client.is_kinase('MAPK1') assert not hgnc_client.is_kinase('EGF') assert hgnc_client.is_phosphatase('PTEN') assert not hgnc_client.is_phosphatase('KRAS') assert hgnc_client.is_transcription_factor('FOXO3') assert not hgnc_client.is_transcription_factor('AKT...
hgnc_id1 = hgnc_client.get_hgnc_from_rat('6496784') hgnc_id2 = hgnc_client.get_hgnc_from_rat('RGD:6496784') assert hgnc_id1 == '44155' assert hgnc_id2 == '44155' hgnc_id = hgnc_client.get_hgnc_from_rat('xxx') assert hgnc_id is None
identifier_body
8646922c8a04_change_default_pool_slots_to_1.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
(): """Change default pool_slots to 1 and make pool_slots not nullable""" connection = op.get_bind() sessionmaker = sa.orm.sessionmaker() session = sessionmaker(bind=connection) session.query(TaskInstance).filter(TaskInstance.pool_slots.is_(None)).update( {TaskInstance.pool_slots: 1}, synch...
upgrade
identifier_name
8646922c8a04_change_default_pool_slots_to_1.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
def downgrade(): """Unapply Change default pool_slots to 1""" with op.batch_alter_table("task_instance", schema=None) as batch_op: batch_op.alter_column("pool_slots", existing_type=sa.Integer, nullable=True)
random_line_split
8646922c8a04_change_default_pool_slots_to_1.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
"""Unapply Change default pool_slots to 1""" with op.batch_alter_table("task_instance", schema=None) as batch_op: batch_op.alter_column("pool_slots", existing_type=sa.Integer, nullable=True)
identifier_body
AEtestNodeATemplate.py
""" To create an Attribute Editor template using python, do the following: 1. create a subclass of `uitypes.AETemplate` 2. set its ``_nodeType`` class attribute to the name of the desired node type, or name the class using the convention ``AE<nodeType>Template`` 3. import the module AETemplates which do not meet o...
(AETemplateBase.mmbTemplateBase): def buildBody(self, nodeName): log.debug("building AETemplate for node: %s", nodeName) self.AEswatchDisplay(nodeName) self.beginLayout("Common Material Attributes",collapse=0) self.addControl("attribute0") self.endLayout() self.beginLayout("Version",collapse=0) self.a...
AEtestNodeATemplate
identifier_name
AEtestNodeATemplate.py
""" To create an Attribute Editor template using python, do the following: 1. create a subclass of `uitypes.AETemplate` 2. set its ``_nodeType`` class attribute to the name of the desired node type, or name the class using the convention ``AE<nodeType>Template`` 3. import the module AETemplates which do not meet o...
class AEtestNodeATemplate(AETemplateBase.mmbTemplateBase): def buildBody(self, nodeName): log.debug("building AETemplate for node: %s", nodeName) self.AEswatchDisplay(nodeName) self.beginLayout("Common Material Attributes",collapse=0) self.addControl("attribute0") self.endLayout() self.beginLayout("Ver...
import mymagicbox.AETemplateBase as AETemplateBase import mymagicbox.log as log
random_line_split
AEtestNodeATemplate.py
""" To create an Attribute Editor template using python, do the following: 1. create a subclass of `uitypes.AETemplate` 2. set its ``_nodeType`` class attribute to the name of the desired node type, or name the class using the convention ``AE<nodeType>Template`` 3. import the module AETemplates which do not meet o...
log.debug("building AETemplate for node: %s", nodeName) self.AEswatchDisplay(nodeName) self.beginLayout("Common Material Attributes",collapse=0) self.addControl("attribute0") self.endLayout() self.beginLayout("Version",collapse=0) self.addControl("mmbversion") self.endLayout() pm.mel.AEdependNodeTem...
identifier_body
HeadsetMicTwoTone.js
import createSvgIcon from './utils/createSvgIcon'; import { jsx as _jsx } from "react/jsx-runtime"; export default createSvgIcon([/*#__PURE__*/_jsx("path", { d: "M5 17c0 .55.45 1 1 1h1v-4H5v3zm12-3h2v4h-2z", opacity: ".3" }, "0"), /*#__PURE__*/_jsx("path", { d: "M12 1c-4.97 0-9 4.03-9 9v7c0 1.66 1.34 3 3 3h3v-8H5...
}, "1")], 'HeadsetMicTwoTone');
random_line_split
mocks.ts
import { MenuItem } from './menu-item-model'; //importo la classe MenuItem così posso usarla qui dentro export const MENUITEMS: MenuItem[] = [ //esporto un oggetto costante di tipo MenuItem[] che si chiama MENUITEM che contiene { //tutte le proprietà degli item del menu di navigazione. name: "Home", ...
description: "This is where is represented the schema of the Water Treatement Plant; with heating, distributing, ecc.", path: "waterplant" }, { name: "Docs", description: "Home Docs Here!", path: "docs" } ]
}, { name: "Water Plant",
random_line_split
InputErrorSuffix.js
import React from 'react'; import PropTypes from 'prop-types'; import Tooltip from '../Tooltip'; import SvgExclamation from '../svg/Exclamation.js'; import styles from './Input.scss'; class InputErrorSuffix extends React.Component {
() { return ( <Tooltip dataHook="input-tooltip" disabled={this.props.errorMessage.length === 0} placement="top" alignment="center" textAlign="left" content={this.props.errorMessage} overlay="" theme="dark" maxWidth="230px" hideDel...
render
identifier_name
InputErrorSuffix.js
import React from 'react'; import PropTypes from 'prop-types'; import Tooltip from '../Tooltip'; import SvgExclamation from '../svg/Exclamation.js'; import styles from './Input.scss'; class InputErrorSuffix extends React.Component { render()
} InputErrorSuffix.propTypes = { theme: PropTypes.oneOf(['normal', 'paneltitle', 'material', 'amaterial']), errorMessage: PropTypes.string.isRequired, focused: PropTypes.bool }; export default InputErrorSuffix;
{ return ( <Tooltip dataHook="input-tooltip" disabled={this.props.errorMessage.length === 0} placement="top" alignment="center" textAlign="left" content={this.props.errorMessage} overlay="" theme="dark" maxWidth="230px" hideDelay=...
identifier_body
InputErrorSuffix.js
import React from 'react'; import PropTypes from 'prop-types'; import Tooltip from '../Tooltip'; import SvgExclamation from '../svg/Exclamation.js'; import styles from './Input.scss'; class InputErrorSuffix extends React.Component { render() {
placement="top" alignment="center" textAlign="left" content={this.props.errorMessage} overlay="" theme="dark" maxWidth="230px" hideDelay={150} > <div className={styles.exclamation}><SvgExclamation width={2} height={11}/></div> </Toolt...
return ( <Tooltip dataHook="input-tooltip" disabled={this.props.errorMessage.length === 0}
random_line_split
matplotFF.py
5 # stages don't always move to the same # place, so numerical positions might differ slightly if xLen == 0 and zLen == 0: z_unique_vals = [self.zRaw[0]] x_unique_vals = [self.xRaw[0]] # count unique values of Z/X values in the data file ...
(sel
identifier_name
matplotFF.py
if output_filename is None: self.output_filename = BaseFilename else: self.output_filename = output_filename self.title = title self.fig = fig self.rawData = np.loadtxt(self.BaseFilename) self.zRaw = self.rawData[:,0] self.xRaw = self.raw...
# figure out the number of steps for Z and X stage_tolerance = 0.05 # stages don't always move to the same # place, so numerical positions might differ slightly if xLen == 0 and zLen == 0: z_unique_vals = [self.zRaw[0]] x_unique_vals = [se...
lf.zRaw = 180/(2*np.pi)*np.arctan(self.zRaw/distance)
conditional_block
matplotFF.py
else: self.output_filename = output_filename self.title = title self.fig = fig self.rawData = np.loadtxt(self.BaseFilename) self.zRaw = self.rawData[:,0] self.xRaw = self.rawData[:,1] self.sigRaw = self.rawData[:,2] self.xlim = (None,...
def __init__(self, fig, BaseFilename, title='', xLen=0, zLen=0, stitch=True, distance=None, angular_direction=None, output_filename=None): self.BaseFilename = BaseFilename if output_filename is None: self.output_filename = BaseFilename
random_line_split
matplotFF.py
0.05 # stages don't always move to the same # place, so numerical positions might differ slightly if xLen == 0 and zLen == 0: z_unique_vals = [self.zRaw[0]] x_unique_vals = [self.xRaw[0]] # count unique values of Z/X values in the data file ...
Image.open(orientation_image_path) height = im.size[1] im = np.array(im).astype(np.float) / 255 self.fig.figimage(im, x, self.fig.bbox.ymax - height - y)
identifier_body
page.py
"""Very dumb 'pager' in Python, for when nothing else works. Only moves forward, same interface as page(), except for pager_cmd and mode.""" out_ln = strng.splitlines()[start:] screens = chop(out_ln, screen_lines - 1) if len(screens) == 1: print(os.linesep.join(screens[0]), file=io.std...
(fname, start=0, pager_cmd=None): """Page a file, using an optional pager command and starting line. """ pager_cmd = get_pager_cmd(pager_cmd) pager_cmd += ' ' + get_pager_start(pager_cmd, start) try: if os.environ['TERM'] in ['emacs', 'dumb']: raise EnvironmentError sys...
page_file
identifier_name
page.py
"""Very dumb 'pager' in Python, for when nothing else works. Only moves forward, same interface as page(), except for pager_cmd and mode.""" out_ln = strng.splitlines()[start:] screens = chop(out_ln, screen_lines - 1) if len(screens) == 1: print(os.linesep.join(screens[0]), file=io.std...
# print 'numlines',numlines,'screenlines',screen_lines # dbg if numlines <= screen_lines: # print '*** normal print' # dbg print(str_toprint, file=io.stdout) else: # Try to open pager and default to internal one if that fails. # All failure modes are tagged as 'retval=1',...
try: screen_lines += _detect_screen_size(screen_lines_def) except (TypeError, UnsupportedOperation): print(str_toprint, file=io.stdout) return
conditional_block
page.py
, and # some termios calls lock up on Sun OS5. return screen_lines_def try: import termios import curses except ImportError: return screen_lines_def # There is a bug in curses, where *sometimes* it fails to properly # initialize, and then after the endwin() call...
ans = msvcrt.getwch() if ans in ("q", "Q"): result = False else:
random_line_split
page.py
"""Very dumb 'pager' in Python, for when nothing else works. Only moves forward, same interface as page(), except for pager_cmd and mode.""" out_ln = strng.splitlines()[start:] screens = chop(out_ln, screen_lines - 1) if len(screens) == 1: print(os.linesep.join(screens[0]), file=io.std...
written in python, very simplistic. """ # for compatibility with mime-bundle form: if isinstance(strng, dict): strng = strng['text/plain'] # Some routines may auto-compute start offsets incorrectly and pass a # negative value. Offset to 0 for robustness. start = max(0, start) ...
"""Display a string, piping through a pager after a certain length. strng can be a mime-bundle dict, supplying multiple representations, keyed by mime-type. The screen_lines parameter specifies the number of *usable* lines of your terminal screen (total lines minus lines you need to reserve to show ot...
identifier_body
domparser.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::document_loader::DocumentLoader; use crate::dom::bindings::codegen::Bindings::DOMParserBinding; use cra...
, } } }
{ let document = Document::new( &self.window, HasBrowsingContext::No, Some(url.clone()), doc.origin().clone(), IsHTMLDocument::NonHTMLDocument, Some(content_type), ...
conditional_block
domparser.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::document_loader::DocumentLoader; use crate::dom::bindings::codegen::Bindings::DOMParserBinding; use cra...
&self.window, HasBrowsingContext::No, Some(url.clone()), doc.origin().clone(), IsHTMLDocument::NonHTMLDocument, Some(content_type), None, DocumentActivity::Inac...
Text_xml | Application_xml | Application_xhtml_xml => { let document = Document::new(
random_line_split
domparser.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::document_loader::DocumentLoader; use crate::dom::bindings::codegen::Bindings::DOMParserBinding; use cra...
} impl DOMParserMethods for DOMParser { // https://w3c.github.io/DOM-Parsing/#the-domparser-interface fn ParseFromString( &self, s: DOMString, ty: DOMParserBinding::SupportedType, ) -> Fallible<DomRoot<Document>> { let url = self.window.get_url(); let content_type =...
{ Ok(DOMParser::new(window)) }
identifier_body
domparser.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::document_loader::DocumentLoader; use crate::dom::bindings::codegen::Bindings::DOMParserBinding; use cra...
(window: &Window) -> Fallible<DomRoot<DOMParser>> { Ok(DOMParser::new(window)) } } impl DOMParserMethods for DOMParser { // https://w3c.github.io/DOM-Parsing/#the-domparser-interface fn ParseFromString( &self, s: DOMString, ty: DOMParserBinding::SupportedType, ) -> Falli...
Constructor
identifier_name
graphicalgauge.py
import kivy kivy.require('1.9.1') from utils import kvFind from kivy.core.window import Window from kivy.properties import NumericProperty from autosportlabs.racecapture.views.dashboard.widgets.gauge import CustomizableGauge class GraphicalGauge(CustomizableGauge): _gaugeView = None gauge_size = NumericPropert...
def __init__(self, **kwargs): super(GraphicalGauge, self).__init__(**kwargs) def on_size(self, instance, value): width = value[0] height = value[1] size = width if width < height else height self._update_gauge_size(size) @property def graph...
self.gauge_size = size
identifier_body
graphicalgauge.py
import kivy kivy.require('1.9.1') from utils import kvFind from kivy.core.window import Window from kivy.properties import NumericProperty from autosportlabs.racecapture.views.dashboard.widgets.gauge import CustomizableGauge class GraphicalGauge(CustomizableGauge): _gaugeView = None gauge_size = NumericPropert...
size = width if width < height else height self._update_gauge_size(size) @property def graphView(self): if not self._gaugeView: self._gaugeView = kvFind(self, 'rcid', 'gauge') return self._gaugeView
def on_size(self, instance, value): width = value[0] height = value[1]
random_line_split
graphicalgauge.py
import kivy kivy.require('1.9.1') from utils import kvFind from kivy.core.window import Window from kivy.properties import NumericProperty from autosportlabs.racecapture.views.dashboard.widgets.gauge import CustomizableGauge class GraphicalGauge(CustomizableGauge): _gaugeView = None gauge_size = NumericPropert...
return self._gaugeView
self._gaugeView = kvFind(self, 'rcid', 'gauge')
conditional_block
graphicalgauge.py
import kivy kivy.require('1.9.1') from utils import kvFind from kivy.core.window import Window from kivy.properties import NumericProperty from autosportlabs.racecapture.views.dashboard.widgets.gauge import CustomizableGauge class GraphicalGauge(CustomizableGauge): _gaugeView = None gauge_size = NumericPropert...
(self, size): self.gauge_size = size def __init__(self, **kwargs): super(GraphicalGauge, self).__init__(**kwargs) def on_size(self, instance, value): width = value[0] height = value[1] size = width if width < height else height self._update_gauge_siz...
_update_gauge_size
identifier_name
complete_starter_form.js
var instanceURL = gs.getProperty("glide.servlet.uri"); var overrideURL = gs.getProperty("glide.email.override.url"); if (overrideURL)
else{ instanceURL = instanceURL; } var url = instanceURL + 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=299dbe0b0a0a3c4501c8951df102a2ae&manager_request=' + current.sys_id + '&first_name=' + current.u_first_name + '&last_name=' + current.u_last_name + '&known_as=' + current.u_known_as + '&job_title=' + cu...
{ instanceURL = overrideURL; }
conditional_block
complete_starter_form.js
var instanceURL = gs.getProperty("glide.servlet.uri"); var overrideURL = gs.getProperty("glide.email.override.url"); if (overrideURL){ instanceURL = overrideURL; } else{ instanceURL = instanceURL; } var url = instanceURL + 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=299dbe0b0a0a3c4501c8951df102a2ae&manage...
//condition current.u_request_id == '' && current.u_request_type == 'Starter' && current.u_assigned_to == gs.userID() || current.u_request_id == '' && current.u_request_type == 'Starter' && current.u_manager_name == gs.userID()
random_line_split
builtins.rs
use crate::state::InterpState; use enum_iterator::IntoEnumIterator; /// Represents a builtin function #[derive(Debug, Clone, PartialEq, IntoEnumIterator)] pub enum Builtin { Dot, Plus, Minus, Star, Slash, Abs, And, Or, Xor, LShift, RShift, Equals, NotEquals, Less...
(&self) -> &'static str { match *self { Builtin::Dot => ".", Builtin::Plus => "+", Builtin::Minus => "-", Builtin::Star => "*", Builtin::Slash => "/", Builtin::Abs => "abs", Builtin::And => "and", Builtin::Or => "or"...
word
identifier_name
builtins.rs
use crate::state::InterpState; use enum_iterator::IntoEnumIterator; /// Represents a builtin function #[derive(Debug, Clone, PartialEq, IntoEnumIterator)] pub enum Builtin { Dot, Plus, Minus, Star, Slash, Abs, And, Or, Xor, LShift, RShift, Equals, NotEquals, Less...
LessEqual => stackexpr!(|n2: i32, n1: i32| n1 <= n2), GreaterEqual => stackexpr!(|n2: i32, n1: i32| n1 >= n2), Emit => print!("{}", stack.pop::<char>()), Dup => { let n: i32 = stack.peak(); stack.push(n); } Swap => s...
RShift => stackexpr!(|u: i32, n: i32| n >> u), Equals => stackexpr!(|n2: i32, n1: i32| n1 == n2), NotEquals => stackexpr!(|n2: i32, n1: i32| n1 != n2), LessThan => stackexpr!(|n2: i32, n1: i32| n1 < n2), GreaterThan => stackexpr!(|n2: i32, n1: i32| n1 > n2),
random_line_split
builtins.rs
use crate::state::InterpState; use enum_iterator::IntoEnumIterator; /// Represents a builtin function #[derive(Debug, Clone, PartialEq, IntoEnumIterator)] pub enum Builtin { Dot, Plus, Minus, Star, Slash, Abs, And, Or, Xor, LShift, RShift, Equals, NotEquals, Less...
Dot => print!("{}", stack.pop::<i32>()), Plus => stackexpr!(|n2: i32, n1: i32| n1 + n2), Minus => stackexpr!(|n2: i32, n1: i32| n1 - n2), Star => stackexpr!(|n2: i32, n1: i32| n1 * n2), Slash => stackexpr!(|n2: i32, n1: i32| n1 / n2), Abs => stacke...
{ let stack = &mut state.stack; /// Allows defining a builtin using closure-like syntax. Note that the /// arguments are in reverse order, as that is how the stack is laid out. macro_rules! stackexpr { ( | $($aname:ident : $atype:ty),+ | $($value:expr),+ ) => { ...
identifier_body
index.js
describe('Loading Nuora', function () { //using nuora as a module var colors = require('colors'), Nuora = require('../'), nuora, zuora, tests; it('has opts property', function () { expect(Nuora).to.have.property('opts'); }); Nuora.opts.option('--reporter [valu...
done(); tests(); }); }); }); });
it('connected to the server', function (done) { zuora.on('loggedin', function () {
random_line_split
write.ts
"use strict"; import {WriteCommand, IWriteCommandArguments} from '../commands/write'; import {Scanner} from '../scanner'; export function parseWriteCommandArgs(args : string) : WriteCommand { if (!args) { return new WriteCommand({}); } var scannedArgs : IWriteCommandArguments = {}; var scanner = new Scann...
let c = scanner.next(); switch (c) { case '!': if (scanner.start > 0) { // :write !cmd scanner.ignore(); while (!scanner.isAtEof) { scanner.next(); } // vim ignores silently if no command after :w ! scannedArgs.cmd = scanner....
{ break; }
conditional_block
write.ts
"use strict"; import {WriteCommand, IWriteCommandArguments} from '../commands/write'; import {Scanner} from '../scanner'; export function parseWriteCommandArgs(args : string) : WriteCommand { if (!args) { return new WriteCommand({});
if (scanner.isAtEof) { break; } let c = scanner.next(); switch (c) { case '!': if (scanner.start > 0) { // :write !cmd scanner.ignore(); while (!scanner.isAtEof) { scanner.next(); } // vim ignores silently if no command af...
} var scannedArgs : IWriteCommandArguments = {}; var scanner = new Scanner(args); while (true) { scanner.skipWhiteSpace();
random_line_split
write.ts
"use strict"; import {WriteCommand, IWriteCommandArguments} from '../commands/write'; import {Scanner} from '../scanner'; export function
(args : string) : WriteCommand { if (!args) { return new WriteCommand({}); } var scannedArgs : IWriteCommandArguments = {}; var scanner = new Scanner(args); while (true) { scanner.skipWhiteSpace(); if (scanner.isAtEof) { break; } let c = scanner.next(); switch (c) { case '!...
parseWriteCommandArgs
identifier_name
write.ts
"use strict"; import {WriteCommand, IWriteCommandArguments} from '../commands/write'; import {Scanner} from '../scanner'; export function parseWriteCommandArgs(args : string) : WriteCommand
// vim ignores silently if no command after :w ! scannedArgs.cmd = scanner.emit().trim() || undefined; continue; } // :write! scannedArgs.bang = true; scanner.ignore(); continue; case '+': // :write ++opt=value scanner.expect('+...
{ if (!args) { return new WriteCommand({}); } var scannedArgs : IWriteCommandArguments = {}; var scanner = new Scanner(args); while (true) { scanner.skipWhiteSpace(); if (scanner.isAtEof) { break; } let c = scanner.next(); switch (c) { case '!': if (scanner.start > ...
identifier_body
index-plain.js
var plain = require('./workers/plain.js'); var NodeMover = require('./modules/NodeMover').NodeMover; var PixiGraphics = require('./modules/PixiGraphics').PixiGraphics; module.exports.main = function () {
var _layoutIterations = 1000; var _layoutStepsPerMessage = 25; //--simple frame-rate display for renders vs layouts var _counts = {renders: 0, layouts: 0, renderRate: 0, layoutRate: 0}; var $info = $('<div>').appendTo('body'); var startTime = new Date(); var _updateInfo = function () { ...
random_line_split
index-plain.js
var plain = require('./workers/plain.js'); var NodeMover = require('./modules/NodeMover').NodeMover; var PixiGraphics = require('./modules/PixiGraphics').PixiGraphics; module.exports.main = function () { var _layoutIterations = 1000; var _layoutStepsPerMessage = 25; //--simple frame-rate display for rende...
}); return _nodeMovers; }); function renderFrame() { plain.step(updatePos); graphics.renderFrame(); _counts.renders++; _updateInfo(); requestAnimFrame(renderFrame); } // begin animation loop: r...
{ nodeMover.position(_layoutPositions.nodePositions[id]); nodeMover.animate(); }
conditional_block
index-plain.js
var plain = require('./workers/plain.js'); var NodeMover = require('./modules/NodeMover').NodeMover; var PixiGraphics = require('./modules/PixiGraphics').PixiGraphics; module.exports.main = function () { var _layoutIterations = 1000; var _layoutStepsPerMessage = 25; //--simple frame-rate display for rende...
(ev) { _layoutPositions = ev.data; _counts.layouts = _layoutPositions.i; }; plain(jsonData); var graphics = new PixiGraphics(0.75, jsonData, function () { $.each(_nodeMovers, function (id, nodeMover) { if (_layoutPositions.nodePositions) { ...
updatePos
identifier_name
index-plain.js
var plain = require('./workers/plain.js'); var NodeMover = require('./modules/NodeMover').NodeMover; var PixiGraphics = require('./modules/PixiGraphics').PixiGraphics; module.exports.main = function () { var _layoutIterations = 1000; var _layoutStepsPerMessage = 25; //--simple frame-rate display for rende...
; plain(jsonData); var graphics = new PixiGraphics(0.75, jsonData, function () { $.each(_nodeMovers, function (id, nodeMover) { if (_layoutPositions.nodePositions) { nodeMover.position(_layoutPositions.nodePositions[id]); nodeMover.ani...
{ _layoutPositions = ev.data; _counts.layouts = _layoutPositions.i; }
identifier_body
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #![crate_name = "js"] #![crate_type = "rlib"] #![feature(core_intrinsics)] #![feature(link_args)] #![feature(str_...
pub mod jsapi; pub mod linkhack; pub mod rust; pub mod glue; pub mod jsval; use jsapi::{JSContext, JSProtoKey, Heap}; use jsval::JSVal; use rust::GCMethods; use libc::c_uint; use heapsize::HeapSizeOf; pub const default_heapsize: u32 = 32_u32 * 1024_u32 * 1024_u32; pub const default_stacksize: usize = 8192; pub co...
#[macro_use] extern crate heapsize; extern crate rustc_serialize as serialize;
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #![crate_name = "js"] #![crate_type = "rlib"] #![feature(core_intrinsics)] #![feature(link_args)] #![feature(str_...
// This is measured properly by the heap measurement implemented in SpiderMonkey. impl<T: Copy + GCMethods<T>> HeapSizeOf for Heap<T> { fn heap_size_of_children(&self) -> usize { 0 } } known_heap_size!(0, JSVal);
{ *vp }
identifier_body
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #![crate_name = "js"] #![crate_type = "rlib"] #![feature(core_intrinsics)] #![feature(link_args)] #![feature(str_...
(&self) -> usize { 0 } } known_heap_size!(0, JSVal);
heap_size_of_children
identifier_name
test.js
var config = require('./lib/config'); var FaceRec = require('./lib/facerec').FaceRec; var hfr = new FaceRec(config); // constant var threshold = 20; var prevX; var prevY; setInterval(function() { var result = hfr.detect(); console.log('result:' + JSON.stringify(result)); if (result && result.pos_x &...
console.log('updating x and y'); prevX = newX; prevY = newY; } }, 5000);
{ var direction = deltaY > 0 ? "down" : "up"; console.log("moving head to " + direction + " , distance" + Math.abs(deltaY)); }
conditional_block
test.js
var config = require('./lib/config'); var FaceRec = require('./lib/facerec').FaceRec; var hfr = new FaceRec(config); // constant var threshold = 20; var prevX; var prevY;
setInterval(function() { var result = hfr.detect(); console.log('result:' + JSON.stringify(result)); if (result && result.pos_x && result.pos_y) { var newX = result.pos_x; var newY = result.pos_y; var deltaX = newX - prevX; var deltaY = newY - prevY; if (Math.ab...
random_line_split
wicked.py
disabling # or working around the copy protections, unless the change has been explicitly permitted # by the original authors. Also decompiling and modification of the closed source # parts is NOT permitted. # # Advertising with this plugin is NOT allowed. # For other uses, permission from the authors is necessar...
def SuchenCallback(self, callback = None, entry = None): if callback is not None and len(callback): self.suchString = callback Name = "--- Search ---" Link = self.suchString.replace(' ', '-') self.session.open(wickedFilmScreen, Link, Name) class wickedGirlsScreen(MPScreen, ThumbsHelper): def __init__(...
not config.mediaportal.premiumize_use.value: message = self.session.open(MessageBoxExt, _("%s only works with enabled MP premiumize.me option (MP Setup)!" % BASE_NAME), MessageBoxExt.TYPE_INFO, timeout=10) return Name = self['liste'].getCurrent()[0][0] Link = self['liste'].getCurrent()[0][1] if Name == "--...
identifier_body
wicked.py
10) return Name = self['liste'].getCurrent()[0][0] Link = self['liste'].getCurrent()[0][1] if Name == "--- Search ---": self.suchen() elif re.match(".*?Girls", Name): self.session.open(wickedGirlsScreen, Link, Name) else: self.session.open(wickedFilmScreen, Link, Name) def SuchenCallback(self, c...
get_stream_link(self.session).check_link(Link, self.play) def play(self, url): title = self['liste'].getCurrent()[0][0] self.session.open(SimplePlayer, [(title, url.replace('%2F','%252F').replace('%3D','%253D').replace('%2B','%252B'))], showPlaylist=False, ltype='wicked')
random_line_split
wicked.py
self.keyDown, "right" : self.keyRight, "left" : self.keyLeft, "cancel" : self.keyCancel }, -1) self['title'] = Label(BASE_NAME) self['ContentTitle'] = Label("Genre:") self.genreliste = [] self.suchString = '' self.ml = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent) sel...
lf.getLastPage(data, 'class="paginationui-container(.*?)</ul>', '.*(?:\/|>)(\d+)')
conditional_block
wicked.py
# or working around the copy protections, unless the change has been explicitly permitted # by the original authors. Also decompiling and modification of the closed source # parts is NOT permitted. # # Advertising with this plugin is NOT allowed. # For other uses, permission from the authors is necessary. # #####...
elf, data): self.getLastPage(data, 'class="paginationui-container(.*?)</ul>', '.*(?:\/|>)(\d+)') parse = re.search('class="showcase-models(.*?)</section>', data, re.S) Movies = re.findall('<a\shref="(.*?)"\sclass="showcase-models.*?img\ssrc="(.*?)"\stitle="(.*?)".*?scenes">(\d+)\sScenes', parse.group(1), re.S) ...
adData(s
identifier_name
config.py
# Copyright 2017 Mycroft AI 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
def merge(self, conf): merge_dict(self, conf) class RemoteConf(LocalConf): """ Config dict fetched from mycroft.ai """ def __init__(self, cache=None): super(RemoteConf, self).__init__(None) cache = cache or WEB_CONFIG_CACHE from mycroft.api import is_paired ...
""" Cache the received settings locally. The cache will be used if the remote is unreachable to load settings that are as close to the user's as possible """ path = path or self.path with open(path, 'w') as f: json.dump(self, f, indent=2)
identifier_body
config.py
# Copyright 2017 Mycroft AI 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
__patch = {} # Patch config that skills can update to override config @staticmethod def get(configs=None, cache=True): """ Get configuration, returns cached instance if available otherwise builds a new configuration dict. Args: configs (list): L...
random_line_split
config.py
# Copyright 2017 Mycroft AI 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
if location: setting["location"] = location # Remove server specific entries config = {} translate_remote(config, setting) for key in config: self.__setitem__(key, config[key]) self.store(cache) except Req...
location = load_commented_json(cache).get('location')
conditional_block
config.py
# Copyright 2017 Mycroft AI 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
(configs=None, cache=False): """ load a stack of config dicts into a single dict Args: configs (list): list of dicts to load cache (boolean): True if result should be cached Returns: merged dict of all configuration files """ ...
load_config_stack
identifier_name