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
gulpfile.js
var gulp = require( 'gulp' ); var rename = require( 'gulp-rename' ); var browserify = require( 'browserify' ); var browserifyInc = require( 'browserify-incremental' ); var reactify = require( 'reactify' ); var xtend = require( 'xtend' ); var source = require( 'vinyl-source-stream' );
entries: [ './src/client/index.jsx' ], extensions: [ '.jsx' ], transform: [ reactify ], debug: true } ) ); browserifyInc( bundler, { cacheFile: './browserify-cache.json' } ); return bundler.bundle() .pipe( source( 'main.js' ) ) .pipe( gulp.dest( 'public/js' ) ); } ); gulp.task( 'server', function () { ...
var server = require( 'gulp-express' ); gulp.task( 'browserify', function () { var bundler = browserify( xtend( browserifyInc.args, {
random_line_split
main.py
# https://leetcode.com/problems/valid-parentheses/ class Solution(object): def isValid(self, s):
if s[i] == "]" and last != "[": return False if s[i] == "}" and last != "{": return False return len(stack) == 0
""" :type s: str :rtype: bool """ if not s: return True stack = [] for i in xrange(len(s)): # if its opening it, its getting deeper so add to stack if s[i] in "([{": stack.append(s[i]) # if not it must be a ...
identifier_body
main.py
# https://leetcode.com/problems/valid-parentheses/ class Solution(object):
:type s: str :rtype: bool """ if not s: return True stack = [] for i in xrange(len(s)): # if its opening it, its getting deeper so add to stack if s[i] in "([{": stack.append(s[i]) # if not it must be a clos...
def isValid(self, s): """
random_line_split
main.py
# https://leetcode.com/problems/valid-parentheses/ class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ if not s: return True stack = [] for i in xrange(len(s)): # if its opening it, its getting deeper so add...
last = stack.pop() if s[i] == ")" and last != "(": return False if s[i] == "]" and last != "[": return False if s[i] == "}" and last != "{": return False return len(stack) == 0
return False
conditional_block
main.py
# https://leetcode.com/problems/valid-parentheses/ class
(object): def isValid(self, s): """ :type s: str :rtype: bool """ if not s: return True stack = [] for i in xrange(len(s)): # if its opening it, its getting deeper so add to stack if s[i] in "([{": stack.app...
Solution
identifier_name
taskrequests.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
(self, resourceName, amount): self._name = resourceName self._amount = float(amount) @property def resourceName(self): return self._name @property def amount(self): return self._amount class TaskResourceRequests(object): """ .. note:: Evolving A set of t...
__init__
identifier_name
taskrequests.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
:class:`pyspark.resource.ResourceProfile` to programmatically specify the resources needed for an RDD that will be applied at the stage level. The amount is specified as a Double to allow for saying you want more then 1 task per resource. Valid values are less than or equal to 0.5 or whole numbers. ...
class TaskResourceRequest(object): """ .. note:: Evolving A task resource request. This is used in conjuntion with the
random_line_split
taskrequests.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
def cpus(self, amount): if self._java_task_resource_requests is not None: self._java_task_resource_requests.cpus(amount) else: self._task_resources[self._CPUS] = TaskResourceRequest(self._CPUS, amount) return self def resource(self, resourceName, amount): ...
from pyspark import SparkContext _jvm = _jvm or SparkContext._jvm if _jvm is not None: self._java_task_resource_requests = \ SparkContext._jvm.org.apache.spark.resource.TaskResourceRequests() if _requests is not None: for k, v in _requests.items():...
identifier_body
taskrequests.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
else: self._java_task_resource_requests = None self._task_resources = {} def cpus(self, amount): if self._java_task_resource_requests is not None: self._java_task_resource_requests.cpus(amount) else: self._task_resources[self._CPUS] = TaskRes...
self._java_task_resource_requests.resource(v.resourceName, v.amount)
conditional_block
__init__.py
# # crowbar - a geometry manipulation program # Copyright (C) 2020 Dylan Scott Grafmyre # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, ...
# along with this program. If not, see <https://www.gnu.org/licenses/>. # """ crowbar - a geometry manipulation program Copyright (C) 2020 Dylan Scott Grafmyre """ import crowbar.baseextension as c_be class StatusBar(c_be.CoreExtension): pkg_resources_prefix = 'ext/status_bar' INSTANCE = StatusBar()...
# You should have received a copy of the GNU Affero General Public License
random_line_split
__init__.py
# # crowbar - a geometry manipulation program # Copyright (C) 2020 Dylan Scott Grafmyre # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, ...
(c_be.CoreExtension): pkg_resources_prefix = 'ext/status_bar' INSTANCE = StatusBar() get_main_gtk_widget = INSTANCE.main_gtk_widget
StatusBar
identifier_name
__init__.py
# # crowbar - a geometry manipulation program # Copyright (C) 2020 Dylan Scott Grafmyre # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, ...
INSTANCE = StatusBar() get_main_gtk_widget = INSTANCE.main_gtk_widget
pkg_resources_prefix = 'ext/status_bar'
identifier_body
__openerp__.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2008-2013 AvanzOSC S.L. All Rights Reserved # Date: 01/07/2013 # # This program is free software: you can redistribute it and/or modif...
############################################################################## { "name": "AvanzOSC - tree_grid extension", "version": "1.0", "depends": ["tree_grid","sale","purchase","stock","account","avanzosc_calculate_coeficient_udv_automatically"], "author": "AvanzOSC S.L.", "category": "Generi...
#
random_line_split
folder.py
# -*- coding: utf-8 -*- """ (c) 2014 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon <pingou@pingoured.fr> """ from anitya.lib.backends import ( BaseBackend, get_versions_by_regex_for_text, REGEX) from anitya.lib.exceptions import AnityaPluginException import six DEFAULT_REGEX = 'href="([0-9][0-9.]*)/...
url, project.name, str(err))) versions = None if not isinstance(req, six.string_types): req = req.text try: regex = REGEX % {'name': project.name.replace('+', '\+')} versions = get_versions_by_regex_for_text( req, url, reg...
''' Method called to retrieve all the versions (that can be found) of the projects provided, project that relies on the backend of this plugin. :arg Project project: a :class:`model.Project` object whose backend corresponds to the current plugin. :return: a list of all the p...
identifier_body
folder.py
# -*- coding: utf-8 -*- """ (c) 2014 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon <pingou@pingoured.fr> """ from anitya.lib.backends import ( BaseBackend, get_versions_by_regex_for_text, REGEX) from anitya.lib.exceptions import AnityaPluginException import six DEFAULT_REGEX = 'href="([0-9][0-9.]*)/...
except AnityaPluginException: versions = get_versions_by_regex_for_text( req, url, DEFAULT_REGEX, project) return versions
random_line_split
folder.py
# -*- coding: utf-8 -*- """ (c) 2014 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon <pingou@pingoured.fr> """ from anitya.lib.backends import ( BaseBackend, get_versions_by_regex_for_text, REGEX) from anitya.lib.exceptions import AnityaPluginException import six DEFAULT_REGEX = 'href="([0-9][0-9.]*)/...
(cls, project): ''' Method called to retrieve all the versions (that can be found) of the projects provided, project that relies on the backend of this plugin. :arg Project project: a :class:`model.Project` object whose backend corresponds to the current plugin. :ret...
get_versions
identifier_name
folder.py
# -*- coding: utf-8 -*- """ (c) 2014 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon <pingou@pingoured.fr> """ from anitya.lib.backends import ( BaseBackend, get_versions_by_regex_for_text, REGEX) from anitya.lib.exceptions import AnityaPluginException import six DEFAULT_REGEX = 'href="([0-9][0-9.]*)/...
try: regex = REGEX % {'name': project.name.replace('+', '\+')} versions = get_versions_by_regex_for_text( req, url, regex, project) except AnityaPluginException: versions = get_versions_by_regex_for_text( req, url, DEFAULT_REGEX, proj...
req = req.text
conditional_block
requestService.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
constructor( @IThreadService threadService: IThreadService, @IWorkspaceContextService contextService: IWorkspaceContextService, @ITelemetryService telemetryService?: ITelemetryService ) { super(contextService, telemetryService); this._threadService = threadService; threadService.registerInstance(this);...
private _nodeJSXHRFunctionPromise: TPromise<IXHRFunction>; private _threadService: IThreadService;
random_line_split
requestService.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
protected makeCrossOriginRequest(options:http.IXHROptions): TPromise<http.IXHRResponse> { if (this._nodeJSXHRFunctionPromise) { // use nodejs to make the call let timer:ITimerEvent = nullEvent; return this._nodeJSXHRFunctionPromise.then((xhrFunction) => { return async.always(xhrFunction(options), ((x...
{ let url = options.url; if (!url) { throw new Error('IRequestService.makeRequest: Url is required.'); } // Support file:// in worker environment through XHR if (strings.startsWith(url, 'file://')) { return xhr(options).then(null, (xhr:XMLHttpRequest) => { if (xhr.status === 0 && xhr.responseText) ...
identifier_body
requestService.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} }
{ // use the main thread to make the call return <TPromise<http.IXHRResponse>> this._threadService.MainThread(this, 'makeCrossOriginRequest', null, [options]); }
conditional_block
requestService.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(): string { return 'NativeRequestService'; } public makeRequest(options:http.IXHROptions):TPromise<http.IXHRResponse> { let url = options.url; if (!url) { throw new Error('IRequestService.makeRequest: Url is required.'); } // Support file:// in worker environment through XHR if (strings.startsWith(u...
getId
identifier_name
streaming.js
import to from 'await-to-js'; import { isWordPressError } from '../utils/utils'; import { cleanUpAfterSync } from '../utils/utils-progress'; import { syncingConfigJavascriptError, syncingConfigErrorBeforeSync } from './syncing-config'; /* Construct Streaming Options itemCount = (int) */ function constru...
/* Fires requests to batch items */ function batchItemsPerPage(itemCount, batchFunction) { return new Promise( async function batchItemsHandler(resolve, reject) { var { currentPage, pages } = constructStreamingOptions(itemCount); while (currentPage <= pages) { var [error, data] = await to( batc...
{ return { currentPage: 1, pages: Math.ceil( (parseInt(itemCount) / parseInt(WP_Shopify.itemsPerRequest)) ) } }
identifier_body
streaming.js
import to from 'await-to-js'; import { isWordPressError } from '../utils/utils'; import { cleanUpAfterSync } from '../utils/utils-progress'; import { syncingConfigJavascriptError, syncingConfigErrorBeforeSync } from './syncing-config'; /* Construct Streaming Options itemCount = (int) */ function constru...
if ( isWordPressError(data) ) { cleanUpAfterSync( syncingConfigErrorBeforeSync(data) ); resolve(); break; } currentPage++; } resolve(); }); } /* Begins the Products background syncing process */ function streamItems(itemCount, batchFunction) { return new...
{ cleanUpAfterSync( syncingConfigJavascriptError(error) ); resolve(); break; }
conditional_block
streaming.js
import to from 'await-to-js'; import { isWordPressError } from '../utils/utils'; import { cleanUpAfterSync } from '../utils/utils-progress'; import { syncingConfigJavascriptError, syncingConfigErrorBeforeSync } from './syncing-config'; /* Construct Streaming Options itemCount = (int) */ function constru...
if (error) { cleanUpAfterSync( syncingConfigJavascriptError(error) ); resolve(); break; } if ( isWordPressError(data) ) { cleanUpAfterSync( syncingConfigErrorBeforeSync(data) ); resolve(); break; } currentPage++; } resolve(); ...
while (currentPage <= pages) { var [error, data] = await to( batchFunction({ 'page': currentPage }) );
random_line_split
streaming.js
import to from 'await-to-js'; import { isWordPressError } from '../utils/utils'; import { cleanUpAfterSync } from '../utils/utils-progress'; import { syncingConfigJavascriptError, syncingConfigErrorBeforeSync } from './syncing-config'; /* Construct Streaming Options itemCount = (int) */ function constru...
(itemCount, batchFunction) { return new Promise( async function batchItemsHandler(resolve, reject) { var { currentPage, pages } = constructStreamingOptions(itemCount); while (currentPage <= pages) { var [error, data] = await to( batchFunction({ 'page': currentPage }) ); if (erro...
batchItemsPerPage
identifier_name
qparametersmanager_en.ts
<name>Logger</name> <message> <location filename="src/logger.cpp" line="37"/> <source>[ DEBUG ] </source> <translation type="unfinished"></translation> </message> <message> <location filename="src/logger.cpp" line="38"/> <source>[ INFO. ] </source> <transl...
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="en_US"> <context>
random_line_split
args.ts
import meow from 'meow'; import { Package, UpdateNotifier } from 'update-notifier'; import { Runner, TypescriptStarterArgsOptions, validateName } from './utils'; export async function
(): Promise<TypescriptStarterArgsOptions> { const cli = meow( ` Usage $ npx typescript-starter Non-Interactive Usage $ npx typescript-starter <project-name> [options] Options --appveyor include Appveyor for Windows CI --description, -d package.json description --dom ...
checkArgs
identifier_name
args.ts
import meow from 'meow'; import { Package, UpdateNotifier } from 'update-notifier'; import { Runner, TypescriptStarterArgsOptions, validateName } from './utils'; export async function checkArgs(): Promise<TypescriptStarterArgsOptions> { const cli = meow( ` Usage $ npx typescript-starter Non-Interactive U...
const version = cli.pkg.version as string; const input = cli.input[0]; if (!input) { /** * No project-name provided, return to collect options in interactive mode. * Note: we always return `install`, so --no-install always works * (important for test performance). */ return { ...
{ // eslint-disable-next-line functional/no-throw-statement throw new Error(` Your version of typescript-starter is outdated. Consider using 'npx typescript-starter' to always get the latest version. `); }
conditional_block
args.ts
import meow from 'meow'; import { Package, UpdateNotifier } from 'update-notifier'; import { Runner, TypescriptStarterArgsOptions, validateName } from './utils'; export async function checkArgs(): Promise<TypescriptStarterArgsOptions>
--no-editorconfig don't include .editorconfig --no-functional don't enable eslint-plugin-functional --no-install skip yarn/npm install --no-vscode don't include VS Code debugging config Non-Interactive Example $ npx typescript-starter my-library -d 'do something, better' ...
{ const cli = meow( ` Usage $ npx typescript-starter Non-Interactive Usage $ npx typescript-starter <project-name> [options] Options --appveyor include Appveyor for Windows CI --description, -d package.json description --dom include DOM type definitions --node...
identifier_body
args.ts
import meow from 'meow'; import { Package, UpdateNotifier } from 'update-notifier'; import { Runner, TypescriptStarterArgsOptions, validateName } from './utils'; export async function checkArgs(): Promise<TypescriptStarterArgsOptions> { const cli = meow( ` Usage $ npx typescript-starter Non-Interactive U...
throw new Error(` Your version of typescript-starter is outdated. Consider using 'npx typescript-starter' to always get the latest version. `); } const version = cli.pkg.version as string; const input = cli.input[0]; if (!input) { /** * No project-name provided, return to collec...
// eslint-disable-next-line functional/no-throw-statement
random_line_split
chip-option.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 {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion'; import {SPACE} from '@angular/cdk/keycodes...
/** Allows for programmatic focusing of the chip. */ focus(): void { if (this.disabled) { return; } if (!this._hasFocus()) { this._elementRef.nativeElement.focus(); this._onFocus.next({chip: this}); } this._hasFocusInternal = true; } /** Resets the state of the chip whe...
{ this.selectionChange.emit({ source: this, isUserInput, selected: this.selected }); }
identifier_body
chip-option.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 {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion'; import {SPACE} from '@angular/cdk/keycodes...
extends MatChip implements AfterContentInit { /** Whether the chip list is selectable. */ chipListSelectable: boolean = true; /** Whether the chip list is in multi-selection mode. */ _chipListMultiple: boolean = false; /** * Whether or not the chip is selectable. * * When a chip is not selectable...
MatChipOption
identifier_name
chip-option.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 {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion'; import {SPACE} from '@angular/cdk/keycodes...
// that moves focus not the next item. To work around the issue, we defer marking the chip // as not focused until the next time the zone stabilizes. this._ngZone.onStable .pipe(take(1)) .subscribe(() => { this._ngZone.run(() => { this._hasFocusInternal = false; this....
// earlier than usual, causing it to be blurred and throwing off the logic in the chip list
random_line_split
uLispParser.py
""" BNF reference: http://theory.lcs.mit.edu/~rivest/sexp.txt <sexp> :: <string> | <list> <string> :: <display>? <simple-string> ; <simple-string> :: <raw> | <token> | <base-64> | <hexadecimal> | <quoted-string> ; <display> :: "[" <simple-string> "]" ; <raw> :: <decimal> ":" <bytes> ; <deci...
(s, l, t): t = t[0] if t.len is not None: t1len = len(t[1]) if t1len != t.len: raise ParseFatalException(s, l, "invalid data of length %d, expected %s" % (t1len, t.len)) return t[1] # define punctuation literals LPAR, RPAR, LBRK, RBRK, LBRC, RBRC, VBAR = map(Suppress, "()[]{}|")...
verifyLen
identifier_name
uLispParser.py
""" BNF reference: http://theory.lcs.mit.edu/~rivest/sexp.txt <sexp> :: <string> | <list> <string> :: <display>? <simple-string> ; <simple-string> :: <raw> | <token> | <base-64> | <hexadecimal> | <quoted-string> ; <display> :: "[" <simple-string> "]" ; <raw> :: <decimal> ":" <bytes> ; <deci...
# define punctuation literals LPAR, RPAR, LBRK, RBRK, LBRC, RBRC, VBAR = map(Suppress, "()[]{}|") decimal = Regex(r'0|[1-9]\d*').setParseAction(lambda t: int(t[0])) hexadecimal = ("#" + OneOrMore(Word(hexnums)) + "#") \ .setParseAction(lambda t: int("".join(t[1:-1]), 16)) bytes = Word(printables) raw = Group(dec...
t = t[0] if t.len is not None: t1len = len(t[1]) if t1len != t.len: raise ParseFatalException(s, l, "invalid data of length %d, expected %s" % (t1len, t.len)) return t[1]
identifier_body
uLispParser.py
""" BNF reference: http://theory.lcs.mit.edu/~rivest/sexp.txt <sexp> :: <string> | <list> <string> :: <display>? <simple-string> ; <simple-string> :: <raw> | <token> | <base-64> | <hexadecimal> | <quoted-string> ; <display> :: "[" <simple-string> "]" ; <raw> :: <decimal> ":" <bytes> ; <deci...
return t[1] # define punctuation literals LPAR, RPAR, LBRK, RBRK, LBRC, RBRC, VBAR = map(Suppress, "()[]{}|") decimal = Regex(r'0|[1-9]\d*').setParseAction(lambda t: int(t[0])) hexadecimal = ("#" + OneOrMore(Word(hexnums)) + "#") \ .setParseAction(lambda t: int("".join(t[1:-1]), 16)) bytes = Word(printables)...
t1len = len(t[1]) if t1len != t.len: raise ParseFatalException(s, l, "invalid data of length %d, expected %s" % (t1len, t.len))
conditional_block
uLispParser.py
""" BNF reference: http://theory.lcs.mit.edu/~rivest/sexp.txt <sexp> :: <string> | <list> <string> :: <display>? <simple-string> ; <simple-string> :: <raw> | <token> | <base-64> | <hexadecimal> | <quoted-string> ; <display> :: "[" <simple-string> "]" ; <raw> :: <decimal> ":" <bytes> ; <deci...
real = Regex(r"[+-]?\d+\.\d*([eE][+-]?\d+)?").setParseAction(lambda tokens: float(tokens[0])) token = Word(alphanums + "-./_:*+=!<>") simpleString = real | base64_ | raw | decimal | token | hexadecimal | qString display = LBRK + simpleString + RBRK string_ = Optional(display) + simpleString uLisp_parse = Forward() ...
random_line_split
test_stringify.py
import unittest from .context import json_stable_stringify_python as stringify class TestStringify(unittest.TestCase): def test_simple_object(self): node = {'c':6, 'b': [4,5], 'a': 3, 'z': None} actual = stringify.stringify(node) expected = '{"a":3,"b":[4,5],"c":6,"z":null}' self.as...
if __name__ == '__main__': unittest.main()
node = [1, ''] actual = stringify.stringify(node) expected = '[1,""]' self.assertEqual(actual, expected)
identifier_body
test_stringify.py
import unittest from .context import json_stable_stringify_python as stringify class TestStringify(unittest.TestCase): def test_simple_object(self): node = {'c':6, 'b': [4,5], 'a': 3, 'z': None} actual = stringify.stringify(node) expected = '{"a":3,"b":[4,5],"c":6,"z":null}' self.as...
unittest.main()
conditional_block
test_stringify.py
import unittest from .context import json_stable_stringify_python as stringify class TestStringify(unittest.TestCase): def test_simple_object(self): node = {'c':6, 'b': [4,5], 'a': 3, 'z': None} actual = stringify.stringify(node) expected = '{"a":3,"b":[4,5],"c":6,"z":null}' self.as...
(self): node = {'a': 3, 'z': ''} actual = stringify.stringify(node) expected = '{"a":3,"z":""}' self.assertEqual(actual, expected) def test_nested_object(self): node = { 'a': { 'b': { 'c': [1,2,3,None] } ...
test_object_with_empty_string
identifier_name
test_stringify.py
import unittest from .context import json_stable_stringify_python as stringify class TestStringify(unittest.TestCase): def test_simple_object(self): node = {'c':6, 'b': [4,5], 'a': 3, 'z': None} actual = stringify.stringify(node) expected = '{"a":3,"b":[4,5],"c":6,"z":null}' self.as...
node = { 'a': { 'b': { 'c': [1,2,3,None] } } } actual = stringify.stringify(node) expected = '{"a":{"b":{"c":[1,2,3,null]}}}' self.assertEqual(actual, expected) def test_array_with_objects(self): ...
def test_nested_object(self):
random_line_split
regions-early-bound-used-in-type-param.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 ...
pub fn main() { let b1 = Box { t: &3i }; assert_eq!(add(b1, b1), 6i); }
{ *g1.get() + *g2.get() }
identifier_body
regions-early-bound-used-in-type-param.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 ...
<T> { t: T } impl<T:Clone> Get<T> for Box<T> { fn get(&self) -> T { self.t.clone() } } fn add<'a,G:Get<&'a int>>(g1: G, g2: G) -> int { *g1.get() + *g2.get() } pub fn main() { let b1 = Box { t: &3i }; assert_eq!(add(b1, b1), 6i); }
Box
identifier_name
regions-early-bound-used-in-type-param.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
layout.py
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be usefu...
(self): return DBCluster( params=self._params, common_tags=self._test_config.common_tags(), test_id=self._test_config.test_id(), ) @cached_property def loader_cluster(self): return LoaderCluster( params=self._params, common_tag...
db_cluster
identifier_name
layout.py
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be usefu...
def monitoring_cluster(self): return MonitoringCluster( params=self._params, common_tags=self._test_config.common_tags(), test_id=self._test_config.test_id(), ) @cached_property def cs_db_cluster(self): if not self._provision_another_scylla_cluste...
) @cached_property
random_line_split
layout.py
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be usefu...
if self.monitoring_cluster: self.monitoring_cluster.provision() if self.loader_cluster: self.loader_cluster.provision() if self.cs_db_cluster: self.cs_db_cluster.provision() @cached_property def db_cluster(self): return DBCluster( ...
self.db_cluster.provision()
conditional_block
layout.py
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be usefu...
) @cached_property def loader_cluster(self): return LoaderCluster( params=self._params, common_tags=self._test_config.common_tags(), test_id=self._test_config.test_id(), ) @cached_property def monitoring_cluster(self): return Monitori...
@cached_property def _test_config(self): return TestConfig() def provision(self): if self.db_cluster: self.db_cluster.provision() if self.monitoring_cluster: self.monitoring_cluster.provision() if self.loader_cluster: self.loader_cluster.provi...
identifier_body
views.py
# Create your views here. import json from django.views.generic import ( ListView, UpdateView, CreateView, ) from django.core.urlresolvers import reverse from contractions.models import Contraction from django.http import HttpResponse from django.http import HttpResponseRedirect class AjaxableResponseMixin(obj...
else: return response class ContractionList(ListView): model = Contraction template_name = 'list_contractions.html' class ContractionListTable(ListView): model = Contraction template_name = 'list_contractions_table.html' class UpdateIntensity(AjaxableResponseMixin,UpdateView): model =...
data = { 'pk': self.object.pk, } return self.render_to_json_response(data)
conditional_block
views.py
# Create your views here. import json from django.views.generic import ( ListView, UpdateView, CreateView, ) from django.core.urlresolvers import reverse from contractions.models import Contraction from django.http import HttpResponse from django.http import HttpResponseRedirect class AjaxableResponseMixin(obj...
(AjaxableResponseMixin,UpdateView): model = Contraction template_name = 'list_contractions.html' def get_success_url(self): return reverse('ContractionList') class UpdateIntensity2(UpdateView): model = Contraction template_name = 'edit_contractions.html' def get_success_url(self): return reverse(...
UpdateIntensity
identifier_name
views.py
# Create your views here. import json from django.views.generic import ( ListView, UpdateView, CreateView, ) from django.core.urlresolvers import reverse from contractions.models import Contraction from django.http import HttpResponse from django.http import HttpResponseRedirect class AjaxableResponseMixin(obj...
class ContractionListTable(ListView): model = Contraction template_name = 'list_contractions_table.html' class UpdateIntensity(AjaxableResponseMixin,UpdateView): model = Contraction template_name = 'list_contractions.html' def get_success_url(self): return reverse('ContractionList') class UpdateInten...
model = Contraction template_name = 'list_contractions.html'
identifier_body
views.py
# Create your views here. import json from django.views.generic import ( ListView, UpdateView, CreateView, ) from django.core.urlresolvers import reverse from contractions.models import Contraction from django.http import HttpResponse from django.http import HttpResponseRedirect class AjaxableResponseMixin(obj...
data = { 'pk': self.object.pk, } return self.render_to_json_response(data) else: return response class ContractionList(ListView): model = Contraction template_name = 'list_contractions.html' class ContractionListTable(ListView): model = Co...
# it might do some processing (in the case of CreateView, it will # call form.save() for example). response = super(AjaxableResponseMixin, self).form_valid(form) if self.request.is_ajax():
random_line_split
classifiedReleaseOrder.model.js
import mongoose, { Schema } from 'mongoose' import auditingSchema from '../../core/base.model' import mongoosePaginate from 'mongoose-paginate' import uniqueValidator from 'mongoose-unique-validator'
const ClassifiedReleaseOrderSchema = new auditingSchema({ publicationId: { type: Schema.ObjectId, ref: 'Publication', required: true, }, releaseOrderNumber: { type: String, required: true, unique: true, }, specialInstructions: { type: String, }, dateOfCreation: { type: Date...
random_line_split
Page.tsx
import React, { useState, useEffect } from "react"; import { Helmet } from "react-helmet"; import { t } from "@lingui/macro"; import { withI18n, withI18nProps } from "@lingui/react"; import helpers from "../util/helpers"; import { getSiteOrigin } from "../routes"; const metadata = {
siteName: t`Who owns what in nyc?`, }; export const FB_APP_ID = "247990609143668"; const TWITTER_HANDLE = "@JustFixNYC"; const ORIGIN_URL = getSiteOrigin(); const SHARE_IMAGE_URL = "https://i.imgur.com/6WL74DZ.png"; type PageProps = { title?: string; children: React.ReactNode; }; const Page = withI18n()((props...
keywords: t`Landlord, Portfolio, Tenant, Displacement, Map, JustFix, NYC, New York, Housing, Who Owns What`, description: t`Use this free tool from JustFix.nyc to research your building and investigate landlords! We use property ownership mapping to identify a landlord's portfolio and provide data to indicate poten...
random_line_split
Page.tsx
import React, { useState, useEffect } from "react"; import { Helmet } from "react-helmet"; import { t } from "@lingui/macro"; import { withI18n, withI18nProps } from "@lingui/react"; import helpers from "../util/helpers"; import { getSiteOrigin } from "../routes"; const metadata = { keywords: t`Landlord, Portfolio, ...
}, []); return ( <> <Helmet script={ gtmId ? [ { src: `https://www.googletagmanager.com/gtag/js?id=${gtmId}`, type: "text/javascript", }, ] : [] } > <title>{f...
{ setGtmId(metaGtmId); }
conditional_block
time_sink.js
/** * Copyright (C) 2013 Alexander Cumming * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is...
* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ /** * Really simple function to add the string [[domain.com]] or * [[whatever.domain.com]] to the end of all HTML <title> elements. */ (function() { if (window && d...
random_line_split
time_sink.js
/** * Copyright (C) 2013 Alexander Cumming * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is...
; })();
{ var hostname = window.location.hostname.replace(/^www./i, ""); if (hostname) { document.title += " [[" + String(hostname) + "]]"; }; }
conditional_block
while-prelude-drop.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 ...
pub fn main() { let mut i = 0; // The auto slot for the result of make(i) should not leak. while make(i) != a { i += 1; } }
{ if i > 10 { return a; } let mut s = String::from_str("hello"); // Ensure s is non-const. s.push_str("there"); return b(s); }
identifier_body
while-prelude-drop.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 ...
(i: int) -> t { if i > 10 { return a; } let mut s = String::from_str("hello"); // Ensure s is non-const. s.push_str("there"); return b(s); } pub fn main() { let mut i = 0; // The auto slot for the result of make(i) should not leak. while make(i) != a { i += 1; } }
make
identifier_name
while-prelude-drop.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 ...
while make(i) != a { i += 1; } }
let mut i = 0; // The auto slot for the result of make(i) should not leak.
random_line_split
while-prelude-drop.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 ...
let mut s = String::from_str("hello"); // Ensure s is non-const. s.push_str("there"); return b(s); } pub fn main() { let mut i = 0; // The auto slot for the result of make(i) should not leak. while make(i) != a { i += 1; } }
{ return a; }
conditional_block
win_reward.py
# This file is part of ArcJail. # # ArcJail 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. # # ArcJail is distributed in the hope that...
for player in self._players: p_player = protected_player_manager[player.index] counter = self._counters[player.index] = p_player.new_counter() if player == winner: counter.hook_hurt = get_hook('SW') else: counter.hook_hurt = hoo...
return info.attacker == winner.index
identifier_body
win_reward.py
# This file is part of ArcJail. # # ArcJail 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. # # ArcJail is distributed in the hope that...
(JailGame): caption = "Win Reward" stage_groups = { 'winreward-start': [ "equip-damage-hooks", "set-start-status", "winreward-entry", ], 'winreward-timed-out': ["winreward-timed-out", ], } def __init__(self, players, **kwargs): super()...
WinReward
identifier_name
win_reward.py
# This file is part of ArcJail. # # ArcJail is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by
# 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 ArcJail. If not, see <http://www.gnu.org/licenses/>. from listeners.tick import Delay from controlled_cvars.handlers import...
# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ArcJail is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of
random_line_split
win_reward.py
# This file is part of ArcJail. # # ArcJail 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. # # ArcJail is distributed in the hope that...
@stage('undo-equip-damage-hooks') def stage_undo_equip_damage_hooks(self): for player in self._players_all: p_player = protected_player_manager[player.index] p_player.delete_counter(self._counters[player.index]) p_player.unset_protected() @stage('winreward-entr...
p_player = protected_player_manager[player.index] counter = self._counters[player.index] = p_player.new_counter() if player == winner: counter.hook_hurt = get_hook('SW') else: counter.hook_hurt = hook_hurt_for_loser p_player.set_protecte...
conditional_block
Main.js
Ext.define('CustomIcons.view.Main', { extend: 'Ext.tab.Panel', xtype: 'main', requires: [ 'Ext.TitleBar', 'Ext.Video' ], config: { tabBarPosition: 'bottom', items: [ { title: 'Welcome', iconCls: 'headphones', ...
{ title: 'Get Started', iconCls: 'facebook2', items: [ { docked: 'top', xtype: 'titlebar', title: 'Getting Started' }, { ...
random_line_split
Cordova.js
define([ "./../AbstractDevice", '../../../util/Class', '../../../util/DomEvent', '../Manager' ], function (AbstractDevice, Class, DomEvent, InputManager) { "use strict"; document.addEventListener('backbutton',function(){ DomEvent.emit('keydown',{ keyCode:27, ...
this.connect[type] = DomEvent.on(document, type, function (evt) { //evtName shouldn't be cached evtName = self.getEventName(type); if (self.evt.hasListeners(evtName)) { return self.evt.emit(evtName, e...
var self = this, channelInfo = this.parseChannelInfo(query), type = channelInfo.eventName, channel = channelInfo.channel, evtName; if (!(type in this.connect) && this.eventNames.indexOf(type) !== -1) {
random_line_split
Cordova.js
define([ "./../AbstractDevice", '../../../util/Class', '../../../util/DomEvent', '../Manager' ], function (AbstractDevice, Class, DomEvent, InputManager) { "use strict"; document.addEventListener('backbutton',function(){ DomEvent.emit('keydown',{ keyCode:27, ...
return self.evt.on(self.getEventName(type, channel), listener); }, /** * @method once * @param {String} type * @param {Function} listener * @return {{id:String,remove:Function}} */ once: function (type,...
{ this.connect[type] = DomEvent.on(document, type, function (evt) { //evtName shouldn't be cached evtName = self.getEventName(type); if (self.evt.hasListeners(evtName)) { return self.evt.emit(evtName,...
conditional_block
test_tmpdir.py
# -*- coding: utf-8 -*- # Copyright (c) 2018 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division) __metaclass__ = type import json import os import shutil import tempfile import p...
"_ansible_remote_tmp": "/path/tmpdir", "_ansible_keep_remote_files": False }, True, "/path/tmpdir/ansible-moduletmp-42-" ), ( { "_ansible_tmpdir": None, "_ansible_remote_tmp": "$HOME/.test", ...
{ "_ansible_tmpdir": None,
random_line_split
test_tmpdir.py
# -*- coding: utf-8 -*- # Copyright (c) 2018 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division) __metaclass__ = type import json import os import shutil import tempfile import p...
{ "_ansible_tmpdir": None, "_ansible_remote_tmp": "/path/tmpdir", "_ansible_keep_remote_files": False }, True, "/path/tmpdir/ansible-moduletmp-42-" ), ( { "_ansible_tmpdir": None, ...
DATA = ( ( { "_ansible_tmpdir": "/path/to/dir", "_ansible_remote_tmp": "/path/tmpdir", "_ansible_keep_remote_files": False, }, True, "/path/to/dir" ), ( { "_ansible_tmpdir"...
identifier_body
test_tmpdir.py
# -*- coding: utf-8 -*- # Copyright (c) 2018 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division) __metaclass__ = type import json import os import shutil import tempfile import p...
(self, monkeypatch, args, expected, stat_exists): makedirs = {'called': False} def mock_mkdtemp(prefix, dir): return os.path.join(dir, prefix) def mock_makedirs(path, mode): makedirs['called'] = True makedirs['path'] = path makedirs['mode'] = mod...
test_tmpdir_property
identifier_name
test_tmpdir.py
# -*- coding: utf-8 -*- # Copyright (c) 2018 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division) __metaclass__ = type import json import os import shutil import tempfile import p...
@pytest.mark.parametrize('stdin', ({"_ansible_tmpdir": None, "_ansible_remote_tmp": "$HOME/.test", "_ansible_keep_remote_files": True},), indirect=['stdin']) def test_tmpdir_makedirs_failure(self, am, ...
assert makedirs['called'] expected = os.path.expanduser(os.path.expandvars(am._remote_tmp)) assert makedirs['path'] == expected assert makedirs['mode'] == 0o700
conditional_block
create.rs
#[macro_use(rotor_compose)] extern crate rotor; extern crate rotor_tools; use std::time::{Duration}; use rotor::{Loop, Config, Scope, Response, Void}; use rotor_tools::timer::{IntervalFunc, interval_func}; use rotor_tools::loop_ext::LoopInstanceExt; #[derive(PartialEq, Eq)] struct Dummy; struct Context; rotor_comp...
<C>(scope: &mut Scope<C>) -> Response<(IntervalFunc<C>, Dummy), Void> { interval_func(scope, Duration::new(1, 0), |_| { println!("Second passed"); }).wrap(|fsm| (fsm, Dummy)) } fn main() { let loop_creator = Loop::new(&Config::new()).unwrap(); let mut loop_inst = loop_creator.instantiate(Co...
create_pair
identifier_name
create.rs
#[macro_use(rotor_compose)] extern crate rotor; extern crate rotor_tools; use std::time::{Duration}; use rotor::{Loop, Config, Scope, Response, Void}; use rotor_tools::timer::{IntervalFunc, interval_func}; use rotor_tools::loop_ext::LoopInstanceExt; #[derive(PartialEq, Eq)] struct Dummy; struct Context; rotor_comp...
interval_func(scope, Duration::new(1, 0), |_| { println!("Second passed"); }).wrap(|fsm| (fsm, Dummy)) } fn main() { let loop_creator = Loop::new(&Config::new()).unwrap(); let mut loop_inst = loop_creator.instantiate(Context); let value: Dummy = loop_inst.add_and_fetch(Fsm::Timer, |scope| {...
fn create_pair<C>(scope: &mut Scope<C>) -> Response<(IntervalFunc<C>, Dummy), Void> {
random_line_split
create.rs
#[macro_use(rotor_compose)] extern crate rotor; extern crate rotor_tools; use std::time::{Duration}; use rotor::{Loop, Config, Scope, Response, Void}; use rotor_tools::timer::{IntervalFunc, interval_func}; use rotor_tools::loop_ext::LoopInstanceExt; #[derive(PartialEq, Eq)] struct Dummy; struct Context; rotor_comp...
{ let loop_creator = Loop::new(&Config::new()).unwrap(); let mut loop_inst = loop_creator.instantiate(Context); let value: Dummy = loop_inst.add_and_fetch(Fsm::Timer, |scope| { create_pair(scope) }).unwrap(); assert!(value == Dummy); loop_inst.run().unwrap(); }
identifier_body
world.js
/* Clashing Coders RPG Platform - The platform used for Creamfinance's first coding contest. Copyright (C) 2016 Florian Proksch This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundati...
for (var i = 0, imax = this.map_definition.height; i < imax; i += 1) { this.map[i] = new Array(this.map_definition.width); for (var j = 0, jmax = this.map_definition.width; j < jmax; j += 1) { this.map[i][j] = new this.map_definition.tileDefinition[i][j](); this.tileset[thi...
{ this.players[i] = new Player(this.player_definition[i]); }
conditional_block
world.js
/* Clashing Coders RPG Platform - The platform used for Creamfinance's first coding contest. Copyright (C) 2016 Florian Proksch This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundati...
};
inv[k] = player.inventory[k]; } return ret;
random_line_split
mod.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/. */ //! Tests for parsing and serialization of values/properties use cssparser::Parser; use media_queries::CSSErrorRe...
($fun:expr,$input:expr, $output:expr) => { let mut parser = Parser::new($input); let parsed = $fun(&mut parser) .expect(&format!("Failed to parse {}", $input)); let serialized = ToCss::to_css_string(&parsed); assert_eq!(serialized, $output); let mut pars...
random_line_split
mod.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/. */ //! Tests for parsing and serialization of values/properties use cssparser::Parser; use media_queries::CSSErrorRe...
// This is a macro so that the file/line information // is preserved in the panic macro_rules! assert_roundtrip_with_context { ($fun:expr, $string:expr) => { assert_roundtrip_with_context!($fun, $string, $string); }; ($fun:expr,$input:expr, $output:expr) => { let url = ::servo_url::ServoUr...
{ let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap(); let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest)); let mut parser = Parser::new(s); f(&context, &mut parser) }
identifier_body
mod.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/. */ //! Tests for parsing and serialization of values/properties use cssparser::Parser; use media_queries::CSSErrorRe...
<T, F: Fn(&ParserContext, &mut Parser) -> Result<T, ()>>(f: F, s: &str) -> Result<T, ()> { let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap(); let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest)); let mut parser = Parser::new(s); f(&context, &mut parser...
parse
identifier_name
node_assert.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {assertEqual, assertNotNull} from './assert'; import {LNode, LNodeFlags} from './interfaces/node'; export fu...
}
return '<unknown>';
random_line_split
node_assert.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {assertEqual, assertNotNull} from './assert'; import {LNode, LNodeFlags} from './interfaces/node'; export fu...
{ if (type == LNodeFlags.Projection) return 'Projection'; if (type == LNodeFlags.Container) return 'Container'; if (type == LNodeFlags.View) return 'View'; if (type == LNodeFlags.Element) return 'Element'; return '<unknown>'; }
identifier_body
node_assert.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {assertEqual, assertNotNull} from './assert'; import {LNode, LNodeFlags} from './interfaces/node'; export fu...
(type: LNodeFlags): string { if (type == LNodeFlags.Projection) return 'Projection'; if (type == LNodeFlags.Container) return 'Container'; if (type == LNodeFlags.View) return 'View'; if (type == LNodeFlags.Element) return 'Element'; return '<unknown>'; }
typeName
identifier_name
views.component.ts
import {Component, ViewEncapsulation} from '@angular/core'; @Component({ selector: 'views', encapsulation: ViewEncapsulation.None, styles: [], template: ` <dialog-error></dialog-error> <dialog-message></dialog-message> <dialog-customer-select></dialog-customer-select> <dialog-document-selec...
<li><i class="socicon socicon-google"></i></li> <li><i class="socicon socicon-github"></i></li>--> </ul> </div> </footer> <ba-back-top position="200"></ba-back-top> ` }) export class Views { username = "Nikske"; constructor() { } ngOnInit() { } }
random_line_split
views.component.ts
import {Component, ViewEncapsulation} from '@angular/core'; @Component({ selector: 'views', encapsulation: ViewEncapsulation.None, styles: [], template: ` <dialog-error></dialog-error> <dialog-message></dialog-message> <dialog-customer-select></dialog-customer-select> <dialog-document-selec...
() { } }
ngOnInit
identifier_name
views.component.ts
import {Component, ViewEncapsulation} from '@angular/core'; @Component({ selector: 'views', encapsulation: ViewEncapsulation.None, styles: [], template: ` <dialog-error></dialog-error> <dialog-message></dialog-message> <dialog-customer-select></dialog-customer-select> <dialog-document-selec...
ngOnInit() { } }
{ }
identifier_body
settings.py
""" Django settings for infoneige 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, ...) ...
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'infoneige.urls' WSGI_APPLICATION = 'infoneige.wsgi.application' # Database # https://docs.djangoproject.com/en/1....
random_line_split
time.js
(function() { "use strict"; const db = require("./db"); const timeComputer = require("./time/timeComputer"); const helper = require("./periods/helper"); const moment = require("moment"); require("moment-duration-format"); function time() { let that = {}; that.getSegments...
that.formatDuration = (duration, options) => { duration = moment.duration(duration); let dotted = !(options && options.undotted); if (dotted) { return duration.format("hh:mm:ss", { trim: false }); } else { ...
that.formatTime = (time) => { return moment(time).format("HH:mm:ss"); };
random_line_split
time.js
(function() { "use strict"; const db = require("./db"); const timeComputer = require("./time/timeComputer"); const helper = require("./periods/helper"); const moment = require("moment"); require("moment-duration-format"); function
() { let that = {}; that.getSegmentsForDay = (project, day) => { let records = db.getRecordsFor(project, day); if (!records.length) { return []; } if ((records[records.length - 1].action !== "stop")) { let date = moment(...
time
identifier_name
time.js
(function() { "use strict"; const db = require("./db"); const timeComputer = require("./time/timeComputer"); const helper = require("./periods/helper"); const moment = require("moment"); require("moment-duration-format"); function time() { let that = {}; that.getSegments...
if ((records[records.length - 1].action !== "stop")) { let date = moment(day).endOf("day"); records.push({ action: "stop", //timestamp: date.valueOf(), timestamp: Date.now(), project: project ...
{ return []; }
conditional_block
time.js
(function() { "use strict"; const db = require("./db"); const timeComputer = require("./time/timeComputer"); const helper = require("./periods/helper"); const moment = require("moment"); require("moment-duration-format"); function time()
return timeComputer.computeWorkingSegmentsFor(records); }; /** * Used to get the worked time for a day once the day is over. * Otherwise, use `getTodayDurationFor`. * * @param {String} project Name of the project to track * @param {String} day D...
{ let that = {}; that.getSegmentsForDay = (project, day) => { let records = db.getRecordsFor(project, day); if (!records.length) { return []; } if ((records[records.length - 1].action !== "stop")) { let date = moment(day...
identifier_body
tweets.js
var boletesPinya = $.merge($.merge($.merge($("#cDB").find("path"), $("#cB4").find("path")), $("#cB3").find("path")), $("#cB2").find("path")); var boletesTronc = $.merge($.merge($("#cB4").find("path"), $("#cB3").find("path")), $("#cB2").find("path")); var usedTweets = {}; $(document).ready(function () { $.each(b...
var content = buildContent(cTweet); if (content !== false) { $(e).tooltipster('content', content); themesAndEvents(e); } }); }, error: function (res) { alert("Error finding tweets"); ...
{ var path = EMOCIO.properties[lastEmotionPlayed].name + ".php"; $.ajax({ type: 'GET', url: path, success: function (data) { var tweets = null; var text, user, hashtag, ttContent, img; tweets = JSON.parse(data); $(boletesPinya).shuffl...
identifier_body
tweets.js
var boletesPinya = $.merge($.merge($.merge($("#cDB").find("path"), $("#cB4").find("path")), $("#cB3").find("path")), $("#cB2").find("path")); var boletesTronc = $.merge($.merge($("#cB4").find("path"), $("#cB3").find("path")), $("#cB2").find("path")); var usedTweets = {}; $(document).ready(function () { $.each(b...
}); }, error: function (res) { alert("Error finding tweets"); } }); } function actualitzarTweets() { var path = EMOCIO.properties[lastEmotionPlayed].name + ".php"; resetTooltips(); $.ajax({ type: 'GET', url: path, success: fu...
{ $(e).tooltipster('content', content); themesAndEvents(e); }
conditional_block
tweets.js
var boletesPinya = $.merge($.merge($.merge($("#cDB").find("path"), $("#cB4").find("path")), $("#cB3").find("path")), $("#cB2").find("path")); var boletesTronc = $.merge($.merge($("#cB4").find("path"), $("#cB3").find("path")), $("#cB2").find("path")); var usedTweets = {}; $(document).ready(function () { $.each(b...
} }); }, error: function (res) { alert("Error finding tweets"); } }); } function buildContent(info) { var tweet = info; if (DictContainsValue(usedTweets, tweet.id_str) || typeof tweet === 'undefined') { usedTweets[tweet.id_str] = use...
if (content !== false) { $(e).tooltipster('content', content); themesAndEvents(e);
random_line_split
tweets.js
var boletesPinya = $.merge($.merge($.merge($("#cDB").find("path"), $("#cB4").find("path")), $("#cB3").find("path")), $("#cB2").find("path")); var boletesTronc = $.merge($.merge($("#cB4").find("path"), $("#cB3").find("path")), $("#cB2").find("path")); var usedTweets = {}; $(document).ready(function () { $.each(b...
() { usedTweets = {}; $.each(boletesPinya, function (i, e) { $(e).tooltipster('destroy'); $(e).off(); $(e).unbind("mouseenter"); $(e).unbind("mouseleave"); }); $.each(boletesPinya, function (i, e) { $(e).tooltipster({ delay: 100, maxWidt...
resetTooltips
identifier_name
game.py
import datetime import math from painttheworld import constants from painttheworld.constants import m1, m2, m3, m4, p1, p2, p3 ''' Note that Latitude is North/South and Longitude is West/East''' class GameState: """Keeps track of which teams have colored which areas of the map. The map is a grid that's repres...
if math.fabs(self.center_coord[1] - lon) < 180: # Case 2 if self.center_coord[1] >= 0: horiz = -horiz elif self.center_coord[1] < 0: # Case 3 horiz = -horiz horiz = math.floor(horiz * 1000 / constants.gridsize) vert = math.floor(vert * 1000 / co...
horiz = -horiz
conditional_block
game.py
import datetime import math from painttheworld import constants from painttheworld.constants import m1, m2, m3, m4, p1, p2, p3 ''' Note that Latitude is North/South and Longitude is West/East''' class GameState: """Keeps track of which teams have colored which areas of the map. The map is a grid that's repres...
raise RuntimeError('Game over.') def inside_grid(self, coord): lowest_coord = (0,0) highest_coord = (constants.radius*2 + 1, constants.radius*2 + 1) lower_bound = np.all(np.greater_equal(coord, lowest_coord)) upper_bound = np.all(np.less_equal(coord, highest_coord)) ...
else: if self.start_time > currtime: raise RuntimeError('Game hasn\'t started.') else:
random_line_split
game.py
datetime import math from painttheworld import constants from painttheworld.constants import m1, m2, m3, m4, p1, p2, p3 ''' Note that Latitude is North/South and Longitude is West/East''' class GameState: """Keeps track of which teams have colored which areas of the map. The map is a grid that's represented ...
(self): """Initialize the starting position of the grid. This calculates the center coordinate by average the longitudes and latitudes of all people (this might not work too well, as that's not really how nautical miles work). Additionally, it sets the start time to be 3 seconds...
start_game
identifier_name
game.py
import datetime import math from painttheworld import constants from painttheworld.constants import m1, m2, m3, m4, p1, p2, p3 ''' Note that Latitude is North/South and Longitude is West/East''' class GameState: """Keeps track of which teams have colored which areas of the map. The map is a grid that's repres...
def update_user(self, id, lon, lat): currtime = datetime.datetime.now() if self.start_time < currtime < self.end_time: gridloc = self.project(lon, lat) out_of_bounds = not self.inside_grid(gridloc) if not out_of_bounds: self.grid[gr...
""" Adds a user and their starting location to the grid. Returns the user id number assosciated with that user, as well as their locations. If there are enough users to begin the game, it initializes the game variables. """ if self.user_count < constants.lobby_size: ...
identifier_body
aggregator_test.py
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
if __name__ == '__main__': unittest.main()
result = aggregator._aggr_weighted_mean((1.0, 1.0), (1, 1)) self.assertAlmostEqual(result, 1.0, places=7) # Simple non-uniform case. result = aggregator._aggr_weighted_mean((1.0, 2.0), (1, 2)) self.assertAlmostEqual(result, 5.0/3.0, places=7) # Make sure it handles integer values as integers. re...
identifier_body