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
mtwt.rs
it doesn't yet exist. pub fn with_sctable<T>(op: |&SCTable| -> T) -> T { thread_local!(static SCTABLE_KEY: SCTable = new_sctable_internal()) SCTABLE_KEY.with(|slot| op(slot)) } // Make a fresh syntax context table with EmptyCtxt in slot zero // and IllegalCtxt in slot one. fn new_sctable_internal() -> SCTable...
{ let mut result = Vec::new(); loop { let table = table.table.borrow(); match (*table)[sc as uint] { EmptyCtxt => {return result;}, Mark(mrk,tail) => { result.push(M(mrk)); sc = tail; cont...
identifier_body
multiwindow.rs
*/ extern crate app_units; extern crate euclid; extern crate gleam; extern crate glutin; extern crate webrender; use app_units::Au; use gleam::gl; use glutin::GlContext; use std::fs::File; use std::io::Read; use webrender::api::*; struct
{ events_proxy: glutin::EventsLoopProxy, } impl Notifier { fn new(events_proxy: glutin::EventsLoopProxy) -> Notifier { Notifier { events_proxy } } } impl RenderNotifier for Notifier { fn clone(&self) -> Box<RenderNotifier> { Box::new(Notifier { events_proxy: self.events_pr...
Notifier
identifier_name
multiwindow.rs
extern crate app_units; extern crate euclid; extern crate gleam; extern crate glutin; extern crate webrender; use app_units::Au; use gleam::gl; use glutin::GlContext; use std::fs::File; use std::io::Read; use webrender::api::*; struct Notifier { events_proxy: glutin::EventsLoopProxy, } impl Notifier { fn new...
_ => {} } _ => {} }); if do_exit { return true } let framebuffer_size = { let (width, height) = self.window.get_inner_size().unwrap(); DeviceUintSize::new(width, height) }; let device_pixel_rati...
{ println!("toggle flags {}", my_name); renderer.toggle_debug_flags(webrender::DebugFlags::PROFILER_DBG); }
conditional_block
multiwindow.rs
*/ extern crate app_units; extern crate euclid; extern crate gleam; extern crate glutin; extern crate webrender; use app_units::Au; use gleam::gl; use glutin::GlContext; use std::fs::File; use std::io::Read; use webrender::api::*; struct Notifier { events_proxy: glutin::EventsLoopProxy, } impl Notifier { f...
.with_multitouch() .with_dimensions(800, 600); let window = glutin::GlWindow::new(window_builder, context_builder, &events_loop) .unwrap(); unsafe { window.make_current().ok(); } let gl = match window.get_api() { glutin::Api::...
let window_builder = glutin::WindowBuilder::new() .with_title(name)
random_line_split
multiwindow.rs
extern crate app_units; extern crate euclid; extern crate gleam; extern crate glutin; extern crate webrender; use app_units::Au; use gleam::gl; use glutin::GlContext; use std::fs::File; use std::io::Read; use webrender::api::*; struct Notifier { events_proxy: glutin::EventsLoopProxy, } impl Notifier { fn new...
} fn main() { let mut win1 = Window::new("window1", ColorF::new(0.3, 0.0, 0.0,
{ self.renderer.deinit(); }
identifier_body
main.rs
use crossbeam::crossbeam_channel::unbounded; use log::{debug, error, info}; use serialport::prelude::*; #[cfg(feature = "mqtt")] use standaertha_gateway::mqtt; #[cfg(feature = "webthing")] use standaertha_gateway::webthing; use standaertha_gateway::{ append_crc16, config, slip_encode, Command, CommandType, Package,...
() -> Result<(), Box<dyn std::error::Error + 'static>> { pretty_env_logger::init(); let config = config::read_config()?; let mut services: Vec<Box<dyn Service>> = vec![]; let (sender, recv) = unbounded(); #[cfg(feature = "mqtt")] { let mqtt = mqtt::init(&config, &sender)?; if...
main
identifier_name
main.rs
use crossbeam::crossbeam_channel::unbounded; use log::{debug, error, info}; use serialport::prelude::*; #[cfg(feature = "mqtt")] use standaertha_gateway::mqtt; #[cfg(feature = "webthing")] use standaertha_gateway::webthing; use standaertha_gateway::{ append_crc16, config, slip_encode, Command, CommandType, Package,...
if thing.is_some() { services.push(thing.unwrap()); } } /* thread::spawn(move || { loop { let mut commands = vec![]; let notification = notifications.recv().expect("Error receiving notification"); commands.push(notification); ...
{ pretty_env_logger::init(); let config = config::read_config()?; let mut services: Vec<Box<dyn Service>> = vec![]; let (sender, recv) = unbounded(); #[cfg(feature = "mqtt")] { let mqtt = mqtt::init(&config, &sender)?; if mqtt.is_some() { services.push(mqtt.unwrap...
identifier_body
main.rs
use crossbeam::crossbeam_channel::unbounded;
use standaertha_gateway::mqtt; #[cfg(feature = "webthing")] use standaertha_gateway::webthing; use standaertha_gateway::{ append_crc16, config, slip_encode, Command, CommandType, Package, PackageInputStream, Service, }; use std::io::Read; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::t...
use log::{debug, error, info}; use serialport::prelude::*; #[cfg(feature = "mqtt")]
random_line_split
main.rs
use crossbeam::crossbeam_channel::unbounded; use log::{debug, error, info}; use serialport::prelude::*; #[cfg(feature = "mqtt")] use standaertha_gateway::mqtt; #[cfg(feature = "webthing")] use standaertha_gateway::webthing; use standaertha_gateway::{ append_crc16, config, slip_encode, Command, CommandType, Package,...
}); sender.send(Command::new(CommandType::Refresh, 0)).unwrap(); let mut last_package = None; for p in PackageInputStream::new(input) { match p { Ok(p) => { if p.len() == 36 { let pkg = Package::from_buf(&p[0..36]); debug!("P...
{ let mut cmds = vec![c.raw()]; let now = Instant::now(); let timeout_duration = Duration::from_millis(100); let timeout = now + timeout_duration; let mut remaining = timeout_duration; while let Ok(c) = recv.recv_timeout(remaining) { ...
conditional_block
ViewportManager.ts
/// <reference path="../_references.ts" /> /// <reference path="IViewportManager.ts" /> /// <reference path="ViewBox.ts" /> module Extropy { export class ViewportManager implements IViewportManager, IDisposable { public width; public height; public element: HTMLElement; public ge...
var clientRect = this.element.getBoundingClientRect(); this._unscaledElement.style.top = clientRect.top + "px"; this._unscaledElement.style.left = clientRect.left + "px"; this._unscaledElement.style.width = clientRect.width + "px"; this._unscaledElement.styl...
private _updateSizes(): void { this._viewBox.forceLayout();
random_line_split
ViewportManager.ts
/// <reference path="../_references.ts" /> /// <reference path="IViewportManager.ts" /> /// <reference path="ViewBox.ts" /> module Extropy { export class Vi
mplements IViewportManager, IDisposable { public width; public height; public element: HTMLElement; public get unscaledElement(): HTMLElement { return this._unscaledElement; } private _unscaledElement: HTMLElement; private _viewBox: any; co...
ewportManager i
identifier_name
ViewportManager.ts
/// <reference path="../_references.ts" /> /// <reference path="IViewportManager.ts" /> /// <reference path="ViewBox.ts" /> module Extropy { export class ViewportManager implements IViewportManager, IDisposable { public width; public height; public element: HTMLElement; public ge...
private _unscaledElement: HTMLElement; private _viewBox: any; constructor(width: number, height: number, parentElement: HTMLElement) { var element = document.createElement("div"); var outerElement = document.createElement("div"); PropertyUtility.createRead...
return this._unscaledElement; }
identifier_body
sink-fund.service.ts
import { Injectable } from "@angular/core"; import { Observable, BehaviorSubject } from "rxjs"; import { ApiGateway } from "../../api/api-gateway.service"; import { SinkFundData } from "./sink-fund-data.model"; import { SinkFundTransferData } from "./sink-fund-transfer-data.model"; @Injectable() export class SinkFundS...
(): Observable<SinkFundData> { return this._currentSinkFund$.asObservable(); } refreshSinkFund(currentId: number): void { this.apiGateway .get(`/sink_funds/${currentId}`) .subscribe((sinkFund: SinkFundData) => { this._currentSinkFund$.next(sinkFund); }); } save(sinkFund: Sink...
getCurrent
identifier_name
sink-fund.service.ts
import { Injectable } from "@angular/core"; import { Observable, BehaviorSubject } from "rxjs"; import { ApiGateway } from "../../api/api-gateway.service"; import { SinkFundData } from "./sink-fund-data.model"; import { SinkFundTransferData } from "./sink-fund-transfer-data.model"; @Injectable() export class SinkFundS...
.subscribe((sinkFund: SinkFundData) => { this._currentSinkFund$.next(sinkFund); }); } save(sinkFund: SinkFundData): Observable<SinkFundData> { return this.apiGateway.put(`/sink_funds/${sinkFund.id}`, sinkFund); } transfer( sinkFund: SinkFundData, transferData: SinkFundTransferD...
.get(`/sink_funds/${currentId}`)
random_line_split
sink-fund.service.ts
import { Injectable } from "@angular/core"; import { Observable, BehaviorSubject } from "rxjs"; import { ApiGateway } from "../../api/api-gateway.service"; import { SinkFundData } from "./sink-fund-data.model"; import { SinkFundTransferData } from "./sink-fund-transfer-data.model"; @Injectable() export class SinkFundS...
getCurrent(): Observable<SinkFundData> { return this._currentSinkFund$.asObservable(); } refreshSinkFund(currentId: number): void { this.apiGateway .get(`/sink_funds/${currentId}`) .subscribe((sinkFund: SinkFundData) => { this._currentSinkFund$.next(sinkFund); }); } save(...
{ return this.apiGateway.get("/sink_funds"); }
identifier_body
validationProvider.ts
ls.loadMessageBundle(); export class LineDecoder { private stringDecoder: NodeStringDecoder; private remaining: string | null; constructor(encoding: string = 'utf8') { this.stringDecoder = new StringDecoder(encoding); this.remaining = null; } public
(buffer: NodeBuffer): string[] { var result: string[] = []; var value = this.remaining ? this.remaining + this.stringDecoder.write(buffer) : this.stringDecoder.write(buffer); if (value.length < 1) { return result; } var start = 0; var ch: number; while (start < value.length && ((ch = value.charC...
write
identifier_name
validationProvider.ts
&& ((ch = value.charCodeAt(idx)) === 13 || ch === 10)) { idx++; } start = idx; } else { idx++; } } this.remaining = start < value.length ? value.substr(start) : null; return result; } public end(): string | null { return this.remaining; } } enum RunTrigger { onSave, onType } name...
{ message = error.message ? error.message : localize('unknownReason', 'Failed to run php using path: {0}. Reason is unknown.', executable); }
conditional_block
validationProvider.ts
idx++; } start = idx; } else { idx++; } } this.remaining = start < value.length ? value.substr(start) : null; return result; } public end(): string | null { return this.remaining; } } enum RunTrigger { onSave, onType } namespace RunTrigger { export let strings = { onSave: 'onSave',...
}
random_line_split
ckeditor__ckeditor5-easy-image-tests.ts
import { Editor } from "@ckeditor/ckeditor5-core"; import { ExportWord } from "@ckeditor/ckeditor5-export-word"; import { ExportWordConfig } from "@ckeditor/ckeditor5-export-word/src/exportword"; class MyEditor extends Editor {} const bool: boolean = ExportWord.isContextPlugin;
let config: ExportWordConfig = {}; config = { converterOptions: {}, }; config = { converterOptions: { margin_top: 0, margin_bottom: "15cm", margin_right: "1cm", margin_left: 0, format: "A6", auto_pagination: bool, }, }; config = { converterUrl: "", fi...
const plugin = new ExportWord(new MyEditor()); const promise = plugin.destroy?.(); if (promise != null) { promise.then(() => {}); }
random_line_split
ckeditor__ckeditor5-easy-image-tests.ts
import { Editor } from "@ckeditor/ckeditor5-core"; import { ExportWord } from "@ckeditor/ckeditor5-export-word"; import { ExportWordConfig } from "@ckeditor/ckeditor5-export-word/src/exportword"; class MyEditor extends Editor {} const bool: boolean = ExportWord.isContextPlugin; const plugin = new ExportWord(new MyEdi...
let config: ExportWordConfig = {}; config = { converterOptions: {}, }; config = { converterOptions: { margin_top: 0, margin_bottom: "15cm", margin_right: "1cm", margin_left: 0, format: "A6", auto_pagination: bool, }, }; config = { converterUrl: "", f...
{ promise.then(() => {}); }
conditional_block
ckeditor__ckeditor5-easy-image-tests.ts
import { Editor } from "@ckeditor/ckeditor5-core"; import { ExportWord } from "@ckeditor/ckeditor5-export-word"; import { ExportWordConfig } from "@ckeditor/ckeditor5-export-word/src/exportword"; class MyEditor extends Editor {} const bool: boolean = ExportWord.isContextPlugin; const plugin = new ExportWord(new MyEdi...
, }; config = { tokenUrl: "", };
{ return Promise.resolve(""); }
identifier_body
ckeditor__ckeditor5-easy-image-tests.ts
import { Editor } from "@ckeditor/ckeditor5-core"; import { ExportWord } from "@ckeditor/ckeditor5-export-word"; import { ExportWordConfig } from "@ckeditor/ckeditor5-export-word/src/exportword"; class
extends Editor {} const bool: boolean = ExportWord.isContextPlugin; const plugin = new ExportWord(new MyEditor()); const promise = plugin.destroy?.(); if (promise != null) { promise.then(() => {}); } let config: ExportWordConfig = {}; config = { converterOptions: {}, }; config = { converterOptions: { ...
MyEditor
identifier_name
IssuesSubView.js
/* * Copyright (c) 2014 DataTorrent, Inc. 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 required by...
initialize: function(options) { this.collection = new DT.lib.ConfigIssueCollection([]); this.fetchPromise = this.collection.fetch(); this.fetchPromise.always(this.render.bind(this)); }, render: function() { var json = { fetchState: this.fetchPromise.state(), ...
var IssuesSubView = BaseView.extend({
random_line_split
service.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #import modułów konektora msg_stream_connector from ComssServiceDevelopment.connectors.tcp.msg_stream_connector import InputMessageConnector, OutputMessageConnector #import modułów klasy bazowej Service oraz kontrolera usługi from ComssServiceDevelopment.service import Ser...
"""deklaracja wyjść""" #deklaracja wyjścia "videoOutput" będącego interfejsem #wyjściowym konektora msg_stream_connector self.declare_output("videoOutput", OutputMessageConnector(self)) def declare_inputs(self): """deklaracja wejść""" #deklaracja wejścia "videoInput" bę...
uts(self):
identifier_name
service.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #import modułów konektora msg_stream_connector from ComssServiceDevelopment.connectors.tcp.msg_stream_connector import InputMessageConnector, OutputMessageConnector #import modułów klasy bazowej Service oraz kontrolera usługi from ComssServiceDevelopment.service import Ser...
#utworzenie obiektu kontrolera usługi config_name = os.path.join( os.path.dirname(__file__), "service.json") # f.e. src\mark_frame_service\service.json sc = ServiceController(MarkFrameService, config_name) sc.start() #uruchomienie usługi
cv2.rectangle(overlay,(0,0),(int(width*SIZE),int(height*SIZE)),(255,0,0),-1) cv2.addWeighted(overlay, OPACITY, frame, 1 - OPACITY, 0, frame) if __name__=="__main__":
random_line_split
service.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #import modułów konektora msg_stream_connector from ComssServiceDevelopment.connectors.tcp.msg_stream_connector import InputMessageConnector, OutputMessageConnector #import modułów klasy bazowej Service oraz kontrolera usługi from ComssServiceDevelopment.service import Ser...
): height, width, _ = frame.shape overlay = frame.copy() cv2.rectangle(overlay,(0,0),(int(width*SIZE),int(height*SIZE)),(255,0,0),-1) cv2.addWeighted(overlay, OPACITY, frame, 1 - OPACITY, 0, frame) if __name__=="__main__": #utworzenie obiektu kontrolera usługi config_name = os....
odebranie danych z interfejsu wejściowego frame = np.loads(frame_obj) #załadowanie ramki do obiektu NumPy # filters time_now = time() with self.filters_lock: current_filters = self.get_parameter("filtersOn") if 1 in current_fil...
conditional_block
service.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #import modułów konektora msg_stream_connector from ComssServiceDevelopment.connectors.tcp.msg_stream_connector import InputMessageConnector, OutputMessageConnector #import modułów klasy bazowej Service oraz kontrolera usługi from ComssServiceDevelopment.service import Ser...
"""główna metoda usługi""" video_input = self.get_input("videoInput") #obiekt interfejsu wejściowego video_output = self.get_output("videoOutput") #obiekt interfejsu wyjściowego #pętla główna usługi while self.running(): frame_obj = video_input.read() #odebranie danyc...
ć""" #deklaracja wejścia "videoInput" będącego interfejsem wyjściowym konektora msg_stream_connector self.declare_input("videoInput", InputMessageConnector(self)) def run(self):
identifier_body
x-large.directive.spec.ts
import { By } from '@angular/platform-browser'; import { inject, fakeAsync, tick, async, TestBed, ComponentFixture, getTestBed } from '@angular/core/testing'; import { Component } from '@angular/core'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
* Load the implementations that should be tested. */ import { XLargeDirective } from './x-large.directive'; describe('x-large directive', () => { /** * Create a test component to test directives. */ @Component({ template: '<div x-large>Content</div>' }) class TestComponent { } beforeEach(() => {...
/**
random_line_split
x-large.directive.spec.ts
import { By } from '@angular/platform-browser'; import { inject, fakeAsync, tick, async, TestBed, ComponentFixture, getTestBed } from '@angular/core/testing'; import { Component } from '@angular/core'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; /** * L...
{ } beforeEach(() => { TestBed.configureTestingModule({ declarations: [ XLargeDirective, TestComponent ] }); }); it('should sent font-size to x-large', fakeAsync(() => { TestBed.compileComponents().then(() => { const fixture = TestBed.createComponent(TestComponent...
TestComponent
identifier_name
alb.d.ts
import { Handler, Callback } from "../handler"; export type ALBHandler = Handler<ALBEvent, ALBResult>; export type ALBCallback = Callback<ALBResult>;
export interface ALBEventRequestContext { elb: { targetGroupArn: string; }; } export interface ALBEventQueryStringParameters { [name: string]: string | undefined; } export interface ALBEventHeaders { [name: string]: string | undefined; } export interface ALBEventMultiValueHeaders { [name:...
// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html
random_line_split
houses.py
import math class Point(object): X = 0 Y = 0 def __init__(self, x, y): self.X = x self.Y = y def getX(self): return self.X def
(self): return self.Y def __str__(self): return "Point(%s,%s)" % (self.X, self.Y) def __eq__(self, other): return self.X == other.X and self.Y == other.Y def move_left(self): self.X = self.X - 1 return None def move_up(self): self.Y = self.Y - 1 ...
getY
identifier_name
houses.py
import math class Point(object): X = 0 Y = 0 def __init__(self, x, y): self.X = x self.Y = y def getX(self): return self.X def getY(self): return self.Y def __str__(self): return "Point(%s,%s)" % (self.X, self.Y) def __eq__(self, other): ...
origin.move_bottom() trail.extend(origin) print "Number of houses visited once : " + str(trail.getHousesCountVisitedOnce()) if __name__ == "__main__": main()
origin = Point(0,0) # Where Santa starts it's run. trail = Trail() # The gifts delivery trail. trail.extend(origin) with open('data.txt') as f: for c in f.read(): if c == "<": origin = Point(origin.X, origin.Y) origin.move_left() trail.ext...
identifier_body
houses.py
import math class Point(object): X = 0 Y = 0 def __init__(self, x, y): self.X = x self.Y = y def getX(self): return self.X def getY(self): return self.Y def __str__(self): return "Point(%s,%s)" % (self.X, self.Y) def __eq__(self, other): ...
return len(uniquePoints) def main(): # # Entry point # origin = Point(0,0) # Where Santa starts it's run. trail = Trail() # The gifts delivery trail. trail.extend(origin) with open('data.txt') as f: for c in f.read(): if c == "<": origin = Poi...
uniquePoints.append(point1)
conditional_block
houses.py
import math class Point(object): X = 0 Y = 0 def __init__(self, x, y): self.X = x self.Y = y def getX(self): return self.X def getY(self): return self.Y def __str__(self): return "Point(%s,%s)" % (self.X, self.Y) def __eq__(self, other): ...
with open('data.txt') as f: for c in f.read(): if c == "<": origin = Point(origin.X, origin.Y) origin.move_left() trail.extend(origin) elif c == "^": origin = Point(origin.X, origin.Y) origin.move_up() ...
random_line_split
website.py
# -*- coding: utf-8 -*- # © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from openerp import api, models class WebsiteMenu(models.Model): _inherit = "website.menu" @api.multi
def get_parents(self, revert=False, include_self=False): """List current menu's parents. :param bool revert: Indicates if the result must be revert before returning. Activating this will mean that the result will be ordered from parent to child. :param b...
random_line_split
website.py
# -*- coding: utf-8 -*- # © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from openerp import api, models class We
odels.Model): _inherit = "website.menu" @api.multi def get_parents(self, revert=False, include_self=False): """List current menu's parents. :param bool revert: Indicates if the result must be revert before returning. Activating this will mean that the result will be...
bsiteMenu(m
identifier_name
website.py
# -*- coding: utf-8 -*- # © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from openerp import api, models class WebsiteMenu(models.Model): _inherit = "website.menu" @api.multi def get_parents(self, revert=False, inclu...
"List current menu's parents. :param bool revert: Indicates if the result must be revert before returning. Activating this will mean that the result will be ordered from parent to child. :param bool include_self: Indicates if the current menu item must b...
identifier_body
website.py
# -*- coding: utf-8 -*- # © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from openerp import api, models class WebsiteMenu(models.Model): _inherit = "website.menu" @api.multi def get_parents(self, revert=False, inclu...
return reversed(result) if revert else result
sult.append(menu) menu = menu.parent_id
conditional_block
Tooltip.stories.tsx
/* MIT License Copyright (c) 2022 Looker Data Sciences, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modi...
(e: FormEvent<HTMLInputElement>) { setPrevent(e.currentTarget.checked) } const [lastEvent, setLastEvent] = useState('N/A') const getHandler = (text: string) => (e: SyntheticEvent) => { setLastEvent(text) if (prevent) { e.preventDefault() } } const handlers = { onBlur: getHandler('b...
handleChange
identifier_name
Tooltip.stories.tsx
/* MIT License Copyright (c) 2022 Looker Data Sciences, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modi...
const [lastEvent, setLastEvent] = useState('N/A') const getHandler = (text: string) => (e: SyntheticEvent) => { setLastEvent(text) if (prevent) { e.preventDefault() } } const handlers = { onBlur: getHandler('blur'), onClick: getHandler('click'), onFocus: getHandler('focus'), ...
{ setPrevent(e.currentTarget.checked) }
identifier_body
Tooltip.stories.tsx
/* MIT License Copyright (c) 2022 Looker Data Sciences, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modi...
argTypes, component: Tooltip, title: 'Tooltip', }
export default {
random_line_split
Tooltip.stories.tsx
/* MIT License Copyright (c) 2022 Looker Data Sciences, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modi...
} const handlers = { onBlur: getHandler('blur'), onClick: getHandler('click'), onFocus: getHandler('focus'), onMouseOut: getHandler('mouse out'), onMouseOver: getHandler('mouse over'), } return ( <SpaceVertical p="u5"> <Text>Last event: {lastEvent}</Text> <Space> <...
{ e.preventDefault() }
conditional_block
server.py
import web from pycryptics.solve_clue import CrypticClueSolver, split_clue_text import webbrowser import re # from fake_solve_clue import FakeCrypticClueSolver as CrypticClueSolver # from fake_solve_clue import split_clue_text SERVER = "http://localhost:8080/solve/" class index: def GET(self): return rend...
print "returning:", answers return render.solver(answers, solver.clue_text, "") else: return render.solver(None, "", "") # class halt: # def POST(self): # print "trying to halt" # solver.stop() # raise web.seeother('/') if __name__ == '__main__...
def GET(self, clue): clue = clue.strip() if clue != "": if not re.match(r"[^\(\)]*\([0-9]+ *[,[0-9 ]*]*\)[ \.a-zA-Z]*", clue): return render.solver(None, clue, "I don't quite understand the formatting of that clue. Please make sure that the clue is of the form: <br>clue text ...
identifier_body
server.py
import web from pycryptics.solve_clue import CrypticClueSolver, split_clue_text import webbrowser import re # from fake_solve_clue import FakeCrypticClueSolver as CrypticClueSolver # from fake_solve_clue import split_clue_text SERVER = "http://localhost:8080/solve/" class index: def GET(self): return rend...
try: phrases, lengths, pattern, answer = split_clue_text(clue) if sum(lengths) != len(pattern) and pattern != '': print "length mismatch" return render.solver(None, clue, "The length of the pattern must exactly match the number of lett...
return render.solver(None, clue, "I don't quite understand the formatting of that clue. Please make sure that the clue is of the form: <br>clue text (length)<br>or<br>clue text (length) pattern<br> as in the examples above.")
conditional_block
server.py
import web from pycryptics.solve_clue import CrypticClueSolver, split_clue_text import webbrowser import re # from fake_solve_clue import FakeCrypticClueSolver as CrypticClueSolver # from fake_solve_clue import split_clue_text SERVER = "http://localhost:8080/solve/" class index: def GET(self): return rend...
print "Shutting down...."
random_line_split
server.py
import web from pycryptics.solve_clue import CrypticClueSolver, split_clue_text import webbrowser import re # from fake_solve_clue import FakeCrypticClueSolver as CrypticClueSolver # from fake_solve_clue import split_clue_text SERVER = "http://localhost:8080/solve/" class index: def GET(self): return rend...
(self, clue): clue = clue.strip() if clue != "": if not re.match(r"[^\(\)]*\([0-9]+ *[,[0-9 ]*]*\)[ \.a-zA-Z]*", clue): return render.solver(None, clue, "I don't quite understand the formatting of that clue. Please make sure that the clue is of the form: <br>clue text (length...
GET
identifier_name
index.js
/** * @fileoverview Defines compressors utility methods. * * @see https://google.github.io/styleguide/javascriptguide.xml * @see https://developers.google.com/closure/compiler/docs/js-for-compiler * @module glize/compressors */ import * as lzw from 'lzw-compressor'; /** * Enumeration of available compression t...
rn result; };
conditional_block
index.js
/** * @fileoverview Defines compressors utility methods. * * @see https://google.github.io/styleguide/javascriptguide.xml * @see https://developers.google.com/closure/compiler/docs/js-for-compiler * @module glize/compressors */ import * as lzw from 'lzw-compressor'; /** * Enumeration of available compression t...
* @return {string} Returns compressed data. * @method * @example * const result = compress( * 'Any string of any length. Any string of any length. Any string of any length.'); * console.log(result); * //> Any string of aā leĈth. ĀĂĄĆĈĊČĎĂđēĕėďĚćĉċčďġgĔ. */ export const compress = (data, opt_type = TYPE.LZW) =...
/** * Compress data string using specified compression type. * @param {string} data Data to compress. * @param {string=} [opt_type=TYPE.LZW] Optional compression type.
random_line_split
index.ts
import {flags} from '@heroku-cli/command' import {cli} from 'cli-ux' import BaseCommand from '../../../base' export default class EventsIndex extends BaseCommand { static description = 'list webhook events on an app' static examples = [ '$ heroku webhooks:events', ] static flags = { app: flags.app()...
} }
{ events.sort((a: any, b: any) => Date.parse(a.created_at) - Date.parse(b.created_at)) cli.table(events, { id: { header: 'Event ID', }, resource: { get: (w: any) => w.payload.resource, }, action: { get: (w: any) => w.payload.action, ...
conditional_block
index.ts
import {flags} from '@heroku-cli/command' import {cli} from 'cli-ux' import BaseCommand from '../../../base' export default class EventsIndex extends BaseCommand { static description = 'list webhook events on an app' static examples = [ '$ heroku webhooks:events', ] static flags = { app: flags.app()...
const {flags} = this.parse(EventsIndex) const {path, display} = this.webhookType(flags) cli.warn('heroku webhooks:event is deprecated, please use heroku webhooks:deliveries') const {body: events} = await this.webhooksClient.get(`${path}/webhook-events`) if (events.length === 0) { this.log(`...
} async run() {
random_line_split
index.ts
import {flags} from '@heroku-cli/command' import {cli} from 'cli-ux' import BaseCommand from '../../../base' export default class
extends BaseCommand { static description = 'list webhook events on an app' static examples = [ '$ heroku webhooks:events', ] static flags = { app: flags.app(), remote: flags.remote(), pipeline: flags.pipeline({char: 'p', description: 'pipeline on which to list', hidden: true}), } async r...
EventsIndex
identifier_name
MentorsTableSeederinitial.js
/*global NULL*/ 'use strict'; var sha1 = require('sha1'); module.exports = { up: function (queryInterface, Sequelize) { return queryInterface.bulkInsert('Mentors', [{ nameFirst: 'Betty', nameLast: 'Coder', email: 'betty@coderevolution.com', password: sha1('password'), githu...
password: sha1('password'), githubLink: 'http://github.com/djackson', skillSet1: 'mean', skillLevel1: 3, bio:'I have been a developer for ten years. I am passionate about learning new technologies.', userWebLink:'http://comecodewithme.code', mentorRating:3...
nameLast: 'Jackson', email: 'taylor@coderevolution.com',
random_line_split
coherence-pair-covered-uncovered-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<T>(T); impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { } //~^ ERROR type parameter `T` must be used as the type parameter for some local type fn main() { }
Local
identifier_name
coherence-pair-covered-uncovered-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn main() { }
random_line_split
coherence-pair-covered-uncovered-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ }
identifier_body
static_lifetime.rs
// Make a constant with `'static` lifetime. static NUM: i32 = 18; // Returns a reference to `NUM` where its `'static` // lifetime is coerced to that of the input argument. fn coerce_static<'a>(_: &'a i32) -> &'a i32 { &NUM } fn main() { { // Make a `string` literal and print it: let static_st...
let coerced_static = coerce_static(&lifetime_num); println!("coerced_static: {}", coerced_static); } println!("NUM: {} stays accessible!", NUM); }
let lifetime_num = 9; // Coerce `NUM` to lifetime of `lifetime_num`:
random_line_split
static_lifetime.rs
// Make a constant with `'static` lifetime. static NUM: i32 = 18; // Returns a reference to `NUM` where its `'static` // lifetime is coerced to that of the input argument. fn coerce_static<'a>(_: &'a i32) -> &'a i32 { &NUM } fn
() { { // Make a `string` literal and print it: let static_string = "I'm in read-only memory"; println!("static_string: {}", static_string); // When `static_string` goes out of scope, the reference // can no longer be used, but the data remains in the binary. } ...
main
identifier_name
static_lifetime.rs
// Make a constant with `'static` lifetime. static NUM: i32 = 18; // Returns a reference to `NUM` where its `'static` // lifetime is coerced to that of the input argument. fn coerce_static<'a>(_: &'a i32) -> &'a i32
fn main() { { // Make a `string` literal and print it: let static_string = "I'm in read-only memory"; println!("static_string: {}", static_string); // When `static_string` goes out of scope, the reference // can no longer be used, but the data remains in the binary. } ...
{ &NUM }
identifier_body
metric-spec.spec.ts
/* * 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 ...
]); }); it('works with csv', () => { expect(getMetricSpecs(JSON_SAMPLE, {}, true)).toEqual([ { name: 'count', type: 'count', }, { fieldName: 'followers', name: 'sum_followers', type: 'longSum', }, { ...
type: 'doubleSum', },
random_line_split
fr-MR.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; fun...
export default [ 'fr-MR', [['AM', 'PM'], u, u], u, [ ['D', 'L', 'M', 'M', 'J', 'V', 'S'], ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'], ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'], ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'] ], u, [ ['J', 'F', 'M'...
{ let i = Math.floor(Math.abs(n)); if (i === 0 || i === 1) return 1; return 5; }
identifier_body
fr-MR.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; fun...
(n: number): number { let i = Math.floor(Math.abs(n)); if (i === 0 || i === 1) return 1; return 5; } export default [ 'fr-MR', [['AM', 'PM'], u, u], u, [ ['D', 'L', 'M', 'M', 'J', 'V', 'S'], ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'], ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeud...
plural
identifier_name
fr-MR.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */
// See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; function plural(n: number): number { let i = Math.floor(Math.abs(n)); if (i === 0 || i === 1) return 1; return 5; } export default [ 'fr-MR', [['AM', 'PM'], u, u], u, [ ['D', 'L', 'M', 'M', 'J', 'V', 'S'], ['dim.', 'lun.', 'mar.',...
// THIS CODE IS GENERATED - DO NOT MODIFY
random_line_split
cropsl.py
#!/usr/bin/env python '''You can easily read off two sample,line coordinates from qview, but ISIS crop wants one sample,line and then offsets. This just takes two coordinates, does the math, and then calls crop.''' # Copyright 2016, 2019, Ross A. Beyer (rbeyer@seti.org) # # Licensed under the Apache License, Version ...
sys.exit(main())
conditional_block
cropsl.py
#!/usr/bin/env python '''You can easily read off two sample,line coordinates from qview, but ISIS crop wants one sample,line and then offsets. This just takes two coordinates, does the math, and then calls crop.''' # Copyright 2016, 2019, Ross A. Beyer (rbeyer@seti.org) # # Licensed under the Apache License, Version ...
(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-o', '--output', help="The output filename.") parser.add_argument('-f', '--first', help='The sample and line of the first point, ' 'separated by a colon, like -f 3:10') parser.a...
main
identifier_name
cropsl.py
#!/usr/bin/env python '''You can easily read off two sample,line coordinates from qview, but ISIS crop wants one sample,line and then offsets. This just takes two coordinates, does the math, and then calls crop.''' # Copyright 2016, 2019, Ross A. Beyer (rbeyer@seti.org) # # Licensed under the Apache License, Version ...
print(crop(in_p, out_p, samp, line, nsamp, nline).args) if(args.output): # If there's a specific output filename, only do one. break if __name__ == "__main__": sys.exit(main())
parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-o', '--output', help="The output filename.") parser.add_argument('-f', '--first', help='The sample and line of the first point, ' 'separated by a colon, like -f 3:10') parser.add_argum...
identifier_body
cropsl.py
#!/usr/bin/env python '''You can easily read off two sample,line coordinates from qview, but ISIS crop wants one sample,line and then offsets. This just takes two coordinates, does the math, and then calls crop.''' # Copyright 2016, 2019, Ross A. Beyer (rbeyer@seti.org) # # Licensed under the Apache License, Version ...
# If there's a specific output filename, only do one. break if __name__ == "__main__": sys.exit(main())
if(args.output):
random_line_split
service.py
from spacyThrift import SpacyThrift from spacyThrift.ttypes import Token from spacy.en import English from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.server import TServer import logging class Handler: def __init__(self, nlp): ...
handler = Handler(nlp) processor = SpacyThrift.Processor(handler) transport = TSocket.TServerSocket(port=9090) tfactory = TTransport.TBufferedTransportFactory() pfactory = TBinaryProtocol.TBinaryProtocolFactory() server = TServer.TThreadedServer(processor, transport, tfactory, pfactory) log...
logger.info("Loading ...") nlp = English(parser=False, tagger=True, entity=False)
random_line_split
service.py
from spacyThrift import SpacyThrift from spacyThrift.ttypes import Token from spacy.en import English from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.server import TServer import logging class Handler: def __init__(self, nlp): ...
if __name__ == '__main__': logging.basicConfig() logger = logging.getLogger() logger.info("Loading ...") nlp = English(parser=False, tagger=True, entity=False) handler = Handler(nlp) processor = SpacyThrift.Processor(handler) transport = TSocket.TServerSocket(port=9090) tfactory = TT...
document = nlp(sentence, parse=False, entity=False) return [Token(element.orth_, element.tag_, element.lemma_) for element in document]
identifier_body
service.py
from spacyThrift import SpacyThrift from spacyThrift.ttypes import Token from spacy.en import English from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.server import TServer import logging class Handler: def __init__(self, nlp): ...
logging.basicConfig() logger = logging.getLogger() logger.info("Loading ...") nlp = English(parser=False, tagger=True, entity=False) handler = Handler(nlp) processor = SpacyThrift.Processor(handler) transport = TSocket.TServerSocket(port=9090) tfactory = TTransport.TBufferedTransportFactor...
conditional_block
service.py
from spacyThrift import SpacyThrift from spacyThrift.ttypes import Token from spacy.en import English from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.server import TServer import logging class
: def __init__(self, nlp): self.nlp = nlp def tag(self, sentence): document = nlp(sentence, parse=False, entity=False) return [Token(element.orth_, element.tag_, element.lemma_) for element in document] if __name__ == '__main__': logging.basicConfig() logger = l...
Handler
identifier_name
many_many_relation.py
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Table from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship # demo many to many relationship # http://docs.sqlalchemy.org/en/rel_0_9/orm/basic_relationships.html#many-to-many engine = cre...
(self, name): self.name = name # create tables Base.metadata.create_all(engine) # create a Session Session = sessionmaker(bind=engine) session = Session() # Populate member1 = Member('John', 'Doe') club1 = Club('Club dub') club1.members.append(member1) session.add(club1) club2 = Club('Club dub dub') club2.me...
__init__
identifier_name
many_many_relation.py
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Table from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship # demo many to many relationship # http://docs.sqlalchemy.org/en/rel_0_9/orm/basic_relationships.html#many-to-many engine = cre...
class Club(Base): __tablename__ = 'club' id = Column(Integer, primary_key=True) name = Column(String) members = relationship('Member', back_populates='clubs', secondary=member_club_mapping) def __init__(self, name): self.name = name # create tables Base.metadat...
self.first_name = first_name self.last_name = last_name
identifier_body
many_many_relation.py
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Table from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship # demo many to many relationship # http://docs.sqlalchemy.org/en/rel_0_9/orm/basic_relationships.html#many-to-many engine = cre...
clubs = relationship('Club', back_populates='members', secondary=member_club_mapping) def __init__(self, first_name, last_name): self.first_name = first_name self.last_name = last_name class Club(Base): __tablename__ = 'club' id = Column(Integer, primary_key=Tr...
id = Column(Integer, primary_key=True) first_name = Column(String) last_name = Column(String)
random_line_split
many_many_relation.py
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Table from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship # demo many to many relationship # http://docs.sqlalchemy.org/en/rel_0_9/orm/basic_relationships.html#many-to-many engine = cre...
print club.name, [(member.first_name, member.last_name) for member in club.members]
conditional_block
slice_visualization_ui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'slice_visualization.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class
(object): def setupUi(self, slice_visualization_gui): slice_visualization_gui.setObjectName("slice_visualization_gui") slice_visualization_gui.resize(800, 600) self.centralwidget = QtWidgets.QWidget(slice_visualization_gui) self.centralwidget.setObjectName("centralwidget") sl...
Ui_slice_visualization_gui
identifier_name
slice_visualization_ui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'slice_visualization.ui' # # Created by: PyQt5 UI code generator 5.6
# # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_slice_visualization_gui(object): def setupUi(self, slice_visualization_gui): slice_visualization_gui.setObjectName("slice_visualization_gui") slice_visualization_gui.resize(800, 600) ...
random_line_split
slice_visualization_ui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'slice_visualization.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_slice_visualization_gui(object): def setupUi(self, slice_v...
_translate = QtCore.QCoreApplication.translate slice_visualization_gui.setWindowTitle(_translate("slice_visualization_gui", "MainWindow"))
identifier_body
phase.py
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # kaizen - Continuously improve, build and manage free software # # Copyright (C) 2011 Björn Ricks <bjoern.ricks@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as publishe...
Exception): def __init__(self, name): self.name = name def __str__(self): return "Phase '%s' does not exist." % (self.name) class Phase(object): def __init__(self, name, value): self.value = value self.name = name def __cmp__(self, other): if self.value < ot...
nknownPhaseError(
identifier_name
phase.py
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # kaizen - Continuously improve, build and manage free software # # Copyright (C) 2011 Björn Ricks <bjoern.ricks@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as publishe...
if self.value > other.value: return 1 def __eq__(self, other): if not isinstance(other, Phase): return False return self.value == other.value def __neq__(self, other): return not self.__eq__(other) def __hash__(self): return self.value ...
eturn 0
conditional_block
phase.py
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # kaizen - Continuously improve, build and manage free software # # Copyright (C) 2011 Björn Ricks <bjoern.ricks@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as publishe...
phases_list = Phases()
ef __init__(self): self.phases = dict() self.phase_names = [ NONE, DOWNLOADED, EXTRACTED, PATCHED, CONFIGURED, BUILT, ...
identifier_body
phase.py
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # kaizen - Continuously improve, build and manage free software # # Copyright (C) 2011 Björn Ricks <bjoern.ricks@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as publishe...
EXTRACTED, PATCHED, CONFIGURED, BUILT, DESTROOTED, ACTIVATED, ] for i, name in enumerate(self.phase_names): ...
NONE, DOWNLOADED,
random_line_split
etext.js
'use strict'; var vkey = require('vkey'); var fromUnicode = require('./utext').fromUnicode; // map virtual key to Unicode corresponding to trit-text, with modifiers var _keymap = { // vkey: normal, shifted, control, shift-control A: ['a', 'A', '☺', ''], B: ['b', 'B', '☻', ''], C: ['c', 'C', '♥', ''], D: ['d...
lags = (ev.shiftKey ? 1 : 0) + (ev.ctrlKey ? 2 : 0); // TODO: metaKey(cmd)? altKey(opt)? var varChars = _keymap[vkeyChar]; if (!varChars) return null; if (varChars[flags] === '' && flags === 3) flags = 2; // no shift-control variant, try control if (varChars[flags] === '' && flags === 2) flags = 0; // no cont...
identifier_body
etext.js
'use strict'; var vkey = require('vkey'); var fromUnicode = require('./utext').fromUnicode; // map virtual key to Unicode corresponding to trit-text, with modifiers var _keymap = { // vkey: normal, shifted, control, shift-control A: ['a', 'A', '☺', ''], B: ['b', 'B', '☻', ''], C: ['c', 'C', '♥', ''], D: ['d...
var flags = (ev.shiftKey ? 1 : 0) + (ev.ctrlKey ? 2 : 0); // TODO: metaKey(cmd)? altKey(opt)? var varChars = _keymap[vkeyChar]; if (!varChars) return null; if (varChars[flags] === '' && flags === 3) flags = 2; // no shift-control variant, try control if (varChars[flags] === '' && flags === 2) flags = 0; // no...
ode];
identifier_name
etext.js
'use strict'; var vkey = require('vkey'); var fromUnicode = require('./utext').fromUnicode; // map virtual key to Unicode corresponding to trit-text, with modifiers var _keymap = { // vkey: normal, shifted, control, shift-control A: ['a', 'A', '☺', ''], B: ['b', 'B', '☻', ''], C: ['c', 'C', '♥', ''], D: ['d...
Q: ['q', 'Q', '', ''], R: ['r', 'R', '', ''], S: ['s', 'S', '', ''], T: ['t', 'T', '', ''], U: ['u', 'U', '', ''], V: ['v', 'V', '', ''], W: ['w', 'W', '', ''], X: ['x', 'X', '≈', ''], Y: ['y', 'Y', '', ''], Z: ['z', 'Z', '', ''], '`': ['`', '~', '', ''], 1: ['1', '!', '', ''], 2: ['2', '@', ...
L: ['l', 'L', '▒', ''], M: ['m', 'M', '←', ''], N: ['n', 'N', '→', ''], O: ['o', 'O', '↑', ''], P: ['p', 'P', '↓', ''],
random_line_split
model-page.component.ts
import { Component, OnInit, Input } from '@angular/core'; import { ActivatedRoute, Params } from '@angular/router'; import { Location } from '@angular/common'; import 'rxjs/add/operator/switchMap'; import { AdminDataService } from '../admin-data.service'; import {ModelService} from '../model.service...
this.adminDataService.getAdminInfo().then(adminData => { this.route.params.switchMap((params: Params)=>[params['modelName']]). subscribe(modelName=>{ this.modelInfo = adminData.find(row =>row.name===modelName); this.modelName = this.modelInfo['name']; this.model...
@Input() modelInfo = {}; formInfo = {method:'post', id:''}; getData() :void {
random_line_split
model-page.component.ts
import { Component, OnInit, Input } from '@angular/core'; import { ActivatedRoute, Params } from '@angular/router'; import { Location } from '@angular/common'; import 'rxjs/add/operator/switchMap'; import { AdminDataService } from '../admin-data.service'; import {ModelService} from '../model.service...
else { obj[pf].val = md[pf]; } } console.log(obj); } }
{ obj[pf].val = ''; obj[pf].vallist = md[pf]; }
conditional_block
model-page.component.ts
import { Component, OnInit, Input } from '@angular/core'; import { ActivatedRoute, Params } from '@angular/router'; import { Location } from '@angular/common'; import 'rxjs/add/operator/switchMap'; import { AdminDataService } from '../admin-data.service'; import {ModelService} from '../model.service...
implements OnInit { constructor( private adminDataService : AdminDataService, private modelService : ModelService, private route: ActivatedRoute, private location: Location ) { } modelData = []; modelD = ''; modelName = ''; @Input() modelInfo = {}; formInfo = {method:'p...
ModelPageComponent
identifier_name
LogicalOperator.py
''' Created on Apr 20, 2011 @author: michel ''' import os from lxml import etree from FeatureServer.WebFeatureService.FilterEncoding.Operator import Operator class LogicalOperator(Operator): def __init__(self, node):
def createStatement(self, datasource, operatorList): logical = self.addOperators(operatorList) xslt = etree.parse(os.path.dirname(os.path.abspath(__file__))+"/../../../../resources/filterencoding/logical_operators.xsl") transform = etree.XSLT(xslt) result =...
super(LogicalOperator, self).__init__(node) self.type = 'LogicalOperator'
identifier_body
LogicalOperator.py
''' Created on Apr 20, 2011 @author: michel ''' import os from lxml import etree from FeatureServer.WebFeatureService.FilterEncoding.Operator import Operator class
(Operator): def __init__(self, node): super(LogicalOperator, self).__init__(node) self.type = 'LogicalOperator' def createStatement(self, datasource, operatorList): logical = self.addOperators(operatorList) xslt = etree.parse(os.path.dirname(os.path.absp...
LogicalOperator
identifier_name
LogicalOperator.py
''' Created on Apr 20, 2011 @author: michel ''' import os from lxml import etree from FeatureServer.WebFeatureService.FilterEncoding.Operator import Operator class LogicalOperator(Operator): def __init__(self, node): super(LogicalOperator, self).__init__(node) self.type = 'LogicalOperator' ...
self.setStatement(None) def addOperators(self, operatorList): logical = etree.Element(self.node.tag) for operator in operatorList: element = etree.Element("Operator") element.text = operator.stmt logical.append(element) ...
self.setStatement(str(elements[0].text).strip()) return
conditional_block
LogicalOperator.py
''' Created on Apr 20, 2011
from FeatureServer.WebFeatureService.FilterEncoding.Operator import Operator class LogicalOperator(Operator): def __init__(self, node): super(LogicalOperator, self).__init__(node) self.type = 'LogicalOperator' def createStatement(self, datasource, operatorList): logical = self....
@author: michel ''' import os from lxml import etree
random_line_split
transform.rs
use std::fmt; use Result; /// A scale and an offset that transforms xyz coordinates. #[derive(Clone, Copy, Debug, PartialEq)] pub struct Transform { /// The scale. pub scale: f64, /// The offset. pub offset: f64, } impl Transform { /// Applies this transform to an i32, returning a float. /// ...
else { Ok(n as i32) } } } impl Default for Transform { fn default() -> Transform { Transform { scale: 0.001, offset: 0., } } } impl fmt::Display for Transform { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "`{} * ...
{ Err(Error::InverseTransform { n, transform: *self, }) }
conditional_block
transform.rs
use std::fmt; use Result; /// A scale and an offset that transforms xyz coordinates. #[derive(Clone, Copy, Debug, PartialEq)] pub struct Transform { /// The scale. pub scale: f64, /// The offset. pub offset: f64, } impl Transform { /// Applies this transform to an i32, returning a float. /// ...
() { let transform = Transform::default(); let n = i32::MAX as f64 * transform.scale + 1.; assert!(transform.inverse(n).is_err()); } #[test] fn too_small() { let transform = Transform::default(); let n = i32::MIN as f64 * transform.scale - 1.; assert!(transfo...
too_large
identifier_name
transform.rs
use std::fmt; use Result; /// A scale and an offset that transforms xyz coordinates. #[derive(Clone, Copy, Debug, PartialEq)] pub struct Transform { /// The scale. pub scale: f64, /// The offset. pub offset: f64, } impl Transform { /// Applies this transform to an i32, returning a float. /// ...
#[test] fn too_small() { let transform = Transform::default(); let n = i32::MIN as f64 * transform.scale - 1.; assert!(transform.inverse(n).is_err()); } }
{ let transform = Transform::default(); let n = i32::MAX as f64 * transform.scale + 1.; assert!(transform.inverse(n).is_err()); }
identifier_body
transform.rs
use std::fmt; use Result; /// A scale and an offset that transforms xyz coordinates. #[derive(Clone, Copy, Debug, PartialEq)] pub struct Transform { /// The scale. pub scale: f64, /// The offset. pub offset: f64,
/// /// # Examples /// /// ``` /// use las::Transform; /// let transform = Transform { scale: 2., offset: 1. }; /// assert_eq!(3., transform.direct(1)); /// ``` pub fn direct(&self, n: i32) -> f64 { self.scale * f64::from(n) + self.offset } /// Applies the inverse tr...
} impl Transform { /// Applies this transform to an i32, returning a float.
random_line_split
track_info_sse.py
import logging from concurrent.futures import CancelledError import asyncio from aiohttp import web from aioredis import create_redis from etc.ice_fetcher import get_current_song from config.settings import STREAM_HOST, STREAM_PORT server_logger = logging.getLogger('aiohttp.server') async def
(request): """ Args: request: HTTP request (aiohttp.web_reqrep.Request) View that handle SSE updates of current track obtained from Icecast server using keep-alive text/event-stream Response """ if request.headers['Accept'] != 'text/event-stream': raise web.HTTPFound('/') #...
push_current_track
identifier_name
track_info_sse.py
import logging from concurrent.futures import CancelledError import asyncio from aiohttp import web from aioredis import create_redis from etc.ice_fetcher import get_current_song from config.settings import STREAM_HOST, STREAM_PORT server_logger = logging.getLogger('aiohttp.server') async def push_current_track(r...
try: current_song = await get_current_song(icecast_host=STREAM_HOST, icecast_port=STREAM_PORT) if current_song: stream.write(b'event: track_update\r\n') stream.write(b'data: ' + str.encode(current_song) + b'\r\n\r\n') else...
""" Args: request: HTTP request (aiohttp.web_reqrep.Request) View that handle SSE updates of current track obtained from Icecast server using keep-alive text/event-stream Response """ if request.headers['Accept'] != 'text/event-stream': raise web.HTTPFound('/') # Construct Stre...
identifier_body
track_info_sse.py
import logging from concurrent.futures import CancelledError import asyncio from aiohttp import web from aioredis import create_redis from etc.ice_fetcher import get_current_song from config.settings import STREAM_HOST, STREAM_PORT server_logger = logging.getLogger('aiohttp.server') async def push_current_track(r...
await stream.write_eof() return stream
random_line_split
track_info_sse.py
import logging from concurrent.futures import CancelledError import asyncio from aiohttp import web from aioredis import create_redis from etc.ice_fetcher import get_current_song from config.settings import STREAM_HOST, STREAM_PORT server_logger = logging.getLogger('aiohttp.server') async def push_current_track(r...
except Exception as e: import traceback server_logger.error('Connection with redis broken? {}'.format(e)) traceback.print_exc() except CancelledError as e: server_logger.error('Feature got canceled {}'.format(e)) # here we mark that response processing is fi...
stream.write(b'event: ping\r\n') stream.write(b'data: ' + b'waiting...' + b'\r\n\r\n') await asyncio.sleep(10, loop=request.app.loop)
conditional_block
notifications.py
from code_intelligence import graphql import fire import github3 import json import logging import os import numpy as np import pprint import retrying import json TOKEN_NAME_PREFERENCE = ["INPUT_GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_TOKEN"] for token in TOKEN_NAME_PREFERENCE: if os....
fire.Fire(NotificationManager)
random_line_split