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 |
|---|---|---|---|---|
aarch64_gen_tests.py |
import ast
import random
import re
def main():
import sys
infile = sys.argv[1]
attempts = int(sys.argv[2])
outfile = sys.argv[3]
with open(infile, "r", encoding="utf-8") as f:
templates = read_opdata_file(f)
buf = []
for template in templates:
for _ in range(attempts):
... | (self, history):
prev = history.values[-1]
return random.randrange(1, self.max - prev, self.scale)
class R(Constraint):
"""A constraint that allows a certain range of registers"""
def __init__(self, count, scale=1):
self.count = count
self.scale = scale
def create_value(sel... | create_value | identifier_name |
aarch64_gen_tests.py | import ast
import random
import re
def main():
import sys
infile = sys.argv[1]
attempts = int(sys.argv[2])
outfile = sys.argv[3]
with open(infile, "r", encoding="utf-8") as f:
templates = read_opdata_file(f)
buf = []
for template in templates:
for _ in range(attempts):
... | def __init__(self, type):
self.type = type
def create_value(self, history):
if self.type == "wide_w":
return make_wide_integer(False)
elif self.type == "wide_x":
return make_wide_integer(True)
elif self.type == "inverted_w":
return make_wide_i... | """A constraint that can emit various special integer encoding formats""" | random_line_split |
list_item.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/. */
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
//! block and an... | #![deny(unsafe_code)]
use block::BlockFlow;
use context::LayoutContext;
use display_list_builder::ListItemFlowDisplayListBuilding;
use floats::FloatKind;
use flow::{Flow, FlowClass, OpaqueFlow};
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo};
use generated_content;
use incr... | random_line_split | |
list_item.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/. */
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
//! block and an... | self,
iterator: &mut FragmentBorderBoxIterator,
stacking_context_position: &Point2D<Au>) {
self.block_flow.iterate_through_fragment_border_boxes(iterator, stacking_context_position);
if let Some(ref marker) = self... | erate_through_fragment_border_boxes(& | identifier_name |
list_item.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/. */
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
//! block and an... | fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
self.block_flow.assign_inline_sizes(layout_context);
if let Some(ref mut marker) = self.marker {
let containing_block_inline_size = self.block_flow.base.block_container_inline_size;
marker.assign_replaced_in... | {
// The marker contributes no intrinsic inline-size, so…
self.block_flow.bubble_inline_sizes()
}
| identifier_body |
test_cubegen.py | #!/usr/bin/env python
# Copyright 2019 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
def test_orb(self):
ftmp = tempfile.NamedTemporaryFile()
orb = cubegen.orbital(mol, ftmp.name, mf.mo_coeff[:,0],
nx=10, ny=10, nz=10)
self.assertEqual(orb.shape, (10,10,10))
self.assertAlmostEqual(lib.finger(orb), -0.11804191128016768, 9)
orb ... | ftmp = tempfile.NamedTemporaryFile()
mep = cubegen.mep(mol, ftmp.name, mf.make_rdm1(),
nx=10, ny=10, nz=10)
self.assertEqual(mep.shape, (10,10,10))
self.assertAlmostEqual(lib.finger(mep), -0.3198103636180436, 9)
mep = cubegen.mep(mol, ftmp.name, mf.make_rdm1(),... | identifier_body |
test_cubegen.py | #!/usr/bin/env python
# Copyright 2019 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | (unittest.TestCase):
def test_mep(self):
ftmp = tempfile.NamedTemporaryFile()
mep = cubegen.mep(mol, ftmp.name, mf.make_rdm1(),
nx=10, ny=10, nz=10)
self.assertEqual(mep.shape, (10,10,10))
self.assertAlmostEqual(lib.finger(mep), -0.3198103636180436, 9)
... | KnownValues | identifier_name |
test_cubegen.py | #!/usr/bin/env python
# Copyright 2019 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | print("Full Tests for molden")
unittest.main() | conditional_block | |
test_cubegen.py | #!/usr/bin/env python
# Copyright 2019 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | import unittest
import copy
import tempfile
from pyscf import lib, gto, scf
from pyscf.tools import cubegen
mol = gto.Mole()
mol.atom = '''
O 0.00000000, 0.000000, 0.119748
H 0.00000000, 0.761561, -0.478993
H 0.00000000, -0.761561, -0.478993 '''
mol.verbose = 0
mol.build()
mf = scf.RHF(mol).run()
def tearDownModul... | # See the License for the specific language governing permissions and
# limitations under the License.
| random_line_split |
reset_password.py | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... |
def remove_all_tokens_for_email(self, email):
super().delete(lookup={'email': email})
def remove_private_data(self, doc):
self.remove_field_from(doc, 'password')
self.remove_field_from(doc, 'token')
self.remove_field_from(doc, 'user')
def remove_field_from(self, doc, fiel... | key = doc.get('token')
password = doc.get('password')
reset_request = superdesk.get_resource_service('active_tokens').find_one(req=None, token=key)
if not reset_request:
logger.warning('Invalid token received: %s' % key)
raise SuperdeskApiError.unauthorizedError('Invalid... | identifier_body |
reset_password.py | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... | (Resource):
schema = reset_schema
public_methods = ['POST']
resource_methods = ['POST']
item_methods = []
class ResetPasswordService(BaseService):
def create(self, docs, **kwargs):
for doc in docs:
email = doc.get('email')
key = doc.get('token')
passwor... | ResetPasswordResource | identifier_name |
reset_password.py | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... |
raise SuperdeskApiError.badRequestError('Either key:password or email must be provided')
def store_reset_password_token(self, doc, email, days_alive, user_id):
token_ttl = app.config['RESET_PASSWORD_TOKEN_TIME_TO_LIVE']
now = utcnow()
doc[app.config['DATE_CREATED']] = now
... | return self.initialize_reset_password(doc, email) | conditional_block |
reset_password.py | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... | password = doc.get('password')
if key and password:
return self.reset_password(doc)
if email:
return self.initialize_reset_password(doc, email)
raise SuperdeskApiError.badRequestError('Either key:password or email must be provided')
... | email = doc.get('email')
key = doc.get('token') | random_line_split |
test_trt_convert_group_norm.py | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
def generate_trt_nodes_num(attrs, dynamic_shape):
if len(attrs[0]) == 3:
if dynamic_shape:
return 1, 2
else:
return 0, 3
else:
return 0, 3
attrs = [
program_config.ops[i].attrs
... | self.dynamic_shape.max_input_shape = {}
self.dynamic_shape.min_input_shape = {}
self.dynamic_shape.opt_input_shape = {} | identifier_body |
test_trt_convert_group_norm.py | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
else:
return 0, 3
else:
return 0, 3
attrs = [
program_config.ops[i].attrs
for i in range(len(program_config.ops))
]
# for static_shape
clear_dynamic_shape()
self.trt_param.precision = paddl... | return 1, 2 | conditional_block |
test_trt_convert_group_norm.py | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | (self):
def teller1(program_config, predictor_config):
if len(self.dynamic_shape.min_input_shape) != 0:
return True
return False
self.add_skip_case(
teller1, SkipReasons.TRT_NOT_IMPLEMENTED,
"The goup_norm plugin will check dim not -1 fail... | add_skip_trt_case | identifier_name |
test_trt_convert_group_norm.py | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
# for static_shape
clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield s... |
attrs = [
program_config.ops[i].attrs
for i in range(len(program_config.ops))
] | random_line_split |
animation.js | /* global sch, sb, map */
function AnimationManager () {
this.bkgStep = 150
this.bkgPosition = 0
this.setAnimationSpeed = (speed) => {
document.body.style.setProperty('--animation-pace', speed)
}
this.stopRunning = () => {
sch.setPace(750)
this.getLight().style.setProperty('transform', `scale(1... | }
this.setBkgPosition = (p) => {
this.bkgPosition += p
}
this.moveRight = () => {
this.setBkgPosition(-this.bkgStep)
map.movePlayerRight()
}
this.moveLeft = () => {
this.setBkgPosition(this.bkgStep)
map.movePlayerLeft()
}
this.getLight = () => {
return this.light || (this.lig... | random_line_split | |
animation.js | /* global sch, sb, map */
function AnimationManager () |
window.am = new AnimationManager()
| {
this.bkgStep = 150
this.bkgPosition = 0
this.setAnimationSpeed = (speed) => {
document.body.style.setProperty('--animation-pace', speed)
}
this.stopRunning = () => {
sch.setPace(750)
this.getLight().style.setProperty('transform', `scale(1.0) translateX(${this.bkgPosition}px)`)
this.getHand... | identifier_body |
animation.js | /* global sch, sb, map */
function AnimationManager () {
this.bkgStep = 150
this.bkgPosition = 0
this.setAnimationSpeed = (speed) => {
document.body.style.setProperty('--animation-pace', speed)
}
this.stopRunning = () => {
sch.setPace(750)
this.getLight().style.setProperty('transform', `scale(1... |
this.getLight().classList.add('light')
this.updateDirection()
sb.add(`Direction: ${map.player.dir.toFixed(1)}rad`)
}
})
}
window.am = new AnimationManager()
| {
this.getLight().classList.remove('light')
this.setBkgPosition(-2 * this.bkgPosition)
this.updateDirection()
sb.add('Wraped around')
} | conditional_block |
animation.js | /* global sch, sb, map */
function | () {
this.bkgStep = 150
this.bkgPosition = 0
this.setAnimationSpeed = (speed) => {
document.body.style.setProperty('--animation-pace', speed)
}
this.stopRunning = () => {
sch.setPace(750)
this.getLight().style.setProperty('transform', `scale(1.0) translateX(${this.bkgPosition}px)`)
this.get... | AnimationManager | identifier_name |
f64.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | unsafe { intrinsics::logf64(self) }
}
/// Returns the logarithm of the number with respect to an arbitrary base.
#[inline]
fn log(self, base: f64) -> f64 { self.ln() / base.ln() }
/// Returns the base 2 logarithm of the number.
#[inline]
fn log2(self) -> f64 {
unsafe { intr... | fn ln(self) -> f64 { | random_line_split |
f64.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | (self) -> f64 { 1.0 / self }
#[inline]
fn powf(self, n: f64) -> f64 {
unsafe { intrinsics::powf64(self, n) }
}
#[inline]
fn powi(self, n: i32) -> f64 {
unsafe { intrinsics::powif64(self, n) }
}
#[inline]
fn sqrt(self) -> f64 {
if self < 0.0 {
NAN
... | recip | identifier_name |
f64.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | else {
unsafe { intrinsics::copysignf64(1.0, self) }
}
}
/// Returns `true` if `self` is positive, including `+0.0` and
/// `Float::infinity()`.
#[inline]
fn is_positive(self) -> bool {
self > 0.0 || (1.0 / self) == Float::infinity()
}
/// Returns `true` if `se... | {
Float::nan()
} | conditional_block |
f64.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
from_str_radix_float_impl! { f64 }
/// Returns `true` if the number is NaN.
#[inline]
fn is_nan(self) -> bool { self != self }
/// Returns `true` if the number is infinite.
#[inline]
fn is_infinite(self) -> bool {
self == Float::infinity() || self == Float::neg_infinity()
}
... | { 1.0 } | identifier_body |
generic_queue.py | from datetime import datetime
from time import sleep
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from dimagi.utils.parsing import string_to_datetime, json_format_datetime
from dimagi.utils.couch.cache import cache_core
from dimagi.u... |
def get_redis_client(self):
rcache = cache_core.get_redis_default_cache()
if not isinstance(rcache, RedisCache):
raise RedisClientError("Could not get redis connection.")
try:
client = rcache.raw_client
except:
raise RedisClientError("Could not g... | try:
self.enqueue_item(item_id)
except:
# We couldn't enqueue, so release the lock
enqueuing_lock.release() | conditional_block |
generic_queue.py | from datetime import datetime
from time import sleep
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from dimagi.utils.parsing import string_to_datetime, json_format_datetime
from dimagi.utils.couch.cache import cache_core
from dimagi.u... | (self):
"""Should return the timeout, in minutes, to use with the
enqueuing lock. This is essentially the number of minutes to
wait before enqueuing an unprocessed item again."""
raise NotImplementedError("This method must be implemented.")
def get_items_to_be_processed(self, utcnow... | get_enqueuing_timeout | identifier_name |
generic_queue.py | from datetime import datetime
from time import sleep
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from dimagi.utils.parsing import string_to_datetime, json_format_datetime
from dimagi.utils.couch.cache import cache_core
from dimagi.u... | self.populate_queue()
except RedisClientError:
notify_exception(None,
message="Could not get redis connection. Is redis up?")
except:
notify_exception(None,
message="Could not populate %s." % self.get_queue_n... | random_line_split | |
generic_queue.py | from datetime import datetime
from time import sleep
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from dimagi.utils.parsing import string_to_datetime, json_format_datetime
from dimagi.utils.couch.cache import cache_core
from dimagi.u... | """
Implements a generic enqueuing operation.
"""
args = ""
help = ""
def handle(self, *args, **options):
if self.use_queue():
self.validate_args(**options)
self.keep_fetching_items()
else:
# If we return right away, supervisor will keep trying to... | identifier_body | |
control_panel.py | import os
import pyglet
class ControlPanelError(Exception): pass
class ControlPanelSkinError(Exception): pass
class ControlPanel(object):
def __init__(self, skin_name):
self.skin_name = skin_name
self.cached_skins = {}
self.switch_skin(self.skin_name)
def _cache_skin(self, skin_n... | if __name__ == '__main__':
import sys
if len(sys.argv) > 1:
control_panel = ControlPanel(sys.argv[1])
else:
control_panel = ControlPanel('basic')
window = pyglet.window.Window(256, 240)
@window.event
def on_draw():
window.clear()
control_panel.draw()
pygle... |
def draw(self):
self.image.blit(0, 0)
| random_line_split |
control_panel.py | import os
import pyglet
class ControlPanelError(Exception): pass
class ControlPanelSkinError(Exception): pass
class ControlPanel(object):
def __init__(self, skin_name):
self.skin_name = skin_name
self.cached_skins = {}
self.switch_skin(self.skin_name)
def _cache_skin(self, skin_n... | (self, skin_name):
"""
Switch the current skin of this control panel to the specified skin.
If the specified skin is not cached, cache it.
"""
self.last_skin_name = self.skin_name
if skin_name not in self.cached_skins.keys():
self._cache_skin(skin_name)
... | switch_skin | identifier_name |
control_panel.py | import os
import pyglet
class ControlPanelError(Exception): pass
class ControlPanelSkinError(Exception): pass
class ControlPanel(object):
def __init__(self, skin_name):
self.skin_name = skin_name
self.cached_skins = {}
self.switch_skin(self.skin_name)
def _cache_skin(self, skin_n... |
window = pyglet.window.Window(256, 240)
@window.event
def on_draw():
window.clear()
control_panel.draw()
pyglet.app.run()
| control_panel = ControlPanel('basic') | conditional_block |
control_panel.py | import os
import pyglet
class ControlPanelError(Exception): pass
class ControlPanelSkinError(Exception): pass
class ControlPanel(object):
|
if __name__ == '__main__':
import sys
if len(sys.argv) > 1:
control_panel = ControlPanel(sys.argv[1])
else:
control_panel = ControlPanel('basic')
window = pyglet.window.Window(256, 240)
@window.event
def on_draw():
window.clear()
control_panel.draw()
py... | def __init__(self, skin_name):
self.skin_name = skin_name
self.cached_skins = {}
self.switch_skin(self.skin_name)
def _cache_skin(self, skin_name):
skin_dir = os.path.join('..', 'data', 'skins', skin_name)
cp_image = pyglet.image.load(os.path.join(skin_dir,'control_panel.p... | identifier_body |
Point.ts | module asteroids.ui {
export class Point {
/** @type {number}*/
public x:number = 0;
/** @type {number}*/
public y:number = 0;
/**
* @constructor
* @param x {number}
* @param y {number}
*/
constructor(x : number = 0, y : number = 0) {
this.x = x;
this.y = y;
... | (point1, point2) {
var dx, dy;
dx = point1.x - point2.x;
dy = point1.y - point2.y;
return Math.sqrt(dx * dx + dy * dy);
}
/**
* @param {Point} targetPoint
* @return {number}
*/
public distanceSquaredTo(targetPoint) {
var dx, dy;
dx = this.x - targetPoint.x;... | distance | identifier_name |
Point.ts | module asteroids.ui {
export class Point {
/** @type {number}*/
public x:number = 0;
/** @type {number}*/
public y:number = 0;
/**
* @constructor
* @param x {number}
* @param y {number}
*/
constructor(x : number = 0, y : number = 0) {
this.x = x;
this.y = y;
... |
/**
* @param {Point} targetPoint
* @return {number}
*/
public distanceSquaredTo(targetPoint) {
var dx, dy;
dx = this.x - targetPoint.x;
dy = this.y - targetPoint.y;
return dx * dx + dy * dy;
}
/**
* @param {Point} targetPoint
* @return {number}
*/
... | {
var dx, dy;
dx = point1.x - point2.x;
dy = point1.y - point2.y;
return Math.sqrt(dx * dx + dy * dy);
} | identifier_body |
Point.ts | module asteroids.ui {
export class Point {
/** @type {number}*/
public x:number = 0;
/** @type {number}*/
public y:number = 0;
/**
* @constructor
* @param x {number}
* @param y {number}
*/
constructor(x : number = 0, y : number = 0) {
this.x = x;
this.y = y;
... | dx = point1.x - point2.x;
dy = point1.y - point2.y;
return Math.sqrt(dx * dx + dy * dy);
}
/**
* @param {Point} targetPoint
* @return {number}
*/
public distanceSquaredTo(targetPoint) {
var dx, dy;
dx = this.x - targetPoint.x;
dy = this.y - targetPoint.y;
... | public static distance(point1, point2) {
var dx, dy; | random_line_split |
method-self-arg-aux1.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let x = Foo;
// Test external call.
Foo::bar(&x);
Foo::baz(x);
Foo::qux(box x);
x.foo(&x);
assert!(method_self_arg1::get_count() == 2u64*3*3*3*5*5*5*7*7*7);
} | identifier_body | |
method-self-arg-aux1.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let x = Foo;
// Test external call.
Foo::bar(&x);
Foo::baz(x);
Foo::qux(box x);
x.foo(&x);
assert!(method_self_arg1::get_count() == 2u64*3*3*3*5*5*5*7*7*7);
}
| main | identifier_name |
method-self-arg-aux1.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // aux-build:method_self_arg1.rs
extern crate method_self_arg1;
use method_self_arg1::Foo;
fn main() {
let x = Foo;
// Test external call.
Foo::bar(&x);
Foo::baz(x);
Foo::qux(box x);
x.foo(&x);
assert!(method_self_arg1::get_count() == 2u64*3*3*3*5*5*5*7*7*7);
} | random_line_split | |
setup.py | #!/usr/bin/env python
import re
from codecs import open
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version():
version = ''
with open('grimreaper.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
... | ():
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
with open('CHANGES.rst', 'r', 'utf-8') as f:
changes = f.read()
return readme + '\n\n' + changes
setup(
name='GrimReapersPie',
version=get_version(),
description='Python client to the GrimReaper process killer.'... | get_long_description | identifier_name |
setup.py | #!/usr/bin/env python
import re
from codecs import open
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version():
version = ''
with open('grimreaper.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
... | def get_long_description():
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
with open('CHANGES.rst', 'r', 'utf-8') as f:
changes = f.read()
return readme + '\n\n' + changes
setup(
name='GrimReapersPie',
version=get_version(),
description='Python client to the Gri... | random_line_split | |
setup.py | #!/usr/bin/env python
import re
from codecs import open
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version():
version = ''
with open('grimreaper.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
... |
return version
def get_long_description():
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
with open('CHANGES.rst', 'r', 'utf-8') as f:
changes = f.read()
return readme + '\n\n' + changes
setup(
name='GrimReapersPie',
version=get_version(),
description='Py... | raise RuntimeError("Cannot find version's information") | conditional_block |
setup.py | #!/usr/bin/env python
import re
from codecs import open
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version():
|
def get_long_description():
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
with open('CHANGES.rst', 'r', 'utf-8') as f:
changes = f.read()
return readme + '\n\n' + changes
setup(
name='GrimReapersPie',
version=get_version(),
description='Python client to the ... | version = ''
with open('grimreaper.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError("Cannot find version's information")
return version | identifier_body |
wiggle.rs | //! Dataflow node that generates/propagates/mutates a wiggle.
use util::{modulo_one, almost_eq, angle_almost_eq};
use network::{Network, NodeIndex, GenerationId, NodeId, OutputId, Inputs, Outputs};
use console_server::reactor::Messages;
use wiggles_value::{Data, Unipolar, Datatype};
use wiggles_value::knob::{Knobs, Res... | (NodeIndex, GenerationId);
impl fmt::Display for WiggleId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "wiggle {}, generation {}", self.0, self.1)
}
}
impl NodeId for WiggleId {
fn new(idx: NodeIndex, gen_id: GenerationId) -> Self {
WiggleId(idx, gen_id)
}
fn ... | WiggleId | identifier_name |
wiggle.rs | //! Dataflow node that generates/propagates/mutates a wiggle.
use util::{modulo_one, almost_eq, angle_almost_eq};
use network::{Network, NodeIndex, GenerationId, NodeId, OutputId, Inputs, Outputs};
use console_server::reactor::Messages;
use wiggles_value::{Data, Unipolar, Datatype};
use wiggles_value::knob::{Knobs, Res... | (**self).try_pop_output(node_id)
}
}
// TODO: consider generalizing Update and/or Render as traits.
/// Wrapper trait for a wiggle network.
pub trait WiggleCollection {
fn update(&mut self, dt: Duration) -> Messages<KnobResponse<WiggleKnobAddr>>;
}
impl WiggleCollection for WiggleNetwork {
fn upda... | &mut self, node_id: WiggleId) -> Result<Messages<KnobResponse<WiggleKnobAddr>>, ()> { | random_line_split |
wiggle.rs | //! Dataflow node that generates/propagates/mutates a wiggle.
use util::{modulo_one, almost_eq, angle_almost_eq};
use network::{Network, NodeIndex, GenerationId, NodeId, OutputId, Inputs, Outputs};
use console_server::reactor::Messages;
use wiggles_value::{Data, Unipolar, Datatype};
use wiggles_value::knob::{Knobs, Res... |
}
impl NodeId for WiggleId {
fn new(idx: NodeIndex, gen_id: GenerationId) -> Self {
WiggleId(idx, gen_id)
}
fn index(&self) -> NodeIndex {
self.0
}
fn gen_id(&self) -> GenerationId {
self.1
}
}
/// Type alias for a network of wiggles.
pub type WiggleNetwork = Network<B... | {
write!(f, "wiggle {}, generation {}", self.0, self.1)
} | identifier_body |
wiggle.rs | //! Dataflow node that generates/propagates/mutates a wiggle.
use util::{modulo_one, almost_eq, angle_almost_eq};
use network::{Network, NodeIndex, GenerationId, NodeId, OutputId, Inputs, Outputs};
use console_server::reactor::Messages;
use wiggles_value::{Data, Unipolar, Datatype};
use wiggles_value::knob::{Knobs, Res... |
}
}
}
pub trait CompleteWiggle:
Wiggle
+ Inputs<KnobResponse<WiggleKnobAddr>, WiggleId>
+ Outputs<KnobResponse<WiggleKnobAddr>, WiggleId>
+ Knobs<KnobAddr>
+ fmt::Debug
{
fn eq(&self, other: &CompleteWiggle) -> bool;
fn as_any(&self) -> &Any;
}
impl<T> CompleteWiggle for T
... | {
node.inner().render(phase_offset, type_hint, node.inputs(), output_id, self, clocks)
} | conditional_block |
analytic.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | (self, cr, uid, ids, template_id, date_start=False, context=None):
if not template_id:
return {}
res = {'value':{}}
template = self.browse(cr, uid, template_id, context=context)
if template.date_start and template.date:
from_dt = datetime.strptime(template.date_st... | on_change_template | identifier_name |
analytic.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
if not child_ids:
return res
where_date = ''
where_clause_args = [tuple(child_ids)]
if context.get('from_date', False):
where_date += " AND l.date >= %s"
where_clause_args += [context['from_date']]
if context.get('to_date', False):
... | res[i][n] = 0.0 | conditional_block |
analytic.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
_constraints = [
(_check_no_view, 'You cannot create analytic line on view account.', ['account_id']),
]
class account_analytic_journal(osv.osv):
_name = 'account.analytic.journal'
_description = 'Analytic Journal'
_columns = {
'name': fields.char('Journal Name', required=True),
... | analytic_lines = self.browse(cr, uid, ids, context=context)
for line in analytic_lines:
if line.account_id.type == 'view':
return False
return True | identifier_body |
analytic.py | # -*- coding: utf-8 -*-
##############################################################################
# | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 v... | # OpenERP, Open Source Management Solution | random_line_split |
create_mock.rs | use std::path::Path;
use clap::ArgMatches;
use itertools::Itertools;
use log::*;
use serde_json::Value;
use pact_models::pact::{Pact, ReadWritePact};
use pact_models::sync_pact::RequestResponsePact;
use crate::handle_error;
pub async fn create_mock_server(host: &str, port: u16, matches: &ArgMatches<'_>) -> Result<(... | }
if matches.is_present("tls") {
info!("Setting mock server to use TLS");
args.push("tls=true");
}
let url = if args.is_empty() {
format!("http://{}:{}/", host, port)
} else {
format!("http://{}:{}/?{}", host, port, args.iter().join("&"))
};
let ... | Ok(ref pact) => {
let mut args = vec![];
if matches.is_present("cors") {
info!("Setting mock server to handle CORS pre-flight requests");
args.push("cors=true"); | random_line_split |
create_mock.rs | use std::path::Path;
use clap::ArgMatches;
use itertools::Itertools;
use log::*;
use serde_json::Value;
use pact_models::pact::{Pact, ReadWritePact};
use pact_models::sync_pact::RequestResponsePact;
use crate::handle_error;
pub async fn create_mock_server(host: &str, port: u16, matches: &ArgMatches<'_>) -> Result<(... | {
let file = matches.value_of("file").unwrap();
log::info!("Creating mock server from file {}", file);
match RequestResponsePact::read_pact(Path::new(file)) {
Ok(ref pact) => {
let mut args = vec![];
if matches.is_present("cors") {
info!("Setting mock server to handle CORS pre-flight requ... | identifier_body | |
create_mock.rs | use std::path::Path;
use clap::ArgMatches;
use itertools::Itertools;
use log::*;
use serde_json::Value;
use pact_models::pact::{Pact, ReadWritePact};
use pact_models::sync_pact::RequestResponsePact;
use crate::handle_error;
pub async fn create_mock_server(host: &str, port: u16, matches: &ArgMatches<'_>) -> Result<(... |
}
}
| {
crate::display_error(format!("Failed to load pact file '{}': {}", file, err), matches);
} | conditional_block |
create_mock.rs | use std::path::Path;
use clap::ArgMatches;
use itertools::Itertools;
use log::*;
use serde_json::Value;
use pact_models::pact::{Pact, ReadWritePact};
use pact_models::sync_pact::RequestResponsePact;
use crate::handle_error;
pub async fn | (host: &str, port: u16, matches: &ArgMatches<'_>) -> Result<(), i32> {
let file = matches.value_of("file").unwrap();
log::info!("Creating mock server from file {}", file);
match RequestResponsePact::read_pact(Path::new(file)) {
Ok(ref pact) => {
let mut args = vec![];
if matches.is_present("cors"... | create_mock_server | identifier_name |
CreateAddressSpacePage.tsx | /*
* Copyright 2020, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
import * as React from "react";
import { Wizard } from "@patternfly/react-core";
import { AddressSpaceConfiguration } from "pages/CreateAddressSpace/CreateAddressSpaceConfigu... |
};
const steps = [
{
name: "Configuration",
component: (
<AddressSpaceConfiguration
name={addressSpaceName}
setName={setAddressSpaceName}
namespace={namespace}
setNamespace={setNamespace}
type={addressSpaceType}
setType={setAddres... | {
const variables = {
as: {
metadata: {
name: addressSpaceName,
namespace: namespace
},
spec: {
type: addressSpaceType.toLowerCase(),
plan: addressSpacePlan.toLowerCase(),
authenticationService: {
name:... | conditional_block |
CreateAddressSpacePage.tsx | /*
* Copyright 2020, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
import * as React from "react";
import { Wizard } from "@patternfly/react-core";
import { AddressSpaceConfiguration } from "pages/CreateAddressSpace/CreateAddressSpaceConfigu... | onSave={handleSave}
/>
)}
</React.Fragment>
);
}; | isFullWidth={true}
onClose={onClose}
title="Create an Instance"
steps={steps}
onNext={() => {}} | random_line_split |
borrowck-vec-pattern-nesting.rs | fn a() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[~ref _a] => {
vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed
}
_ => fail!("foo")
}
}
fn b() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[.._b] => {
vec[0] = ~4; //~ E... | _ => {}
}
let a = vec[0]; //~ ERROR use of partially moved value: `vec`
}
fn d() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[.._a, _b] => {
//~^ ERROR cannot move out
}
_ => {}
}
let a = vec[0]; //~ ERROR use of partially moved value: `vec`
}
fn e() ... | } | random_line_split |
borrowck-vec-pattern-nesting.rs | fn a() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[~ref _a] => {
vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed
}
_ => fail!("foo")
}
}
fn b() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[.._b] => {
vec[0] = ~4; //~ E... | {} | identifier_body | |
borrowck-vec-pattern-nesting.rs | fn a() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[~ref _a] => {
vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed
}
_ => fail!("foo")
}
}
fn | () {
let mut vec = ~[~1, ~2, ~3];
match vec {
[.._b] => {
vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed
}
}
}
fn c() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[_a, .._b] => {
//~^ ERROR cannot move out
// Note... | b | identifier_name |
borrowck-vec-pattern-nesting.rs | fn a() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[~ref _a] => {
vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed
}
_ => fail!("foo")
}
}
fn b() {
let mut vec = ~[~1, ~2, ~3];
match vec {
[.._b] => {
vec[0] = ~4; //~ E... |
_ => {}
}
let a = vec[0]; //~ ERROR use of partially moved value: `vec`
}
fn main() {}
| {} | conditional_block |
views.py | from flask import render_template, flash, redirect, session, url_for, request, g
from flask_login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from .forms import LoginForm, EditForm
from .models import User
from datetime import datetime
@app.before_request
def before_r... | (error):
return render_template('404.html'), 404
@app.errorhandler(500)
def internal_error(error):
db.session.rollback()
return render_template('500.html'), 500 | not_found_error | identifier_name |
views.py | from flask import render_template, flash, redirect, session, url_for, request, g
from flask_login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from .forms import LoginForm, EditForm
from .models import User
from datetime import datetime
@app.before_request
def before_r... |
@app.errorhandler(404)
def not_found_error(error):
return render_template('404.html'), 404
@app.errorhandler(500)
def internal_error(error):
db.session.rollback()
return render_template('500.html'), 500 | form = EditForm(g.user.nickname)
if form.validate_on_submit():
g.user.nickname = form.nickname.data
g.user.about_me = form.about_me.data
db.session.add(g.user)
db.session.commit()
flash('You changes have been saved.')
return redirect(url_for('edit'))
else:
... | identifier_body |
views.py | from flask import render_template, flash, redirect, session, url_for, request, g
from flask_login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from .forms import LoginForm, EditForm
from .models import User
from datetime import datetime
@app.before_request
def before_r... | return render_template('500.html'), 500 | random_line_split | |
views.py | from flask import render_template, flash, redirect, session, url_for, request, g
from flask_login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from .forms import LoginForm, EditForm
from .models import User
from datetime import datetime
@app.before_request
def before_r... |
return render_template('login.html',
title='Sign In',
form=form,
providers=app.config['OPENID_PROVIDERS'])
@lm.user_loader
def load_user(id):
return User.query.get(int(id))
@oid.after_login
def after_login(resp):
if resp.e... | session['remember_me'] = form.remember_me.data
return oid.try_login(form.openid.data, ask_for=['nickname', 'email']) | conditional_block |
share_snapshots.py | # Copyright 2012 NetApp
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | (self, snapshot, **kwargs):
"""Update a snapshot.
:param snapshot: The :class:`ShareSnapshot` instance or string with ID
of snapshot to delete.
:rtype: :class:`ShareSnapshot`
"""
if not kwargs:
return
body = {'snapshot': kwargs, }
snapsho... | update | identifier_name |
share_snapshots.py | # Copyright 2012 NetApp
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
def update(self, snapshot, **kwargs):
"""Update a snapshot.
:param snapshot: The :class:`ShareSnapshot` instance or string with ID
of snapshot to delete.
:rtype: :class:`ShareSnapshot`
"""
if not kwargs:
return
body = {'snapshot': kwargs, }... | return self._do_force_delete(snapshot, "force_delete") | identifier_body |
share_snapshots.py | # Copyright 2012 NetApp
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | else:
path = "/snapshots%s" % (query_string,)
return self._list(path, 'snapshots')
def delete(self, snapshot):
"""Delete a snapshot of a share.
:param snapshot: The :class:`ShareSnapshot` to delete.
"""
self._delete("/snapshots/%s" % common_base.getid(s... | random_line_split | |
share_snapshots.py | # Copyright 2012 NetApp
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
return self._list(path, 'snapshots')
def delete(self, snapshot):
"""Delete a snapshot of a share.
:param snapshot: The :class:`ShareSnapshot` to delete.
"""
self._delete("/snapshots/%s" % common_base.getid(snapshot))
def _do_force_delete(self, snapshot, action_name="... | path = "/snapshots%s" % (query_string,) | conditional_block |
generic.py | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... | def _verify_download(self, file_name=None):
"""
Checks the saved file to see if it was actually valid, if not then consider the download a failure.
"""
# primitive verification of torrents, just make sure we didn't get a text file or something
if self.providerType == G... | return self._verify_download(file_name)
| random_line_split |
generic.py | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... | (self):
self._checkAuth()
self.cache.updateCache()
return self.cache.findNeededEpisodes()
def getQuality(self, item):
"""
Figures out the quality of the given RSS item node
item: An elementtree.ElementTree element representing the <item> tag of ... | searchRSS | identifier_name |
generic.py | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... |
for item in itemList:
(title, url) = self._get_title_and_url(item)
# parse the file name
try:
myParser = NameParser(False)
parse_result = myParser.parse(title, True)
except InvalidNameException:
logger... | itemList += self._doSearch(cur_search_string, show=episode.show) | conditional_block |
generic.py | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... |
def imageName(self):
return self.getID() + '.png'
def _checkAuth(self):
return
def isActive(self):
if self.providerType == GenericProvider.NZB and sickbeard.USE_NZBS:
return self.isEnabled()
elif self.providerType == GenericProvider.TORRENT and sick... | return re.sub("[^\w\d_]", "_", name.strip().lower()) | identifier_body |
test_anonymous_user_permissions.py | import pytest
from ..base_test import SeleniumTestCase
from ..entities import Project, Organization
pytestmark = pytest.mark.skip
class AnonymousUserOrganizationView(SeleniumTestCase):
def test_anonymous_user_project_view(self):
self.open("")
self.wd.wait_for_css(".organizations")
self.... | self.open("")
self.wd.wait_for_css(".projects")
self.wd.find_element_by_link_text("Projects").click()
self.wd.wait_for_xpath("//h1[contains(text(), 'Projects')]")
self.wd.find_element_by_link_text(Project.get_test_proj_name()).click()
self.wd.wait_for_xpath("//h2[contains(text(),... | identifier_body | |
test_anonymous_user_permissions.py | import pytest
from ..base_test import SeleniumTestCase
from ..entities import Project, Organization
pytestmark = pytest.mark.skip
class AnonymousUserOrganizationView(SeleniumTestCase):
def test_anonymous_user_project_view(self):
self.open("")
self.wd.wait_for_css(".organizations")
self.... | "//h2[contains(text(), 'Organization Overview')]")
assert self.wd.find_element_by_xpath("//div/section/p")
class AnonymousUserProjectView(SeleniumTestCase):
def test_anonymous_user_project_view(self):
self.open("")
self.wd.wait_for_css(".projects")
self.wd.find_element... | self.wd.wait_for_xpath( | random_line_split |
test_anonymous_user_permissions.py | import pytest
from ..base_test import SeleniumTestCase
from ..entities import Project, Organization
pytestmark = pytest.mark.skip
class AnonymousUserOrganizationView(SeleniumTestCase):
def test_anonymous_user_project_view(self):
self.open("")
self.wd.wait_for_css(".organizations")
self.... | (self):
self.open("")
self.wd.wait_for_css(".projects")
self.wd.find_element_by_link_text("Projects").click()
self.wd.wait_for_xpath("//h1[contains(text(), 'Projects')]")
self.wd.find_element_by_link_text(Project.get_test_proj_name()).click()
self.wd.wait_for_xpath("//h2[... | test_anonymous_user_project_view | identifier_name |
webpack.config.js | "use strict";
var webpack = require('webpack');
var path = require('path');
var loaders = require('./webpack.loaders');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var DashboardPlugin = require('webpack-dashboard/plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
const HOST = process... | new DashboardPlugin(),
new HtmlWebpackPlugin({
template: './src/template.html',
files: {
css: ['style.css'],
js: [ "bundle.js"],
}
}),
]
}; | filename: 'style.css',
allChunks: true
}), | random_line_split |
LivroRouter.ts | import { LivroDAO } from '../domain/DAO/livroDAO';
import { Router, Request, Response, NextFunction } from 'express';
export class LivroRouter{
router: Router
| (){
this.router = Router();
this.init();
}
public async create(req: Request, res: Response, next: NextFunction ){
let Livros = new LivroDAO();
res.json(await Livros.persist(req.body.title,req.body.author));
}
public async findAll(req: Request, res: Response, next: NextFu... | constructor | identifier_name |
LivroRouter.ts | import { LivroDAO } from '../domain/DAO/livroDAO';
import { Router, Request, Response, NextFunction } from 'express';
export class LivroRouter{
router: Router
constructor(){
this.router = Router();
this.init();
}
public async create(req: Request, res: Response, next: NextFunction ){
... |
}
const livroRoutes = new LivroRouter();
livroRoutes.init();
export default livroRoutes.router; | {
this.router.get('/', this.findAll);
this.router.post('/create', this.create);
this.router.post('/findById', this.findById);
} | identifier_body |
LivroRouter.ts | import { LivroDAO } from '../domain/DAO/livroDAO';
import { Router, Request, Response, NextFunction } from 'express';
export class LivroRouter{
router: Router
constructor(){
this.router = Router();
this.init();
}
public async create(req: Request, res: Response, next: NextFunction ){
... | export default livroRoutes.router; | random_line_split | |
setup.py | from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'riak_repl', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from... |
with open(dep_file, encoding='utf-8') as f:
return f.readlines()
def parse_pyproject_array(name):
import os
import re
from ast import literal_eval
pattern = r'^{} = (\[.*?\])$'.format(name)
with open(os.path.join(HERE, 'pyproject.toml'), 'r', encoding='utf-8') as f:
# Windo... | return [] | conditional_block |
setup.py | from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'riak_repl', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from... |
CHECKS_BASE_REQ = parse_pyproject_array('dependencies')[0]
setup(
name='datadog-riak_repl',
version=ABOUT['__version__'],
description='The Riak_repl check',
long_description=long_description,
long_description_content_type='text/markdown',
keywords='datadog agent riak_repl check',
# The ... | import os
import re
from ast import literal_eval
pattern = r'^{} = (\[.*?\])$'.format(name)
with open(os.path.join(HERE, 'pyproject.toml'), 'r', encoding='utf-8') as f:
# Windows \r\n prevents match
contents = '\n'.join(line.rstrip() for line in f.readlines())
array = re.search(pa... | identifier_body |
setup.py | from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'riak_repl', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from... |
def parse_pyproject_array(name):
import os
import re
from ast import literal_eval
pattern = r'^{} = (\[.*?\])$'.format(name)
with open(os.path.join(HERE, 'pyproject.toml'), 'r', encoding='utf-8') as f:
# Windows \r\n prevents match
contents = '\n'.join(line.rstrip() for line in f.... | random_line_split | |
setup.py | from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'riak_repl', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from... | (name):
import os
import re
from ast import literal_eval
pattern = r'^{} = (\[.*?\])$'.format(name)
with open(os.path.join(HERE, 'pyproject.toml'), 'r', encoding='utf-8') as f:
# Windows \r\n prevents match
contents = '\n'.join(line.rstrip() for line in f.readlines())
array = ... | parse_pyproject_array | identifier_name |
flate.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (&mut self, _buf: &[u8]) { fail2!() }
fn flush(&mut self) { fail2!() }
}
impl<W: Writer> Decorator<W> for DeflateWriter<W> {
fn inner(self) -> W {
match self {
DeflateWriter { inner_writer: w } => w
}
}
fn inner_ref<'a>(&'a self) -> &'a W {
match *self {
... | write | identifier_name |
flate.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | InflateReader { inner_reader: ref r } => r
}
}
fn inner_mut_ref<'a>(&'a mut self) -> &'a mut R {
match *self {
InflateReader { inner_reader: ref mut r } => r
}
}
}
#[cfg(test)]
mod test {
use prelude::*;
use super::*;
use super::super::mem::*;
... | random_line_split | |
flate.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn inner_ref<'a>(&'a self) -> &'a R {
match *self {
InflateReader { inner_reader: ref r } => r
}
}
fn inner_mut_ref<'a>(&'a mut self) -> &'a mut R {
match *self {
InflateReader { inner_reader: ref mut r } => r
}
}
}
#[cfg(test)]
mod test {
... | {
match self {
InflateReader { inner_reader: r } => r
}
} | identifier_body |
setup.py | from setuptools import setup, find_packages
try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
import re, ast
# get version from __version__ variable in bench/__init__.py
_version_re = re.compile(r'__version__\s+=\... | author_email='info@frappe.io',
version=version,
packages=find_packages(),
zip_safe=False,
include_package_data=True,
install_requires=[str(ir.req) for ir in requirements],
dependency_links=[str(ir._link) for ir in requirements if ir._link],
entry_points='''
[console_scripts]
bench=bench.cli:cli
''',
) | author='Frappe Technologies', | random_line_split |
main.js | /*
Eventually by HTML5 UP
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/
(function() {
"use strict";
// Methods/polyfills.
// classList | (c) @remy | github.com/remy/polyfills | rem.mit-license.org
!function(){function t(t){this.el=t;for(var n=... | },toString:function(){return o.call(this," ")},toggle:function(t){return this.contains(t)?this.remove(t):this.add(t),this.contains(t)}},window.DOMTokenList=t,n(Element.prototype,"classList",function(){return new t(this)})}}();
// canUse
window.canUse=function(p){if(!window._canUse)window._canUse=document.createEl... | {for(var n=0;n<this.length&&this[n]!=t;n++);s.call(this,n,1),this.el.className=this.toString()} | conditional_block |
main.js | /*
Eventually by HTML5 UP
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/
(function() {
"use strict";
// Methods/polyfills.
// classList | (c) @remy | github.com/remy/polyfills | rem.mit-license.org
!function(){function | (t){this.el=t;for(var n=t.className.replace(/^\s+|\s+$/g,"").split(/\s+/),i=0;i<n.length;i++)e.call(this,n[i])}function n(t,n,i){Object.defineProperty?Object.defineProperty(t,n,{get:i}):t.__defineGetter__(n,i)}if(!("undefined"==typeof window.Element||"classList"in document.documentElement)){var i=Array.prototype,e=i.pu... | t | identifier_name |
main.js | /*
Eventually by HTML5 UP
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/
(function() {
"use strict";
// Methods/polyfills.
// classList | (c) @remy | github.com/remy/polyfills | rem.mit-license.org
!function(){function t(t){this.el=t;for(var n=... | var $body = document.querySelector('body');
// Disable animations/transitions until everything's loaded.
$body.classList.add('is-loading');
window.addEventListener('load', function() {
window.setTimeout(function() {
$body.classList.remove('is-loading');
}, 100);
});
})(); | // window.addEventListener
(function(){if("addEventListener"in window)return;window.addEventListener=function(type,f){window.attachEvent("on"+type,f)}})();
// Vars. | random_line_split |
main.js | /*
Eventually by HTML5 UP
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/
(function() {
"use strict";
// Methods/polyfills.
// classList | (c) @remy | github.com/remy/polyfills | rem.mit-license.org
!function(){function t(t) | function n(t,n,i){Object.defineProperty?Object.defineProperty(t,n,{get:i}):t.__defineGetter__(n,i)}if(!("undefined"==typeof window.Element||"classList"in document.documentElement)){var i=Array.prototype,e=i.push,s=i.splice,o=i.join;t.prototype={add:function(t){this.contains(t)||(e.call(this,t),this.el.className=this.to... | {this.el=t;for(var n=t.className.replace(/^\s+|\s+$/g,"").split(/\s+/),i=0;i<n.length;i++)e.call(this,n[i])} | identifier_body |
pyxpcom_test_tools.py | # test tools for the pyxpcom bindings
from xpcom import _xpcom
import unittest
# export a "getmemusage()" function that returns a useful "bytes used" count
# for the current process. Growth in this when doing the same thing over and
# over implies a leak.
try:
import win32api
import win32pdh
import win32... | ret = mod.suite()
else:
ret = unittest.TestLoader.loadTestsFromModule(self, mod)
assert ret.countTestCases() > 0, "No tests in %r" % (mod,)
return ret
def loadTestsFromName(self, name, module=None):
test = unittest.TestLoader.loadTestsFromName(self, name, modu... | # later! see pywin32's win32/test/util.py
return test
def loadTestsFromModule(self, mod):
if hasattr(mod, "suite"): | random_line_split |
pyxpcom_test_tools.py | # test tools for the pyxpcom bindings
from xpcom import _xpcom
import unittest
# export a "getmemusage()" function that returns a useful "bytes used" count
# for the current process. Growth in this when doing the same thing over and
# over implies a leak.
try:
import win32api
import win32pdh
import win32... | ():
global g_pdh_data
if g_pdh_data is None:
hq, hc = FindMyCounter()
g_pdh_data = hq, hc
hq, hc = g_pdh_data
return GetCounterValue(hq, hc)
# The public bit
if have_pdh:
getmemusage = pdh_getmemusage
else:
def getmemusage():
return 0
# Test runner utilities, including ... | pdh_getmemusage | identifier_name |
pyxpcom_test_tools.py | # test tools for the pyxpcom bindings
from xpcom import _xpcom
import unittest
# export a "getmemusage()" function that returns a useful "bytes used" count
# for the current process. Growth in this when doing the same thing over and
# over implies a leak.
try:
import win32api
import win32pdh
import win32... | print "********* WARNING - Leaving with %d/%d objects alive" % (ni,ng) | conditional_block | |
pyxpcom_test_tools.py | # test tools for the pyxpcom bindings
from xpcom import _xpcom
import unittest
# export a "getmemusage()" function that returns a useful "bytes used" count
# for the current process. Growth in this when doing the same thing over and
# over implies a leak.
try:
import win32api
import win32pdh
import win32... |
def CloseCounter(hq, hc):
win32pdh.RemoveCounter(hc)
win32pdh.CloseQuery(hq)
def GetCounterValue(hq, hc):
win32pdh.CollectQueryData(hq)
format = win32pdh.PDH_FMT_LONG
type, val = win32pdh.GetFormattedCounterValue(hc, format)
return val
g_pdh_data = None
# The pdh function that does the work
... | pid_me = win32api.GetCurrentProcessId()
object = "Process"
items, instances = win32pdh.EnumObjectItems(None,None,object, -1)
for instance in instances:
# We use 2 counters - "ID Process" and "Working Set"
counter = "ID Process"
format = win32pdh.PDH_FMT_LONG
hq = win32pdh.O... | identifier_body |
TL_57.js | /*************************************************************************
* tranSMART - translational medicine data mart
*
* Copyright 2008-2012 Janssen Research & Development, LLC.
*
* This product includes software developed at Janssen Research & Development, LLC. | *
* 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, along with the following terms:
* 1. You may convey a work based ... | random_line_split | |
praznici.spec.ts | import { PrazniciProvider } from './praznici';
let praznici: PrazniciProvider = null;
|
it('returns a date for Easter', () => {
expect(praznici.getVeligden(2017).valueOf()).toEqual(new Date(2017, 3, 16).valueOf());
});
it('expects that the winter Commemoration of the departed to be 59 days before Easter', () => {
let easter = praznici.getVeligden(2017).valueOf();
let zadushicaZimska = ... | describe('PrazniciProvider', () => {
beforeEach(() => {
praznici = new PrazniciProvider();
// spyOn(praznici['storage'], 'set').and.callThrough();
}); | random_line_split |
fileSearch.ts | /*
* Copyright 2017 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Creates the file search/filter request handler.
* @returns the request handler to handle search requests.
*/
export function createHandler(settings: common.AppSettings): http.RequestHandler {
appSettings = settings;
// Unless it has been explicitly disabled, always enable the filesystem index
// on GCP... | {
pattern = pattern.toLowerCase();
return data.filter((item) => {
return item.toLowerCase().indexOf(pattern) > -1;
});
} | identifier_body |
fileSearch.ts | /*
* Copyright 2017 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... | (request: http.ServerRequest, response: http.ServerResponse): void {
const parsedUrl = url.parse(request.url, true);
const pattern = parsedUrl.query['pattern'];
let results: string[] = [];
response.writeHead(200, { 'Content-Type': 'application/json' });
if (pattern !== undefined) {
let decodedPattern = d... | requestHandler | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.