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
M668.py
""" GCode M668 Adjust backlash compensation for each named axis M668 Xn Yn Zn En Hn An Bn Cn Author: Anthony Clay License: CC BY-SA: http://creativecommons.org/licenses/by-sa/2.0/ """ from GCodeCommand import GCodeCommand import logging class M668(GCodeCommand): def execute(self, g): for index, axis ...
def get_description(self): return "Adjust backlash compensation for each named axis"
if g.has_letter(axis): self.printer.backlash_compensation[index] = float(g.get_value_by_letter(axis))/1000.0 # Convert to meters. logging.info("Backlash compensation for axis " + str(axis) + " changed to " + str(self.printer.backlash_compensation[index])) self.printer.pat...
conditional_block
M668.py
""" GCode M668 Adjust backlash compensation for each named axis M668 Xn Yn Zn En Hn An Bn Cn Author: Anthony Clay License: CC BY-SA: http://creativecommons.org/licenses/by-sa/2.0/ """ from GCodeCommand import GCodeCommand import logging class M668(GCodeCommand): def
(self, g): for index, axis in enumerate(["X", "Y", "Z", "E", "H", "A", "B", "C"]): if g.has_letter(axis): self.printer.backlash_compensation[index] = float(g.get_value_by_letter(axis))/1000.0 # Convert to meters. logging.info("Backlash compensation for axis " + str(ax...
execute
identifier_name
SourcesTree.js
, { Component } from "react"; import classnames from "classnames"; import { connect } from "react-redux"; // Selectors import { getShownSource, getSelectedSource, getDebuggeeUrl, getExpandedState, getProjectDirectoryRoot, getRelativeSources, getSourceCount } from "../../selectors"; import { getSourceByU...
depth={depth} focused={focused} expanded={expanded} focusItem={this.focusItem} selectItem={this.selectItem} source={this.getSource(item)} debuggeeUrl={debuggeeUrl} projectRoot={projectRoot} setExpanded={setExpanded} /> ); }; renderTr...
<SourcesTreeItem item={item}
random_line_split
SourcesTree.js
, { Component } from "react"; import classnames from "classnames"; import { connect } from "react-redux"; // Selectors import { getShownSource, getSelectedSource, getDebuggeeUrl, getExpandedState, getProjectDirectoryRoot, getRelativeSources, getSourceCount } from "../../selectors"; import { getSourceByU...
componentWillReceiveProps(nextProps: Props) { const { projectRoot, debuggeeUrl, sources, shownSource, selectedSource } = this.props; const { uncollapsedTree, sourceTree } = this.state; if ( projectRoot != nextProps.projectRoot || debuggeeUrl != nextProps.de...
{ const { selectedSource } = this.props; if (selectedSource) { this.setHighlightFocusItems(selectedSource); } }
identifier_body
SourcesTree.js
, { Component } from "react"; import classnames from "classnames"; import { connect } from "react-redux"; // Selectors import { getShownSource, getSelectedSource, getDebuggeeUrl, getExpandedState, getProjectDirectoryRoot, getRelativeSources, getSourceCount } from "../../selectors"; import { getSourceByU...
} setHighlightFocusItems(source: ?Source) { const { sourceTree, parentMap } = this.state; if (source) { const items = getDirectories(source, parentMap, sourceTree); return this.setState({ listItems: items, highlightItems: items }); } } focusItem = (item: TreeNode) => { this.setSta...
{ this.setState( updateTree({ newSources: nextProps.sources, prevSources: sources, debuggeeUrl, projectRoot, uncollapsedTree, sourceTree }) ); }
conditional_block
SourcesTree.js
, { Component } from "react"; import classnames from "classnames"; import { connect } from "react-redux"; // Selectors import { getShownSource, getSelectedSource, getDebuggeeUrl, getExpandedState, getProjectDirectoryRoot, getRelativeSources, getSourceCount } from "../../selectors"; import { getSourceByU...
() { const { selectedSource } = this.props; if (selectedSource) { this.setHighlightFocusItems(selectedSource); } } componentWillReceiveProps(nextProps: Props) { const { projectRoot, debuggeeUrl, sources, shownSource, selectedSource } = this.props; const {...
componentDidMount
identifier_name
http-client.js
import {HttpClientConfiguration} from './http-client-configuration'; import {RequestInit, Interceptor} from './interfaces'; import 'core-js'; /** * An HTTP client based on the Fetch API. * * @constructor */ export class HttpClient { activeRequestCount: number = 0; isRequesting: boolean = false; interceptors: I...
let normalizedConfig; if (typeof config === 'string') { normalizedConfig = { baseUrl: config }; } else if (typeof config === 'object') { normalizedConfig = { defaults: config }; } else if (typeof config === 'function') { normalizedConfig = new HttpClientConfiguration(); config(n...
* or a config object, or a string to use as the client's baseUrl. * @chainable */ configure(config: string|RequestInit|(config: HttpClientConfiguration) => void): HttpClient {
random_line_split
http-client.js
import {HttpClientConfiguration} from './http-client-configuration'; import {RequestInit, Interceptor} from './interfaces'; import 'core-js'; /** * An HTTP client based on the Fetch API. * * @constructor */ export class HttpClient { activeRequestCount: number = 0; isRequesting: boolean = false; interceptors: I...
else if (result instanceof Request) { response = fetch(result); } else { throw new Error(`An invalid result was returned by the interceptor chain. Expected a Request or Response instance, but got [${result}]`); } return processResponse(response, this.interceptors); })...
{ response = result; }
conditional_block
http-client.js
import {HttpClientConfiguration} from './http-client-configuration'; import {RequestInit, Interceptor} from './interfaces'; import 'core-js'; /** * An HTTP client based on the Fetch API. * * @constructor */ export class HttpClient { activeRequestCount: number = 0; isRequesting: boolean = false; interceptors: I...
normalizedConfig; if (typeof config === 'string') { normalizedConfig = { baseUrl: config }; } else if (typeof config === 'object') { normalizedConfig = { defaults: config }; } else if (typeof config === 'function') { normalizedConfig = new HttpClientConfiguration(); config(normaliz...
let
identifier_name
authentication.ts
'use strict'; import * as Joi from 'joi'; import { ValidationError } from './errors'; import { MiddlewareConfig, middlewareConfigValidatorSchema } from './middleware'; /** * Configure Authentication for APIs. */ export interface AuthenticationConfig { /** * The strategy used for authentication */ ...
export function validateJwtAuthConfig(config: JWTAuthentication) { const result = Joi.validate(config, jwtAuthenticationSchema); if (result.error) { throw new ValidationError(result.error); } else { return result.value; } }
{ const result = Joi.validate(config, basicAuthenticationSchema); if (result.error) { throw new ValidationError(result.error); } else { return result.value; } }
identifier_body
authentication.ts
'use strict'; import * as Joi from 'joi'; import { ValidationError } from './errors'; import { MiddlewareConfig, middlewareConfigValidatorSchema } from './middleware'; /** * Configure Authentication for APIs. */ export interface AuthenticationConfig { /** * The strategy used for authentication */ ...
}
{ return result.value; }
conditional_block
authentication.ts
'use strict'; import * as Joi from 'joi'; import { ValidationError } from './errors'; import { MiddlewareConfig, middlewareConfigValidatorSchema } from './middleware'; /** * Configure Authentication for APIs. */ export interface AuthenticationConfig { /** * The strategy used for authentication */ ...
const localAuthenticationSchema = Joi.object().keys({ passwordField: Joi.string(), usernameField: Joi.string(), verify: middlewareConfigValidatorSchema.required() }); export let authenticationValidatorSchema = Joi.object().keys({ strategy: middlewareConfigValidatorSchema.required() }); export let api...
});
random_line_split
authentication.ts
'use strict'; import * as Joi from 'joi'; import { ValidationError } from './errors'; import { MiddlewareConfig, middlewareConfigValidatorSchema } from './middleware'; /** * Configure Authentication for APIs. */ export interface AuthenticationConfig { /** * The strategy used for authentication */ ...
(config: JWTAuthentication) { const result = Joi.validate(config, jwtAuthenticationSchema); if (result.error) { throw new ValidationError(result.error); } else { return result.value; } }
validateJwtAuthConfig
identifier_name
app.js
var React = require('react'); var Router = require('react-router'); var whenKeys = require('when/keys'); var EventEmitter = require('events').EventEmitter; var { Route, DefaultRoute, RouteHandler, Link } = Router; var API = 'http://addressbook-api.herokuapp.com'; var loadingEvents = new EventEmitter(); function
(url) { if (getJSON._cache[url]) return Promise.resolve(getJSON._cache[url]); return new Promise((resolve, reject) => { var req = new XMLHttpRequest(); req.onload = function () { if (req.status === 404) { reject(new Error('not found')); } else { // fake a slow response every...
getJSON
identifier_name
app.js
var React = require('react'); var Router = require('react-router'); var whenKeys = require('when/keys'); var EventEmitter = require('events').EventEmitter; var { Route, DefaultRoute, RouteHandler, Link } = Router; var API = 'http://addressbook-api.herokuapp.com'; var loadingEvents = new EventEmitter(); function getJS...
return { loading: false }; }, componentDidMount () { var timer; loadingEvents.on('loadStart', () => { clearTimeout(timer); // for slow responses, indicate the app is thinking // otherwise its fast enough to just wait for the // data to load timer = setTimeout(() => { ...
return getJSON(`${API}/contacts`).then((res) => res.contacts); } }, getInitialState () {
random_line_split
app.js
var React = require('react'); var Router = require('react-router'); var whenKeys = require('when/keys'); var EventEmitter = require('events').EventEmitter; var { Route, DefaultRoute, RouteHandler, Link } = Router; var API = 'http://addressbook-api.herokuapp.com'; var loadingEvents = new EventEmitter(); function getJS...
}, getInitialState () { return { loading: false }; }, componentDidMount () { var timer; loadingEvents.on('loadStart', () => { clearTimeout(timer); // for slow responses, indicate the app is thinking // otherwise its fast enough to just wait for the // data to load ti...
{ return getJSON(`${API}/contacts`).then((res) => res.contacts); }
identifier_body
KStream.ts
*/ constructor(topicName, storage = null, kafka = null, isClone = false) { super(topicName, storage, kafka, isClone); this.started = false; //readability if (isClone) { this.started = true; } } /** * start kafka consumption * prepare production of messages if necessary ...
(stream) { if (!(stream instanceof StreamDSL)) { throw new Error("stream has to be an instance of KStream or KTable."); } // multicast prevents replays // create a new internal stream that merges both KStream.stream$s const newStream$ = this.stream$.multicast().merge(stream.stream$.multicast...
merge
identifier_name
KStream.ts
*/ constructor(topicName, storage = null, kafka = null, isClone = false) { super(topicName, storage, kafka, isClone); this.started = false; //readability if (isClone) { this.started = true; } } /** * start kafka consumption * prepare production of messages if necessary ...
this.produceVersion, kafkaErrorCallback ); }); } } /** * Emits an output when both input sources have records with the same key. * s1$:{object} + s2$:{object} -> j$:{left: s1$object, right: s2$object} * @param {StreamDSL} stream * @param {string} key ...
this.produceType, this.produceCompressionType,
random_line_split
KStream.ts
*/ constructor(topicName, storage = null, kafka = null, isClone = false) { super(topicName, storage, kafka, isClone); this.started = false; //readability if (isClone) { this.started = true; } } /** * start kafka consumption * prepare production of messages if necessary ...
/** * creates a new KStream instance from a given most.js * stream; the consume topic will be empty and therefore * no consumer will be build * @param {Object} most.js stream * @returns {KStream} */ fromMost(stream$) { return this._cloneWith(stream$); } /** * as only jo...
{ const kafkaStreams = this._kafkaStreams; if (!kafkaStreams) { throw new Error("merging requires a kafka streams reference on the left-hand merger."); } const newStorage = kafkaStreams.getStorage(); const newKafkaClient = kafkaStreams.getKafkaClient(); const newInstance = new KStream(n...
identifier_body
KStream.ts
{function|Object} kafkaReadyCallback - can also be an object (config) * @param {function} kafkaErrorCallback * @param {boolean} withBackPressure * @param {Object} outputKafkaConfig */ start(kafkaReadyCallback = null, kafkaErrorCallback = null, withBackPressure = false, outputKafkaConfig = null) { if...
{ throw new Error("from & to should be unix epoch ms times."); }
conditional_block
u8.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 ...
#![unstable] #![doc(primitive = "u8")] use from_str::FromStr; use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; use string::String; pub use core::u8::{BITS, BYTES, MIN, MAX}; uint_module!(u8)
//! Operations and constants for unsigned 8-bits integers (`u8` type)
random_line_split
issue-8351-2.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ Foo{f: int, b: bool}, Bar, } pub fn main() { let e = Foo{f: 0, b: false}; match e { Foo{f: 1, b: true} => fail!(), Foo{b: false, f: 0} => (), _ => fail!(), } }
E
identifier_name
issue-8351-2.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} }
match e { Foo{f: 1, b: true} => fail!(), Foo{b: false, f: 0} => (), _ => fail!(),
random_line_split
line.py
# computational geometry | 2D line intersecton | Python def parallel_int(verticeX,verticeY): k = (verticeY[2]-verticeY[0])*(verticeX[1]-verticeX[0]) - (verticeX[2]-verticeX[0])*(verticeY[1]-verticeY[0]) if k==0: return "infinite" else: return "no" def line_int(verticeX,verticeY):
X=[] Y=[] try: input = raw_input except NameError: pass print("Enter 2-point form of each line") X.append(float(input("X of point 1, line 1: "))) Y.append(float(input("Y of point 1, line 1: "))) X.append(float(input("X of point 2, line 1: "))) Y.append(float(input("Y of point 2, line 1: "))) X.append(float(inpu...
x12 = verticeX[0]-verticeX[1] x34 = verticeX[2]-verticeX[3] y12 = verticeY[0]-verticeY[1] y34 = verticeY[2]-verticeY[3] c = x12 * y34 - y12 * x34 if c == 0: return ("NoInt",None) a = verticeX[0] * verticeY[1] - verticeY[0] * verticeX[1] b = verticeX[2] * verticeY[3] - verticeY[2] * verticeX[3] x = (a * x...
identifier_body
line.py
# computational geometry | 2D line intersecton | Python def
(verticeX,verticeY): k = (verticeY[2]-verticeY[0])*(verticeX[1]-verticeX[0]) - (verticeX[2]-verticeX[0])*(verticeY[1]-verticeY[0]) if k==0: return "infinite" else: return "no" def line_int(verticeX,verticeY): x12 = verticeX[0]-verticeX[1] x34 = verticeX[2]-verticeX[3] y12 = verticeY[0]-verticeY[1] y34 = vert...
parallel_int
identifier_name
line.py
# computational geometry | 2D line intersecton | Python def parallel_int(verticeX,verticeY): k = (verticeY[2]-verticeY[0])*(verticeX[1]-verticeX[0]) - (verticeX[2]-verticeX[0])*(verticeY[1]-verticeY[0]) if k==0: return "infinite" else: return "no" def line_int(verticeX,verticeY): x12 = verticeX[0]-verticeX[1] ...
X.append(float(input("X of point 1, line 2: "))) Y.append(float(input("Y of point 1, line 2: "))) X.append(float(input("X of point 2, line 2: "))) Y.append(float(input("Y of point 2, line 2: "))) intersectn = line_int(X,Y) if intersectn[0]=="NoInt": print("Parallel lines found with "+parallel_int(X,Y)+" intersectio...
X.append(float(input("X of point 2, line 1: "))) Y.append(float(input("Y of point 2, line 1: ")))
random_line_split
line.py
# computational geometry | 2D line intersecton | Python def parallel_int(verticeX,verticeY): k = (verticeY[2]-verticeY[0])*(verticeX[1]-verticeX[0]) - (verticeX[2]-verticeX[0])*(verticeY[1]-verticeY[0]) if k==0:
else: return "no" def line_int(verticeX,verticeY): x12 = verticeX[0]-verticeX[1] x34 = verticeX[2]-verticeX[3] y12 = verticeY[0]-verticeY[1] y34 = verticeY[2]-verticeY[3] c = x12 * y34 - y12 * x34 if c == 0: return ("NoInt",None) a = verticeX[0] * verticeY[1] - verticeY[0] * verticeX[1] b = verticeX[2...
return "infinite"
conditional_block
filters.js
angular.module('confjuvapp.filters', []). filter('htmlToPlainText', function() { return function(text) { return String(text).replace(/<[^>]+>/gm, ''); }; }).
filter('categoryType', function() { return function(categories, type) { for (var i = 0; i < categories.length; i++) { if (categories[i].type.toLowerCase() == type) { return categories[i].name; } } }; }). filter('tagFilter', function() { return function(text) { return String(text).r...
random_line_split
filters.js
angular.module('confjuvapp.filters', []). filter('htmlToPlainText', function() { return function(text) { return String(text).replace(/<[^>]+>/gm, ''); }; }). filter('categoryType', function() { return function(categories, type) { for (var i = 0; i < categories.length; i++) { if (categories[i].type.t...
} }; }). filter('tagFilter', function() { return function(text) { return String(text).replace(/#/gm, ''); }; }). filter('etniaFilter', function() { return function(type) { var etnia = {}; etnia[1] = 'Pardo'; etnia[2] = 'Preto'; etnia[3] = 'Branco'; etnia[4] = 'Indígena'; etnia[5...
{ return categories[i].name; }
conditional_block
SetupsAndTeardowns.js
window.setupsAndTeardownsOutput = {}; window.setupsAndTeardownsOutput["suite"] = [1,2,3,0,[],[1,0,27],[],[[4,0,1,0,[],[1,24,3],[[1,5,6,0,7,8,0,[1,25,0],[],[[25,2,8]]],[0,9,0,0,0,0,0,[1,25,1],[[0,10,6,0,11,0,0,[1,25,1],[],[]],[2,5,6,0,7,12,0,[1,26,0],[],[[26,2,12]]]],[]],[2,5,6,0,7,13,0,[1,26,1],[],[[27,2,13]]]]]],[[1,...
window.setupsAndTeardownsOutput["baseMillis"] = 1432033913775; window.settings = {"background":{"fail":"DeepPink"},"logURL":"log.html","reportURL":"report.html"};
window.setupsAndTeardownsOutput["generatedMillis"] = -775;
random_line_split
convert.py
# -*- coding: utf-8 -*- """ Created on Fri Dec 04 13:10:20 2015 @author: bayevskihk """ import sys def main(argv):
return print ("Convertion was successfull") def parse(file_name, rom_name, addr_last): hex_file = open(file_name, 'r') rom_file = open(rom_name, 'w') # rom_file.truncate() hex_parts = hex_file.readline() line = "" try: hex_parts.index("@") except: ret...
number = len(argv) data_addr = 0 last_addr = 0 if(number != 2): return else: try: data_addr = int(argv[0]) last_addr = int(argv[1]) except: print ("Wrong arguments") return if(parse("build/obj/text.vh", "build/text.rom"...
identifier_body
convert.py
# -*- coding: utf-8 -*- """ Created on Fri Dec 04 13:10:20 2015 @author: bayevskihk """ import sys def
(argv): number = len(argv) data_addr = 0 last_addr = 0 if(number != 2): return else: try: data_addr = int(argv[0]) last_addr = int(argv[1]) except: print ("Wrong arguments") return if(parse("build/obj/text.vh", "bui...
main
identifier_name
convert.py
# -*- coding: utf-8 -*- """ Created on Fri Dec 04 13:10:20 2015 @author: bayevskihk """ import sys def main(argv): number = len(argv) data_addr = 0 last_addr = 0 if(number != 2): return else: try: data_addr = int(argv[0]) last_addr = int(argv[1]) ...
print ("Wrong text file") return if(parse("build/obj/data.vh", "build/data.rom", last_addr - data_addr) < 0): print ("Wrong text file") return print ("Convertion was successfull") def parse(file_name, rom_name, addr_last): hex_file = open(file_name...
return if(parse("build/obj/text.vh", "build/text.rom", data_addr) < 0):
random_line_split
convert.py
# -*- coding: utf-8 -*- """ Created on Fri Dec 04 13:10:20 2015 @author: bayevskihk """ import sys def main(argv): number = len(argv) data_addr = 0 last_addr = 0 if(number != 2): return else: try: data_addr = int(argv[0]) last_addr = int(argv[1]) ...
if(parse("build/obj/data.vh", "build/data.rom", last_addr - data_addr) < 0): print ("Wrong text file") return print ("Convertion was successfull") def parse(file_name, rom_name, addr_last): hex_file = open(file_name, 'r') rom_file = open(rom_name, 'w') # rom_file....
print ("Wrong text file") return
conditional_block
blueprints.py
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
uri = '/blueprints/{0}'.format(blueprint_id) # For a Windows path (e.g. "C:\aaa\bbb.zip") scheme is the # drive letter and therefore the 2nd condition is present if urlparse.urlparse(archive_location).scheme and \ not os.path.exists(archive_location): # archi...
query_params['application_file_name'] = \ urllib.quote(application_file_name)
random_line_split
blueprints.py
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
class BlueprintsClient(object): def __init__(self, api): self.api = api @staticmethod def _tar_blueprint(blueprint_path, tempdir): blueprint_path = expanduser(blueprint_path) blueprint_name = os.path.basename(os.path.splitext(blueprint_path)[0]) blueprint_directory = os....
""" Gets the description of the blueprint :return: The description of the blueprint. """ return self.get('description')
identifier_body
blueprints.py
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
(self, archive_location, blueprint_id, application_file_name=None): query_params = {} if application_file_name is not None: query_params['application_file_name'] = \ urllib.quote(application_file_name) uri = '/blueprints/{0}'.format(bl...
_upload
identifier_name
blueprints.py
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
return self.api.put(uri, params=query_params, data=data, expected_status_code=201) def list(self, _include=None, **kwargs): """ Returns a list of currently stored blueprints. :param _include: List of fields to include in response. :param kwargs...
data = bytes_stream_utils.request_data_file_stream_gen( archive_location)
conditional_block
popup.service.ts
import { ApplicationRef, ComponentFactoryResolver, Injectable, Injector } from '@angular/core'; import { NgElement, WithProperties } from '@angular/elements'; import { PopupComponent } from './popup.component'; @Injectable() export class PopupService { constructor(private injector: Injector, private a...
document.body.removeChild(popup); this.applicationRef.detachView(popupComponentRef.hostView); }); // Set the message popupComponentRef.instance.message = message; // Add to the DOM document.body.appendChild(popup); } // This uses the new custom-element method to add the popup to t...
// Listen to the close event popupComponentRef.instance.closed.subscribe(() => {
random_line_split
popup.service.ts
import { ApplicationRef, ComponentFactoryResolver, Injectable, Injector } from '@angular/core'; import { NgElement, WithProperties } from '@angular/elements'; import { PopupComponent } from './popup.component'; @Injectable() export class PopupService { constructor(private injector: Injector, private ...
(message: string) { // Create element const popupEl: NgElement & WithProperties<PopupComponent> = document.createElement('popup-element') as any; // Listen to the close event popupEl.addEventListener('closed', () => document.body.removeChild(popupEl)); // Set the message popupEl.message = mess...
showAsElement
identifier_name
tsp.rs
extern crate time; extern crate getopts; extern crate rand; // TODO use terminal colors for nicer colored output // extern crate term; use getopts::{Options, Matches}; use std::env::args; use rand::{SeedableRng, StdRng}; use time::precise_time_ns; use std::str::FromStr; use graph::Graph; use population::Population; ...
<T: FromStr>(matches: &Matches, opt: &str, default: T) -> T { match matches.opt_str(opt) { Some(o) => o.parse::<T>().unwrap_or(default), None => default, } } fn main() { let args: Vec<String> = args().skip(1).collect(); let program = args[0].clone(); let mut opts = Options::new(); ...
parse_opt
identifier_name
tsp.rs
extern crate time; extern crate getopts; extern crate rand; // TODO use terminal colors for nicer colored output // extern crate term; use getopts::{Options, Matches}; use std::env::args; use rand::{SeedableRng, StdRng}; use time::precise_time_ns; use std::str::FromStr; use graph::Graph; use population::Population; ...
else { // make a seeded RNG for the random graph generation for consistent testing let seed: &[_] = &[12, 13, 14, 15]; let mut s_rng: StdRng = SeedableRng::from_seed(seed); graph = Graph::random_graph(&mut s_rng, node_count, scale, scale); } if v_flag { println!("Runnin...
{ let file_path = parse_opt::<String>(&matches, "r", String::new()); if file_path.is_empty() { panic!("failed to parse file path") } graph = Graph::from_file(&file_path).unwrap(); }
conditional_block
tsp.rs
extern crate time; extern crate getopts; extern crate rand; // TODO use terminal colors for nicer colored output // extern crate term; use getopts::{Options, Matches}; use std::env::args; use rand::{SeedableRng, StdRng}; use time::precise_time_ns; use std::str::FromStr; use graph::Graph; use population::Population; ...
fn main() { let args: Vec<String> = args().skip(1).collect(); let program = args[0].clone(); let mut opts = Options::new(); opts.optflag("h", "help", "print this help menu"); opts.optopt("m", "mutation_rate", "change the mutation rate (default: 0.015)", ...
{ match matches.opt_str(opt) { Some(o) => o.parse::<T>().unwrap_or(default), None => default, } }
identifier_body
tsp.rs
extern crate time; extern crate getopts; extern crate rand; // TODO use terminal colors for nicer colored output // extern crate term; use getopts::{Options, Matches}; use std::env::args; use rand::{SeedableRng, StdRng}; use time::precise_time_ns; use std::str::FromStr; use graph::Graph; use population::Population; ...
fn parse_opt<T: FromStr>(matches: &Matches, opt: &str, default: T) -> T { match matches.opt_str(opt) { Some(o) => o.parse::<T>().unwrap_or(default), None => default, } } fn main() { let args: Vec<String> = args().skip(1).collect(); let program = args[0].clone(); let mut opts = Optio...
random_line_split
_009_change_token_value.py
# -*- coding: utf-8 -*- # Copyright 2018 GIG Technology NV # # 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...
roles=[] if DEBUG else menu_item_roles, fall_through=True) system.publish_changes(api_key)
menu_item_roles.append(role.id) system.put_menu_item(api_key, icon_name, BUY_TOKENS_TAG, coords, None, label, static_flow=flow,
random_line_split
_009_change_token_value.py
# -*- coding: utf-8 -*- # Copyright 2018 GIG Technology NV # # 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...
for stats_model in GlobalStats.query(): # type: GlobalStats new_value = stats_model.value / 100 currencies = _get_currency_conversions(stats_model.currencies, new_value) stats_model.populate(currencies=currencies, value=new_value) stats_model.put() coords = [2, 1, 0] icon_name =...
identifier_body
_009_change_token_value.py
# -*- coding: utf-8 -*- # Copyright 2018 GIG Technology NV # # 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...
(): for stats_model in GlobalStats.query(): # type: GlobalStats new_value = stats_model.value / 100 currencies = _get_currency_conversions(stats_model.currencies, new_value) stats_model.populate(currencies=currencies, value=new_value) stats_model.put() coords = [2, 1, 0] ico...
migrate
identifier_name
_009_change_token_value.py
# -*- coding: utf-8 -*- # Copyright 2018 GIG Technology NV # # 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...
system.put_menu_item(api_key, icon_name, BUY_TOKENS_TAG, coords, None, label, static_flow=flow, roles=[] if DEBUG else menu_item_roles, fall_through=True) system.publish_changes(api_key)
menu_item_roles.append(role.id)
conditional_block
REDBEARDUO.py
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> # # 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 h...
(): pins = pinutils.scan_pin_file([], 'stm32f20x.csv', 6, 9, 10) pins = pinutils.scan_pin_af_file(pins, 'stm32f20x_af.csv', 0, 1) return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
get_pins
identifier_name
REDBEARDUO.py
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> # # 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 h...
def get_pins(): pins = pinutils.scan_pin_file([], 'stm32f20x.csv', 6, 9, 10) pins = pinutils.scan_pin_af_file(pins, 'stm32f20x_af.csv', 0, 1) return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
random_line_split
REDBEARDUO.py
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> # # 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 h...
pins = pinutils.scan_pin_file([], 'stm32f20x.csv', 6, 9, 10) pins = pinutils.scan_pin_af_file(pins, 'stm32f20x_af.csv', 0, 1) return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
identifier_body
option.js
import React,{ Component } from 'react'; export default class Options extends Component { constructor(props) { super(props); this.state = { datas: this.props.datas, } this.editor = null; this.editorBody = null; this.editorHtml = null; } componentDidMount() { console.log('compo...
this.props.deleteOption(event.currentTarget.attributes["data-option-id"].value); } onChangeChecked(event) { this.updateInputValue(this.editor.getData()); //fix ie 11,check befor blur; this.props.changeOptionChecked(event.currentTarget.attributes["data-option-id"].value,this.props.datas.checked); } ...
random_line_split
option.js
import React,{ Component } from 'react'; export default class Options extends Component { constructor(props) { super(props); this.state = { datas: this.props.datas, } this.editor = null; this.editorBody = null; this.editorHtml = null; } componentDidMount() { console.log('compo...
this.editorHtml = inputValue; this.props.updateInputValue(this.props.datas.optionId,inputValue); } render() { let showDanger = this.props.isValidator && this.props.datas.inputValue.length <= 0; let type = 'checkbox'; if(this.props.isRadio) { type= 'radio'; } if(this.editorBody && t...
(inputValue);
identifier_name
option.js
import React,{ Component } from 'react'; export default class Options extends Component { constructor(props) { super(props); this.state = { datas: this.props.datas, } this.editor = null; this.editorBody = null; this.editorHtml = null; } componentDidMount() { console.log('compo...
setTimeout(function(){ self.updateInputValue(self.editor.getData()); },100) }); }else { this.editor.setData(datas.inputValue); } } updateInputValue(inputValue) { console .log(inputValue); this.editorHtml = inputValue; this.props.updateInputValue(this.props...
{ if(!this.editor) { this.editor = CKEDITOR.replace(this.props.datas.optionId, { toolbar: 'Minimal', filebrowserImageUploadUrl:this.props.imageUploadUrl, height: 120 }); let self = this; this.editor.on("instanceReady", function () { self.editorBody = $('#' +...
identifier_body
option.js
import React,{ Component } from 'react'; export default class Options extends Component { constructor(props) { super(props); this.state = { datas: this.props.datas, } this.editor = null; this.editorBody = null; this.editorHtml = null; } componentDidMount() { console.log('compo...
self.updateInputValue(self.editor.getData()); },100) }); }else { this.editor.setData(datas.inputVa lue); } } updateInputValue(inputValue) { console.log(inputValue); this.editorHtml = inputValue; this.props.updateInputValue(this.props.datas.optionId,inputValue); ...
{ this.editor = CKEDITOR.replace(this.props.datas.optionId, { toolbar: 'Minimal', filebrowserImageUploadUrl:this.props.imageUploadUrl, height: 120 }); let self = this; this.editor.on("instanceReady", function () { self.editorBody = $('#' + [self.props.datas.opti...
conditional_block
FunctionFilters.tsx
import React from 'react'; import { chain, compact, debounce, uniq, map } from 'lodash'; import { $rootScope } from 'ngimport'; import { Subscription } from 'rxjs'; import { Application } from 'core/application'; import { CloudProviderLabel, CloudProviderLogo } from 'core/cloudProvider'; import { FilterCollapse, ISort...
FunctionState.filterService.updateFunctionGroups(app); const { region, account } = digestDependentFilters({ sortFilter: FunctionState.filterModel.asFilterModel.sortFilter, dependencyOrder: ['providerType', 'account', 'region'], pool: poolBuilder(app.functions.data), }); this.setStat...
{ FunctionState.filterModel.asFilterModel.applyParamsToUrl(); }
conditional_block
FunctionFilters.tsx
import React from 'react'; import { chain, compact, debounce, uniq, map } from 'lodash'; import { $rootScope } from 'ngimport'; import { Subscription } from 'rxjs'; import { Application } from 'core/application'; import { CloudProviderLabel, CloudProviderLogo } from 'core/cloudProvider'; import { FilterCollapse, ISort...
public updateFunctionGroups = (applyParamsToUrl = true): void => { const { app } = this.props; if (applyParamsToUrl) { FunctionState.filterModel.asFilterModel.applyParamsToUrl(); } FunctionState.filterService.updateFunctionGroups(app); const { region, account } = digestDependentFilters({...
{ this.groupsUpdatedSubscription.unsubscribe(); this.functionsRefreshUnsubscribe(); this.locationChangeUnsubscribe(); }
identifier_body
FunctionFilters.tsx
import React from 'react'; import { chain, compact, debounce, uniq, map } from 'lodash'; import { $rootScope } from 'ngimport'; import { Subscription } from 'rxjs'; import { Application } from 'core/application'; import { CloudProviderLabel, CloudProviderLogo } from 'core/cloudProvider'; import { FilterCollapse, ISort...
(): void { const { app } = this.props; this.groupsUpdatedSubscription = FunctionState.filterService.groupsUpdatedStream.subscribe(() => { this.setState({ tags: FunctionState.filterModel.asFilterModel.tags }); }); if (app.functions && app.functions.loaded) { this.updateFunctionGroups(); ...
componentDidMount
identifier_name
FunctionFilters.tsx
import React from 'react'; import { chain, compact, debounce, uniq, map } from 'lodash'; import { $rootScope } from 'ngimport'; import { Subscription } from 'rxjs'; import { Application } from 'core/application'; import { CloudProviderLabel, CloudProviderLogo } from 'core/cloudProvider'; import { FilterCollapse, ISort...
<FilterSection heading="Region" expanded={true}> {regionHeadings.map(heading => ( <FilterCheckbox heading={heading} key={heading} sortFilterType={sortFilter.region} onChange={this.updateFunctionGroups} ...
</FilterSection>
random_line_split
webpack.config.js
const path = require("path"); const webpack = require("webpack"); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const CopyWebpackPlugin = require('copy-webpack-plugin'); var babelOptions = { presets: [ ["@babel/preset-env", { ...
]), devServer: { contentBase: './static/', publicPath: "/", port: 8080, hot: true, inline: true }, module: { rules: [ { test: /\.js$/, exclude: /node_module...
] }) ]) : commonPlugins.concat([ new webpack.HotModuleReplacementPlugin(),
random_line_split
add-collection-attribute.component.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * This program 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 ...
(private fb: FormBuilder) {} public get attributeControl(): AbstractControl { return this.form?.controls?.attribute; } public ngOnInit() { this.form = this.fb.group({attribute: null}); this.refreshValidators(); } private refreshValidators() { this.attributeControl?.setValidators([notEmptyVa...
constructor
identifier_name
add-collection-attribute.component.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * This program 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 ...
{ return (control: FormControl): ValidationErrors | null => { const attributeName = String(control.value || '').trim(); if (attributes.find(attribute => attribute.name === attributeName)) { return {notUnique: true}; } return null; }; }
identifier_body
add-collection-attribute.component.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * This program 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 ...
this.attributeControl?.setValue(''); } public onKeyPress(event: KeyboardEvent) { if (event.key === KeyCode.Enter && this.attributeControl?.valid) { this.onCreateAttribute(); } } public onInput(value: any) { const safeValue = filterOutInvalidAttributeNameCharacters(String(value || '')); ...
{ this.save.emit(name); }
conditional_block
add-collection-attribute.component.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * This program 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 ...
public form: FormGroup; constructor(private fb: FormBuilder) {} public get attributeControl(): AbstractControl { return this.form?.controls?.attribute; } public ngOnInit() { this.form = this.fb.group({attribute: null}); this.refreshValidators(); } private refreshValidators() { this.at...
@Input() public attributes: Attribute[]; @Output() public save = new EventEmitter<string>();
random_line_split
cvtdq2ps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn cvtdq2ps_1() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM0)), operand2: Some(Direc...
fn cvtdq2ps_3() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM7)), operand2: Some(Direct(XMM4)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 91, 252], OperandSize::Qword) } fn cvtdq2ps_4() ...
{ run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM6)), operand2: Some(IndirectScaledIndexed(EAX, EDI, Eight, Some(OperandSize::Xmmword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 91, 52,...
identifier_body
cvtdq2ps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*;
fn cvtdq2ps_1() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM0)), operand2: Some(Direct(XMM6)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 91, 198], OperandSize::Dword) } fn cvtdq2ps_2() {...
use ::Reg::*; use ::RegScale::*;
random_line_split
cvtdq2ps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn cvtdq2ps_1() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM0)), operand2: Some(Direc...
() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM6)), operand2: Some(IndirectScaledIndexed(EAX, EDI, Eight, Some(OperandSize::Xmmword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 91, ...
cvtdq2ps_2
identifier_name
main.rs
extern crate splc; use std::io::prelude::*; use std::fs::File; use splc::bio::rna::*; use splc::bio::fasta::*; use splc::bio::dna::DNA; use splc::bio::aa::*; fn main() { let mut file = File::open("input").unwrap(); let mut buffer = String::new(); file.read_to_string(&mut buffer).unwrap(); let fastas:...
}
random_line_split
main.rs
extern crate splc; use std::io::prelude::*; use std::fs::File; use splc::bio::rna::*; use splc::bio::fasta::*; use splc::bio::dna::DNA; use splc::bio::aa::*; fn main() { let mut file = File::open("input").unwrap(); let mut buffer = String::new(); file.read_to_string(&mut buffer).unwrap(); let fastas:...
pos = pos + 1; }, Some(n) => { if &s[pos] == &s[n] { table.push(Some(n + 1)); cnd = Some(n + 1); pos = pos + 1; } else { ...
{ table.push(Some(0)); }
conditional_block
main.rs
extern crate splc; use std::io::prelude::*; use std::fs::File; use splc::bio::rna::*; use splc::bio::fasta::*; use splc::bio::dna::DNA; use splc::bio::aa::*; fn main() { let mut file = File::open("input").unwrap(); let mut buffer = String::new(); file.read_to_string(&mut buffer).unwrap(); let fastas:...
<T: Eq>(haystack: &[T], needle: &[T]) -> Vec<usize> { let mut vec = Vec::new(); let mut i = 0; while i < haystack.len() { let rest = &haystack[i..]; i = i + kmp(rest, needle) + 1; if i < haystack.len() { vec.push(i - 1); } } vec } fn kmp<T: Eq>(haystack: ...
indices
identifier_name
main.rs
extern crate splc; use std::io::prelude::*; use std::fs::File; use splc::bio::rna::*; use splc::bio::fasta::*; use splc::bio::dna::DNA; use splc::bio::aa::*; fn main() { let mut file = File::open("input").unwrap(); let mut buffer = String::new(); file.read_to_string(&mut buffer).unwrap(); let fastas:...
fn indices<T: Eq>(haystack: &[T], needle: &[T]) -> Vec<usize> { let mut vec = Vec::new(); let mut i = 0; while i < haystack.len() { let rest = &haystack[i..]; i = i + kmp(rest, needle) + 1; if i < haystack.len() { vec.push(i - 1); } } vec } fn kmp<T: Eq...
{ // println!("{:?}", intron); let mut result = Vec::new(); let mut i = 0; for start in indices(&sequence, intron) { result.extend_from_slice(&sequence[i .. start]); i = start + intron.len(); } result.extend_from_slice(&sequence[i ..]); *sequence = result; }
identifier_body
switch.rs
use core::sync::atomic::Ordering; use arch; use super::{contexts, Context, Status, CONTEXT_ID}; /// Switch to the next context /// /// # Safety /// /// Do not call this while holding locks! pub unsafe fn switch() -> bool { use core::ops::DerefMut; // Set the global lock to avoid the unsafe operations below f...
} if to_ptr as usize == 0 { for (pid, context_lock) in contexts.iter() { if *pid < (*from_ptr).id { let mut context = context_lock.write(); if check_context(&mut context) { to_ptr = context.deref_mut() as *mut ...
{ let mut context = context_lock.write(); if check_context(&mut context) { to_ptr = context.deref_mut() as *mut Context; break; } }
conditional_block
switch.rs
use core::sync::atomic::Ordering; use arch; use super::{contexts, Context, Status, CONTEXT_ID}; /// Switch to the next context /// /// # Safety /// /// Do not call this while holding locks! pub unsafe fn
() -> bool { use core::ops::DerefMut; // Set the global lock to avoid the unsafe operations below from causing issues while arch::context::CONTEXT_SWITCH_LOCK.compare_and_swap(false, true, Ordering::SeqCst) { arch::interrupt::pause(); } let cpu_id = ::cpu_id(); let from_ptr; let m...
switch
identifier_name
switch.rs
use core::sync::atomic::Ordering; use arch; use super::{contexts, Context, Status, CONTEXT_ID}; /// Switch to the next context /// /// # Safety /// /// Do not call this while holding locks! pub unsafe fn switch() -> bool
let check_context = |context: &mut Context| -> bool { if context.cpu_id == None && cpu_id == 0 { context.cpu_id = Some(cpu_id); // println!("{}: take {} {}", cpu_id, context.id, ::core::str::from_utf8_unchecked(&context.name.lock())); } if con...
{ use core::ops::DerefMut; // Set the global lock to avoid the unsafe operations below from causing issues while arch::context::CONTEXT_SWITCH_LOCK.compare_and_swap(false, true, Ordering::SeqCst) { arch::interrupt::pause(); } let cpu_id = ::cpu_id(); let from_ptr; let mut to_ptr =...
identifier_body
switch.rs
use core::sync::atomic::Ordering; use arch; use super::{contexts, Context, Status, CONTEXT_ID}; /// Switch to the next context /// /// # Safety /// /// Do not call this while holding locks! pub unsafe fn switch() -> bool { use core::ops::DerefMut; // Set the global lock to avoid the unsafe operations below f...
(&mut *from_ptr).arch.switch_to(&mut (&mut *to_ptr).arch); true }
// Unset global lock before switch, as arch is only usable by the current CPU at this time arch::context::CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst);
random_line_split
ionicSideMenuDelegate.js
(function() { 'use strict'; angular.module('ionic.ui.service.sideMenuDelegate', []) .factory('$ionicSideMenuDelegate', ['$rootScope', '$timeout', '$q', function($rootScope, $timeout, $q) { return { getSideMenuController: function($scope) { return $scope.sideMenuController; }, close: function($scop...
}, openLeft: function($scope) { if($scope.sideMenuController) { $scope.sideMenuController.openPercentage(100); } }, openRight: function($scope) { if($scope.sideMenuController) { $scope.sideMenuController.openPercentage(-100); } } }; }]); })();
{ $scope.sideMenuController.toggleRight(); }
conditional_block
ionicSideMenuDelegate.js
(function() { 'use strict'; angular.module('ionic.ui.service.sideMenuDelegate', []) .factory('$ionicSideMenuDelegate', ['$rootScope', '$timeout', '$q', function($rootScope, $timeout, $q) { return { getSideMenuController: function($scope) { return $scope.sideMenuController;
close: function($scope) { if($scope.sideMenuController) { $scope.sideMenuController.close(); } }, toggleLeft: function($scope) { if($scope.sideMenuController) { $scope.sideMenuController.toggleLeft(); } }, toggleRight: function($scope) { if($scope.sideMe...
},
random_line_split
ENTimeUnitCasualRelativeFormatParser.ts
import { TIME_UNITS_PATTERN, parseTimeUnits } from "../constants"; import { ParsingContext } from "../../../chrono"; import { ParsingComponents } from "../../../results"; import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary"; import { reverseTimeUnits } from ".....
case "past": case "-": timeUnits = reverseTimeUnits(timeUnits); break; } return ParsingComponents.createRelativeFromReference(context.reference, timeUnits); } }
innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents { const prefix = match[1].toLowerCase(); let timeUnits = parseTimeUnits(match[2]); switch (prefix) { case "last":
random_line_split
ENTimeUnitCasualRelativeFormatParser.ts
import { TIME_UNITS_PATTERN, parseTimeUnits } from "../constants"; import { ParsingContext } from "../../../chrono"; import { ParsingComponents } from "../../../results"; import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary"; import { reverseTimeUnits } from ".....
extends AbstractParserWithWordBoundaryChecking { innerPattern(): RegExp { return PATTERN; } innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents { const prefix = match[1].toLowerCase(); let timeUnits = parseTimeUnits(match[2]); switch (prefix) {...
ENTimeUnitCasualRelativeFormatParser
identifier_name
ENTimeUnitCasualRelativeFormatParser.ts
import { TIME_UNITS_PATTERN, parseTimeUnits } from "../constants"; import { ParsingContext } from "../../../chrono"; import { ParsingComponents } from "../../../results"; import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary"; import { reverseTimeUnits } from ".....
}
{ const prefix = match[1].toLowerCase(); let timeUnits = parseTimeUnits(match[2]); switch (prefix) { case "last": case "past": case "-": timeUnits = reverseTimeUnits(timeUnits); break; } return ParsingComponents...
identifier_body
bf.rs
use std::io::{self, Stdout, StdoutLock, Write}; use std::net::TcpStream; use std::{env, fs, process}; enum Op { Dec, Inc, Prev, Next, Loop(Box<[Op]>), Print, } struct Tape { pos: usize, tape: Vec<i32>, } impl Tape { fn new() -> Self { Self { pos: 0, ...
(&mut self) { *self.get_mut() -= 1; } fn inc(&mut self) { *self.get_mut() += 1; } fn prev(&mut self) { self.pos -= 1; } fn next(&mut self) { self.pos += 1; if self.pos >= self.tape.len() { self.tape.resize(self.pos << 1, 0); } } ...
dec
identifier_name
bf.rs
use std::io::{self, Stdout, StdoutLock, Write}; use std::net::TcpStream; use std::{env, fs, process}; enum Op { Dec, Inc, Prev, Next, Loop(Box<[Op]>), Print, } struct Tape { pos: usize, tape: Vec<i32>, } impl Tape { fn new() -> Self { Self { pos: 0, ...
fn inc(&mut self) { *self.get_mut() += 1; } fn prev(&mut self) { self.pos -= 1; } fn next(&mut self) { self.pos += 1; if self.pos >= self.tape.len() { self.tape.resize(self.pos << 1, 0); } } } struct Printer<'a> { output: StdoutLock<'a>,...
*self.get_mut() -= 1; }
random_line_split
authentication.py
# accounts/authentication.py import requests import logging from django.conf import settings from django.contrib.auth import get_user_model logger = logging.getLogger(__name__) User = get_user_model() PERSONA_VERIFY_URL = 'https://verifier.login.persona.org/verify' #DOMAIN = 'localhost' #DOMAIN = 'http://hotzenplot...
try: return User.objects.get(email=email) except User.DoesNotExist: return None
def authenticate(self, assertion): logging.warning('entering authenticate function') response = requests.post( PERSONA_VERIFY_URL, data = {'assertion': assertion, 'audience': settings.DOMAIN} ) logging.warning('got response from persona') logging.warning(r...
identifier_body
authentication.py
# accounts/authentication.py import requests import logging from django.conf import settings from django.contrib.auth import get_user_model logger = logging.getLogger(__name__) User = get_user_model() PERSONA_VERIFY_URL = 'https://verifier.login.persona.org/verify' #DOMAIN = 'localhost' #DOMAIN = 'http://hotzenplot...
def get_user(self, email): try: return User.objects.get(email=email) except User.DoesNotExist: return None
logger.warning( 'Persona says no. Json was: {}'.format(response.json()) )
conditional_block
authentication.py
# accounts/authentication.py import requests import logging from django.conf import settings from django.contrib.auth import get_user_model logger = logging.getLogger(__name__) User = get_user_model() PERSONA_VERIFY_URL = 'https://verifier.login.persona.org/verify' #DOMAIN = 'localhost' #DOMAIN = 'http://hotzenplot...
if response.ok and response.json()['status'] == 'okay': email = response.json()['email'] try: return User.objects.get(email=email) except User.DoesNotExist: return User.objects.create(email=email) else: logger.warning( ...
data = {'assertion': assertion, 'audience': settings.DOMAIN} ) logging.warning('got response from persona') logging.warning(response.content.decode())
random_line_split
authentication.py
# accounts/authentication.py import requests import logging from django.conf import settings from django.contrib.auth import get_user_model logger = logging.getLogger(__name__) User = get_user_model() PERSONA_VERIFY_URL = 'https://verifier.login.persona.org/verify' #DOMAIN = 'localhost' #DOMAIN = 'http://hotzenplot...
(object): def authenticate(self, assertion): logging.warning('entering authenticate function') response = requests.post( PERSONA_VERIFY_URL, data = {'assertion': assertion, 'audience': settings.DOMAIN} ) logging.warning('got response from persona') lo...
PersonaAuthenticationBackend
identifier_name
asyncMessenger.js
const Rivescript = require('rivescript') const AsyncMessenger = function(messenger, macros, onReady) { const self = this self.messenger = messenger self.rs = new Rivescript({ utf8: true, caseSensitive: true }) self.rs.unicodePunctuation = new RegExp(/[~]/) self.sendMessage = (message, messageText) => { ...
} self.rs.loadDirectory('./brain', () => { self.rs.sortReplies() onReady() }) Object.keys(macros).forEach(macro => { self.rs._objlangs[macro] = 'javascript' self.rs._handlers.javascript._objects[macro] = (rs, args) => { /* eslint-disable no-console */ console.log('args', args.join...
{ self.messenger.sendMessage(reply, message.channel) }
conditional_block
asyncMessenger.js
const Rivescript = require('rivescript') const AsyncMessenger = function(messenger, macros, onReady) {
const self = this self.messenger = messenger self.rs = new Rivescript({ utf8: true, caseSensitive: true }) self.rs.unicodePunctuation = new RegExp(/[~]/) self.sendMessage = (message, messageText) => { const reply = self.rs.reply(message.user, messageText) if(reply.then){ /* eslint-disable no-co...
random_line_split
tap.ts
import { MonoTypeOperatorFunction, Observer } from '../types'; import { isFunction } from '../util/isFunction'; import { operate } from '../util/lift'; import { OperatorSubscriber } from './OperatorSubscriber'; import { identity } from '../util/identity'; export function tap<T>(observer?: Partial<Observer<T>>): MonoTy...
}, (err) => { tapObserver.error?.(err); subscriber.error(err); } ) ); }) : // Tap was called with no valid tap observer or handler // (e.g. `tap(null, null, null)` or `tap(null)` or `tap()`) // so we're going to just...
{ // We have to check to see not only if next is a function, // but if error or complete were passed. This is because someone // could technically call tap like `tap(null, fn)` or `tap(null, null, fn)`. const tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext as (value: T...
identifier_body
tap.ts
import { MonoTypeOperatorFunction, Observer } from '../types'; import { isFunction } from '../util/isFunction'; import { operate } from '../util/lift'; import { OperatorSubscriber } from './OperatorSubscriber'; import { identity } from '../util/identity'; export function tap<T>(observer?: Partial<Observer<T>>): MonoTy...
* map(n => n > 0.5 ? 'big' : 'small') * ).subscribe(console.log); * ``` * * ## Example * Using `tap` to analyze a value and force an error. Below is an observable where in our system we only * want to emit numbers 3 or less we get from another source. We can force our observable to error * using `tap`. * * ...
* import { of } from 'rxjs'; * import { tap, map } from 'rxjs/operators'; * * of(Math.random()).pipe( * tap(console.log),
random_line_split
tap.ts
import { MonoTypeOperatorFunction, Observer } from '../types'; import { isFunction } from '../util/isFunction'; import { operate } from '../util/lift'; import { OperatorSubscriber } from './OperatorSubscriber'; import { identity } from '../util/identity'; export function tap<T>(observer?: Partial<Observer<T>>): MonoTy...
<T>( observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | null, error?: ((e: any) => void) | null, complete?: (() => void) | null ): MonoTypeOperatorFunction<T> { // We have to check to see not only if next is a function, // but if error or complete were passed. This is because someone // could te...
tap
identifier_name
package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class
(RPackage): """R Interface to CoreArray Genomic Data Structure (GDS) Files. This package provides a high-level R interface to CoreArray Genomic Data Structure (GDS) data files, which are portable across platforms with hierarchical structure to store multiple scalable array-oriented data ...
RGdsfmt
identifier_name
package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RGdsfmt(RPackage):
version('1.16.0', commit='49b011452585e432b983b68466a230c9b71d8a95') version('1.14.1', commit='15743647b7eea5b82d3284858b4591fb6e59959d') version('1.12.0', commit='d705a95b0bea7be2a2b37e939f45017337ba0fb6') depends_on('r@2.15.0:', type=('build', 'run'))
"""R Interface to CoreArray Genomic Data Structure (GDS) Files. This package provides a high-level R interface to CoreArray Genomic Data Structure (GDS) data files, which are portable across platforms with hierarchical structure to store multiple scalable array-oriented data sets with metad...
identifier_body
package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RGdsfmt(RPackage): """R Interface to CoreArray Genomic Data Structure (GDS) Files. ...
access memory. The gdsfmt package offers the efficient operations specifically designed for integers of less than 8 bits, since a diploid genotype, like single-nucleotide polymorphism (SNP), usually occupies fewer bits than a byte. Data compression and decompression are available with...
especially for data which are much larger than the available random-
random_line_split
rollforward.py
# This file is part of taxtastic. # # taxtastic 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 3 of the License, or # (at your option) any later version. # # taxtastic is distrib...
def action(args): """Roll forward previously rolled back commands on a refpkg. *args* should be an argparse object with fields refpkg (giving the path to the refpkg to operate on) and optionall n (giving the number of operations to roll forward. """ log.info('loading reference package') ...
parser.add_argument('refpkg', action='store', metavar='refpkg', help='the reference package to operate on') parser.add_argument('-n', action='store', metavar='int', default=1, type=int, help='Number of operations to roll back')
identifier_body
rollforward.py
# This file is part of taxtastic. # # taxtastic 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 3 of the License, or # (at your option) any later version. # # taxtastic is distrib...
(args): """Roll forward previously rolled back commands on a refpkg. *args* should be an argparse object with fields refpkg (giving the path to the refpkg to operate on) and optionall n (giving the number of operations to roll forward. """ log.info('loading reference package') r = refpkg.R...
action
identifier_name
rollforward.py
# This file is part of taxtastic. # # taxtastic 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 3 of the License, or # (at your option) any later version. # # taxtastic is distrib...
return 0
r.rollforward()
conditional_block
rollforward.py
# This file is part of taxtastic. # # taxtastic 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 3 of the License, or # (at your option) any later version. # # taxtastic is distrib...
"""Restore a change to a refpkg immediately after being reverted Restore the last ``N`` rolled back operations on ``refpkg``, or the last operation if ``-n`` is omitted. If there are not at least ``N`` operations that can be rolled forward on this refpkg, then an error is returned and no changes are made to the refpk...
# along with taxtastic. If not, see <http://www.gnu.org/licenses/>.
random_line_split
context_singleton.py
# -*- coding: utf-8 -*- ''' Copyright (c) 2013, LastSeal S.A. Copyright (c) 2011-2012, Joaquin G. Duo All rights reserved. This code is distributed under BSD 3-clause License. For details check the LICENSE file in the root of the project. ''' class context_singleton(object): ''' Singleton pattern decorator...
return context.get_config('singleton', self.class_) def smokeTestModule(): from simplerpc.common.context.base import ContextBase class Context(ContextBase): def _loadInitConfig(self): pass ctx = Context('smoke test') @context_singleton class Example(object): def...
context.set_config('singleton', self.class_(context=context, *a, **ad), self.class_)
conditional_block
context_singleton.py
# -*- coding: utf-8 -*- ''' Copyright (c) 2013, LastSeal S.A. Copyright (c) 2011-2012, Joaquin G. Duo All rights reserved. This code is distributed under BSD 3-clause License. For details check the LICENSE file in the root of the project. '''
class context_singleton(object): ''' Singleton pattern decorator. It provides a singleton for a determined class_ in a determined Context. So for each Context there will be only once instance of the decorated class. ''' def __init__(self, class_): self.class_ = class_ def __cal...
random_line_split