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
webpack.config.prod.js
import webpack from 'webpack'; import path from 'path'; import HTMLWebpackPlugin from 'html-webpack-plugin'; import WebpackMd5Hash from 'webpack-md5-hash'; import ExtractTextPlugin from 'extract-text-webpack-plugin'; export default { debug: true, devtool: 'source-map', noInfo: false, entry: { vendor: path.resol...
collapseWhitespaces: true, removeRedundantAttributes: true, useShortDoctype: true, removeEmptyAttributes: true, removeStyleLinkTypeAttributes: true, keepClosingSlash: true, minifyJS: true, minifyCSS: true, minifyURLs: true }, SENTRY_TOKEN: 'TEST TOKEN' }), new webpack.optim...
template: 'src/index.html', inject: true, minify: { removeComments: true,
random_line_split
dst-index.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 ...
} struct T; impl Copy for T {} impl Index<uint, Show + 'static> for T { fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) { static x: uint = 42; &x } } fn main() { S[0]; //~^ ERROR cannot move out of dereference //~^^ ERROR E0161 T[0]; //~^ ERROR cannot move out...
{ "hello" }
identifier_body
dst-index.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 ...
impl Copy for T {} impl Index<uint, Show + 'static> for T { fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) { static x: uint = 42; &x } } fn main() { S[0]; //~^ ERROR cannot move out of dereference //~^^ ERROR E0161 T[0]; //~^ ERROR cannot move out of dereferenc...
struct T;
random_line_split
dst-index.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 ...
<'a>(&'a self, _: &uint) -> &'a str { "hello" } } struct T; impl Copy for T {} impl Index<uint, Show + 'static> for T { fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) { static x: uint = 42; &x } } fn main() { S[0]; //~^ ERROR cannot move out of dereference ...
index
identifier_name
status.rs
// Copyright 2017 LambdaStack 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...
{ severity: String, summary: String, } #[derive(RustcDecodable, RustcEncodable)] pub struct CephStatusHealthDetail { dummy: String, } #[derive(RustcDecodable, RustcEncodable)] pub struct CephStatusMonMap { epoch: u32, fsid: String, modified: String, created: String, mons: Vec<CephStat...
CephStatusHealthSummary
identifier_name
status.rs
// Copyright 2017 LambdaStack 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...
} #[derive(RustcDecodable, RustcEncodable)] pub struct CephStatusMonRank { rank: u16, name: String, addr: String, } #[derive(RustcDecodable, RustcEncodable)] pub struct CephStatusOSDMapH { osdmap: CephStatusOSDMapL, } #[derive(RustcDecodable, RustcEncodable)] pub struct CephStatusOSDMapL { epoch:...
created: String, mons: Vec<CephStatusMonRank>,
random_line_split
exceptions.py
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modif...
"""Exceptions raised due to errors in result output. It may be better for the Qiskit API to raise this exception. Args: error (dict): This is the error record as it comes back from the API. The format is like:: error = {'status': 403, 'message'...
class ResultError(QiskitError):
random_line_split
exceptions.py
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modif...
def __str__(self): return '{}: {}'.format(self.code, self.message)
super().__init__(error['message']) self.status = error['status'] self.code = error['code']
identifier_body
exceptions.py
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modif...
(self, error): super().__init__(error['message']) self.status = error['status'] self.code = error['code'] def __str__(self): return '{}: {}'.format(self.code, self.message)
__init__
identifier_name
ScrollFilled.tsx
// https://thenounproject.com/jngll2/uploads/?i=1219368 // Created by jngll from the Noun Project const Icon = (props: Props) => ( <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" className="icon" {...props}> <path d="M80.64,10.87l-.52,0-.26,0H30.64A11.24,11.24,0,0,0,19.42,21.94s0,.05,0,.08V66.66h-....
import * as React from 'react'; type Props = Omit<React.ComponentPropsWithoutRef<'svg'>, 'xmlns' | 'viewBox' | 'className'>;
random_line_split
archive.js
import React from "react" import { Link, graphql } from "gatsby" import Bio from "../components/bio" import Layout from "../components/layout" import SEO from "../components/seo" import { rhythm } from "../utils/typography" class BlogIndex extends React.Component {
() { const { data } = this.props const siteTitle = data.site.siteMetadata.title const posts = data.allMarkdownRemark.edges return ( <Layout location={this.props.location} title={siteTitle}> <SEO title="All posts" keywords={[`blog`, `gatsby`, `javascript`, `react`]} ...
render
identifier_name
archive.js
import React from "react" import { Link, graphql } from "gatsby" import Bio from "../components/bio" import Layout from "../components/layout" import SEO from "../components/seo" import { rhythm } from "../utils/typography" class BlogIndex extends React.Component { render() { const { data } = this.props con...
return ( <div key={node.fields.slug}> <h3 style={{ marginBottom: rhythm(1 / 4), }} > <Link style={{ boxShadow: `none` }} to={node.fields.slug}> {title} </Link> ...
{ desc = node.excerpt; }
conditional_block
archive.js
import React from "react" import { Link, graphql } from "gatsby" import Bio from "../components/bio" import Layout from "../components/layout" import SEO from "../components/seo" import { rhythm } from "../utils/typography" class BlogIndex extends React.Component { render() {
const siteTitle = data.site.siteMetadata.title const posts = data.allMarkdownRemark.edges return ( <Layout location={this.props.location} title={siteTitle}> <SEO title="All posts" keywords={[`blog`, `gatsby`, `javascript`, `react`]} /> <Bio /> {post...
const { data } = this.props
random_line_split
mut_from_ref.rs
#![allow(unused)] #![warn(clippy::mut_from_ref)] struct Foo; impl Foo { fn this_wont_hurt_a_bit(&self) -> &mut Foo { unimplemented!() } } trait Ouch { fn ouch(x: &Foo) -> &mut Foo; } impl Ouch for Foo { fn ouch(x: &Foo) -> &mut Foo { unimplemented!() } } fn fail(x: &u32) -> &mut...
{ //TODO }
identifier_body
mut_from_ref.rs
#![allow(unused)] #![warn(clippy::mut_from_ref)] struct Foo; impl Foo { fn this_wont_hurt_a_bit(&self) -> &mut Foo { unimplemented!() } } trait Ouch { fn ouch(x: &Foo) -> &mut Foo; }
impl Ouch for Foo { fn ouch(x: &Foo) -> &mut Foo { unimplemented!() } } fn fail(x: &u32) -> &mut u16 { unimplemented!() } fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { unimplemented!() } fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { unim...
random_line_split
mut_from_ref.rs
#![allow(unused)] #![warn(clippy::mut_from_ref)] struct
; impl Foo { fn this_wont_hurt_a_bit(&self) -> &mut Foo { unimplemented!() } } trait Ouch { fn ouch(x: &Foo) -> &mut Foo; } impl Ouch for Foo { fn ouch(x: &Foo) -> &mut Foo { unimplemented!() } } fn fail(x: &u32) -> &mut u16 { unimplemented!() } fn fail_lifetime<'a>(x: &'a u...
Foo
identifier_name
PubMenuItem.tsx
import React from 'react'; import classNames from 'classnames'; import { Button } from 'reakit/Button'; import { Byline, PreviewImage } from 'components'; require('./pubMenuItem.scss'); type BylineProps = React.ComponentProps<typeof Byline>; interface Props { active?: boolean; disabled?: boolean; contributors?: a...
onClick, showImage = false, title, bylineProps = {}, } = props; const skeletonClass = classNames(isSkeleton && 'bp3-skeleton'); const className = classNames( 'bp3-menu-item', 'pub-menu-item-component', active && 'active', disabled && 'bp3-disabled', isSkeleton && 'is-skeleton', !onClick && 'unse...
random_line_split
timelineBuffer.ts
/** * Copyright 2014 Mozilla Foundation * * 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...
for (var k = 0; k < leaveCount; k++) { sample = currentStack.pop(); buffer.leave(sample.functionName, null, time); } while (j < stack.length) { sample = stack[j++]; buffer.enter(sample.functionName, null, time); } currentStack = stack; ...
j++; } var leaveCount = currentStack.length - j;
random_line_split
timelineBuffer.ts
/** * Copyright 2014 Mozilla Foundation * * 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...
currentStack = stack; } while (sample = currentStack.pop()) { buffer.leave(sample.functionName, null, time); } return buffer; } private static _resolveIds(parent, idMap) { idMap[parent.id] = parent; if (parent.children) { for (var i = 0; i < parent.c...
{ sample = stack[j++]; buffer.enter(sample.functionName, null, time); }
conditional_block
timelineBuffer.ts
/** * Copyright 2014 Mozilla Foundation * * 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...
(name: string, value: number, data?: any) { // Not Implemented } /** * Constructs an easier to work with TimelineFrame data structure. */ createSnapshot(count: number = Number.MAX_VALUE): TimelineBufferSnapshot { if (!this._marks) { return null; } var times = this...
count
identifier_name
timelineBuffer.ts
/** * Copyright 2014 Mozilla Foundation * * 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...
get kinds(): TimelineItemKind [] { return this._kinds.concat(); } get depth(): number { return this._depth; } private _initialize() { this._depth = 0; this._stack = []; this._data = []; this._kinds = []; this._kindNameMap = Object.create(null); thi...
{ return this._kinds[kind]; }
identifier_body
prueba_de_inventario.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # sin título.py # # Copyright 2012 Jesús Hómez <jesus@soneview> # # 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; ei...
#Model().conectar() #Model().borrar_tablas_para_inventario() #~ Model().crear_tablas_para_inventario(2011,12) #~ Model().crear_tabla_entradas() venta_id = Model().venta_id_max() new_venta_id = Model().nuevo_venta_id() print venta_id print new_venta_id
random_line_split
devicemotion.js
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate...
/** * Get the current acceleration along the x, y, and z axes. * @returns {Promise<AccelerationData>} Returns object with x, y, z, and timestamp properties */ DeviceMotion.getCurrentAcceleration = function () { return; }; /** * Watch the device acceleration. Clear the watch by un...
{ }
identifier_body
devicemotion.js
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate...
DeviceMotion.watchAcceleration = function (options) { return; }; __decorate([ Cordova() ], DeviceMotion, "getCurrentAcceleration", null); __decorate([ Cordova({ callbackOrder: 'reverse', observable: true, clearFunction: 'clearWatch' })...
* Watch the device acceleration. Clear the watch by unsubscribing from the observable. * @param {AccelerometerOptions} options list of options for the accelerometer. * @returns {Observable<AccelerationData>} Observable returns an observable that you can subscribe to */
random_line_split
devicemotion.js
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate...
() { } /** * Get the current acceleration along the x, y, and z axes. * @returns {Promise<AccelerationData>} Returns object with x, y, z, and timestamp properties */ DeviceMotion.getCurrentAcceleration = function () { return; }; /** * Watch the device acceleration. Clear the ...
DeviceMotion
identifier_name
msgfmt.py
""" msgfmt tool """ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software...
return result ############################################################################# ############################################################################# def _create_mo_file_builder(env, **kw): """ Create builder object for `MOFiles` builder """ import SCons.Action # FIXME: What factory use ...
env['LINGUAS_FILE'] = linguas_files
conditional_block
msgfmt.py
""" msgfmt tool """ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software...
(env): """ Check if the tool exists """ from SCons.Tool.GettextCommon import _msgfmt_exists try: return _msgfmt_exists(env) except: return False ############################################################################# # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expand...
exists
identifier_name
msgfmt.py
""" msgfmt tool """ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software...
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING F...
# # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
random_line_split
msgfmt.py
""" msgfmt tool """ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software...
############################################################################# ############################################################################# def _create_mo_file_builder(env, **kw): """ Create builder object for `MOFiles` builder """ import SCons.Action # FIXME: What factory use for source? Ours o...
""" The builder class for `MO` files. The reason for this builder to exists and its purpose is quite simillar as for `_POFileBuilder`. This time, we extend list of sources, not targets, and call `BuilderBase._execute()` only once (as we assume single-target here). """ def _execute(self, env, target, so...
identifier_body
strings.js
define( ({ _widgetLabel: "분석", executeAnalysisTip: "실행할 분석 도구 클릭", noToolTip: "분석 도구를 선택하지 않았습니다!", back: "뒤로", next: "다음", home: "홈", jobSubmitted: "제출하였습니다.", jobCancelled: "취소되었습니다.", jobFailed: "실패함", jobSuccess: "성공했습니다.", executing: "실행 중", cancelJob: "분석 작업 취소"...
privilegeError: "내 사용자 역할은 분석을 수행할 수 없습니다. 분석을 수행하려면 내 기관의 관리자가 특정 <a href=\"http://doc.arcgis.com/en/arcgis-online/reference/roles.htm\" target=\"_blank\">권한</a>을 부여해야 합니다." }) );
random_line_split
conf.py
# -*- coding: utf-8 -*- # # {{ cookiecutter.project_name }} documentation build configuration file, created by # sphinx-quickstart. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All con...
] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote'
('index', '{{ cookiecutter.project_slug }}', '{{ cookiecutter.project_name }} Documentation', """{{ cookiecutter.author_name }}""", '{{ cookiecutter.project_name }}', """{{ cookiecutter.description }}""", 'Miscellaneous'),
random_line_split
ethernet_networks.py
# -*- coding: utf-8 -*- ### # (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limi...
(self, resource, timeout=-1): """ Updates an Ethernet network. Args: resource: dict object to update timeout: Timeout in seconds. Wait task completion by default. The timeout does not abort the operation in OneView, just stops waiting for ...
update
identifier_name
ethernet_networks.py
# -*- coding: utf-8 -*- ### # (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limi...
Gets a paginated collection of Ethernet networks. The collection is based on optional sorting and filtering, and constrained by start and count parameters. Args: start: The first item to return, using 0-based indexing. If not specified, the default is...
def get_all(self, start=0, count=-1, filter='', sort=''): """
random_line_split
ethernet_networks.py
# -*- coding: utf-8 -*- ### # (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limi...
return ethernet_networks def dissociate_values_or_ranges(self, vlan_id_range): """ Build a list of vlan ids given a combination of ranges and/or values Examples: >>> enet.dissociate_values_or_ranges('1-2,5') [1, 2, 5] >>> enet.dissociate_va...
if int(net['vlanId']) not in vlan_ids: ethernet_networks.remove(net)
conditional_block
ethernet_networks.py
# -*- coding: utf-8 -*- ### # (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limi...
def update(self, resource, timeout=-1): """ Updates an Ethernet network. Args: resource: dict object to update timeout: Timeout in seconds. Wait task completion by default. The timeout does not abort the operation in OneView, just st...
""" Build a list of vlan ids given a combination of ranges and/or values Examples: >>> enet.dissociate_values_or_ranges('1-2,5') [1, 2, 5] >>> enet.dissociate_values_or_ranges('5') [1, 2, 3, 4, 5] >>> enet.dissociate_values_or_ranges...
identifier_body
status.ts
import { ActionContextType, StateType } from '../../context.type' import { setDetail } from './toggleDetail' // History will never grow beyond this export const MAX_STATUS_HISTORY = 250 // When history gets to MAX, we shrink to MIN export const MIN_STATUS_HISTORY = 200 export const HISTORY_PATH = [ '$status', 'list' ]...
const s = Object.assign ( {}, status, { ref } ) let list = [ s, ...curr ] if ( list.length > MAX_STATUS_HISTORY ) { list = list.slice ( 0, MIN_STATUS_HISTORY ) } state.set ( HISTORY_PATH, list ) return s } export const status = ( { state, input, output }: ActionContextType ) => { if ( input.status ) ...
( state: StateType , status: StatusType ) : StatusType => { const curr = state.get ( HISTORY_PATH ) || [] ref += 1
random_line_split
status.ts
import { ActionContextType, StateType } from '../../context.type' import { setDetail } from './toggleDetail' // History will never grow beyond this export const MAX_STATUS_HISTORY = 250 // When history gets to MAX, we shrink to MIN export const MIN_STATUS_HISTORY = 200 export const HISTORY_PATH = [ '$status', 'list' ]...
state.set ( HISTORY_PATH, list ) return s } export const status = ( { state, input, output }: ActionContextType ) => { if ( input.status ) { const s = addStatus ( state, input.status ) if ( s.type === 'error' ) { // Automatically open on error setDetail ( state, s ) } } } // Cerebral...
{ list = list.slice ( 0, MIN_STATUS_HISTORY ) }
conditional_block
issue-3563-3.rs
// run-pass #![allow(unused_imports)] #![allow(non_snake_case)] // ASCII art shape renderer. Demonstrates traits, impls, operator overloading, // non-copyable struct, unit testing. To run execute: rustc --test shapes.rs && // ./shapes // Rust's std library is tightly bound to the language itself so it is // automat...
return true; } fn test_ascii_art_ctor() { let art = AsciiArt(3, 3, '*'); assert!(check_strs(&art.to_string(), "...\n...\n...")); } fn test_add_pt() { let mut art = AsciiArt(3, 3, '*'); art.add_pt(0, 0); art.add_pt(0, -10); art.add_pt(1, 2); assert!(check_strs(&art.to_string(), "*..\...
{ println!("Found:\n{}\nbut expected\n{}", actual, expected); return false; }
conditional_block
issue-3563-3.rs
// run-pass #![allow(unused_imports)] #![allow(non_snake_case)] // ASCII art shape renderer. Demonstrates traits, impls, operator overloading, // non-copyable struct, unit testing. To run execute: rustc --test shapes.rs && // ./shapes // Rust's std library is tightly bound to the language itself so it is // automat...
height: usize, fill: char, lines: Vec<Vec<char> > , // This struct can be quite large so we'll disable copying: developers need // to either pass these structs around via references or move them. } impl Drop for AsciiArt { fn drop(&mut self) {} } // It's common to define a constructor sort of...
random_line_split
issue-3563-3.rs
// run-pass #![allow(unused_imports)] #![allow(non_snake_case)] // ASCII art shape renderer. Demonstrates traits, impls, operator overloading, // non-copyable struct, unit testing. To run execute: rustc --test shapes.rs && // ./shapes // Rust's std library is tightly bound to the language itself so it is // automat...
(&mut self, shape: Rect) { // Add the top and bottom lines. for x in shape.top_left.x..shape.top_left.x + shape.size.width { self.add_pt(x, shape.top_left.y); self.add_pt(x, shape.top_left.y + shape.size.height - 1); } // Add the left and right lines. for...
add_rect
identifier_name
regress-crbug-691323.js
// Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Flags: --allow-natives-syntax var buffer = new ArrayBuffer(0x100); var array = new Uint8Array(buffer).fill(55); var tmp = {}; tmp[Symbol.toPrimitive]...
tmp[Symbol.toPrimitive] = function () { %ArrayBufferNeuter(array.buffer) return 0; }; assertEquals(false, Array.prototype.includes.call(array, 0x00, tmp)); buffer = new ArrayBuffer(0x100); array = new Uint8Array(buffer).fill(55); tmp = {}; tmp[Symbol.toPrimitive] = function () { %ArrayBufferNeuter(array.buffer...
buffer = new ArrayBuffer(0x100); array = new Uint8Array(buffer).fill(55); tmp = {};
random_line_split
Rc4Util.ts
export class Rc4Util { public static decry_RC4(data: string, key: string): string { if (data == null || key == null) { return null; } return this.bytesToString(this.RC4Base(this.HexString2Bytes(data), key)); } public static encry_RC4_string(data: string, key: string): string { if (data ==...
private static RC4Base(input: number[], mKkey: string): number[] { let x = 0; let y = 0; let key: number[] = this.initKey(mKkey); let xorIndex: number; let result: number[] = new Array(input.length); for (let i = 0; i < input.length; i++) { x = (x + 1) & 0xff; y = ((key[x] & 0xff)...
let _b0: number = parseInt(String.fromCharCode(src0), 16) << 4; let _b1: number = parseInt(String.fromCharCode(src1), 16); return _b0 ^ _b1; }
random_line_split
Rc4Util.ts
export class Rc4Util { public static decry_RC4(data: string, key: string): string { if (data == null || key == null) { return null; } return this.bytesToString(this.RC4Base(this.HexString2Bytes(data), key)); } public static encry_RC4_string(data: string, key: string): string { if (data ==...
}
{ let x = 0; let y = 0; let key: number[] = this.initKey(mKkey); let xorIndex: number; let result: number[] = new Array(input.length); for (let i = 0; i < input.length; i++) { x = (x + 1) & 0xff; y = ((key[x] & 0xff) + y) & 0xff; let tmp: number = key[x]; key[x] = key[y];...
identifier_body
Rc4Util.ts
export class Rc4Util { public static decry_RC4(data: string, key: string): string { if (data == null || key == null) { return null; } return this.bytesToString(this.RC4Base(this.HexString2Bytes(data), key)); } public static encry_RC4_string(data: string, key: string): string { if (data ==...
(str): number[] { let ch: number = 0; let st: number[] = []; let re: number[] = []; for (let i = 0; i < str.length; i++) { ch = str.charCodeAt(i); st = []; do { st.push(ch & 0xFF); ch = ch >> 8; } while (ch); re = re.concat(st.reverse()); } return re...
stringToBytes
identifier_name
Rc4Util.ts
export class Rc4Util { public static decry_RC4(data: string, key: string): string { if (data == null || key == null) { return null; } return this.bytesToString(this.RC4Base(this.HexString2Bytes(data), key)); } public static encry_RC4_string(data: string, key: string): string { if (data ==...
return this.toHexString(this.bytesToString(this.encry_RC4_byte(data, key))); } private static encry_RC4_byte(data: string, key: string): number[] { if (data == null || key == null) { return null; } let b_data: number[] = this.stringToBytes(data); return this.RC4Base(b_data, key); } ...
{ return null; }
conditional_block
room_key_request.rs
//! Types for the [`m.room_key_request`] event. //! //! [`m.room_key_request`]: https://spec.matrix.org/v1.2/client-server-api/#mroom_key_request use ruma_macros::EventContent; use ruma_serde::StringEnum; use serde::{Deserialize, Serialize}; use crate::{DeviceId, EventEncryptionAlgorithm, PrivOwnedStr, RoomId, Transa...
}
random_line_split
room_key_request.rs
//! Types for the [`m.room_key_request`] event. //! //! [`m.room_key_request`]: https://spec.matrix.org/v1.2/client-server-api/#mroom_key_request use ruma_macros::EventContent; use ruma_serde::StringEnum; use serde::{Deserialize, Serialize}; use crate::{DeviceId, EventEncryptionAlgorithm, PrivOwnedStr, RoomId, Transa...
(&self) -> &str { self.as_ref() } } /// Information about a requested key. #[derive(Clone, Debug, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct RequestedKeyInfo { /// The encryption algorithm the requested key in this event is to be used wit...
as_str
identifier_name
Npc.ts
module Role { export class Npc extends Common.Character{ NpcTalk = { "guard": [ "Hello there", "We don't need to see your identification", "You are not the player we're looking for", "Move along, move along..." ], "king": [ "Hi, I'...
mKind; discourse; talkCount; talkIndex; selectTalk(game){ var change = false; if(this.discourse != -1){ var found = false; for(var i = 1; !found && i<this.NpcTalk[this.itemKind].length; i++){ if(this.NpcTalk[this.itemKind][i]["condition"](game)){ if(this.discourse != i){ change ...
uper(id, kind); this.itemKind = Types.getKindAsString(kind); if(typeof this.NpcTalk[this.itemKind][0] === 'string'){ this.discourse = -1; this.talkCount = this.NpcTalk[this.itemKind].length; } else{ this.discourse = 0; this.talkCount = this.NpcTalk[this.itemKind][this.discourse]["te...
identifier_body
Npc.ts
module Role { export class Npc extends Common.Character{ NpcTalk = { "guard": [ "Hello there", "We don't need to see your identification", "You are not the player we're looking for", "Move along, move along..." ], "king": [ "Hi, I'...
"In order to find them, exploration is key.", "Good luck." ], "octocat": [ "Welcome to BrowserQuest!", "Want to see the source code?", 'Check out <a target="_blank" href="http://github.com/browserquest/BrowserQuest">the repository on GitHub</a...
"I understand. It's easy to get envious.", "I actually crafted it myself, using my mad wizard skills.", "But let me tell you one thing...", "There are lots of items in this game.", "Some more powerful than others.",
random_line_split
Npc.ts
module Role { export class Npc extends Common.Character{ NpcTalk = { "guard": [ "Hello there", "We don't need to see your identification", "You are not the player we're looking for", "Move along, move along..." ], "king": [ "Hi, I'...
this.talkIndex += 1; return msg.replace('*name*',game.player.name); } } }
if(this.discourse == -1){ msg = this.NpcTalk[this.itemKind][this.talkIndex]; } else{ msg = this.NpcTalk[this.itemKind][this.discourse]["text"][this.talkIndex]; } }
conditional_block
Npc.ts
module Role { export class
extends Common.Character{ NpcTalk = { "guard": [ "Hello there", "We don't need to see your identification", "You are not the player we're looking for", "Move along, move along..." ], "king": [ "Hi, I'm the King", "I run...
Npc
identifier_name
ircbot.py
'''Todo: * Add multiple thread support for async_process functions * Potentially thread each handler function? idk ''' import sys import socket import re import threading import logging import time if sys.hexversion < 0x03000000: #Python 2 import Queue as queue BlockingIOError = socket.error else: imp...
(self, func): '''decorated functions should be written as class methods @on('join') def on_join(self, channel): print("Joined channel %s" % channel) ''' self._handlers[type].append(func) return func return decor...
decorator
identifier_name
ircbot.py
'''Todo: * Add multiple thread support for async_process functions * Potentially thread each handler function? idk ''' import sys import socket import re import threading import logging import time if sys.hexversion < 0x03000000: #Python 2 import Queue as queue BlockingIOError = socket.error else: imp...
__all__ = ['IRCBot']
self._handlers['nick'].append(func) return func
identifier_body
ircbot.py
'''Todo: * Add multiple thread support for async_process functions * Potentially thread each handler function? idk ''' import sys import socket import re import threading import logging import time if sys.hexversion < 0x03000000: #Python 2 import Queue as queue BlockingIOError = socket.error else: imp...
def start(self): IRCClient.start(self) self._process_thread = threading.Thread(target=self._async_process) self._process_thread.start() def on(self, type): '''Decorator function''' def decorator(self, func): '''decorated functions should be written as class...
time.sleep(0.01) try: args = self._in_queue.get_nowait() #These "msg"s will be raw irc received lines, which have several forms # basically, we should be looking for # :User!Name@host COMMAND <ARGS> userhost = user_re.search(arg...
conditional_block
ircbot.py
'''Todo: * Add multiple thread support for async_process functions * Potentially thread each handler function? idk ''' import sys import socket import re import threading import logging import time if sys.hexversion < 0x03000000: #Python 2 import Queue as queue BlockingIOError = socket.error else: imp...
channel = args[2] topic = ' '.join(args[3:]) for handler in self._handlers['topic']: handler(self, nick, host, channel, topic) elif command == 'PART': channel = args[2] ...
channel = args[2][1:] #JOIN Channels are : prefixed for handler in self._handlers['join']: handler(self, nick, host, channel) elif command == 'TOPIC':
random_line_split
display-on-last-day-before-participants-must-check-in.py
#!/usr/bin/python import participantCollection participantCollection = participantCollection.ParticipantCollection() numberStillIn = participantCollection.sizeOfParticipantsWhoAreStillIn() initialNumber = participantCollection.size() print "There are currently **" + str(numberStillIn) + " out of " + str(initialNumber...
print ""
print "" for participant in participantCollection.participantsWhoAreStillInAndHaveNotCheckedIn(): print "/u/" + participant.name + " ~"
random_line_split
display-on-last-day-before-participants-must-check-in.py
#!/usr/bin/python import participantCollection participantCollection = participantCollection.ParticipantCollection() numberStillIn = participantCollection.sizeOfParticipantsWhoAreStillIn() initialNumber = participantCollection.size() print "There are currently **" + str(numberStillIn) + " out of " + str(initialNumber...
print "/u/" + participant.name + " ~" print ""
conditional_block
cursor.js
/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview The class representing a cursor. * Used primarily for keyboard navigation. * @author aschmiedt@google.com (Abby Schmiedt) */ 'use strict'; goog.provide('Blockly.Cursor'); goog.require('Blockly.ASTNode'); g...
return newNode; }; Blockly.registry.register( Blockly.registry.Type.CURSOR, Blockly.registry.DEFAULT, Blockly.Cursor);
{ this.setCurNode(newNode); }
conditional_block
cursor.js
/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview The class representing a cursor. * Used primarily for keyboard navigation. * @author aschmiedt@google.com (Abby Schmiedt) */ 'use strict'; goog.provide('Blockly.Cursor'); goog.require('Blockly.ASTNode'); g...
curNode.getType() == Blockly.ASTNode.types.OUTPUT) { curNode = curNode.next(); } var newNode = curNode.in(); if (newNode) { this.setCurNode(newNode); } return newNode; }; /** * Find the previous connection, field, or block. * @return {Blockly.ASTNode} The previous element, or null if the cur...
random_line_split
hooks.tsx
import { useCallback, useState, useEffect } from 'react'; import { KeyStore } from './keystore'; import type { Accounts, Hooks as HooksType } from './../types'; export const Hooks = { useKeyStore: () => { const [accounts, setAccounts] = useState<Accounts>(); const [error, setError] = useState<string>(); ...
try { await KeyStore.newAccount(passphrase); setAccounts(await KeyStore.getAccounts()); } catch (err: any) { setError(err); } } addAccount(); }, []); return { accounts, error, newAccount }; }, useEthereumClient: () => {}, } as HooksType;
const newAccount = useCallback((passphrase: string) => { async function addAccount() {
random_line_split
hooks.tsx
import { useCallback, useState, useEffect } from 'react'; import { KeyStore } from './keystore'; import type { Accounts, Hooks as HooksType } from './../types'; export const Hooks = { useKeyStore: () => { const [accounts, setAccounts] = useState<Accounts>(); const [error, setError] = useState<string>(); ...
() { try { setAccounts(await KeyStore.getAccounts()); } catch (err: any) { setError(err); } } getAccounts(); }, []); const newAccount = useCallback((passphrase: string) => { async function addAccount() { try { await KeyStore.newAcco...
getAccounts
identifier_name
hooks.tsx
import { useCallback, useState, useEffect } from 'react'; import { KeyStore } from './keystore'; import type { Accounts, Hooks as HooksType } from './../types'; export const Hooks = { useKeyStore: () => { const [accounts, setAccounts] = useState<Accounts>(); const [error, setError] = useState<string>(); ...
getAccounts(); }, []); const newAccount = useCallback((passphrase: string) => { async function addAccount() { try { await KeyStore.newAccount(passphrase); setAccounts(await KeyStore.getAccounts()); } catch (err: any) { setError(err); } } ...
{ try { setAccounts(await KeyStore.getAccounts()); } catch (err: any) { setError(err); } }
identifier_body
GreaterEqual.ts
/** * @license * Copyright 2021 Google 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 required by a...
export const greaterEqualConfig: KernelConfig = { kernelName: GreaterEqual, backendName: 'webgpu', kernelFunc: greaterEqual };
cpuKernelImpl: cpuGreaterEqual });
random_line_split
ZmZimbraMail.ts
/* * T4Z - TypeScript 4 Zimlet * Copyright (C) 2017 ZeXtras S.r.l. * * This file is part of T4Z - TypeScript 4 Zimlet. * * 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, version 2 of * t...
return undefined; } public cancelRequest(reqId: string, errorCallback?: AjxCallback, noBusyOverlay?: boolean): void {} public getKeyMapMgr(): DwtKeyMapMgr { return undefined; } // Only for tests TODO: wut? public setRequestResponse(resp: ZmCsfeResult) { this.mRequestResponse = resp; } p...
{ params.callback.run(this.mRequestResponse); }
conditional_block
ZmZimbraMail.ts
/* * T4Z - TypeScript 4 Zimlet * Copyright (C) 2017 ZeXtras S.r.l. * * This file is part of T4Z - TypeScript 4 Zimlet. * * 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, version 2 of * t...
(reqId: string, errorCallback?: AjxCallback, noBusyOverlay?: boolean): void {} public getKeyMapMgr(): DwtKeyMapMgr { return undefined; } // Only for tests TODO: wut? public setRequestResponse(resp: ZmCsfeResult) { this.mRequestResponse = resp; } public getNewButton(): DwtToolBarButton { retur...
cancelRequest
identifier_name
ZmZimbraMail.ts
/* * T4Z - TypeScript 4 Zimlet * Copyright (C) 2017 ZeXtras S.r.l. * * This file is part of T4Z - TypeScript 4 Zimlet. * * 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, version 2 of * t...
private mRequestResponse: ZmCsfeResult; public sendRequest(params: ZmZimbraMailSendRequestParams): string | ZmCsfeResult { if ( typeof params.callback !== "undefined" && typeof this.mRequestResponse !== "undefined" ) { params.callback.run(this.mRequestResponse); } return undefin...
{}
identifier_body
ZmZimbraMail.ts
/* * T4Z - TypeScript 4 Zimlet * Copyright (C) 2017 ZeXtras S.r.l. * * This file is part of T4Z - TypeScript 4 Zimlet. * * 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, version 2 of * t...
} public setNewButtonProps(params: SetNewButtonPropsParams): void {} public getAppChooser(): ZmAppChooser { return undefined; } public addApp(app: ZmApp): void {} public getAppViewMgr(): ZmAppViewMgr { return undefined; } } export interface ZmZimbraMailSendRequestParams extends ZmRequestMgrSendRequestParam...
public getNewButton(): DwtToolBarButton { return undefined;
random_line_split
checkbox.d.ts
import { ElementRef, EventEmitter, Renderer, AfterContentInit } from '@angular/core'; import { ControlValueAccessor } from '@angular/common'; export declare class
{ source: MdCheckbox; checked: boolean; } /** * A material design checkbox component. Supports all of the functionality of an HTML5 checkbox, * and exposes a similar API. An MdCheckbox can be either checked, unchecked, indeterminate, or * disabled. Note that all additional accessibility attributes ar...
MdCheckboxChange
identifier_name
checkbox.d.ts
import { ElementRef, EventEmitter, Renderer, AfterContentInit } from '@angular/core'; import { ControlValueAccessor } from '@angular/common'; export declare class MdCheckboxChange { source: MdCheckbox; checked: boolean; } /** * A material design checkbox component. Supports all of the functionality of a...
* disabled. Note that all additional accessibility attributes are taken care of by the component, * so there is no need to provide them yourself. However, if you want to omit a label and still * have the checkbox be accessible, you may supply an [aria-label] input. * See: https://www.google.com/design/spec/compo...
* and exposes a similar API. An MdCheckbox can be either checked, unchecked, indeterminate, or
random_line_split
remote.py
""" Support for an interface to work with a remote instance of Home Assistant. If a connection error occurs while communicating with the API a HomeAssistantError will be raised. For more details about the Python API, please refer to the documentation at https://home-assistant.io/developers/python_api/ """ from dateti...
def validate_api(api): """Make a call to validate API.""" try: req = api(METHOD_GET, URL_API) if req.status_code == 200: return APIStatus.OK elif req.status_code == 401: return APIStatus.INVALID_PASSWORD else: return APIStatus.UNKNOWN ...
"""JSONEncoder that supports Home Assistant objects.""" # pylint: disable=too-few-public-methods,method-hidden def default(self, obj): """Convert Home Assistant objects. Hand other objects to the original method. """ if isinstance(obj, datetime): return obj.isoforma...
identifier_body
remote.py
""" Support for an interface to work with a remote instance of Home Assistant. If a connection error occurs while communicating with the API a HomeAssistantError will be raised. For more details about the Python API, please refer to the documentation at https://home-assistant.io/developers/python_api/ """ from dateti...
ha.create_timer(self) self.bus.fire(ha.EVENT_HOMEASSISTANT_START, origin=ha.EventOrigin.remote) # Give eventlet time to startup import eventlet eventlet.sleep(0.1) # Setup that events from remote_api get forwarded to local_api # Do this af...
if 'api' not in self.config.components: if not bootstrap.setup_component(self, 'api'): raise HomeAssistantError( 'Unable to setup local API to receive events')
random_line_split
remote.py
""" Support for an interface to work with a remote instance of Home Assistant. If a connection error occurs while communicating with the API a HomeAssistantError will be raised. For more details about the Python API, please refer to the documentation at https://home-assistant.io/developers/python_api/ """ from dateti...
(from_api, to_api): """Setup from_api to forward all events to to_api.""" data = { 'host': to_api.host, 'api_password': to_api.api_password, 'port': to_api.port } try: req = from_api(METHOD_POST, URL_API_EVENT_FORWARD, data) if req.status_code == 200: ...
connect_remote_events
identifier_name
remote.py
""" Support for an interface to work with a remote instance of Home Assistant. If a connection error occurs while communicating with the API a HomeAssistantError will be raised. For more details about the Python API, please refer to the documentation at https://home-assistant.io/developers/python_api/ """ from dateti...
class StateMachine(ha.StateMachine): """Fire set events to an API. Uses state_change events to track states.""" def __init__(self, bus, api): """Initalize the statemachine.""" super().__init__(None) self._api = api self.mirror() bus.listen(ha.EVENT_STATE_CHANGED, sel...
fire_event(api, event.event_type, event.data)
conditional_block
NLBAdvancedSettings.tsx
import React from 'react'; import { Field, FormikProps } from 'formik'; import { HelpField } from '@spinnaker/core'; import { IAmazonNetworkLoadBalancerUpsertCommand } from 'amazon/domain'; export interface INLBAdvancedSettingsProps { formik: FormikProps<IAmazonNetworkLoadBalancerUpsertCommand>; } export class NL...
() { const { values } = this.props.formik; return ( <div className="form-group"> <div className="col-md-3 sm-label-right"> <b>Protection</b> <HelpField id="loadBalancer.advancedSettings.deletionProtection" /> </div> <div className="col-md-7 checkbox"> <label> ...
render
identifier_name
NLBAdvancedSettings.tsx
import React from 'react'; import { Field, FormikProps } from 'formik'; import { HelpField } from '@spinnaker/core'; import { IAmazonNetworkLoadBalancerUpsertCommand } from 'amazon/domain'; export interface INLBAdvancedSettingsProps { formik: FormikProps<IAmazonNetworkLoadBalancerUpsertCommand>; } export class NL...
<Field type="checkbox" name="deletionProtection" checked={values.deletionProtection} /> Enable deletion protection </label> </div> </div> ); } }
random_line_split
ChainInstance.js
module.exports = ChainInstance; function
(chain, cb) { var instances = null; var loading = false; var queue = []; var load = function () { loading = true; chain.run(function (err, items) { instances = items; return next(); }); }; var promise = function(hwd, next) { return function () { if (!loading) { load(); } queue....
ChainInstance
identifier_name
ChainInstance.js
module.exports = ChainInstance; function ChainInstance(chain, cb) { var instances = null; var loading = false; var queue = []; var load = function () { loading = true; chain.run(function (err, items) { instances = items; return next(); }); }; var promise = function(hwd, next) { return funct...
return instances[i].save(function (err) { if (err) { if (typeof cb === "function") { cb(err); } return next(); } return saveNext(i + 1); }); }; return saveNext(0); }) }; if (typeof cb === "function") { return calls.forEach(cb); } return calls; }
{ if (typeof cb === "function") { cb(); } return next(); }
conditional_block
ChainInstance.js
module.exports = ChainInstance; function ChainInstance(chain, cb)
{ var instances = null; var loading = false; var queue = []; var load = function () { loading = true; chain.run(function (err, items) { instances = items; return next(); }); }; var promise = function(hwd, next) { return function () { if (!loading) { load(); } queue.push({ hwd: ...
identifier_body
ChainInstance.js
module.exports = ChainInstance; function ChainInstance(chain, cb) { var instances = null; var loading = false; var queue = []; var load = function () { loading = true; chain.run(function (err, items) { instances = items; return next(); }); }; var promise = function(hwd, next) { return funct...
}), get: promise(function (cb) { cb(instances); return next(); }), save: promise(function (cb) { var saveNext = function (i) { if (i >= instances.length) { if (typeof cb === "function") { cb(); } return next(); } return instances[i].save(function (err) { if (err)...
return next();
random_line_split
changePropertyTypeRule.js
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b)...
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var ts = require("typescript"); var Lint = require("tslint"); var changes_1 = require("../changes"); var memberRuleWalker_1 = require("./memberRuleWa...
{ this.constructor = d; }
identifier_body
changePropertyTypeRule.js
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b)...
if (newType) { var checker = this.getTypeChecker(); var oldType = void 0; if (node.kind === ts.SyntaxKind.GetAccessor) { var signature = checker.getSignatureFromDeclaration(node); if (!signature) return; oldT...
var newType = changes_1.changes[this.configEntryName][oldParentName] && changes_1.changes[this.configEntryName][oldParentName][oldMemberName];
random_line_split
changePropertyTypeRule.js
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b)...
() { return _super !== null && _super.apply(this, arguments) || this; } Rule.prototype.applyWithProgram = function (sourceFile, program) { return this.applyWithWalker(new ChangeReturnTypeWalker(sourceFile, this.getOptions(), program)); }; return Rule; }(Lint.Rules.TypedRule)); exports.Ru...
Rule
identifier_name
bgjob.py
# This script is an example of how you can run blender from the command line (in background mode with no interface) # to automate tasks, in this example it creates a text object, camera and light, then renders and/or saves it. # This example also shows how you can parse command line options to python scripts. # # Examp...
import sys # to get command line args import optparse # to parse options for us and print a nice help message script_name= 'background_job.py' def main(): # get the args passed to blender after "--", all of which are ignored by blender specifically # so python may receive its own arguments argv= sys.argv if ...
sce= bpy.data.scenes.active txt_data= bpy.data.curves.new('MyText', 'Text3d') # Text Object txt_ob = sce.objects.new(txt_data) # add the data to the scene as an object txt_data.setText(body_text) # set the body text to the command line arg given txt_data.setAlignment(Blender.Text3d.MIDDLE)# center text #...
identifier_body
bgjob.py
# This script is an example of how you can run blender from the command line (in background mode with no interface) # to automate tasks, in this example it creates a text object, camera and light, then renders and/or saves it. # This example also shows how you can parse command line options to python scripts. # # Examp...
options, args = parser.parse_args(argv) # In this example we wont use the args if not argv: parser.print_help() return if not options.body_text: print 'Error: --text="some string" argument not given, aborting.' parser.print_help() return # Run the example function example_function(options.body_text, o...
random_line_split
bgjob.py
# This script is an example of how you can run blender from the command line (in background mode with no interface) # to automate tasks, in this example it creates a text object, camera and light, then renders and/or saves it. # This example also shows how you can parse command line options to python scripts. # # Examp...
# Run the example function example_function(options.body_text, options.save_path, options.render_path) print 'batch job finished, exiting' if __name__ == '__main__': main()
print 'Error: --text="some string" argument not given, aborting.' parser.print_help() return
conditional_block
bgjob.py
# This script is an example of how you can run blender from the command line (in background mode with no interface) # to automate tasks, in this example it creates a text object, camera and light, then renders and/or saves it. # This example also shows how you can parse command line options to python scripts. # # Examp...
(body_text, save_path, render_path): sce= bpy.data.scenes.active txt_data= bpy.data.curves.new('MyText', 'Text3d') # Text Object txt_ob = sce.objects.new(txt_data) # add the data to the scene as an object txt_data.setText(body_text) # set the body text to the command line arg given txt_data.setAlignment(...
example_function
identifier_name
text.py
# # Copyright 2010 Free Software Foundation, Inc. # # This file was generated by gr_modtool, a tool from the GNU Radio framework # This file is a part of gr-paint # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Utilities for extracting text from generated classes. """ def is_string(txt): if isinstance(txt, s...
return description_bit(obj).strip() def description_bit(obj): if hasattr(obj, 'content'): contents = [description_bit(item) for item in obj.content] result = ''.join(contents) elif hasattr(obj, 'content_'): contents = [description_bit(item) for item in obj.content_] result ...
return None
conditional_block
text.py
# # Copyright 2010 Free Software Foundation, Inc. # # This file was generated by gr_modtool, a tool from the GNU Radio framework # This file is a part of gr-paint # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Utilities for extracting text from generated classes. """ def is_string(txt): if isinstance(txt, s...
def description_bit(obj): if hasattr(obj, 'content'): contents = [description_bit(item) for item in obj.content] result = ''.join(contents) elif hasattr(obj, 'content_'): contents = [description_bit(item) for item in obj.content_] result = ''.join(contents) elif hasattr(obj...
if obj is None: return None return description_bit(obj).strip()
identifier_body
text.py
# # Copyright 2010 Free Software Foundation, Inc. # # This file was generated by gr_modtool, a tool from the GNU Radio framework # This file is a part of gr-paint # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Utilities for extracting text from generated classes. """ def is_string(txt): if isinstance(txt, s...
(obj): if obj is None: return None return description_bit(obj).strip() def description_bit(obj): if hasattr(obj, 'content'): contents = [description_bit(item) for item in obj.content] result = ''.join(contents) elif hasattr(obj, 'content_'): contents = [description_bit(i...
description
identifier_name
text.py
# # Copyright 2010 Free Software Foundation, Inc. # # This file was generated by gr_modtool, a tool from the GNU Radio framework # This file is a part of gr-paint # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Utilities for extracting text from generated classes.
return True try: if isinstance(txt, str): return True except NameError: pass return False def description(obj): if obj is None: return None return description_bit(obj).strip() def description_bit(obj): if hasattr(obj, 'content'): contents = [...
""" def is_string(txt): if isinstance(txt, str):
random_line_split
BackupSecondFactorModalContent.tsx
import { Box, Flex, Sans } from "@artsy/palette"
import React from "react" import { createFragmentContainer, graphql } from "react-relay" import { BackupSecondFactorModalContent_me } from "__generated__/BackupSecondFactorModalContent_me.graphql" import { BackupSecondFactorModalContentQuery } from "__generated__/BackupSecondFactorModalContentQuery.graphql" import { ...
import { BorderBoxProps } from "@artsy/palette/dist/elements/BorderBox/BorderBoxBase" import { SystemQueryRenderer as QueryRenderer } from "Artsy/Relay/SystemQueryRenderer"
random_line_split
category.js
'use strict'; var superagent = require('superagent'); var assert = require('chai').assert; var tools = require('../test-tools'); var config = tools.config; var dataLoader = require('../../test-data/data-loader'); var Category = tools.Category; var User = tools.User; var categoriesData = dataLoader.categoriesData; var...
// add category with parent var catObj2 = { name: 'cate object two', parent: catObj._id }; superagent .post(url) .set('x-access-token', user.token) .send(catObj2) .end(handleResponse(catObj2, ['parent'], done)); })); }); }); });
.end(handleResponse(catObj, ['name'], function (err, res) {
random_line_split
test.ts
import rearrangeDutch from './main'; declare function require(name: string): any; const assert = require('assert'); const tests: {arrayBefore: number[], pivotIndex: number, arrayAfter: number[]}[] = [ { arrayBefore: [1], pivotIndex: 0, arrayAfter: [1] }, { arrayBefore: [2, ...
arrayBefore: [2, 1], pivotIndex: 1, arrayAfter: [1, 2] }, { arrayBefore: [3, 2, 1, 2, 5], pivotIndex: 0, arrayAfter: [2, 1, 2, 3, 5] }, { arrayBefore: [3, 2, 1, 2, 5], pivotIndex: 1, arrayAfter: [1, 2, 2, 3, 5] }, { ...
}, {
random_line_split
expn_asy.py
"""Precompute the polynomials for the asymptotic expansion of the generalized exponential integral. Sources ------- [1] NIST, Digital Library of Mathematical Functions, https://dlmf.nist.gov/8.20#ii """ import os try: import sympy from sympy import Poly x = sympy.symbols('x') except ImportError: ...
if __name__ == "__main__": main()
print(__doc__) fn = os.path.join('..', 'cephes', 'expn.h') K = 12 A = generate_A(K) with open(fn + '.new', 'w') as f: f.write(WARNING) f.write("#define nA {}\n".format(len(A))) for k, Ak in enumerate(A): tmp = ', '.join([str(x.evalf(18)) for x in Ak.coeffs()]) ...
identifier_body
expn_asy.py
"""Precompute the polynomials for the asymptotic expansion of the generalized exponential integral. Sources ------- [1] NIST, Digital Library of Mathematical Functions, https://dlmf.nist.gov/8.20#ii """ import os try: import sympy from sympy import Poly x = sympy.symbols('x') except ImportError: ...
(K): A = [Poly(1, x)] for k in range(K): A.append(Poly(1 - 2*k*x, x)*A[k] + Poly(x*(x + 1))*A[k].diff()) return A WARNING = """\ /* This file was automatically generated by _precompute/expn_asy.py. * Do not edit it manually! */ """ def main(): print(__doc__) fn = os.path.join('..', 'ce...
generate_A
identifier_name
expn_asy.py
"""Precompute the polynomials for the asymptotic expansion of the
ERROR: type should be large_string, got " https://dlmf.nist.gov/8.20#ii\n\n\"\"\"\nimport os\n\ntry:\n import sympy\n from sympy import Poly\n x = sympy.symbols('x')\nexcept ImportError:\n pass\n\n\ndef generate_A(K):\n A = [Poly(1, x)]\n for k in range(K):\n A.append(Poly(1 - 2*k*x, x)*A[k] + Poly(x*(x + 1))*A[k].diff())\n return A\n\n\nWARNING = \"\"\"\\\n/* This file was automatically generated by _precompute/expn_asy.py.\n * Do not edit it manually!\n */\n\"\"\"\n\n\ndef main():\n print(__doc__)\n fn = os.path.join('..', 'cephes', 'expn.h')\n\n K = 12\n A = generate_A(K)\n with open(fn + '.new', 'w') as f:\n f.write(WARNING)\n f.write(\"#define nA {}\\n\".format(len(A)))\n for k, Ak in enumerate(A):\n tmp = ', '.join([str(x.evalf(18)) for x in Ak.coeffs()])\n f.write(\"static const double A{}[] = {{{}}};\\n\".format(k, tmp))\n tmp = \", \".join([\"A{}\".format(k) for k in range(K + 1)])\n f.write(\"static const double *A[] = {{{}}};\\n\".format(tmp))\n tmp = \", \".join([str(Ak.degree()) for Ak in A])\n f.write(\"static const int Adegs[] = {{{}}};\\n\".format(tmp))\n os.rename(fn + '.new', fn)\n\n\nif __name__ == \"__main__\":\n main()"
generalized exponential integral. Sources ------- [1] NIST, Digital Library of Mathematical Functions,
random_line_split
expn_asy.py
"""Precompute the polynomials for the asymptotic expansion of the generalized exponential integral. Sources ------- [1] NIST, Digital Library of Mathematical Functions, https://dlmf.nist.gov/8.20#ii """ import os try: import sympy from sympy import Poly x = sympy.symbols('x') except ImportError: ...
tmp = ", ".join(["A{}".format(k) for k in range(K + 1)]) f.write("static const double *A[] = {{{}}};\n".format(tmp)) tmp = ", ".join([str(Ak.degree()) for Ak in A]) f.write("static const int Adegs[] = {{{}}};\n".format(tmp)) os.rename(fn + '.new', fn) if __name__ == "__main__": ...
tmp = ', '.join([str(x.evalf(18)) for x in Ak.coeffs()]) f.write("static const double A{}[] = {{{}}};\n".format(k, tmp))
conditional_block
admin.py
from django import forms from django.contrib import admin from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin from django.contrib.auth.forms import ReadOnlyPasswordHashField # Register your models here. from accounts.models import (User, ValidSMSCod...
def clean_password2(self): # Check that the two password entries match password1 = self.cleaned_data.get("password1") password2 = self.cleaned_data.get("password2") if password1 and password2 and password1 != password2: raise forms.ValidationError("Passwords don't match...
model = User fields = ('user', 'email', 'first_name', 'last_name')
identifier_body
admin.py
from django import forms from django.contrib import admin from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin from django.contrib.auth.forms import ReadOnlyPasswordHashField # Register your models here. from accounts.models import (User, ValidSMSCod...
(self, commit=True): # Save the provided password in hashed format user = super(UserCreationForm, self).save(commit=False) user.set_password(self.cleaned_data["password1"]) if commit: user.save() return user class UserChangeForm(forms.ModelForm): """ A form ...
save
identifier_name
admin.py
from django import forms from django.contrib import admin from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin from django.contrib.auth.forms import ReadOnlyPasswordHashField # Register your models here. from accounts.models import (User, ValidSMSCod...
search_fields = ('email',) ordering = ('email',) filter_horizontal = () # class ApplicationAdmin(admin.ModelAdmin): # """ # Tailor the Application page in the main Admin module # """ # # DONE: Add Admin view for applications # list_display = ('name', 'user') # admin.site.register(Acc...
'fields': ('user', 'email', 'password1', 'password2')} ), )
random_line_split