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
GoogleSource.js
/** * Copyright (c) 2008-2011 The Open Planning Project * * Published under the BSD license. * See https://github.com/opengeo/gxp/raw/master/license.txt for the full text * of the license. */ /** * @requires plugins/LayerSource.js */ /** api: (define) * module = gxp.plugins * class = Google...
/** api: constructor * .. class:: GoolgeSource(config) * * Plugin for using Google layers with :class:`gxp.Viewer` instances. The * plugin uses the GMaps v3 API and also takes care of loading the * required Google resources. * * Available layer names for this source are "ROADMAP", "SATELLITE"...
random_line_split
migration.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a ...
(): repository = _find_migrate_repo() try: return versioning_api.db_version(get_engine(), repository) except versioning_exceptions.DatabaseNotControlledError: meta = sqlalchemy.MetaData() engine = get_engine() meta.reflect(bind=engine) tables = meta.tables if ...
db_version
identifier_name
migration.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a ...
assert os.path.exists(path) if _REPOSITORY is None: _REPOSITORY = Repository(path) return _REPOSITORY
def _find_migrate_repo(): """Get the path for the migrate repository.""" global _REPOSITORY path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'migrate_repo')
random_line_split
migration.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a ...
def db_version_control(version=None): repository = _find_migrate_repo() versioning_api.version_control(get_engine(), repository, version) return version def _find_migrate_repo(): """Get the path for the migrate repository.""" global _REPOSITORY path = os.path.join(os.path.abspath(os.path.di...
return INIT_VERSION
identifier_body
migration.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a ...
def db_version(): repository = _find_migrate_repo() try: return versioning_api.db_version(get_engine(), repository) except versioning_exceptions.DatabaseNotControlledError: meta = sqlalchemy.MetaData() engine = get_engine() meta.reflect(bind=engine) tables = meta.t...
return versioning_api.downgrade(get_engine(), repository, version)
conditional_block
S11.8.3_A3.2_T1.2.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: > Operator x <= y returns ToString(x) <= ToString(y), if Type(Primitive(x)) is String and Type(Primitive(y)) is String es5id: 11.8.3_A3.2_T1.2 description: > Type(...
//CHECK#2 if ((function(){return 1} <= {}) !== (function(){return 1}.toString() <= {}.toString())) { $ERROR('#2: (function(){return 1} <= {}) === (function(){return 1}.toString() <= {}.toString())'); } //CHECK#3 if ((function(){return 1} <= function(){return 1}) !== (function(){return 1}.toString() <= function(){r...
{ $ERROR('#1: ({} <= function(){return 1}) === ({}.toString() <= function(){return 1}.toString())'); }
conditional_block
S11.8.3_A3.2_T1.2.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: > Operator x <= y returns ToString(x) <= ToString(y), if Type(Primitive(x)) is String and Type(Primitive(y)) is String es5id: 11.8.3_A3.2_T1.2 description: > Type(...
$ERROR('#1: ({} <= function(){return 1}) === ({}.toString() <= function(){return 1}.toString())'); } //CHECK#2 if ((function(){return 1} <= {}) !== (function(){return 1}.toString() <= {}.toString())) { $ERROR('#2: (function(){return 1} <= {}) === (function(){return 1}.toString() <= {}.toString())'); } //CHECK#3 i...
//CHECK#1 if (({} <= function(){return 1}) !== ({}.toString() <= function(){return 1}.toString())) {
random_line_split
SZGooglePlusComments.js
// Definizione variabile principale per contenere // le funzioni che verranno richiamate da popup var SZGoogleDialog = { local_ed:'ed', // Funzione init per le operazioni iniziali del // componente da eseguire in questo stesso file init: function(ed) { SZGoogleDialog.local_ed = ed; tinyMCEPopup.resizeToInne...
if (url != '') output += 'url="' + url + '" '; if (width != '') output += 'width="' + width + '" '; if (align != '') output += 'align="' + align + '" '; output += '/]'; // Una volta eseguita la composizione del comando shotcode // richiamo i metodi di tinyMCE per inserimento in editor tinyMC...
// Composizione shortcode selezionato con elenco // delle opzioni disponibili e valore associato output = '[sz-gplus-comments ';
random_line_split
dbFunctions.ts
/* Copyright 2021 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
export const insertUserRecord = ( req: Request, looker_id: string, external_id: string, email: string ) => { const adapter = new FileSync<Schema>(process.env.PATH_TO_DB!); const dbUser = low(adapter) .get("users") .push({ looker_id: looker_id, external_id: external_id, email: email...
import { Users, Schema, ScimUser, ScimErrorSchema } from "../types"; import { Request, Response } from "express-serve-static-core/index"; import Logger from "./logger"; // insert user record into scim db
random_line_split
log_reader.py
import time import asyncio from aiokafka import AIOKafkaProducer from settings import KAFKA_SERVERS, SAVEPOINT, LOG_FILE, KAFKA_TOPIC class LogStreamer: def __init__(self, KAFKA_SERVERS, KAFKA_TOPIC, loop, savepoint_file, log_fi...
skip_first_empty = False time.sleep(0.1) current_position = self.log_file.tell() if last != current_position: self.savepoint_file.seek(0) self.savepoint_file.write(str(current_position)) continue ...
return
random_line_split
log_reader.py
import time import asyncio from aiokafka import AIOKafkaProducer from settings import KAFKA_SERVERS, SAVEPOINT, LOG_FILE, KAFKA_TOPIC class LogStreamer: def
(self, KAFKA_SERVERS, KAFKA_TOPIC, loop, savepoint_file, log_file): self.KAFKA_TOPIC = KAFKA_TOPIC self.loop = loop self.producer = AIOKafkaProducer(loop=self.loop, bootstrap_servers=KAFKA_SERVERS) self....
__init__
identifier_name
log_reader.py
import time import asyncio from aiokafka import AIOKafkaProducer from settings import KAFKA_SERVERS, SAVEPOINT, LOG_FILE, KAFKA_TOPIC class LogStreamer: def __init__(self, KAFKA_SERVERS, KAFKA_TOPIC, loop, savepoint_file, log_fi...
async def produce(self, finite=False): last = self.savepoint_file.read() if last: self.log_file.seek(int(last)) skip_first_empty = True while True: line = self.log_file.readline() line = line.strip(' \t\n\r') if not line: ...
self.KAFKA_TOPIC = KAFKA_TOPIC self.loop = loop self.producer = AIOKafkaProducer(loop=self.loop, bootstrap_servers=KAFKA_SERVERS) self.savepoint_file = savepoint_file self.log_file = log_file
identifier_body
log_reader.py
import time import asyncio from aiokafka import AIOKafkaProducer from settings import KAFKA_SERVERS, SAVEPOINT, LOG_FILE, KAFKA_TOPIC class LogStreamer: def __init__(self, KAFKA_SERVERS, KAFKA_TOPIC, loop, savepoint_file, log_fi...
skip_first_empty = True while True: line = self.log_file.readline() line = line.strip(' \t\n\r') if not line: if finite and not skip_first_empty: return skip_first_empty = False time.sleep(0.1) ...
self.log_file.seek(int(last))
conditional_block
FunctionReturnType.py
from typing import Optional, List def a(x): # type: (List[int]) -> List[str] return <warning descr="Expected type 'List[str]', got 'List[List[int]]' instead">[x]</warning> def b(x): # type: (int) -> List[str] return <warning descr="Expected type 'List[str]', got 'List[int]' instead">[1,2]</warning> d...
(x): # type: (Any) -> int if x: return <warning descr="Expected type 'int', got 'str' instead">'abc'</warning> else: return <warning descr="Expected type 'int', got 'dict' instead">{}</warning>
g
identifier_name
FunctionReturnType.py
from typing import Optional, List def a(x): # type: (List[int]) -> List[str] return <warning descr="Expected type 'List[str]', got 'List[List[int]]' instead">[x]</warning> def b(x): # type: (int) -> List[str] return <warning descr="Expected type 'List[str]', got 'List[int]' instead">[1,2]</warning> d...
return 'abc' else: return def g(x): # type: (Any) -> int if x: return <warning descr="Expected type 'int', got 'str' instead">'abc'</warning> else: return <warning descr="Expected type 'int', got 'dict' instead">{}</warning>
if x > 0: return <warning descr="Expected type 'Optional[str]', got 'int' instead">42</warning> elif x == 0:
random_line_split
FunctionReturnType.py
from typing import Optional, List def a(x): # type: (List[int]) -> List[str] return <warning descr="Expected type 'List[str]', got 'List[List[int]]' instead">[x]</warning> def b(x): # type: (int) -> List[str] return <warning descr="Expected type 'List[str]', got 'List[int]' instead">[1,2]</warning> d...
conditional_block
FunctionReturnType.py
from typing import Optional, List def a(x): # type: (List[int]) -> List[str] return <warning descr="Expected type 'List[str]', got 'List[List[int]]' instead">[x]</warning> def b(x): # type: (int) -> List[str] return <warning descr="Expected type 'List[str]', got 'List[int]' instead">[1,2]</warning> d...
if x: return <warning descr="Expected type 'int', got 'str' instead">'abc'</warning> else: return <warning descr="Expected type 'int', got 'dict' instead">{}</warning>
identifier_body
format.service.ts
import { Regex, RegexType } from 'ws-regex'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { FormatTime } from 'ws-format-time'; import { ServerService } from './../server/server.service'; import { IdentityService } from './../identity/identity.service'; import { Logger } ...
public readonly ImageConnect = (path: string): string => { if (!path) { return ""; } if (!path.startsWith("/")) { return path; } return this.ImageSrcRoot + path; } public readonly ImageTickParse = (str: string, coll: ISticker[], size: number = null): string => { if (!coll ...
{ super(); this.logger = this.logsrv.GetLogger('FormatService').SetModule('service'); }
identifier_body
format.service.ts
import { Regex, RegexType } from 'ws-regex'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { FormatTime } from 'ws-format-time'; import { ServerService } from './../server/server.service'; import { IdentityService } from './../identity/identity.service'; import { Logger } ...
const reg = Regex.Create(/\[#\(.+?\)\]/, RegexType.IgnoreCase); str = this.goRegex(reg, str, coll, size); return str; } private goRegex = (reg: Regex, str: string, ticks: ISticker[], size: number): string => { const coll = reg.Matches(str); if (coll[0] && coll[0] !== ''...
{ return str; }
conditional_block
format.service.ts
import { Regex, RegexType } from 'ws-regex'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { FormatTime } from 'ws-format-time'; import { ServerService } from './../server/server.service'; import { IdentityService } from './../identity/identity.service'; import { Logger } ...
const coll = reg.Matches(str); if (coll[0] && coll[0] !== '') { const target = ticks.find(i => `[${i.key}]` === coll[0]); if (target) { str = str.replace(coll[0], `</span><img class="tassel-sticker" ${size ? 'width="' + size + '"' : ''}src="${this.ImageSrcRoot}${t...
str = this.goRegex(reg, str, coll, size); return str; } private goRegex = (reg: Regex, str: string, ticks: ISticker[], size: number): string => {
random_line_split
format.service.ts
import { Regex, RegexType } from 'ws-regex'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { FormatTime } from 'ws-format-time'; import { ServerService } from './../server/server.service'; import { IdentityService } from './../identity/identity.service'; import { Logger } ...
() { return this.server.ServerStaticRoot; } constructor( private identity: IdentityService, private server: ServerService) { super(); this.logger = this.logsrv.GetLogger('FormatService').SetModule('service'); } public readonly ImageConnect = (path: string): string => { ...
ImageSrcRoot
identifier_name
generate_bnmf.py
""" Generate a toy dataset for the matrix factorisation case, and store it. We use dimensions 100 by 50 for the dataset, and 10 latent factors. As the prior for U and V we take value 1 for all entries (so exp 1). As a result, each value in R has a value of around 20, and a variance of 100-120. For contrast, the San...
from BNMTF.code.models.distributions.exponential import exponential_draw from BNMTF.code.models.distributions.normal import normal_draw from BNMTF.code.cross_validation.mask import generate_M import numpy, itertools, matplotlib.pyplot as plt def generate_dataset(I,J,K,lambdaU,lambdaV,tau): # Generate U, V U =...
random_line_split
generate_bnmf.py
""" Generate a toy dataset for the matrix factorisation case, and store it. We use dimensions 100 by 50 for the dataset, and 10 latent factors. As the prior for U and V we take value 1 for all entries (so exp 1). As a result, each value in R has a value of around 20, and a variance of 100-120. For contrast, the San...
(I,J,fraction_unknown,attempts): for attempt in range(1,attempts+1): try: M = generate_M(I,J,fraction_unknown) sums_columns = M.sum(axis=0) sums_rows = M.sum(axis=1) for i,c in enumerate(sums_rows): assert c != 0, "Fully unobserved row in M, ro...
try_generate_M
identifier_name
generate_bnmf.py
""" Generate a toy dataset for the matrix factorisation case, and store it. We use dimensions 100 by 50 for the dataset, and 10 latent factors. As the prior for U and V we take value 1 for all entries (so exp 1). As a result, each value in R has a value of around 20, and a variance of 100-120. For contrast, the San...
output_folder = project_location+"BNMTF/data_toy/bnmf/" I,J,K = 100, 80, 10 #20, 10, 5 # fraction_unknown = 0.1 alpha, beta = 1., 1. lambdaU = numpy.ones((I,K)) lambdaV = numpy.ones((I,K)) tau = alpha / beta (U,V,tau,true_R,R) = generate_dataset(I,J,K,lambdaU,lambdaV,tau) # Tr...
conditional_block
generate_bnmf.py
""" Generate a toy dataset for the matrix factorisation case, and store it. We use dimensions 100 by 50 for the dataset, and 10 latent factors. As the prior for U and V we take value 1 for all entries (so exp 1). As a result, each value in R has a value of around 20, and a variance of 100-120. For contrast, the San...
########## if __name__ == "__main__": output_folder = project_location+"BNMTF/data_toy/bnmf/" I,J,K = 100, 80, 10 #20, 10, 5 # fraction_unknown = 0.1 alpha, beta = 1., 1. lambdaU = numpy.ones((I,K)) lambdaV = numpy.ones((I,K)) tau = alpha / beta (U,V,tau,true_R,R) = genera...
for attempt in range(1,attempts+1): try: M = generate_M(I,J,fraction_unknown) sums_columns = M.sum(axis=0) sums_rows = M.sum(axis=1) for i,c in enumerate(sums_rows): assert c != 0, "Fully unobserved row in M, row %s. Fraction %s." % (i,fraction_unk...
identifier_body
MovieCollection.js
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import MonitorToggleButton from 'Components/MonitorToggleButton'; import EditImportListModalConnector from 'Settings/ImportLists/ImportLists/EditImportListModalConnector'; import styles from './MovieCollection.css'; class MovieCollection ext...
} onEditImportListModalClose = () => { this.setState({ isEditImportListModalOpen: false }); } render() { const { name, collectionList, isSaving } = this.props; const monitored = collectionList !== undefined && collectionList.enabled && collectionList.enableAuto; const i...
{ this.props.onMonitorTogglePress(monitored); this.setState({ isEditImportListModalOpen: true }); }
conditional_block
MovieCollection.js
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import MonitorToggleButton from 'Components/MonitorToggleButton'; import EditImportListModalConnector from 'Settings/ImportLists/ImportLists/EditImportListModalConnector'; import styles from './MovieCollection.css'; class MovieCollection ext...
() { const { name, collectionList, isSaving } = this.props; const monitored = collectionList !== undefined && collectionList.enabled && collectionList.enableAuto; const importListId = collectionList ? collectionList.id : 0; return ( <div> <MonitorToggleButton ...
render
identifier_name
MovieCollection.js
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import MonitorToggleButton from 'Components/MonitorToggleButton'; import EditImportListModalConnector from 'Settings/ImportLists/ImportLists/EditImportListModalConnector'; import styles from './MovieCollection.css'; class MovieCollection ext...
<EditImportListModalConnector id={importListId} isOpen={this.state.isEditImportListModalOpen} onModalClose={this.onEditImportListModalClose} onDeleteImportListPress={this.onDeleteImportListPress} /> </div> ); } } MovieCollection.propTypes = { tmdbId...
onPress={this.onAddImportListPress} /> {name}
random_line_split
MovieCollection.js
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import MonitorToggleButton from 'Components/MonitorToggleButton'; import EditImportListModalConnector from 'Settings/ImportLists/ImportLists/EditImportListModalConnector'; import styles from './MovieCollection.css'; class MovieCollection ext...
} MovieCollection.propTypes = { tmdbId: PropTypes.number.isRequired, name: PropTypes.string.isRequired, collectionList: PropTypes.object, isSaving: PropTypes.bool.isRequired, onMonitorTogglePress: PropTypes.func.isRequired }; export default MovieCollection;
{ const { name, collectionList, isSaving } = this.props; const monitored = collectionList !== undefined && collectionList.enabled && collectionList.enableAuto; const importListId = collectionList ? collectionList.id : 0; return ( <div> <MonitorToggleButton ...
identifier_body
upload.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; import { Http, Headers } from '@angular/http'; import { FirebaseApp } from 'angularfire2'; // for methods...
(newJersey:UniformStyle,index,key) { debugger let storageRef = firebase.storage().ref(); let ref = storageRef.child(`${this.basePath}/${newJersey.name}`) var dbRef = this.db.object(`${this.basePath}/${newJersey.name}/`); if(index>=0) { let uploadTask1 = storageRef.child(`${'/jersey-sty...
apiHit
identifier_name
upload.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; import { Http, Headers } from '@angular/http'; import { FirebaseApp } from 'angularfire2'; // for methods...
}
{ let storageRef = firebase.storage().ref(); storageRef.child(`${this.basePath}/${name}`).delete() }
identifier_body
upload.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; import { Http, Headers } from '@angular/http'; import { FirebaseApp } from 'angularfire2'; // for methods...
}); } apiHit(newJersey:UniformStyle,index,key) { debugger let storageRef = firebase.storage().ref(); let ref = storageRef.child(`${this.basePath}/${newJersey.name}`) var dbRef = this.db.object(`${this.basePath}/${newJersey.name}/`); if(index>=0) { let uploadTask1 = storageRef...
{ console.log("About to upload") console.log(newJersey[key]); for (var index = 0; index < newJersey.files.length; index++) { //var index=newJersey.files.length; self.apiHit(newJersey,index,key) } }
conditional_block
upload.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; import { Http, Headers } from '@angular/http'; import { FirebaseApp } from 'angularfire2'; // for methods...
} apiHit(newJersey:UniformStyle,index,key) { debugger let storageRef = firebase.storage().ref(); let ref = storageRef.child(`${this.basePath}/${newJersey.name}`) var dbRef = this.db.object(`${this.basePath}/${newJersey.name}/`); if(index>=0) { let uploadTask1 = storageRef.child(`$...
//var index=newJersey.files.length; self.apiHit(newJersey,index,key) } } });
random_line_split
move-side-effects-to-legacy.ts
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import { parse, print, types } from 'recast'; import fs, { stat } from 'fs'; import path from 'path'; import { promisify } from 'util'; import { Identifie...
} return b.emptyStatement(); } // Keep going to the left of namespaces to check the leftmost, // and if it is the target namespace, pull it. let current = statement.expression.left.object; while (current.object) { cur...
if (statement.expression.right.type === 'LogicalExpression') { targetNamespace = statement.expression.right.left.property.name;
random_line_split
move-side-effects-to-legacy.ts
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import { parse, print, types } from 'recast'; import fs, { stat } from 'fs'; import path from 'path'; import { promisify } from 'util'; import { Identifie...
function createLegacy() { const ast = parse(''); ast.program.body = legacyStatements.concat(legacyTypeDefs); return print(ast).code; } function capitalizeFirstLetter(string: string) { return string.charAt(0).toUpperCase() + string.slice(1); } async function main(folder: string) { const pathName = path.joi...
{ const ast = parse(source); const statements: any[] = []; const typeDefs: any[] = []; ast.program.body = ast.program.body.map((statement: any) => { try { switch (statement.type) { case 'ExpressionStatement': if (statement.expression.type === 'CallExpression') { break; ...
identifier_body
move-side-effects-to-legacy.ts
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import { parse, print, types } from 'recast'; import fs, { stat } from 'fs'; import path from 'path'; import { promisify } from 'util'; import { Identifie...
} if (statement.expression.left.type === 'MemberExpression') { // Remove self.Foo = self.Foo || {} if (statement.expression.left.object.name === 'self') { // Grab the namespace from the RHS of self.[Namespace] if (statement.expression.right.type ...
{ typeDefs.push(statement); return b.emptyStatement(); }
conditional_block
move-side-effects-to-legacy.ts
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import { parse, print, types } from 'recast'; import fs, { stat } from 'fs'; import path from 'path'; import { promisify } from 'util'; import { Identifie...
(source: string, fileName: string) { const ast = parse(source); const statements: any[] = []; const typeDefs: any[] = []; ast.program.body = ast.program.body.map((statement: any) => { try { switch (statement.type) { case 'ExpressionStatement': if (statement.expression.type === 'Call...
rewriteSource
identifier_name
urls.py
from django.urls import url, include, path from rest_framework import routers from users import views # router = routers.DefaultRouter() # router.register(r'users', views.UserViewSet) # router.register(r'groups', views.GroupViewSet) # # # Wire up our API using automatic URL routing. # # Additionally, we include login ...
url( regex=r'^~update/$', view=views.UserUpdateView.as_view(), name='update' ), ]
url( regex=r'^(?P<username>[\w.@+-]+)/$', view=views.UserDetailView.as_view(), name='detail' ),
random_line_split
jquery.ui.dialog.minmax.js
/* * jQuery UI Dialog 1.8.16 * w/ Minimize & Maximize Support * by Elijah Horton (fieryprophet@yahoo.com) * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Dialog * * Depends: * jquer...
ui) { return { position: ui.position, offset: ui.offset }; } self.uiDialog.draggable({ cancel: '.ui-dialog-content, .ui-dialog-titlebar-close', handle: '.ui-dialog-titlebar', containment: 'document', start: function(event, ui) { heightBeforeDrag = options.height === "auto" ? "auto" : ...
ilteredUi(
identifier_name
jquery.ui.dialog.minmax.js
/* * jQuery UI Dialog 1.8.16 * w/ Minimize & Maximize Support * by Elijah Horton (fieryprophet@yahoo.com) * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Dialog * * Depends: * jquer...
self.uiDialog.resizable({ cancel: '.ui-dialog-content', containment: 'document', alsoResize: self.element, maxWidth: options.maxWidth, maxHeight: options.maxHeight, minWidth: options.minWidth, minHeight: self._minHeight(), handles: resizeHandles, start: function(event, ui) { $(this).add...
return { originalPosition: ui.originalPosition, originalSize: ui.originalSize, position: ui.position, size: ui.size }; }
identifier_body
jquery.ui.dialog.minmax.js
/* * jQuery UI Dialog 1.8.16 * w/ Minimize & Maximize Support * by Elijah Horton (fieryprophet@yahoo.com) * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Dialog * * Depends: * jquer...
$el.remove(); // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) var maxZ = 0; $.each(this.instances, function() { maxZ = Math.max(maxZ, this.css('z-index')); }); this.maxZ = maxZ; }, height: function() { return $(document).height() + 'px'; }, width: function() { ...
$([document, window]).unbind('.dialog-overlay'); }
conditional_block
jquery.ui.dialog.minmax.js
/* * jQuery UI Dialog 1.8.16 * w/ Minimize & Maximize Support * by Elijah Horton (fieryprophet@yahoo.com) * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Dialog * * Depends: * jquer...
$(this).css('top', pos.top - topOffset); } } }, resizable: true, show: null, stack: true, title: '', width: 300, zIndex: 1000 }, _create: function() { this.originalTitle = this.element.attr('title'); // #5742 - .attr() might return a DOMElement if ( typeof this.originalTitle !== "stri...
random_line_split
align_of.rs
#![feature(core)] extern crate core; #[cfg(test)] mod tests { use core::mem::align_of; // pub fn align_of<T>() -> usize { // unsafe { intrinsics::min_align_of::<T>() } // } macro_rules! align_of_test { ($T:ty, $size:expr) => ({ let size: usize = align_of::<$T>(); assert_eq!(size, ...
() { struct A; align_of_test!( A, 1 ); } #[test] fn align_of_test2() { align_of_test!( u8, 1 ); align_of_test!( u16, 2 ); align_of_test!( u32, 4 ); align_of_test!( u64, 8 ); align_of_test!( i8, 1 ); align_of_test!( i16, 2 ); align_of_test!( i32, 4 ); align_of_test!( i64, 8 ); align_of_test!( f...
align_of_test1
identifier_name
align_of.rs
#![feature(core)] extern crate core; #[cfg(test)] mod tests { use core::mem::align_of; // pub fn align_of<T>() -> usize { // unsafe { intrinsics::min_align_of::<T>() } // }
let size: usize = align_of::<$T>(); assert_eq!(size, $size); }) } #[test] fn align_of_test1() { struct A; align_of_test!( A, 1 ); } #[test] fn align_of_test2() { align_of_test!( u8, 1 ); align_of_test!( u16, 2 ); align_of_test!( u32, 4 ); align_of_test!( u64, 8 ); align_of_...
macro_rules! align_of_test { ($T:ty, $size:expr) => ({
random_line_split
align_of.rs
#![feature(core)] extern crate core; #[cfg(test)] mod tests { use core::mem::align_of; // pub fn align_of<T>() -> usize { // unsafe { intrinsics::min_align_of::<T>() } // } macro_rules! align_of_test { ($T:ty, $size:expr) => ({ let size: usize = align_of::<$T>(); assert_eq!(size, ...
#[test] fn align_of_test2() { align_of_test!( u8, 1 ); align_of_test!( u16, 2 ); align_of_test!( u32, 4 ); align_of_test!( u64, 8 ); align_of_test!( i8, 1 ); align_of_test!( i16, 2 ); align_of_test!( i32, 4 ); align_of_test!( i64, 8 ); align_of_test!( f32, 4 ); align_of_test!( f64, 8 ); align_of_...
{ struct A; align_of_test!( A, 1 ); }
identifier_body
color.ts
import Vue from 'vue'; import Component from 'vue-class-component'; import { Prop } from 'vue-property-decorator'; import WithRender from './color.html?style=./color.scss'; import { CompleterResult } from 'readline'; @WithRender @Component export class MColor extends Vue { @Prop() public hex: string; @Prop...
(): string[] { let shorthandRegex: any = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; let hex: string = this.hex.replace(shorthandRegex, (m, r, g, b) => { return r + r + g + g + b + b; }); return /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); } private get red(): numb...
hexArray
identifier_name
color.ts
import Vue from 'vue'; import Component from 'vue-class-component'; import { Prop } from 'vue-property-decorator'; import WithRender from './color.html?style=./color.scss'; import { CompleterResult } from 'readline'; @WithRender @Component export class MColor extends Vue { @Prop() public hex: string; @Prop...
return parseInt(this.hexArray[2], 16); } private get blue(): number { return parseInt(this.hexArray[3], 16); } private get rgb(): string { return this.hexArray ? this.red + ', ' + this.green + ', ' + this.blue : undefined; } private get textColor(): string { le...
private get green(): number {
random_line_split
color.ts
import Vue from 'vue'; import Component from 'vue-class-component'; import { Prop } from 'vue-property-decorator'; import WithRender from './color.html?style=./color.scss'; import { CompleterResult } from 'readline'; @WithRender @Component export class MColor extends Vue { @Prop() public hex: string; @Prop...
private get green(): number { return parseInt(this.hexArray[2], 16); } private get blue(): number { return parseInt(this.hexArray[3], 16); } private get rgb(): string { return this.hexArray ? this.red + ', ' + this.green + ', ' + this.blue : undefined; } private ...
{ return parseInt(this.hexArray[1], 16); }
identifier_body
ContentStylePositionTest.ts
import { Assertions, Pipeline, Step } from '@ephox/agar'; import { Arr } from '@ephox/katamari'; import { TinyLoader } from '@ephox/mcagar'; import { Element, Node } from '@ephox/sugar'; import Theme from 'tinymce/themes/silver/Theme'; import { UnitTest } from '@ephox/bedrock'; UnitTest.asynctest('browser.tinymce.core...
}) ], onSuccess, onFailure); }, { content_style: contentStyle, base_url: '/project/tinymce/js/tinymce' }, success, failure); });
}).getOrDie('could not find content style tag'); Assertions.assertEq('style tag should be after link tag', linkIndex < styleIndex, true);
random_line_split
persistentid.py
# -*- coding: utf-8 -*- # # This file is part of Zenodo. # Copyright (C) 2016 CERN. # # Zenodo 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 2 of the # License, or (at your option) any later v...
"""Special DOI field.""" default_error_messages = { 'invalid_scheme': _('Not a valid {scheme} identifier.'), 'invalid_pid': _('Not a valid persistent identifier.'), } def __init__(self, scheme=None, normalize=True, *args, **kwargs): """Initialize field.""" super(PersistentI...
identifier_body
persistentid.py
# -*- coding: utf-8 -*- # # This file is part of Zenodo. # Copyright (C) 2016 CERN. # # Zenodo 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 2 of the # License, or (at your option) any later v...
import idutils from flask_babelex import lazy_gettext as _ from marshmallow import missing from .sanitizedunicode import SanitizedUnicode class PersistentId(SanitizedUnicode): """Special DOI field.""" default_error_messages = { 'invalid_scheme': _('Not a valid {scheme} identifier.'), 'invali...
random_line_split
persistentid.py
# -*- coding: utf-8 -*- # # This file is part of Zenodo. # Copyright (C) 2016 CERN. # # Zenodo 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 2 of the # License, or (at your option) any later v...
(self, value, attr, obj): """Serialize persistent identifier value.""" if not value: return missing return value def _deserialize(self, value, attr, data): """Deserialize persistent identifier value.""" value = super(PersistentId, self)._deserialize(value, attr, ...
_serialize
identifier_name
persistentid.py
# -*- coding: utf-8 -*- # # This file is part of Zenodo. # Copyright (C) 2016 CERN. # # Zenodo 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 2 of the # License, or (at your option) any later v...
return idutils.normalize_pid(value, schemes[0]) \ if self.normalize else value
self.fail('invalid_pid')
conditional_block
popstateevent.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 https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindi...
(window: &Window) -> DomRoot<PopStateEvent> { reflect_dom_object(Box::new(PopStateEvent::new_inherited()), window) } pub fn new( window: &Window, type_: Atom, bubbles: bool, cancelable: bool, state: HandleValue, ) -> DomRoot<PopStateEvent> { let ev = ...
new_uninitialized
identifier_name
popstateevent.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 https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindi...
// https://html.spec.whatwg.org/multipage/#the-popstateevent-interface #[dom_struct] pub struct PopStateEvent { event: Event, #[ignore_malloc_size_of = "Defined in rust-mozjs"] state: Heap<JSVal>, } impl PopStateEvent { fn new_inherited() -> PopStateEvent { PopStateEvent { event: E...
use js::rust::HandleValue; use servo_atoms::Atom;
random_line_split
popstateevent.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 https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindi...
pub fn new_uninitialized(window: &Window) -> DomRoot<PopStateEvent> { reflect_dom_object(Box::new(PopStateEvent::new_inherited()), window) } pub fn new( window: &Window, type_: Atom, bubbles: bool, cancelable: bool, state: HandleValue, ) -> DomRoot<PopS...
{ PopStateEvent { event: Event::new_inherited(), state: Heap::default(), } }
identifier_body
mining.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mining RPCs - getmininginfo - getblocktemplate proposal mode - submitblock""" import copy from b...
if __name__ == '__main__': MiningTest().main()
def set_test_params(self): self.num_nodes = 2 self.setup_clean_chain = False def run_test(self): node = self.nodes[0] self.log.info('getmininginfo') mining_info = node.getmininginfo() assert_equal(mining_info['blocks'], 200) assert_equal(mining_info['chain']...
identifier_body
mining.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mining RPCs - getmininginfo - getblocktemplate proposal mode - submitblock""" import copy from b...
(IoPTestFramework): def set_test_params(self): self.num_nodes = 2 self.setup_clean_chain = False def run_test(self): node = self.nodes[0] self.log.info('getmininginfo') mining_info = node.getmininginfo() assert_equal(mining_info['blocks'], 200) assert_eq...
MiningTest
identifier_name
mining.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mining RPCs - getmininginfo - getblocktemplate proposal mode - submitblock""" import copy from b...
mining_info = node.getmininginfo() assert_equal(mining_info['blocks'], 200) assert_equal(mining_info['chain'], 'regtest') assert_equal(mining_info['currentblocktx'], 0) assert_equal(mining_info['currentblockweight'], 0) assert_equal(mining_info['difficulty'], Decimal('4.6...
self.log.info('getmininginfo')
random_line_split
mining.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mining RPCs - getmininginfo - getblocktemplate proposal mode - submitblock""" import copy from b...
MiningTest().main()
conditional_block
config.py
# -*- coding: utf-8 -*- ''' .. module:: genomics.config :synopsis: library configuration :noindex: :copyright: Copyright 2014 by Tiago Antao :license: GNU Affero, see LICENSE for details .. moduleauthor:: Tiago Antao <tra@popgen.net> ''' import os import configparser as cp config_file = os.path.expandus...
except cp.NoSectionError: self.mr_dir = '/tmp' self.grid = 'Local' self.grid_limit = 1.0
self.grid_limit = int(self.grid_limit)
conditional_block
config.py
# -*- coding: utf-8 -*- ''' .. module:: genomics.config :synopsis: library configuration :noindex: :copyright: Copyright 2014 by Tiago Antao :license: GNU Affero, see LICENSE for details .. moduleauthor:: Tiago Antao <tra@popgen.net> ''' import os import configparser as cp config_file = os.path.expandus...
(self, config_file=config_file): self.config_file = config_file def load_config(self): config = cp.ConfigParser() config.read(self.config_file) try: self.mr_dir = config.get('main', 'mr_dir') self.grid = config.get('main', 'grid') if self.grid == ...
__init__
identifier_name
config.py
# -*- coding: utf-8 -*- ''' .. module:: genomics.config :synopsis: library configuration :noindex: :copyright: Copyright 2014 by Tiago Antao :license: GNU Affero, see LICENSE for details .. moduleauthor:: Tiago Antao <tra@popgen.net> ''' import os import configparser as cp config_file = os.path.expandus...
def load_config(self): config = cp.ConfigParser() config.read(self.config_file) try: self.mr_dir = config.get('main', 'mr_dir') self.grid = config.get('main', 'grid') if self.grid == 'Local': self.grid_limit = config.get('grid.local', 'li...
self.config_file = config_file
identifier_body
config.py
# -*- coding: utf-8 -*- ''' .. module:: genomics.config :synopsis: library configuration :noindex: :copyright: Copyright 2014 by Tiago Antao :license: GNU Affero, see LICENSE for details .. moduleauthor:: Tiago Antao <tra@popgen.net> ''' import os import configparser as cp config_file = os.path.expandus...
Configuration parameters are separated by section **Section main** * **mr_dir** Directory where temporary map_reduce communication is stored * **grid** Grid type (Local) **Section grid.local** The parameters for grid type Local. Currently limit (see :py:class:`genomics.parallel.execut...
:param config_file: The config file to use The default config file is defined above and can be changed before doing import genomics
random_line_split
dy.js
// This is the base browser library for dy.js. It is all that is needed in the // browser for modules written for dy.js to work. // // In development you'd probably also want to include the dy/ext/reload // extension to add dynamic reloading functionality. However, in production // this is the *only* code you need (pl...
} } if (window) { window.dy = dy; } })(window);
{ dy.modules[name]._load() }
conditional_block
dy.js
// This is the base browser library for dy.js. It is all that is needed in the // browser for modules written for dy.js to work. // // In development you'd probably also want to include the dy/ext/reload // extension to add dynamic reloading functionality. However, in production // this is the *only* code you need (plu...
initializer.apply(self, dependencies) } // Registry of all active modules dy.modules = {} dy.retrieveOrCreateModule = function (name) { if (dy.modules[name] === undefined) { // Set up new instance dy.modules[name] = {} } // Retrieve the instance of the module return dy.modules[n...
})
random_line_split
test_auto_MRISPreproc.py
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ....testing import assert_equal from ..model import MRISPreproc
input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), fsgd_file=dict(argstr='--fsgd %s', xor=(u'subjects', u'fsgd_file', u'subject_file'), ), fwhm=dict(argstr='--fwhm %f', xor=[u'num_iters'], ), fwhm_source=dict(argstr='--fwhm-src %f', ...
def test_MRISPreproc_inputs():
random_line_split
test_auto_MRISPreproc.py
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ....testing import assert_equal from ..model import MRISPreproc def
(): input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), fsgd_file=dict(argstr='--fsgd %s', xor=(u'subjects', u'fsgd_file', u'subject_file'), ), fwhm=dict(argstr='--fwhm %f', xor=[u'num_iters'], ), fwhm_source=dict(argstr='--fwhm-src %f...
test_MRISPreproc_inputs
identifier_name
test_auto_MRISPreproc.py
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ....testing import assert_equal from ..model import MRISPreproc def test_MRISPreproc_inputs(): input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), fsgd_file=dict(argstr='--fsgd %s', xor=(u'subje...
for metakey, value in list(metadata.items()): yield assert_equal, getattr(outputs.traits()[key], metakey), value
conditional_block
test_auto_MRISPreproc.py
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ....testing import assert_equal from ..model import MRISPreproc def test_MRISPreproc_inputs(): input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), fsgd_file=dict(argstr='--fsgd %s', xor=(u'subje...
output_map = dict(out_file=dict(), ) outputs = MRISPreproc.output_spec() for key, metadata in list(output_map.items()): for metakey, value in list(metadata.items()): yield assert_equal, getattr(outputs.traits()[key], metakey), value
identifier_body
debug.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
<T: Debug>(&mut self, field_name: &str, field_value: &T) { self.add_string(field_name, format!("{:?}", field_value)); } pub fn add<T: IndentedToString>(&mut self, field_name: &str, field_value: &T) { let spaces = self.spaces.to_string(); let repeat = self.repeat + 1; self.add_st...
add_debug
identifier_name
debug.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
pub struct IndentedStructFormatter { name: String, fields: Vec<(String, String)>, spaces: String, repeat: usize, } impl IndentedStructFormatter { pub fn new(name: &str, spaces: &str, repeat: usize) -> Self { Self { name: name.to_string(), fields: Vec::new(), ...
its!($value, " ", 0) }; );
random_line_split
debug.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
pub fn add<T: IndentedToString>(&mut self, field_name: &str, field_value: &T) { let spaces = self.spaces.to_string(); let repeat = self.repeat + 1; self.add_string(field_name, its!(field_value, &spaces, repeat)); } pub fn fmt(&mut self) -> String { let indent = self.spaces...
{ self.add_string(field_name, format!("{:?}", field_value)); }
identifier_body
python_move_group_ns.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source cod...
self.group.set_joint_value_target(target) return self.group.compute_plan() def test_validation(self): current = np.asarray(self.group.get_current_joint_values()) plan1 = self.plan(current + 0.2) plan2 = self.plan(current + 0.2) # first plan should execute s...
def plan(self, target):
random_line_split
python_move_group_ns.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source cod...
self.group.set_joint_value_target(*args) res = self.group.get_joint_value_target() self.assertTrue(np.all(np.asarray(res) == np.asarray(expect)), "Setting failed for %s, values: %s" % (type(args[0]), res)) def test_target_setting(self): n = self.group.get_va...
args = [expect]
conditional_block
python_move_group_ns.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source cod...
(self, target): self.group.set_joint_value_target(target) return self.group.compute_plan() def test_validation(self): current = np.asarray(self.group.get_current_joint_values()) plan1 = self.plan(current + 0.2) plan2 = self.plan(current + 0.2) # first plan should e...
plan
identifier_name
python_move_group_ns.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source cod...
if __name__ == '__main__': PKGNAME = 'moveit_ros_planning_interface' NODENAME = 'moveit_test_python_move_group' rospy.init_node(NODENAME) rostest.rosrun(PKGNAME, NODENAME, PythonMoveGroupNsTest)
PLANNING_GROUP = "manipulator" PLANNING_NS = "test_ns/" @classmethod def setUpClass(self): self.group = MoveGroupInterface(self.PLANNING_GROUP, "%srobot_description"%self.PLANNING_NS, self.PLANNING_NS) @classmethod def tearDown(self): pass def check_target_setting(self, expect...
identifier_body
issue_371.rs
//! Checks that `executor.look_ahead().field_name()` is correct in presence of //! multiple query fields. //! See [#371](https://github.com/graphql-rust/juniper/issues/371) for details. //! //! Original author of this test is [@davidpdrsn](https://github.com/davidpdrsn). use juniper::{ graphql_object, graphql_vars...
() { let query = "{ countries { id } }"; let schema = Schema::new(Query, EmptyMutation::new(), EmptySubscription::new()); let (_, errors) = juniper::execute(query, None, &schema, &graphql_vars! {}, &Context) .await .unwrap(); assert_eq!(errors.len(), 0); } #[tokio::test] async fn both...
countries
identifier_name
issue_371.rs
//! Checks that `executor.look_ahead().field_name()` is correct in presence of //! multiple query fields. //! See [#371](https://github.com/graphql-rust/juniper/issues/371) for details. //! //! Original author of this test is [@davidpdrsn](https://github.com/davidpdrsn). use juniper::{ graphql_object, graphql_vars...
#[tokio::test] async fn countries() { let query = "{ countries { id } }"; let schema = Schema::new(Query, EmptyMutation::new(), EmptySubscription::new()); let (_, errors) = juniper::execute(query, None, &schema, &graphql_vars! {}, &Context) .await .unwrap(); assert_eq!(errors.len(), 0...
assert_eq!(errors.len(), 0); }
random_line_split
colour.rs
use super::request::*; use std::cmp::Ordering; /// HSB colour representation - hue, saturation, brightness (aka value). /// Aka HSV (LIFX terminology) - hue, saturation, value. /// This is not the same as HSL as used in CSS. /// LIFX uses HSB aka HSV, not HSL. #[derive(Debug)] pub struct HSB { pub hue: u16, ...
() { assert_eq!(360, hue_word_to_degrees(65535)); assert_eq!(0, hue_word_to_degrees(0)); assert_eq!(180, hue_word_to_degrees(32768)); } #[test] fn test_saturation_percent_to_word() { assert_eq!([0x80, 0x00], saturation_percent_to_word(50)); } #[test] fn test_rgb...
test_hue_word_to_degrees
identifier_name
colour.rs
use super::request::*; use std::cmp::Ordering; /// HSB colour representation - hue, saturation, brightness (aka value). /// Aka HSV (LIFX terminology) - hue, saturation, value. /// This is not the same as HSL as used in CSS. /// LIFX uses HSB aka HSV, not HSL. #[derive(Debug)] pub struct HSB { pub hue: u16, ...
{ let colour: &str = &(s.to_lowercase()); match colour { "beige" => { HSB { hue: 60, saturation: 56, brightness: 91, } } "blue" => { HSB { hue: 240, saturation: 100, ...
identifier_body
colour.rs
use super::request::*; use std::cmp::Ordering; /// HSB colour representation - hue, saturation, brightness (aka value). /// Aka HSV (LIFX terminology) - hue, saturation, value. /// This is not the same as HSL as used in CSS. /// LIFX uses HSB aka HSV, not HSL. #[derive(Debug)] pub struct HSB { pub hue: u16, ...
HSB { hue: 120, saturation: 100, brightness: 50, } } "red" => { HSB { hue: 0, saturation: 100, brightness: 50, } } "slate_gray" => { ...
brightness: 50, } } "green" => {
random_line_split
AppFilesCommandBar.tsx
import React, { useEffect, useContext } from 'react'; import { ICommandBarItemProps, CommandBar } from 'office-ui-fabric-react'; import { useTranslation } from 'react-i18next'; import { PortalContext } from '../../../../PortalContext'; import { CustomCommandBarButton } from '../../../../components/CustomCommandBarButto...
}, ]; }; useEffect(() => { portalCommunicator.updateDirtyState(dirty); }, [dirty, portalCommunicator]); return ( <> <CommandBar items={getItems()} role="nav" styles={CommandBarStyles} ariaLabel={t('functionEditorCommandBarAriaLabel')} buttonAs={Cu...
disabled: disabled, ariaLabel: t('appFilesSaveAriaLabel'), onClick: refreshFunction,
random_line_split
catall.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ This script shows the categories on each page and lets you change them. For each page in the target wiki: * If the page contains no categories, you can specify a list of categories to add to the page. * If the page already contains one or more categories, you can specify...
y: main() except KeyboardInterrupt: pywikibot.output('\nQuitting program...')
conditional_block
catall.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ This script shows the categories on each page and lets you change them. For each page in the target wiki: * If the page contains no categories, you can specify a list of categories to add to the page. * If the page already contains one or more categories, you can specify...
def main(*args): """ Process command line arguments and perform task. If args is an empty list, sys.argv is used. @param args: command line arguments @type args: list of unicode """ docorrections = True start = 'A' local_args = pywikibot.handle_args(args) for arg in local_ar...
"Make categories.""" if site is None: site = pywikibot.Site() pllist = [] for p in list: cattitle = "%s:%s" % (site.namespaces.CATEGORY, p) pllist.append(pywikibot.Page(site, cattitle)) page.put_async(textlib.replaceCategoryLinks(page.get(), pllist, ...
identifier_body
catall.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ This script shows the categories on each page and lets you change them. For each page in the target wiki: * If the page contains no categories, you can specify a list of categories to add to the page. * If the page already contains one or more categories, you can specify...
__version__ = '$Id$' # import pywikibot from pywikibot import i18n, textlib from pywikibot.bot import QuitKeyboardInterrupt def choosecats(pagetext): """Coose categories.""" chosen = [] done = False length = 1000 # TODO: → input_choice pywikibot.output("""Give the new categories, one per lin...
from __future__ import absolute_import, unicode_literals
random_line_split
catall.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ This script shows the categories on each page and lets you change them. For each page in the target wiki: * If the page contains no categories, you can specify a list of categories to add to the page. * If the page already contains one or more categories, you can specify...
age, list, site=None): """Make categories.""" if site is None: site = pywikibot.Site() pllist = [] for p in list: cattitle = "%s:%s" % (site.namespaces.CATEGORY, p) pllist.append(pywikibot.Page(site, cattitle)) page.put_async(textlib.replaceCategoryLinks(page.get(), pllist, ...
ke_categories(p
identifier_name
vec_conversion.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/. */ extern crate js; use js::conversions::ConversionBehavior; use js::conversions::FromJSValConvertible; use js::conv...
ptr::null_mut(), h_option, &c_option); let global_root = Rooted::new(cx, global); let global = global_root.handle(); let _ac = JSAutoCompartment::new(cx, global.get()); assert!(JS_InitStandardClasses(cx, global)); let mut rval = RootedVal...
let cx = rt.cx(); let h_option = OnNewGlobalHookOption::FireOnNewGlobalHook; let c_option = CompartmentOptions::default(); let global = JS_NewGlobalObject(cx, &SIMPLE_GLOBAL_CLASS,
random_line_split
vec_conversion.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/. */ extern crate js; use js::conversions::ConversionBehavior; use js::conversions::FromJSValConvertible; use js::conv...
{ unsafe { assert!(JS_Init()); let rt = Runtime::new(ptr::null_mut()); let cx = rt.cx(); let h_option = OnNewGlobalHookOption::FireOnNewGlobalHook; let c_option = CompartmentOptions::default(); let global = JS_NewGlobalObject(cx, &SIMPLE_GLOBAL_CLASS, ...
identifier_body
vec_conversion.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/. */ extern crate js; use js::conversions::ConversionBehavior; use js::conversions::FromJSValConvertible; use js::conv...
() { unsafe { assert!(JS_Init()); let rt = Runtime::new(ptr::null_mut()); let cx = rt.cx(); let h_option = OnNewGlobalHookOption::FireOnNewGlobalHook; let c_option = CompartmentOptions::default(); let global = JS_NewGlobalObject(cx, &SIMPLE_GLOBAL_CLASS, ...
vec_conversion
identifier_name
writer.rs
use schema::{Schema, Field, Document}; use fastfield::FastFieldSerializer; use std::io; use schema::Value; use DocId; use schema::FieldType; use common; use common::VInt; use common::BinarySerializable; /// The fastfieldswriter regroup all of the fast field writers. pub struct FastFieldsWriter { field_writers: Vec...
/// method. /// /// We cannot serialize earlier as the values are /// bitpacked and the number of bits required for bitpacking /// can only been known once we have seen all of the values. /// /// Both u64, and i64 use the same writer. /// i64 are just remapped to the `0..2^64 - 1` /// using `common::i64_to_u64`. pub st...
/// The fast field writer just keeps the values in memory. /// /// Only when the segment writer can be closed and /// persisted on disc, the fast field writer is /// sent to a `FastFieldSerializer` via the `.serialize(...)`
random_line_split
writer.rs
use schema::{Schema, Field, Document}; use fastfield::FastFieldSerializer; use std::io; use schema::Value; use DocId; use schema::FieldType; use common; use common::VInt; use common::BinarySerializable; /// The fastfieldswriter regroup all of the fast field writers. pub struct FastFieldsWriter { field_writers: Vec...
(&mut self, doc: &Document) { let val = self.extract_val(doc); self.add_val(val); } /// Push the fast fields value to the `FastFieldWriter`. pub fn serialize(&self, serializer: &mut FastFieldSerializer) -> io::Result<()> { let (min, max) = if self.val_min > self.val_max { ...
add_document
identifier_name
Histogram.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
const x = xScale.range()[0]; const y = Math.round((yScale(index) || 0) + yScale.bandwidth() / 2 + BAR_HEIGHT / 2); const historyTickClass = alignTicks ? 'histogram-tick-start' : 'histogram-tick'; return ( <text className={'bar-chart-tick ' + historyTickClass} dx={alignTicks ? 0 :...
return null; }
random_line_split
Histogram.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
const x = xScale(d) + (alignTicks ? padding[3] : 0); const y = Math.round((yScale(index) || 0) + yScale.bandwidth() / 2 + BAR_HEIGHT / 2); return ( <Tooltip overlay={this.props.yTooltips && this.props.yTooltips[index]}> <text className="bar-chart-tick histogram-value" dx="1em" dy="0.3em" x=...
{ return null; }
conditional_block
Histogram.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
renderTick(index: number, xScale: XScale, yScale: YScale) { const { alignTicks, yTicks } = this.props; const tick = yTicks && yTicks[index]; if (!tick) { return null; } const x = xScale.range()[0]; const y = Math.round((yScale(index) || 0) + yScale.bandwidth() / 2 + BAR_HEIGHT / 2);...
{ const { alignTicks, padding = DEFAULT_PADDING, yValues } = this.props; const value = yValues && yValues[index]; if (!value) { return null; } const x = xScale(d) + (alignTicks ? padding[3] : 0); const y = Math.round((yScale(index) || 0) + yScale.bandwidth() / 2 + BAR_HEIGHT / 2); ...
identifier_body
Histogram.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
(index: number, xScale: XScale, yScale: YScale) { const { alignTicks, yTicks } = this.props; const tick = yTicks && yTicks[index]; if (!tick) { return null; } const x = xScale.range()[0]; const y = Math.round((yScale(index) || 0) + yScale.bandwidth() / 2 + BAR_HEIGHT / 2); const his...
renderTick
identifier_name
BernoulliNBJSTest.py
# -*- coding: utf-8 -*- import unittest from unittest import TestCase from sklearn.naive_bayes import BernoulliNB from tests.estimator.classifier.Classifier import Classifier from tests.language.JavaScript import JavaScript class BernoulliNBJSTest(JavaScript, Classifier, TestCase): def setUp(self):
def tearDown(self): super(BernoulliNBJSTest, self).tearDown() @unittest.skip('BernoulliNB is just suitable for discrete data.') def test_random_features__iris_data__default(self): pass @unittest.skip('BernoulliNB is just suitable for discrete data.') def test_existing_features__b...
super(BernoulliNBJSTest, self).setUp() self.estimator = BernoulliNB()
identifier_body
BernoulliNBJSTest.py
# -*- coding: utf-8 -*- import unittest from unittest import TestCase from sklearn.naive_bayes import BernoulliNB from tests.estimator.classifier.Classifier import Classifier from tests.language.JavaScript import JavaScript class BernoulliNBJSTest(JavaScript, Classifier, TestCase): def
(self): super(BernoulliNBJSTest, self).setUp() self.estimator = BernoulliNB() def tearDown(self): super(BernoulliNBJSTest, self).tearDown() @unittest.skip('BernoulliNB is just suitable for discrete data.') def test_random_features__iris_data__default(self): pass @unitt...
setUp
identifier_name
BernoulliNBJSTest.py
# -*- coding: utf-8 -*- import unittest from unittest import TestCase from sklearn.naive_bayes import BernoulliNB from tests.estimator.classifier.Classifier import Classifier from tests.language.JavaScript import JavaScript class BernoulliNBJSTest(JavaScript, Classifier, TestCase): def setUp(self): su...
@unittest.skip('BernoulliNB is just suitable for discrete data.') def test_existing_features__digits_data__default(self): pass
@unittest.skip('BernoulliNB is just suitable for discrete data.') def test_random_features__digits_data__default(self): pass
random_line_split
rpc_mock.py
from bitcoingraph.bitcoind import BitcoinProxy, BitcoindException from pathlib import Path import json TEST_DATA_PATH = "tests/data" class BitcoinProxyMock(BitcoinProxy): def __init__(self, host=None, port=None): super().__init__(host, port) self.heights = {} self.blocks = {} ...
elif f.name.startswith("tx"): tx_hash = f.name[3:-5] with f.open() as jf: raw_block = json.load(jf) self.txs[tx_hash] = raw_block # Override production proxy methods def getblock(self, block_hash): if block_hash not i...
height = f.name[6:-5] with f.open() as jf: raw_block = json.load(jf) block_hash = raw_block['hash'] self.heights[int(height)] = block_hash self.blocks[block_hash] = raw_block
conditional_block