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
pre_NAMD.py
# pre_NAMD.py # Creates the files used for NAMD based on the .pdb file dowloaded from PDB bank # # Usage: # python pre_NAMD.py $PDBID # # $PDBID=the 4 characters identification code of the .pdb file # # Input: # $PDBID.pdb: .pdb file downloaded from PDB bank # # Output: # $PDBID_p.pdb: .pdb file with water mole...
# the ionized water box model # # Author: Xiaofei Zhang # Date: June 20 2016 from __future__ import print_function import sys, os def print_error(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) # main if len(sys.argv) != 2: print_error("Usage: python pre_NAMD.py $PDBID") sys.exit(-1) mypa...
# $PDBID_wb_i.pdb: .pdb file of the ionized water box model (For NAMD) # $PDBID_wb_i.psf: .psf file of PDBID_wb_i.pdb (For NAMD) # $PDBID.log: Log file of the whole process (output of VMD) # $PDBID_center.txt: File contains the grid and center information of
random_line_split
lib.rs
.copy_head.borrow(); copy_head.fill.set(end); unsafe { copy_head.as_ptr().offset(start as int) } } #[inline] fn alloc_copy<T>(&self, op: || -> T) -> &mut T { unsafe { let ptr = self.alloc_copy_inner(mem::size_of::<T>(), ...
{ self.grow() }
conditional_block
lib.rs
preallocated. pub fn new_with_size(initial_size: uint) -> Arena { Arena { head: RefCell::new(chunk(initial_size, false)), copy_head: RefCell::new(chunk(initial_size, true)), chunks: RefCell::new(Vec::new()), } } } fn chunk(size: uint, is_copy: bool) -> Chunk...
TypedArenaChunk
identifier_name
lib.rs
. This reduces overhead when initializing /// plain-old-data (`Copy` types) and means we don't need to waste time running /// their destructors. pub struct Arena { // The head is separated out from the list as a unbenchmarked // microoptimization, to avoid needing to case on the list to access the // head. ...
} /// Allocates a new Arena with `initial_size` bytes preallocated. pub fn new_with_size(initial_size: uint) -> Arena { Arena { head: RefCell::new(chunk(initial_size, false)), copy_head: RefCell::new(chunk(initial_size, true)), chunks: RefCell::new(Vec::new()), ...
impl Arena { /// Allocates a new Arena with 32 bytes preallocated. pub fn new() -> Arena { Arena::new_with_size(32u)
random_line_split
lib.rs
let start = round_up(self.copy_head.borrow().fill.get(), align); let end = start + n_bytes; if end > self.chunk_size() { return self.alloc_copy_grow(n_bytes, align); } let copy_head = self.copy_head.borrow(); copy_head.fill.set(end); unsafe { c...
{ unsafe { let chunk = TypedArenaChunk::<T>::new(ptr::null_mut(), capacity); TypedArena { ptr: Cell::new((*chunk).start() as *const T), end: Cell::new((*chunk).end() as *const T), first: RefCell::new(chunk), } } }
identifier_body
column_item.tsx
import React from 'react' export default (props: any) => { const column = props.column return ( <div className="_20Cq3Rn7_0"> <div className="_2sej44xY_0"> <a data-seo="" href="//time.geekbang.org/course/intro/237"> <img src={column.column_cover} alt="" className="_1miPDP4s_0" /> ...
) : ( '' )} {'0' + index + ' | ' + article.article_title} </a> </li> ) })} </ul> </div> <div className="_2zRFFX7P_0"> <p className="_14cxbu2p_...
href="" className={article.is_video_preview ? '_10vvBdC9_0' : ''} > {article.is_video_preview ? ( <span className="_ffA7FdL_0">免费</span>
random_line_split
cpu_timing.rs
// 6A ROR A 0, // 6B ARR* #$ab 5, // 6C JMP ($abcd) 4, // 6D ADC $abcd 6, // 6E ROR $abcd 0, // 6F RRA* $abcd 2, // 70 BVS nearlabel 5, // 71 ADC ($ab),Y 0, // 72 HLT* 0, // 73 RRA* ($ab),Y 0, // 74 SKB* $ab,X 4, // 75 ADC $ab,X 6, // 76 ROR $ab,X 0, // 77 RRA* $ab,X...
{ let clock = Rc::new(Cell::new(0u8)); let clock_clone = clock.clone(); let tick_fn: TickFn = Rc::new(move || { clock_clone.set(clock_clone.get().wrapping_add(1)); }); cpu.write(0x1000, opcode as u8); cpu.write(0x1001, 0x00); ...
conditional_block
cpu_timing.rs
(ram: Ram) -> Self { MockMemory { ram } } } impl Addressable for MockMemory { fn read(&self, address: u16) -> u8 { self.ram.read(address) } fn write(&mut self, address: u16, value: u8) { self.ram.write(address, value); } } fn setup_cpu() -> Cpu6510 { let ba_line = Rc::...
new
identifier_name
cpu_timing.rs
F ASO* $abcd,X 6, // 20 JSR $abcd 6, // 21 AND ($ab,X) 0, // 22 HLT* 0, // 23 RLA* ($ab,X) 3, // 24 BIT $ab 3, // 25 AND $ab 5, // 26 ROL $ab 0, // 27 RLA* $ab 4, // 28 PLP 2, // 29 AND #$ab 2, // 2A ROL A 0, // 2B ANC* #$ab 4, // 2C BIT $abcd 4, // 2D AND $abcd ...
4, // BC LDY $abcd,X 4, // BD LDA $abcd,X
random_line_split
cpu_timing.rs
fn write(&mut self, address: u16, value: u8) { self.ram.write(address, value); } } fn setup_cpu() -> Cpu6510 { let ba_line = Rc::new(RefCell::new(Pin::new_high())); let cpu_io_port = Rc::new(RefCell::new(IoPort::new(0x00, 0xff))); let cpu_irq = Rc::new(RefCell::new(IrqLine::new("irq"))); ...
{ self.ram.read(address) }
identifier_body
models.py
# Django from django.contrib.auth.models import User from common.utils import get_sentinel_user from toggleproperties.models import ToggleProperty try: # Django < 1.10 from django.contrib.contenttypes.generic import GenericForeignKey except ImportError: # Django >= 1.10 from django.contrib.contenttype...
property_type='like' ).values_list('user__pk', flat=True) def __str__(self): return "Comment %d" % self.pk def get_absolute_url(self): object_url = self.content_type.get_object_for_this_type(id=self.object_id).get_absolute_url() return '%s#c%d' % (object_url, self.i...
@property def likes(self): return ToggleProperty.objects.filter( object_id=self.pk, content_type=ContentType.objects.get_for_model(NestedComment),
random_line_split
models.py
# Django from django.contrib.auth.models import User from common.utils import get_sentinel_user from toggleproperties.models import ToggleProperty try: # Django < 1.10 from django.contrib.contenttypes.generic import GenericForeignKey except ImportError: # Django >= 1.10 from django.contrib.contenttype...
class Meta: app_label = 'nested_comments'
raise ValidationError('Comments are closed')
conditional_block
models.py
# Django from django.contrib.auth.models import User from common.utils import get_sentinel_user from toggleproperties.models import ToggleProperty try: # Django < 1.10 from django.contrib.contenttypes.generic import GenericForeignKey except ImportError: # Django >= 1.10 from django.contrib.contenttype...
: app_label = 'nested_comments'
Meta
identifier_name
models.py
# Django from django.contrib.auth.models import User from common.utils import get_sentinel_user from toggleproperties.models import ToggleProperty try: # Django < 1.10 from django.contrib.contenttypes.generic import GenericForeignKey except ImportError: # Django >= 1.10 from django.contrib.contenttype...
created = models.DateTimeField( auto_now_add=True, editable=False, ) updated = models.DateTimeField( auto_now=True, editable=False, ) parent = models.ForeignKey( 'self', null=True, blank=True, related_name='children', on_dele...
content_type = models.ForeignKey( ContentType, on_delete=models.CASCADE ) object_id = models.PositiveIntegerField() content_object = GenericForeignKey( 'content_type', 'object_id', ) author = models.ForeignKey( User, related_name="comments", ...
identifier_body
Logo.tsx
import React from 'react' import SvgIcon, { Props as SvgIconProps } from './SvgIcon' export const logoAspect = 90 / 103.9
export default class Logo extends React.Component<SvgIconProps> { render() { return ( <SvgIcon viewBox='0 0 90 103.9' {...this.props}> <path opacity='.6' fill='#009741' d='M45 34.6l15 8.7V26L30 8.7 0 26v34.6l30 17.3 30-17.3-15 8.7-15-8.7V43.3z'/> <path opacity='.6...
random_line_split
Logo.tsx
import React from 'react' import SvgIcon, { Props as SvgIconProps } from './SvgIcon' export const logoAspect = 90 / 103.9 export default class Logo extends React.Component<SvgIconProps> {
() { return ( <SvgIcon viewBox='0 0 90 103.9' {...this.props}> <path opacity='.6' fill='#009741' d='M45 34.6l15 8.7V26L30 8.7 0 26v34.6l30 17.3 30-17.3-15 8.7-15-8.7V43.3z'/> <path opacity='.6' fill='#dedc0a' d='M30 60.6V43.3l15-8.7L30 26 0 43.3v34.6l30 17.4 30-17.4V6...
render
identifier_name
info.py
/" + file def getViewsPath(file = ""): return getBasePath() + "/controllers/views/" + file def getPiconPath(): if pathExists("/media/usb/picon/"): return "/media/usb/picon/" elif pathExists("/media/cf/picon/"): return "/media/cf/picon/" elif pathExists("/media/hdd/picon/"): return "/media/hdd/picon/" elif ...
info['hdd'] = [] for hdd in harddiskmanager.hdd: dev = hdd.findMount() if dev: stat = os.statvfs(dev) free = int((stat.f_bfree/1024) * (stat.f_bsize/1024)) else: free = -1 if free <= 1024: free = "%i %s" % (free,_("MB")) else: free = free / 1024. free = "%.1f %s" % (free,_("GB")) s...
info['ifaces'].append({ "name": iNetwork.getAdapterName(iface), "friendlynic": getFriendlyNICChipSet(iface), "linkspeed": getLinkSpeed(iface), "mac": iNetwork.getAdapterAttribute(iface, "mac"), "dhcp": iNetwork.getAdapterAttribute(iface, "dhcp"), "ipv4method": getIPv4Method(iface), "ip": formatIp(i...
conditional_block
info.py
in tmp[1]: type = "NFS" # Default is r/w mode = _("r/w") settings = tmp[1].split(",") for setting in settings: if setting == "ro": mode = _("r/o") uri = tmp[2] parts = [] parts = tmp[2].split(':') if parts[0] is "": server = uri.split('/')[2] uri = uri.strip(...
random_line_split
info.py
recs = NavigationInstance.instance.getRecordings() if recs: # only one stream and only TV from Plugins.Extensions.OpenWebif.controllers.stream import streamList s_name = '' s_cip = '' if len(streamList)==1: from Screens.ChannelSelection import service_types_tv from enigma import eEPGCa...
ernativeServices = eServiceCenter.getInstance().list(eServiceReference(service)) return alternativeServices and alternativeServices.getContent("S", True) d
identifier_body
info.py
: free = -1 if free <= 1024: free = "%i %s" % (free,_("MB")) else: free = free / 1024. free = "%.1f %s" % (free,_("GB")) size = hdd.diskSize() * 1000000 / 1048576. if size > 1048576: size = "%.1f %s" % ((size / 1048576.),_("TB")) elif size > 1024: size = "%.1f %s" % ((size / 1024.),_("GB...
FrontendStatus(se
identifier_name
step_twisted2.py
from buildbot.status import tests from buildbot.process.step import SUCCESS, FAILURE, BuildStep from buildbot.process.step_twisted import RunUnitTests from zope.interface import implements from twisted.python import log, failure from twisted.spread import jelly from twisted.pb.tokens import BananaError from twisted.w...
except ImportError: from twisted.trial import unittest # Twisted-1.0.4 has them here for name in ResultTypeNames: setattr(ResultTypes, name, getattr(unittest, name)) log._keepErrors = 0 from twisted.trial import remote # for trial/jelly parsing import StringIO class OneJellyTest(tests.OneTest): ...
setattr(ResultTypes, name, getattr(reporter, name))
conditional_block
step_twisted2.py
from buildbot.status import tests from buildbot.process.step import SUCCESS, FAILURE, BuildStep from buildbot.process.step_twisted import RunUnitTests from zope.interface import implements from twisted.python import log, failure from twisted.spread import jelly from twisted.pb.tokens import BananaError from twisted.w...
def addStdout(self, data): if not self.decoder: return try: self.decoder.dataReceived(data) except BananaError: self.decoder = None log.msg("trial --jelly output unparseable, traceback follows") log.deferr() def remote_start(...
BuildStep.logProgress(self, progress)
identifier_body
step_twisted2.py
from buildbot.status import tests from buildbot.process.step import SUCCESS, FAILURE, BuildStep from buildbot.process.step_twisted import RunUnitTests from zope.interface import implements from twisted.python import log, failure from twisted.spread import jelly from twisted.pb.tokens import BananaError from twisted.w...
(self, progress): # XXX: track number of tests BuildStep.logProgress(self, progress) def addStdout(self, data): if not self.decoder: return try: self.decoder.dataReceived(data) except BananaError: self.decoder = None log.msg("t...
logProgress
identifier_name
step_twisted2.py
from buildbot.status import tests from buildbot.process.step import SUCCESS, FAILURE, BuildStep from buildbot.process.step_twisted import RunUnitTests from zope.interface import implements from twisted.python import log, failure from twisted.spread import jelly from twisted.pb.tokens import BananaError from twisted.we...
if total == None: result = (FAILURE, ['tests%s' % self.rtext(' (%s)')]) if count: result = (FAILURE, ["%d tes%s%s" % (count, (count == 1 and 't' or 'ts'), self.rtext(' (%s)'))]) ...
total = self.results.countTests() count = self.results.countFailures() result = SUCCESS
random_line_split
populate_mini_ws.py
from biokbase.workspace.client import Workspace import requests import json import sys from time import time from fix_workspace_info import fix_all_workspace_info from pprint import pprint kb_port = 9999 mini_ws_url = f"http://localhost:{kb_port}/services/ws" mini_auth_url = f"http://localhost:{kb_port}/services/auth/...
return uploaded_data def _load_workspace_data(ws, ws_data, idx, narrative_ver): """ Loads up a single workspace with data and returns a dict about it. Dict contains: id = the workspace id perms = the workspace permissions correct_meta = the correct workspace metadata (for validation) "...
uploaded_data.append(_load_workspace_data(ws, ws_data, len(uploaded_data), vers['new_ver']))
conditional_block
populate_mini_ws.py
from biokbase.workspace.client import Workspace import requests import json import sys from time import time from fix_workspace_info import fix_all_workspace_info from pprint import pprint kb_port = 9999 mini_ws_url = f"http://localhost:{kb_port}/services/ws" mini_auth_url = f"http://localhost:{kb_port}/services/auth/...
}) ws.release_module('KBaseNarrative') for n in ws.get_module_info({'mod': 'KBaseNarrative'})['types'].keys(): if '.Narrative' in n: old_ver = n.split('-')[-1] with open(narrative_spec_file, "r") as f: spec = f.read() ws.register_typespec({ 'spec': spec, ...
""" Loads the KBaseNarrative.Narrative type info into mini kb. ws = Workspace client configured for admin """ ws.request_module_ownership("KBaseNarrative") ws.administer({ 'command': 'approveModRequest', 'module': 'KBaseNarrative' }) with open(old_narrative_spec_file, "r") as...
identifier_body
populate_mini_ws.py
from biokbase.workspace.client import Workspace import requests import json import sys from time import time from fix_workspace_info import fix_all_workspace_info from pprint import pprint kb_port = 9999 mini_ws_url = f"http://localhost:{kb_port}/services/ws" mini_auth_url = f"http://localhost:{kb_port}/services/auth/...
(ws): """ Loads the KBaseNarrative.Narrative type info into mini kb. ws = Workspace client configured for admin """ ws.request_module_ownership("KBaseNarrative") ws.administer({ 'command': 'approveModRequest', 'module': 'KBaseNarrative' }) with open(old_narrative_spec_fil...
load_narrative_type
identifier_name
populate_mini_ws.py
from biokbase.workspace.client import Workspace import requests import json import sys from time import time from fix_workspace_info import fix_all_workspace_info from pprint import pprint kb_port = 9999 mini_ws_url = f"http://localhost:{kb_port}/services/ws" mini_auth_url = f"http://localhost:{kb_port}/services/auth/...
'dryrun': 0, 'new_types': [ 'Narrative', 'Cell', 'Worksheet', 'Metadata' ] }) ws.release_module('KBaseNarrative') for n in ws.get_module_info({'mod': 'KBaseNarrative'})['types'].keys(): if '.Narrative' in n: old_ver ...
with open(old_narrative_spec_file, "r") as f: old_spec = f.read() ws.register_typespec({ 'spec': old_spec,
random_line_split
game.js
/* global Cervus */ const material = new Cervus.materials.PhongMaterial({ requires: [ Cervus.components.Render, Cervus.components.Transform ], texture: Cervus.core.image_loader('../textures/4.png'), normal_map: Cervus.core.image_loader('../textures/normal2.jpg') }); const phong_material = new Cervus.ma...
game.light.get_component(Cervus.components.Transform).position = game.camera.get_component(Cervus.components.Transform).position; });
random_line_split
P4COMSTR.py
#!/usr/bin/env python # # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, ...
"Perforce/aaa.in\nchecked-out bbb.in\nPerforce/ccc.in\n") test.must_match(['sub', 'all'], "Perforce/sub/ddd.in\nchecked-out sub/eee.in\nPerforce/sub/fff.in\n") # test.pass_test()
""" % locals())) test.must_match('all',
random_line_split
decodable.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
} Named(ref fields) => { // use the field's span to get nicer error messages. let fields = fields.iter().enumerate().map(|(i, &(name, span))| { cx.field_imm(span, name, getarg(span, cx.str_of(name), i)) }).collect(); cx.expr_struct_ident(o...
{ let fields = fields.iter().enumerate().map(|(i, &span)| { getarg(span, format!("_field{}", i).to_managed(), i) }).collect(); cx.expr_call_ident(outer_span, outer_pat_ident, fields) }
conditional_block
decodable.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr { let decoder = substr.nonself_args[0]; let recurse = ~[cx.ident_of("extra"), cx.ident_of("serialize"), cx.ident_of("Decodable"), cx.ident_of("decode")]; // throw ...
decodable_substructure
identifier_name
decodable.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
const_nonmatching: true, combine_substructure: decodable_substructure, }, ] }; trait_def.expand(mitem, in_items) } fn decodable_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr { let decoder = substr.nonse...
{ let trait_def = TraitDef { cx: cx, span: span, path: Path::new_(~["extra", "serialize", "Decodable"], None, ~[~Literal(Path::new_local("__D"))], true), additional_bounds: ~[], generics: LifetimeBounds { lifetimes: ~[], bounds: ~[("_...
identifier_body
decodable.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
cx.expr_method_call(span, decoder, cx.ident_of("read_struct"), ~[cx.expr_str(span, cx.str_of(substr.type_ident)), cx.expr_uint(span, nfields), cx.lambda_expr_1(span, result, blkarg)]) } Static...
cx.expr_method_call(span, blkdecoder, read_struct_field, ~[cx.expr_str(span, name), cx.expr_uint(span, field), lambdadecode]) });
random_line_split
simpleturing.js
var simpleturing = (function() { function Machine(initial, states) { this.run = function(initialdata, position, defaultvalue) { var tape = initialdata.slice(); if (position == null) position = 0; var state = initial; ...
{ module.exports = simpleturing; }
conditional_block
simpleturing.js
var simpleturing = (function() { function
(initial, states) { this.run = function(initialdata, position, defaultvalue) { var tape = initialdata.slice(); if (position == null) position = 0; var state = initial; while (true) { // console.log(tape); ...
Machine
identifier_name
simpleturing.js
var simpleturing = (function() { function Machine(initial, states)
next = states[state][value]; tape[position] = next[0]; state = next[1]; if (state == 'stop') return tape; position += next[2]; } } } ...
{ this.run = function(initialdata, position, defaultvalue) { var tape = initialdata.slice(); if (position == null) position = 0; var state = initial; while (true) { // console.log(tape); // console.log(s...
identifier_body
simpleturing.js
var simpleturing = (function() { function Machine(initial, states) { this.run = function(initialdata, position, defaultvalue) { var tape = initialdata.slice(); if (position == null) position = 0; var state = initial; ...
}
random_line_split
create_db.py
database""" def __init__(self, input_file, db_name, backend, image_dims, **kwargs):
self.encoding = kwargs.pop('encoding', None) self.compression = kwargs.pop('compression', None) self.mean_file = kwargs.pop('mean_file', None) self.labels_file = kwargs.pop('labels_file', None) super(CreateDbTask, self).__init__(**kwargs) self.pickver_task_createdb = PIC...
""" Arguments: input_file -- read images and labels from this file db_name -- save database to this location backend -- database backend (lmdb/hdf5) image_dims -- (height, width, channels) Keyword Arguments: image_folder -- prepend image paths with this folder ...
identifier_body
create_db.py
database""" def __init__(self, input_file, db_name, backend, image_dims, **kwargs): """ Arguments: input_file -- read images and labels from this file db_name -- save database to this location backend -- database backend (lmdb/hdf5) image_dims -- (height, width, cha...
@override def html_id(self): if self.db_name == utils.constants.TRAIN_DB or 'train' in self.db_name.lower(): return 'task-create_db-train' elif self.db_name == utils.constants.VAL_DB or 'val' in self.db_name.lower(): return 'task-create_db-val' elif self.db_name ...
@override def before_run(self): super(CreateDbTask, self).before_run() self.create_db_log = open(self.path(self.create_db_log_file), 'a')
random_line_split
create_db.py
database""" def __init__(self, input_file, db_name, backend, image_dims, **kwargs): """ Arguments: input_file -- read images and labels from this file db_name -- save database to this location backend -- database backend (lmdb/hdf5) image_dims -- (height, width, cha...
(self, resources, env): args = [sys.executable, os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(digits.__file__))), 'tools', 'create_db.py'), self.path(self.input_file), self.path(self.db_name), self.image_dims[1], ...
task_arguments
identifier_name
create_db.py
database""" def __init__(self, input_file, db_name, backend, image_dims, **kwargs): """ Arguments: input_file -- read images and labels from this file db_name -- save database to this location backend -- database backend (lmdb/hdf5) image_dims -- (height, width, cha...
self.pickver_task_createdb = PICKLE_VERSION if not hasattr(self, 'backend') or self.backend is None: self.backend = 'lmdb' if not hasattr(self, 'compression') or self.compression is None: self.compression = 'none' @override def name(self): if self.db_na...
self.encoding = 'none'
conditional_block
searchEditorModel.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
searchEditorModel.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
private async createModel() { const getContents = async () => { if (this.existingData.text !== undefined) { return this.existingData.text; } else if (this.existingData.backingUri !== undefined) { return (await this.instantiationService.invokeFunction(parseSavedSearchEditor, this.existingData.backi...
{ await (this.ongoingResolve = this.ongoingResolve.then(() => this.cachedContentsModel || this.createModel())); return assertIsDefined(this.cachedContentsModel); }
identifier_body
searchEditorModel.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(): Promise<ITextModel> { await (this.ongoingResolve = this.ongoingResolve.then(() => this.cachedContentsModel || this.createModel())); return assertIsDefined(this.cachedContentsModel); } private async createModel() { const getContents = async () => { if (this.existingData.text !== undefined) { return t...
resolve
identifier_name
poetry_requirements_caof.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import os from typing import Iterable, Mapping from packaging.utils import canonicalize_name as canonicalize_project_name from pants.backend.python.ma...
requirements = parse_pyproject_toml( PyProjectToml.deprecated_macro_create(self._parse_context, source) ) for parsed_req in requirements: normalized_proj_name = canonicalize_project_name(parsed_req.project_name) self._parse_context.create_object( ...
""" :param module_mapping: a mapping of requirement names to a list of the modules they provide. For example, `{"ansicolors": ["colors"]}`. Any unspecified requirements will use the requirement name as the default module, e.g. "Django" will default to `modules=["django"]`. ...
identifier_body
poetry_requirements_caof.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import os from typing import Iterable, Mapping from packaging.utils import canonicalize_name as canonicalize_project_name from pants.backend.python.ma...
: """Translates dependencies specified in a pyproject.toml Poetry file to a set of "python_requirements_library" targets. For example, if pyproject.toml contains the following entries under poetry.tool.dependencies: `foo = ">1"` and `bar = ">2.4"`, python_requirement( name="foo", ...
PoetryRequirementsCAOF
identifier_name
poetry_requirements_caof.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import os from typing import Iterable, Mapping from packaging.utils import canonicalize_name as canonicalize_project_name from pants.backend.python.ma...
normalized_proj_name = canonicalize_project_name(parsed_req.project_name) self._parse_context.create_object( "python_requirement", name=parsed_req.project_name, requirements=[parsed_req], modules=normalized_module_mapping.get(normalized_proj_na...
conditional_block
poetry_requirements_caof.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import os from typing import Iterable, Mapping from packaging.utils import canonicalize_name as canonicalize_project_name from pants.backend.python.ma...
You may also use the parameter `module_mapping` to teach Pants what modules each of your requirements provide. For any requirement unspecified, Pants will default to the name of the requirement. This setting is important for Pants to know how to convert your import statements back into your dependencies...
See Poetry documentation for correct specification of pyproject.toml: https://python-poetry.org/docs/pyproject/
random_line_split
yt-helper.ts
// YouTube Helper // require utils.js // require yt-parser import {ytparser} from './yt-parser'; import * as _ from 'underscore'; export class yth { /** * @param options cf options Youtube */ static getSrc(vid, origin, options) { origin = origin || (location.protocol + '//' + location.host + location.pa...
rel: 0, autoplay: 0, disablekb: 1, playsinline: 1, widgetid: 2 }, options); return "https://www.youtube.com/embed/" + vid + "?" + $.param(params).replace(/&/g, '&amp;'); }; /** * Conversion d'une liste de piste en tracklist YouTube * @param {[Disc.Track]} tracks */ ...
showinfo: 0,
random_line_split
yt-helper.ts
// YouTube Helper // require utils.js // require yt-parser import {ytparser} from './yt-parser'; import * as _ from 'underscore'; export class yth { /** * @param options cf options Youtube */ static getSrc(vid, origin, options) { origin = origin || (location.protocol + '//' + location.host + location.pa...
return formatHMSS(track.startSeconds); }; }
identifier_body
yt-helper.ts
// YouTube Helper // require utils.js // require yt-parser import {ytparser} from './yt-parser'; import * as _ from 'underscore'; export class
{ /** * @param options cf options Youtube */ static getSrc(vid, origin, options) { origin = origin || (location.protocol + '//' + location.host + location.pathname); const params = $.extend({ origin: origin, // origin toujours en premier car tout est placé dans ce paramètre feature: 'pla...
yth
identifier_name
evaluator.rs
// // This file is part of zero_sum. // // zero_sum is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // zero_sum is distributed in...
} /// Implement arithmetic operators (`Add`, `Sub`, `Mul`, `Neg`, `Div`) and `Display` for a tuple /// struct in terms of the enclosed type. /// /// # Example /// /// ```rust /// #[macro_use] /// extern crate zero_sum; /// # use zero_sum::analysis::Evaluation; /// # use std::fmt; /// use std::i32; /// use std::ops::{...
{ let mut state = state.clone(); if let Err(error) = state.execute_plies(plies) { panic!("Error calculating evaluation: {}", error); } if plies.len() % 2 == 0 { self.evaluate(&state) } else { -self.evaluate(&state) } }
identifier_body
evaluator.rs
// // This file is part of zero_sum. // // zero_sum is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // zero_sum is distributed in...
/// This is usually a tuple around a signed numeric type. /// /// # Example /// /// There is a [helper macro](../macro.prepare_evaluation_tuple.html) to facilitate the implementation of tuple structs: /// /// ```rust /// #[macro_use] /// extern crate zero_sum; /// # use zero_sum::analysis::Evaluation; /// # use std::fm...
random_line_split
evaluator.rs
// // This file is part of zero_sum. // // zero_sum is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // zero_sum is distributed in...
() -> Self { -Self::win() } /// The maximum value representable. This must be safely negatable. fn max() -> Self; /// The minimum value representable. fn min() -> Self { -Self::max() } /// Returns `true` if this evaluation contains a win. This is usually a check to /// see if the value is abov...
lose
identifier_name
evaluator.rs
// // This file is part of zero_sum. // // zero_sum is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // zero_sum is distributed in...
} } /// Implement arithmetic operators (`Add`, `Sub`, `Mul`, `Neg`, `Div`) and `Display` for a tuple /// struct in terms of the enclosed type. /// /// # Example /// /// ```rust /// #[macro_use] /// extern crate zero_sum; /// # use zero_sum::analysis::Evaluation; /// # use std::fmt; /// use std::i32; /// use std::...
{ -self.evaluate(&state) }
conditional_block
regofsoffline.py
.soundspeed.profile.profilelist import ProfileList from hyo2.abc.lib.progress.cli_progress import CliProgress logger = logging.getLogger(__name__) class RegOfsOffline: class Model(IntEnum): # East Coast CBOFS = 10 # RG = True # Format is GoMOFS DBOFS = 11 # RG = True # Format ...
self._has_data_loaded = False # grids are "
if self._file: self._file.close()
conditional_block
regofsoffline.py
.soundspeed.profile.profilelist import ProfileList from hyo2.abc.lib.progress.cli_progress import CliProgress logger = logging.getLogger(__name__) class RegOfsOffline: class Model(IntEnum): # East Coast CBOFS = 10 # RG = True # Format is GoMOFS DBOFS = 11 # RG = True # Format ...
def __init__(self, data_folder: str, prj: 'hyo2.soundspeed.soundspeed import SoundSpeedLibrary') -> None: self.name = self.__class__.__name__ self.desc = "Abstract atlas" # a human-readable description self.data_folder = data_folder self.prj = prj self.g = Geodesy() ...
}
random_line_split
regofsoffline.py
.soundspeed.profile.profilelist import ProfileList from hyo2.abc.lib.progress.cli_progress import CliProgress logger = logging.getLogger(__name__) class RegOfsOffline: class Model(IntEnum): # East Coast CBOFS = 10 # RG = True # Format is GoMOFS DBOFS = 11 # RG = True # Format ...
self._temp = None self._sal = None def query(self, nc_path: str, lat: float, lon: float) -> Optional[ProfileList]: if not os.path.exists(nc_path): raise RuntimeError('Unable to locate %s' % nc_path) logger.debug('nc path: %s' % nc_path) if (lat is None) or (lon...
self.name = self.__class__.__name__ self.desc = "Abstract atlas" # a human-readable description self.data_folder = data_folder self.prj = prj self.g = Geodesy() self._has_data_loaded = False # grids are "loaded" ? (netCDF files are opened) self._file = None se...
identifier_body
regofsoffline.py
.soundspeed.profile.profilelist import ProfileList from hyo2.abc.lib.progress.cli_progress import CliProgress logger = logging.getLogger(__name__) class RegOfsOffline: class Model(IntEnum): # East Coast CBOFS = 10 # RG = True # Format is GoMOFS DBOFS = 11 # RG = True # Format ...
(self, data_folder: str, prj: 'hyo2.soundspeed.soundspeed import SoundSpeedLibrary') -> None: self.name = self.__class__.__name__ self.desc = "Abstract atlas" # a human-readable description self.data_folder = data_folder self.prj = prj self.g = Geodesy() self._has_data_...
__init__
identifier_name
Routes.js
import React from 'react'; import { connect } from 'react-redux'; import {Router, Route, IndexRedirect, browserHistory} from 'react-router'; import { updatePlayersArray, updateLastNumberRolled, updateNextPlayerIndexTurn, setFirstPlayerTurn, startGame, buy, receivingMoney, receiveMoney } from '../reducers/gameReducer'; ...
} }); export default connect(null, mapDispatch)(Routes);
random_line_split
main.rs
extern crate clap; extern crate yaml_rust; extern crate lxd; use std::env; use std::fs::File; use std::io::Read; use clap::{App, Arg, ArgMatches, SubCommand}; use yaml_rust::YamlLoader; use lxd::{Container,LxdServer}; fn create_dividing_line(widths: &Vec<usize>) -> String { let mut dividing_line = String::new(...
fn list(matches: &ArgMatches) { let home_dir = env::var("HOME").unwrap(); let mut config_file = File::open(home_dir.clone() + "/.config/lxc/config.yml").unwrap(); let mut file_contents = String::new(); config_file.read_to_string(&mut file_contents).unwrap(); let lxd_config = YamlLoader::load_from_...
{ let mut ipv4_address = String::new(); let mut ipv6_address = String::new(); for ip in &c.status.ips { if ip.protocol == "IPV4" && ip.address != "127.0.0.1" { ipv4_address = ip.address.clone(); } if ip.protocol == "IPV6" && ip.address != "::1" { ipv6_address ...
identifier_body
main.rs
extern crate clap; extern crate yaml_rust; extern crate lxd; use std::env; use std::fs::File; use std::io::Read; use clap::{App, Arg, ArgMatches, SubCommand}; use yaml_rust::YamlLoader; use lxd::{Container,LxdServer}; fn create_dividing_line(widths: &Vec<usize>) -> String { let mut dividing_line = String::new(...
(item: &Vec<String>, widths: &Vec<usize>) -> String { let mut content_line = String::new(); content_line.push_str("|"); for (n, column_content) in item.iter().enumerate() { content_line.push_str(" "); content_line.push_str(&format!("{:1$}", &column_content, widths[n] + 1)); content_l...
create_content_line
identifier_name
main.rs
extern crate clap; extern crate yaml_rust; extern crate lxd; use std::env; use std::fs::File; use std::io::Read; use clap::{App, Arg, ArgMatches, SubCommand}; use yaml_rust::YamlLoader; use lxd::{Container,LxdServer}; fn create_dividing_line(widths: &Vec<usize>) -> String { let mut dividing_line = String::new(...
match matches.subcommand_name() { Some("list") => list(matches.subcommand_matches("list").unwrap()), _ => println!("{}", matches.usage()), } }
.index(1))) .get_matches();
random_line_split
main.rs
extern crate clap; extern crate yaml_rust; extern crate lxd; use std::env; use std::fs::File; use std::io::Read; use clap::{App, Arg, ArgMatches, SubCommand}; use yaml_rust::YamlLoader; use lxd::{Container,LxdServer}; fn create_dividing_line(widths: &Vec<usize>) -> String { let mut dividing_line = String::new(...
if ip.protocol == "IPV6" && ip.address != "::1" { ipv6_address = ip.address.clone(); } } let ephemeral = if c.ephemeral { "YES" } else { "NO" }; vec![c.name.clone(), c.status.status.clone().to_uppercase(), ipv4_address.to_string(), ipv6_address.to_string(), ephemeral.to_string()...
{ ipv4_address = ip.address.clone(); }
conditional_block
red.py
#!/usr/bin/python # Example using an RGB character LCD wired directly to Raspberry Pi or BeagleBone Black. import time import Adafruit_CharLCD as LCD # Raspberry Pi configuration: lcd_rs = 27 # Change this to pin 21 on older revision Raspberry Pi's lcd_en = 22 lcd_d4 = 25 lcd_d5 = 24 lcd_d6 = 23 lcd_d7...
lcd.message('Joyeux') time.sleep(3.0) lcd.set_color(0.0, 1.0, 0.0) lcd.clear() lcd.message('Noel') time.sleep(3.0) lcd.set_color(0.0, 0.0, 1.0) lcd.clear() lcd.message('Je vais') time.sleep(3.0) lcd.set_color(1.0, 1.0, 0.0) lcd.clear() lcd.message('te faire') time.sleep(3.0) lcd.set_color(0.0, 1.0...
random_line_split
aasincos.js
function aasin(v) { var ONE_TOL = 1.00000000000001; var av = fabs(v); if (av >= 1) { if (av > ONE_TOL) pj_ctx_set_errno(-19); return v < 0 ? -M_HALFPI : M_HALFPI; } return asin(v); } function
(v) { var ONE_TOL = 1.00000000000001; var av = fabs(v); if (av >= 1) { if (av > ONE_TOL) pj_ctx_set_errno(-19); return (v < 0 ? M_PI : 0); } return acos(v); } function asqrt(v) { return ((v <= 0) ? 0 : sqrt(v)); } function aatan2(n, d) { var ATOL = 1e-50; return ((fabs(n) < ATOL && fabs(d) < ATO...
aacos
identifier_name
aasincos.js
function aasin(v) { var ONE_TOL = 1.00000000000001; var av = fabs(v); if (av >= 1) { if (av > ONE_TOL) pj_ctx_set_errno(-19); return v < 0 ? -M_HALFPI : M_HALFPI; } return asin(v); } function aacos(v) { var ONE_TOL = 1.00000000000001; var av = fabs(v); if (av >= 1) { if (av > ONE_TOL) pj_ct...
function aatan2(n, d) { var ATOL = 1e-50; return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0 : atan2(n,d)); }
} function asqrt(v) { return ((v <= 0) ? 0 : sqrt(v)); }
random_line_split
aasincos.js
function aasin(v) { var ONE_TOL = 1.00000000000001; var av = fabs(v); if (av >= 1) { if (av > ONE_TOL) pj_ctx_set_errno(-19); return v < 0 ? -M_HALFPI : M_HALFPI; } return asin(v); } function aacos(v) { var ONE_TOL = 1.00000000000001; var av = fabs(v); if (av >= 1)
return acos(v); } function asqrt(v) { return ((v <= 0) ? 0 : sqrt(v)); } function aatan2(n, d) { var ATOL = 1e-50; return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0 : atan2(n,d)); }
{ if (av > ONE_TOL) pj_ctx_set_errno(-19); return (v < 0 ? M_PI : 0); }
conditional_block
aasincos.js
function aasin(v) { var ONE_TOL = 1.00000000000001; var av = fabs(v); if (av >= 1) { if (av > ONE_TOL) pj_ctx_set_errno(-19); return v < 0 ? -M_HALFPI : M_HALFPI; } return asin(v); } function aacos(v) { var ONE_TOL = 1.00000000000001; var av = fabs(v); if (av >= 1) { if (av > ONE_TOL) pj_c...
function aatan2(n, d) { var ATOL = 1e-50; return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0 : atan2(n,d)); }
{ return ((v <= 0) ? 0 : sqrt(v)); }
identifier_body
brain_subprocess.py
# Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com> # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER import sys import textwrap import six import astroid PY33 = sys.version_info >= (3, 3) PY36 = s...
start_new_session=False, pass_fds=()): pass """ else: communicate = ('string', 'string') communicate_signature = 'def communicate(self, input=None)' init = """ def __init__(self, args, bufsize=0, executable=None, ...
communicate = (bytes('string', 'ascii'), bytes('string', 'ascii')) communicate_signature = 'def communicate(self, input=None, timeout=None)' if PY36: init = """ def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, ...
conditional_block
brain_subprocess.py
# Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com> # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER import sys import textwrap import six import astroid PY33 = sys.version_info >= (3, 3) PY36 = s...
startupinfo=None, creationflags=0, restore_signals=True, start_new_session=False, pass_fds=()): pass """ else: communicate = ('string', 'string') communicate_signature = 'def communicate(self, input=None)' init = "...
if six.PY3: communicate = (bytes('string', 'ascii'), bytes('string', 'ascii')) communicate_signature = 'def communicate(self, input=None, timeout=None)' if PY36: init = """ def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=No...
identifier_body
brain_subprocess.py
# Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com> # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER import sys import textwrap import six import astroid PY33 = sys.version_info >= (3, 3) PY36 = s...
def __enter__(self): return self def __exit__(self, *args): pass ''' else: ctx_manager = '' code = textwrap.dedent(''' class Popen(object): returncode = pid = 0 stdin = stdout = stderr = file() %(communicate_signature)s: return %(communica...
wait_signature = 'def wait(self, timeout=None)' else: wait_signature = 'def wait(self)' if six.PY3: ctx_manager = '''
random_line_split
brain_subprocess.py
# Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com> # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER import sys import textwrap import six import astroid PY33 = sys.version_info >= (3, 3) PY36 = s...
(): if six.PY3: communicate = (bytes('string', 'ascii'), bytes('string', 'ascii')) communicate_signature = 'def communicate(self, input=None, timeout=None)' if PY36: init = """ def __init__(self, args, bufsize=0, executable=None, stdin=None, s...
_subprocess_transform
identifier_name
string.rs
/* * Copyright (c) 2016 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy,...
} result.push_str(&string); } result }
result.push('-');
random_line_split
string.rs
/* * Copyright (c) 2016 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy,...
underscore = false; } } camel } /// Transform a camel case command name to its dashed version. /// WinOpen is transformed to win-open. pub fn to_dash_name(name: &str) -> String { let mut result = String::new(); for (index, character) in name.chars().enumerate() { let string...
{ let mut chars = string.chars(); let string = match chars.next() { None => String::new(), Some(first) => first.to_uppercase().collect::<String>() + chars.as_str(), }; let mut camel = String::new(); let mut underscore = false; for character in string.chars() {...
identifier_body
string.rs
/* * Copyright (c) 2016 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy,...
(name: &str) -> String { let mut result = String::new(); for (index, character) in name.chars().enumerate() { let string: String = character.to_lowercase().collect(); if character.is_uppercase() && index > 0 { result.push('-'); } result.push_str(&string); } re...
to_dash_name
identifier_name
selectors.ts
import { createSelector } from 'reselect'; import { tKeys } from 'services/i18n'; import { getSelectValuesToLabelsMap } from 'shared/helpers'; import { ISelectOption } from 'shared/types/form'; import { IUsersSearchFilters } from 'shared/types/githubSearch'; import { IUsersSearchFormProps } from './UsersSearchForm'; ...
export const selectOptions = createSelector( (props: IUsersSearchFormProps) => props.t, (t): OptionType[] => ([ { value: 'username-email', label: t(intl.usernameAndEmail) }, { value: 'login', label: t(intl.username) }, { value: 'email', label: t(intl.email) }, { value: 'fullname', label: t(intl.ful...
random_line_split
Carousel.js
/** * @author */ imports("Controls.Composite.Carousel"); using("System.Fx.Marquee"); var Carousel = Control.extend({ onChange: function (e) { var ul = this.find('.x-carousel-header'), t; if (t = ul.first(e.from)) t.removeClass('x-carousel-header-selected'); if(t = ul.first(e.to)) ...
me.marquee.start(); } }).defineMethods("marquee", "moveTo moveBy start stop");
me.marquee.moveTo(this.index()); }); me.onChange({to: 0});
random_line_split
error_plot.py
import numpy as np import matplotlib.pyplot as plt __all__ = ('error_plot',) def error_plot(network, logx=False, ax=None, show=True): """ Makes line plot that shows training progress. x-axis is an epoch number and y-axis is an error. Parameters ---------- logx : bool Parameter set up lo...
the plot. Defaults to ``True``. Returns ------- object Matplotlib axis instance. """ if ax is None: ax = plt.gca() if not network.errors: network.logs.warning("There is no data to plot") return ax train_errors = network.errors.normalized() vali...
Defaults to ``None``. show : bool If parameter is equal to ``True`` plot will instantly shows
random_line_split
error_plot.py
import numpy as np import matplotlib.pyplot as plt __all__ = ('error_plot',) def error_plot(network, logx=False, ax=None, show=True): """ Makes line plot that shows training progress. x-axis is an epoch number and y-axis is an error. Parameters ---------- logx : bool Parameter set up lo...
train_errors = network.errors.normalized() validation_errors = network.validation_errors.normalized() if len(train_errors) != len(validation_errors): network.logs.warning("Number of train and validation errors are " "not the same. Ignored validation errors.") ...
network.logs.warning("There is no data to plot") return ax
conditional_block
error_plot.py
import numpy as np import matplotlib.pyplot as plt __all__ = ('error_plot',) def error_plot(network, logx=False, ax=None, show=True):
""" if ax is None: ax = plt.gca() if not network.errors: network.logs.warning("There is no data to plot") return ax train_errors = network.errors.normalized() validation_errors = network.validation_errors.normalized() if len(train_errors) != len(validation_errors): ...
""" Makes line plot that shows training progress. x-axis is an epoch number and y-axis is an error. Parameters ---------- logx : bool Parameter set up logarithmic scale to x-axis. Defaults to ``False``. ax : object or None Matplotlib axis object. ``None`` values means that a...
identifier_body
error_plot.py
import numpy as np import matplotlib.pyplot as plt __all__ = ('error_plot',) def
(network, logx=False, ax=None, show=True): """ Makes line plot that shows training progress. x-axis is an epoch number and y-axis is an error. Parameters ---------- logx : bool Parameter set up logarithmic scale to x-axis. Defaults to ``False``. ax : object or None Matpl...
error_plot
identifier_name
histogram.rs
/* * Copyright (C) 2013 The Android Open Source Project * * 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 app...
return gClear; }
return 0xff; }
random_line_split
urls.py
"""litchi URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views
Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.url...
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
random_line_split
project-fn-ret-contravariant.rs
#![feature(unboxed_closures)] #![feature(rustc_attrs)] // Test for projection cache. We should be able to project distinct // lifetimes from `foo` as we reinstantiate it multiple times, but not // if we do it just once. In this variant, the region `'a` is used in // an contravariant position, which affects the results...
<T>(t: T, x: T::Output) -> T::Output where T: FnOnce<()> { t() } #[cfg(ok)] // two instantiations: OK fn baz<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { let a = bar(foo, x); let b = bar(foo, y); (a, b) } #[cfg(oneuse)] // one instantiation: OK (surprisingly) fn baz<'a,'b>(x: &'a u32, y:...
bar
identifier_name
project-fn-ret-contravariant.rs
#![feature(unboxed_closures)] #![feature(rustc_attrs)] // Test for projection cache. We should be able to project distinct // lifetimes from `foo` as we reinstantiate it multiple times, but not // if we do it just once. In this variant, the region `'a` is used in // an contravariant position, which affects the results...
#[cfg(transmute)] // one instantiations: BAD fn baz<'a,'b>(x: &'a u32) -> &'static u32 { bar(foo, x) //[transmute]~ ERROR E0759 } #[cfg(krisskross)] // two instantiations, mixing and matching: BAD fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { let a = bar(foo, y); let b = bar(foo, x); ...
(a, b) }
random_line_split
project-fn-ret-contravariant.rs
#![feature(unboxed_closures)] #![feature(rustc_attrs)] // Test for projection cache. We should be able to project distinct // lifetimes from `foo` as we reinstantiate it multiple times, but not // if we do it just once. In this variant, the region `'a` is used in // an contravariant position, which affects the results...
#[cfg(oneuse)] // one instantiation: OK (surprisingly) fn baz<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { let f /* : fn() -> &'static u32 */ = foo; // <-- inferred type annotated let a = bar(f, x); // this is considered ok because fn args are contravariant... let b = bar(f, y); // ...and hence ...
{ let a = bar(foo, x); let b = bar(foo, y); (a, b) }
identifier_body
datacatalog_entry_factory.py
#!/usr/bin/python # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
(date_value): if pd.notnull(date_value): return int(date_value.timestamp()) @staticmethod def __convert_source_system_timestamp_fields(raw_create_time, raw_update_time): create_time = DataCatalogEntryFactory. \ __convert_d...
__convert_date_value_to_epoch
identifier_name
datacatalog_entry_factory.py
#!/usr/bin/python # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
else: table_type = self.__metadata_definition['table_def']['type'] entry.user_specified_type = table_type entry.user_specified_system = self.__entry_group_id entry.display_name = self._format_display_name(table['name']) entry.name = datacatalog.DataCatalogClient....
table_type = table_type.lower()
conditional_block
datacatalog_entry_factory.py
#!/usr/bin/python # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
if not pd.isnull(raw_update_time): update_time = DataCatalogEntryFactory. \ __convert_date_value_to_epoch(raw_update_time) else: update_time = create_time return create_time, update_time @staticmethod def __format_entry_column_type(source_name): ...
raw_update_time): create_time = DataCatalogEntryFactory. \ __convert_date_value_to_epoch(raw_create_time)
random_line_split
datacatalog_entry_factory.py
#!/usr/bin/python # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
def make_entries_for_table_container(self, table_container): """Create Datacatalog entries from a table container dict. :param table_container: :return: entry_id, entry """ entry_id = self._format_id(table_container['name']) entry = datacatalog.Entry() ...
self.__project_id = project_id self.__location_id = location_id self.__entry_resource_url_prefix = entry_resource_url_prefix self.__entry_group_id = entry_group_id self.__metadata_definition = metadata_definition
identifier_body
html.py
""" Configuration parameters: path.internal.ansi2html """ import sys import os import re from subprocess import Popen, PIPE MYDIR = os.path.abspath(os.path.join(__file__, '..', '..')) sys.path.append("%s/lib/" % MYDIR) # pylint: disable=wrong-import-position from config import CONFIG from globals import error ...
(query, result, editable, repository_button, topics_list, request_options): def _html_wrapper(data): """ Convert ANSI text `data` to HTML """ cmd = ["bash", CONFIG['path.internal.ansi2html'], "--palette=solarized", "--bg=dark"] try: proc = Popen(cmd, stdin=PIPE, ...
_render_html
identifier_name
html.py
""" Configuration parameters: path.internal.ansi2html """ import sys import os import re from subprocess import Popen, PIPE MYDIR = os.path.abspath(os.path.join(__file__, '..', '..')) sys.path.append("%s/lib/" % MYDIR) # pylint: disable=wrong-import-position from config import CONFIG from globals import error ...
result = result + "\n$" result = _html_wrapper(result) title = "<title>cheat.sh/%s</title>" % query submit_button = ('<input type="submit" style="position: absolute;' ' left: -9999px; width: 1px; height: 1px;" tabindex="-1" />') topic_list = ('<datalist id="topics">%s</datali...
""" Convert ANSI text `data` to HTML """ cmd = ["bash", CONFIG['path.internal.ansi2html'], "--palette=solarized", "--bg=dark"] try: proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) except FileNotFoundError: print("ERROR: %s" % cmd) raise...
identifier_body
html.py
"""
Configuration parameters: path.internal.ansi2html """ import sys import os import re from subprocess import Popen, PIPE MYDIR = os.path.abspath(os.path.join(__file__, '..', '..')) sys.path.append("%s/lib/" % MYDIR) # pylint: disable=wrong-import-position from config import CONFIG from globals import error from ...
random_line_split
html.py
""" Configuration parameters: path.internal.ansi2html """ import sys import os import re from subprocess import Popen, PIPE MYDIR = os.path.abspath(os.path.join(__file__, '..', '..')) sys.path.append("%s/lib/" % MYDIR) # pylint: disable=wrong-import-position from config import CONFIG from globals import error ...
return result
result = result.replace('</body>', TWITTER_BUTTON \ + GITHUB_BUTTON \ + repository_button \ + GITHUB_BUTTON_FOOTER \ + '</body>')
conditional_block
client.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import uuid import socket import time __appname__ = "pymessage" __author__ = "Marco Sirabella, Owen Davies" __copyright__ = "" __credits__ = "Marco Sirabella, Owen Davies" __license__ = "new BSD 3-Clause" __version__ = "0.0.3" __maintainers__ = "Ma...
connect()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(address) sock.send((hex(uuid.getnode()) + '\n').encode() + bytes(False)) # ik this is such BAD CODE print("sent") sock.send(lguid.encode()) print('sent latest guid: {}'.format(lguid)) # contents = "latest guid +5: {}".format(...
identifier_body
client.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import uuid import socket import time __appname__ = "pymessage" __author__ = "Marco Sirabella, Owen Davies" __copyright__ = "" __credits__ = "Marco Sirabella, Owen Davies" __license__ = "new BSD 3-Clause" __version__ = "0.0.3" __maintainers__ = "Ma...
print('sent latest guid: {}'.format(lguid)) # contents = "latest guid +5: {}".format(lguid + '5') msg = True fullmsg = '' while msg: msg = sock.recv(16).decode() # low byte count for whatever reason #print('mes rec: {}'.format(msg)) fullmsg += msg print('received message...
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(address) sock.send((hex(uuid.getnode()) + '\n').encode() + bytes(False)) # ik this is such BAD CODE print("sent") sock.send(lguid.encode())
random_line_split
client.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import uuid import socket import time __appname__ = "pymessage" __author__ = "Marco Sirabella, Owen Davies" __copyright__ = "" __credits__ = "Marco Sirabella, Owen Davies" __license__ = "new BSD 3-Clause" __version__ = "0.0.3" __maintainers__ = "Ma...
(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(address) sock.send((hex(uuid.getnode()) + '\n').encode() + bytes(False)) # ik this is such BAD CODE print("sent") sock.send(lguid.encode()) print('sent latest guid: {}'.format(lguid)) # contents = "latest guid +5: {}"...
connect
identifier_name
client.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import uuid import socket import time __appname__ = "pymessage" __author__ = "Marco Sirabella, Owen Davies" __copyright__ = "" __credits__ = "Marco Sirabella, Owen Davies" __license__ = "new BSD 3-Clause" __version__ = "0.0.3" __maintainers__ = "Ma...
print('received message: {}'.format(fullmsg)) sock.close() connect()
msg = sock.recv(16).decode() # low byte count for whatever reason #print('mes rec: {}'.format(msg)) fullmsg += msg
conditional_block