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
ellipsebase.ts
import { GeometryNode } from './geometrynode' import { getAttribute, svgNodeIsVisible } from '../utils/node' import { Context } from '../context/context' import { Path } from '../utils/path' import { SvgNode } from './svgnode' import { Matrix } from 'jspdf' export abstract class EllipseBase extends GeometryNode { ab...
if (!isFinite(rx) || ry <= 0 || !isFinite(ry) || ry <= 0) { return null } const x = parseFloat(getAttribute(this.element, context.styleSheets, 'cx') || '0'), y = parseFloat(getAttribute(this.element, context.styleSheets, 'cy') || '0') const lx = (4 / 3) * (Math.SQRT2 - 1) * rx, ly = ...
protected getPath(context: Context): Path | null { const rx = this.getRx(context) const ry = this.getRy(context)
random_line_split
ellipsebase.ts
import { GeometryNode } from './geometrynode' import { getAttribute, svgNodeIsVisible } from '../utils/node' import { Context } from '../context/context' import { Path } from '../utils/path' import { SvgNode } from './svgnode' import { Matrix } from 'jspdf' export abstract class EllipseBase extends GeometryNode { ab...
(parentVisible: boolean, context: Context): boolean { return svgNodeIsVisible(this, parentVisible, context) } }
isVisible
identifier_name
ellipsebase.ts
import { GeometryNode } from './geometrynode' import { getAttribute, svgNodeIsVisible } from '../utils/node' import { Context } from '../context/context' import { Path } from '../utils/path' import { SvgNode } from './svgnode' import { Matrix } from 'jspdf' export abstract class EllipseBase extends GeometryNode { ab...
}
{ return svgNodeIsVisible(this, parentVisible, context) }
identifier_body
main.js
const { app, BrowserWindow } = require('electron'); const {ipcMain} = require('electron'); // shared to-do list data global.sharedData = { itemList: [ { id: 0, text: "First meet up with David Lau on 5th July", isCompleted: true }, { id: 1, ...
ipcMain.on('item-list-update', () => { windows.forEach((win) => { win.webContents.send('refresh-item-data'); }); }); });
{ const win = new BrowserWindow({ width: 800, height: 600, show: true, }); win.loadURL(`file://${__dirname}/dist/index.html`); // win.openDevTools(); windows.push(win); }
conditional_block
main.js
const { app, BrowserWindow } = require('electron'); const {ipcMain} = require('electron'); // shared to-do list data global.sharedData = { itemList: [ { id: 0, text: "First meet up with David Lau on 5th July", isCompleted: true }, { id: 1, ...
windows.push(win); } ipcMain.on('item-list-update', () => { windows.forEach((win) => { win.webContents.send('refresh-item-data'); }); }); });
}); win.loadURL(`file://${__dirname}/dist/index.html`); // win.openDevTools();
random_line_split
linkcode.py
# -*- coding: utf-8 -*- """ linkcode ~~~~~~~~ Add external links to module code in Python object descriptions. :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division, absolute_import, print_function import warn...
continue if uri in uris or not uri: # only one link per name, please continue uris.add(uri) onlynode = addnodes.only(expr='html') onlynode += nodes.reference('', '', internal=False, refuri=uri) onlynode[0] += n...
domain = objnode.get('domain') uris = set() for signode in objnode: if not isinstance(signode, addnodes.desc_signature): continue # Convert signode to a specified format info = {} for key in domain_keys.get(domain, []): val...
conditional_block
linkcode.py
# -*- coding: utf-8 -*- """ linkcode ~~~~~~~~ Add external links to module code in Python object descriptions. :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division, absolute_import, print_function import warn...
def doctree_read(app, doctree): env = app.builder.env resolve_target = getattr(env.config, 'linkcode_resolve', None) if not isinstance(env.config.linkcode_resolve, collections.Callable): raise LinkcodeError( "Function `linkcode_resolve` is not given in conf.py") domain_keys = di...
category = "linkcode error"
identifier_body
linkcode.py
# -*- coding: utf-8 -*- """ linkcode ~~~~~~~~ Add external links to module code in Python object descriptions. :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division, absolute_import, print_function import warn...
(SphinxError): category = "linkcode error" def doctree_read(app, doctree): env = app.builder.env resolve_target = getattr(env.config, 'linkcode_resolve', None) if not isinstance(env.config.linkcode_resolve, collections.Callable): raise LinkcodeError( "Function `linkcode_resolve` i...
LinkcodeError
identifier_name
linkcode.py
# -*- coding: utf-8 -*- """ linkcode ~~~~~~~~ Add external links to module code in Python object descriptions. :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division, absolute_import, print_function import warn...
onlynode[0] += nodes.inline('', _('[source]'), classes=['viewcode-link']) signode += onlynode def setup(app): app.connect('doctree-read', doctree_read) app.add_config_value('linkcode_resolve', None, '')
random_line_split
wad_system.rs
use super::errors::{Error, ErrorKind, Result}; use engine::{DependenciesFrom, System}; use failchain::{bail, ResultExt}; use log::info; use std::path::PathBuf; use wad::{ Archive, Level as WadLevel, LevelAnalysis, LevelVisitor, LevelWalker, Result as WadResult, TextureDirectory, WadName, }; #[derive(Debug)] pu...
<V: LevelVisitor>(&self, visitor: &mut V) { LevelWalker::new( &self.level, &self.analysis, &self.textures, self.archive.metadata(), visitor, ) .walk(); } } #[derive(DependenciesFrom)] pub struct Dependencies<'context> { config:...
walk
identifier_name
wad_system.rs
use super::errors::{Error, ErrorKind, Result}; use engine::{DependenciesFrom, System}; use failchain::{bail, ResultExt}; use log::info; use std::path::PathBuf; use wad::{ Archive, Level as WadLevel, LevelAnalysis, LevelVisitor, LevelWalker, Result as WadResult, TextureDirectory, WadName, }; #[derive(Debug)] pu...
} #[derive(DependenciesFrom)] pub struct Dependencies<'context> { config: &'context Config, } impl<'context> System<'context> for WadSystem { type Dependencies = Dependencies<'context>; type Error = Error; fn debug_name() -> &'static str { "wad" } fn create(deps: Dependencies) -> Re...
{ LevelWalker::new( &self.level, &self.analysis, &self.textures, self.archive.metadata(), visitor, ) .walk(); }
identifier_body
wad_system.rs
use super::errors::{Error, ErrorKind, Result}; use engine::{DependenciesFrom, System}; use failchain::{bail, ResultExt}; use log::info; use std::path::PathBuf; use wad::{ Archive, Level as WadLevel, LevelAnalysis, LevelVisitor, LevelWalker, Result as WadResult, TextureDirectory, WadName, }; #[derive(Debug)] pu...
"Loading new level {:?} ({})...", self.level_name, self.next_level_index ); self.level = WadLevel::from_archive(&self.archive, self.current_level_index) .chain_err(|| { ErrorKind(format!( ...
{ if self.next_level_index >= self.archive.num_levels() { info!( "New level index {} is out of bounds, keeping current.", self.next_level_index ); self.next_level_index = self.current_level_index; } else { ...
conditional_block
wad_system.rs
use super::errors::{Error, ErrorKind, Result}; use engine::{DependenciesFrom, System}; use failchain::{bail, ResultExt}; use log::info; use std::path::PathBuf; use wad::{ Archive, Level as WadLevel, LevelAnalysis, LevelVisitor, LevelWalker, Result as WadResult, TextureDirectory, WadName, }; #[derive(Debug)] pu...
.name(); info!( "Loading new level {:?} ({})...", self.level_name, self.next_level_index ); self.level = WadLevel::from_archive(&self.archive, self.current_level_index) .chain_err(|| { ...
"while accessing level name for next level request {}", self.next_level_index )) })?
random_line_split
types.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
it('returns true for ColumnMeta with expression', () => { expect(isSavedExpression(SAVED_EXPRESSION)).toEqual(true); }); });
}); it('returns false for ColumnMeta without expression', () => { expect(isSavedExpression(COLUMN_META)).toEqual(false); });
random_line_split
pci.rs
/* SPDX-License-Identifier: GPL-2.0-only */ use std::collections::HashMap; pub struct ConfigAddr(pub u32); impl ConfigAddr { pub fn enabled(&self) -> bool { (self.0 & (1 << 31)) != 0 } pub fn offset(&self) -> u8 { (self.0 & 0xff) as u8 } pub fn bdf(&self) -> u16 { ((self...
} pub fn write(&mut self, value: u32) { let bdf = self.config_addr.bdf(); if let Some(device) = self.devices.get_mut(&bdf) { device.write(self.config_addr.offset(), value); } } }
{ u32::MAX }
conditional_block
pci.rs
/* SPDX-License-Identifier: GPL-2.0-only */ use std::collections::HashMap; pub struct ConfigAddr(pub u32); impl ConfigAddr { pub fn enabled(&self) -> bool { (self.0 & (1 << 31)) != 0 } pub fn offset(&self) -> u8 { (self.0 & 0xff) as u8 } pub fn bdf(&self) -> u16 { ((self...
{ pub config_addr: ConfigAddr, pub devices: HashMap<u16, Box<dyn PciDevice + Send>>, } impl PciBus { pub fn new() -> Self { let host_bridge = HostBridge::new(); let mut pci_bus = PciBus { config_addr: ConfigAddr(0), devices: HashMap::new(), }; pci_bu...
PciBus
identifier_name
pci.rs
/* SPDX-License-Identifier: GPL-2.0-only */ use std::collections::HashMap; pub struct ConfigAddr(pub u32); impl ConfigAddr { pub fn enabled(&self) -> bool { (self.0 & (1 << 31)) != 0 } pub fn offset(&self) -> u8 { (self.0 & 0xff) as u8 } pub fn bdf(&self) -> u16 { ((self...
pub trait PciDevice { fn read(&self, offset: u8) -> u32; fn write(&mut self, offset: u8, value: u32); } pub struct HostBridge { pub data: [u32; 16], } impl HostBridge { pub fn new() -> Self { //0:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01) let ...
} }
random_line_split
webroot.py
# -*- coding: utf-8 -*- import json import os import re import cherrypy import mako from girder import constants from girder.models.setting import Setting from girder.settings import SettingKey from girder.utility import config class WebrootBase: """ Serves a template file in response to GET requests. ...
self.vars['apiRoot'] = server.getApiRoot() self.vars['staticPublicPath'] = server.getStaticPublicPath() self.vars['brandName'] = Setting().get(SettingKey.BRAND_NAME) self.vars['contactEmail'] = Setting().get(SettingKey.CONTACT_EMAIL_ADDRESS) self.vars['privacyNoticeHref'] = Set...
self.vars['pluginJs'].append(plugin)
conditional_block
webroot.py
# -*- coding: utf-8 -*- import json import os import re import cherrypy import mako from girder import constants from girder.models.setting import Setting from girder.settings import SettingKey from girder.utility import config class WebrootBase: """ Serves a template file in response to GET requests. ...
self.vars = {} def _renderHTML(self): from girder.utility import server from girder.plugin import loadedPlugins self.vars['plugins'] = loadedPlugins() self.vars['pluginCss'] = [] self.vars['pluginJs'] = [] builtDir = os.path.join(constants.STATIC_ROOT_DIR, '...
if not templatePath: templatePath = os.path.join(constants.PACKAGE_DIR, 'utility', 'webroot.mako') super().__init__(templatePath)
random_line_split
webroot.py
# -*- coding: utf-8 -*- import json import os import re import cherrypy import mako from girder import constants from girder.models.setting import Setting from girder.settings import SettingKey from girder.utility import config class WebrootBase:
self.vars.update(vars) def setTemplatePath(self, templatePath): """ Set the path to a template file to render instead of the default template. The default template remains available so that custom templates can inherit from it. To do so, save the default template filename f...
""" Serves a template file in response to GET requests. This will typically be the base class of any non-API endpoints. """ exposed = True def __init__(self, templatePath): self.vars = {} self.config = config.getConfig() self._templateDirs = [] self.setTemplatePat...
identifier_body
webroot.py
# -*- coding: utf-8 -*- import json import os import re import cherrypy import mako from girder import constants from girder.models.setting import Setting from girder.settings import SettingKey from girder.utility import config class WebrootBase: """ Serves a template file in response to GET requests. ...
(self, **params): raise cherrypy.HTTPError(405) def PUT(self, **params): raise cherrypy.HTTPError(405) class Webroot(WebrootBase): """ The webroot endpoint simply serves the main index HTML file. """ def __init__(self, templatePath=None): if not templatePath: ...
POST
identifier_name
semver-tests.ts
/// <reference path="semver.d.ts" /> var obj:Object; var bool:boolean; var num:number; var str:string; var x:any = null; var arr:any[]; var exp:RegExp; var strArr:string[]; var numArr:string[]; var mod:typeof SemVerModule; var v1:string, v2:string; var version:string; var versions:string[]; var loose:boolean; str =...
str = range.inspect(); str = range.toString(); bool = range.test(ver); var sets:SemVerModule.Comparator[][]; sets = range.set; var lims:SemVerModule.Comparator[]; lims = range.parseRange(str);
random_line_split
profile-settings.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ import { Map } from "immutable"; import { React, rclass, rtypes, Component, Rendered } from "../app-framework"; import { Panel } from "../antd-bootstrap"; import { LabeledRow, ...
first_name?: string; last_name?: string; // redux props account_id: string; profile: Map<string, any>; } interface State { show_instructions: boolean; } class ProfileSettings extends Component<Props, State> { constructor(props, state) { super(props, state); this.state = { show_instructions: fal...
interface Props { email_address?: string;
random_line_split
profile-settings.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ import { Map } from "immutable"; import { React, rclass, rtypes, Component, Rendered } from "../app-framework"; import { Panel } from "../antd-bootstrap"; import { LabeledRow, ...
{ return { account: { account_id: rtypes.string, profile: rtypes.immutable.Map, }, }; } private onColorChange(value: string): void { set_account_table({ profile: { color: value } }); } private render_header(): Rendered { return ( <> <Avatar account_id=...
uxProps()
identifier_name
profile-settings.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ import { Map } from "immutable"; import { React, rclass, rtypes, Component, Rendered } from "../app-framework"; import { Panel } from "../antd-bootstrap"; import { LabeledRow, ...
private onColorChange(value: string): void { set_account_table({ profile: { color: value } }); } private render_header(): Rendered { return ( <> <Avatar account_id={this.props.account_id} size={48} /> <Space /> <Space /> Avatar </> ); } public render():...
return { account: { account_id: rtypes.string, profile: rtypes.immutable.Map, }, }; }
identifier_body
DefensesShattered.ts
import { SpellEffect } from '../../base/Effect'; import { Character } from '../../../shared/models/character';
import { Revealed } from '../misc/Revealed'; export class RecentlyShattered extends SpellEffect { iconData = { name: 'on-sight', color: '#333', tooltipDesc: 'Recently had shattered defenses and cannot be shattered for a period.' }; cast(caster: Character, target: Character, skillRef?: Skill) { ...
import { Skill } from '../../base/Skill';
random_line_split
DefensesShattered.ts
import { SpellEffect } from '../../base/Effect'; import { Character } from '../../../shared/models/character'; import { Skill } from '../../base/Skill'; import { Revealed } from '../misc/Revealed'; export class RecentlyShattered extends SpellEffect { iconData = { name: 'on-sight', color: '#333', toolti...
(char: Character) { this.effectMessageRadius(char, `${char.name} pinpoints the hidden attackers!`); const revealed = char.$$room.state.getPlayersInRange(char, 4, [], false); revealed.forEach(target => { const revealEffect = new Revealed({}); revealEffect.duration = 3; revealEffect.cast(ch...
effectStart
identifier_name
DefensesShattered.ts
import { SpellEffect } from '../../base/Effect'; import { Character } from '../../../shared/models/character'; import { Skill } from '../../base/Skill'; import { Revealed } from '../misc/Revealed'; export class RecentlyShattered extends SpellEffect { iconData = { name: 'on-sight', color: '#333', toolti...
}
{ const recently = new RecentlyShattered({}); recently.cast(char, char); this.effectMessage(char, 'Your defenses have recovered.'); }
identifier_body
models.py
from django.db import models from django.contrib.auth.models import User class Task(models.Model): name = models.CharField(max_length=100) def __unicode__(self): return self.name class Surgeon(models.Model): name = models.CharField(max_length=100) def __unicode__(self):
class Video(models.Model): filename = models.CharField(max_length=200) task = models.ForeignKey(Task) surgeon = models.ForeignKey(Surgeon) def __unicode__(self): return self.filename + " | " + self.task.name + " | By: " + self.surgeon.name class Rating(models.Model): user = models.Foreig...
return self.name
identifier_body
models.py
from django.db import models from django.contrib.auth.models import User class Task(models.Model): name = models.CharField(max_length=100) def __unicode__(self): return self.name class Surgeon(models.Model): name = models.CharField(max_length=100) def __unicode__(self): return self....
filename = models.CharField(max_length=200) task = models.ForeignKey(Task) surgeon = models.ForeignKey(Surgeon) def __unicode__(self): return self.filename + " | " + self.task.name + " | By: " + self.surgeon.name class Rating(models.Model): user = models.ForeignKey(User) video = models...
class Video(models.Model):
random_line_split
models.py
from django.db import models from django.contrib.auth.models import User class
(models.Model): name = models.CharField(max_length=100) def __unicode__(self): return self.name class Surgeon(models.Model): name = models.CharField(max_length=100) def __unicode__(self): return self.name class Video(models.Model): filename = models.CharField(max_length=200) ...
Task
identifier_name
Foursquare.py
import string, urllib, urllib2, logging from webapp2_extras import json import Handlers, Config class FoursquareException(Exception): def __init__(self, message, value): super(self, Exception).__init__(message) self.value = value class FoursquareApiException(FoursquareException): pass class Four...
make a request to the endpoint, parse the result, and return it.""" url = self.foursquareApiUrl(apiPath, accessToken) request = urllib2.urlopen(url) content = request.read() # Criminy. http://stackoverflow.com/a/1020931/87990 encoding = request.headers['content-t...
"""Given a partial foursquare API endpoint path and an auth token,
random_line_split
Foursquare.py
import string, urllib, urllib2, logging from webapp2_extras import json import Handlers, Config class FoursquareException(Exception): def __init__(self, message, value): super(self, Exception).__init__(message) self.value = value class FoursquareApiException(FoursquareException): pass class Four...
self.setCookie(self.OAUTH_COOKIE, access_token) def getFoursquareCheckins(self, accessToken): """Get the list of the signed-in user's checkins, per https://developer.foursquare.com/docs/users/checkins""" return self.getFoursquareApi('users/self/checkins', accessToken)...
raise FoursquareException(result)
conditional_block
Foursquare.py
import string, urllib, urllib2, logging from webapp2_extras import json import Handlers, Config class FoursquareException(Exception): def __init__(self, message, value): super(self, Exception).__init__(message) self.value = value class FoursquareApiException(FoursquareException):
class FoursquareMixin(Handlers.WebAuth, Config.ConfigAware): """This is a mixin class which has several convenience methods for constructing foursquare-related URL, based on the assumption that a configParser instance is in the app configuration.""" # Default setting for config lookups DEFA...
pass
identifier_body
Foursquare.py
import string, urllib, urllib2, logging from webapp2_extras import json import Handlers, Config class FoursquareException(Exception): def __init__(self, message, value): super(self, Exception).__init__(message) self.value = value class FoursquareApiException(FoursquareException): pass class Four...
(self, apiPath, accessToken): """Given a partial foursquare API endpoint path and an auth token, make a request to the endpoint, parse the result, and return it.""" url = self.foursquareApiUrl(apiPath, accessToken) request = urllib2.urlopen(url) content = request.read() ...
getFoursquareApi
identifier_name
web3.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 lat...
//! Web3 rpc implementation. use hash::keccak; use jsonrpc_core::Result; use util::version; use v1::traits::Web3; use v1::types::{H256, Bytes}; /// Web3 rpc implementation. pub struct Web3Client; impl Web3Client { /// Creates new Web3Client. pub fn new() -> Self { Web3Client } } impl Web3 for Web3Client { fn clie...
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
random_line_split
web3.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 lat...
} impl Web3 for Web3Client { fn client_version(&self) -> Result<String> { Ok(version().to_owned().replace("Parity/", "Parity//")) } fn sha3(&self, data: Bytes) -> Result<H256> { Ok(keccak(&data.0).into()) } }
{ Web3Client }
identifier_body
web3.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 lat...
(&self) -> Result<String> { Ok(version().to_owned().replace("Parity/", "Parity//")) } fn sha3(&self, data: Bytes) -> Result<H256> { Ok(keccak(&data.0).into()) } }
client_version
identifier_name
security_level.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 la...
{ /// All blocks from genesis to chain head are known to have valid state transitions and PoW. FullState, /// All blocks from genesis to chain head are known to have a valid PoW. FullProofOfWork, /// Some recent headers (the argument) are known to have a valid PoW. PartialProofOfWork(BlockNumber), } impl Securi...
SecurityLevel
identifier_name
security_level.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 la...
}
_ => false, } }
random_line_split
security_level.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 la...
}
{ match *self { SecurityLevel::FullState | SecurityLevel::FullProofOfWork => true, _ => false, } }
identifier_body
closure-bounds-squiggle-closure-as-copyable-typaram.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(x: ~fn:Copy()) -> (~fn:(), ~fn:()) { bar(x) } fn main() { let v = ~[~[1,2,3],~[4,5,6]]; // shouldn't get double-freed let (f1,f2) = do foo { assert!(v.len() == 2); }; f1(); f2(); }
foo
identifier_name
closure-bounds-squiggle-closure-as-copyable-typaram.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
; f1(); f2(); }
{ let v = ~[~[1,2,3],~[4,5,6]]; // shouldn't get double-freed let (f1,f2) = do foo { assert!(v.len() == 2); }
identifier_body
closure-bounds-squiggle-closure-as-copyable-typaram.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
bar(x) } fn main() { let v = ~[~[1,2,3],~[4,5,6]]; // shouldn't get double-freed let (f1,f2) = do foo { assert!(v.len() == 2); }; f1(); f2(); }
random_line_split
editar-agendamento.component.ts
/** * Created by andypax on 06/11/16. */ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { AgendamentoModel } from './agendamento.model'; import { AgendamentoService } from './agendamento.service'; @Component({ templateUrl: 'app/agendamento/tem...
atualizar() { this.agendamentoService.atulaizar(this.id, this.agenda); this.router.navigate(['/perfil-proprietario']); } }
ngOnInit() { this.id = +this.route.snapshot.params['id']; this.agenda = this.agendamentoService.buscarPorId(this.id); }
random_line_split
editar-agendamento.component.ts
/** * Created by andypax on 06/11/16. */ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { AgendamentoModel } from './agendamento.model'; import { AgendamentoService } from './agendamento.service'; @Component({ templateUrl: 'app/agendamento/tem...
() { this.id = +this.route.snapshot.params['id']; this.agenda = this.agendamentoService.buscarPorId(this.id); } atualizar() { this.agendamentoService.atulaizar(this.id, this.agenda); this.router.navigate(['/perfil-proprietario']); } }
ngOnInit
identifier_name
editar-agendamento.component.ts
/** * Created by andypax on 06/11/16. */ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { AgendamentoModel } from './agendamento.model'; import { AgendamentoService } from './agendamento.service'; @Component({ templateUrl: 'app/agendamento/tem...
atualizar() { this.agendamentoService.atulaizar(this.id, this.agenda); this.router.navigate(['/perfil-proprietario']); } }
{ this.id = +this.route.snapshot.params['id']; this.agenda = this.agendamentoService.buscarPorId(this.id); }
identifier_body
index.ts
import { A } from '@ember/array'; import Route from '@ember/routing/route'; import Ember from 'ember'; import Pretender from 'pretender'; const { testing } = Ember; const LEGACY_PAYLOAD = { fruit: [ { id: 1, name: 'apple' }, { id: 2, name: 'pear' }, { id: 3, n...
() { let arr: any = []; this.store.pushPayload('fruit', !this.store.peekAll ? LEGACY_PAYLOAD : PAYLOAD); if (!this.store.peekAll) { arr = [1, 2, 3, 4].map(id => (this.store as any).getById('fruit', id)); } else { arr = this.store.peekAll('fruit'); } return A(arr); }, beforeModel...
model
identifier_name
index.ts
import { A } from '@ember/array'; import Route from '@ember/routing/route'; import Ember from 'ember'; import Pretender from 'pretender'; const { testing } = Ember; const LEGACY_PAYLOAD = { fruit: [ { id: 1, name: 'apple' }, { id: 2, name: 'pear' }, { id: 3, n...
}, deactivate() { this._super(...arguments); }, willDestroy() { this._super(...arguments); if (!this.get('currentModel').constructor) { this.get('currentModel').constructor = {}; } }, _setupPretender() { const server = new Pretender(); // server.get('/fruits', request => { ...
{ this._setupPretender(); }
conditional_block
index.ts
import { A } from '@ember/array'; import Route from '@ember/routing/route'; import Ember from 'ember'; import Pretender from 'pretender'; const { testing } = Ember; const LEGACY_PAYLOAD = { fruit: [ { id: 1, name: 'apple' }, { id: 2, name: 'pear' }, { id: 3, n...
arr = [1, 2, 3, 4].map(id => (this.store as any).getById('fruit', id)); } else { arr = this.store.peekAll('fruit'); } return A(arr); }, beforeModel() { this._super(...arguments); if (!testing) { this._setupPretender(); } }, deactivate() { this._super(...arguments)...
let arr: any = []; this.store.pushPayload('fruit', !this.store.peekAll ? LEGACY_PAYLOAD : PAYLOAD); if (!this.store.peekAll) {
random_line_split
index.ts
import { A } from '@ember/array'; import Route from '@ember/routing/route'; import Ember from 'ember'; import Pretender from 'pretender'; const { testing } = Ember; const LEGACY_PAYLOAD = { fruit: [ { id: 1, name: 'apple' }, { id: 2, name: 'pear' }, { id: 3, n...
, deactivate() { this._super(...arguments); }, willDestroy() { this._super(...arguments); if (!this.get('currentModel').constructor) { this.get('currentModel').constructor = {}; } }, _setupPretender() { const server = new Pretender(); // server.get('/fruits', request => { ...
{ this._super(...arguments); if (!testing) { this._setupPretender(); } }
identifier_body
alpha_spaces.spec.ts
import validate from '../src/alpha_spaces';
expect(validate('a', [undefined])).toBe(true); expect(validate('abcdefgHijklMnOpqRsTUVwxYZ', [undefined])).toBe(true); expect(validate('', [undefined])).toBe(true); expect(validate(null, [undefined])).toBe(true); expect(validate(undefined, [undefined])).toBe(true); expect(validate('null', [undefined])).toBe...
test('validates that the string may only contain alphabetic characters and spaces', () => {
random_line_split
text_field_handler.tsx
0) { return; } } } element = this.getNode(); const countNewlines = (s: string) => s.split("\n").length - 1; const getContOffset = (totalIndex: number) => { const startOfLine = 1 + this.text.lastIndexOf('\n', totalIndex - 1); let offset = totalInd...
{ // scroll so that the node with 'node-in-view' class, if it exists // is in view, if necessary const container = this.getContainerNode(); const node = $(container).find('.node-in-view').get(0); if (node) { // position() is relative to the contenteditable div const nodeTop...
identifier_body
text_field_handler.tsx
newSelection, newText] = this.getSelectionAndText(); const selection = this.selection; const text = this.baseText; let op; try { op = getOpForTextChange(selection, text, newSelection, newText); Utils.assert(newText === OtText.applyTextOp(text, op)); } catch (ex) { ...
// run of spaces r = l + 1; while (r < text.length && Utils.isWhitespace(text.charAt(r))) { r += 1 } cur_line.push({ node: node, left: l, right: r, text: " ", isSpace: true }); } else { // run of text ...
let r; if (Utils.isWhitespace(text.charAt(l))) {
random_line_split
text_field_handler.tsx
newSelection, newText] = this.getSelectionAndText(); const selection = this.selection; const text = this.baseText; let op; try { op = getOpForTextChange(selection, text, newSelection, newText); Utils.assert(newText === OtText.applyTextOp(text, op)); } catch (ex) { ...
() : [Range[], string] { const element: any = this.getNode(); // Ugh, some annoying crap for traversing the DOM nodes for dealing // with the crazy way browsers interpret spaces. const text_lines: string[] = []; let cur_line: LineInfoPiece[] = []; let cur_line_has_text = false; ...
getSelectionAndText
identifier_name
text_field_handler.tsx
Selection, newText] = this.getSelectionAndText(); const selection = this.selection; const text = this.baseText; let op; try { op = getOpForTextChange(selection, text, newSelection, newText); Utils.assert(newText === OtText.applyTextOp(text, op)); } catch (ex) { //...
} element = this.getNode(); const countNewlines = (s: string) => s.split("\n").length - 1; const getContOffset = (totalIndex: number) => { const startOfLine = 1 + this.text.lastIndexOf('\n', totalIndex - 1); let offset = totalIndex - startOfLine; const containerIndex ...
{ const range = selObj.getRangeAt(i); if ($(range.startContainer).closest(element).size() === 0) { return; } if ($(range.endContainer).closest(element).size() === 0) { return; } }
conditional_block
_ImageEdit3MultiProcess.py
# print("dx: " + str(dx) + " , dy: " + str(dy)) # if y - dsy < resolution + 1 and y - dsy > 0-(resolution + 1): #round(dsy) == y: return 255 else: return 0 red = 0 green = 0 blue = 0 canvas_height = im.height canvas_width = im.width OldXRange = (canvas_...
x = datax #print("[" + str(threadName) + "] Processing " + str(x)) y = canvas_height while y > 0: y = y - 1 qlock.acquire() im.tmppix = im.tmppix + 1 qlock.release() #print("Solving: " + str(x...
if gotqdata: #queueLock.release() #print ("%s processing %s" % (threadName, data))
random_line_split
_ImageEdit3MultiProcess.py
print("An error occured when importing the image: " + str(ex)) else: print("An Error Occured With Setting The Mode") while True: pass print("""Operations: 0: Nothing 1: Greyscale 2: Custom """) opsuccess = False while not opsuccess: tr...
if not os.path.isfile(filename + "-" + str(savid) + "sav.png"): imoutput.save(filename + "-" + str(savid) + "sav.png", "PNG") saved = True else: savid = savid + 1
conditional_block
_ImageEdit3MultiProcess.py
(var_old_min, var_old_max, var_new_min, var_new_max, var_value): OldSRange = (var_old_max - var_old_min) NewSRange = (var_new_max - var_new_min) return (((var_value - var_old_min) * NewSRange) / OldSRange) + var_new_min def is_even(value_to_test): return value_to_test % 2 == 0 ...
scale
identifier_name
_ImageEdit3MultiProcess.py
def is_even(value_to_test): return value_to_test % 2 == 0 def draw_funct(dfunction, dxmin, dxmax, dymin, dymax, resolution): dx = scale(0,canvas_width,dxmin,dxmax,x) cdy = eval(dfunction) dx = scale(0,canvas_width,dxmin,dxmax,x-resolution) pdy = eval(dfunction) ...
OldSRange = (var_old_max - var_old_min) NewSRange = (var_new_max - var_new_min) return (((var_value - var_old_min) * NewSRange) / OldSRange) + var_new_min
identifier_body
en-IL.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function
(n: number): number { let i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length; if (i === 1 && v === 0) return 1; return 5; } export default [ 'en-IL', [ ['a', 'p'], ['AM', 'PM'], ], [ ['AM', 'PM'], , ], [ ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon'...
plural
identifier_name
en-IL.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n: number...
], [ ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] ], , [ ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], ['Jan...
,
random_line_split
en-IL.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n: number...
export default [ 'en-IL', [ ['a', 'p'], ['AM', 'PM'], ], [ ['AM', 'PM'], , ], [ ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], ['Su', 'Mo', 'Tu', 'We', 'Th',...
{ let i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length; if (i === 1 && v === 0) return 1; return 5; }
identifier_body
demo-step.js
'use strict'; var d3Selection = require('d3-selection'),
PubSub = require('pubsub-js'), step = require('./../src/charts/step'), miniTooltip = require('./../src/charts/mini-tooltip'), dataBuilder = require('./../test/fixtures/stepChartDataBuilder'); function createStepChart() { var stepChart = step(), tooltip = miniTooltip(), testDataS...
random_line_split
demo-step.js
'use strict'; var d3Selection = require('d3-selection'), PubSub = require('pubsub-js'), step = require('./../src/charts/step'), miniTooltip = require('./../src/charts/mini-tooltip'), dataBuilder = require('./../test/fixtures/stepChartDataBuilder'); function
() { var stepChart = step(), tooltip = miniTooltip(), testDataSet = new dataBuilder.StepDataBuilder(), stepContainer = d3Selection.select('.js-step-chart-container'), containerWidth = stepContainer.node() ? stepContainer.node().getBoundingClientRect().width : false, tooltipCo...
createStepChart
identifier_name
demo-step.js
'use strict'; var d3Selection = require('d3-selection'), PubSub = require('pubsub-js'), step = require('./../src/charts/step'), miniTooltip = require('./../src/charts/mini-tooltip'), dataBuilder = require('./../test/fixtures/stepChartDataBuilder'); function createStepChart()
.xAxisLabelOffset(45) .yAxisLabel('Quantity') .yAxisLabelOffset(-50) .margin({ top: 40, right: 40, bottom: 50, left: 80 }) .on('customMouseOver', tooltip.show) .on('customM...
{ var stepChart = step(), tooltip = miniTooltip(), testDataSet = new dataBuilder.StepDataBuilder(), stepContainer = d3Selection.select('.js-step-chart-container'), containerWidth = stepContainer.node() ? stepContainer.node().getBoundingClientRect().width : false, tooltipConta...
identifier_body
demo-step.js
'use strict'; var d3Selection = require('d3-selection'), PubSub = require('pubsub-js'), step = require('./../src/charts/step'), miniTooltip = require('./../src/charts/mini-tooltip'), dataBuilder = require('./../test/fixtures/stepChartDataBuilder'); function createStepChart() { var stepChart = ...
{ createStepChart(); // For getting a responsive behavior on our chart, // we'll need to listen to the window resize event var redrawCharts = function(){ d3Selection.select('.step-chart').remove(); createStepChart(); }; // Redraw charts on window resize PubSub.subscribe('r...
conditional_block
gulpfile.babel.js
import gulp from "gulp"; import {spawn} from "child_process"; import hugoBin from "hugo-bin"; import gutil from "gulp-util"; import gulpif from "gulp-if"; import yargs from "yargs"; import postcss from "gulp-postcss"; import cssnext from "postcss-cssnext"; import cssnano from "gulp-cssnano"; import atImport from "postc...
else { browserSync.notify("Hugo build failed :("); cb("Hugo build failed"); } }); }
{ browserSync.reload(); cb(); }
conditional_block
gulpfile.babel.js
import gulp from "gulp"; import {spawn} from "child_process"; import hugoBin from "hugo-bin"; import gutil from "gulp-util"; import gulpif from "gulp-if"; import yargs from "yargs"; import postcss from "gulp-postcss"; import cssnext from "postcss-cssnext"; import cssnano from "gulp-cssnano"; import atImport from "postc...
import webpackConfig from "./webpack.conf"; const browserSync = BrowserSync.create(); const argv = yargs.argv; // Hugo arguments const hugoArgsDefault = ["-d", "../dist", "-s", "site", "-v"]; const hugoArgsPreview = ["--baseUrl=/", "--cleanDestinationDir", "--buildDrafts", "--buildFuture"]; // Development tasks gulp...
import BrowserSync from "browser-sync"; import webpack from "webpack";
random_line_split
gulpfile.babel.js
import gulp from "gulp"; import {spawn} from "child_process"; import hugoBin from "hugo-bin"; import gutil from "gulp-util"; import gulpif from "gulp-if"; import yargs from "yargs"; import postcss from "gulp-postcss"; import cssnext from "postcss-cssnext"; import cssnano from "gulp-cssnano"; import atImport from "postc...
(cb, options, environment = "development") { const args = options ? hugoArgsDefault.concat(options) : hugoArgsDefault; process.env.NODE_ENV = environment; return spawn(hugoBin, args, {stdio: "inherit"}).on("close", (code) => { if (code === 0) { browserSync.reload(); cb(); } else { brow...
buildSite
identifier_name
gulpfile.babel.js
import gulp from "gulp"; import {spawn} from "child_process"; import hugoBin from "hugo-bin"; import gutil from "gulp-util"; import gulpif from "gulp-if"; import yargs from "yargs"; import postcss from "gulp-postcss"; import cssnext from "postcss-cssnext"; import cssnano from "gulp-cssnano"; import atImport from "postc...
{ const args = options ? hugoArgsDefault.concat(options) : hugoArgsDefault; process.env.NODE_ENV = environment; return spawn(hugoBin, args, {stdio: "inherit"}).on("close", (code) => { if (code === 0) { browserSync.reload(); cb(); } else { browserSync.notify("Hugo build failed :("); ...
identifier_body
semanticTokensDto.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(arr: Uint8Array): void { for (let i = 0, len = arr.length; i < len; i += 4) { // flip bytes 0<->3 and 1<->2 const b0 = arr[i + 0]; const b1 = arr[i + 1]; const b2 = arr[i + 2]; const b3 = arr[i + 3]; arr[i + 0] = b3; arr[i + 1] = b2; arr[i + 2] = b1; arr[i + 3] = b0; } } function toLittleEndianBuf...
reverseEndianness
identifier_name
semanticTokensDto.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
export function encodeSemanticTokensDto(semanticTokens: ISemanticTokensDto): VSBuffer { const dest = new Uint32Array(encodeSemanticTokensDtoSize(semanticTokens)); let offset = 0; dest[offset++] = semanticTokens.id; if (semanticTokens.type === 'full') { dest[offset++] = EncodedSemanticTokensType.Full; dest[off...
{ const uint8Arr = buff.buffer; if (!platform.isLittleEndian()) { // the byte order must be changed reverseEndianness(uint8Arr); } if (uint8Arr.byteOffset % 4 === 0) { return new Uint32Array(uint8Arr.buffer, uint8Arr.byteOffset, uint8Arr.length / 4); } else { // unaligned memory access doesn't work on all ...
identifier_body
semanticTokensDto.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
else { dest[offset++] = EncodedSemanticTokensType.Delta; dest[offset++] = semanticTokens.deltas.length; for (const delta of semanticTokens.deltas) { dest[offset++] = delta.start; dest[offset++] = delta.deleteCount; if (delta.data) { dest[offset++] = delta.data.length; dest.set(delta.data, offset...
{ dest[offset++] = EncodedSemanticTokensType.Full; dest[offset++] = semanticTokens.data.length; dest.set(semanticTokens.data, offset); offset += semanticTokens.data.length; }
conditional_block
semanticTokensDto.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} export type ISemanticTokensDto = IFullSemanticTokensDto | IDeltaSemanticTokensDto; const enum EncodedSemanticTokensType { Full = 1, Delta = 2 } function reverseEndianness(arr: Uint8Array): void { for (let i = 0, len = arr.length; i < len; i += 4) { // flip bytes 0<->3 and 1<->2 const b0 = arr[i + 0]; cons...
id: number; type: 'delta'; deltas: { start: number; deleteCount: number; data?: Uint32Array; }[];
random_line_split
png.py
# Copyright 2014, Sandia Corporation. Under the terms of Contract # DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain # rights in this software. from __future__ import absolute_import from __future__ import division import toyplot.cairo.png def
(canvas, fobj=None, width=None, height=None, scale=None): """Render the PNG bitmap representation of a canvas. By default, canvas dimensions in CSS pixels are mapped directly to pixels in the output PNG image. Use one of `width`, `height`, or `scale` to override this behavior. Parameters ----...
render
identifier_name
png.py
# Copyright 2014, Sandia Corporation. Under the terms of Contract # DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain # rights in this software. from __future__ import absolute_import from __future__ import division import toyplot.cairo.png def render(canvas, fobj=None, width=None, hei...
Returns ------- frames: Python generator expression that returns each PNG image in the sequence. The caller must iterate over the returned frames and is responsible for all subsequent processing, including disk I/O, video compression, etc. Notes ----- The output PNG images are curr...
Specify the width of the output image in pixels. height: number, optional Specify the height of the output image in pixels. scale: number, optional Ratio of output image pixels to `canvas` pixels.
random_line_split
png.py
# Copyright 2014, Sandia Corporation. Under the terms of Contract # DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain # rights in this software. from __future__ import absolute_import from __future__ import division import toyplot.cairo.png def render(canvas, fobj=None, width=None, hei...
Returns ------- png: PNG image data, or `None` PNG representation of `canvas`, or `None` if the caller specifies the `fobj` parameter. Notes ----- The output PNG is currently rendered using :func:`toyplot.cairo.png.render()`. This may change in the future. """ return t...
"""Render the PNG bitmap representation of a canvas. By default, canvas dimensions in CSS pixels are mapped directly to pixels in the output PNG image. Use one of `width`, `height`, or `scale` to override this behavior. Parameters ---------- canvas: :class:`toyplot.canvas.Canvas` Canvas...
identifier_body
StorageInfoResponse.py
#!/usr/bin/env python """ Copyright 2012 GroupDocs. 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...
""" NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.""" def __init__(self): self.swaggerTypes = { 'result': 'StorageInfoResult', 'status': 'str', 'error_message': 'str', 'composedOn': 'int...
identifier_body
StorageInfoResponse.py
#!/usr/bin/env python """ Copyright 2012 GroupDocs. 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...
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ class StorageInfoResponse: """ NOTE: This class is auto generated by the swagger code generator program. Do not edi...
random_line_split
StorageInfoResponse.py
#!/usr/bin/env python """ Copyright 2012 GroupDocs. 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...
(self): self.swaggerTypes = { 'result': 'StorageInfoResult', 'status': 'str', 'error_message': 'str', 'composedOn': 'int' } self.result = None # StorageInfoResult self.status = None # str self.error_message = None # str s...
__init__
identifier_name
simple_tests.py
from hiveplotter import HivePlot from networkx import nx import random from unittest import TestCase SEED = 1 NTYPES = ['A', 'B', 'C'] class SimpleCase(TestCase): def make_graph(self): G = nx.fast_gnp_random_graph(30, 0.2, seed=SEED) for node, data in G.nodes_iter(data=True): data[...
tests = SimpleCase() tests.test_simple()
conditional_block
simple_tests.py
from hiveplotter import HivePlot from networkx import nx import random from unittest import TestCase SEED = 1 NTYPES = ['A', 'B', 'C'] class SimpleCase(TestCase): def make_graph(self): G = nx.fast_gnp_random_graph(30, 0.2, seed=SEED) for node, data in G.nodes_iter(data=True): data[...
if __name__ == '__main__': tests = SimpleCase() tests.test_simple()
def test_dump_cfg(self): G = self.make_graph() H = HivePlot(G, node_class_attribute='ntype') H.draw() print(H.dump_config())
random_line_split
simple_tests.py
from hiveplotter import HivePlot from networkx import nx import random from unittest import TestCase SEED = 1 NTYPES = ['A', 'B', 'C'] class SimpleCase(TestCase):
H.draw() print(H.dump_config()) if __name__ == '__main__': tests = SimpleCase() tests.test_simple()
def make_graph(self): G = nx.fast_gnp_random_graph(30, 0.2, seed=SEED) for node, data in G.nodes_iter(data=True): data['ntype'] = random.choice(NTYPES) for src, tgt, data in G.edges_iter(data=True): data['weight'] = random.random() return G def test_simple...
identifier_body
simple_tests.py
from hiveplotter import HivePlot from networkx import nx import random from unittest import TestCase SEED = 1 NTYPES = ['A', 'B', 'C'] class SimpleCase(TestCase): def make_graph(self): G = nx.fast_gnp_random_graph(30, 0.2, seed=SEED) for node, data in G.nodes_iter(data=True): data[...
(self): G = self.make_graph() H = HivePlot(G, node_class_attribute='ntype') H.draw() print(H.dump_config()) if __name__ == '__main__': tests = SimpleCase() tests.test_simple()
test_dump_cfg
identifier_name
views.py
from django.shortcuts import render from django.views.generic.base import TemplateView from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.contrib.syndication.views import Feed from django.utils.feedgenerator import Atom1Feed from blog.models import Post from t...
(DetailView): context_object_name = 'post' template_name = 'blog/post.html' def get_queryset(self): if self.request.user.is_superuser: return Post.objects.all() return Post.objects.filter(is_published=True) class BlogTagView(TemplateView): template_name = 'blog/tag.html' ...
BlogPostView
identifier_name
views.py
from django.shortcuts import render from django.views.generic.base import TemplateView from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.contrib.syndication.views import Feed from django.utils.feedgenerator import Atom1Feed from blog.models import Post from t...
class BlogAtomFeed(BlogRssFeed): feed_type = Atom1Feed subtitle = BlogRssFeed.title
def item_description(self, item): return item.get_preview()
random_line_split
views.py
from django.shortcuts import render from django.views.generic.base import TemplateView from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.contrib.syndication.views import Feed from django.utils.feedgenerator import Atom1Feed from blog.models import Post from t...
class BlogPostView(DetailView): context_object_name = 'post' template_name = 'blog/post.html' def get_queryset(self): if self.request.user.is_superuser: return Post.objects.all() return Post.objects.filter(is_published=True) class BlogTagView(TemplateView): template_name ...
template_name = 'blog/home.html' context_object_name = 'posts' paginate_by = 10 def get_queryset(self): posts = Post.objects.order_by('-pub_date') if self.request.user.is_superuser: return posts else: return posts.filter(is_published=True)
identifier_body
views.py
from django.shortcuts import render from django.views.generic.base import TemplateView from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.contrib.syndication.views import Feed from django.utils.feedgenerator import Atom1Feed from blog.models import Post from t...
class BlogPostView(DetailView): context_object_name = 'post' template_name = 'blog/post.html' def get_queryset(self): if self.request.user.is_superuser: return Post.objects.all() return Post.objects.filter(is_published=True) class BlogTagView(TemplateView): template_name ...
return posts.filter(is_published=True)
conditional_block
add_ad_customizer.py
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 or agreed to in writing, softwa...
adwords_client = adwords.AdWordsClient.LoadFromStorage() main(adwords_client, ADGROUPS)
conditional_block
add_ad_customizer.py
# # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
print('Added FeedItem with ID %d.' % feed_item['feedItemId']) else: raise errors.GoogleAdsError('No FeedItems were added.') for feed_item, adgroup_id in zip(response['value'], adgroup_ids): RestrictFeedItemToAdGroup(client, feed_item, adgroup_id) def CreateFeedItemAddOperation(name, price, date, ad...
random_line_split
add_ad_customizer.py
# # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
feed_item_operations = [ CreateFeedItemAddOperation( 'Mars', '$1234.56', mars_date.strftime(time_format), ad_customizer_feed), CreateFeedItemAddOperation( 'Venus', '$1450.00', venus_date.strftime(time_format), ad_customizer_feed) ] response = feed_item_service....
"""Creates FeedItems for the specified AdGroups. These FeedItems contain values to use in ad customizations for the AdGroups. Args: client: an AdWordsClient instance. adgroup_ids: a list containing two AdGroup Ids. ad_customizer_feed: the AdCustomizerFeed we're associating the FeedItems with. ...
identifier_body
add_ad_customizer.py
# # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
(client, adgroup_ids, feed_name): """Creates ExpandedTextAds that use ad customizations for specified AdGroups. Args: client: an AdWordsClient instance. adgroup_ids: a list containing the AdGroup ids to add ExpandedTextAds to. feed_name: the name of the feed used to apply customizations. Raises: ...
CreateAdsWithCustomizations
identifier_name
ruby_requirements.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
return ['rubocop'] @classmethod def install(cls): # Intentionally do nothing pass class RakeRequirements(task_requirement_base.TaskRequirementBase): @classmethod def require(cls): return ['rake'] @classmethod def install(cls): # Intentionally do nothi...
@classmethod def require(cls):
random_line_split
ruby_requirements.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
(cls): # Intentionally do nothing pass class RakeRequirements(task_requirement_base.TaskRequirementBase): @classmethod def require(cls): return ['rake'] @classmethod def install(cls): # Intentionally do nothing pass
install
identifier_name
ruby_requirements.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
pass
identifier_body
errors.py
"""Let's Encrypt client errors.""" class Error(Exception): """Generic Let's Encrypt client error.""" class AccountStorageError(Error): """Generic `.AccountStorage` error.""" class AccountNotFound(AccountStorageError): """Account not found error.""" class ReverterError(Error): """Let's Encrypt Re...
"""Configuration sanity error.""" # NoninteractiveDisplay iDisplay plugin error: class MissingCommandlineFlag(Error): """A command line argument was missing in noninteractive usage"""
random_line_split
errors.py
"""Let's Encrypt client errors.""" class Error(Exception): """Generic Let's Encrypt client error.""" class AccountStorageError(Error): """Generic `.AccountStorage` error.""" class AccountNotFound(AccountStorageError): """Account not found error.""" class ReverterError(Error): """Let's Encrypt Re...
(Error): """Authorization error.""" class FailedChallenges(AuthorizationError): """Failed challenges error. :ivar set failed_achalls: Failed `.AnnotatedChallenge` instances. """ def __init__(self, failed_achalls): assert failed_achalls self.failed_achalls = failed_achalls ...
AuthorizationError
identifier_name
errors.py
"""Let's Encrypt client errors.""" class Error(Exception): """Generic Let's Encrypt client error.""" class AccountStorageError(Error): """Generic `.AccountStorage` error.""" class AccountNotFound(AccountStorageError): """Account not found error.""" class ReverterError(Error): """Let's Encrypt Re...
class FailedChallenges(AuthorizationError): """Failed challenges error. :ivar set failed_achalls: Failed `.AnnotatedChallenge` instances. """ def __init__(self, failed_achalls): assert failed_achalls self.failed_achalls = failed_achalls super(FailedChallenges, self).__init__...
"""Authorization error."""
identifier_body
main.rs
// y // 2 _|_|_ // 1 _|_|_ // 0 | | // 0 1 2 x use std::collections::LinkedList; use std::io::stdin; struct Step { loc: Loc, who: i8 } struct Loc { x: i8, y: i8, } struct EachRecord { win: Vec<Loc>, draw: Vec<Loc>, lose: Vec<Loc> } fn main() { let mut table : LinkedList<Step>...
// xxx * 3 x x // x * 3 x * 3 // x x let t1 = test1(&table); let t2 = test2(&table); let t3 = test3(&table); return 0; } fn test1(table: &[[i8; 3]; 3]) -> i8 { for i in 0 .. 3 { if table[i][0] != 0 && table[i][0] == table[i][1] && ...
// ret // 0 = unfinished // 1 = win 0 // 2 = win 1 // 3 = draw
random_line_split