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
append.ts
'use strict'; var append: { (parentNode: HTMLElement, node: any, position?: string): HTMLElement; create: (node: string) => HTMLElement; remove: (node: HTMLElement) => void; toIndex: (parentNode: HTMLElement, node: HTMLElement, index: number) => HTMLElement; }; append = (() => { var append: any = function(parentN...
} return node; }; } append.create = function (node: string) { return window.document.createElement(node); }; append.remove = function (node: HTMLElement) { if (node.parentNode) { node.parentNode.removeChild(node); } }; append.toIndex = function (parentNode: HTMLElement, node: HTMLElement, index: ...
} else { if (position === 'beforeBegin') { parentNode.parentNode.insertBefore(node, parentNode); }
random_line_split
rollup-aot.config.js
/* eslint no-console: 0 */ 'use strict'; const fs = require('fs'); const mkdirp = require('mkdirp'); const rollup = require('rollup'); const nodeResolve = require('rollup-plugin-node-resolve'); const commonjs = require('rollup-plugin-commonjs'); const uglify = require('rollup-plugin-uglify'); const src = 'src'; con...
app.write({ format: 'iife', dest: `${dest}/app.js`, sourceMap: false, }) ), // build polyfills rollup.rollup({ entry: `${src}/polyfills-aot.js`, context: 'this', plugins: [ nodeResolve({ jsnext: true, module: true }), commonjs(), uglify(), ], }).then(...
}).then(app =>
random_line_split
history.component.ts
import { AlertController } from 'ionic-angular'; import { PlayService } from './../../service/playService'; import { Component } from '@angular/core'; @Component({ selector: 'history', templateUrl: './history.component.html', styleUrls: ['./history.component.scss'] }) export class HistoryComponent { con...
type.selected = true; this.playSvr.getPlays(type.id).subscribe( data => { let result = data.json(); if (!result.error) { this.histories = result.data; } this.loading = false; }, error => { ...
delete py.selected; } }
conditional_block
history.component.ts
import { AlertController } from 'ionic-angular'; import { PlayService } from './../../service/playService'; import { Component } from '@angular/core'; @Component({ selector: 'history', templateUrl: './history.component.html', styleUrls: ['./history.component.scss'] }) export class HistoryComponent { con...
alert.present(); }, "获取历史开奖记录失败"); } ); } }
oading = true; for (let py of this.playTypes) { if (py.id != type.id) { delete py.selected; } } type.selected = true; this.playSvr.getPlays(type.id).subscribe( data => { let result = data.json(); if (!res...
identifier_body
history.component.ts
import { AlertController } from 'ionic-angular'; import { PlayService } from './../../service/playService'; import { Component } from '@angular/core'; @Component({ selector: 'history', templateUrl: './history.component.html', styleUrls: ['./history.component.scss'] }) export class
{ constructor( private playSvr: PlayService, private alertCtrl: AlertController ) { } playTypes = []; histories = []; loading: boolean = true; ionViewWillEnter() { this.playTypes = this.playSvr.getPlayTypesList(); if (this.playTypes && this.playTypes.length) { ...
HistoryComponent
identifier_name
history.component.ts
import { AlertController } from 'ionic-angular'; import { PlayService } from './../../service/playService'; import { Component } from '@angular/core'; @Component({ selector: 'history', templateUrl: './history.component.html', styleUrls: ['./history.component.scss'] }) export class HistoryComponent { con...
this.playSvr.errorHandler(error, (msg) => { let alert = this.alertCtrl.create({ message: msg }); alert.present(); }, "获取玩法分类失败") } ); } } ...
error => {
random_line_split
borland.py
# -*- coding: utf-8 -*- """ pygments.styles.borland ~~~~~~~~~~~~~~~~~~~~~~~ Style similar to the style used in the Borland IDEs. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.style import Style from pygment...
(Style): """ Style similar to the style used in the borland IDEs. """ default_style = '' styles = { Whitespace: '#bbbbbb', Comment: 'italic #008800', Comment.Preproc: 'noitalic #008080', Comment.Special: 'noitali...
BorlandStyle
identifier_name
borland.py
# -*- coding: utf-8 -*- """ pygments.styles.borland ~~~~~~~~~~~~~~~~~~~~~~~ Style similar to the style used in the Borland IDEs. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.style import Style from pygment...
Generic.Heading: '#999999', Generic.Subheading: '#aaaaaa', Generic.Deleted: 'bg:#ffdddd #000000', Generic.Inserted: 'bg:#ddffdd #000000', Generic.Error: '#aa0000', Generic.Emph: 'italic', Generic.Strong: '...
""" Style similar to the style used in the borland IDEs. """ default_style = '' styles = { Whitespace: '#bbbbbb', Comment: 'italic #008800', Comment.Preproc: 'noitalic #008080', Comment.Special: 'noitalic bold', ...
identifier_body
borland.py
# -*- coding: utf-8 -*- """ pygments.styles.borland ~~~~~~~~~~~~~~~~~~~~~~~ Style similar to the style used in the Borland IDEs. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.style import Style from pygment...
Comment.Special: 'noitalic bold', String: '#0000FF', String.Char: '#800080', Number: '#0000FF', Keyword: 'bold #000080', Operator.Word: 'bold', Name.Tag: 'bold #000080'...
Comment.Preproc: 'noitalic #008080',
random_line_split
startup-assistant.js
function
(changelog) { this.justChangelog = changelog; // on first start, this message is displayed, along with the current version message from below this.firstMessage = $L('Here are some tips for first-timers:<ul><li>Lumberjack has no tips yet</li></ul>'); this.secondMessage = $L('We hope you enjoy chopping d...
StartupAssistant
identifier_name
startup-assistant.js
function StartupAssistant(changelog) { this.justChangelog = changelog; // on first start, this message is displayed, along with the current version message from below this.firstMessage = $L('Here are some tips for first-timers:<ul><li>Lumberjack has no tips yet</li></ul>'); this.secondMessage = $L('We ...
, 'More log level preferences' ] }, { version: '0.1.1', log: [ 'Service Stability Updates' ] }, { version: '0.1.0', log: [ 'Initial Release!' ] } ]; // setup menu this.menuModel = { visible: true, items: [ { label: $L("Help"), command: 'do-help' } ] }; ...
'Added a way to get back to this changelog from the help scene' ] }, { version: '0.3.1', log: [ 'Exclude logging messages from dbus capture' ] }, { version: '0.3.0', log: [ 'Added DBus Capture for debugging services' , 'Type-to-Search in get-log scene'
random_line_split
startup-assistant.js
function StartupAssistant(changelog) { this.justChangelog = changelog; // on first start, this message is displayed, along with the current version message from below this.firstMessage = $L('Here are some tips for first-timers:<ul><li>Lumberjack has no tips yet</li></ul>'); this.secondMessage = $L('We ...
}; // Local Variables: // tab-width: 4 // End:
{ switch (event.command) { case 'do-continue': this.controller.stageController.swapScene({name: 'main', transition: Mojo.Transition.crossFade}); break; case 'do-prefs': this.controller.stageController.pushScene('preferences'); break; case 'do-help': this.controller.stageCont...
conditional_block
startup-assistant.js
function StartupAssistant(changelog)
'Fixed Ls2 Monitor for webOS 2.0' ] }, { version: '0.4.1', log: [ 'Better graphs for resource monitor', 'Added Clear Log File to main scene and get log scene for clearing the /var/log/messages file', 'Fixed bug where resource monitor would fail to start a second time' ] }, { version...
{ this.justChangelog = changelog; // on first start, this message is displayed, along with the current version message from below this.firstMessage = $L('Here are some tips for first-timers:<ul><li>Lumberjack has no tips yet</li></ul>'); this.secondMessage = $L('We hope you enjoy chopping down trees, s...
identifier_body
extra.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from django.core.exceptions import ImproperlyConfigured from django.core.sig...
def extra_view_dispatch(request, view): """ Dispatch to an Xtheme extra view. :param request: A request :type request: django.http.HttpRequest :param view: View name :type view: str :return: A response of some ilk :rtype: django.http.HttpResponse """ theme = get_current_theme...
if not theme: return None cache_key = (theme.identifier, view_name) if cache_key not in _VIEW_CACHE: view = _get_view_by_name(theme, view_name) _VIEW_CACHE[cache_key] = view else: view = _VIEW_CACHE[cache_key] return view
identifier_body
extra.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from django.core.exceptions import ImproperlyConfigured from django.core.sig...
cache_key = (theme.identifier, view_name) if cache_key not in _VIEW_CACHE: view = _get_view_by_name(theme, view_name) _VIEW_CACHE[cache_key] = view else: view = _VIEW_CACHE[cache_key] return view def extra_view_dispatch(request, view): """ Dispatch to an Xtheme extra v...
return None
conditional_block
extra.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from django.core.exceptions import ImproperlyConfigured from django.core.sig...
(request, view): """ Dispatch to an Xtheme extra view. :param request: A request :type request: django.http.HttpRequest :param view: View name :type view: str :return: A response of some ilk :rtype: django.http.HttpResponse """ theme = get_current_theme(request) view_func = ...
extra_view_dispatch
identifier_name
extra.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from django.core.exceptions import ImproperlyConfigured from django.core.sig...
:rtype: django.http.HttpResponse """ theme = get_current_theme(request) view_func = get_view_by_name(theme, view) if not view_func: msg = "%s/%s: Not found" % (getattr(theme, "identifier", None), view) return HttpResponseNotFound(msg) return view_func(request)
:param view: View name :type view: str :return: A response of some ilk
random_line_split
collectionsearch.py
# Copyright: (c) 2019, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.module_utils.six import string_types from ansible.playbook.attribute import FieldAttr...
# FIXME: exclude role tasks? if default_collection and default_collection not in collection_list: collection_list.insert(0, default_collection) # if there's something in the list, ensure that builtin or legacy is always there too if collection_list and 'ansible.builtin' not in collection_list...
collection_list = []
conditional_block
collectionsearch.py
# Copyright: (c) 2019, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.module_utils.six import string_types from ansible.playbook.attribute import FieldAttr...
class CollectionSearch: # this needs to be populated before we can resolve tasks/roles/etc _collections = FieldAttribute(isa='list', listof=string_types, priority=100, default=_ensure_default_collection, always_post_validate=True, static=True) def _load_collections(sel...
default_collection = AnsibleCollectionLoader().default_collection # Will be None when used as the default if collection_list is None: collection_list = [] # FIXME: exclude role tasks? if default_collection and default_collection not in collection_list: collection_list.insert(0, default...
identifier_body
collectionsearch.py
# Copyright: (c) 2019, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.module_utils.six import string_types from ansible.playbook.attribute import FieldAttr...
# field early on to guarantee we are dealing with a list. ds = self.get_validated_value('collections', self._collections, ds, None) # this will only be called if someone specified a value; call the shared value _ensure_default_collection(collection_list=ds) if not ds: # don't ...
# We are always a mixin with Base, so we can validate this untemplated
random_line_split
collectionsearch.py
# Copyright: (c) 2019, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.module_utils.six import string_types from ansible.playbook.attribute import FieldAttr...
(self, attr, ds): # We are always a mixin with Base, so we can validate this untemplated # field early on to guarantee we are dealing with a list. ds = self.get_validated_value('collections', self._collections, ds, None) # this will only be called if someone specified a value; call the ...
_load_collections
identifier_name
lib.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com> // // 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.o...
(cx: &mut ExtCtxt, it: P<ast::Item>) -> P<ast::Item> { match it.node { ast::ItemKind::Fn(ref decl, style, constness, abi, _, ref block) => { let istr = it.ident.name.as_str(); let fn_name = &*istr; let ty_params = platformtree::builder::meta_args::get_ty_params_for_task(cx, fn_name); let ...
macro_zinc_task_item
identifier_name
lib.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com> // // 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.o...
fn macro_zinc_task(cx: &mut ExtCtxt, _: Span, _: &ast::MetaItem, ann: Annotatable) -> Annotatable { match ann { Annotatable::Item(it) => {Annotatable::Item(macro_zinc_task_item(cx, it))} other => {other} } } fn macro_zinc_task_item(cx: &mut ExtCtxt, it: P<ast::Item>) -> P<ast::Item> { match it.no...
} macro_platformtree(cx, sp, tts) }
random_line_split
lib.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com> // // 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.o...
["pt".to_string(), fn_name.to_string() + "_args"].iter().map(|t| cx.ident_of(t.as_str())).collect(), vec!(), ty_params.iter().map(|ty| { cx.ty_path(cx.path_ident(DUMMY_SP, cx.ident_of(ty.to_tyhash().as_str()))) }).collect(), ...
{ let istr = it.ident.name.as_str(); let fn_name = &*istr; let ty_params = platformtree::builder::meta_args::get_ty_params_for_task(cx, fn_name); let params = ty_params.iter().map(|ty| { cx.typaram( DUMMY_SP, cx.ident_of(ty.to_tyhash().as_str()), P::f...
conditional_block
card.component.ts
at * * http://www.apache.org/licenses/LICENSE-2.0 * * 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 ...
this.polarideStyleMap.set('tilted-minus-2-degree', 'card-container-pol-styl'); this.polarideStyleMap.set('tilted-2-degree', 'card-container-pol-styl2'); this.polarideStyleMap.set('tilted-4-degree', 'card-container-pol-styl3'); this.polarideStyleMap.set('tilted-minus-4-degree', 'card-container-pol-styl4'...
this.instance = this; this.polarideStyleMap = new Map();
random_line_split
card.component.ts
at * * http://www.apache.org/licenses/LICENSE-2.0 * * 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 ...
() { // FOR HEADER PADING this.headerComponentList = this.amexioHeader.toArray(); this.headerComponentList.forEach((item: AmexioHeaderComponent, currentIndex) => { item.fullScreenFlag = this.yesFullScreen; item.fullscreenMaxCard = true; item.aComponent = 'card'; if (item.padding) { ...
ngAfterContentInit
identifier_name
card.component.ts
* * http://www.apache.org/licenses/LICENSE-2.0 * * 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 per...
ngAfterContentChecked() { } ngAfterContentInit() { // FOR HEADER PADING this.headerComponentList = this.amexioHeader.toArray(); this.headerComponentList.forEach((item: AmexioHeaderComponent, currentIndex) => { item.fullScreenFlag = this.yesFullScreen; item.fullscreenMaxCard = true; ...
{ super.ngAfterViewInit(); }
identifier_body
card.component.ts
12/18/17. */ import { DOCUMENT } from '@angular/common'; import { AfterContentChecked, AfterContentInit, AfterViewInit, Component, ElementRef, EventEmitter, HostListener, Inject, Input, OnDestroy, OnInit, Output, Renderer2, ViewChild, } from '@angular/core'; import { ContentChildren, QueryList } from '@angular/...
{ this.globalClickListenFunc(); }
conditional_block
move_imagery.py
from tempfile import TemporaryDirectory import psycopg2 conn = psycopg2.connect( database='innoter', user='postgres', password='postgres', host='192.168.0.107', port='5432') cursor = conn.cursor() dst_dir = r"\\nas1\storage\DG_archive\sat" path_list = [] cursor.execute( """SELECT path, order_id FROM geoar...
import os import shutil import re import zipfile import xml.etree.ElementTree as ET
random_line_split
move_imagery.py
import os import shutil import re import zipfile import xml.etree.ElementTree as ET from tempfile import TemporaryDirectory import psycopg2 conn = psycopg2.connect( database='innoter', user='postgres', password='postgres', host='192.168.0.107', port='5432') cursor = conn.cursor() dst_dir = r"\\nas1\storage\DG_arc...
with zipfile.ZipFile(zip_path) as zf: # order_shape = [fnm for fnm in zf.namelist() if re.match(r'.+ORDER_SHAPE.+', fnm, re.I)] # if not order_shape: # # for fnm in zf.namelist(): # # if re.match(r'.+ORDER_SHAPE.+', fnm, re.I) is None: # cursor.execute("""UPDATE geoar...
zip_path, order_id = result[0], result[1] print(i + 1, zip_path) dst_filepath = os.path.join(dst_dir, os.path.basename(zip_path)) shutil.move(zip_path, dst_filepath) cursor.execute("""UPDATE geoarchive.dg_orders SET path = %s WHERE order_id = %s""", [dst_filepath, order_id, ], ) conn...
conditional_block
PlatformExpress.spec.ts
import {PlatformBuilder} from "@tsed/common"; import Sinon from "sinon"; import {expect} from "chai"; import {PlatformExpress} from "@tsed/platform-express"; const sandbox = Sinon.createSandbox(); class
{} describe("PlatformExpress", () => { describe("create()", () => { beforeEach(() => { sandbox.stub(PlatformBuilder, "create"); }); afterEach(() => sandbox.restore()); it("should create platform", () => { PlatformExpress.create(Server, {}); expect(PlatformBuilder.create).to.have.b...
Server
identifier_name
PlatformExpress.spec.ts
import {PlatformBuilder} from "@tsed/common"; import Sinon from "sinon"; import {expect} from "chai"; import {PlatformExpress} from "@tsed/platform-express";
describe("PlatformExpress", () => { describe("create()", () => { beforeEach(() => { sandbox.stub(PlatformBuilder, "create"); }); afterEach(() => sandbox.restore()); it("should create platform", () => { PlatformExpress.create(Server, {}); expect(PlatformBuilder.create).to.have.been.c...
const sandbox = Sinon.createSandbox(); class Server {}
random_line_split
form-list.component.spec.ts
import { TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core'; import { of } from 'rxjs'; import { Ng2FilterPipe } from '../../../shared/pipes/ng2-...
{ name: 'form 2', display: 'form 2', published: true, uuid: 'uuid2', version: '1.0', favourite: false }, { name: 'form 1', display: 'form 1', published: true, uuid: 'uuid', version: '1.0...
} ]; const expectedFormsList = [
random_line_split
form-list.component.spec.ts
import { TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core'; import { of } from 'rxjs'; import { Ng2FilterPipe } from '../../../shared/pipes/ng2-...
implements PipeTransform { transform(value: any, decimalPlaces: number): any { return value; } } describe('FormList Component', () => { const fakeChangeDetectorRef = { markForCheck: () => {} }; let fixture, nativeElement, comp; beforeEach(async(() => { TestBed.configureTestingModule({ ...
FakeTranslatePipe
identifier_name
main.rs
//! Module with the entry point of the binary. extern crate case; extern crate clap; extern crate conv; #[macro_use] extern crate log; extern crate rush; mod args; mod logging; mod rcfile; use std::error::Error; // for .cause() method use std::io::{self, Write}; use std::iter::repeat; use std::process::exit; us...
Ok(()) } /// Apply the expressions to the standard input with given mode. /// This forms the bulk of the input processing. #[inline] fn apply_multi_ctx(mode: InputMode, context: &mut Context, exprs: &[&str], mut output: &mut Write) -> io::Result<()> { let func: fn(_, _, _, _) -> _ = match ...
{ let result = try!(rush::eval(after, &mut context)); let result_string = try!(String::try_from(result) .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))); // Make it so that the output always ends with a newline, // regardless whether it consists of a single value...
conditional_block
main.rs
//! Module with the entry point of the binary. extern crate case; extern crate clap; extern crate conv; #[macro_use] extern crate log; extern crate rush; mod args; mod logging; mod rcfile; use std::error::Error; // for .cause() method use std::io::{self, Write}; use std::iter::repeat; use std::process::exit; us...
// Do the processing. // // If there is an "after" expression provided, it is that expression that should produce // the only output of the program. So we'll just consume whatever results would normally // be printed otherwise. if after.is_some() { // HACK: Because the intermediate resul...
if let Some(before) = before { try!(rush::exec(before, &mut context)); }
random_line_split
main.rs
//! Module with the entry point of the binary. extern crate case; extern crate clap; extern crate conv; #[macro_use] extern crate log; extern crate rush; mod args; mod logging; mod rcfile; use std::error::Error; // for .cause() method use std::io::{self, Write}; use std::iter::repeat; use std::process::exit; us...
(mode: InputMode, before: Option<&str>, exprs: &[&str], after: Option<&str>) -> io::Result<()> { // Prepare a Context for the processing. // This includes evaluating any "before" expression within it. let mut context = Context::new(); try!(rcfile::load_into(&mut context) .map_er...
process_input
identifier_name
main.rs
//! Module with the entry point of the binary. extern crate case; extern crate clap; extern crate conv; #[macro_use] extern crate log; extern crate rush; mod args; mod logging; mod rcfile; use std::error::Error; // for .cause() method use std::io::{self, Write}; use std::iter::repeat; use std::process::exit; us...
/// Handle an error that occurred while processing the input. fn handle_error(error: io::Error) { writeln!(&mut io::stderr(), "error: {}", error).unwrap(); // Print the error causes as an indented "tree". let mut cause = error.cause(); let mut indent = 0; while let Some(error) = cause { w...
{ let func: fn(_, _, _, _) -> _ = match mode { InputMode::String => rush::apply_string_multi_ctx, InputMode::Lines => rush::map_lines_multi_ctx, InputMode::Words => rush::map_words_multi_ctx, InputMode::Chars => rush::map_chars_multi_ctx, InputMode::Bytes => rush::map_bytes_m...
identifier_body
aws_logs.py
# Copyright 2018 PerfKitBenchmarker Authors. 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 appli...
stdout, _, _ = vm_util.IssueCommand(get_cmd) return json.loads(stdout) def GetLogStreamAsString(region, stream_name, log_group): """Returns the messages of the log stream as a string.""" log_lines = [] token = None events = [] while token is None or events: response = GetLogs(region, stream_name, l...
get_cmd.extend(['--next-token', token])
conditional_block
aws_logs.py
# Copyright 2018 PerfKitBenchmarker Authors. 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 appli...
def GetLogStreamAsString(region, stream_name, log_group): """Returns the messages of the log stream as a string.""" log_lines = [] token = None events = [] while token is None or events: response = GetLogs(region, stream_name, log_group, token) events = response['events'] token = response['next...
"""Fetches the JSON formatted log stream starting at the token.""" get_cmd = util.AWS_PREFIX + [ '--region', region, 'logs', 'get-log-events', '--start-from-head', '--log-group-name', group_name, '--log-stream-name', stream_name, ] if token: get_cmd.extend(['--next-token', token]...
identifier_body
aws_logs.py
# Copyright 2018 PerfKitBenchmarker Authors. 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 appli...
'--no-paginate' ] stdout, _, _ = vm_util.IssueCommand(describe_cmd) log_groups = json.loads(stdout)['logGroups'] group = next((group for group in log_groups if group['logGroupName'] == self.name), None) return bool(group) def _PostCreate(self): """Set the retention p...
'--log-group-name-prefix', self.name,
random_line_split
aws_logs.py
# Copyright 2018 PerfKitBenchmarker Authors. 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 appli...
(self): """Set the retention policy.""" put_cmd = util.AWS_PREFIX + [ '--region', self.region, 'logs', 'put-retention-policy', '--log-group-name', self.name, '--retention-in-days', str(self.retention_in_days) ] vm_util.IssueCommand(put_cmd) def GetLogs(region, stream_na...
_PostCreate
identifier_name
test_directory.py
"""Tests for the directory module""" import os from translate.storage import directory class TestDirectory: """a test class to run tests on a test Pootle Server""" def setup_method(self, method): """sets up a test directory""" print("setup_method called on", self.__class__.__name__) ...
assert len(d.getunits()) == 3
assert unit.target == "blabla"
conditional_block
test_directory.py
"""Tests for the directory module""" import os from translate.storage import directory class TestDirectory: """a test class to run tests on a test Pootle Server""" def setup_method(self, method): """sets up a test directory""" print("setup_method called on", self.__class__.__name__) ...
(self): """Tests a small directory structure.""" files = ["a.po", "b.po", "c.po"] self.touchfiles(self.testdir, files) self.mkdir("bla") self.touchfiles(os.path.join(self.testdir, "bla"), files) d = directory.Directory(self.testdir) filenames = [name for dirname,...
test_structure
identifier_name
test_directory.py
"""Tests for the directory module""" import os from translate.storage import directory class TestDirectory: """a test class to run tests on a test Pootle Server""" def setup_method(self, method): """sets up a test directory""" print("setup_method called on", self.__class__.__name__) ...
files = files * 2 files.sort() assert filenames == files def test_getunits(self): """Tests basic functionality.""" files = ["a.po", "b.po", "c.po"] posource = '''msgid "bla"\nmsgstr "blabla"\n''' self.touchfiles(self.testdir, files, posource) d = dir...
self.touchfiles(os.path.join(self.testdir, "bla"), files) d = directory.Directory(self.testdir) filenames = [name for dirname, name in d.getfiles()] filenames.sort()
random_line_split
test_directory.py
"""Tests for the directory module""" import os from translate.storage import directory class TestDirectory: """a test class to run tests on a test Pootle Server""" def setup_method(self, method): """sets up a test directory""" print("setup_method called on", self.__class__.__name__) ...
def test_created(self): """test that the directory actually exists""" print(self.testdir) assert os.path.isdir(self.testdir) def test_basic(self): """Tests basic functionality.""" files = ["a.po", "b.po", "c.po"] files.sort() self.touchfiles(self.testdi...
"""Makes a directory inside self.testdir.""" os.mkdir(os.path.join(self.testdir, dir))
identifier_body
config.rs
// In heavy WIP use std::fs::{ self, File }; use std::io::Read; use std::path::Path; use toml; use error::PackageError; use repository::RepositoryUrls; /// Represents the config file. #[derive(Debug, Deserialize)] pub struct Config { pub buffer_size: Option<u64>, // pub config_path: Option<String>, pub do...
// Wait for RFC-2086 to be implemented first. /* [allow(irrefutable_let_pattern)] if let Config { $key: mut x, .. } = $dest { if let None = x { x = $value } } */ ...
{ // Destructuring the default configs into individual variables. let Self { buffer_size: buf_size, download_path: dl_path, unpack_path: unpk_path, repository: repo, } = Self::default(); /// Internal macro, to ease the implementation of `f...
identifier_body
config.rs
// In heavy WIP use std::fs::{ self, File }; use std::io::Read; use std::path::Path; use toml; use error::PackageError; use repository::RepositoryUrls; /// Represents the config file. #[derive(Debug, Deserialize)] pub struct Config { pub buffer_size: Option<u64>, // pub config_path: Option<String>, pub do...
<P: AsRef<Path>>(path: P) -> Result<Self, PackageError> { let mut content = String::new(); // Check whether there are tons of configs in the path if path.as_ref().is_dir() { // Read every config files and put them into a string, if it is for entry in fs::read_dir(path)? ...
read_from
identifier_name
config.rs
// In heavy WIP use std::fs::{ self, File }; use std::io::Read; use std::path::Path; use toml; use error::PackageError; use repository::RepositoryUrls; /// Represents the config file. #[derive(Debug, Deserialize)] pub struct Config { pub buffer_size: Option<u64>, // pub config_path: Option<String>, pub do...
else { // Read the config file into a string, if it isn't let mut config = File::open(path)?; config.read_to_string(&mut content)?; } // Try to parse the string, and convert it into a `Config`. let config = content.parse::<toml::Value>()?; let config...
{ // Read every config files and put them into a string, if it is for entry in fs::read_dir(path)? { let entry = entry?; let mut config = File::open(entry.path())?; config.read_to_string(&mut content)?; } }
conditional_block
config.rs
// In heavy WIP use std::fs::{ self, File }; use std::io::Read; use std::path::Path; use toml; use error::PackageError; use repository::RepositoryUrls; /// Represents the config file. #[derive(Debug, Deserialize)] pub struct Config { pub buffer_size: Option<u64>, // pub config_path: Option<String>, pub do...
match $dest { Self { $key: ref mut x, .. } => { match x { &mut Some(_) => {}, &mut None => *x = $value, } } } /...
macro_rules! set_on_none { ($dest:ident, $key:ident, $value:expr) => (
random_line_split
entities.js
//used to organize code this.dead = this.checkIfDead(); //leads to fucntion below //organizes code this.checkKeyPressesAndMove (); //checks the characters ability keys this.checkAbilityKeys(); //organizes our code this.setAnimation(); //checks for collisions me.collision.check(this, true, this.col...
{ this.body.vel.x = 0; }
conditional_block
entities.js
setPlayerTimers: function(){ //keeps track of what time it is for the game this.now = new Date().getTime(); //lets the character hit the other characters over and over again this.lastHit = this.now; //controls when the next spear spons this.lastSpear = this.now; //controls when the time of the last attac...
this.body.setVelocity(game.data.playerMoveSpeed, 20); //a gold is added when the creep dies from attack this.attack = game.data.playerAttack; }, //used to organize our code //leads to line of code above setFlags: function(){ //keeps track of what direction your character is going this.facing = "right"; ...
random_line_split
augment_test.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
(self): self.assertEqual(self.input_augment_lt.axes, self.input_lt.axes) self.assertEqual(self.target_augment_lt.axes, self.target_lt.axes) self.save_images('augment', [ self.get_images('input_', self.input_augment_lt), self.get_images('target_', self.target_augment_lt) ]) self.asse...
test
identifier_name
augment_test.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
test.main()
conditional_block
augment_test.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
def setUp(self): super(CorruptTest, self).setUp() self.signal_lt = lt.select(self.input_lt, {'mask': util.slice_1(False)}) rc = lt.ReshapeCoder(['z', 'channel', 'mask'], ['channel']) self.corrupt_coded_lt = augment.corrupt(0.1, 0.05, 0.1, rc.encode(self.sig...
random_line_split
augment_test.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
def test_name(self): self.assertIn('augment/input', self.input_augment_lt.name) self.assertIn('augment/target', self.target_augment_lt.name) def test(self): self.assertEqual(self.input_augment_lt.axes, self.input_lt.axes) self.assertEqual(self.target_augment_lt.axes, self.target_lt.axes) sel...
super(AugmentTest, self).setUp() ap = augment.AugmentParameters(0.1, 0.05, 0.1) self.input_augment_lt, self.target_augment_lt = augment.augment( ap, self.input_lt, self.target_lt)
identifier_body
config.py
""" Buildbot inplace config (C) Copyright 2015 HicknHack Software GmbH The original code can be found at: https://github.com/hicknhack-software/buildbot-inplace-config 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...
def project_profile_worker_names(self, profile): return [worker.name for worker in self.inplace_workers if set(profile.setups).issubset(set(worker.setups)) and profile.platform in worker.platforms] def setup_project_inplace(self, project): self....
self.builders.clear() self.schedulers.clear() builder_name = self.DUMMY_NAME trigger_name = self.DUMMY_TRIGGER worker_names = self.inplace_workers.names self.builders.named_set(BuilderConfig(name=builder_name, workernames=worker_names, factory=BuildFactory())) self.schedu...
identifier_body
config.py
""" Buildbot inplace config (C) Copyright 2015 HicknHack Software GmbH The original code can be found at: https://github.com/hicknhack-software/buildbot-inplace-config 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...
(self, name): for elem in self: if elem.name == name: return elem def clear(self): del self[:] @property def names(self): return map(lambda elem: elem.name, self) class Wrapper(dict): """ Wrapper for the configuration dictionary """ def __init...
named_get
identifier_name
config.py
""" Buildbot inplace config (C) Copyright 2015 HicknHack Software GmbH The original code can be found at: https://github.com/hicknhack-software/buildbot-inplace-config 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...
@property def names(self): return map(lambda elem: elem.name, self) class Wrapper(dict): """ Wrapper for the configuration dictionary """ def __init__(self, **kwargs): super(Wrapper, self).__init__(**kwargs) self._inplace_workers = NamedList() self._projects = NamedLi...
del self[:]
random_line_split
config.py
""" Buildbot inplace config (C) Copyright 2015 HicknHack Software GmbH The original code can be found at: https://github.com/hicknhack-software/buildbot-inplace-config 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...
return self[key] def load_workers(self, path): Worker.load(path, self.inplace_workers, self.workers) def load_projects(self, path): Project.load(path, self.projects) DUMMY_NAME = "Dummy" DUMMY_TRIGGER = "Trigger_Dummy" def setup_inplace(self): self.builders.clear...
self[key] = NamedList()
conditional_block
state.js
/* State * @class * @classdesc This class reprensent an automata state, a sub-type of a generic Node */ k.data.State = (function(_super) { 'use strict'; /* jshint latedef:false */ k.utils.obj.inherit(state, _super); /* * Constructor Automata State * * @constructor * @param {[ItemRule]} options.items Arra...
if (this.isAcceptanceState) { return state.constants.AcceptanceStateName; } else if (!this._items.length) { return _super.prototype._generateIdentity.apply(this, arguments); } return k.utils.obj.reduce( k.utils.obj.sortBy(this._items, function(item) { return item.rule.index; }), fun...
state.prototype._generateIdentity = function() {
random_line_split
state.js
/* State * @class * @classdesc This class reprensent an automata state, a sub-type of a generic Node */ k.data.State = (function(_super) { 'use strict'; /* jshint latedef:false */ k.utils.obj.inherit(state, _super); /* * Constructor Automata State * * @constructor * @param {[ItemRule]} options.items Arra...
} /* @method REgister the list of item rules of the current stateso they are assesible by its id * @returns {Void} */ state.prototype._registerItemRules = function () { k.utils.obj.each(this._items, function (itemRule) { this._registerItems[itemRule.getIdentity()] = itemRule; }, this); }; state.cons...
{ _super.apply(this, arguments); k.utils.obj.defineProperty(this, 'isAcceptanceState'); // This is set by the automata generator k.utils.obj.defineProperty(this, '_items'); k.utils.obj.defineProperty(this, '_registerItems'); k.utils.obj.defineProperty(this, '_condencedView'); k.utils.obj.defineProperty(t...
identifier_body
state.js
/* State * @class * @classdesc This class reprensent an automata state, a sub-type of a generic Node */ k.data.State = (function(_super) { 'use strict'; /* jshint latedef:false */ k.utils.obj.inherit(state, _super); /* * Constructor Automata State * * @constructor * @param {[ItemRule]} options.items Arra...
(options) { _super.apply(this, arguments); k.utils.obj.defineProperty(this, 'isAcceptanceState'); // This is set by the automata generator k.utils.obj.defineProperty(this, '_items'); k.utils.obj.defineProperty(this, '_registerItems'); k.utils.obj.defineProperty(this, '_condencedView'); k.utils.obj.defin...
state
identifier_name
state.js
/* State * @class * @classdesc This class reprensent an automata state, a sub-type of a generic Node */ k.data.State = (function(_super) { 'use strict'; /* jshint latedef:false */ k.utils.obj.inherit(state, _super); /* * Constructor Automata State * * @constructor * @param {[ItemRule]} options.items Arra...
else if (!this._items.length) { return _super.prototype._generateIdentity.apply(this, arguments); } return k.utils.obj.reduce( k.utils.obj.sortBy(this._items, function(item) { return item.rule.index; }), function (acc, item) { return acc + item.getIdentity(); //.rule.index + '(' + item....
{ return state.constants.AcceptanceStateName; }
conditional_block
benchmark.js
/** * @license Apache-2.0 * * Copyright (c) 2018 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
b.toc(); if ( typeof o !== 'object' ) { b.fail( 'should return an object' ); } b.pass( 'benchmark finished' ); b.end(); });
{ err.message = 'be-'+fromCodePoint( (i%25)+97 )+' -ep'; o = toJSON( err ); if ( typeof o !== 'object' ) { b.fail( 'should return an object' ); } }
conditional_block
benchmark.js
/**
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the...
* @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. *
random_line_split
parameters.py
from property import * # Neuron common parameters iaf_neuronparams = {'E_L': -70., 'V_th': -50., 'V_reset': -67., 'C_m': 2., 't_ref': 2., 'V_m': -60., 'tau_syn_ex': 1., 'tau_syn_i...
STDP_synparams_Glu = dict({'delay': {'distribution': 'uniform', 'low': 1, 'high': 1.3}, 'weight': w_Glu, 'Wmax': 70.}, **STDP_synapseparams) # GABA synapse STDP_synparams_GABA = dict({'delay': {'distribution': 'uniform', 'low': 1., 'high': 1.3}, ...
# Glutamate synapse
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(macro_rules, plugin_registrar, quote, phase)] #![deny(unused_imports, unused_variable)] //! Exports m...
impl LintPass for UnrootedPass { fn get_lints(&self) -> LintArray { lint_array!(UNROOTED_MUST_ROOT) } fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) { if cx.tcx.map.expect_item(id).attrs.iter().all(|a| !a.check_nam...
{ match ty.node { ast::TyBox(ref t) | ast::TyUniq(ref t) | ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) | ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning), ast::TyPath(_, _, id) => { ma...
identifier_body
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(macro_rules, plugin_registrar, quote, phase)] #![deny(unused_imports, unused_variable)] //! Exports m...
fn check_variant(&mut self, cx: &Context, var: &ast::Variant, _gen: &ast::Generics) { let ref map = cx.tcx.map; if map.expect_item(map.get_parent(var.node.id)).attrs.iter().all(|a| !a.check_name("must_root")) { match var.node.kind { ast::TupleVariantKind(ref vec) => { ...
"Type must be rooted, use #[must_root] on the struct definition to propagate"); } } }
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(macro_rules, plugin_registrar, quote, phase)] #![deny(unused_imports, unused_variable)] //! Exports m...
(reg: &mut Registry) { reg.register_lint_pass(box TransmutePass as LintPassObject); reg.register_lint_pass(box UnrootedPass as LintPassObject); } #[macro_export] macro_rules! bitfield( ($bitfieldname:ident, $getter:ident, $setter:ident, $value:expr) => ( impl $bitfieldname { #[inline] ...
plugin_registrar
identifier_name
customcert.js
import fetch from 'isomorphic-fetch'; import { application } from '../../config'; import * as Action from './constants'; export function setCerts(data) { return ({ type: Action.SET_SET_OF_CERTS, data, }); } export function setObjectToEdit(data) { return ({ type: Action.SET_CUSTOMCERT_OBJECT_TO_EDIT,...
}); }; }
{ dispatch(loadCerts()); }
conditional_block
customcert.js
import fetch from 'isomorphic-fetch'; import { application } from '../../config'; import * as Action from './constants'; export function setCerts(data) { return ({ type: Action.SET_SET_OF_CERTS, data, }); } export function
(data) { return ({ type: Action.SET_CUSTOMCERT_OBJECT_TO_EDIT, data, }); } export function loadCerts() { return (dispatch, getState) => { const eventId = getState().event.id; const config = { method: 'POST', mode: 'cors', credentials: 'include', headers: { Accept:...
setObjectToEdit
identifier_name
customcert.js
import fetch from 'isomorphic-fetch'; import { application } from '../../config'; import * as Action from './constants'; export function setCerts(data) { return ({ type: Action.SET_SET_OF_CERTS, data, }); } export function setObjectToEdit(data) { return ({ type: Action.SET_CUSTOMCERT_OBJECT_TO_EDIT,...
} }); }; }
{ return (dispatch, getState) => { const eventId = getState().event.id; const config = { method: 'POST', mode: 'cors', credentials: 'include', headers: { Accept: 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ objectToEdit ...
identifier_body
customcert.js
import fetch from 'isomorphic-fetch'; import { application } from '../../config'; import * as Action from './constants'; export function setCerts(data) { return ({ type: Action.SET_SET_OF_CERTS, data, }); } export function setObjectToEdit(data) { return ({ type: Action.SET_CUSTOMCERT_OBJECT_TO_EDIT,...
}, }; fetch(`${application.url}/api/event/${eventId}/module/cert/cert/act/get_certs`, config) .then(response => response.json()) .then((data) => { if (!data.error) { dispatch(setCerts(data.data)); } }); }; } export function createNew(text) { return (dispat...
headers: { Accept: 'application/json', 'Content-Type': 'application/json',
random_line_split
FileHash58TestElement.py
# Copyright 2016 Casey Jaymes # This file is part of PySCAP. # # PySCAP is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # PySCAP is ...
(TestType): MODEL_MAP = { 'tag_name': 'filehash58_test', }
FileHash58TestElement
identifier_name
FileHash58TestElement.py
# Copyright 2016 Casey Jaymes # This file is part of PySCAP. # # PySCAP is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with PySCAP. If not, see <http://www.gnu.org/licenses/>. import ...
# (at your option) any later version. # # PySCAP is distributed in the hope that it will be useful,
random_line_split
FileHash58TestElement.py
# Copyright 2016 Casey Jaymes # This file is part of PySCAP. # # PySCAP is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # PySCAP is ...
MODEL_MAP = { 'tag_name': 'filehash58_test', }
identifier_body
mod.rs
pub mod counts; mod hashing; pub mod mash; pub mod scaled; use needletail::parser::SequenceRecord; use serde::{Deserialize, Serialize}; use crate::bail; use crate::errors::FinchResult; use crate::filtering::FilterParams; use crate::serialization::Sketch; pub use hashing::ItemHash; #[derive(Clone, Debug, Deserialize,...
Ok(first_params) } /// Return any sketch parameter difference that would make comparisons /// between sketches generated by these parameter sets not work. /// /// Note this doesn't actually check the enum variants themselves, but it /// should still break if there are different variants...
// TODO: harminize sketch sizes? // TODO: do something with no_strict and final_size }
random_line_split
mod.rs
pub mod counts; mod hashing; pub mod mash; pub mod scaled; use needletail::parser::SequenceRecord; use serde::{Deserialize, Serialize}; use crate::bail; use crate::errors::FinchResult; use crate::filtering::FilterParams; use crate::serialization::Sketch; pub use hashing::ItemHash; #[derive(Clone, Debug, Deserialize,...
(&self) -> (&str, u16, u64, Option<f64>) { match self { SketchParams::Mash { hash_seed, .. } => ("MurmurHash3_x64_128", 64, *hash_seed, None), SketchParams::Scaled { hash_seed, scale, .. } => ("MurmurHash3_x64_128", 64, *hash_seed, Some(*scale)), S...
hash_info
identifier_name
mod.rs
pub mod counts; mod hashing; pub mod mash; pub mod scaled; use needletail::parser::SequenceRecord; use serde::{Deserialize, Serialize}; use crate::bail; use crate::errors::FinchResult; use crate::filtering::FilterParams; use crate::serialization::Sketch; pub use hashing::ItemHash; #[derive(Clone, Debug, Deserialize,...
*kmer_length, *hash_seed, )), SketchParams::AllCounts { kmer_length } => { Box::new(counts::AllCountsSketcher::new(*kmer_length)) } } } pub fn process_post_filter(&self, kmers: &mut Vec<KmerCount>, name: &str) -> Finch...
{ match self { SketchParams::Mash { kmers_to_sketch, kmer_length, hash_seed, .. } => Box::new(mash::MashSketcher::new( *kmers_to_sketch, *kmer_length, *hash_seed, )...
identifier_body
cmd.js
#!/usr/bin/env node var CompactToStylishStream = require('../') var minimist = require('minimist') var argv = minimist(process.argv.slice(2), {
}) if (!process.stdin.isTTY || argv._[0] === '-' || argv.stdin) { var snazzy = new CompactToStylishStream() // Set the process exit code based on whether snazzy found errors process.on('exit', function (code) { if (code === 0 && snazzy.exitCode !== 0) { process.exitCode = snazzy.exitCode } }) ...
boolean: [ 'stdin' ]
random_line_split
cmd.js
#!/usr/bin/env node var CompactToStylishStream = require('../') var minimist = require('minimist') var argv = minimist(process.argv.slice(2), { boolean: [ 'stdin' ] }) if (!process.stdin.isTTY || argv._[0] === '-' || argv.stdin) { var snazzy = new CompactToStylishStream() // Set the process exit code ba...
{ console.error(` snazzy: 'standard' is no longer bundled with 'snazzy'. Install standard snazzy: ('npm install standard') then run 'standard | snazzy' instead. `) process.exitCode = 1 }
conditional_block
htmltablecaptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding; use crate::dom::bindings::root::DomRo...
document: &Document, ) -> HTMLTableCaptionElement { HTMLTableCaptionElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), } } #[allow(unrooted_must_root)] pub fn new( local_name: LocalName, prefix: Option<Prefix>, do...
impl HTMLTableCaptionElement { fn new_inherited( local_name: LocalName, prefix: Option<Prefix>,
random_line_split
htmltablecaptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding; use crate::dom::bindings::root::DomRo...
( local_name: LocalName, prefix: Option<Prefix>, document: &Document, ) -> DomRoot<HTMLTableCaptionElement> { Node::reflect_node( Box::new(HTMLTableCaptionElement::new_inherited( local_name, prefix, document, )), document, ...
new
identifier_name
route_registry_module.ts
/* Copyright 2020 The TensorFlow Authors. 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 applicable law or a...
(): Iterable<RouteKind> { return this.routeKindToNgComponent.keys(); } /** * Returns RouteConfigs of current route configuration. Returnsn null if no * routes are registered. */ getRouteConfigs(): RouteConfigs { return this.routeConfigs; } getNgComponentByRouteKind(routeKind: RouteKind): Ty...
getRegisteredRouteKinds
identifier_name
route_registry_module.ts
/* Copyright 2020 The TensorFlow Authors. 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 applicable law or a...
/** * Returns RouteConfigs of current route configuration. Returnsn null if no * routes are registered. */ getRouteConfigs(): RouteConfigs { return this.routeConfigs; } getNgComponentByRouteKind(routeKind: RouteKind): Type<Component> | null { return this.routeKindToNgComponent.get(routeKind) ...
getRegisteredRouteKinds(): Iterable<RouteKind> { return this.routeKindToNgComponent.keys(); }
random_line_split
route_registry_module.ts
/* Copyright 2020 The TensorFlow Authors. 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 applicable law or a...
const configs: RouteDef[] = []; for (const routeDefList of configsList) { for (const routeDef of routeDefList) { configs.push(routeDef); } } this.routeConfigs = new RouteConfigs(configs); configs.forEach((config) => { if (isConcreteRouteDef(config)) { this.routeKi...
{ this.routeConfigs = new RouteConfigs([]); return; }
conditional_block
route_registry_module.ts
/* Copyright 2020 The TensorFlow Authors. 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 applicable law or a...
/** * Returns RouteConfigs of current route configuration. Returnsn null if no * routes are registered. */ getRouteConfigs(): RouteConfigs { return this.routeConfigs; } getNgComponentByRouteKind(routeKind: RouteKind): Type<Component> | null { return this.routeKindToNgComponent.get(routeKind)...
{ return this.routeKindToNgComponent.keys(); }
identifier_body
yt.py
Title": title} ) if forcePlayer or len(sys.argv) < 2 or int(sys.argv[1]) == -1: import xbmc pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) pl.clear() pl.add(url, liz) xbmc.Player().play(pl) else: import xbmcplugin liz.setPath(url) xbmcplugin.setResolvedU...
elif len(s) == 83: return s[6] + s[3:6] + s[33] + s[7:24] + s[0] + s[25:33] + s[53] + s[34:53] + s[24] + s[54:] elif len(s) == 82: return s[36] + s[79:67:-1] + s[81] + s[66:40:-1] + s[33] + s[39:36:-1] + s[40] + s[35] + s[0] + s[67] + s[32:0:-1] + s[34] elif len(s) == 81: return s[6...
return s[83:36:-1] + s[2] + s[35:26:-1] + s[3] + s[25:3:-1] + s[26]
conditional_block
yt.py
Title": title} ) if forcePlayer or len(sys.argv) < 2 or int(sys.argv[1]) == -1: import xbmc pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) pl.clear() pl.add(url, liz) xbmc.Player().play(pl) else: import xbmcplugin liz.setPath(url) xbmcplugin.setResolvedU...
#################################################### global playerData global allLocalFunNamesTab global allLocalVarNamesTab def _extractVarLocalFuns(match): varName, objBody = match.groups() output
pos = data.find("};") if pos != -1: data = data[:pos + 1] return data
identifier_body
yt.py
Title": title} ) if forcePlayer or len(sys.argv) < 2 or int(sys.argv[1]) == -1: import xbmc pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) pl.clear() pl.add(url, liz) xbmc.Player().play(pl) else: import xbmcplugin liz.setPath(url) xbmcplugin.setResolvedU...
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') req.add_header('Referer', 'http://www.youtube.com/') return urllib2.urlopen(req).read().decode("utf-8") def replaceHTMLCodes(txt): # Fix missing ; in &#<number>; txt = re....
return flashvars def FetchPage(url): req = urllib2.Request(url)
random_line_split
yt.py
s[61:48:-1] + s[67] + s[47:12:-1] + s[3] + s[11:3:-1] + s[2] + s[12] elif len(s) == 87: return s[62] + s[82:62:-1] + s[83] + s[61:52:-1] + s[0] + s[51:2:-1] elif len(s) == 86: return s[2:63] + s[82] + s[64:82] + s[63] elif len(s) == 85: return s[76] + s[82:76:-1] + s[83] + s[75:60:-...
_getLocalFunBody
identifier_name
SideNavigatorItem.tsx
import React from 'react' import cc from 'classcat' import styled from '../../lib/styled' import { sideBarTextColor, sideBarSecondaryTextColor, activeBackgroundColor, iconColor } from '../../lib/styled/styleFunctions' import { IconArrowSingleRight, IconArrowSingleDown } from '../icons' const Container = styled...
<IconArrowSingleDown color='currentColor' /> )} </FoldButton> )} <ClickableContainer style={{ paddingLeft: `${10 * depth + 30}px`, cursor: onClick ? 'pointer' : 'initial', fontSize: '15px' }} onClick={o...
> {folded ? ( <IconArrowSingleRight color='currentColor' /> ) : (
random_line_split
client.py
# -*- coding: utf-8 -*- # Author: Leo Vidarte <http://nerdlabs.com.ar> # # This file is part of lai-server. # # lai-server is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 # as published by the Free Software Foundation. # # lai-server is distribut...
def fetch(data=None): url = SERVER_URL if data is not None: data = urllib.urlencode({'data': data}) req = urllib2.Request(url, data) else: req = url res = urllib2.urlopen(req) return res.read() if __name__ == '__main__': doc = {'user' : 'lvidarte@gmail.com', ...
random_line_split
client.py
# -*- coding: utf-8 -*- # Author: Leo Vidarte <http://nerdlabs.com.ar> # # This file is part of lai-server. # # lai-server is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 # as published by the Free Software Foundation. # # lai-server is distribut...
(data=None): url = SERVER_URL if data is not None: data = urllib.urlencode({'data': data}) req = urllib2.Request(url, data) else: req = url res = urllib2.urlopen(req) return res.read() if __name__ == '__main__': doc = {'user' : 'lvidarte@gmail.com', 'key_...
fetch
identifier_name
client.py
# -*- coding: utf-8 -*- # Author: Leo Vidarte <http://nerdlabs.com.ar> # # This file is part of lai-server. # # lai-server is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 # as published by the Free Software Foundation. # # lai-server is distribut...
import time time.sleep(9) # Commit doc['process'] = 'commit' msg = json.dumps(doc) enc = crypto.encrypt(msg, PUB_KEY) data = base64.b64encode(enc) try: data = fetch(data) except: print "Fetch error" else: enc = base64.b64decode(data) msg = c...
enc = base64.b64decode(data) msg = crypto.decrypt(enc, PRV_KEY) doc = json.loads(msg) print doc['session_id']
conditional_block
client.py
# -*- coding: utf-8 -*- # Author: Leo Vidarte <http://nerdlabs.com.ar> # # This file is part of lai-server. # # lai-server is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 # as published by the Free Software Foundation. # # lai-server is distribut...
if __name__ == '__main__': doc = {'user' : 'lvidarte@gmail.com', 'key_name' : 'howl', 'session_id': None, 'process' : 'update', 'last_tid' : 0, 'docs' : []} msg = json.dumps(doc) enc = crypto.encrypt(msg, PUB_KEY) data = base64.b64...
url = SERVER_URL if data is not None: data = urllib.urlencode({'data': data}) req = urllib2.Request(url, data) else: req = url res = urllib2.urlopen(req) return res.read()
identifier_body
main.rs
#![feature(async_await)] use futures_util::stream::StreamExt; use std::env; use std::io::*; use std::process::Stdio; use tokio::codec::{FramedRead, LinesCodec}; use tokio::prelude::*; use tokio::process::{Child, Command}; const USAGE: &str = "args: config_file"; struct Qemu { pub process: Child, } impl Qemu { ...
(mut self) { { self.process .stdin() .as_mut() .unwrap() .write_all(b"q\n") .unwrap(); } let ecode = self.process.wait().expect("failed to wait on child"); assert!(ecode.success()); } } struc...
terminate
identifier_name
main.rs
#![feature(async_await)] use futures_util::stream::StreamExt; use std::env; use std::io::*; use std::process::Stdio; use tokio::codec::{FramedRead, LinesCodec}; use tokio::prelude::*; use tokio::process::{Child, Command}; const USAGE: &str = "args: config_file"; struct Qemu { pub process: Child, } impl Qemu { ...
fn read(&mut self) -> Vec<u8> { let mut result = Vec::new(); self.process .stdout .as_mut() .unwrap() .read_to_end(&mut result) .unwrap(); result } fn write(&mut self, bytes: &[u8]) { self.process .std...
{ let process = Command::new("gdb") .stdin(Stdio::piped()) .stdout(Stdio::null()) // .stderr(Stdio::null()) .spawn() .expect("Unable to start gdb"); let stdout = process.stdout().take().unwrap(); Self { process, ...
identifier_body
main.rs
#![feature(async_await)] use futures_util::stream::StreamExt; use std::env; use std::io::*; use std::process::Stdio; use tokio::codec::{FramedRead, LinesCodec}; use tokio::prelude::*; use tokio::process::{Child, Command}; const USAGE: &str = "args: config_file"; struct Qemu { pub process: Child, } impl Qemu { ...
let ecode = self.process.wait().expect("failed to wait on child"); assert!(ecode.success()); } } #[tokio::main] async fn main() { let _args: Vec<_> = env::args().skip(1).collect(); let mut qemu = Qemu::new("build/test_disk.img"); let mut gdb = Gdb::new(); gdb.start(); std::th...
self.write(b"q\n");
random_line_split