file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
query-result-stores.js | /* eslint-disable no-await-in-loop */
const assert = require('assert');
const TestUtils = require('../utils');
const query1 = `SELECT 1 AS id, 'blue' AS color`;
function | (ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function testBatchToCompletion(config) {
const utils = new TestUtils(config);
await utils.init(true);
const connection = await utils.post('admin', '/api/connections', {
name: 'test connection',
driver: 'sqlite',
data: {
... | wait | identifier_name |
test_flag_collection.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
from __future__ import (absolute_import, division, print_function,
unicode_literals) |
import numpy as np
from ...tests.helper import pytest
from .. import FlagCollection
def test_init():
FlagCollection(shape=(1, 2, 3))
def test_init_noshape():
with pytest.raises(Exception) as exc:
FlagCollection()
assert exc.value.args[0] == ('FlagCollection should be initialized with '
... | random_line_split | |
test_flag_collection.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from ...tests.helper import pytest
from .. import FlagCollection
def test_init():
FlagCollect... | (value):
f = FlagCollection(shape=(1, 2, 3))
with pytest.raises(Exception) as exc:
f['a'] = value
assert exc.value.args[0] == 'flags should be given as a Numpy array'
def test_setitem_invalid_shape():
f = FlagCollection(shape=(1, 2, 3))
with pytest.raises(ValueError) as exc:
f['a']... | test_setitem_invalid_type | identifier_name |
test_flag_collection.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from ...tests.helper import pytest
from .. import FlagCollection
def test_init():
FlagCollect... |
def test_setitem_invalid_shape():
f = FlagCollection(shape=(1, 2, 3))
with pytest.raises(ValueError) as exc:
f['a'] = np.ones((3, 2, 1))
assert exc.value.args[0].startswith('flags array shape')
assert exc.value.args[0].endswith('does not match data shape (1, 2, 3)')
| f = FlagCollection(shape=(1, 2, 3))
with pytest.raises(Exception) as exc:
f['a'] = value
assert exc.value.args[0] == 'flags should be given as a Numpy array' | identifier_body |
extern-call-scrub.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | } | }); | random_line_split |
extern-call-scrub.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | else {
count(data - 1) + count(data - 1)
}
}
fn count(n: libc::uintptr_t) -> libc::uintptr_t {
unsafe {
println!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
// Make sure we're on a task with small Rust stacks (main currently
// has a large stack)
let... | {
data
} | conditional_block |
extern-call-scrub.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (n: libc::uintptr_t) -> libc::uintptr_t {
unsafe {
println!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
// Make sure we're on a task with small Rust stacks (main currently
// has a large stack)
let _t = Thread::spawn(move|| {
let result = count(12);
... | count | identifier_name |
extern-call-scrub.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn count(n: libc::uintptr_t) -> libc::uintptr_t {
unsafe {
println!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
// Make sure we're on a task with small Rust stacks (main currently
// has a large stack)
let _t = Thread::spawn(move|| {
let result = count(1... | {
if data == 1 {
data
} else {
count(data - 1) + count(data - 1)
}
} | identifier_body |
settings.py | """
Django settings for testproject project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... |
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/' | } | random_line_split |
IsClassMethods.py | """Subclass of IsClassMethods, which is generated by wxFormBuilder."""
from beatle import model
from beatle.lib import wxx
from beatle.activity.models.ui import ui as ui
from beatle.app.utils import cached_type
# Implementing IsClassMethods
class | (ui.IsClassMethods):
"""
This dialog allows to add/remove is_class methods.
"""
@wxx.SetInfo(__doc__)
def __init__(self, parent, container):
"""Dialog initialization"""
super(IsClassMethods, self).__init__(parent)
# container es la clase base
self.container = containe... | IsClassMethods | identifier_name |
IsClassMethods.py | """Subclass of IsClassMethods, which is generated by wxFormBuilder."""
from beatle import model
from beatle.lib import wxx
from beatle.activity.models.ui import ui as ui
from beatle.app.utils import cached_type
# Implementing IsClassMethods
class IsClassMethods(ui.IsClassMethods):
"""
This dialog allows to a... |
# do a label insertion remembering state
pos = 0
for k in self._map:
v = self._map[k]
self.m_checkList2.Insert(k, pos, v)
if v[1]:
self.m_checkList2.Check(pos)
pos = pos + 1
def visit(self, k):
"""Add inheritance branc... | name = k.scoped
name = "is_" + name.replace('::', '_')
if name in self._is_class_method_names:
self._map[name] = (k, self._is_class_method_names[name])
else:
self._map[name] = (k, None) | conditional_block |
IsClassMethods.py | """Subclass of IsClassMethods, which is generated by wxFormBuilder."""
from beatle import model
from beatle.lib import wxx
from beatle.activity.models.ui import ui as ui
from beatle.app.utils import cached_type
# Implementing IsClassMethods
class IsClassMethods(ui.IsClassMethods):
"""
This dialog allows to a... | kwargs = {}
derivative = v[0]
kwargs['parent'] = self.container
kwargs['name'] = 'is_' + derivative.scoped.replace('::', '_')
kwargs['type'] = model.cc.typeinst(
type=tbool, const=True)
kwargs['constm... | c = self.m_checkList2.IsChecked(item)
if (c and v[1]) or (not c and not v[1]):
continue
if c: | random_line_split |
IsClassMethods.py | """Subclass of IsClassMethods, which is generated by wxFormBuilder."""
from beatle import model
from beatle.lib import wxx
from beatle.activity.models.ui import ui as ui
from beatle.app.utils import cached_type
# Implementing IsClassMethods
class IsClassMethods(ui.IsClassMethods):
"""
This dialog allows to a... |
def visit(self, k):
"""Add inheritance branch"""
for l in k._deriv:
self.visit(l)
self._classes.append(k)
def get_kwargs(self):
"""Returns kwargs dictionary suitable for objects creation"""
kwargs_list = []
tbool = cached_type(self.container.project... | """Dialog initialization"""
super(IsClassMethods, self).__init__(parent)
# container es la clase base
self.container = container
# create a map of feasible casts
self._classes = []
for k in container._deriv:
self.visit(k)
# get current methods
... | identifier_body |
app.module.ts | import { BrowserModule } from '@angular/platform-browser';
import { NgModule, LOCALE_ID } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { MaterializeModule } from 'angular2-materialize';
import { AppComponent } from './app.component';
import { H... | { }
| AppModule | identifier_name |
app.module.ts | import { BrowserModule } from '@angular/platform-browser';
import { NgModule, LOCALE_ID } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { MaterializeModule } from 'angular2-materialize';
import { AppComponent } from './app.component';
import { H... | import { LoginComponent } from './pages/login/login.component';
import { routing } from './app.routing';
import { AuthService } from './pages/login/auth.service';
import { AuthGuard } from './pages/login/guards/auth.guard';
import { EnderecoService } from './pages/endereco/endereco.service';
import { MessageService }... | import { EmpresaComponent } from './pages/empresa/empresa.component';
import { HomeComponent } from './pages/home/home.component'; | random_line_split |
test_classes.py | from __future__ import absolute_import
from __future__ import print_function
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional,
Sized, Tuple, Union, Text)
from django.core.urlresolvers import resolve
from django.conf imp... |
super(ZulipTestCase, self).__init__(*args, **kwargs)
DEFAULT_REALM = Realm.objects.get(string_id='zulip')
@instrument_url
def client_patch(self, url, info={}, **kwargs):
# type: (Text, Dict[str, Any], **Any) -> HttpResponse
"""
We need to urlencode, since Django's function... | self.assertRaisesRegex = self.assertRaisesRegexp | conditional_block |
test_classes.py | from __future__ import absolute_import
from __future__ import print_function
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional,
Sized, Tuple, Union, Text)
from django.core.urlresolvers import resolve
from django.conf imp... |
def example_user(self, name):
# type: (str) -> UserProfile
email = self.example_user_map[name]
return get_user(email, get_realm('zulip'))
def mit_user(self, name):
# type: (str) -> UserProfile
email = self.mit_user_map[name]
return get_user(email, get_realm('ze... | email = self.nonreg_user_map[name]
return get_user(email, get_realm_by_email_domain(email)) | identifier_body |
test_classes.py | from __future__ import absolute_import
from __future__ import print_function
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional,
Sized, Tuple, Union, Text)
from django.core.urlresolvers import resolve
from django.conf imp... | (self, name):
# type: (str) -> Text
return self.mit_user_map[name]
def notification_bot(self):
# type: () -> UserProfile
return get_user('notification-bot@zulip.com', get_realm('zulip'))
def login_with_return(self, email, password=None):
# type: (Text, Optional[Text]) -... | mit_email | identifier_name |
test_classes.py | from __future__ import absolute_import
from __future__ import print_function
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional,
Sized, Tuple, Union, Text)
from django.core.urlresolvers import resolve
from django.conf imp... |
def do_test_message(self, msg, expected_message):
# type: (Message, Optional[Text]) -> None
if expected_message is not None:
self.assertEqual(msg.content, expected_message) | random_line_split | |
background.rs | use super::SkewTContext;
use crate::{
app::config::{self},
coords::TPCoords,
gui::DrawingArgs,
};
use metfor::{Celsius, CelsiusDiff, HectoPascal, Quantity};
impl SkewTContext {
pub fn draw_clear_background(&self, args: DrawingArgs<'_, '_>) {
let (cr, config) = (args.cr, args.ac.config.borrow())... | }
} | }
cr.close_path();
cr.fill().unwrap(); | random_line_split |
background.rs | use super::SkewTContext;
use crate::{
app::config::{self},
coords::TPCoords,
gui::DrawingArgs,
};
use metfor::{Celsius, CelsiusDiff, HectoPascal, Quantity};
impl SkewTContext {
pub fn draw_clear_background(&self, args: DrawingArgs<'_, '_>) {
let (cr, config) = (args.cr, args.ac.config.borrow())... |
fn draw_temperature_band(&self, cold_t: Celsius, warm_t: Celsius, args: DrawingArgs<'_, '_>) {
let cr = args.cr;
// Assume color has already been set up for us.
const MAXP: HectoPascal = config::MAXP;
const MINP: HectoPascal = config::MINP;
let mut coords = [
... | {
let (cr, config) = (args.cr, args.ac.config.borrow());
let rgba = config.dendritic_zone_rgba;
cr.set_source_rgba(rgba.0, rgba.1, rgba.2, rgba.3);
self.draw_temperature_band(Celsius(-18.0), Celsius(-12.0), args);
} | identifier_body |
background.rs | use super::SkewTContext;
use crate::{
app::config::{self},
coords::TPCoords,
gui::DrawingArgs,
};
use metfor::{Celsius, CelsiusDiff, HectoPascal, Quantity};
impl SkewTContext {
pub fn draw_clear_background(&self, args: DrawingArgs<'_, '_>) {
let (cr, config) = (args.cr, args.ac.config.borrow())... | (&self, cold_t: Celsius, warm_t: Celsius, args: DrawingArgs<'_, '_>) {
let cr = args.cr;
// Assume color has already been set up for us.
const MAXP: HectoPascal = config::MAXP;
const MINP: HectoPascal = config::MINP;
let mut coords = [
(warm_t.unpack(), MAXP.unpack... | draw_temperature_band | identifier_name |
legacy.mouse.shim.js | (function($, undefined) {
/**
* Plugin to force OpenSeadragon to use the legacy mouse pointer event model
*/
$.MouseTracker.subscribeEvents = [ "click", "dblclick", "keypress", "focus", "blur", $.MouseTracker.wheelEventName ];
if( $.MouseTracker.wheelEventName == "DOMMouseScroll" ) |
$.MouseTracker.havePointerEvents = false;
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
$.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" );
$.MouseTracker.haveMouseEnter = true;
} else {
$.MouseTracker.subscribeEvents.push( "mouseover", "mouseo... | {
// Older Firefox
$.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" );
} | conditional_block |
legacy.mouse.shim.js | (function($, undefined) {
/**
* Plugin to force OpenSeadragon to use the legacy mouse pointer event model
*/ | $.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" );
}
$.MouseTracker.havePointerEvents = false;
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
$.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" );
$.MouseTracker.haveMouseEnter = true;
... |
$.MouseTracker.subscribeEvents = [ "click", "dblclick", "keypress", "focus", "blur", $.MouseTracker.wheelEventName ];
if( $.MouseTracker.wheelEventName == "DOMMouseScroll" ) {
// Older Firefox | random_line_split |
moh.py | #
# Medal of Honor Parser for BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2010 James 'Bakes' Baker (bakes@bigbrotherbot.net)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; eithe... |
def checkVersion(self):
version = self.output.write('version')
self.info('server version : %s' % version)
if version[0] != 'MOH':
raise Exception("the moh parser can only work with Medal of Honor")
def getClient(self, cid, _guid=None):
... | self.info('connecting all players...')
plist = self.getPlayerList()
for cid, p in plist.iteritems():
client = self.clients.getByCID(cid)
if not client:
#self.clients.newClient(playerdata['cid'], guid=playerdata['guid'], name=playerdata['name'], team=playerdata['te... | identifier_body |
moh.py | #
# Medal of Honor Parser for BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2010 James 'Bakes' Baker (bakes@bigbrotherbot.net)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; eithe... |
self.say('Changing map to %s' % map)
time.sleep(1)
self.write(('mapList.nextLevelIndex', nextIndex))
self.write(('admin.runNextRound', ))
| nextIndex += 1 | conditional_block |
moh.py | #
# Medal of Honor Parser for BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2010 James 'Bakes' Baker (bakes@bigbrotherbot.net)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; eithe... | (self, team):
"""convert MOH team numbers to B3 team numbers"""
team = int(team)
if team == 1:
return b3.TEAM_RED
elif team == 2:
return b3.TEAM_BLUE
elif team == 3:
return b3.TEAM_SPEC
else:
return b3.TEAM_UNKNOWN
... | getTeam | identifier_name |
moh.py | #
# Medal of Honor Parser for BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2010 James 'Bakes' Baker (bakes@bigbrotherbot.net)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; eithe... | pass
return
if admin:
reason = self.getMessage('banned_by', client.exactName, admin.exactName, reason)
else:
reason = self.getMessage('banned', client.exactName, reason)
reason = self.stripColors(reason)
if client.cid is None:
... | random_line_split | |
asm.rs | // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | (&self) -> State {
match *self {
Asm => Outputs,
Outputs => Inputs,
Inputs => Clobbers,
Clobbers => Options,
Options => StateNone,
StateNone => StateNone
}
}
}
static OPTIONS: &'static [&'static str] = &["volatile... | next | identifier_name |
asm.rs | // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
let span = p.last_span;
p.expect(&token::OpenDelim(token::Paren));
let out = p.parse_expr();
p.expect(&token::CloseDelim(token::Paren));
// Expands a read+write operand into two operands.
//
... | let (constraint, _str_style) = p.parse_str(); | random_line_split |
asm.rs | // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
}
static OPTIONS: &'static [&'static str] = &["volatile", "alignstack", "intel"];
pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
-> Box<base::MacResult+'cx> {
let mut p = cx.new_parser_from_tts(tts);
let mut asm = InternedString::new("");
let mut asm... | {
match *self {
Asm => Outputs,
Outputs => Inputs,
Inputs => Clobbers,
Clobbers => Options,
Options => StateNone,
StateNone => StateNone
}
} | identifier_body |
porn91.py | # encoding: utf-8
from __future__ import unicode_literals
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_urlencode,
)
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
ExtractorError,
)
class Porn91IE(InfoExtractor):
IE_NAME = '91por... | ._match_id(url)
self._set_cookie('91porn.com', 'language', 'cn_CN')
webpage = self._download_webpage(
'http://91porn.com/view_video.php?viewkey=%s' % video_id, video_id)
if '作为游客,你每天只可观看10个视频' in webpage:
raise ExtractorError('91 Porn says: Daily limit 10 videos exceede... | deo_id = self | identifier_name |
porn91.py | # encoding: utf-8
from __future__ import unicode_literals
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_urlencode,
)
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
ExtractorError,
)
class Porn91IE(InfoExtractor):
| IE_NAME = '91porn'
_VALID_URL = r'(?:https?://)(?:www\.|)91porn\.com/.+?\?viewkey=(?P<id>[\w\d]+)'
_TEST = {
'url': 'http://91porn.com/view_video.php?viewkey=7e42283b4f5ab36da134',
'md5': '6df8f6d028bc8b14f5dbd73af742fb20',
'info_dict': {
'id': '7e42283b4f5ab36da134',
... | identifier_body | |
porn91.py | # encoding: utf-8
from __future__ import unicode_literals
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_urlencode,
)
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
ExtractorError,
)
class Porn91IE(InfoExtractor):
IE_NAME = '91por... | ideo-title">([^<]+)</div>', webpage, 'title')
title = title.replace('\n', '')
# get real url
file_id = self._search_regex(
r'so.addVariable\(\'file\',\'(\d+)\'', webpage, 'file id')
sec_code = self._search_regex(
r'so.addVariable\(\'seccode\',\'([^\']+)\'', webpa... | ', expected=True)
title = self._search_regex(
r'<div id="viewv | conditional_block |
porn91.py | # encoding: utf-8
from __future__ import unicode_literals
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_urlencode,
)
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
ExtractorError,
)
class Porn91IE(InfoExtractor):
IE_NAME = '91por... | 'age_limit': 18,
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
self._set_cookie('91porn.com', 'language', 'cn_CN')
webpage = self._download_webpage(
'http://91porn.com/view_video.php?viewkey=%s' % video_id, video_id)
if '作为游客,... | 'duration': 431, | random_line_split |
index.d.ts | // Type definitions for ember-test-helpers 0.7
// Project: https://github.com/emberjs/ember-test-helpers#readme
// Definitions by: Derek Wickern <https://github.com/dwickern>
// Mike North <https://github.com/mike-north>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Ve... | owner: Ember.ApplicationInstance & {
factoryFor(fullName: string, options?: {}): any;
};
pauseTest(): Promise<void>;
resumeTest(): void;
element: Element;
}
class TestModule {
constructor(name: string, callbacks?: ModuleCallbacks);
constructor... | random_line_split | |
index.d.ts | // Type definitions for ember-test-helpers 0.7
// Project: https://github.com/emberjs/ember-test-helpers#readme
// Definitions by: Derek Wickern <https://github.com/dwickern>
// Mike North <https://github.com/mike-north>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Ve... | extends TestModule {}
class TestModuleForModel extends TestModule {}
function getContext(): TestContext | undefined;
function setContext(context: TestContext): void;
function unsetContext(): void;
function setResolver(resolver: Ember.Resolver): void;
}
declare module 'ember-test-helpers/wait' {
... | TestModuleForComponent | identifier_name |
__init__.py | import os
import glob
import importlib
import logging
logger = logging.getLogger(__name__)
class UnknownFormatError(RuntimeError):
pass
item_classes = []
supported_protocols = []
def constructor_exists(path):
for klass in item_classes:
if klass.applies(path):
return True
return Fal... |
def register(klass):
"""Make this class available to storage for creating items.
:type klass: type
Works as decorator for both classes and functions.
"""
item_classes.append(klass)
logger.info("Registered item class %s." % klass.__name__)
supported_protocols.extend(getattr(klass, "proto... | """Try to create item using one of the registered constructors."""
klass = find_best_constructor(path)
if klass:
return klass(storage, name, path)
else:
raise UnknownFormatError("Cannot interpret file %s" % path) | identifier_body |
__init__.py | import os
import glob
import importlib
import logging
logger = logging.getLogger(__name__)
class UnknownFormatError(RuntimeError):
pass
item_classes = []
supported_protocols = []
def constructor_exists(path):
for klass in item_classes:
if klass.applies(path):
return True
return Fal... |
else:
raise UnknownFormatError("Cannot interpret file %s" % path)
def register(klass):
"""Make this class available to storage for creating items.
:type klass: type
Works as decorator for both classes and functions.
"""
item_classes.append(klass)
logger.info("Registered item cla... | return klass(storage, name, path) | conditional_block |
__init__.py | import os
import glob
import importlib
import logging
logger = logging.getLogger(__name__)
class UnknownFormatError(RuntimeError):
pass
item_classes = []
supported_protocols = []
def constructor_exists(path):
for klass in item_classes:
if klass.applies(path):
return True
return Fal... | """Available constructors for a path.
"""
applies = ((float(klass.applies(path, **kwargs)), klass) for klass in item_classes)
contructors = list(sorted((c for c in applies if c[0] > 0.0), key=lambda c: (c[0], c[1].__name__)))
logging.debug("For {0}, constructors found: {1}".format(path, contructors... | def find_constructors(path, **kwargs): | random_line_split |
__init__.py | import os
import glob
import importlib
import logging
logger = logging.getLogger(__name__)
class UnknownFormatError(RuntimeError):
pass
item_classes = []
supported_protocols = []
def constructor_exists(path):
for klass in item_classes:
if klass.applies(path):
return True
return Fal... | (name, storage, path):
"""Try to create item using one of the registered constructors."""
klass = find_best_constructor(path)
if klass:
return klass(storage, name, path)
else:
raise UnknownFormatError("Cannot interpret file %s" % path)
def register(klass):
"""Make this class availa... | read_item | identifier_name |
upload.py | #!/usr/bin/env python
import argparse
import errno
import hashlib
import os
import shutil
import subprocess
import sys
import tempfile
from io import StringIO
from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \
get_zip_name
from lib.util import electron_gyp, execute, ge... | ():
parser = argparse.ArgumentParser(description='upload distribution file')
parser.add_argument('-v', '--version', help='Specify the version',
default=ELECTRON_VERSION)
parser.add_argument('-p', '--publish-release',
help='Publish the release',
act... | parse_args | identifier_name |
upload.py | #!/usr/bin/env python
import argparse
import errno
import hashlib
import os
import shutil
import subprocess
import sys
import tempfile
from io import StringIO
from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \
get_zip_name
from lib.util import electron_gyp, execute, ge... |
def get_electron_build_version():
if get_target_arch() == 'arm' or os.environ.has_key('CI'):
# In CI we just build as told.
return ELECTRON_VERSION
if PLATFORM == 'darwin':
electron = os.path.join(SOURCE_ROOT, 'out', 'R',
'{0}.app'.format(PRODUCT_NAME), 'Contents',
... | script_path = os.path.join(SOURCE_ROOT, 'script', script)
return execute([sys.executable, script_path] + list(args)) | identifier_body |
upload.py | #!/usr/bin/env python
import argparse
import errno
import hashlib
import os
import shutil
import subprocess
import sys
import tempfile
from io import StringIO
from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \
get_zip_name
from lib.util import electron_gyp, execute, ge... | pass
# Upload the file.
with open(file_path, 'rb') as f:
upload_io_to_github(github, release, filename, f, 'application/zip')
# Upload the checksum file.
upload_sha256_checksum(release['tag_name'], file_path)
# Upload ARM assets without the v7l suffix for backwards compatibility
# TODO Remove f... | if asset['name'] == filename:
github.repos(ELECTRON_REPO).releases.assets(asset['id']).delete()
except Exception: | random_line_split |
upload.py | #!/usr/bin/env python
import argparse
import errno
import hashlib
import os
import shutil
import subprocess
import sys
import tempfile
from io import StringIO
from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \
get_zip_name
from lib.util import electron_gyp, execute, ge... |
if PLATFORM == 'darwin':
electron = os.path.join(SOURCE_ROOT, 'out', 'R',
'{0}.app'.format(PRODUCT_NAME), 'Contents',
'MacOS', PRODUCT_NAME)
elif PLATFORM == 'win32':
electron = os.path.join(SOURCE_ROOT, 'out', 'R',
'... | return ELECTRON_VERSION | conditional_block |
error.rs | use std::{env,
error,
fmt,
io,
net,
path::PathBuf,
result,
str,
string};
use crate::{api_client,
hcore::{self,
package::PackageIdent}};
pub type Result<T> = result::Result<T, Error>;
#[derive(Debug)]
pub e... | (err: net::AddrParseError) -> Self { Error::NetParseError(err) }
}
impl From<native_tls::Error> for Error {
fn from(error: native_tls::Error) -> Self { Error::NativeTls(error) }
}
| from | identifier_name |
error.rs | use std::{env,
error,
fmt,
io,
net,
path::PathBuf,
result,
str,
string};
use crate::{api_client,
hcore::{self,
package::PackageIdent}};
pub type Result<T> = result::Result<T, Error>;
#[derive(Debug)]
pub e... | }
impl From<net::AddrParseError> for Error {
fn from(err: net::AddrParseError) -> Self { Error::NetParseError(err) }
}
impl From<native_tls::Error> for Error {
fn from(error: native_tls::Error) -> Self { Error::NativeTls(error) }
} | fn from(err: toml::ser::Error) -> Self { Error::TomlSerializeError(err) } | random_line_split |
error.rs | use std::{env,
error,
fmt,
io,
net,
path::PathBuf,
result,
str,
string};
use crate::{api_client,
hcore::{self,
package::PackageIdent}};
pub type Result<T> = result::Result<T, Error>;
#[derive(Debug)]
pub e... |
Error::OfflinePackageNotFound(ref ident) => {
format!("No installed package or cached artifact could be found locally in \
offline mode: {}",
ident)
}
Error::PackageNotFound(ref e) => format!("Package not found. {}", e... | {
format!("Cached origin key not found in offline mode: {}",
name_with_rev)
} | conditional_block |
error.rs | use std::{env,
error,
fmt,
io,
net,
path::PathBuf,
result,
str,
string};
use crate::{api_client,
hcore::{self,
package::PackageIdent}};
pub type Result<T> = result::Result<T, Error>;
#[derive(Debug)]
pub e... |
}
impl From<env::JoinPathsError> for Error {
fn from(err: env::JoinPathsError) -> Self { Error::JoinPathsError(err) }
}
impl From<str::Utf8Error> for Error {
fn from(err: str::Utf8Error) -> Self { Error::StrFromUtf8Error(err) }
}
impl From<string::FromUtf8Error> for Error {
fn from(err: string::FromUtf8... | { Error::IO(err) } | identifier_body |
Decompose.js | /**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Create an array of points for each corner of a Rectangle
* If an array is specified, each point object will be added to the end of the a... |
out.push({ x: rect.x, y: rect.y });
out.push({ x: rect.right, y: rect.y });
out.push({ x: rect.right, y: rect.bottom });
out.push({ x: rect.x, y: rect.bottom });
return out;
};
module.exports = Decompose;
| { out = []; } | conditional_block |
Decompose.js | /**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Create an array of points for each corner of a Rectangle
* If an array is specified, each point object will be added to the end of the a... | return out;
};
module.exports = Decompose; | out.push({ x: rect.right, y: rect.bottom });
out.push({ x: rect.x, y: rect.bottom });
| random_line_split |
dweet.py | """
A component which allows you to send data to Dweet.io.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/dweet/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNKNO... |
try:
_state = state_helper.state_as_number(state)
except ValueError:
_state = state.state
json_body[state.attributes.get('friendly_name')] = _state
send_data(name, json_body)
hass.bus.listen(EVENT_STATE_CHANGED, dweet_event_listener)
return True
@T... | return | conditional_block |
dweet.py | """
A component which allows you to send data to Dweet.io.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/dweet/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNKNO... | (event):
"""Listen for new messages on the bus and sends them to Dweet.io."""
state = event.data.get('new_state')
if state is None or state.state in (STATE_UNKNOWN, '') \
or state.entity_id not in whitelist:
return
try:
_state = state_helper.state... | dweet_event_listener | identifier_name |
dweet.py | """
A component which allows you to send data to Dweet.io.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/dweet/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNKNO... | DOMAIN: vol.Schema({
vol.Required(CONF_NAME): cv.string,
vol.Required(CONF_WHITELIST): cv.string,
}),
}, extra=vol.ALLOW_EXTRA)
# pylint: disable=too-many-locals
def setup(hass, config):
"""Setup the Dweet.io component."""
conf = config[DOMAIN]
name = conf[CONF_NAME]
whitelist ... | CONFIG_SCHEMA = vol.Schema({ | random_line_split |
dweet.py | """
A component which allows you to send data to Dweet.io.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/dweet/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNKNO... |
hass.bus.listen(EVENT_STATE_CHANGED, dweet_event_listener)
return True
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def send_data(name, msg):
"""Send the collected data to Dweet.io."""
import dweepy
try:
dweepy.dweet_for(name, msg)
except dweepy.DweepyError:
_LOGGER.error("Error savi... | """Listen for new messages on the bus and sends them to Dweet.io."""
state = event.data.get('new_state')
if state is None or state.state in (STATE_UNKNOWN, '') \
or state.entity_id not in whitelist:
return
try:
_state = state_helper.state_as_number(state)... | identifier_body |
read_spec.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 lig::read::{read, read_attribute, read_entity, read_value};
use lig::*;
use ligature::{Attribute, Entity, Stateme... | fn read_attributes() -> Result<(), LigError> {
let a = "@<test>";
assert_eq!(read_attribute(a)?, Attribute::new("test")?);
Ok(())
}
#[test]
fn read_string_literals() -> Result<(), LigError> {
let s = "\"test\"";
assert_eq!(read_value(s)?, Value::StringLiteral("test".to_string()));
Ok(())
}
#[t... | );
}
#[test] | random_line_split |
read_spec.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 lig::read::{read, read_attribute, read_entity, read_value};
use lig::*;
use ligature::{Attribute, Entity, Stateme... |
#[test]
fn read_attributes() -> Result<(), LigError> {
let a = "@<test>";
assert_eq!(read_attribute(a)?, Attribute::new("test")?);
Ok(())
}
#[test]
fn read_string_literals() -> Result<(), LigError> {
let s = "\"test\"";
assert_eq!(read_value(s)?, Value::StringLiteral("test".to_string()));
Ok(... | {
let e = "<test>";
assert_eq!(
read_entity(e),
Entity::new("test").map_err(|_| LigError("Could not create entity.".into()))
);
} | identifier_body |
read_spec.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 lig::read::{read, read_attribute, read_entity, read_value};
use lig::*;
use ligature::{Attribute, Entity, Stateme... | () -> Result<(), LigError> {
let f = "1.2";
assert_eq!(read_value(f)?, Value::FloatLiteral(1.2));
Ok(())
}
#[test]
fn read_byte_arrays_literals() -> Result<(), LigError> {
let b = "0x00ff";
assert_eq!(read_value(b)?, Value::BytesLiteral(vec![0, 255]));
Ok(())
}
#[test]
fn read_entity_as_value(... | read_float_literals | identifier_name |
response.py | __author__ = 'Joe Linn'
#import pylastica
import pylastica.response
class Response(pylastica.response.Response): | @param response_data:
@type response_data: dict or str
@param action:
@type action: pylastica.bulk.action.Action
@param op_type: bulk operation type
@type op_type: str
"""
assert isinstance(action, pylastica.bulk.action.Action), "action must be an instance... | def __init__(self, response_data, action, op_type):
"""
| random_line_split |
response.py | __author__ = 'Joe Linn'
#import pylastica
import pylastica.response
class Response(pylastica.response.Response):
def __init__(self, response_data, action, op_type):
"""
@param response_data:
@type response_data: dict or str
@param action:
@type action: pylastica.bulk.actio... |
@property
def op_type(self):
"""
@return:
@rtype: str
"""
return self._op_type
| """
@return:
@rtype: pylastica.bulk.action.Action
"""
return self._action | identifier_body |
response.py | __author__ = 'Joe Linn'
#import pylastica
import pylastica.response
class Response(pylastica.response.Response):
def | (self, response_data, action, op_type):
"""
@param response_data:
@type response_data: dict or str
@param action:
@type action: pylastica.bulk.action.Action
@param op_type: bulk operation type
@type op_type: str
"""
assert isinstance(action, pylas... | __init__ | identifier_name |
task.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... |
def get_dep_chain(self):
if self._parent:
return self._parent.get_dep_chain()
else:
return None
def get_search_path(self):
'''
Return the list of paths you should search for files, in order.
This follows role/playbook dependency chain.
'... | '''
Generic logic to get the attribute or parent attribute for a task value.
'''
extend = self._valid_attrs[attr].extend
prepend = self._valid_attrs[attr].prepend
try:
value = self._attributes[attr]
# If parent is static, we can grab attrs from the parent... | identifier_body |
task.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | "be a variable itself (though it can contain variables)",
obj=ds,
)
return LoopControl.load(data=ds, variable_manager=self._variable_manager, loader=self._loader)
def _validate_attributes(self, ds):
try:
super(Task, self)._validate_attributes... | "the `loop_control` value must be specified as a dictionary and cannot " | random_line_split |
task.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | (self, block=None, role=None, task_include=None):
''' constructors a task, without the Task.load classmethod, it will be pretty blank '''
self._role = role
self._parent = None
if task_include:
self._parent = task_include
else:
self._parent = block
... | __init__ | identifier_name |
task.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... |
else:
display.warning("could not parse environment value, skipping: %s" % value)
elif isinstance(value, dict):
# should not really happen
env = dict()
for env_item in value:
_parse_env_k... | env.update(isdict) | conditional_block |
axis.js | // "horizontalaxis" : {
// "id" : STRING, "type" : DATATYPE(number), "length" : RELLEN(1.0), "base" : POINT(-1,1), "anchor" : DOUBLE(-1), "position" : POINT(0,0),
// "min" : DATAVALUEORAUTO(auto), "max" : DATAVALUEORAUTO(auto), "minposition" : RELPOS(-1.0), "maxposition" : RELPOS(1.0), "color" : COLOR(black), "l... | // If there was a spacing attr on the <labels> tag, create a new labeler for
// each spacing present in it, using the other values from the <labels> tag
for (i = 0; i < spacings.length; ++i) {
labelers.add(Labeler.parseJSON(json, axis, undefined, spacings[i]));
}
} else i... | spacings = vF.typeOf(json.spacing) === 'array' ? json.spacing : [ json.spacing ];
}
}
if (spacings.length > 0) { | random_line_split |
axis.js |
// "horizontalaxis" : {
// "id" : STRING, "type" : DATATYPE(number), "length" : RELLEN(1.0), "base" : POINT(-1,1), "anchor" : DOUBLE(-1), "position" : POINT(0,0),
// "min" : DATAVALUEORAUTO(auto), "max" : DATAVALUEORAUTO(auto), "minposition" : RELPOS(-1.0), "maxposition" : RELPOS(1.0), "color" : COLOR(black), "... | else {
axis.title(AxisTitle.parseJSON(json.title, axis));
}
} else {
axis.title(new AxisTitle(axis));
}
if (json.grid) {
axis.grid(Grid.parseJSON(json.grid));
}
if (json.visible !== undefined) {
axis.visible(json.... | {
if (json.title) {
axis.title(new AxisTitle(axis));
} else {
axis.title(AxisTitle.parseJSON({}, axis));
}
} | conditional_block |
input.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 script_traits::MouseButton;
use std::path::Path;
use std::mem::size_of;
use std::mem::transmute;
use std::mem... | else {
touch_count += 1;
}
}
slots[current_slot].tracking_id = event.value;
},
(EV_ABS, _) => println!("Unknown ABS code {}", event.code),
(_, _) => println!("Unknown event type {... | {
touch_count -= 1;
} | conditional_block |
input.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 script_traits::MouseButton;
use std::path::Path;
use std::mem::size_of;
use std::mem::transmute;
use std::mem... | (device_path: &Path,
sender: &Sender<WindowEvent>) {
let mut device = match File::open(device_path) {
Ok(dev) => dev,
Err(e) => {
println!("Couldn't open device! {}", e);
return;
},
};
let fd = device.as_raw_fd();
let mut x_info: linu... | read_input_device | identifier_name |
input.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 script_traits::MouseButton;
use std::path::Path;
use std::mem::size_of;
use std::mem::transmute;
use std::mem... | println!("Couldn't get ABS_MT_POSITION_X info {} {}", ret, errno());
}
}
unsafe {
let ret = ioctl(fd, ev_ioc_g_abs(ABS_MT_POSITION_Y), &mut y_info);
if ret < 0 {
println!("Couldn't get ABS_MT_POSITION_Y info {} {}", ret, errno());
}
}
let touchWid... | unsafe {
let ret = ioctl(fd, ev_ioc_g_abs(ABS_MT_POSITION_X), &mut x_info);
if ret < 0 { | random_line_split |
htmlframeelement.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 dom::bindings::codegen::Bindings::HTMLFrameElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFrame... | use servo_util::str::DOMString;
#[deriving(Encodable)]
#[must_root]
pub struct HTMLFrameElement {
pub htmlelement: HTMLElement
}
impl HTMLFrameElementDerived for EventTarget {
fn is_htmlframeelement(&self) -> bool {
self.type_id == NodeTargetTypeId(ElementNodeTypeId(HTMLFrameElementTypeId))
}
}
i... | use dom::document::Document;
use dom::element::HTMLFrameElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::htmlelement::HTMLElement;
use dom::node::{Node, ElementNodeTypeId}; | random_line_split |
htmlframeelement.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 dom::bindings::codegen::Bindings::HTMLFrameElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFrame... |
}
| {
self.htmlelement.reflector()
} | identifier_body |
htmlframeelement.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 dom::bindings::codegen::Bindings::HTMLFrameElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLFrame... | (localName: DOMString, document: JSRef<Document>) -> Temporary<HTMLFrameElement> {
let element = HTMLFrameElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLFrameElementBinding::Wrap)
}
}
impl Reflectable for HTMLFrameElement {
fn reflector<'a>(&'a self) ... | new | identifier_name |
scrollable.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Directionality} from '@angular/cdk/bidi';
import {
getRtlScrollAxisType,
RtlScrollAxisType,
supportsScr... | /** Returns observable that emits when a scroll event is fired on the host element. */
elementScrolled(): Observable<Event> {
return this._elementScrolled;
}
/** Gets the ElementRef for the viewport. */
getElementRef(): ElementRef<HTMLElement> {
return this.elementRef;
}
/**
* Scrolls to the ... | this.scrollDispatcher.deregister(this);
this._destroyed.next();
this._destroyed.complete();
}
| random_line_split |
scrollable.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Directionality} from '@angular/cdk/bidi';
import {
getRtlScrollAxisType,
RtlScrollAxisType,
supportsScr... | else if (from == 'end') {
from = isRtl ? LEFT : RIGHT;
}
if (isRtl && getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
// For INVERTED, scrollLeft is (scrollWidth - clientWidth) when scrolled all the way left and
// 0 when scrolled all the way right.
if (from == LEFT) {
... | {
from = isRtl ? RIGHT : LEFT;
} | conditional_block |
scrollable.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Directionality} from '@angular/cdk/bidi';
import {
getRtlScrollAxisType,
RtlScrollAxisType,
supportsScr... |
/** Gets the ElementRef for the viewport. */
getElementRef(): ElementRef<HTMLElement> {
return this.elementRef;
}
/**
* Scrolls to the specified offsets. This is a normalized version of the browser's native scrollTo
* method, since browsers are not consistent about what scrollLeft means in RTL. For... | {
return this._elementScrolled;
} | identifier_body |
scrollable.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Directionality} from '@angular/cdk/bidi';
import {
getRtlScrollAxisType,
RtlScrollAxisType,
supportsScr... | () {
this.scrollDispatcher.register(this);
}
ngOnDestroy() {
this.scrollDispatcher.deregister(this);
this._destroyed.next();
this._destroyed.complete();
}
/** Returns observable that emits when a scroll event is fired on the host element. */
elementScrolled(): Observable<Event> {
return ... | ngOnInit | identifier_name |
mod.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | (&mut self, addr: rtio::SocketAddr)
-> IoResult<Box<rtio::RtioUdpSocket + Send>> {
net::UdpSocket::bind(addr).map(|u| {
box u as Box<rtio::RtioUdpSocket + Send>
})
}
fn unix_bind(&mut self, path: &CString)
-> IoResult<Box<rtio::RtioUnixListener + Send... | udp_bind | identifier_name |
mod.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
n => return n,
}
}
}
fn keep_going(data: &[u8], f: |*const u8, uint| -> i64) -> i64 {
let origamt = data.len();
let mut data = data.as_ptr();
let mut amt = origamt;
while amt > 0 {
let ret = retry(|| f(data, amt) as libc::c_int);
if ret == 0 {
break
... | {} | conditional_block |
mod.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
#[cfg(unix)]
#[path = "file_unix.rs"]
pub mod file;
#[cfg(windows)]
#[path = "file_windows.rs"]
pub mod file;
#[cfg(target_os = "macos")]
#[cfg(target_os = "ios")]
#[cfg(target_os = "freebsd")]
#[cfg(target_os = "dragonfly")]
#[cfg(target_os = "android")]
#[cfg(target_os = "linux")]
#[path = "timer_unix.rs"]
pub mod ... | pub mod process;
mod util; | random_line_split |
testrpc.ts | // Deterministic accounts when called as 'ganache-cli -m soltsice' | /** The first five accounts generated with soltsice mnemonic on Ganache (TestRPC) */
export const testAddresses: string[] =
[
'0x11a9f77f4d2d9f298536f47ef14790b612e40a98',
'0x772167d4d36b92523e5284b6e39a20f7b7add641',
'0x64a91e5c14720ffda56a7a29fa8a891c4bf3ca9a',
'0x5c58888cd9f60ea6f... | random_line_split | |
jquery.autocomplete.js | /*
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/
;(... | url: isUrl ? urlOrData : null,
data: isUrl ? null : urlOrData,
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
max: options && !options.scroll ? 10 : 150
}, options);
// if highlight is set to false, replace it with a do-nothing function
options.highlight = options.highlight || function(value) ... | random_line_split | |
jquery.autocomplete.js | /*
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/
;(... | };
function movePosition(step) {
active += step;
if (active < 0) {
active = listItems.size() - 1;
} else if (active >= listItems.size()) {
active = 0;
}
}
function limitNumberOfItems(available) {
return options.max && options.max < available
? options.max
: available;
}
function fillLi... |
var offset = 0;
listItems.slice(0, active).each(function() {
offset += this.offsetHeight;
});
if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
... | conditional_block |
jquery.autocomplete.js | /*
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/
;(... |
function hideResultsNow() {
var wasVisible = select.visible();
select.hide();
clearTimeout(timeout);
stopLoading();
if (options.mustMatch) {
// call search and run callback
$input.search(
function (result){
// if no value found, clear the input box
if( !result ) {
if (options.mult... |
clearTimeout(timeout);
timeout = setTimeout(hideResultsNow, 200);
}; | identifier_body |
jquery.autocomplete.js | /*
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/
;(... | step) {
active += step;
if (active < 0) {
active = listItems.size() - 1;
} else if (active >= listItems.size()) {
active = 0;
}
}
function limitNumberOfItems(available) {
return options.max && options.max < available
? options.max
: available;
}
function fillList() {
list.empty();
var ... | ovePosition( | identifier_name |
test_matcher.py | # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib', 'pyscraper'))
from matcher import Matcher
import util as util
import unittest
class TestM... | (cls):
# This is required so that readScraper() can parse the XML instruction files
util.RCBHOME = os.path.join(os.path.dirname(__file__), '..', '..')
# Test matching against a result set
def test_getBestResultsWithRomanNumerals(self):
results = [{'SearchKey': ['Tekken 2']}, {'SearchKey': ['Tekken 3']}, {'Se... | setUpClass | identifier_name |
test_matcher.py | # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib', 'pyscraper'))
from matcher import Matcher
import util as util
import unittest
class TestM... | conditional_block | ||
test_matcher.py | # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib', 'pyscraper'))
from matcher import Matcher
import util as util
import unittest
class TestM... |
# Test matching against a result set
def test_getBestResultsWithRomanNumerals(self):
results = [{'SearchKey': ['Tekken 2']}, {'SearchKey': ['Tekken 3']}, {'SearchKey': ['Tekken IV']}]
gamename = 'Tekken II'
m = Matcher()
x = m.getBestResults(results, gamename)
self.assertEquals(x.get('SearchKey')[0], ... | util.RCBHOME = os.path.join(os.path.dirname(__file__), '..', '..') | identifier_body |
test_matcher.py | # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'lib', 'pyscraper'))
from matcher import Matcher
import util as util
import unittest
class TestM... | if __name__ == "__main__":
unittest.main() | m = Matcher()
x = m.getBestResults(results, gamename)
self.assertEquals(x.get('SearchKey')[0], 'FIFA 98')
| random_line_split |
test_sns_operations.py | #!/usr/bin/env python
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limi... | (self):
self.session = botocore.session.get_session()
self.sns = self.session.get_service('sns')
def test_subscribe_with_endpoint(self):
op = self.sns.get_operation('Subscribe')
params = op.build_parameters(topic_arn='topic_arn',
protocol='http',... | setUp | identifier_name |
test_sns_operations.py | #!/usr/bin/env python
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limi... | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
import unittest
from mock import Mock, sentinel
import botocore.session
class TestSNSOperations(unittest.TestCase):
def setUp(self):
self.session = botocore.session.get_session()
self.sns = self.sessio... | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF ... | random_line_split |
test_sns_operations.py | #!/usr/bin/env python
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limi... | unittest.main() | conditional_block | |
test_sns_operations.py | #!/usr/bin/env python
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limi... |
def test_subscribe_with_endpoint(self):
op = self.sns.get_operation('Subscribe')
params = op.build_parameters(topic_arn='topic_arn',
protocol='http',
notification_endpoint='http://example.org')
self.assertEqual(param... | self.session = botocore.session.get_session()
self.sns = self.session.get_service('sns') | identifier_body |
workspace.rs | use crate::core::{Target, Workspace};
use crate::ops::CompileOptions;
use crate::util::CargoResult;
use anyhow::bail;
use std::fmt::Write;
fn get_available_targets<'a>(
filter_fn: fn(&Target) -> bool,
ws: &'a Workspace<'_>,
options: &'a CompileOptions,
) -> CargoResult<Vec<&'a str>> {
let packages = op... |
pub fn print_available_binaries(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> {
print_available_targets(Target::is_bin, ws, options, "--bin", "binaries")
}
pub fn print_available_benches(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> {
print_available_targets(Target::is_b... | {
print_available_targets(Target::is_example, ws, options, "--example", "examples")
} | identifier_body |
workspace.rs | use crate::core::{Target, Workspace};
use crate::ops::CompileOptions;
use crate::util::CargoResult;
use anyhow::bail;
use std::fmt::Write;
fn get_available_targets<'a>(
filter_fn: fn(&Target) -> bool,
ws: &'a Workspace<'_>,
options: &'a CompileOptions,
) -> CargoResult<Vec<&'a str>> {
let packages = op... | (
filter_fn: fn(&Target) -> bool,
ws: &Workspace<'_>,
options: &CompileOptions,
option_name: &str,
plural_name: &str,
) -> CargoResult<()> {
let targets = get_available_targets(filter_fn, ws, options)?;
let mut output = String::new();
writeln!(output, "\"{}\" takes one argument.", optio... | print_available_targets | identifier_name |
workspace.rs | use crate::core::{Target, Workspace};
use crate::ops::CompileOptions;
use crate::util::CargoResult;
use anyhow::bail;
use std::fmt::Write;
fn get_available_targets<'a>(
filter_fn: fn(&Target) -> bool,
ws: &'a Workspace<'_>,
options: &'a CompileOptions,
) -> CargoResult<Vec<&'a str>> {
let packages = op... |
bail!("{}", output)
}
pub fn print_available_examples(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> {
print_available_targets(Target::is_example, ws, options, "--example", "examples")
}
pub fn print_available_binaries(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> {
p... | {
writeln!(output, "Possible packages/workspace members:")?;
for package in packages {
writeln!(output, " {}", package)?;
}
} | conditional_block |
workspace.rs | use crate::core::{Target, Workspace};
use crate::ops::CompileOptions;
use crate::util::CargoResult;
use anyhow::bail;
use std::fmt::Write;
fn get_available_targets<'a>(
filter_fn: fn(&Target) -> bool,
ws: &'a Workspace<'_>,
options: &'a CompileOptions,
) -> CargoResult<Vec<&'a str>> {
let packages = op... | which can be any package ID specifier in the dependency graph.\n\
Run `cargo help pkgid` for more information about SPEC format.\n\n"
.to_string();
if packages.is_empty() {
// This would never happen.
// Just in case something regresses we covers it here.
writeln!(ou... | .members()
.map(|pkg| pkg.name().as_str())
.collect::<Vec<_>>();
let mut output = "\"--package <SPEC>\" requires a SPEC format value, \ | random_line_split |
index.js | export { default as mdlUpgrade } from './utils/mdlUpgrade';
export { default as MDLComponent } from './utils/MDLComponent';
// components | CardMedia, CardText, CardMenu
} from './Card';
export { default as Checkbox } from './Checkbox';
export { default as DataTable, Table, TableHeader } from './DataTable';
export {
Dialog, DialogTitle, DialogContent,
DialogActions
} from './Dialog';
export { default as FABButton } from './FABButton';
export {
... | export { default as Badge } from './Badge';
export { default as Button } from './Button';
export {
Card, CardTitle, CardActions, | random_line_split |
factory.py | # 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 th... | # Copyright 2012 Kevin Ormbrek
# | random_line_split | |
factory.py | # Copyright 2012 Kevin Ormbrek
#
# 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... |
return obj
# private
def _assert_is_suds_object(self, object):
if not isinstance(object, SudsObject):
raise ValueError("Object must be a WSDL object (suds.sudsobject.Object).")
| self.set_wsdl_object_attribute(obj, name_value_pairs[i], name_value_pairs[i + 1]) | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.