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
util.py
import functools import logging import os import random import sys import time from gym import error logger = logging.getLogger(__name__) def utf8(value): if isinstance(value, unicode) and sys.version_info < (3, 0):
else: return value def file_size(f): return os.fstat(f.fileno()).st_size def retry_exponential_backoff(f, errors, max_retries=5, interval=1): @functools.wraps(f) def wrapped(*args, **kwargs): num_retries = 0 caught_errors = [] while True: try: ...
return value.encode('utf-8')
conditional_block
util.py
import functools import logging import os import random import sys import time from gym import error logger = logging.getLogger(__name__) def utf8(value): if isinstance(value, unicode) and sys.version_info < (3, 0): return value.encode('utf-8') else: return value def file_size(f):
def retry_exponential_backoff(f, errors, max_retries=5, interval=1): @functools.wraps(f) def wrapped(*args, **kwargs): num_retries = 0 caught_errors = [] while True: try: result = f(*args, **kwargs) except errors as e: logger.erro...
return os.fstat(f.fileno()).st_size
identifier_body
util.py
import functools import logging import os import random import sys import time from gym import error logger = logging.getLogger(__name__) def utf8(value): if isinstance(value, unicode) and sys.version_info < (3, 0): return value.encode('utf-8') else: return value def file_size(f): return...
(f, errors, max_retries=5, interval=1): @functools.wraps(f) def wrapped(*args, **kwargs): num_retries = 0 caught_errors = [] while True: try: result = f(*args, **kwargs) except errors as e: logger.error("Caught error in %s: %s" % (f...
retry_exponential_backoff
identifier_name
util.py
import functools import logging import os import random import sys import time from gym import error logger = logging.getLogger(__name__) def utf8(value): if isinstance(value, unicode) and sys.version_info < (3, 0): return value.encode('utf-8') else: return value def file_size(f): return...
backoff = random.randint(1, 2 ** num_retries) * interval logger.error("Retrying in %.1fs..." % backoff) time.sleep(backoff) num_retries += 1 else: msg = "Exceeded allowed retries. Here are the individual ...
random_line_split
closure.lib.d.ts
// Work around for https://github.com/Microsoft/TypeScript/issues/983 // All clutz namespaces are below ಠ_ಠ.clutz, thus // this acts as global. declare namespace ಠ_ಠ.clutz { type GlobalError = Error; var GlobalError: ErrorConstructor; type GlobalEvent = Event; var GlobalEvent: typeof Event; /** Represents the...
declare namespace ಠ_ಠ.clutz.goog { var __namespace_needs_to_be_non_value_empty__: void; } /** * Global variable indicating whether the JavaScript code has been compiled. * This variable is defined in Closure's base.js, but not on the `goog` namespace, which * means it has to be explcitly declared here, similar to...
} // Will be extended if base.js is a dependency.
random_line_split
closure.lib.d.ts
// Work around for https://github.com/Microsoft/TypeScript/issues/983 // All clutz namespaces are below ಠ_ಠ.clutz, thus // this acts as global. declare namespace ಠ_ಠ.clutz { type GlobalError = Error; var GlobalError: ErrorConstructor; type GlobalEvent = Event; var GlobalEvent: typeof Event; /** Represents the...
* * Represents a Closure interface that is private. Only used for extending/implementing. When in * type position PrivateType is used. */ interface PrivateInterface {} interface IObject<KEY1, VALUE> {} } // Will be extended if base.js is a dependency. declare namespace ಠ_ಠ.clutz.goog { var __namespace_...
lass {} /*
identifier_name
spawn_task.rs
use super::*; use crate::ok_or_shutdown; use crate::state_helper::{pause_on_failure, save_state, LockedState}; impl TaskHandler { /// See if we can start a new queued task. pub fn spawn_new(&mut self) { let cloned_state_mutex = self.state.clone(); let mut state = cloned_state_mutex.lock().unwr...
}
{ // Check if the task exists and can actually be spawned. Otherwise do an early return. match state.tasks.get(&task_id) { Some(task) => { if !matches!( &task.status, TaskStatus::Stashed { .. } | TaskStatus::Queued | TaskStatus::Paused ...
identifier_body
spawn_task.rs
use super::*; use crate::ok_or_shutdown; use crate::state_helper::{pause_on_failure, save_state, LockedState}; impl TaskHandler { /// See if we can start a new queued task. pub fn
(&mut self) { let cloned_state_mutex = self.state.clone(); let mut state = cloned_state_mutex.lock().unwrap(); // Check whether a new task can be started. // Spawn tasks until we no longer have free slots available. while let Some(id) = self.get_next_task_id(&state) { ...
spawn_new
identifier_name
spawn_task.rs
use super::*; use crate::ok_or_shutdown; use crate::state_helper::{pause_on_failure, save_state, LockedState}; impl TaskHandler { /// See if we can start a new queued task. pub fn spawn_new(&mut self) { let cloned_state_mutex = self.state.clone(); let mut state = cloned_state_mutex.lock().unwr...
return false; } // Get the currently running tasks by looking at the actually running processes. // They're sorted by group, which makes this quite convenient. let running_tasks = match self.children.0.get(&task.group) { ...
} }; // Let's check if the group is running. If it isn't, simply return false. if group.status != GroupStatus::Running {
random_line_split
classHelix_1_1Logic_1_1admin_1_1Row.js
var classHelix_1_1Logic_1_1admin_1_1Row = [ [ "Row", "classHelix_1_1Logic_1_1admin_1_1Row.html#a5cca50abc389396e26ec68cbd3fb6596", null ], [ "Row", "classHelix_1_1Logic_1_1admin_1_1Row.html#a9dbe8548daa0a4887688199e00c25ebe", null ], [ "~Row", "classHelix_1_1Logic_1_1admin_1_1Row.html#a8cc0869c91dc94ee59506...
[ "init", "classHelix_1_1Logic_1_1admin_1_1Row.html#a2b565af0d1dde980ea1554a9f2f701e2", null ], [ "Name", "classHelix_1_1Logic_1_1admin_1_1Row.html#a4d274004c656534d5e53e2e71aa56ced", null ], [ "operator=", "classHelix_1_1Logic_1_1admin_1_1Row.html#a87ba0481b0ca4da736c29902ae99ae16", null ], [ "readXmlC...
[ "createXmlChildren", "classHelix_1_1Logic_1_1admin_1_1Row.html#a214f15c6d3d9f8fafb0e0c06eb11b055", null ], [ "createXmlDoc", "classHelix_1_1Logic_1_1admin_1_1Row.html#a94214dcf9a6b54b4a6e9e29e22c7fdaf", null ], [ "createXmlNode", "classHelix_1_1Logic_1_1admin_1_1Row.html#a6574128e020e000ed6d8f6237170b6ab"...
random_line_split
telephone.py
import sys, math # Auto-generated code below aims at helping you parse
class Tree(object): def __repr__(self): return self.val def __init__(self, val=None): self.val = val self.childs = [] def add_number(self, number): if not number: return for child in self.childs: if number[0] == child.val: d...
# the standard input according to the problem statement.
random_line_split
telephone.py
import sys, math # Auto-generated code below aims at helping you parse # the standard input according to the problem statement. class Tree(object): def __repr__(self): return self.val def __init__(self, val=None): self.val = val self.childs = [] def add_number(self, number): ...
# N = int(raw_input()) # for i in xrange(N): # telephone = raw_input() # # Write an action using print # # To debug: print >> sys.stderr, "Debug messages..." # print "number" # The number of elements (referencing a number) stored in the structure. if __name__ == '__main__': t = Tree() t.add_number(lis...
child.show(order)
conditional_block
telephone.py
import sys, math # Auto-generated code below aims at helping you parse # the standard input according to the problem statement. class Tree(object): def __repr__(self):
def __init__(self, val=None): self.val = val self.childs = [] def add_number(self, number): if not number: return for child in self.childs: if number[0] == child.val: del number[0] child.add_number(number) ...
return self.val
identifier_body
telephone.py
import sys, math # Auto-generated code below aims at helping you parse # the standard input according to the problem statement. class Tree(object): def __repr__(self): return self.val def
(self, val=None): self.val = val self.childs = [] def add_number(self, number): if not number: return for child in self.childs: if number[0] == child.val: del number[0] child.add_number(number) return ne...
__init__
identifier_name
actorRegistry.ts
/** * Holds instances to Actor classes for instantiation */ import { ActorType } from '../../actor/actor'; /* tslint:disable-next-line interface-over-type-literal */ type ActorRegister = { [actorClassName: string]: ActorType }; export class ActorRegistry { private static self: ActorRegistry = new ActorRegistry(...
this.registry = {}; } }
random_line_split
actorRegistry.ts
/** * Holds instances to Actor classes for instantiation */ import { ActorType } from '../../actor/actor'; /* tslint:disable-next-line interface-over-type-literal */ type ActorRegister = { [actorClassName: string]: ActorType }; export class ActorRegistry { private static self: ActorRegistry = new ActorRegistry(...
} /** * Check to see if an actor exists in the registry * @param {string} actor - The string name of the actor class * @return {boolean} - Whether the actor exists in the registry */ public exists(actor: string): boolean { return !!this.registry[actor]; } /** * Get the specified ActorTyp...
{ this.registry[actor.name] = actor; }
conditional_block
actorRegistry.ts
/** * Holds instances to Actor classes for instantiation */ import { ActorType } from '../../actor/actor'; /* tslint:disable-next-line interface-over-type-literal */ type ActorRegister = { [actorClassName: string]: ActorType }; export class ActorRegistry { private static self: ActorRegistry = new ActorRegistry(...
(actor: string): boolean { return !!this.registry[actor]; } /** * Get the specified ActorType from the registry, or throw * @param {string} actor - The string name of the actor class * @return {ActorType} - The actor class, or throw */ public get(actor: string): ActorType { if (this.exists(ac...
exists
identifier_name
web-request-event.ts
/* eslint-disable no-bitwise */ import { ipcRenderer } from 'electron'; (String.prototype as any).hashCode = function hashCode() { let hash = 0; let i; let chr; if (this.length === 0) { return hash; } for (i = 0; i < this.length; i += 1) { chr = this.charCodeAt(i); hash = ((hash << 5) - hash)...
addListener(callback: (details: any) => any, filter = {}): void { const digest = (callback.toString() as any).hashCode(); this.listeners.push(digest); ipcRenderer.on( `lulumi-${this.scope}-${this.event}-intercepted-${digest}`, (event, requestId, details) => { ipcRenderer.send( `l...
{ this.name = name; // extension's name this.scope = scope; this.event = event; this.listeners = []; }
identifier_body
web-request-event.ts
/* eslint-disable no-bitwise */ import { ipcRenderer } from 'electron'; (String.prototype as any).hashCode = function hashCode() { let hash = 0; let i; let chr; if (this.length === 0) { return hash; } for (i = 0; i < this.length; i += 1) { chr = this.charCodeAt(i); hash = ((hash << 5) - hash)...
filter, ); } removeListener(callback: (details: any) => any): void { const digest = (callback.toString() as any).hashCode(); this.listeners = this.listeners.filter(c => (c !== digest)); ipcRenderer.removeAllListeners(`lulumi-${this.scope}-${this.event}-intercepted-${digest}`); ipcRenderer...
ipcRenderer.send( `lulumi-${this.scope}-add-listener-${this.event}`, this.name, this.event, digest,
random_line_split
web-request-event.ts
/* eslint-disable no-bitwise */ import { ipcRenderer } from 'electron'; (String.prototype as any).hashCode = function hashCode() { let hash = 0; let i; let chr; if (this.length === 0) { return hash; } for (i = 0; i < this.length; i += 1) { chr = this.charCodeAt(i); hash = ((hash << 5) - hash)...
(name: string, scope: string, event: string) { this.name = name; // extension's name this.scope = scope; this.event = event; this.listeners = []; } addListener(callback: (details: any) => any, filter = {}): void { const digest = (callback.toString() as any).hashCode(); this.listeners.push(d...
constructor
identifier_name
web-request-event.ts
/* eslint-disable no-bitwise */ import { ipcRenderer } from 'electron'; (String.prototype as any).hashCode = function hashCode() { let hash = 0; let i; let chr; if (this.length === 0) { return hash; } for (i = 0; i < this.length; i += 1)
return hash; }; class Event { name: string; scope: string; event: string; listeners: ((details: any) => any)[]; constructor(name: string, scope: string, event: string) { this.name = name; // extension's name this.scope = scope; this.event = event; this.listeners = []; } addListener(c...
{ chr = this.charCodeAt(i); hash = ((hash << 5) - hash) + chr; hash |= 0; // convert to 32bit integer }
conditional_block
const-contents.rs
// Copyright 2012 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 ...
() { assert_eq!(lsl, 4); assert_eq!(add, 3); assert_eq!(addf, 3.0); assert_eq!(not, -1); assert_eq!(notb, false); assert_eq!(neg, -1); }
main
identifier_name
const-contents.rs
// Copyright 2012 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 ...
{ assert_eq!(lsl, 4); assert_eq!(add, 3); assert_eq!(addf, 3.0); assert_eq!(not, -1); assert_eq!(notb, false); assert_eq!(neg, -1); }
identifier_body
const-contents.rs
// Copyright 2012 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Issue #570 s...
random_line_split
container.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2012 Anne Archibald <peridot.faceted@gmail.com> # # 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...
class ContainerList(list,Container): """A ContainerList is a list whose children know they're in it. Each element in the ContainerList has a .container attribute which points to the ContainerList itself. This container pointer is maintained automatically. """ def __init__(self, items=[], owner=N...
"""A container is an object that manages objects it contains. The objects in a container each have a .container attribute that points to the container. This attribute is managed by the container itself. This class is a base class that provides common container functionality, to be used to simplif...
identifier_body
container.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2012 Anne Archibald <peridot.faceted@gmail.com> # # 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...
(self, i, item): self._set_container(item) list.insert(self,i,item) def remove(self, item): self._unset_container(item) list.remove(self,item) def pop(self, i=-1): self._unset_container(self[i]) return list.pop(self,i) # These don't work because they make the...
insert
identifier_name
container.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2012 Anne Archibald <peridot.faceted@gmail.com> # # 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...
del p2[:] d = ContainerDict(a=a, b=b, c=c) print(d) print(d["a"]) d["a"] = a try: d["a"] = b except ContainerError as err: print(err) else: raise AssertionError del d["a"] d["a"] = a d.pop("a") print(d) d["a"] = a k,v = d.popitem() d[...
d = ContainerDict(a=a, b=b, c=c) except ContainerError as err: print(err) else: raise AssertionError
random_line_split
container.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2012 Anne Archibald <peridot.faceted@gmail.com> # # 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...
def _unset_container_multi(self, items): """Remove items from the container in an all-or-nothing way""" r = [] try: for i in items: self._unset_container(i) r.append(i) r = None finally: if r is not None: ...
for i in r: try: self._unset_container(i) except ContainerError: pass
conditional_block
reprojection.js
goog.require('ol.Map'); goog.require('ol.View'); goog.require('ol.extent'); goog.require('ol.format.WMTSCapabilities'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); goog.require('ol.source.OSM'); goog.require('ol.source.TileImage'); goog.require('ol.source.TileWMS'); goog.require('ol.source.WMTS'); goog.requ...
* Handle change event. */ renderEdgesCheckbox.onchange = function() { renderEdges = renderEdgesCheckbox.checked; map.getLayers().forEach(function(layer) { updateRenderEdgesOnLayer(layer); }); };
/**
random_line_split
reprojection.js
goog.require('ol.Map'); goog.require('ol.View'); goog.require('ol.extent'); goog.require('ol.format.WMTSCapabilities'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); goog.require('ol.source.OSM'); goog.require('ol.source.TileImage'); goog.require('ol.source.TileWMS'); goog.require('ol.source.WMTS'); goog.requ...
lse { layers['bng'].setExtent(undefined); } } /** * Handle change event. */ viewProjSelect.onchange = function() { updateViewProjection(); }; updateViewProjection(); var updateRenderEdgesOnLayer = function(layer) { if (layer instanceof ol.layer.Tile) { var source = layer.getSource(); if (source ...
layers['bng'].setExtent([-1057216, 6405988, 404315, 8759696]); } e
conditional_block
reprojection.js
goog.require('ol.Map'); goog.require('ol.View'); goog.require('ol.extent'); goog.require('ol.format.WMTSCapabilities'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); goog.require('ol.source.OSM'); goog.require('ol.source.TileImage'); goog.require('ol.source.TileWMS'); goog.require('ol.source.WMTS'); goog.requ...
{ var newProj = ol.proj.get(viewProjSelect.value); var newProjExtent = newProj.getExtent(); var newView = new ol.View({ projection: newProj, center: ol.extent.getCenter(newProjExtent || [0, 0, 0, 0]), zoom: 0, extent: newProjExtent || undefined }); map.setView(newView); // Example how to p...
dateViewProjection()
identifier_name
reprojection.js
goog.require('ol.Map'); goog.require('ol.View'); goog.require('ol.extent'); goog.require('ol.format.WMTSCapabilities'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); goog.require('ol.source.OSM'); goog.require('ol.source.TileImage'); goog.require('ol.source.TileWMS'); goog.require('ol.source.WMTS'); goog.requ...
/** * Handle change event. */ viewProjSelect.onchange = function() { updateViewProjection(); }; updateViewProjection(); var updateRenderEdgesOnLayer = function(layer) { if (layer instanceof ol.layer.Tile) { var source = layer.getSource(); if (source instanceof ol.source.TileImage) { source.setRen...
var newProj = ol.proj.get(viewProjSelect.value); var newProjExtent = newProj.getExtent(); var newView = new ol.View({ projection: newProj, center: ol.extent.getCenter(newProjExtent || [0, 0, 0, 0]), zoom: 0, extent: newProjExtent || undefined }); map.setView(newView); // Example how to prev...
identifier_body
common.rs
use byteorder::{BigEndian, WriteBytesExt, ReadBytesExt}; use std::io::{self, Read, Write}; pub enum
{ Connect(u32), Connected(u32), Data(u32, Vec<u8>), Disconnect(u32), Disconnected(u32), // Really want FIN ACK? } /* impl SimpleFwdOp { pub fn write_to<A: Write + Sized>(&self, os: &mut A) -> io::Result<()> { use SimpleFwdOp::*; match self { &Connect(id) => { ...
SimpleFwdOp
identifier_name
common.rs
use byteorder::{BigEndian, WriteBytesExt, ReadBytesExt}; use std::io::{self, Read, Write}; pub enum SimpleFwdOp { Connect(u32), Connected(u32), Data(u32, Vec<u8>), Disconnect(u32), Disconnected(u32), // Really want FIN ACK? } /* impl SimpleFwdOp { pub fn write_to<A: Write + Sized>(&self, os: ...
pub fn write_frame<A: Write + Sized>(stream: &mut A, buf: &[u8]) -> io::Result<()> { try!(stream.write_u32::<BigEndian>(buf.len() as u32)); try!(stream.write_all(buf)); stream.flush() } #[cfg(test)] mod tests { use super::*; use std::io::Cursor; fn check_write_read(bs: &[u8]) { let m...
{ let length = try!(stream.read_u32::<BigEndian>()); let mut buf = vec![0; length as usize]; try!(read_exact(stream, &mut buf)); Ok(buf) }
identifier_body
common.rs
use byteorder::{BigEndian, WriteBytesExt, ReadBytesExt}; use std::io::{self, Read, Write}; pub enum SimpleFwdOp { Connect(u32), Connected(u32), Data(u32, Vec<u8>), Disconnect(u32), Disconnected(u32), // Really want FIN ACK? } /* impl SimpleFwdOp { pub fn write_to<A: Write + Sized>(&self, os: ...
} }
random_line_split
state_defs.py
# Copyright (c) 2001, Stanford University # All rights reserved. # # See the file LICENSE.txt for information on redistributing this software. import sys import apiutil apiutil.CopyrightDef() print """DESCRIPTION "" EXPORTS """ keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") for func_name in ap...
for func_name in apiutil.AllSpecials( 'state_select' ): print "crStateSelect%s" % func_name print """crStateInit crStateReadPixels crStateGetChromiumParametervCR crStateCreateContext crStateCreateContextEx crStateDestroyContext crStateDiffContext crStateSwitchContext crStateMakeCurrent crStateSetCurrent crStateF...
print "crStateFeedback%s" % func_name
conditional_block
state_defs.py
# Copyright (c) 2001, Stanford University # All rights reserved. # # See the file LICENSE.txt for information on redistributing this software. import sys import apiutil apiutil.CopyrightDef() print """DESCRIPTION "" EXPORTS """ keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") for func_name in ap...
crStateTextureCheckDirtyImages crStateExtensionsInit crStateSetExtensionString crStateUseServerArrays crStateUseServerArrayElements crStateComputeVersion crStateTransformXformPointMatrixf crStateTransformXformPointMatrixd crStateInitMatrixStack crStateLoadMatrix __currentBits """
random_line_split
logger.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2017 Ivo Tzvetkov # # 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 wit...
def main(): import yaml from argparse import ArgumentParser arg_parser = ArgumentParser() arg_parser.description = 'RedMsg logging service.' arg_parser.add_argument('--config', metavar='FILE', default='config.yaml', help='path to config file (default: %(default)s)') ...
try: self.handler.handle(message) except Exception as e: sys.stderr.write('{0}: {1}: {2}\n'.format(e.__class__.__name__, e, message).encode('utf-8'))
conditional_block
logger.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2017 Ivo Tzvetkov # # 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 wit...
if __name__ == '__main__': main()
import yaml from argparse import ArgumentParser arg_parser = ArgumentParser() arg_parser.description = 'RedMsg logging service.' arg_parser.add_argument('--config', metavar='FILE', default='config.yaml', help='path to config file (default: %(default)s)') args = arg_parser...
identifier_body
logger.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2017 Ivo Tzvetkov # # 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 wit...
latest_txid = self.handler.get_latest_txid(self.channel) generator = self.subscriber.listen() if latest_txid is None else \ self.subscriber.listen_from(latest_txid + 1, ignore_missing=True) for message in generator: try: self.handler.handle(message...
def start(self): self.subscriber.subscribe(self.channel)
random_line_split
logger.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2017 Ivo Tzvetkov # # 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 wit...
(self, config): self.channel = config['channel'] self.subscriber = Subscriber(**config['redmsg']) self.handler = handlers[config['handler']](config[config['handler']]) def start(self): self.subscriber.subscribe(self.channel) latest_txid = self.handler.get_latest_txid(self.ch...
__init__
identifier_name
setup.py
import os import re from setuptools import setup, find_packages THIS_DIR = os.path.dirname(os.path.realpath(__name__)) def read(*parts): with open(os.path.join(THIS_DIR, *parts)) as f: return f.read() def get_version():
setup(name='marionette_client', version=get_version(), description="Marionette test automation client", long_description='See http://marionette-client.readthedocs.org/', classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='mozilla', ...
return re.findall("__version__ = '([\d\.]+)'", read('marionette', '__init__.py'), re.M)[0]
identifier_body
setup.py
import os import re from setuptools import setup, find_packages THIS_DIR = os.path.dirname(os.path.realpath(__name__)) def
(*parts): with open(os.path.join(THIS_DIR, *parts)) as f: return f.read() def get_version(): return re.findall("__version__ = '([\d\.]+)'", read('marionette', '__init__.py'), re.M)[0] setup(name='marionette_client', version=get_version(), description="Marionette tes...
read
identifier_name
setup.py
import os import re from setuptools import setup, find_packages THIS_DIR = os.path.dirname(os.path.realpath(__name__)) def read(*parts): with open(os.path.join(THIS_DIR, *parts)) as f: return f.read() def get_version(): return re.findall("__version__ = '([\d\.]+)'",
setup(name='marionette_client', version=get_version(), description="Marionette test automation client", long_description='See http://marionette-client.readthedocs.org/', classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='mozilla', aut...
read('marionette', '__init__.py'), re.M)[0]
random_line_split
build_projects.py
#!/usr/bin/env python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import multiprocessing import optparse import os import posixpath import sys import urllib2 import buildbot_common import build_ve...
(pepperdir, clobber=False): tools_dir = os.path.join(pepperdir, 'tools') if not os.path.exists(tools_dir): buildbot_common.ErrorExit('SDK tools dir is missing: %s' % tools_dir) exampledir = os.path.join(pepperdir, 'examples') if clobber: buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(e...
UpdateHelpers
identifier_name
build_projects.py
#!/usr/bin/env python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import multiprocessing import optparse import os import posixpath import sys import urllib2 import buildbot_common import build_ve...
try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass options, args = parser.parse_args(argv[1:]) global verbose if options.verbose: verbose = True buildbot_common.verbose = verbose if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configur...
# complete -F _optcomplete build_projects.py
random_line_split
build_projects.py
#!/usr/bin/env python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import multiprocessing import optparse import os import posixpath import sys import urllib2 import buildbot_common import build_ve...
def UpdateProjects(pepperdir, project_tree, toolchains, clobber=False, configs=None, first_toolchain=False): if configs is None: configs = ['Debug', 'Release'] if not os.path.exists(os.path.join(pepperdir, 'tools')): buildbot_common.ErrorExit('Examples depend on missing tools.') if n...
out = {} # Build list of all project names localtargets = [proj['NAME'] for proj in projects] # For each project for proj in projects: deplist = [] # generate a list of dependencies for targ in proj.get('TARGETS', []): deplist.extend(targ.get('DEPS', []) + targ.get('LIBS', [])) # and ad...
identifier_body
build_projects.py
#!/usr/bin/env python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import multiprocessing import optparse import os import posixpath import sys import urllib2 import buildbot_common import build_ve...
if args: filters['NAME'] = args Trace('Filter by name: ' + str(args)) try: project_tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, include=filters) except parse_dsc.ValidationError as e: buildbot_common.ErrorExit(str(e)) if verbose: parse_dsc.PrintProjectTree(project_tree) UpdateHelpers(...
filters['DEST'] = options.dest Trace('Filter by type: ' + str(options.dest))
conditional_block
scan_dihedral.py
#!/usr/bin/env python import sys import string import subprocess #---------------------------------------------------------------------- # Define some handy functions #---------------------------------------------------------------------- def
(file): f = open(file,'r') fc = f.readlines() f.close() return fc def write_to_file(file,fc): f = open(file,'w') f.writelines(fc) f.close() #---------------------------------------------------------------------- # The main function #---------------------------------------------------------...
get_contents
identifier_name
scan_dihedral.py
#!/usr/bin/env python import sys import string import subprocess #---------------------------------------------------------------------- # Define some handy functions #---------------------------------------------------------------------- def get_contents(file): f = open(file,'r') fc = f.readlines() f.clo...
if __name__ == '__main__': #---------------------------------------------------------------------- # Read in arguments from command line #---------------------------------------------------------------------- if (len(sys.argv)-2)%3 != 0 or len(sys.argv) == 2: p...
pdb_file = sys.argv[1] base = pdb_file.split('/')[-1].split('.')[0] gzmat_file = base + ".gzmat" diheds = [] stepsizes = [] nsteps = [] for i in range(0,n_dihed): diheds.append(sys.argv[3*i+2]) stepsizes.append(float(sys.argv[3*i+3])) nsteps.append(int(sys.argv[3*i+4])+1)...
identifier_body
scan_dihedral.py
#!/usr/bin/env python import sys import string import subprocess #---------------------------------------------------------------------- # Define some handy functions #---------------------------------------------------------------------- def get_contents(file): f = open(file,'r') fc = f.readlines() f.clo...
if __name__ == '__main__': #---------------------------------------------------------------------- # Read in arguments from command line #---------------------------------------------------------------------- if (len(sys.argv)-2)%3 != 0 or len(sys.argv) == 2: p...
newvalue1 = values[1] + float(i1)*stepsizes[1] gzmat[lines[1]] = diheds[1] + "= " + str(newvalue1) + "\n" new_gzmat_file = base + "_" + str(i0).zfill(3) + "_" + str(i1).zfill(3) + ".gzmat" new_pdb_file = base + "_" + str(i0).zfill(3) + "_" + str(i1).zfill(3) + ".pdb" ...
conditional_block
scan_dihedral.py
#!/usr/bin/env python import sys import string import subprocess #---------------------------------------------------------------------- # Define some handy functions #---------------------------------------------------------------------- def get_contents(file): f = open(file,'r') fc = f.readlines() f.clo...
newvalue1 = values[1] + float(i1)*stepsizes[1] gzmat[lines[1]] = diheds[1] + "= " + str(newvalue1) + "\n" new_gzmat_file = base + "_" + str(i0).zfill(3) + "_" + str(i1).zfill(3) + ".gzmat" new_pdb_file = base + "_" + str(i0).zfill(3) + "_" + str(i1).zfill...
else: for i1 in range(0,nsteps[1]): # for second dihedral, set new value to initial + step number*step size
random_line_split
vec_delete_left.rs
use malachite_base::vecs::vec_delete_left; use malachite_base_test_util::bench::bucketers::pair_1_vec_len_bucketer; use malachite_base_test_util::bench::{run_benchmark, BenchmarkType}; use malachite_base_test_util::generators::common::{GenConfig, GenMode}; use malachite_base_test_util::generators::unsigned_vec_unsigned...
{ run_benchmark( "vec_delete_left(&mut [T], usize)", BenchmarkType::Single, unsigned_vec_unsigned_pair_gen_var_1::<u8>().get(gm, &config), gm.name(), limit, file_name, &pair_1_vec_len_bucketer("xs"), &mut [("Malachite", &mut |(mut xs, amount)| { ...
identifier_body
vec_delete_left.rs
use malachite_base::vecs::vec_delete_left; use malachite_base_test_util::bench::bucketers::pair_1_vec_len_bucketer; use malachite_base_test_util::bench::{run_benchmark, BenchmarkType}; use malachite_base_test_util::generators::common::{GenConfig, GenMode}; use malachite_base_test_util::generators::unsigned_vec_unsigned...
vec_delete_left(&mut xs, amount); println!( "xs := {:?}; vec_delete_left(&mut xs, {}); xs = {:?}", old_xs, amount, xs ); } } fn benchmark_vec_delete_left(gm: GenMode, config: GenConfig, limit: usize, file_name: &str) { run_benchmark( "vec_delete_left(&mut...
for (mut xs, amount) in unsigned_vec_unsigned_pair_gen_var_1::<u8>() .get(gm, &config) .take(limit) { let old_xs = xs.clone();
random_line_split
vec_delete_left.rs
use malachite_base::vecs::vec_delete_left; use malachite_base_test_util::bench::bucketers::pair_1_vec_len_bucketer; use malachite_base_test_util::bench::{run_benchmark, BenchmarkType}; use malachite_base_test_util::generators::common::{GenConfig, GenMode}; use malachite_base_test_util::generators::unsigned_vec_unsigned...
(gm: GenMode, config: GenConfig, limit: usize, file_name: &str) { run_benchmark( "vec_delete_left(&mut [T], usize)", BenchmarkType::Single, unsigned_vec_unsigned_pair_gen_var_1::<u8>().get(gm, &config), gm.name(), limit, file_name, &pair_1_vec_len_bucketer("xs...
benchmark_vec_delete_left
identifier_name
del_cluster_systemlist.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
required_parameters = ["cluster", "hostname"] resource_class = SystemList def render(self, hostname, **kwargs): super(CommandDelClusterSystemList, self).render(hostname=None, metacluster=None, ...
class CommandDelClusterSystemList(CommandDelClusterMemberPriority):
random_line_split
del_cluster_systemlist.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
(self, hostname, **kwargs): super(CommandDelClusterSystemList, self).render(hostname=None, metacluster=None, comments=None, member=hostname, ...
render
identifier_name
del_cluster_systemlist.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
super(CommandDelClusterSystemList, self).render(hostname=None, metacluster=None, comments=None, member=hostname, ...
identifier_body
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(plugin)] #![cfg_attr(test, feature(core_intrinsics))] #![plugin(plugins)] extern crate app_units; exte...
}
{ assert_eq!(get_writing_mode(INITIAL_VALUES.get_inheritedbox()), WritingMode::empty()) }
identifier_body
lib.rs
#![cfg_attr(test, feature(core_intrinsics))] #![plugin(plugins)] extern crate app_units; extern crate cssparser; extern crate euclid; extern crate selectors; #[macro_use(atom, ns)] extern crate string_cache; extern crate style; extern crate style_traits; extern crate url; extern crate util; #[cfg(test)] mod styleshe...
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(plugin)]
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(plugin)] #![cfg_attr(test, feature(core_intrinsics))] #![plugin(plugins)] extern crate app_units; exte...
() { assert_eq!(get_writing_mode(INITIAL_VALUES.get_inheritedbox()), WritingMode::empty()) } }
initial_writing_mode_is_empty
identifier_name
__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ HTTP streaming toolbox with flow control, written in Python. :copyright: (c) 2014 Runzhou Li (Leo) :license: The MIT License (MIT), see LICENSE for details. """ __title__ = 'tidehunter' __version__ = '1.0.1' VERSION = tuple(map(int, __version__.split('.'))) __author_...
(logging.Handler): def emit(self, record): pass logging.getLogger(__name__).addHandler(NullHandler())
NullHandler
identifier_name
__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """
:copyright: (c) 2014 Runzhou Li (Leo) :license: The MIT License (MIT), see LICENSE for details. """ __title__ = 'tidehunter' __version__ = '1.0.1' VERSION = tuple(map(int, __version__.split('.'))) __author__ = 'Runzhou Li (Leo)' __license__ = 'The MIT License (MIT)' __copyright__ = 'Runzhou Li (Leo)' from tidehunter....
HTTP streaming toolbox with flow control, written in Python.
random_line_split
__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ HTTP streaming toolbox with flow control, written in Python. :copyright: (c) 2014 Runzhou Li (Leo) :license: The MIT License (MIT), see LICENSE for details. """ __title__ = 'tidehunter' __version__ = '1.0.1' VERSION = tuple(map(int, __version__.split('.'))) __author_...
logging.getLogger(__name__).addHandler(NullHandler())
def emit(self, record): pass
identifier_body
agents_vm.ts
/* * Copyright 2021 ThoughtWorks, Inc. * * 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 agr...
else { this.sortOrder = SortOrder.ASC; this.sortOnColumn = columnIndex; } this.sort(); } sort() { const agentComparator = new AgentComparator(this.sortableColumns.get(this.sortOnColumn) as string); this.agentsVM.all().sort(agentComparator.compare.bind(agentComparator)); if (thi...
{ this.sortOrder = this.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC; }
conditional_block
agents_vm.ts
/* * Copyright 2021 ThoughtWorks, Inc. * * 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 agr...
(agentConfigState: AgentConfigState): Agent[] { return this.list().filter((agent) => agent.agentConfigState === agentConfigState); } unselectAll() { this._selectedAgentsUUID([]); } list() { return super.list().filter((agent) => !agent.isElastic()); } protected getAgentSortHandler() { retu...
filterBy
identifier_name
agents_vm.ts
/* * Copyright 2021 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License");
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language gov...
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at
random_line_split
vcloud_handler.py
# Copyright (c) 2015-2020 Cloudify Platform Ltd. 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 b...
(BaseCloudifyInputsConfigReader): def __init__(self, cloudify_config, manager_blueprint_path, **kwargs): super(CloudifyVcloudInputsConfigReader, self).__init__( cloudify_config, manager_blueprint_path=manager_blueprint_path, **kwargs) @property def vcloud_username(self): ...
CloudifyVcloudInputsConfigReader
identifier_name
vcloud_handler.py
# Copyright (c) 2015-2020 Cloudify Platform Ltd. 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 b...
handler = VcloudHandler def login(env): vca = vcloudair.VCA( host=env['vcloud_url'], username=env['vcloud_username'], service_type=env['vcloud_service_type'], version="5.7", verify=False) logined = (vca.login(env['vcloud_password']) and vca.login_to_in...
CleanupContext = VcloudCleanupContext CloudifyConfigReader = CloudifyVcloudInputsConfigReader def before_bootstrap(self): super(VcloudHandler, self).before_bootstrap() vca = login(self.env.cloudify_config) if vca.get_vdc(TEST_VDC): status, task = vca.delete_vdc(TEST_VDC) ...
identifier_body
vcloud_handler.py
# Copyright (c) 2015-2020 Cloudify Platform Ltd. 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 b...
else: return None def wait_for_task(vca_client, task): TASK_RECHECK_TIMEOUT = 5 TASK_STATUS_SUCCESS = 'success' TASK_STATUS_ERROR = 'error' WAIT_TIME_MAX_MINUTES = 30 MAX_ATTEMPTS = WAIT_TIME_MAX_MINUTES * 60 / TASK_RECHECK_TIMEOUT status = task.get_status() for attempt in xr...
return vca
conditional_block
vcloud_handler.py
# Copyright (c) 2015-2020 Cloudify Platform Ltd. 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 b...
@classmethod def clean_all(cls, env): """ Cleans *all* resources, including resources that were not created by the test """ super(VcloudCleanupContext, cls).clean_all(env) class CloudifyVcloudInputsConfigReader(BaseCloudifyInputsConfigReader): def __init__(self, c...
class VcloudCleanupContext(BaseHandler.CleanupContext): def __init__(self, context_name, env): super(VcloudCleanupContext, self).__init__(context_name, env)
random_line_split
example.py
from Robinhood import Robinhood #Setup my_trader = Robinhood(username="YOUR_USERNAME", password="YOUR_PASSWORD"); #Get stock information #Note: Sometimes more than one instrument may be returned for a given stock symbol stock_instrument = my_trader.instruments("GEVO")[0] #Get a stock's quote my_trader.print_quot...
sell_order = my_trader.place_sell_order(stock_instrument, 1)
#Place a sell order
random_line_split
build.py
# -*- coding: utf-8 -*- import logging import os from django.conf import settings from django.core.management import BaseCommand from django.apps import apps from django.core.management import CommandError from django.template.defaultfilters import slugify from django.template.loader import get_template from django.db...
(self): for template_name in self.template_names: template = get_template(template_name) data = template.render(self.context) destination = self.get_destination(template_name, app_name=self.context['app_name']) with open(destination, 'wb') as out: ...
generate
identifier_name
build.py
# -*- coding: utf-8 -*- import logging import os from django.conf import settings from django.core.management import BaseCommand from django.apps import apps from django.core.management import CommandError from django.template.defaultfilters import slugify from django.template.loader import get_template from django.db...
def generate(self): for template_name in self.template_names: template = get_template(template_name) data = template.render(self.context) destination = self.get_destination(template_name, app_name=self.context['app_name']) with open(destination, 'wb') as out...
destination = self.path + template_name.replace( 'scaffold/', '/' ).replace( '.py.html', '.py' ).replace( 'APP_NAME', app_name ).replace( 'MODEL_NAME', model_name ) # Create the directory if it does not exist. directory = o...
identifier_body
build.py
# -*- coding: utf-8 -*- import logging import os from django.conf import settings from django.core.management import BaseCommand from django.apps import apps from django.core.management import CommandError from django.template.defaultfilters import slugify from django.template.loader import get_template from django.db...
) # Create the directory if it does not exist. directory = os.path.dirname(destination) if not os.path.exists(directory): os.makedirs(directory) return destination def generate(self): for template_name in self.template_names: template = get_...
'.py.html', '.py' ).replace( 'APP_NAME', app_name ).replace( 'MODEL_NAME', model_name
random_line_split
build.py
# -*- coding: utf-8 -*- import logging import os from django.conf import settings from django.core.management import BaseCommand from django.apps import apps from django.core.management import CommandError from django.template.defaultfilters import slugify from django.template.loader import get_template from django.db...
return destination def generate(self): for template_name in self.template_names: template = get_template(template_name) data = template.render(self.context) destination = self.get_destination(template_name, app_name=self.context['app_name']) with op...
os.makedirs(directory)
conditional_block
issue-33537.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
}
assert_eq!(bar(), 2);
random_line_split
issue-33537.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() -> i32 { *&{(1, 2, 3).1} } fn main() { assert_eq!(foo(), b"foo" as *const _ as *const i8); assert_eq!(bar(), 2); }
bar
identifier_name
issue-33537.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn main() { assert_eq!(foo(), b"foo" as *const _ as *const i8); assert_eq!(bar(), 2); }
{ *&{(1, 2, 3).1} }
identifier_body
globPatternContribution.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} }
random_line_split
globPatternContribution.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(resource: URI, location: JSONLocation, currentKey: string, result: JSONWorker.ISuggestionsCollector): WinJS.Promise { if (this.isSettingsFile(resource) && (location.matches(['files.exclude']) || location.matches(['search.exclude']))) { globValues.forEach((e) => result.add(e)); } return null; } public get...
collectValueSuggestions
identifier_name
globPatternContribution.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
return null; } public getInfoContribution(resource: URI, location: JSONLocation): WinJS.TPromise<HtmlContent.IHTMLContentElement[]> { return null; } }
{ globValues.forEach((e) => result.add(e)); }
conditional_block
sample_help.py
#! /usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import division,print_function,absolute_import,unicode_literals import sys import os os.chdir(sys.path[0]) sys.path.append('/mnt/sda2/github/TSF1KEV/TSFpy') from TSF_io import * #from TSF_Forth import * from TSF_shuffle import * from TSF_match import * fro...
TSF_Forth_setTSF("replaceO:", "\t".join(["TSF_time_getdaytime()"]), TSF_style="N") TSF_Forth_setTSF("replaceN:", "\t".join(["@000y@0m@0dm@wdec@0h@0n@0s"]), TSF_style="N") TSF_Forth_addfin(TSF_io_argvs()) TSF_Forth_argvsleftcut(TSF_io_argvs(),1) TSF_Forth_run()
TSF_style="N") TSF_Forth_setTSF("replace:", "\t".join(["replaceN:","#TSF_carbonthe","#TSF_calender","replaceN:","0","#TSF_pokethe","help:","replaceO:","replaceN:","#TSF_replacestacks"]), TSF_style="T")
random_line_split
uart.rs
use core::fmt; use core::str::StrExt; use core::result::Result; use hw::HW; pub trait Uart<W : HW> { fn put(&self, &mut W, ch : u8); } pub trait UartWriter : fmt::Write { } pub struct
; impl UartWriter for DummyUartWriter { } impl fmt::Write for DummyUartWriter { fn write_str(&mut self, _: &str) -> fmt::Result { Result::Ok(()) } } pub struct BlockingUartWriter<H : 'static+HW> { uart : &'static Uart<H>, hw : &'static mut H, } impl<H : HW> UartWriter for BlockingUartWriter<...
DummyUartWriter
identifier_name
uart.rs
use core::fmt; use core::str::StrExt; use core::result::Result;
pub trait UartWriter : fmt::Write { } pub struct DummyUartWriter; impl UartWriter for DummyUartWriter { } impl fmt::Write for DummyUartWriter { fn write_str(&mut self, _: &str) -> fmt::Result { Result::Ok(()) } } pub struct BlockingUartWriter<H : 'static+HW> { uart : &'static Uart<H>, hw : ...
use hw::HW; pub trait Uart<W : HW> { fn put(&self, &mut W, ch : u8); }
random_line_split
uart.rs
use core::fmt; use core::str::StrExt; use core::result::Result; use hw::HW; pub trait Uart<W : HW> { fn put(&self, &mut W, ch : u8); } pub trait UartWriter : fmt::Write { } pub struct DummyUartWriter; impl UartWriter for DummyUartWriter { } impl fmt::Write for DummyUartWriter { fn write_str(&mut self, _: ...
} impl<H> fmt::Write for BlockingUartWriter<H> where H : HW { fn write_str(&mut self, s: &str) -> fmt::Result { for ch in s.bytes() { self.uart.put(self.hw, ch); } Result::Ok(()) } }
{ BlockingUartWriter { uart: uart, hw: hw } }
identifier_body
styles.py
# -*- coding: utf-8 -*- # Copyright © 2014-2018 GWHAT Project Contributors # https://github.com/jnsebgosselin/gwhat # # This file is part of GWHAT (Ground-Water Hydrograph Analysis Toolbox). # Licensed under the terms of the GNU General Public License. # Standard library imports : import platform # Third party impo...
self): # ---- frame self.frame = 22 self.HLine = 52 self.VLine = 53 self.sideBarWidth = 275 # ----- colors self.red = '#C83737' self.lightgray = '#E6E6E6' self.rain = '#0000CC' self.snow = '0.7' self.wlvl = '#0000CC' # '#000099...
_init__(
identifier_name
styles.py
# -*- coding: utf-8 -*- # Copyright © 2014-2018 GWHAT Project Contributors # https://github.com/jnsebgosselin/gwhat # # This file is part of GWHAT (Ground-Water Hydrograph Analysis Toolbox). # Licensed under the terms of the GNU General Public License. # Standard library imports : import platform # Third party impo...
# self.fontSize1.setPointSize(11) # 17 = QtGui.QFrame.Box | QtGui.QFrame.Plain # 22 = QtGui.QFrame.StyledPanel | QtGui.QFrame.Plain # 20 = QtGui.QFrame.HLine | QtGui.QFrame.Plain # 52 = QtGui.QFrame.HLine | QtGui.QFrame.Sunken # 53 = QtGui.QFrame.VLine | QtGui.QFrame.Sun...
ef __init__(self): # ---- frame self.frame = 22 self.HLine = 52 self.VLine = 53 self.sideBarWidth = 275 # ----- colors self.red = '#C83737' self.lightgray = '#E6E6E6' self.rain = '#0000CC' self.snow = '0.7' self.wlvl = '#0000CC'...
identifier_body
styles.py
# -*- coding: utf-8 -*- # Copyright © 2014-2018 GWHAT Project Contributors # https://github.com/jnsebgosselin/gwhat # # This file is part of GWHAT (Ground-Water Hydrograph Analysis Toolbox). # Licensed under the terms of the GNU General Public License. # Standard library imports : import platform # Third party impo...
class StyleDB(object): def __init__(self): # ---- frame self.frame = 22 self.HLine = 52 self.VLine = 53 self.sideBarWidth = 275 # ----- colors self.red = '#C83737' self.lightgray = '#E6E6E6' self.rain = '#0000CC' self.snow = '0.7' ...
random_line_split
styles.py
# -*- coding: utf-8 -*- # Copyright © 2014-2018 GWHAT Project Contributors # https://github.com/jnsebgosselin/gwhat # # This file is part of GWHAT (Ground-Water Hydrograph Analysis Toolbox). # Licensed under the terms of the GNU General Public License. # Standard library imports : import platform # Third party impo...
elif platform.system() == 'Linux': self.fontfamily = "Ubuntu" # self.fontSize1.setPointSize(11) # 17 = QtGui.QFrame.Box | QtGui.QFrame.Plain # 22 = QtGui.QFrame.StyledPanel | QtGui.QFrame.Plain # 20 = QtGui.QFrame.HLine | QtGui.QFrame.Plain # 52 = QtGui.QFra...
elf.fontfamily = "Segoe UI" # "Cambria" #"Calibri" #"Segoe UI""
conditional_block
node_group.py
#!/usr/bin/env python # This demonstrates a node group configurations. # # Node groups can be defined with the syntax "-g N@IP0,IP1-IP2,IP3". # This says to create a group of N nodes with IPs IP0, IP1, ..., IP2, # IP3. Run it with deterministic IPs causes lots of gratuitous IP # reassignments. Running with --nd fixe...
c.recover() c.random_iterations()
random_line_split
node_group.py
#!/usr/bin/env python # This demonstrates a node group configurations. # # Node groups can be defined with the syntax "-g N@IP0,IP1-IP2,IP3". # This says to create a group of N nodes with IPs IP0, IP1, ..., IP2, # IP3. Run it with deterministic IPs causes lots of gratuitous IP # reassignments. Running with --nd fixe...
(s): (count, ips_str) = s.split("@", 1) ips = [i for r in ips_str.split(",") \ for i in expand_range(r) if r != ""] for i in range(int(count)): c.add_node(ctdb_takeover.Node(ips)) c = ctdb_takeover.Cluster() if ctdb_takeover.options.groups is None: print "Error: no node groups d...
add_node_group
identifier_name
node_group.py
#!/usr/bin/env python # This demonstrates a node group configurations. # # Node groups can be defined with the syntax "-g N@IP0,IP1-IP2,IP3". # This says to create a group of N nodes with IPs IP0, IP1, ..., IP2, # IP3. Run it with deterministic IPs causes lots of gratuitous IP # reassignments. Running with --nd fixe...
def add_node_group(s): (count, ips_str) = s.split("@", 1) ips = [i for r in ips_str.split(",") \ for i in expand_range(r) if r != ""] for i in range(int(count)): c.add_node(ctdb_takeover.Node(ips)) c = ctdb_takeover.Cluster() if ctdb_takeover.options.groups is None: ...
sr = r.split("-", 1) if len(sr) == 2: all = string.ascii_uppercase + string.ascii_lowercase sr = list(all[all.index(sr[0]):all.index(sr[1])+1]) return sr
identifier_body
node_group.py
#!/usr/bin/env python # This demonstrates a node group configurations. # # Node groups can be defined with the syntax "-g N@IP0,IP1-IP2,IP3". # This says to create a group of N nodes with IPs IP0, IP1, ..., IP2, # IP3. Run it with deterministic IPs causes lots of gratuitous IP # reassignments. Running with --nd fixe...
c.recover() c.random_iterations()
add_node_group(g)
conditional_block
sky_box_actor.js
(function (exports) { exports.SkyBoxActor = SkyBoxActor; // The instance of this class is sent throght network. function SkyBoxActor(actorInfo, actorManager)
; SkyBoxActor.prototype = Object.create(exports.Actor.prototype); SkyBoxActor.prototype.constructor = exports.Actor; exports.ActorManager.setCreator( exports.SkyBoxActorInfo.prototype.type, function(actorInfo, actorManager){ return new exports.SkyBoxActor(actorInfo, actorManager); } )...
{ exports.Actor.call(this, actorInfo, actorManager); var cShape = new Ammo.btSphereShape(1); var inertia = new Ammo.btVector3(); cShape.calculateLocalInertia(0, inertia); this.physicsState = new exports.PhysicsState(actorManager.physics); this.physicsState.rigidBody = new Ammo.btRigidBody(0, this, cShape,...
identifier_body
sky_box_actor.js
(function (exports) { exports.SkyBoxActor = SkyBoxActor; // The instance of this class is sent throght network. function
(actorInfo, actorManager) { exports.Actor.call(this, actorInfo, actorManager); var cShape = new Ammo.btSphereShape(1); var inertia = new Ammo.btVector3(); cShape.calculateLocalInertia(0, inertia); this.physicsState = new exports.PhysicsState(actorManager.physics); this.physicsState.rigidBody = new Ammo.bt...
SkyBoxActor
identifier_name
sky_box_actor.js
(function (exports) { exports.SkyBoxActor = SkyBoxActor; // The instance of this class is sent throght network. function SkyBoxActor(actorInfo, actorManager) { exports.Actor.call(this, actorInfo, actorManager); var cShape = new Ammo.btSphereShape(1); var inertia = new Ammo.btVector3(); cShape....
); })(typeof teien === 'undefined' ? module.exports : teien);
return new exports.SkyBoxActor(actorInfo, actorManager); }
random_line_split
connecting.rs
extern crate ftp; use std::str; use std::io::Cursor; use ftp::FtpStream; fn
() { let mut ftp_stream = match FtpStream::connect("127.0.0.1", 21) { Ok(s) => s, Err(e) => panic!("{}", e) }; match ftp_stream.login("username", "password") { Ok(_) => (), Err(e) => panic!("{}", e) } match ftp_stream.current_dir() { Ok(dir) => println!("{}", d...
main
identifier_name
connecting.rs
extern crate ftp; use std::str; use std::io::Cursor; use ftp::FtpStream; fn main()
{ let mut ftp_stream = match FtpStream::connect("127.0.0.1", 21) { Ok(s) => s, Err(e) => panic!("{}", e) }; match ftp_stream.login("username", "password") { Ok(_) => (), Err(e) => panic!("{}", e) } match ftp_stream.current_dir() { Ok(dir) => println!("{}", dir)...
identifier_body
connecting.rs
extern crate ftp; use std::str; use std::io::Cursor; use ftp::FtpStream; fn main() { let mut ftp_stream = match FtpStream::connect("127.0.0.1", 21) { Ok(s) => s, Err(e) => panic!("{}", e) }; match ftp_stream.login("username", "password") { Ok(_) => (), Err(e) => panic!("{}", ...
let _ = ftp_stream.quit(); }
}
random_line_split