file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
models.py
from django.conf import settings as dj_settings from django.db import models, transaction from django.core.signals import got_request_exception from django.http import Http404 from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ from djangodblog import settings from d...
else: Error.objects.create_from_exception(**extra) except Exception, exc: try: logger.exception(u'Unable to process log entry: %s' % (exc,)) except Exception, exc: warnings.warn(u'Unable to process log entry: %s' % (exc,)) cla...
logging.getLogger('dblog').critical(exc_value, exc_info=sys.exc_info(), extra=extra)
conditional_block
connection.py
.readline() while not data.endswith(SYM_LF): # there's more data in the socket that we need self._read_from_socket() buf.seek(self.bytes_read) data = buf.readline() self.bytes_read += len(data) # purge the buffer when we've consumed it ...
(self): return self.description_format % self._description_args def __del__(self): try: self.disconnect() except Exception: pass def register_connect_callback(self, callback): self._connect_callbacks.append(callback) def clear_connect_callbacks(self...
__repr__
identifier_name
connection.py
buffer.close() self._buffer = None self.encoding = None def can_read(self): return self._buffer and bool(self._buffer.length) def read_response(self): try: lgt = int(self._buffer.readline()) except ValueError: raise ConnectionErro...
output.append(SYM_EMPTY.join(pieces)) buffer_length = 0 pieces = []
conditional_block
connection.py
.readline() while not data.endswith(SYM_LF): # there's more data in the socket that we need self._read_from_socket() buf.seek(self.bytes_read) data = buf.readline() self.bytes_read += len(data) # purge the buffer when we've consumed it ...
class PythonParser(BaseParser): """ Plain Python parsing class """ encoding = None def __init__(self, socket_read_size): self.socket_read_size = socket_read_size self._sock = None self._buffer = None def __del__(self): try: self.on_disconnect() ...
self._sock = None
random_line_split
connection.py
class SocketBuffer(object): def __init__(self, socket, socket_read_size): self._sock = socket self.socket_read_size = socket_read_size self._buffer = BytesIO() # number of bytes written to the buffer from the socket self.bytes_written = 0 # number of bytes read fro...
EXCEPTION_CLASSES = { 'ERR': ResponseError, 'EXECABORT': ExecAbortError, 'LOADING': BusyLoadingError, 'NOSCRIPT': NoScriptError, } def parse_error(self, response): "Parse an error response" error_code = response.split(' ')[0] if error_code in self.EXCEPTI...
identifier_body
description.py
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
## This file defines parameters for a prediction experiment. import os from nupic.frameworks.opf.exp_description_helpers import importBaseDescription # the sub-experiment configuration config = \ { 'claEvalClassification': True, 'dataSource': 'file://' + os.path.join(os.path.dirname(__file__), ...
random_line_split
wrap_downscaler_cmip5_slurm_minmax.py
head = '#!/bin/sh\n' + \ '#SBATCH --ntasks=32\n' + \ '#SBATCH --nodes=1\n' + \ '#SBATCH --ntasks-per-node=32\n' + \ '#SBATCH --account=snap\n' + \ '#SBATCH --mail-type=FAIL\n' + \ '#SBATCH --mail-user=malindgren@alaska.edu\n' + \ '#SBATCH -p main\n' script_path = '/workspace/UA/malindgren/repos...
# # # # # # wrap downscaler for running on slurm # # # # # def run_model( fn, base_dir, variable, mean_variable, model, scenario, units, metric, level=None, level_name=None ): import os, subprocess
random_line_split
wrap_downscaler_cmip5_slurm_minmax.py
# # # # # # wrap downscaler for running on slurm # # # # # def run_model( fn, base_dir, variable, mean_variable, model, scenario, units, metric, level=None, level_name=None ): import os, subprocess head = '#!/bin/sh\n' + \ '#SBATCH --ntasks=32\n' + \ '#SBATCH --nodes=1\n' + \ '#SBATCH --ntasks-per-node=32\...
fn = os.path.join( path, 'slurm_run_downscaler_'+'_'.join([variable, model, scenario])+'.slurm' ) _ = run_model( fn, base_dir, variable, mean_variable, model, scenario, units, metric, level, level_name )
if variable == 'pr': units = 'mm' metric = 'total' level = None level_name = None elif variable in ['tas','tasmax','tasmin']: units = 'C' metric = 'mean' level = None level_name = None elif variable == 'hur': units = 'pct' metric = 'mean' level = str(16) # 1000mb level_name = 'pl...
conditional_block
wrap_downscaler_cmip5_slurm_minmax.py
# # # # # # wrap downscaler for running on slurm # # # # # def run_model( fn, base_dir, variable, mean_variable, model, scenario, units, metric, level=None, level_name=None ):
f.writelines( head + "\n" + command + '\n' ) subprocess.call([ 'sbatch', fn ]) return 1 if __name__ == '__main__': import os, glob, itertools, subprocess base_dir = '/workspace/Shared/Tech_Projects/DeltaDownscaling/project_data' models = [ 'GFDL-CM3', 'IPSL-CM5A-LR', 'MRI-CGCM3', 'GISS-E2-R', 'CCSM4' ] vari...
import os, subprocess head = '#!/bin/sh\n' + \ '#SBATCH --ntasks=32\n' + \ '#SBATCH --nodes=1\n' + \ '#SBATCH --ntasks-per-node=32\n' + \ '#SBATCH --account=snap\n' + \ '#SBATCH --mail-type=FAIL\n' + \ '#SBATCH --mail-user=malindgren@alaska.edu\n' + \ '#SBATCH -p main\n' script_path = '/workspa...
identifier_body
wrap_downscaler_cmip5_slurm_minmax.py
# # # # # # wrap downscaler for running on slurm # # # # # def
( fn, base_dir, variable, mean_variable, model, scenario, units, metric, level=None, level_name=None ): import os, subprocess head = '#!/bin/sh\n' + \ '#SBATCH --ntasks=32\n' + \ '#SBATCH --nodes=1\n' + \ '#SBATCH --ntasks-per-node=32\n' + \ '#SBATCH --account=snap\n' + \ '#SBATCH --mail-type=FAIL\n' +...
run_model
identifier_name
assign_bit.rs
use malachite_base::num::conversion::traits::ExactFrom; use malachite_base::num::logic::traits::BitAccess; use malachite_base_test_util::bench::bucketers::pair_2_triple_2_bucketer; use malachite_base_test_util::bench::{run_benchmark, BenchmarkType}; use malachite_base_test_util::generators::common::{GenConfig, GenMode}...
fn demo_natural_assign_bit(gm: GenMode, config: GenConfig, limit: usize) { for (mut n, index, bit) in natural_unsigned_bool_triple_gen_var_1() .get(gm, &config) .take(limit) { let n_old = n.clone(); n.assign_bit(index, bit); println!( "x := {}; x.assign_bit(...
{ register_demo!(runner, demo_natural_assign_bit); register_bench!(runner, benchmark_natural_assign_bit_library_comparison); }
identifier_body
assign_bit.rs
use malachite_base::num::conversion::traits::ExactFrom; use malachite_base::num::logic::traits::BitAccess; use malachite_base_test_util::bench::bucketers::pair_2_triple_2_bucketer; use malachite_base_test_util::bench::{run_benchmark, BenchmarkType}; use malachite_base_test_util::generators::common::{GenConfig, GenMode}...
(runner: &mut Runner) { register_demo!(runner, demo_natural_assign_bit); register_bench!(runner, benchmark_natural_assign_bit_library_comparison); } fn demo_natural_assign_bit(gm: GenMode, config: GenConfig, limit: usize) { for (mut n, index, bit) in natural_unsigned_bool_triple_gen_var_1() .get(gm...
register
identifier_name
assign_bit.rs
use malachite_base::num::conversion::traits::ExactFrom; use malachite_base::num::logic::traits::BitAccess; use malachite_base_test_util::bench::bucketers::pair_2_triple_2_bucketer; use malachite_base_test_util::bench::{run_benchmark, BenchmarkType}; use malachite_base_test_util::generators::common::{GenConfig, GenMode}...
BenchmarkType::LibraryComparison, natural_unsigned_bool_triple_gen_var_1_rm().get(gm, &config), gm.name(), limit, file_name, &pair_2_triple_2_bucketer("index"), &mut [ ("Malachite", &mut |(_, (mut n, index, bit))| { n.assign_bit(index, ...
random_line_split
producertask.py
""" Copyright 2015-2018 IBM Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
@asyncio.coroutine def run(self): print('The producer has started') while self.running: message = 'This is a test message #{0}'.format(self.counter) key = 'key' sleep = 2 # Short sleep for flow control try: self.producer.produce(se...
rint('Message produced, offset: {0}'.format(msg.offset()))
conditional_block
producertask.py
""" Copyright 2015-2018 IBM Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
self): print('The producer has started') while self.running: message = 'This is a test message #{0}'.format(self.counter) key = 'key' sleep = 2 # Short sleep for flow control try: self.producer.produce(self.topic_name, message, key, -1, sel...
un(
identifier_name
producertask.py
""" Copyright 2015-2018 IBM Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
self.counter = 0 self.running = True def stop(self): self.running = False def on_delivery(self, err, msg): if err: print('Delivery report: Failed sending message {0}'.format(msg.value())) print(err) # We could retry sending the message ...
def __init__(self, conf, topic_name): self.topic_name = topic_name self.producer = Producer(conf)
random_line_split
producertask.py
""" Copyright 2015-2018 IBM Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
rint('The producer has started') while self.running: message = 'This is a test message #{0}'.format(self.counter) key = 'key' sleep = 2 # Short sleep for flow control try: self.producer.produce(self.topic_name, message, key, -1, self.on_delivery) ...
identifier_body
sg-ski.py
#!/usr/bin/env python import sys def parse_map_file(path): map_grid = [] # Create a two-dimensional list based on the input data with open(path, 'r') as f: width, height = map(int, f.readline().split()) for line in f: row = map(int, line.split()) map_grid.append(row...
(): if len(sys.argv) != 2: sys.exit('Usage: {} <map file>'.format(sys.argv[0])) print 'Parsing map data...' try: width, height, map_grid = parse_map_file(sys.argv[1]) except IOError as e: sys.exit('Unable to read map file: {}'.format(e)) except ValueError as e: sys.e...
main
identifier_name
sg-ski.py
#!/usr/bin/env python import sys def parse_map_file(path): map_grid = [] # Create a two-dimensional list based on the input data with open(path, 'r') as f: width, height = map(int, f.readline().split()) for line in f: row = map(int, line.split()) map_grid.append(row...
def make_grid(width, height, initial_value): return [width*[initial_value] for i in range(height)] def get_length_and_elevation(x, y, map_grid, path_lengths, final_elevations): path_length = path_lengths[y][x] if path_length != -1: return path_length, final_elevations[y][x] current_elevation ...
random_line_split
sg-ski.py
#!/usr/bin/env python import sys def parse_map_file(path): map_grid = [] # Create a two-dimensional list based on the input data with open(path, 'r') as f: width, height = map(int, f.readline().split()) for line in f: row = map(int, line.split()) map_grid.append(row...
path_length = longest_path + 1 path_lengths[y][x] = path_length final_elevations[y][x] = lowest_elevation return path_length, lowest_elevation def main(): if len(sys.argv) != 2: sys.exit('Usage: {} <map file>'.format(sys.argv[0])) print 'Parsing map data...' try: width, ...
path_length, final_elevation = get_length_and_elevation(xn, yn, map_grid, path_lengths, final_elevations) if path_length > longest_path or (path_length == longest_path and final_elevation < lowest_elevation): longest_path = path_length lowest_elevation = final_elevation
conditional_block
sg-ski.py
#!/usr/bin/env python import sys def parse_map_file(path): map_grid = [] # Create a two-dimensional list based on the input data with open(path, 'r') as f: width, height = map(int, f.readline().split()) for line in f: row = map(int, line.split()) map_grid.append(row...
path_length, final_elevation = get_length_and_elevation(xn, yn, map_grid, path_lengths, final_elevations) if path_length > longest_path or (path_length == longest_path and final_elevation < lowest_elevation): longest_path = path_length lowest_elevation = final_ele...
path_length = path_lengths[y][x] if path_length != -1: return path_length, final_elevations[y][x] current_elevation = map_grid[y][x] longest_path = 0 lowest_elevation = current_elevation neighbors = [ (x, y - 1), # up (x, y + 1), # down (x - 1, y), # left (x...
identifier_body
lib.rs
// Copyright 2015 The Gfx-rs Developers. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
/// Render commands encoder mod encoder; /// Factory extensions mod factory; /// Meshes mod mesh; /// Pipeline states pub mod pso; /// Shaders pub mod shade; /// Convenience macros pub mod macros;
Sampler, TextureSampler}; pub use pso::target::{DepthStencilTarget, DepthTarget, StencilTarget, RenderTarget, RawRenderTarget, BlendTarget, BlendRef, Scissor};
random_line_split
error_handling.py
from itty import * @error(500) def my_great_500(request, exception): html_output = """ <html> <head> <title>Application Error! OH NOES!</title> </head> <body> <h1>OH NOES!</h1> <p>Yep, you broke it.</p> <...
(request): raise Forbidden('No soup for you!') return 'This should never happen either either either.' @get('/test_redirect') def test_redirect(request): raise Redirect('/hello') run_itty()
test_403
identifier_name
error_handling.py
from itty import * @error(500) def my_great_500(request, exception): html_output = """ <html> <head> <title>Application Error! OH NOES!</title> </head>
<h1>OH NOES!</h1> <p>Yep, you broke it.</p> <p>Exception: %s</p> </body> </html> """ % exception response = Response(html_output, status=500) return response.send(request._start_response) @get('/hello') def hello(request): return...
<body>
random_line_split
error_handling.py
from itty import * @error(500) def my_great_500(request, exception): html_output = """ <html> <head> <title>Application Error! OH NOES!</title> </head> <body> <h1>OH NOES!</h1> <p>Yep, you broke it.</p> <...
@get('/test_500') def test_500(request): raise AppError('Oops.') return 'This should never happen either.' @get('/test_other') def test_other(request): raise RuntimeError('Oops.') return 'This should never happen either either.' @get('/test_403') def test_403(request): raise Forbidden('No soup f...
raise NotFound('Not here, sorry.') return 'This should never happen.'
identifier_body
parse-line-number-range.js
const rangeParser = require(`parse-numeric-range`) module.exports = language => {
let [splitLanguage, ...options] = language.split(`{`) let highlightLines = [], numberLines = false, numberLinesStartAt // Options can be given in any order and are optional options.forEach(option => { option = option.slice(0, -1) // Test if the option is for line hightlighting ...
if (!language) { return `` } if (language.split(`{`).length > 1) {
random_line_split
parse-line-number-range.js
const rangeParser = require(`parse-numeric-range`) module.exports = language => { if (!language) { return `` } if (language.split(`{`).length > 1)
Number.isInteger(parseInt(option[1].trim(), 10))) ) { numberLines = true numberLinesStartAt = option[1].trim() === `true` ? 1 : parseInt(option[1].trim(), 10) } }) return { splitLanguage, highlightLines, numberLines, numberLinesStartAt, ...
{ let [splitLanguage, ...options] = language.split(`{`) let highlightLines = [], numberLines = false, numberLinesStartAt // Options can be given in any order and are optional options.forEach(option => { option = option.slice(0, -1) // Test if the option is for line hightlighting ...
conditional_block
DimensionSubset.ts
/* * This file is part of rasdaman community. * * Rasdaman community 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. * * Rasdam...
(dimension:string) { this.Dimension = dimension; } public toKVP():string { throw new rasdaman.common.NotImplementedException(); } } }
constructor
identifier_name
DimensionSubset.ts
/* * This file is part of rasdaman community.
* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Rasdaman community is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GN...
* * Rasdaman community is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
random_line_split
analytics.effects.ts
import { Store } from '@ngrx/store'; import { Injectable } from '@angular/core'; import { Effect, Actions, ofType } from '@ngrx/effects'; import { UserProfileActions } from '@store/user-profile'; import * as PlayerSearch from '@store/player-search'; import { ActionTypes } from '@store/app-player'; import * as AppCore ...
PlayerSearch.PlayerSearchActions.SEARCH_MORE_FOR_QUERY ), map(toPayload), withLatestFrom(this.store.select(PlayerSearch.getSearchType)), tap((states: any[]) => this.analytics.trackSearch(states[1].presets)) ); @Effect({ dispatch: false }) trackPlay$ = this.actions$.pipe( ofType(ActionTy...
@Effect({ dispatch: false }) trackSearch$ = this.actions$.pipe( ofType( PlayerSearch.PlayerSearchActions.SEARCH_NEW_QUERY,
random_line_split
analytics.effects.ts
import { Store } from '@ngrx/store'; import { Injectable } from '@angular/core'; import { Effect, Actions, ofType } from '@ngrx/effects'; import { UserProfileActions } from '@store/user-profile'; import * as PlayerSearch from '@store/player-search'; import { ActionTypes } from '@store/app-player'; import * as AppCore ...
{ constructor( private actions$: Actions, private store: Store<EchoesState>, private userProfileActions: UserProfileActions, private analytics: AnalyticsService ) {} @Effect({ dispatch: false }) trackToken$ = this.actions$.pipe( ofType(UserProfileActions.USER_PROFILE_RECIEVED), map(toP...
AnalyticsEffects
identifier_name
pattern.py
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Tiger Soldier # # This file is part of OSD Lyrics. # # OSD Lyrics 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...
elif tag in keys: value = getattr(metadata, keys[tag]) if not value: raise PatternException('%s not in metadata' % keys[tag]) has_tag = True parts.append(value) if has_tag: st...
tion = metadata.location if not location: raise PatternException('Location not found in metadata') uri = urlparse.urlparse(location) if uri.scheme != '' and not uri.scheme in ['file']: raise PatternException('Uns...
conditional_block
pattern.py
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Tiger Soldier # # This file is part of OSD Lyrics. # # OSD Lyrics 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...
... 'tracknumber': '1', ... 'album': 'Album', ... 'location': 'file:///%E6%AD%8C%E6%9B%B2/%E7%9A%84/%E5%9C%B0%E5%9D%80.mp3'} >>> expand_file('%p - %t', metadata) 'Foo - Bar' >>> expand_file('foobar', metadata) 'foobar' >>> print expand_file('name is %f :)', metadata) name is 地址 :) ...
""" Expands the pattern to a file name according to the infomation of a music The following are supported place holder in the pattern: - %t: Title of the track. 'title' in metadata - %p: Performer (artist) of the music. 'artist' in metadata - %a: Album of the music. 'album' in metadata - %n: Tr...
identifier_body
pattern.py
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Tiger Soldier # # This file is part of OSD Lyrics. # # OSD Lyrics 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...
'%something else' >>> expand_file('%%a - %%t', metadata) '%a - %t' >>> expand_file('%%%', metadata) '%%' >>> expand_file('%n - %a:%p,%t', metadata) '1 - Album:Foo,Bar' >>> expand_file('%t', {}) Traceback (most recent call last): ... PatternException: 'title not in metadat...
'foobar' >>> print expand_file('name is %f :)', metadata) name is 地址 :) >>> expand_file('%something else', metadata)
random_line_split
pattern.py
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Tiger Soldier # # This file is part of OSD Lyrics. # # OSD Lyrics 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...
tern, metadata): """ Expands the pattern to a directory path according to the infomation of a music The pattern can be one of the three forms: - begin with `/': the path is an absolute path and will not be expanded - begin with `~/': the path is an relative path and the `~' wiil be expanded to ...
nd_path(pat
identifier_name
lib.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
//! //! This API is completely unstable and subject to change. // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "rustc_trans"] #![unstable(feature = "rustc_private")] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib...
//! //! # Note
random_line_split
auth.py
# Copyright (c) 2013 OpenStack, LLC. # # 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 req...
(auth.ManilaKeystoneContext): def __init__(self, application): LOG.warn(_LW('manila.api.auth:ManilaKeystoneContext is deprecated. ' 'Please use ' 'manila.api.middleware.auth:ManilaKeystoneContext ' 'instead.')) super(ManilaKeystoneContex...
ManilaKeystoneContext
identifier_name
auth.py
# Copyright (c) 2013 OpenStack, LLC. # # 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 req...
def __init__(self, application): LOG.warn(_LW('manila.api.auth:ManilaKeystoneContext is deprecated. ' 'Please use ' 'manila.api.middleware.auth:ManilaKeystoneContext ' 'instead.')) super(ManilaKeystoneContext, self).__init__(application)...
class ManilaKeystoneContext(auth.ManilaKeystoneContext):
random_line_split
auth.py
# Copyright (c) 2013 OpenStack, LLC. # # 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 req...
def pipeline_factory(loader, global_conf, **local_conf): LOG.warn(_LW('manila.api.auth:pipeline_factory is deprecated. Please use ' 'manila.api.middleware.auth:pipeline_factory instead.')) auth.pipeline_factory(loader, global_conf, **local_conf)
def __init__(self, application): LOG.warn(_LW('manila.api.auth:ManilaKeystoneContext is deprecated. ' 'Please use ' 'manila.api.middleware.auth:ManilaKeystoneContext ' 'instead.')) super(ManilaKeystoneContext, self).__init__(application)
identifier_body
lib.rs
// Copyright 2016 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 ...
{ Layout, Ptr, ResultPtr, Unit, Usize, }
AllocatorTy
identifier_name
lib.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub output: AllocatorTy, } pub enum AllocatorTy { Layout, Ptr, ResultPtr, Unit, Usize, }
pub inputs: &'static [AllocatorTy],
random_line_split
url_builder.rs
_ => None, }) .collect() } } /// Builder for an efficient url value replacer. pub struct UrlBuilder<'a> { path: Vec<PathPart<'a>>, parts: &'a BTreeMap<String, Type>, } impl<'a> UrlBuilder<'a> { pub fn new(path: &'a Path) -> Self { let path_parts = path.path.split(); ...
into_expr
identifier_name
url_builder.rs
8], &str) { if i[0] == b'{' { let i = shift(i, 1); take_while(i, |c| c != b'}') } else { take_while(i, |c| c != b'}') } } } enum PathParseState { Literal, Param, } /// A part of a Path #[derive(Debug, PartialEq)] pub enum PathPart<'a> { Liter...
{ url.iter() .map(|p| match *p { PathPart::Literal(p) => { let lit = syn::Lit::Str(p.to_string(), syn::StrStyle::Cooked); syn::Stmt::Semi(Box::new(parse_expr(quote!(#url_ident.push_str(#lit))))) } PathPart::Param...
identifier_body
url_builder.rs
], &str) { if i[0] == b'{' { let i = shift(i, 1); take_while(i, |c| c != b'}') } else { take_while(i, |c| c != b'}') } } } enum PathParseState { Literal, Param, } /// A part of a Path #[derive(Debug, PartialEq)] pub enum PathPart<'a> { Litera...
.collect() }
random_line_split
lib.es2015.symbol.wellknown.d.ts
compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR...
interface Int16Array { readonly [Symbol.toStringTag]: "Int16Array"; } interface Uint16Array { readonly [Symbol.toStringTag]: "Uint16Array"; } interface Int32Array { readonly [Symbol.toStringTag]: "Int32Array"; } interface Uint32Array { readonly [Symbol.toStringTag]: "Uint32Array"; }
interface Uint8ClampedArray { readonly [Symbol.toStringTag]: "Uint8ClampedArray"; }
random_line_split
authentication.js
const express = require('express'); const router = express.Router(); const bodyParser = require('body-parser');
const { signOutUser } = require('../../models/helper-functions'); const user = require('../../models/users'); const reviews = require('../../models/reviews'); const urlEncodedParser = bodyParser.urlencoded({ extended: false }); router.get('/sign-up', (req, res) => { res.render('sign-up', { error: false }); }); rou...
const { validateSignInForm, isLoggedIn } = require('../middlewares/validation');
random_line_split
Sink.ts
import {IBehavior} from './types' class Sink implements IBehavior { x: number y: number c: number static c = 0.0000001 constructor() { this.x = 0 this.y = 0 this.c = Sink.c } setIntensity(n: number) {
this.y = y } update(_: number, x: number, y: number, data: Float32Array, offset: number) { const dx = this.x - x const dy = this.y - y const distance = Math.sqrt(dx ** 2 + dy ** 2) const fx = this.c * dx * distance const fy = this.c * dy * distance data[offset + 2] += fx data[offs...
this.c = n * Sink.c } setCenter(x: number, y: number) { this.x = x
random_line_split
Sink.ts
import {IBehavior} from './types' class Sink implements IBehavior { x: number y: number c: number static c = 0.0000001 constructor() { this.x = 0 this.y = 0 this.c = Sink.c } setIntensity(n: number) { this.c = n * Sink.c } setCenter(x: number, y: number) { this.x = x this....
} export default Sink
{ const dx = this.x - x const dy = this.y - y const distance = Math.sqrt(dx ** 2 + dy ** 2) const fx = this.c * dx * distance const fy = this.c * dy * distance data[offset + 2] += fx data[offset + 3] += fy }
identifier_body
Sink.ts
import {IBehavior} from './types' class Sink implements IBehavior { x: number y: number c: number static c = 0.0000001 constructor() { this.x = 0 this.y = 0 this.c = Sink.c }
(n: number) { this.c = n * Sink.c } setCenter(x: number, y: number) { this.x = x this.y = y } update(_: number, x: number, y: number, data: Float32Array, offset: number) { const dx = this.x - x const dy = this.y - y const distance = Math.sqrt(dx ** 2 + dy ** 2) const fx = this.c *...
setIntensity
identifier_name
forms.py
#!/usr/bin/env python from django import forms from django.utils.translation import ugettext_lazy as _ from django.utils.html import format_html from django.forms.util import flatatt from django.utils.encoding import force_text from mezzanine.conf import settings from cartridge.shop.forms import OrderForm from cartri...
self.fields["card_number"].widget = DataEncryptedTextInput() self.fields["card_ccv"].widget = DataEncryptedPasswordInput()
conditional_block
forms.py
#!/usr/bin/env python from django import forms from django.utils.translation import ugettext_lazy as _ from django.utils.html import format_html from django.forms.util import flatatt from django.utils.encoding import force_text from mezzanine.conf import settings from cartridge.shop.forms import OrderForm from cartri...
class BraintreeOrderForm(OrderForm): """ The following changes are made to the cartridge order form: - Shipping and Billing country fields are rendered using a Select widget. This ensures the country selected can be converted to a valid code for Braintree's payment processing. - Credit Car...
input_type = 'password'
identifier_body
forms.py
#!/usr/bin/env python from django import forms from django.utils.translation import ugettext_lazy as _ from django.utils.html import format_html from django.forms.util import flatatt from django.utils.encoding import force_text from mezzanine.conf import settings from cartridge.shop.forms import OrderForm from cartri...
(forms.TextInput): def render(self, name, value, attrs=None): # See django.forms.widgets.py, # class Input, method render() if value is None: value = '' if attrs is None: attrs = {} attrs['name'] = name attrs['autocomplete'] = 'off' att...
DataEncryptedTextInput
identifier_name
forms.py
#!/usr/bin/env python from django import forms from django.utils.translation import ugettext_lazy as _ from django.utils.html import format_html
from cartridge.shop import checkout from cartridge.shop.utils import make_choices from cartridge_braintree.countries import get_country_names_list class DataEncryptedTextInput(forms.TextInput): def render(self, name, value, attrs=None): # See django.forms.widgets.py, # class Input, method render()...
from django.forms.util import flatatt from django.utils.encoding import force_text from mezzanine.conf import settings from cartridge.shop.forms import OrderForm
random_line_split
home.js
/* * Copyright 2020 Verizon Media * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed t...
({ req }) { let api = API(req); let reload = false; let error = null; const domains = await Promise.all([ api.listUserDomains(), api.getHeaderDetails(), api.getPendingDomainMembersList(), ]).catch((err) => { let response = RequestUt...
getInitialProps
identifier_name
home.js
/* * Copyright 2020 Verizon Media * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed t...
const AppContainerDiv = styled.div` align-items: stretch; flex-flow: row nowrap; height: 100%; display: flex; justify-content: flex-start; `; const MainContentDiv = styled.div` flex: 1 1 calc(100vh - 60px); overflow: hidden; font: 300 14px HelveticaNeue-Reg, Helvetica, Arial, sans-serif...
`;
random_line_split
home.js
/* * Copyright 2020 Verizon Media * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed t...
if (this.props.error) { return <Error err={this.props.error} />; } return ( <CacheProvider value={this.cache}> <div data-testid='home'> <Head> <title>Athenz</title> </Head> ...
{ window.location.reload(); return <div />; }
conditional_block
out-of-stack-new-thread-no-split.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...
() { let args = os::args(); let args = args; if args.len() > 1 && args[1] == "recurse" { let _t = Thread::scoped(recurse); } else { let recurse = Command::new(&args[0]).arg("recurse").output().unwrap(); assert!(!recurse.status.success()); let error = String::from_utf8_los...
main
identifier_name
out-of-stack-new-thread-no-split.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...
// lifted from the test module // Inlining to avoid llvm turning the recursive functions into tail calls, // which doesn't consume stack. #[inline(always)] #[no_stack_check] pub fn black_box<T>(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } #[no_stack_check] fn recurse() { let buf = [0; 10]; black_box(buf)...
use std::thread::Thread;
random_line_split
out-of-stack-new-thread-no-split.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...
#[no_stack_check] fn recurse() { let buf = [0; 10]; black_box(buf); recurse(); } fn main() { let args = os::args(); let args = args; if args.len() > 1 && args[1] == "recurse" { let _t = Thread::scoped(recurse); } else { let recurse = Command::new(&args[0]).arg("recurse").o...
{ unsafe { asm!("" : : "r"(&dummy)) } }
identifier_body
out-of-stack-new-thread-no-split.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...
}
{ let recurse = Command::new(&args[0]).arg("recurse").output().unwrap(); assert!(!recurse.status.success()); let error = String::from_utf8_lossy(&recurse.error); println!("wut"); println!("`{}`", error); assert!(error.contains("has overflowed its stack")); }
conditional_block
infotemplate.py
HOSTINFO = { 'location': '', 'hostname': '', 'hostid': '', 'ip': '', 'dns': '',
'services': '' }, 'isagent': 'yes', 'proxy': '', 'snmpstring': '', 'services': '', 'web_check_name': '', 'web_application': 'Web checks', 'web_delay': '', 'web_retries': '', 'web_agent': 'Zabbix', 'web_variables': '', 'web_step_name': '', 'web_step_url': '', ...
'groups': [], 'templates': { 'os': '',
random_line_split
spike_reset.py
#!/usr/bin/env python #encoding: utf-8 import numpy as np from pylab import * dt=0.01 # msec tau=40.0 # msec tmax=1000 # msec V_spk=-20 V_thres=-50.0 V_reset=-70.0 E_leak=V_reset R_m=10.0 # MΩ tt=np.arange(0, tmax, dt) #0:dt:tmax Nt=len(tt) #length(tt) V=np.zeros((Nt,)) V2=np.zeros((Nt,)) S=np.zeros((Nt,)) S2=np.zero...
k2=np.nonzero(S2>0)[0] Nspk2=len(k2) subplot(nrows,1,2) color = cmap(i_super/float(Nsuper)) colors.append(color) plot(tt,V2,'-',zorder=-Nsuper+i_super,lw=LW,c=color) if plot_spikes: hold(True) plot([k2*dt]*2, [V_reset,V_spk], '-',zorder=-Nsuper+i_super,c=color,lw=LW) ti...
2[i]=V_reset S2[i]=1
conditional_block
spike_reset.py
#!/usr/bin/env python #encoding: utf-8 import numpy as np from pylab import * dt=0.01 # msec tau=40.0 # msec tmax=1000 # msec V_spk=-20 V_thres=-50.0 V_reset=-70.0 E_leak=V_reset R_m=10.0 # MΩ tt=np.arange(0, tmax, dt) #0:dt:tmax Nt=len(tt) #length(tt) V=np.zeros((Nt,)) V2=np.zeros((Nt,)) S=np.zeros((Nt,)) S2=np.zero...
I_const=I_e(theta_freq) # 2.0578580 # 2.1 # constant current print 'I_const = %.4f nA'%I_const Dt=25 # msec: STDP half window n=int(Dt/dt) hPlus=1.0*I_const # max height hMinus=2.0*hPlus dI=np.r_[np.linspace(0,hPlus,n),0,np.linspace(-hMinus,0,n)] ## first simulation V[0]=V_reset for i in xrange(1, Nt): #=2:Nt ...
au_isi = 1000.0/f return -(1/R_m) * (E_leak + (V_reset - V_thres*exp(tau_isi/tau))/(exp(tau_isi/tau) - 1))
identifier_body
spike_reset.py
#!/usr/bin/env python #encoding: utf-8 import numpy as np from pylab import * dt=0.01 # msec tau=40.0 # msec tmax=1000 # msec V_spk=-20 V_thres=-50.0 V_reset=-70.0 E_leak=V_reset R_m=10.0 # MΩ tt=np.arange(0, tmax, dt) #0:dt:tmax Nt=len(tt) #length(tt) V=np.zeros((Nt,)) V2=np.zeros((Nt,)) S=np.zeros((Nt,)) S2=np.zero...
# yp=np.polyval(p,x) # plot(x,yp,'r-',zorder=0) # plot(X,Y,'b-',lw=1,zorder=0) ylabel(r'Phase Reset ($\pi$)') ax = gca() ax.set_xticks(linspace(-1, 1, 5)) ax.set_yticks(linspace(-1, 1, 5)) axis('equal') axis('image') xlim(midX-1.2, midX+1.2) ylim(-1.2, 1.2) ion() show()
print X[i_super],Y[i_super] # p=np.polyfit(x,y,1)
random_line_split
spike_reset.py
#!/usr/bin/env python #encoding: utf-8 import numpy as np from pylab import * dt=0.01 # msec tau=40.0 # msec tmax=1000 # msec V_spk=-20 V_thres=-50.0 V_reset=-70.0 E_leak=V_reset R_m=10.0 # MΩ tt=np.arange(0, tmax, dt) #0:dt:tmax Nt=len(tt) #length(tt) V=np.zeros((Nt,)) V2=np.zeros((Nt,)) S=np.zeros((Nt,)) S2=np.zero...
f): tau_isi = 1000.0/f return -(1/R_m) * (E_leak + (V_reset - V_thres*exp(tau_isi/tau))/(exp(tau_isi/tau) - 1)) I_const=I_e(theta_freq) # 2.0578580 # 2.1 # constant current print 'I_const = %.4f nA'%I_const Dt=25 # msec: STDP half window n=int(Dt/dt) hPlus=1.0*I_const # max height hMinus=2.0*hPlus dI=np....
_e(
identifier_name
nsiqcppstyle_unittestbase.py
# Copyright (c) 2009 NHN 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 code must retain the above copyright # notice, this list of conditions and the follow...
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIA...
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
random_line_split
nsiqcppstyle_unittestbase.py
# Copyright (c) 2009 NHN 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 code must retain the above copyright # notice, this list of conditions and the follow...
nsiqcppstyle_checker.ProcessFile(nsiqcppstyle_rulemanager.ruleManager, filename, data)
identifier_body
nsiqcppstyle_unittestbase.py
# Copyright (c) 2009 NHN 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 code must retain the above copyright # notice, this list of conditions and the follow...
(unittest.TestCase): def setUp(self): nsiqcppstyle_rulemanager.ruleManager.ResetRules() nsiqcppstyle_rulemanager.ruleManager.ResetRegisteredRules() nsiqcppstyle_state._nsiqcppstyle_state.verbose = True nsiqcppstyle_reporter.Error = MockError self.setUpRule() global er...
nct
identifier_name
nsiqcppstyle_unittestbase.py
# Copyright (c) 2009 NHN 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 code must retain the above copyright # notice, this list of conditions and the follow...
return False def MockError(token, category, message): AddError((token, category, message)) print token, category, message class nct(unittest.TestCase): def setUp(self): nsiqcppstyle_rulemanager.ruleManager.ResetRules() nsiqcppstyle_rulemanager.ruleManager.ResetRegisteredRules() ...
if err[1] == msg : return True
conditional_block
java.awt.geom.Rectangle2D$Double.d.ts
declare namespace java { namespace awt { namespace geom { class Rectangle2D$Double extends java.awt.geom.Rectangle2D implements java.io.Serializable { public x: double public y: double public width: double public height: double public constructor() public con...
}
random_line_split
java.awt.geom.Rectangle2D$Double.d.ts
declare namespace java { namespace awt { namespace geom { class
extends java.awt.geom.Rectangle2D implements java.io.Serializable { public x: double public y: double public width: double public height: double public constructor() public constructor(arg0: number | java.lang.Double, arg1: number | java.lang.Double, arg2: number | java....
Rectangle2D$Double
identifier_name
getRequestParametersIdentifier.js
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format */ 'use strict'; const invariant = require('invariant'); const stableCopy = require('./stableCop...
( parameters: RequestParameters, variables: Variables, ): Identifier { const requestID = parameters.id != null ? parameters.id : parameters.text; invariant( requestID != null, 'getRequestParametersIdentifier: Expected request `%s` to have either a ' + 'valid `id` or `text` property', parameter...
getRequestParametersIdentifier
identifier_name
getRequestParametersIdentifier.js
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format */ 'use strict'; const invariant = require('invariant'); const stableCopy = require('./stableCop...
module.exports = getRequestParametersIdentifier;
{ const requestID = parameters.id != null ? parameters.id : parameters.text; invariant( requestID != null, 'getRequestParametersIdentifier: Expected request `%s` to have either a ' + 'valid `id` or `text` property', parameters.name, ); return requestID + JSON.stringify(stableCopy(variables)); ...
identifier_body
getRequestParametersIdentifier.js
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format */ 'use strict'; const invariant = require('invariant'); const stableCopy = require('./stableCop...
'getRequestParametersIdentifier: Expected request `%s` to have either a ' + 'valid `id` or `text` property', parameters.name, ); return requestID + JSON.stringify(stableCopy(variables)); } module.exports = getRequestParametersIdentifier;
const requestID = parameters.id != null ? parameters.id : parameters.text; invariant( requestID != null,
random_line_split
testoai.py
# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You sh...
# Copyright (C) 2014 Antonin Delpeuch # # 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 2
random_line_split
testoai.py
; 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 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY;...
records.add(OaiRecord.objects.get(identifier=second_id)) self.assertEqual(set(new_paper.oairecords), records) def test_update_pdf_url(self): """ Two OAI records share the same splash URL, but the second one has a pdf_url. We should add the PDF url to the existing O...
""" Addition of an OAI record when it is matched to an existing paper by DOI """ first_id='ftunivmacedonia:oai:dspace.lib.uom.gr:2159/6240' second_id='oai:crossref.org:10.1111/j.1574-0862.2005.00325.x' # first, make sure the paper isn't there already self.delete(...
identifier_body
testoai.py
; 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 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY;...
def test_create_invalid_identifier(self): """ Fetching an invalid identifier from OAI """ with
self.assertEqual( self.create(i, f), None)
conditional_block
testoai.py
; 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 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY;...
(self): """ Creation of a paper from an OAI record, when the paper does not exist yet. """ oai_id = 'ftunivsavoie:oai:HAL:hal-01063697v1' # first, make sure the paper isn't there already self.delete(oai_id) # create a paper from BASE hal_paper = s...
test_create_no_match
identifier_name
EarthShield.tsx
import { Trans } from '@lingui/macro'; import { formatPercentage } from 'common/format'; import SPELLS from 'common/SPELLS'; import SPECS from 'game/SPECS'; import { SpellLink } from 'interface'; import UptimeIcon from 'interface/icons/Uptime'; import Analyzer, { Options, SELECTED_PLAYER } from 'parser/core/Analyzer'; ...
} // gets overriden by the rshaman module getFeeding() { return 0; } statistic() { return ( <StatisticBox label={<SpellLink id={SPELLS.EARTH_SHIELD_TALENT.id} />} category={this.category} position={STATISTIC_ORDER.OPTIONAL(45)} tooltip={ <Trans id="sh...
{ this.buffHealing += calculateEffectiveHealing(event, this.earthShieldHealingIncrease); }
conditional_block
EarthShield.tsx
import { Trans } from '@lingui/macro'; import { formatPercentage } from 'common/format'; import SPELLS from 'common/SPELLS'; import SPECS from 'game/SPECS'; import { SpellLink } from 'interface'; import UptimeIcon from 'interface/icons/Uptime'; import Analyzer, { Options, SELECTED_PLAYER } from 'parser/core/Analyzer'; ...
onEarthShieldAmpSpellHeal(event: HealEvent) { const combatant = this.combatants.getEntity(event); if (combatant && combatant.hasBuff(SPELLS.EARTH_SHIELD_TALENT.id, event.timestamp)) { this.buffHealing += calculateEffectiveHealing(event, this.earthShieldHealingIncrease); } } // gets overriden ...
{ this.healing += event.amount + (event.absorbed || 0); }
identifier_body
EarthShield.tsx
import { Trans } from '@lingui/macro'; import { formatPercentage } from 'common/format'; import SPELLS from 'common/SPELLS'; import SPECS from 'game/SPECS'; import { SpellLink } from 'interface'; import UptimeIcon from 'interface/icons/Uptime'; import Analyzer, { Options, SELECTED_PLAYER } from 'parser/core/Analyzer'; ...
() { return { actual: this.uptimePercent, isLessThan: { minor: 0.95, average: 0.9, major: 0.8, }, style: ThresholdStyle.PERCENTAGE, }; } onEarthShieldHeal(event: HealEvent) { this.healing += event.amount + (event.absorbed || 0); } onEarthShieldAmpSpe...
suggestionThresholds
identifier_name
EarthShield.tsx
import { Trans } from '@lingui/macro'; import { formatPercentage } from 'common/format'; import SPELLS from 'common/SPELLS'; import SPECS from 'game/SPECS'; import { SpellLink } from 'interface'; import UptimeIcon from 'interface/icons/Uptime'; import Analyzer, { Options, SELECTED_PLAYER } from 'parser/core/Analyzer'; ...
(p) => p !== SPELLS.EARTH_SHIELD_HEAL, ); // event listener for healing being buffed by having earth shield on the target this.addEventListener( Events.heal.by(SELECTED_PLAYER).spell(HEALING_ABILITIES_AMPED_BY_EARTH_SHIELD_FILTERED), this.onEarthShieldAmpSpellHeal, ); } get uptime...
Events.heal.by(SELECTED_PLAYER).spell(SPELLS.EARTH_SHIELD_HEAL), this.onEarthShieldHeal, ); const HEALING_ABILITIES_AMPED_BY_EARTH_SHIELD_FILTERED = HEALING_ABILITIES_AMPED_BY_EARTH_SHIELD.filter(
random_line_split
cursor-operations.ts
import assert from 'assert' import { THREAD_COUNT, CURSOR_BUFFER_SIZE, THREAD_COUNTER_BYTE_LENGTH, } from './constants' import { InputCursor, StoredEventBatchPointer, StoredEventPointer, } from './types' const checkThreadArrayLength = (threadArray: Array<number>): void => { assert.strictEqual( thread...
const cursorBuffer = Buffer.from(cursor, 'base64') assert.strictEqual( cursorBuffer.length, CURSOR_BUFFER_SIZE, 'Wrong size of cursor buffer' ) const threadCounters = new Array<number>(THREAD_COUNT) for (let i = 0; i < cursorBuffer.length / THREAD_COUNTER_BYTE_LENGTH; i++) { threadCounters[...
return cursorBuffer.toString('base64') } export const cursorToThreadArray = (cursor: InputCursor): Array<number> => { if (cursor == null) return initThreadArray()
random_line_split
cursor-operations.ts
import assert from 'assert' import { THREAD_COUNT, CURSOR_BUFFER_SIZE, THREAD_COUNTER_BYTE_LENGTH, } from './constants' import { InputCursor, StoredEventBatchPointer, StoredEventPointer, } from './types' const checkThreadArrayLength = (threadArray: Array<number>): void => { assert.strictEqual( thread...
} const maxThreadArray = calculateMaxThreadArray( tuples.map((t) => t.threadArray) ) for (const t of tuples) { startingThreadArray[t.event.threadId]++ } for (let i = 0; i < THREAD_COUNT; ++i) { if (maxThreadArray[i] !== startingThreadArray[i]) { return false } } return true }
{ return false }
conditional_block
paginate.js
ThinMint.Mixin.Paginate = function() { var _super = {}; _super.init = ThinMint.Util.callback( this.init ); _super.getPage = ThinMint.Util.callback( this.getPage ); _super.setPage = ThinMint.Util.callback( this.setPage ); _super.getPages = ThinMint.Util.callback( this.getPages ); _super.setPages = ThinMint...
--this.page; return this.onPage(); }; this.pageTo = function(page) { page = parseInt(page); if(page >= this.pages || page <= this.pageFirst) { this.console.warn('ThinMint.Mixin.Paginate', 'Cannot go outside of the allowed pages.'); return; } this.page = page; return ...
{ this.console.warn('ThinMint.Mixin.Paginate', 'Already at the first page.'); return; }
conditional_block
paginate.js
ThinMint.Mixin.Paginate = function() { var _super = {}; _super.init = ThinMint.Util.callback( this.init ); _super.getPage = ThinMint.Util.callback( this.getPage ); _super.setPage = ThinMint.Util.callback( this.setPage ); _super.getPages = ThinMint.Util.callback( this.getPages ); _super.setPages = ThinMint...
// The current page. this.page = 1; // How many pages are available. this.pages = 1; this.getPage = function() { return this.page; }; this.setPage = function(page) { this.page = Number(page); return this; }; this.getPages = function() { return this.pages; }; this.setPages = fun...
// The first page, cannot paginate before this page. this.pageFirst = 1;
random_line_split
array.rs
extern crate byteorder; use self::byteorder::{ReadBytesExt, WriteBytesExt, BigEndian}; use std::error::Error; use std::io::Write; use backend::Debug; use pg::{Pg, PgTypeMetadata}; use query_source::Queryable; use types::*; impl<T> HasSqlType<Array<T>> for Pg where Pg: HasSqlType<T>, { fn metadata() -> PgType...
(row: Self) -> Self { row } } use expression::AsExpression; use expression::bound::Bound; macro_rules! array_as_expression { ($ty:ty, $sql_type:ty) => { impl<'a, ST, T> AsExpression<$sql_type> for $ty where Pg: HasSqlType<ST>, { type Expression = Bound<$sql_type...
build
identifier_name
array.rs
extern crate byteorder; use self::byteorder::{ReadBytesExt, WriteBytesExt, BigEndian}; use std::error::Error; use std::io::Write; use backend::Debug; use pg::{Pg, PgTypeMetadata}; use query_source::Queryable; use types::*; impl<T> HasSqlType<Array<T>> for Pg where Pg: HasSqlType<T>, { fn metadata() -> PgType...
let num_elements = try!(bytes.read_i32::<BigEndian>()); let lower_bound = try!(bytes.read_i32::<BigEndian>()); assert!(num_dimensions == 1, "multi-dimensional arrays are not supported"); assert!(lower_bound == 1, "lower bound must be 1"); (0..num_elements).map(|_| { ...
{ return Ok(Vec::new()) }
conditional_block
array.rs
extern crate byteorder; use self::byteorder::{ReadBytesExt, WriteBytesExt, BigEndian}; use std::error::Error; use std::io::Write; use backend::Debug; use pg::{Pg, PgTypeMetadata}; use query_source::Queryable; use types::*; impl<T> HasSqlType<Array<T>> for Pg where Pg: HasSqlType<T>, { fn metadata() -> PgType...
try!(out.write_u32::<BigEndian>(Pg::metadata().oid)); try!(out.write_i32::<BigEndian>(self.len() as i32)); let lower_bound = 1; try!(out.write_i32::<BigEndian>(lower_bound)); let mut buffer = Vec::new(); for elem in self.iter() { let is_null = try!(elem.to_sq...
try!(out.write_i32::<BigEndian>(num_dimensions)); let flags = 0; try!(out.write_i32::<BigEndian>(flags));
random_line_split
array.rs
extern crate byteorder; use self::byteorder::{ReadBytesExt, WriteBytesExt, BigEndian}; use std::error::Error; use std::io::Write; use backend::Debug; use pg::{Pg, PgTypeMetadata}; use query_source::Queryable; use types::*; impl<T> HasSqlType<Array<T>> for Pg where Pg: HasSqlType<T>, { fn metadata() -> PgType...
} impl<T, ST> Queryable<Array<ST>, Pg> for Vec<T> where T: FromSql<ST, Pg> + Queryable<ST, Pg>, Pg: HasSqlType<ST>, { type Row = Self; fn build(row: Self) -> Self { row } } use expression::AsExpression; use expression::bound::Bound; macro_rules! array_as_expression { ($ty:ty, $sql_ty...
{ FromSql::<Array<ST>, Pg>::from_sql(row.take()) }
identifier_body
frame.rs
/* Copyright 2013 Jesse 'Jeaye' Wilkerson See licensing in LICENSE file, or at: http://www.opensource.org/licenses/BSD-3-Clause File: client/md5/animation/frame.rs Author: Jesse 'Jeaye' Wilkerson Description: TODO */ use math; struct Base_Frame { position: math::Vec3f, orientati...
() -> Frame_Data { Frame_Data { id: 0, data: ~[], } } }
new
identifier_name
frame.rs
/* Copyright 2013 Jesse 'Jeaye' Wilkerson See licensing in LICENSE file, or at: http://www.opensource.org/licenses/BSD-3-Clause
File: client/md5/animation/frame.rs Author: Jesse 'Jeaye' Wilkerson Description: TODO */ use math; struct Base_Frame { position: math::Vec3f, orientation: math::Quaternion, } struct Frame_Data { id: i32, data: ~[f32], } impl Base_Frame { pub fn new() -> Base_Frame { Base_Frame ...
random_line_split
message.js
/* * Package: message.js * * Namespace: bbop.widget.message * * TODO: Code needs to be cleaned with <bbop.html>. * * BBOP object to produce a self-constructing/self-destructing * sliding message/announcments/warnings. * * Note that this is a steal of some older code. We'll probably have * to clean this u...
* Function: warning * * Temporarily display a messsage styled for warnings. * * Parameters: * msg - the message * * Returns * n/a */ this.warning = function(msg){ var elt = _generate_element('warning', msg); elt.show().slideDown('slow').slideUp('slow'...
elt.show().slideDown('slow').slideUp('slow', _destroy_element); }; /*
random_line_split
message.js
/* * Package: message.js * * Namespace: bbop.widget.message * * TODO: Code needs to be cleaned with <bbop.html>. * * BBOP object to produce a self-constructing/self-destructing * sliding message/announcments/warnings. * * Note that this is a steal of some older code. We'll probably have * to clean this u...
if ( typeof bbop.widget == "undefined" ){ bbop.widget = {}; } /* * Constructor: message * * Contructor for the bbop.widget.message object. * * A trivial invocation might be something like: * : var m = new bbop.widget.message(); * : m.notice("Hello, World!"); * * Arguments: * n/a * * Returns: * self ...
{ var bbop = {}; }
conditional_block
message.js
/* * Package: message.js * * Namespace: bbop.widget.message * * TODO: Code needs to be cleaned with <bbop.html>. * * BBOP object to produce a self-constructing/self-destructing * sliding message/announcments/warnings. * * Note that this is a steal of some older code. We'll probably have * to clean this u...
/// /// Notice and error handling. /// // elt.show().fadeIn('slow').fadeOut('slow', _destroy_element); /* * Function: notice * * Temporarily display a messsage styled for notices. * * Parameters: * msg - the message * * Returns * n/a */ t...
{ jQuery(this).remove(); }
identifier_body
message.js
/* * Package: message.js * * Namespace: bbop.widget.message * * TODO: Code needs to be cleaned with <bbop.html>. * * BBOP object to produce a self-constructing/self-destructing * sliding message/announcments/warnings. * * Note that this is a steal of some older code. We'll probably have * to clean this u...
(str){ logger.kvetch('W (message): ' + str); } // Generate tags. function _generate_element(ctype, str){ var message_classes = ['bbop-js-message', 'bbop-js-message-' + ctype]; var message_elt = new bbop.html.tag('div', {'generate_id': true, 'class': message_classes.join(' ...
ll
identifier_name
index.js
var app = { initialize: function() { this.bind(); this.run(); }, bind: function() { var self = this; document.getElementById("page-request-form").addEventListener('submit', function(e) { var address = document.getElementById("page-request-address"); se...
}); } };
{ e.preventDefault(); if (el.text.match(/^emulate\./)) { app.redirect(el.text); } else { app.goto(el.text); } }
conditional_block
index.js
var app = { initialize: function() { this.bind(); this.run(); }, bind: function() { var self = this;
return false; }); }, run: function() { this.showLoading(true); this.load(); this.showLoading(false); }, load: function() { if (this.hasWarnings()) { this.loadWarnings(); } else if (this.hasApiRequest()) { this.lo...
document.getElementById("page-request-form").addEventListener('submit', function(e) { var address = document.getElementById("page-request-address"); self.loadPageRequest(address.value);
random_line_split
setup_py2exe.py
86" name="%(prog)s" type="win32"> </assemblyIdentity> <description>%(prog)s</description> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker" uiAccess="false"> </requestedExecutionLev...
data_files = []
random_line_split
setup_py2exe.py
of the DiRefl application. For testing purposes, direfl.exe can be run from the dist directory. """ import os import sys ''' print "*** Python path is:" for i, p in enumerate(sys.path): print "%5d %s" %(i, p) ''' from distutils.core import setup # Augment the setup interface with the py2exe command and make ...
(): """This class stores metadata about the distribution in a dictionary.""" def __init__(self, **kw): self.__dict__.update(kw) self.version = version client = Target( name = 'DiRefl', description = 'Direct Inversion Reflectometry (DiRefl) application', script = 'bin/direfl.py', #...
Target
identifier_name