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
procurement.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (c) 2013 Acysos S.L. (http://acysos.com) All Rights Reserved. # Ignacio Ibeas <ignacio@acysos.com> # $Id$ # # This program i...
'origin': procurement.origin, 'product_id': procurement.product_id.id, 'product_qty': - procurement.product_id.virtual_available, 'product_uom': procurement.product_uom.id, 'product_uos_qty': procurement.product_uos and ...
_inherit = 'procurement.order' def make_mo(self, cr, uid, ids, context=None): """ Make Manufacturing(production) order from procurement @return: New created Production Orders procurement wise """ res = {} company = self.pool.get('res.users').browse(cr, uid, uid, context...
identifier_body
procurement.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (c) 2013 Acysos S.L. (http://acysos.com) All Rights Reserved. # Ignacio Ibeas <ignacio@acysos.com> # $Id$ # # This program i...
produce_ids.append(produce_id) bom_result = production_obj.action_compute(cr, uid, [produce_id], properties=[x.id for x in procurement.property_ids]) self.write(cr, uid, [procurement.id], {'state': 'running'}) else: self.wri...
res_id = procurement.move_id.id loc_id = procurement.location_id.id newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0) newdate = newdate - relativedelta(days=company.manufacturin...
conditional_block
procurement.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (c) 2013 Acysos S.L. (http://acysos.com) All Rights Reserved. # Ignacio Ibeas <ignacio@acysos.com> # $Id$ # # This program i...
(osv.osv): _inherit = 'procurement.order' def make_mo(self, cr, uid, ids, context=None): """ Make Manufacturing(production) order from procurement @return: New created Production Orders procurement wise """ res = {} company = self.pool.get('res.users').browse(cr, ui...
procurement_order
identifier_name
CallList.js
import React from 'react'; import {Paper} from 'material-ui'; import CallView from 'components/CallView'; import ConnectionStore from 'stores/ConnectionStore'; class CallList extends React.Component { constructor(props) { super(props); this.state = { calls: ConnectionStore.getCallList() }; } c...
this.setState({ calls: ConnectionStore.getCallList() }); } render() { var peerItems = this.state.calls.map(renderPeerItem); return ( <div className="callList row"> {peerItems} </div> ); } } function renderPeerItem(call) { return ( <div className="col-xs-4" key=...
} _onChange() {
random_line_split
CallList.js
import React from 'react'; import {Paper} from 'material-ui'; import CallView from 'components/CallView'; import ConnectionStore from 'stores/ConnectionStore'; class CallList extends React.Component { constructor(props) { super(props); this.state = { calls: ConnectionStore.getCallList() }; }
() { ConnectionStore.addListener('callsChange', this._onChange.bind(this)); } componentWillUnmount() { ConnectionStore.removeListener('callsChange', this._onChange.bind(this)); } _onChange() { this.setState({ calls: ConnectionStore.getCallList() }); } render() { var peerItems = thi...
componentDidMount
identifier_name
CallList.js
import React from 'react'; import {Paper} from 'material-ui'; import CallView from 'components/CallView'; import ConnectionStore from 'stores/ConnectionStore'; class CallList extends React.Component { constructor(props) { super(props); this.state = { calls: ConnectionStore.getCallList() }; } c...
_onChange() { this.setState({ calls: ConnectionStore.getCallList() }); } render() { var peerItems = this.state.calls.map(renderPeerItem); return ( <div className="callList row"> {peerItems} </div> ); } } function renderPeerItem(call) { return ( <div classNam...
{ ConnectionStore.removeListener('callsChange', this._onChange.bind(this)); }
identifier_body
subscription_dictionary.py
from pagarme import card from pagarme import plan from tests.resources import pagarme_test from tests.resources.dictionaries import card_dictionary from tests.resources.dictionaries import customer_dictionary from tests.resources.dictionaries import plan_dictionary from tests.resources.dictionaries import transaction_d...
BOLETO_SUBSCRIPTION = { "plan_id": NO_TRIAL_PLAN['id'], "customer": customer_dictionary.CUSTOMER, "payment_method": "boleto", "postback_url": POSTBACK_URL } CHARGES = { "charges": "1" } CREDIT_CARD_PERCENTAGE_SPLIT_RULE_SUBSCRIPTION = { "plan_id": NO_TRIAL_PLAN['id'], "customer": customer...
"split_rules": transaction_dictionary.SPLIT_RULE_PERCENTAGE }
random_line_split
index.d.ts
/* * @license Apache-2.0 * * Copyright (c) 2021 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ...
* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *
random_line_split
AWTconvertTable.py
#!/usr/bin/env python # convertAWT.py - Mass Table Conversion Utility import os massFile = 'AWTMass-2003.dat' newFile = os.path.join('..', 'nmrfreq', 'masstable.py') def main(): with open(massFile, 'r') as file: massDict = extractMasses(file) writeToFile(newFile, massDict, massFile) def extractMa...
main()
conditional_block
AWTconvertTable.py
#!/usr/bin/env python # convertAWT.py - Mass Table Conversion Utility import os massFile = 'AWTMass-2003.dat' newFile = os.path.join('..', 'nmrfreq', 'masstable.py') def main(): with open(massFile, 'r') as file: massDict = extractMasses(file) writeToFile(newFile, massDict, massFile) def extractMa...
def createIsotopesString(massdict): string = '' for key in sorted(massdict.iterkeys()): string = '{2} "{0}": {1},\n'.format(key, massdict[key], string) return string if __name__ == '__main__': main()
with open(filename, 'w') as f: f.write('# Mass table for use in nmrfreq from {0}\n'.format(massFile)) f.write('table = {\n') f.write(createIsotopesString(massdict)) f.write('}\n')
identifier_body
AWTconvertTable.py
#!/usr/bin/env python # convertAWT.py - Mass Table Conversion Utility import os massFile = 'AWTMass-2003.dat' newFile = os.path.join('..', 'nmrfreq', 'masstable.py') def main(): with open(massFile, 'r') as file: massDict = extractMasses(file) writeToFile(newFile, massDict, massFile) def extractMa...
line = adjustLine(line) if line is not None: isotope, Z, mass = getValuesFrom(line) mass = convertMass(mass) massdict[isotope] = (Z, mass) return massdict def adjustLine(line): line = line.strip() if line[0] != '#' and line[-1] != '#': line = lin...
for line in file:
random_line_split
AWTconvertTable.py
#!/usr/bin/env python # convertAWT.py - Mass Table Conversion Utility import os massFile = 'AWTMass-2003.dat' newFile = os.path.join('..', 'nmrfreq', 'masstable.py') def main(): with open(massFile, 'r') as file: massDict = extractMasses(file) writeToFile(newFile, massDict, massFile) def
(file): massdict = {} for line in file: line = adjustLine(line) if line is not None: isotope, Z, mass = getValuesFrom(line) mass = convertMass(mass) massdict[isotope] = (Z, mass) return massdict def adjustLine(line): line = line.strip() if line[...
extractMasses
identifier_name
web.rs
use std::io::Read; use std::{thread, time}; use hyper::Client; use hyper::net::HttpsConnector; use hyper_native_tls::NativeTlsClient; use hyper::Ok; use kuchiki; use kuchiki::traits::TendrilSink; fn fetch_url(url: &str) -> impl Read
pub fn fetch_html(url: &str) -> kuchiki::NodeRef { let mut response = fetch_url(url); kuchiki::parse_html() .from_utf8() .read_from(&mut response) .unwrap() } pub fn fetch_string(url: &str) -> String { let mut response = fetch_url(url); let mut response_string = String::new(); response.read_to_strin...
{ //we're going to be nice to the maintainers of the donation tracker //to avoid DDOSing them, add a delay between each request let delay_milliseconds = 100; thread::sleep(time::Duration::from_millis(delay_milliseconds)); //perform the request and read the repsonse into a string let ssl = NativeTlsClient::new()....
identifier_body
web.rs
use std::io::Read; use std::{thread, time}; use hyper::Client; use hyper::net::HttpsConnector; use hyper_native_tls::NativeTlsClient; use hyper::Ok; use kuchiki; use kuchiki::traits::TendrilSink; fn fetch_url(url: &str) -> impl Read { //we're going to be nice to the maintainers of the donation tracker //to avoid D...
(url: &str) -> String { let mut response = fetch_url(url); let mut response_string = String::new(); response.read_to_string(&mut response_string).unwrap(); response_string }
fetch_string
identifier_name
web.rs
use std::io::Read; use std::{thread, time}; use hyper::Client; use hyper::net::HttpsConnector; use hyper_native_tls::NativeTlsClient; use hyper::Ok; use kuchiki; use kuchiki::traits::TendrilSink; fn fetch_url(url: &str) -> impl Read { //we're going to be nice to the maintainers of the donation tracker //to avoid D...
} pub fn fetch_html(url: &str) -> kuchiki::NodeRef { let mut response = fetch_url(url); kuchiki::parse_html() .from_utf8() .read_from(&mut response) .unwrap() } pub fn fetch_string(url: &str) -> String { let mut response = fetch_url(url); let mut response_string = String::new(); response.read_to_stri...
response
random_line_split
fixture.py
yield mo
kwargs['delete'] = False kwargs.setdefault('prefix', 'sub-man-test') fh = tempfile.NamedTemporaryFile(mode='w+', *args, **kwargs) fh.write(content) fh.close() yield fh.name finally: os.unlink(fh.name) @contextmanager def locale_context(new_locale, category=N...
@contextmanager def temp_file(content, *args, **kwargs): try:
random_line_split
fixture.py
yield mo @contextmanager def temp_file(content, *args, **kwargs): try: kwargs['delete'] = False kwargs.setdefault('prefix', 'sub-man-test') fh = tempfile.NamedTemporaryFile(mode='w+', *args, **kwargs) fh.write(content) fh.close() yield fh.name finally: ...
for f in self.files_to_cleanup: # Assuming these are tempfile.NamedTemporaryFile, created with # the write_tempfile() method in this class. f.close() def write_tempfile(self, contents): """ Write out a tempfile and append it to the list of those to be ...
return
conditional_block
fixture.py
yield mo @contextmanager def temp_file(content, *args, **kwargs): try: kwargs['delete'] = False kwargs.setdefault('prefix', 'sub-man-test') fh = tempfile.NamedTemporaryFile(mode='w+', *args, **kwargs) fh.write(content) fh.close() yield fh.name finally: ...
def set_consumer_auth_cp(self, consumer_auth_cp): cp_provider = inj.require(inj.CP_PROVIDER) cp_provider.consumer_auth_cp = consumer_auth_cp def get_consumer_cp(self): cp_provider = inj.require(inj.CP_PROVIDER) consumer_cp = cp_provider.get_consumer_auth_cp() return co...
""" Write out a tempfile and append it to the list of those to be cleaned up in tearDown. """ fid = tempfile.NamedTemporaryFile(mode='w+', suffix='.tmp') fid.write(contents) fid.seek(0) self.files_to_cleanup.append(fid) return fid
identifier_body
fixture.py
.setlocale(category, old_locale) class FakeLogger(object): def __init__(self): self.expected_msg = "" self.msg = None self.logged_exception = None def debug(self, buf, *args, **kwargs): self.msg = buf def error(self, buf, *args, **kwargs): self.msg = buf def ...
_inject_mock_invalid_consumer
identifier_name
__init__.py
Thread class for running the main tests. """ def __init__(self, exc_queue, app, **kwargs): threading.Thread.__init__(self, **kwargs) self.exc_queue = exc_queue self.app = app def run(self): try: self.app.run_tests() # pylint: disable=broad-except ...
def _update_content(self, cat_name, item_idx): self.cur_item = (cat_name, item_idx) def _merge_stat(self, panel): self.pause = True cat_name, _ = panel.cur_key text = self.window.get_input() match_keys = [] for key in self.stats[cat_name]: res = re....
self.cur_class = (cat_name, item_idx)
identifier_body
__init__.py
que([], queue_max) def match(self, text): if self.method == 'exact': return text == self.key elif self.method == 'regex': return re.match(self.key + '$', text) def append(self, result): self.counter += 1 self.queue.append(result) def extend(self, st...
self.window.destroy()
conditional_block
__init__.py
Thread class for running the main tests. """ def __init__(self, exc_queue, app, **kwargs): threading.Thread.__init__(self, **kwargs) self.exc_queue = exc_queue self.app = app def run(self): try: self.app.run_tests() # pylint: disable=broad-except ...
""" Print a list of available providers if --list-providers is set or return a dict of specified providers. """ providers = {} if self.args.providers: for path in self.args.providers.split(','): prvdr = provider.Provider(path) p...
def _process_providers(self):
random_line_split
__init__.py
Thread class for running the main tests. """ def __init__(self, exc_queue, app, **kwargs): threading.Thread.__init__(self, **kwargs) self.exc_queue = exc_queue self.app = app def run(self): try: self.app.run_tests() # pylint: disable=broad-except ...
(self, result): self.counter += 1 self.queue.append(result) def extend(self, stat): for result in stat.queue: self.append(result) class DiceApp(object): """ Curses-based DICE client application. """ def __init__(self): self.parser = argparse.ArgumentPar...
append
identifier_name
first-drawing.js
(function () { 'use strict'; /*global document */ /*global Reveal */ /*global define*/ define(function (require) { var canvas = document.getElementById('firstDrawingCanvas'); var environment = require('environment'); var ctx = canvas.getContext('2d'); function makeF...
else { ctx.stroke(); } ctx.restore(); } function anglePart(n, m) { return Math.PI * 2 * n / m; } function clearCanvas() { ctx.clearRect(0, 0, canvas.width, canvas.height); } return { start: f...
{ ctx.fill(); }
conditional_block
first-drawing.js
(function () { 'use strict'; /*global document */ /*global Reveal */ /*global define*/ define(function (require) { var canvas = document.getElementById('firstDrawingCanvas'); var environment = require('environment'); var ctx = canvas.getContext('2d'); function makeF...
} else { ctx.stroke(); } ctx.restore(); } function anglePart(n, m) { return Math.PI * 2 * n / m; } function clearCanvas() { ctx.clearRect(0, 0, canvas.width, canvas.height); } return { ...
if (solid) { ctx.fill();
random_line_split
first-drawing.js
(function () { 'use strict'; /*global document */ /*global Reveal */ /*global define*/ define(function (require) { var canvas = document.getElementById('firstDrawingCanvas'); var environment = require('environment'); var ctx = canvas.getContext('2d'); function makeF...
function draw(x, y, angle, size, solid) { var halfSize = size / 2; ctx.save(); ctx.beginPath(); ctx.translate(x, y); ctx.rotate(angle); ctx.moveTo(0, -halfSize); ctx.lineTo(halfSize, halfSize); ctx.lineTo(-halfSize...
{ canvas.width = environment.width; canvas.height = environment.height; Reveal.layout(); }
identifier_body
first-drawing.js
(function () { 'use strict'; /*global document */ /*global Reveal */ /*global define*/ define(function (require) { var canvas = document.getElementById('firstDrawingCanvas'); var environment = require('environment'); var ctx = canvas.getContext('2d'); function
(canvas) { canvas.width = environment.width; canvas.height = environment.height; Reveal.layout(); } function draw(x, y, angle, size, solid) { var halfSize = size / 2; ctx.save(); ctx.beginPath(); ctx.translate(x, y); ...
makeFullScreen
identifier_name
mozjs-error.rs
// run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] struct CustomAutoRooterVFTable { trace: unsafe extern "C" fn(this: *mut i32, trc: *mut u32), } unsafe trait CustomAutoTraceable: Sized { const vftable: CustomAutoRooterVFTable = CustomAutoRooterVFTable { trace: Self::trace, }; ...
fn main() { let _ = <()>::vftable; }
random_line_split
mozjs-error.rs
// run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] struct CustomAutoRooterVFTable { trace: unsafe extern "C" fn(this: *mut i32, trc: *mut u32), } unsafe trait CustomAutoTraceable: Sized { const vftable: CustomAutoRooterVFTable = CustomAutoRooterVFTable { trace: Self::trace, }; ...
() { let _ = <()>::vftable; }
main
identifier_name
institutions.component.ts
import { Component, OnInit } from "@angular/core"; import { MatDialog } from "@angular/material/dialog"; import { switchMap } from "rxjs/operators"; import { InstitutionData } from "../bank-accounts/institution.model"; import { MessageService } from "../message-display/message.service"; import { MainToolbarService } fr...
this.messageService.setErrorMessage("Institution not saved."); this.refresh(); } ); } addInstitution() { this.viewDetails({ id: 0, name: "" }); } }
}, error => {
random_line_split
institutions.component.ts
import { Component, OnInit } from "@angular/core"; import { MatDialog } from "@angular/material/dialog"; import { switchMap } from "rxjs/operators"; import { InstitutionData } from "../bank-accounts/institution.model"; import { MessageService } from "../message-display/message.service"; import { MainToolbarService } fr...
implements OnInit { institutions: InstitutionData[] = []; constructor( private setupService: SetupService, private dialog: MatDialog, private toolbar: MainToolbarService, private messageService: MessageService ) {} ngOnInit() { this.refresh(); } refresh() { this.setupService ...
InstitutionsComponent
identifier_name
run-pass.rs
// run-pass #![feature(if_let_guard)] enum Foo { Bar, Baz, Qux(u8), } fn bar(x: bool) -> Foo { if x { Foo::Baz } else { Foo::Bar } } fn baz(x: u8) -> Foo { if x % 2 == 0 { Foo::Bar } else { Foo::Baz } } fn qux(x: u8) -> Foo { Foo::Qux(x.rotate_left(1)) } fn main() { match Some((true, 3...
match Some(42) { Some(x) if let Foo::Qux(y) = qux(x) => assert_eq!(y, 84), _ => panic!(), } }
random_line_split
run-pass.rs
// run-pass #![feature(if_let_guard)] enum Foo { Bar, Baz, Qux(u8), } fn bar(x: bool) -> Foo { if x { Foo::Baz } else { Foo::Bar } } fn baz(x: u8) -> Foo { if x % 2 == 0
else { Foo::Baz } } fn qux(x: u8) -> Foo { Foo::Qux(x.rotate_left(1)) } fn main() { match Some((true, 3)) { Some((x, _)) if let Foo::Bar = bar(x) => panic!(), Some((_, x)) if let Foo::Baz = baz(x) => {}, _ => panic!(), } match Some(42) { Some(x) if let Foo::Qux(y) = qu...
{ Foo::Bar }
conditional_block
run-pass.rs
// run-pass #![feature(if_let_guard)] enum Foo { Bar, Baz, Qux(u8), } fn
(x: bool) -> Foo { if x { Foo::Baz } else { Foo::Bar } } fn baz(x: u8) -> Foo { if x % 2 == 0 { Foo::Bar } else { Foo::Baz } } fn qux(x: u8) -> Foo { Foo::Qux(x.rotate_left(1)) } fn main() { match Some((true, 3)) { Some((x, _)) if let Foo::Bar = bar(x) => panic!(), Some((_, x)) if let...
bar
identifier_name
run-pass.rs
// run-pass #![feature(if_let_guard)] enum Foo { Bar, Baz, Qux(u8), } fn bar(x: bool) -> Foo { if x { Foo::Baz } else { Foo::Bar } } fn baz(x: u8) -> Foo { if x % 2 == 0 { Foo::Bar } else { Foo::Baz } } fn qux(x: u8) -> Foo
fn main() { match Some((true, 3)) { Some((x, _)) if let Foo::Bar = bar(x) => panic!(), Some((_, x)) if let Foo::Baz = baz(x) => {}, _ => panic!(), } match Some(42) { Some(x) if let Foo::Qux(y) = qux(x) => assert_eq!(y, 84), _ => panic!(), } }
{ Foo::Qux(x.rotate_left(1)) }
identifier_body
internal_logs_controller.ts
/** * Internal logs Controller. * * Allows user to download current set of internal log files. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import archi...
const pluginServer: EventEmitter | null = AddonManager.getPluginServer(); if (pluginServer) { pluginServer.on('log', onLog); const cleanup = (): void => { pluginServer.removeListener('log', onLog); clearInterval(heartbeat); }; websocket.on('error', cleanup); web...
{ websocket.send(JSON.stringify(message), (err) => { if (err) { console.error('WebSocket sendMessage failed:', err); } }); }
identifier_body
internal_logs_controller.ts
/** * Internal logs Controller. * * Allows user to download current set of internal log files. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import archi...
controller.get('/zip', async (_request, response) => { const archive = archiver('zip'); archive.on('error', (err) => { response.status(500).send(err.message); }); response.attachment('logs.zip'); archive.pipe(response); fs.readdirSync(UserProfile.logDir).map((f) => { const fullP...
*/
random_line_split
internal_logs_controller.ts
/** * Internal logs Controller. * * Allows user to download current set of internal log files. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import archi...
(message: Constants.LogMessage): void { websocket.send(JSON.stringify(message), (err) => { if (err) { console.error('WebSocket sendMessage failed:', err); } }); } const pluginServer: EventEmitter | null = AddonManager.getPluginServer(); if (pluginServer) { plugin...
onLog
identifier_name
internal_logs_controller.ts
/** * Internal logs Controller. * * Allows user to download current set of internal log files. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import archi...
}); } const pluginServer: EventEmitter | null = AddonManager.getPluginServer(); if (pluginServer) { pluginServer.on('log', onLog); const cleanup = (): void => { pluginServer.removeListener('log', onLog); clearInterval(heartbeat); }; websocket.on('error', cle...
{ console.error('WebSocket sendMessage failed:', err); }
conditional_block
errors.rs
use toml; use std::error; use std::fmt::{self, Display}; #[derive(Debug)] pub enum Error { Parsing(Vec<toml::ParserError>), MissingKey(String), ExpectedType(&'static str, String), PackageNotFound(String), TargetNotFound(String), MissingRoot, UnsupportedVersion(String), } impl error::Error...
(&self) -> Option<&error::Error> { None } } impl Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> ::std::result::Result<(), fmt::Error> { use self::Error::*; match *self { Parsing(ref n) => { for e in n { try!(e.fmt(f)); ...
cause
identifier_name
errors.rs
use toml;
use std::error; use std::fmt::{self, Display}; #[derive(Debug)] pub enum Error { Parsing(Vec<toml::ParserError>), MissingKey(String), ExpectedType(&'static str, String), PackageNotFound(String), TargetNotFound(String), MissingRoot, UnsupportedVersion(String), } impl error::Error for Error ...
random_line_split
ModRow.d.ts
/*! * Copyright Unlok, Vaughn Royko 2011-2019 * http://www.unlok.ca * * Credits & Thanks: * http://www.unlok.ca/credits-thanks/ * * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the moddin...
private buttonView; private buttonPublish; constructor(uiApi: UiApi, modIndex: number, modInfo: IModInfo); updateButtons(): void; onChecked(checked: boolean, prompts?: boolean): Promise<boolean>; private canPublish; private getDependencyNames; private isLoadable; private onPublish; }
export default class ModRow extends CheckButton { readonly info: IModInfo; readonly index: number; private buttonOptions;
random_line_split
ModRow.d.ts
/*! * Copyright Unlok, Vaughn Royko 2011-2019 * http://www.unlok.ca * * Credits & Thanks: * http://www.unlok.ca/credits-thanks/ * * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the moddin...
extends CheckButton { readonly info: IModInfo; readonly index: number; private buttonOptions; private buttonView; private buttonPublish; constructor(uiApi: UiApi, modIndex: number, modInfo: IModInfo); updateButtons(): void; onChecked(checked: boolean, prompts?: boolean): Promise<boolean...
ModRow
identifier_name
0002_auto_20160519_0326.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class
(migrations.Migration): dependencies = [ ('get_feedback', '0001_initial'), ] operations = [ migrations.AddField( model_name='course', name='feedback_amount', field=models.DecimalField(default=0, decimal_places=0, max_digits=10), ), migrat...
Migration
identifier_name
0002_auto_20160519_0326.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models
dependencies = [ ('get_feedback', '0001_initial'), ] operations = [ migrations.AddField( model_name='course', name='feedback_amount', field=models.DecimalField(default=0, decimal_places=0, max_digits=10), ), migrations.AlterField( ...
class Migration(migrations.Migration):
random_line_split
0002_auto_20160519_0326.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration):
migrations.AlterField( model_name='course', name='feedback_easy', field=models.FloatField(), ), migrations.AlterField( model_name='course', name='feedback_freedom', field=models.FloatField(), ), migrations.Al...
dependencies = [ ('get_feedback', '0001_initial'), ] operations = [ migrations.AddField( model_name='course', name='feedback_amount', field=models.DecimalField(default=0, decimal_places=0, max_digits=10), ), migrations.AlterField( ...
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-11 19:21 from __future__ import unicode_literals from django.db import migrations, models import prosody.utils class Migration(migrations.Migration):
), migrations.AlterUniqueTogether( name='prosody', unique_together=set([('user', 'store', 'key')]), ), ]
initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Prosody', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('host', models.TextField(default=prosody.uti...
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-11 19:21 from __future__ import unicode_literals from django.db import migrations, models import prosody.utils class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( ...
), migrations.AlterUniqueTogether( name='prosody', unique_together=set([('user', 'store', 'key')]), ), ]
('value', models.TextField()), ], options={ 'db_table': 'prosody', },
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-11 19:21 from __future__ import unicode_literals from django.db import migrations, models import prosody.utils class
(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Prosody', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('host', models....
Migration
identifier_name
test_v1beta1_user_info.py
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
if __name__ == '__main__': unittest.main()
""" Test V1beta1UserInfo """ # FIXME: construct object with mandatory attributes with example values #model = kubernetes.client.models.v1beta1_user_info.V1beta1UserInfo() pass
identifier_body
test_v1beta1_user_info.py
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
unittest.main()
conditional_block
test_v1beta1_user_info.py
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
(unittest.TestCase): """ V1beta1UserInfo unit test stubs """ def setUp(self): pass def tearDown(self): pass def testV1beta1UserInfo(self): """ Test V1beta1UserInfo """ # FIXME: construct object with mandatory attributes with example values #mode...
TestV1beta1UserInfo
identifier_name
test_v1beta1_user_info.py
# coding: utf-8
OpenAPI spec version: v1.8.2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest import kubernetes.client from kubernetes.client.rest import ApiException from kubernetes.client.models.v1beta1_user_info import V...
""" Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
random_line_split
__main__.py
#!/usr/bin/env python """ Create Matplotlib style gallery for all stylesheets and display in the browser. By default, all plots are rebuilt, but this can be avoided using the `--skip-build` (`-s`) flag. To build a static website, run suppress user input and set a static output directory:: python -m mpl_style_gal...
if args.static_output: output = gallery.render_static() save_static_output(output, args.static_output) elif args.serve: hostname, port = args.serve gallery.serve(hostname, port) else: gallery.open() if __name__ == '__main__': main()
formatter = argparse.ArgumentDefaultsHelpFormatter parser = argparse.ArgumentParser(description=__doc__, formatter_class=formatter) parser.add_argument('-s', '--skip-build', action='store_true', help="If set, skip plot-generation step.") parser.ad...
identifier_body
__main__.py
#!/usr/bin/env python """ Create Matplotlib style gallery for all stylesheets and display in the browser. By default, all plots are rebuilt, but this can be avoided using the `--skip-build` (`-s`) flag. To build a static website, run suppress user input and set a static output directory:: python -m mpl_style_gal...
(): formatter = argparse.ArgumentDefaultsHelpFormatter parser = argparse.ArgumentParser(description=__doc__, formatter_class=formatter) parser.add_argument('-s', '--skip-build', action='store_true', help="If set, skip plot-generation step.") p...
main
identifier_name
__main__.py
#!/usr/bin/env python """ Create Matplotlib style gallery for all stylesheets and display in the browser. By default, all plots are rebuilt, but this can be avoided using the `--skip-build` (`-s`) flag. To build a static website, run suppress user input and set a static output directory:: python -m mpl_style_gal...
help="Do not allow input stylesheets.") parser.add_argument('--static-output', help="Save static files to static output directory.") args = parser.parse_args() if not args.skip_build: remove_directory(disk.build_dir) build.save_all_plots() ...
help="Serve app on hostname and port") parser.add_argument('--no-input', action='store_true',
random_line_split
__main__.py
#!/usr/bin/env python """ Create Matplotlib style gallery for all stylesheets and display in the browser. By default, all plots are rebuilt, but this can be avoided using the `--skip-build` (`-s`) flag. To build a static website, run suppress user input and set a static output directory:: python -m mpl_style_gal...
gallery = app.GalleryApp(args.no_input) if args.static_output: output = gallery.render_static() save_static_output(output, args.static_output) elif args.serve: hostname, port = args.serve gallery.serve(hostname, port) else: gallery.open() if __name__ == '__ma...
remove_directory(disk.build_dir) build.save_all_plots()
conditional_block
utils.py
# -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
move_dict_to_root(obj, field): for attr in obj[field]: obj["%s/%s" % (field, attr)] = obj[field][attr] del obj[field] def format_archive_policy(ap): format_dict_list(ap, "definition") format_string_list(ap, "aggregation_methods") def dict_from_parsed_args(parsed_args, attrs): d = {} ...
"\n".join( "- " + ", ".join("%s: %s" % (k, v) for k, v in elem.items()) for elem in objs[field]) def format_
identifier_body
utils.py
# -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
for attr in attrs: value = getattr(parsed_args, attr) if value is not None: d[attr] = value return d def dict_to_querystring(objs): return "&".join(["%s=%s" % (k, v) for k, v in objs.items() if v is not None])
def dict_from_parsed_args(parsed_args, attrs): d = {}
random_line_split
utils.py
# -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
f result is None: result = res elif isinstance(result, dict): list(result.values())[0].append(res) else: result = part return result def search_query_builder(query): parsed_query = expr.parseString(query)[0] return _parsed_query2dict(parsed_q...
query2dict(part) i
conditional_block
utils.py
# -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
at_dict_list(ap, "definition") format_string_list(ap, "aggregation_methods") def dict_from_parsed_args(parsed_args, attrs): d = {} for attr in attrs: value = getattr(parsed_args, attr) if value is not None: d[attr] = value return d def dict_to_querystring(objs): retur...
_policy(ap): form
identifier_name
exp-ae-celeba-mafl-30.py
import tensorflow as tf import os import sys from copy import copy from model.pipeline import Pipeline from tensorflow.python import debug as tf_debug if __name__ == "__main__": num_keypoints = 30 patch_feature_dim = 8 decoding_levels = 5 kp_transform_loss = 1e4 base_recon_weight = 0.1 reco...
"keypoint_axis_balancing_loss_weight": 200., "keypoint_separation_loss_weight": keypoint_separation_loss_weight, "keypoint_separation_bandwidth": keypoint_separation_bandwidth, "keypoint_transform_loss_weight": kp_transform_loss, "keypoint_decoding_heatmap_levels": decoding_le...
"keypoint_num": num_keypoints, "patch_feature_dim": patch_feature_dim, "ae_recon_type": opt["recon_name"], "keypoint_concentration_loss_weight": 100.,
random_line_split
exp-ae-celeba-mafl-30.py
import tensorflow as tf import os import sys from copy import copy from model.pipeline import Pipeline from tensorflow.python import debug as tf_debug if __name__ == "__main__":
keypoint_separation_loss_weight = 10 opt = { "optimizer": "Adam", "data_name": "celeba_mafl_100x100_80x80", "recon_name": "gaussian_fixedvar_in_01", "encoder_name": "general_80x80", "decoder_name": "general_80x80", "latent_dim": num_keypoints*2+(num_keypoints+1)*...
num_keypoints = 30 patch_feature_dim = 8 decoding_levels = 5 kp_transform_loss = 1e4 base_recon_weight = 0.1 recon_weight = Pipeline.ValueScheduler( "piecewise_constant", [100000, 200000], [base_recon_weight, base_recon_weight*100, base_recon_weight*1000] ) ...
conditional_block
main.rs
use std::fs; use std::io; use std::io::Read; use clap::{App, Arg}; mod llvm_runner; mod optimizer; mod parser; mod runner; mod structs; #[cfg(feature = "llvm")] use llvm_runner::LlvmState; use parser::parse; use runner::State; use structs::OpStream; fn
() { let app = App::new("BrainRust") .arg( Arg::with_name("dry-run") .short("n") .long("dry-run") .help("Don't actually execute the program"), ) .arg( Arg::with_name("no-optimize") .short("0") ...
main
identifier_name
main.rs
use std::fs; use std::io; use std::io::Read; use clap::{App, Arg}; mod llvm_runner; mod optimizer; mod parser; mod runner; mod structs; #[cfg(feature = "llvm")] use llvm_runner::LlvmState; use parser::parse; use runner::State; use structs::OpStream; fn main() { let app = App::new("BrainRust") .arg( ...
for filename in matches.values_of("FILES").unwrap() { let buffer = match read_file(filename) { Ok(v) => v, Err(e) => { eprintln!("Error while reading {}: {}", filename, e); continue; } }; let ops = match parse(&buffer) { ...
random_line_split
main.rs
use std::fs; use std::io; use std::io::Read; use clap::{App, Arg}; mod llvm_runner; mod optimizer; mod parser; mod runner; mod structs; #[cfg(feature = "llvm")] use llvm_runner::LlvmState; use parser::parse; use runner::State; use structs::OpStream; fn main()
.long("llvm") .help("Execute using LLVM JIT"), ); let matches = app.get_matches(); let dry_run = matches.is_present("dryrun"); let no_optimize = matches.is_present("no-optimize"); let use_llvm = cfg!(feature = "llvm") && matches.is_present("llvm"); for filename in matc...
{ let app = App::new("BrainRust") .arg( Arg::with_name("dry-run") .short("n") .long("dry-run") .help("Don't actually execute the program"), ) .arg( Arg::with_name("no-optimize") .short("0") ...
identifier_body
main.rs
use std::fs; use std::io; use std::io::Read; use clap::{App, Arg}; mod llvm_runner; mod optimizer; mod parser; mod runner; mod structs; #[cfg(feature = "llvm")] use llvm_runner::LlvmState; use parser::parse; use runner::State; use structs::OpStream; fn main() { let app = App::new("BrainRust") .arg( ...
}; let mut opstream = OpStream { ops }; if !(use_llvm || no_optimize) { opstream.optimize(); } if !dry_run { if use_llvm { #[cfg(feature = "llvm")] LlvmState::new(&mut io::stdin(), &mut io::stdout(), !no_optimize) ...
{ eprintln!("Error while parsing {}: {}", filename, e); continue; }
conditional_block
BitmapFilterType.ts
/** * Copyright 2014 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
static classInitializer: any = null; // List of static symbols to link. static classSymbols: string [] = null; // []; // List of instance symbols to link. static instanceSymbols: string [] = null; // []; constructor () { super(); } // JS -> AS Bindings static INNER: string...
// Called whenever the class is initialized.
random_line_split
BitmapFilterType.ts
/** * Copyright 2014 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
() { super(); } // JS -> AS Bindings static INNER: string = "inner"; static OUTER: string = "outer"; static FULL: string = "full"; // AS -> JS Bindings } }
constructor
identifier_name
insert-users.js
var Bookshelf = require('bookshelf'), Q = require('q'), uuid = require('node-uuid'), Mailgun = require('mailgun').Mailgun; var conf = require('./config'); var DB = Bookshelf.initialize(conf.database); var Participant = DB.Model.extend({ tableName: 'participants' }); var model = new Participant({email:...
});
{ console.log('Login at http://localhost:1337/%s', model.get('hash')); process.exit(0); }
conditional_block
insert-users.js
var Bookshelf = require('bookshelf'), Q = require('q'), uuid = require('node-uuid'), Mailgun = require('mailgun').Mailgun; var conf = require('./config'); var DB = Bookshelf.initialize(conf.database); var Participant = DB.Model.extend({ tableName: 'participants' });
mg.sendText('Turku Agile Day <info@turkuagileday.fi>', model.get('email'), 'Choose your workshops', 'Hi there!\nYou can choose in which workshops to participate by following the following link: http://localhost:1337/' + model.get('hash') + '\n\nBest regards,\nTurku Agile Day Organizers', function() { console....
var model = new Participant({email: process.argv[2], name: process.argv[3], hash: uuid.v4()}); model.save().then(function() { if (process.env.MAILGUN_API_KEY) { var mg = new Mailgun(process.env.MAILGUN_API_KEY);
random_line_split
error.py
class EmptyResult(object): ''' Null Object pattern to prevent Null reference errors when there is no result ''' def __init__(self): self.status = 0 self.body = '' self.msg = '' self.reason = '' def __nonzero__(self): return False class HapiError(ValueEr...
(HapiError): '''Error wrapper for 404 and 410 results''' class HapiTimeout(HapiError): '''Wrapper for socket timeouts, sslerror, and 504''' class HapiUnauthorized(HapiError): '''Wrapper for 401 Unauthorized errors''' class HapiServerError(HapiError): '''Wrapper for most 500 errors'''
HapiNotFound
identifier_name
error.py
class EmptyResult(object): ''' Null Object pattern to prevent Null reference errors when there is no result ''' def __init__(self): self.status = 0 self.body = '' self.msg = '' self.reason = '' def __nonzero__(self): return False class HapiError(ValueEr...
def __str__(self): return self.__unicode__().encode('ascii', 'replace') def __unicode__(self): params = {} request_keys = ('method', 'host', 'url', 'data', 'headers', 'timeout', 'body') result_attrs = ('status', 'reason', 'msg', 'body', 'headers') params['error'] = se...
super(HapiError,self).__init__(result and result.reason or "Unknown Reason") if result == None: self.result = EmptyResult() else: self.result = result if request == None: request = {} self.request = request self.err = err
identifier_body
error.py
class EmptyResult(object): ''' Null Object pattern to prevent Null reference errors when there is no result ''' def __init__(self): self.status = 0 self.body = '' self.msg = '' self.reason = ''
class HapiError(ValueError): """Any problems get thrown as HapiError exceptions with the relevant info inside""" as_str_template = u''' ---- request ---- {method} {host}{url}, [timeout={timeout}] ---- body ---- {body} ---- headers ---- {headers} ---- result ---- {result_status} ---- body ----- {result_body...
def __nonzero__(self): return False
random_line_split
error.py
class EmptyResult(object): ''' Null Object pattern to prevent Null reference errors when there is no result ''' def __init__(self): self.status = 0 self.body = '' self.msg = '' self.reason = '' def __nonzero__(self): return False class HapiError(ValueEr...
return unicode_data # Create more specific error cases, to make filtering errors easier class HapiBadRequest(HapiError): '''Error wrapper for most 40X results and 501 results''' class HapiNotFound(HapiError): '''Error wrapper for 404 and 410 results''' class HapiTimeout(HapiError): '''Wrapper ...
unicode_data[key] = val
conditional_block
manifest.js
import ResourceProcessorBase from './resource-processor-base'; class
extends ResourceProcessorBase { processResource (manifest, ctx, charset, urlReplacer) { var lines = manifest.split('\n'); for (var i = 0; i < lines.length; i++) { var line = lines[i].trim(); if (line && line !== 'CACHE MANIFEST' && line !== 'NETWORK:' && line !== 'FALLBACK...
ManifestProcessor
identifier_name
manifest.js
import ResourceProcessorBase from './resource-processor-base'; class ManifestProcessor extends ResourceProcessorBase {
var line = lines[i].trim(); if (line && line !== 'CACHE MANIFEST' && line !== 'NETWORK:' && line !== 'FALLBACK:' && line !== 'CACHE:' && line[0] !== '#' && line !== '*') { var isFallbackItem = line.indexOf(' ') !== -1; if (isFallbackItem) { ...
processResource (manifest, ctx, charset, urlReplacer) { var lines = manifest.split('\n'); for (var i = 0; i < lines.length; i++) {
random_line_split
manifest.js
import ResourceProcessorBase from './resource-processor-base'; class ManifestProcessor extends ResourceProcessorBase { processResource (manifest, ctx, charset, urlReplacer) { var lines = manifest.split('\n'); for (var i = 0; i < lines.length; i++) { var line = lines[i].trim(); ...
} export default new ManifestProcessor();
{ return ctx.contentInfo.isManifest; }
identifier_body
handle-gatsby-cloud.ts
import { silent as resolveFromSilent } from "resolve-from" import * as semver from "semver" import { IPluginInfo } from "../types" import { processPlugin } from "../process-plugin" export const GATSBY_CLOUD_PLUGIN_NAME = `gatsby-plugin-gatsby-cloud` export function addGatsbyPluginCloudPluginWhenInstalled( plugins: ...
} export function incompatibleGatsbyCloudPlugin( plugins: Array<IPluginInfo> ): boolean { const plugin = plugins.find( plugin => plugin.name === GATSBY_CLOUD_PLUGIN_NAME ) return !semver.satisfies(plugin!.version, `>=4.0.0-alpha`, { includePrerelease: true, }) }
{ const processedGatsbyCloudPlugin = processPlugin( { resolve: cloudPluginLocation, options: {}, }, rootDir ) plugins.push(processedGatsbyCloudPlugin) }
conditional_block
handle-gatsby-cloud.ts
import { silent as resolveFromSilent } from "resolve-from" import * as semver from "semver" import { IPluginInfo } from "../types" import { processPlugin } from "../process-plugin" export const GATSBY_CLOUD_PLUGIN_NAME = `gatsby-plugin-gatsby-cloud` export function
( plugins: Array<IPluginInfo>, rootDir: string ): void { const cloudPluginLocation = resolveFromSilent( rootDir, GATSBY_CLOUD_PLUGIN_NAME ) if (cloudPluginLocation) { const processedGatsbyCloudPlugin = processPlugin( { resolve: cloudPluginLocation, options: {}, }, ...
addGatsbyPluginCloudPluginWhenInstalled
identifier_name
handle-gatsby-cloud.ts
import { silent as resolveFromSilent } from "resolve-from" import * as semver from "semver" import { IPluginInfo } from "../types" import { processPlugin } from "../process-plugin" export const GATSBY_CLOUD_PLUGIN_NAME = `gatsby-plugin-gatsby-cloud` export function addGatsbyPluginCloudPluginWhenInstalled( plugins: ...
{ const plugin = plugins.find( plugin => plugin.name === GATSBY_CLOUD_PLUGIN_NAME ) return !semver.satisfies(plugin!.version, `>=4.0.0-alpha`, { includePrerelease: true, }) }
identifier_body
handle-gatsby-cloud.ts
import { silent as resolveFromSilent } from "resolve-from" import * as semver from "semver" import { IPluginInfo } from "../types" import { processPlugin } from "../process-plugin" export const GATSBY_CLOUD_PLUGIN_NAME = `gatsby-plugin-gatsby-cloud` export function addGatsbyPluginCloudPluginWhenInstalled( plugins: ...
): boolean { const plugin = plugins.find( plugin => plugin.name === GATSBY_CLOUD_PLUGIN_NAME ) return !semver.satisfies(plugin!.version, `>=4.0.0-alpha`, { includePrerelease: true, }) }
export function incompatibleGatsbyCloudPlugin( plugins: Array<IPluginInfo>
random_line_split
services.func.js
import Services from '../src/lib/services'; const _ = require('lodash'); require('db-migrate-mysql'); const expect = require('unexpected'); const request = require('./request.func'); let rds; class Email { // eslint-disable-next-line sendHtml() { return Promise.resolve(); } } class Slack { // eslint-dis...
return new Slack(); } getMysql() { if (!rds) { // eslint-disable-next-line global-require rds = require('serverless-mysql')({ config: { host: this.getEnv('RDS_HOST'), user: this.getEnv('RDS_USER'), password: this.getEnv('RDS_PASSWORD'), database: ...
// eslint-disable-next-line class-methods-use-this getSlack() {
random_line_split
services.func.js
import Services from '../src/lib/services'; const _ = require('lodash'); require('db-migrate-mysql'); const expect = require('unexpected'); const request = require('./request.func'); let rds; class Email { // eslint-disable-next-line sendHtml() { return Promise.resolve(); } } class Slack { // eslint-dis...
} export default class FuncTestServices extends Services { // eslint-disable-next-line class-methods-use-this getEmail() { return new Email(); } // eslint-disable-next-line class-methods-use-this getSlack() { return new Slack(); } getMysql() { if (!rds) { // eslint-disable-next-line ...
{ return Promise.resolve(); }
identifier_body
services.func.js
import Services from '../src/lib/services'; const _ = require('lodash'); require('db-migrate-mysql'); const expect = require('unexpected'); const request = require('./request.func'); let rds; class Email { // eslint-disable-next-line sendHtml() { return Promise.resolve(); } } class Slack { // eslint-dis...
() { return new Slack(); } getMysql() { if (!rds) { // eslint-disable-next-line global-require rds = require('serverless-mysql')({ config: { host: this.getEnv('RDS_HOST'), user: this.getEnv('RDS_USER'), password: this.getEnv('RDS_PASSWORD'), datab...
getSlack
identifier_name
services.func.js
import Services from '../src/lib/services'; const _ = require('lodash'); require('db-migrate-mysql'); const expect = require('unexpected'); const request = require('./request.func'); let rds; class Email { // eslint-disable-next-line sendHtml() { return Promise.resolve(); } } class Slack { // eslint-dis...
return rds; } static async initDb() { await rds.query( 'INSERT IGNORE INTO vendors SET id=?, name=?, address=?, email=?, isPublic=?', [process.env.FUNC_VENDOR, 'test', 'test', process.env.FUNC_USER_EMAIL, 0], ); await rds.query('DELETE FROM appVersions WHERE vendor=?', [process.env.FUN...
{ // eslint-disable-next-line global-require rds = require('serverless-mysql')({ config: { host: this.getEnv('RDS_HOST'), user: this.getEnv('RDS_USER'), password: this.getEnv('RDS_PASSWORD'), database: this.getEnv('RDS_DATABASE'), ssl: this.getEnv('R...
conditional_block
text_renderer.rs
<u32>, vertex_buffer: BufferHandle<GlResources, Vertex>, index_buffer: BufferHandle<GlResources, u32>, params: TextShaderParams<GlResources>, } impl TextRenderer { pub fn new( graphics: &mut Graphics<GlDevice>, frame_size: [u32; 2], initial_buffer_size: usize, bitmap_fo...
#[derive(Copy)] #[derive(Clone)] #[derive(Debug)]
random_line_split
text_renderer.rs
}; use gfx::batch::{ Error, RefBatch, }; use gfx::shade::TextureParam; use gfx_device_gl::{ GlDevice, GlResources, }; use bitmap_font::BitmapFont; use utils::{grow_buffer, MAT4_ID}; pub struct TextRenderer { program: ProgramHandle<GlResources>, state: DrawState, bitmap_font: BitmapFont,...
(&mut self, width: u32, height: u32) { self.params.u_screen_size = [width as f32, height as f32]; } pub fn draw_text_at_position( &mut self, text: &str, world_position: [f32; 3], color: [f32; 4], ) { self.draw_text(text, [0, 0], world_position, 0, color); ...
resize
identifier_name
http.rs
extern crate websocket; extern crate hyper; extern crate serde_json; use std::thread; use self::hyper::header::{ContentLength, ContentType}; use self::hyper::mime::{Mime, TopLevel, SubLevel}; use self::hyper::server::{Request, Response}; use self::hyper::status::StatusCode; use self::hyper::uri::RequestUri; const HEA...
}; res.headers_mut() .set(ContentLength(get_response.len() as u64)); res.send(get_response).unwrap(); }) .unwrap(); }) } pub fn port() -> i32 { 8080 }
{ *res.status_mut() = StatusCode::MethodNotAllowed; b"502" }
conditional_block
http.rs
extern crate websocket; extern crate hyper; extern crate serde_json; use std::thread; use self::hyper::header::{ContentLength, ContentType}; use self::hyper::mime::{Mime, TopLevel, SubLevel}; use self::hyper::server::{Request, Response}; use self::hyper::status::StatusCode; use self::hyper::uri::RequestUri; const HEA...
() -> thread::JoinHandle<()> { thread::spawn(|| { let addr = format!("0.0.0.0:{}", port()); let server = hyper::Server::http(addr).unwrap(); let index = format!("{}<script>{}</script>", HEADER, SCRIPT); server .handle(move |req: Request, mut res: Response| { ...
start_thread
identifier_name
http.rs
extern crate websocket; extern crate hyper; extern crate serde_json; use std::thread; use self::hyper::header::{ContentLength, ContentType}; use self::hyper::mime::{Mime, TopLevel, SubLevel}; use self::hyper::server::{Request, Response}; use self::hyper::status::StatusCode; use self::hyper::uri::RequestUri; const HEA...
{ 8080 }
identifier_body
http.rs
extern crate websocket; extern crate hyper; extern crate serde_json; use std::thread; use self::hyper::header::{ContentLength, ContentType}; use self::hyper::mime::{Mime, TopLevel, SubLevel}; use self::hyper::server::{Request, Response}; use self::hyper::status::StatusCode; use self::hyper::uri::RequestUri; const HEA...
vec![]))); include_bytes!("html/favicon.ico") } _ => { *res.status_mut() = StatusCode::NotFound; b"404" ...
.set(ContentType(Mime(TopLevel::Image, SubLevel::Ext("x-icon".to_string()),
random_line_split
workflow-importer.js
/* * 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")...
}); importedWfActionVersions._keys.forEach(function(wfActionType){ if(!CommonUtils.isSupportedAction(wfActionType)){ return; } var maxImportedActionVersion = Math.max.apply(null,importedWfActionVersions.get(wfActionType)); var supportedVersions = this.get('schemaVersions').getS...
{ importedWfActionVersions.set(wfActionType, [wfActionVersion]); }
conditional_block
workflow-importer.js
/* * 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")...
}else{ workflow.schemaVersions.actionVersions.set(wfActionType, maxImportedActionVersion); } }, this); }, this); }, processActionNode(nodeMap,action){ var actionMapper=this.get("workflowMapper").getNodeHandler("action"); var actionNode=actionMapper.handleImportNode(action...
importedWfActionVersions.get(wfActionType).forEach((version)=>{ if(supportedVersions.indexOf(version) === -1){ errors.push({message: "Unsupported " + wfActionType + " version - " + maxImportedActionVersion});
random_line_split
workflow-importer.js
/* * 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")...
, getNodeIds(nodeMap){ var ids=[]; nodeMap.forEach(function(entry){ var node=entry.node; ids.push(node.id); }); return ids; }, getNodeNames(nodeMap){ var names=[]; nodeMap.forEach(function(entry){ var node=entry.node; names.push(node.id); }); return names; ...
{ var self=this; nodeMap.forEach(function(entry,key){ var node=entry.node; if (!node){ console.error("could not process:",key);//TODO error handling... return; } var json=entry.json; var nodeHandler=self.workflowMapper.getNodeHandler(node.get("type")); if (!no...
identifier_body
workflow-importer.js
/* * 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")...
(nodeMap){ var containsKillNode=false; nodeMap.forEach(function(entry){ var node=entry.node; if (node.isKillNode()){ containsKillNode=true; } }); return containsKillNode; } }); export {WorkflowImporter};
containsKillNode
identifier_name
main.js
!function(){ "use strict"; var oCanvasElm = document.getElementById("terrain"), ctx = oCanvasElm.getContext("2d"); function setCanvasSize( width, height ){ ctx.canvas.width = width; ctx.canvas.height = height; } function
(){ ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height); } function mouseCoord(e){ var posx = 0; var posy = 0; if( !e ){ e = window.event; } if( e.pageX || e.pageY ){ posx = e.pageX; posy = e.pageY; } else if( e.clientX || e.cl...
clearCanvas
identifier_name
main.js
!function(){ "use strict"; var oCanvasElm = document.getElementById("terrain"), ctx = oCanvasElm.getContext("2d"); function setCanvasSize( width, height ){ ctx.canvas.width = width;
} function mouseCoord(e){ var posx = 0; var posy = 0; if( !e ){ e = window.event; } if( e.pageX || e.pageY ){ posx = e.pageX; posy = e.pageY; } else if( e.clientX || e.clientY ){ posx = e.clientX + document.body.scrollLeft ...
ctx.canvas.height = height; } function clearCanvas(){ ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);
random_line_split
main.js
!function(){ "use strict"; var oCanvasElm = document.getElementById("terrain"), ctx = oCanvasElm.getContext("2d"); function setCanvasSize( width, height ){ ctx.canvas.width = width; ctx.canvas.height = height; } function clearCanvas(){ ctx.clearRect(0,0,ctx.canva...
// posx and posy contain the mouse position relative to the document return {x:posx, y:posy}; } }();
{ posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; }
conditional_block
main.js
!function(){ "use strict"; var oCanvasElm = document.getElementById("terrain"), ctx = oCanvasElm.getContext("2d"); function setCanvasSize( width, height )
function clearCanvas(){ ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height); } function mouseCoord(e){ var posx = 0; var posy = 0; if( !e ){ e = window.event; } if( e.pageX || e.pageY ){ posx = e.pageX; posy = e.pageY; } ...
{ ctx.canvas.width = width; ctx.canvas.height = height; }
identifier_body