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
bundle.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex...
// USE THIS TO CLEAR LOCAL STORAGE // window.localStorage.clear(); //THIS SAVES CRAP TO LOCAL STORAGE. var json = JSON.stringify(data); localStorage.setItem('task'+count, json); var fs = require('fs'); fs.writeFile('data2.json', json, 'utf8', callback); // looping just to see whats in storage /...
random_line_split
messageevent.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/. */ use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::MessageEve...
(&self, _cx: *mut JSContext) -> JSVal { self.data.get() } // https://html.spec.whatwg.org/multipage/#dom-messageevent-origin fn Origin(&self) -> DOMString { self.origin.clone() } // https://html.spec.whatwg.org/multipage/#dom-messageevent-lasteventid fn LastEventId(&self) -> DO...
Data
identifier_name
messageevent.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/. */ use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::MessageEve...
// https://html.spec.whatwg.org/multipage/#dom-messageevent-origin fn Origin(&self) -> DOMString { self.origin.clone() } // https://html.spec.whatwg.org/multipage/#dom-messageevent-lasteventid fn LastEventId(&self) -> DOMString { self.lastEventId.clone() } }
}
random_line_split
FileDetail.js
/** * Wheel, copyright (c) 2019 - present by Arno van der Vegt * Distributed under an MIT license: https://arnovandervegt.github.io/wheel/license.txt **/ const File = require('./File'); exports.FileDetail = class extends File.File { constructor(opts) { opts.className = 'file detail'; super(opts);...
let i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; } };
{ return '0 Byte'; }
conditional_block
FileDetail.js
/** * Wheel, copyright (c) 2019 - present by Arno van der Vegt * Distributed under an MIT license: https://arnovandervegt.github.io/wheel/license.txt **/ const File = require('./File'); exports.FileDetail = class extends File.File { constructor(opts)
initDOM(parentNode) { let file = this._file; this.create( parentNode, { id: this.setElement.bind(this), className: this._className, children: [ File.getIcon(this._getImage, file), ...
{ opts.className = 'file detail'; super(opts); }
identifier_body
FileDetail.js
/** * Wheel, copyright (c) 2019 - present by Arno van der Vegt * Distributed under an MIT license: https://arnovandervegt.github.io/wheel/license.txt **/ const File = require('./File'); exports.FileDetail = class extends File.File { constructor(opts) { opts.className = 'file detail'; super(opts);...
(bytes) { const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; if (parseInt(bytes, 10) === 0) { return '0 Byte'; } let i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; } };
bytesToSize
identifier_name
unsound_collection_transmute.rs
use super::utils::is_layout_incompatible; use super::UNSOUND_COLLECTION_TRANSMUTE; use clippy_utils::diagnostics::span_lint; use clippy_utils::match_any_diagnostic_items; use rustc_hir::Expr; use rustc_lint::LateContext; use rustc_middle::ty::{self, Ty}; use rustc_span::symbol::{sym, Symbol}; // used to check for UNSO...
true } else { false } }, _ => false, } }
{ match (&from_ty.kind(), &to_ty.kind()) { (ty::Adt(from_adt, from_substs), ty::Adt(to_adt, to_substs)) => { if from_adt.did != to_adt.did || match_any_diagnostic_items(cx, to_adt.did, COLLECTIONS).is_none() { return false; } if from_substs ...
identifier_body
unsound_collection_transmute.rs
use super::utils::is_layout_incompatible; use super::UNSOUND_COLLECTION_TRANSMUTE; use clippy_utils::diagnostics::span_lint; use clippy_utils::match_any_diagnostic_items; use rustc_hir::Expr; use rustc_lint::LateContext; use rustc_middle::ty::{self, Ty}; use rustc_span::symbol::{sym, Symbol}; // used to check for UNSO...
.zip(to_substs.types()) .any(|(from_ty, to_ty)| is_layout_incompatible(cx, from_ty, to_ty)) { span_lint( cx, UNSOUND_COLLECTION_TRANSMUTE, e.span, &format!( ...
if from_substs .types()
random_line_split
unsound_collection_transmute.rs
use super::utils::is_layout_incompatible; use super::UNSOUND_COLLECTION_TRANSMUTE; use clippy_utils::diagnostics::span_lint; use clippy_utils::match_any_diagnostic_items; use rustc_hir::Expr; use rustc_lint::LateContext; use rustc_middle::ty::{self, Ty}; use rustc_span::symbol::{sym, Symbol}; // used to check for UNSO...
<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, from_ty: Ty<'tcx>, to_ty: Ty<'tcx>) -> bool { match (&from_ty.kind(), &to_ty.kind()) { (ty::Adt(from_adt, from_substs), ty::Adt(to_adt, to_substs)) => { if from_adt.did != to_adt.did || match_any_diagnostic_items(cx, to_adt.did, COLLECTIONS).is_n...
check
identifier_name
libbuild.rs
#[allow(dead_code)] const VERSION_ENVVAR: &'static str = "PLAN_VERSION"; #[allow(dead_code)] mod builder { use std::env; use std::process::Command; use super::VERSION_ENVVAR; pub fn common() { super::version::write_file(version()); } pub fn version() -> String { match env::va...
.expect("Failed to read line from version file"); ver } } #[allow(dead_code)] mod util { use std::env; use std::fs::File; use std::io::Write; use std::path::Path; pub fn write_out_dir_file<P, S>(filename: P, content: S) where P: AsRef<Path>, S: AsRef<str...
let f = File::open(ver_file).expect("Failed to open version file"); let mut reader = BufReader::new(f); let mut ver = String::new(); reader .read_line(&mut ver)
random_line_split
libbuild.rs
#[allow(dead_code)] const VERSION_ENVVAR: &'static str = "PLAN_VERSION"; #[allow(dead_code)] mod builder { use std::env; use std::process::Command; use super::VERSION_ENVVAR; pub fn common() { super::version::write_file(version()); } pub fn version() -> String { match env::va...
}
{ super::util::write_out_dir_file("VERSION", version); }
identifier_body
libbuild.rs
#[allow(dead_code)] const VERSION_ENVVAR: &'static str = "PLAN_VERSION"; #[allow(dead_code)] mod builder { use std::env; use std::process::Command; use super::VERSION_ENVVAR; pub fn common() { super::version::write_file(version()); } pub fn version() -> String { match env::va...
<S: AsRef<str>>(version: S) { super::util::write_out_dir_file("VERSION", version); } }
write_file
identifier_name
setup.py
#!/usr/bin/env python from setuptools import setup from setuptools.command.sdist import sdist as _sdist import re import sys import time import codecs import subprocess if sys.version < "2.2.3": from distutils.dist import DistributionMetadata DistributionMetadata.classifiers = None DistributionMetadata.dow...
# Run parent constructor _sdist.run(self) # Get the long description from the relevant file try: f = codecs.open('README.rst', encoding='utf-8') long_description = f.read() f.close() except: long_description = '' testing_requires = ["mock"] setup( name="pyrax", version=version...
spec_in.close() spec.close()
random_line_split
setup.py
#!/usr/bin/env python from setuptools import setup from setuptools.command.sdist import sdist as _sdist import re import sys import time import codecs import subprocess if sys.version < "2.2.3": from distutils.dist import DistributionMetadata DistributionMetadata.classifiers = None DistributionMetadata.dow...
spec_in.close() spec.close() # Run parent constructor _sdist.run(self) # Get the long description from the relevant file try: f = codecs.open('README.rst', encoding='utf-8') long_description = f.read() f.close() except: long_description = '' testing_requires = ["mock"...
if "@VERSION@" in line: line = line.replace("@VERSION@", version) elif "@RELEASE@" in line: # If development release, include date+githash in %{release} if release.startswith('0'): release += '.' + git_release line = line.re...
conditional_block
setup.py
#!/usr/bin/env python from setuptools import setup from setuptools.command.sdist import sdist as _sdist import re import sys import time import codecs import subprocess if sys.version < "2.2.3": from distutils.dist import DistributionMetadata DistributionMetadata.classifiers = None DistributionMetadata.dow...
line = line.replace("@RELEASE@", release) spec.write(line) spec_in.close() spec.close() # Run parent constructor _sdist.run(self) # Get the long description from the relevant file try: f = codecs.open('README.rst', encoding='utf-8') long_description...
global version global release # Create a development release string for later use git_head = subprocess.Popen("git log -1 --pretty=format:%h", shell=True, stdout=subprocess.PIPE).communicate()[0].strip() date = time...
identifier_body
setup.py
#!/usr/bin/env python from setuptools import setup from setuptools.command.sdist import sdist as _sdist import re import sys import time import codecs import subprocess if sys.version < "2.2.3": from distutils.dist import DistributionMetadata DistributionMetadata.classifiers = None DistributionMetadata.dow...
(self): global version global release # Create a development release string for later use git_head = subprocess.Popen("git log -1 --pretty=format:%h", shell=True, stdout=subprocess.PIPE).communicate()[0].strip() ...
run
identifier_name
varlink_grammar.rs
pub use grammar::*; peg::parser! { grammar grammar() for str { /* Modeled after ECMA-262, 5th ed., 7.2. */ rule whitespace() -> &'input str = quiet!{$([' ' | '\t' | '\u{00A0}' | '\u{FEFF}' | '\u{1680}' | '\u{180E}' | '\u{2000}'..='\u{200A}' | '\u{202F}' | '\u{205F}' | '\u{3000}' ])} ...
use crate::trim_doc; rule vtypedef() -> Typedef<'input> = d:$(wce()*) "type" wce()+ n:$(name()) wce()* v:vstruct() { Typedef{name: n, doc: trim_doc(d), elt: VStructOrEnum::VStruct(Box::new(v))} } / d:$(wce()*) "type" wce()+ n:$(name()) wce()* v:venum(...
use crate::Typedef; use crate::VStructOrEnum;
random_line_split
hrtb-parse.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn foo11(t: Box<for<'a> Get(int) -> int>) { } fn foo20(t: for<'a> fn(int) -> int) { } fn foo21(t: for<'a> unsafe fn(int) -> int) { } fn foo22(t: for<'a> extern "C" fn(int) -> int) { } fn foo23(t: for<'a> unsafe extern "C" fn(int) -> int) { } fn foo30(t: for<'a> |int| -> int) { } fn foo31(t: for<'a> unsafe |int| -> i...
{ }
identifier_body
hrtb-parse.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<T: for<'a> Get<&'a int, &'a int>>(t: T) { } // Parse HRTB with explicit `for` in various sorts of types: fn foo10(t: Box<for<'a> Get<int, int>>) { } fn foo11(t: Box<for<'a> Get(int) -> int>) { } fn foo20(t: for<'a> fn(int) -> int) { } fn foo21(t: for<'a> unsafe fn(int) -> int) { } fn foo22(t: for<'a> extern "C" fn(...
foo01
identifier_name
hrtb-parse.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn foo00<T>(t: T) where T : for<'a> Get<&'a int, &'a int> { } fn foo01<T: for<'a> Get<&'a int, &'a int>>(t: T) { } // Parse HRTB with explicit `for` in various sorts of types: fn foo10(t: Box<for<'a> Get<int, int>>) { } fn foo11(t: Box<for<'a> Get(int) -> int>) { } fn foo20(t: for<'a> fn(int) -> int) { } fn fo...
trait Get<A,R> { fn get(&self, arg: A) -> R; } // Parse HRTB with explicit `for` in a where-clause:
random_line_split
stateconfig_test.js
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
let resource = jasmine.createSpyObj('$resource', ['get']); resource.get.and.callFake(function() { return {$promise: promise}; }); let actual = resolveResource(resource, {namespace: 'foo-ns'}, kdDataSelectService); expect(resource.get) .toHaveBeenCalledWith(kdDataSelectService.getDefa...
random_line_split
logger.rs
// Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use crate::PythonLogLevel; use std::collections::HashMap; use std::convert::TryInto; use std::fmt::Write as FmtWrite; use std::fs::{File, OpenOptions}; use std::io::Write; use std::path:...
(&self) {} }
flush
identifier_name
logger.rs
// Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use crate::PythonLogLevel; use std::collections::HashMap; use std::convert::TryInto; use std::fmt::Write as FmtWrite; use std::fs::{File, OpenOptions}; use std::io::Write; use std::path:...
// Attempt to write to stdio, and write to the pantsd log if we fail (either because we don't // have a valid stdio instance, or because of an error). if destination.write_stderr_raw(log_bytes).is_err() { let mut maybe_file = inner.log_file.lock(); if let Some(ref mut file) = *maybe_file { ...
}
random_line_split
logger.rs
// Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use crate::PythonLogLevel; use std::collections::HashMap; use std::convert::TryInto; use std::fmt::Write as FmtWrite; use std::fs::{File, OpenOptions}; use std::io::Write; use std::path:...
; writeln!(log_string, " {}", log_msg).unwrap(); log_string }; let log_bytes = log_string.as_bytes(); { let mut maybe_per_run_file = inner.per_run_logs.lock(); if let Some(ref mut file) = *maybe_per_run_file { // deliberately ignore errors writing to per-run log file ...
{ write!(log_string, " ({})", record.target()).unwrap(); }
conditional_block
responsiveFontSizes.test.js
import { expect } from 'chai'; import { createTheme } from '@mui/material/styles'; import defaultTheme from './defaultTheme'; import responsiveFontSizes from './responsiveFontSizes'; describe('responsiveFontSizes', () => { it('should support unitless line height', () => { const defaultVariant = { fontFamil...
...defaultVariant, fontSize: '3.5rem', [`@media (min-width:${defaultTheme.breakpoints.values.sm}px)`]: { fontSize: '4.75rem' }, [`@media (min-width:${defaultTheme.breakpoints.values.md}px)`]: { fontSize: '5.5rem' }, [`@media (min-width:${defaultTheme.breakpoints.values.lg}px)`]: { ...
expect(typography.h1).to.deep.equal({
random_line_split
deployed_stateful_service_replica_info.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
ChangeRole. :type address: str :param service_package_activation_id: :type service_package_activation_id: str :param ServiceKind: Polymorphic Discriminator :type ServiceKind: str :param replica_id: Id of the stateful service replica. :type replica_id: str :param replica_role: Possib...
"""Information about a stateful service replica deployed on a node. :param service_name: Full hierarchical name of the service in URI format starting with `fabric:`. :type service_name: str :param service_type_name: Name of the service type as specified in the service manifest. :type service_...
identifier_body
deployed_stateful_service_replica_info.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
(DeployedServiceReplicaInfo): """Information about a stateful service replica deployed on a node. :param service_name: Full hierarchical name of the service in URI format starting with `fabric:`. :type service_name: str :param service_type_name: Name of the service type as specified in the se...
DeployedStatefulServiceReplicaInfo
identifier_name
deployed_stateful_service_replica_info.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
:type service_name: str :param service_type_name: Name of the service type as specified in the service manifest. :type service_type_name: str :param service_manifest_name: The name of the service manifest in which this service type is defined. :type service_manifest_name: str :param co...
random_line_split
0010_forcefield_techs.py
from __future__ import unicode_literals from django.db import migrations def initial_data(apps, schema_editor): TC = apps.get_model('tech', 'TechCategory') T = apps.get_model('tech', 'Tech') tc = TC(name='Advanced Magnetism', cost=250, category='FF') tc.save() T(name='Class I Shield', categ=tc, ...
(migrations.Migration): dependencies = [ ('tech', '0009_physics_t
Migration
identifier_name
0010_forcefield_techs.py
from __future__ import unicode_literals from django.db import migrations def initial_data(apps, schema_editor): TC = apps.get_model('tech', 'TechCategory') T = apps.get_model('tech', 'Tech') tc = TC(name='Advanced Magnetism', cost=250, category='FF') tc.save()
T(name='Mass Driver', categ=tc, desc="""A rail gun firing a hyper-velocity projectile. Inflicts 6 points of damage. Damage is not reduced by range. Modifications: autofire, armor piercing, heavy mount, point defense.""").save() T(name='ECM Jammer', categ=tc, desc="""Creates a magnetic pulse jamming both weapon ...
T(name='Class I Shield', categ=tc, desc="""Protects ships from physical and energy attacks. Absorbs up to 5 times the ship's size in damage before failing, with each attack reduced by 1 points of damage. Regenerates 30% per combat turn.""").save()
random_line_split
0010_forcefield_techs.py
from __future__ import unicode_literals from django.db import migrations def initial_data(apps, schema_editor):
tc = TC(name='Electromagnetic Refraction', cost=1500, category='FF') tc.save() T(name='Stealth Field', categ=tc, desc="""Reduces the gravitic emissions from FTL drives. Ships equipped with stealth fields can not be detected at any range on the main screen.""").save() T(name='Personal Shield', categ=tc,...
TC = apps.get_model('tech', 'TechCategory') T = apps.get_model('tech', 'Tech') tc = TC(name='Advanced Magnetism', cost=250, category='FF') tc.save() T(name='Class I Shield', categ=tc, desc="""Protects ships from physical and energy attacks. Absorbs up to 5 times the ship's size in damage before failing...
identifier_body
ActionsCell.test.tsx
/* * Copyright (C) 2020 Graylog, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the Server Side Public License, version 1, * as published by MongoDB, Inc. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; withou...
}, })); describe('ActionsCell', () => { afterEach(() => { jest.clearAllMocks(); }); const customRoleName = 'custom-role-name'; const customRoleId = 'custom-role-id'; const currentUser = viewsManager; const renderSUT = ({ permissions, readOnly, roleName, roleId }) => ( <CurrentUserContext.Provide...
loadUsersForRole: jest.fn(() => mockLoadUsersPromise),
random_line_split
fix_kwargs.py
u""" Fixer for Python 3 function parameter syntax This fixer is rather sensitive to incorrect py3k syntax. """ # Note: "relevant" parameters are parameters following the first STAR in the list. from lib2to3 import fixer_base from lib2to3.fixer_util import token, String, Newline, Comma, Name from libfuturize.fixer_uti...
elif t.type == token.NAME and not found_kwargs: # Keyword-only argument: definitely need to fix. needs_fix = True elif t.type == token.NAME and found_kwargs: # Return 'foobar' of **foobar, if needed. return t.value if needs_fix else u'' elif t.typ...
continue
conditional_block
fix_kwargs.py
u""" Fixer for Python 3 function parameter syntax This fixer is rather sensitive to incorrect py3k syntax. """ # Note: "relevant" parameters are parameters following the first STAR in the list. from lib2to3 import fixer_base from lib2to3.fixer_util import token, String, Newline, Comma, Name from libfuturize.fixer_uti...
else: default_value = None yield (name, default_value) curr_idx += 1 def remove_params(raw_params, kwargs_default=_kwargs_default_name): u""" Removes all keyword-only args from the params list and a bare star, if any. Does not add the kwargs dict if needed. Returns...
u""" Generator that yields tuples of (name, default_value) for each parameter in the list If no default is given, then it is default_value is None (not Leaf(token.NAME, 'None')) """ assert raw_params[0].type == token.STAR and len(raw_params) > 2 curr_idx = 2 # the first place a keyword-only paramet...
identifier_body
fix_kwargs.py
u""" Fixer for Python 3 function parameter syntax This fixer is rather sensitive to incorrect py3k syntax. """ # Note: "relevant" parameters are parameters following the first STAR in the list. from lib2to3 import fixer_base from lib2to3.fixer_util import token, String, Newline, Comma, Name from libfuturize.fixer_uti...
(raw_params): u""" Generator that yields tuples of (name, default_value) for each parameter in the list If no default is given, then it is default_value is None (not Leaf(token.NAME, 'None')) """ assert raw_params[0].type == token.STAR and len(raw_params) > 2 curr_idx = 2 # the first place a ke...
gen_params
identifier_name
fix_kwargs.py
u""" Fixer for Python 3 function parameter syntax This fixer is rather sensitive to incorrect py3k syntax. """ # Note: "relevant" parameters are parameters following the first STAR in the list. from lib2to3 import fixer_base from lib2to3.fixer_util import token, String, Newline, Comma, Name from libfuturize.fixer_uti...
u""" Returns string with the name of the kwargs dict if the params after the first star need fixing Otherwise returns empty string """ found_kwargs = False needs_fix = False for t in raw_params[2:]: if t.type == token.COMMA: # Commas are irrelevant at this stage. ...
random_line_split
core.py
# -*- coding: utf-8 -*- # # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # 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 # # Unl...
""Decrypts a cypher text using the decryption key 'dkey', working modulo n""" if type(cyphertext) not in (types.IntType, types.LongType): raise TypeError('cyphertext should be an integer, not %s' % cyphertext.__type__) assert_int(cyphertext, 'cyphertext') assert_int(dkey, 'dkey...
identifier_body
core.py
# -*- coding: utf-8 -*- # # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # 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 # # Unl...
assert_int(n, 'n') if message < 0: raise ValueError('Only non-negative numbers are supported') if message > n: raise OverflowError("The message %i is too long for n=%i" % (message, n)) return pow(message, ekey, n) def decrypt_int(cyphertext, dkey, n): """Decrypts a cypher text us...
random_line_split
core.py
# -*- coding: utf-8 -*- # # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # 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 # # Unl...
raise TypeError('%s should be an integer, not %s' % (name, var.__class__)) def encrypt_int(message, ekey, n): """Encrypts a message using encryption key 'ekey', working modulo n""" assert_int(message, 'message') assert_int(ekey, 'ekey') assert_int(n, 'n') if message < 0: raise ValueE...
eturn
conditional_block
core.py
# -*- coding: utf-8 -*- # # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # 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 # # Unl...
cyphertext, dkey, n): """Decrypts a cypher text using the decryption key 'dkey', working modulo n""" if type(cyphertext) not in (types.IntType, types.LongType): raise TypeError('cyphertext should be an integer, not %s' % cyphertext.__type__) assert_int(cyphertext, 'cyphertext')...
ecrypt_int(
identifier_name
colorHelper.ts
/* * Power BI Visualizations * * Copyright (c) Microsoft Corporation * All rights reserved. * MIT License * * 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 restrict...
} }
{ debug.assertAnyValue(selector, 'selector'); // For dynamic series charts, colors are set per category. So, exclude any measure (metadata repetition) from the selector. if (selector && (isSingleSeries || selector.data)) return { data: selector.data }; ...
identifier_body
colorHelper.ts
/* * Power BI Visualizations * * Copyright (c) Microsoft Corporation * All rights reserved. * MIT License * * 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 restrict...
(selector: data.Selector, isSingleSeries?: boolean): data.Selector { debug.assertAnyValue(selector, 'selector'); // For dynamic series charts, colors are set per category. So, exclude any measure (metadata repetition) from the selector. if (selector && (isSingleSeries || selector.d...
normalizeSelector
identifier_name
colorHelper.ts
/* * Power BI Visualizations * * Copyright (c) Microsoft Corporation * All rights reserved. * MIT License * * 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 restrict...
return (this.fillProp && DataViewObjects.getFillColor(objects, this.fillProp)) || this.defaultDataPointColor || scaleColor; } public static normalizeSelector(selector: data.Selector, isSingleSeries?: boolean): data.Selector { debug.assertAnyValue...
* Gets the color for the given measure. */ public getColorForMeasure(objects: DataViewObjects, measureKey: any): string { // Note, this allocates the color from the scale regardless of if we use it or not which helps keep colors stable. let scaleColor = this.defaultColo...
random_line_split
balancete.py
# !/usr/bin/env python3 # -*- encoding: utf-8 -*- """ ERP+ """ __author__ = 'António Anacleto' __credits__ = [] __version__ = "1.0" __maintainer__ = "António Anacleto" __status__ = "Development" __model_name__ = 'balancete.Balancete' import auth, base_models from orm import * from form import * try: from my_ano_fis...
#descendentes = {} #for conta in all_contas: # if conta['ascendente'] in descendentes: # descendentes[conta['ascendente']].append(conta['id']) # else: # descendentes[conta['ascendente']] = [conta['id']] #print(contas) movimentos = {} ...
s[conta['id']] = conta
conditional_block
balancete.py
# !/usr/bin/env python3 # -*- encoding: utf-8 -*- """ ERP+ """ __author__ = 'António Anacleto' __credits__ = [] __version__ = "1.0" __maintainer__ = "António Anacleto" __status__ = "Development" __model_name__ = 'balancete.Balancete' import auth, base_models from orm import * from form import * try: from my_ano_fis...
, key, window_id): #print('estou no imprimir do balancete') template = 'balancete' record = self.prepare_data() return Report(record=record, report_template=template).show() def Exportar(self, key, window_id): #print('estou na função de Exportar no balancete') result...
mir(self
identifier_name
balancete.py
# !/usr/bin/env python3 # -*- encoding: utf-8 -*- """ ERP+ """ __author__ = 'António Anacleto' __credits__ = [] __version__ = "1.0" __maintainer__ = "António Anacleto" __status__ = "Development" __model_name__ = 'balancete.Balancete' import auth, base_models from orm import * from form import * try: from my_ano_fis...
= self.prepare_data()['lines'] #print('result: ', result) return data_to_csv(data=result, model=self, text='Gravar', cols=['codigo', 'conta', 'debito', 'credito', 'saldo'])
identifier_body
balancete.py
# !/usr/bin/env python3 # -*- encoding: utf-8 -*- """ ERP+ """ __author__ = 'António Anacleto' __credits__ = [] __version__ = "1.0" __maintainer__ = "António Anacleto" __status__ = "Development" __model_name__ = 'balancete.Balancete' import auth, base_models from orm import * from form import * try: from my_ano_fis...
return Report(record=record, report_template=template).show() def Exportar(self, key, window_id): #print('estou na função de Exportar no balancete') result = self.prepare_data()['lines'] #print('result: ', result) return data_to_csv(data=result, model=self, text='Gravar', co...
template = 'balancete' record = self.prepare_data()
random_line_split
setup.py
from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from distutils import core from distutils.command.install import install import sys, os, subprocess def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() def git(*args): return subproce...
class install_all(install): def run(self): current_directory = subprocess.Popen(["pwd"],stdout=subprocess.PIPE) current_directory, err = current_directory.communicate() subprocess.call(["sh","depends.sh"]) subprocess.call(["pip install -r requirements.txt --no-clean"], shell=True) install.run(self)...
os.chdir(spidev_directory) subprocess.call(["insmod", "low-speed-spidev.ko"]) os.chdir("..")
random_line_split
setup.py
from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from distutils import core from distutils.command.install import install import sys, os, subprocess def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() def git(*args): return subproce...
(self): spidev_directory = subprocess.Popen(["pwd"],stdout=subprocess.PIPE) spidev_directory, err = spidev_directory.communicate() spidev_directory = spidev_directory.rstrip() + "/low_speed_spidev" os.chdir("/usr/src/kernel/") subprocess.call(["make", "scripts"]) subproc...
run
identifier_name
setup.py
from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from distutils import core from distutils.command.install import install import sys, os, subprocess def read(fname):
def git(*args): return subprocess.check_call(['git'] + list(args)) class low_speed_spidev(install): def run(self): spidev_directory = subprocess.Popen(["pwd"],stdout=subprocess.PIPE) spidev_directory, err = spidev_directory.communicate() spidev_directory = spidev_directory.rstrip() + "/...
return open(os.path.join(os.path.dirname(__file__), fname)).read()
identifier_body
instance.d.ts
/// <reference types="node" /> import * as fs from 'fs'; import * as ts from 'typescript'; import { Checker } from './checker'; import { CompilerInfo, LoaderConfig, TsConfig } from './interfaces'; export interface Instance { id: number; babelImpl?: any; compiledFiles: { [key: string]: boolean; }...
} export interface Compiler { inputFileSystem: typeof fs; _tsInstances: { [key: string]: Instance; }; options: { watch: boolean; }; } export interface Loader { _compiler: Compiler; cacheable: () => void; query: string; async: () => (err: Error, source?: string, map?: ...
loaderConfig: LoaderConfig; checker: Checker; cacheIdentifier: any; context: string;
random_line_split
mwlCalendarHourList.js
'use strict'; var angular = require('angular'); var calendarUtils = require('calendar-utils'); angular .module('mwl.calendar') .controller('MwlCalendarHourListCtrl', function($scope, $document, moment, calendarHelper) { var vm = this; // source: http://stackoverflow.com/questions/13382516/getting-scroll-...
}); }); } var originalLocale = moment.locale(); $scope.$on('calendar.refreshView', function() { if (originalLocale !== moment.locale()) { originalLocale = moment.locale(); updateDays(); } }); $scope.$watchGroup([ 'vm.dayViewStart', 'vm.da...
{ vm.cellModifier({calendarCell: segment}); }
conditional_block
mwlCalendarHourList.js
'use strict'; var angular = require('angular'); var calendarUtils = require('calendar-utils'); angular .module('mwl.calendar') .controller('MwlCalendarHourListCtrl', function($scope, $document, moment, calendarHelper) { var vm = this; // source: http://stackoverflow.com/questions/13382516/getting-scroll-...
() { vm.dayViewSplit = parseInt(vm.dayViewSplit); var dayStart = (vm.dayViewStart || '00:00').split(':'); var dayEnd = (vm.dayViewEnd || '23:59').split(':'); vm.hourGrid = calendarUtils.getDayViewHourGrid({ viewDate: vm.view === 'week' ? moment(vm.viewDate).startOf('week').toDate() : mo...
updateDays
identifier_name
mwlCalendarHourList.js
'use strict'; var angular = require('angular'); var calendarUtils = require('calendar-utils'); angular .module('mwl.calendar') .controller('MwlCalendarHourListCtrl', function($scope, $document, moment, calendarHelper) { var vm = this; // source: http://stackoverflow.com/questions/13382516/getting-scroll-...
outer.parentNode.removeChild(outer); return widthNoScroll - widthWithScroll; } vm.scrollBarWidth = getScrollbarWidth(); function updateDays() { vm.dayViewSplit = parseInt(vm.dayViewSplit); var dayStart = (vm.dayViewStart || '00:00').split(':'); var dayEnd = (vm.dayViewEnd ...
{ var outer = $document[0].createElement('div'); outer.style.visibility = 'hidden'; outer.style.width = '100px'; outer.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps $document[0].body.appendChild(outer); var widthNoScroll = outer.offsetWidth; // force scrollbar...
identifier_body
mwlCalendarHourList.js
'use strict'; var angular = require('angular'); var calendarUtils = require('calendar-utils'); angular .module('mwl.calendar') .controller('MwlCalendarHourListCtrl', function($scope, $document, moment, calendarHelper) { var vm = this; // source: http://stackoverflow.com/questions/13382516/getting-scroll-...
var widthNoScroll = outer.offsetWidth; // force scrollbars outer.style.overflow = 'scroll'; // add innerdiv var inner = $document[0].createElement('div'); inner.style.width = '100%'; outer.appendChild(inner); var widthWithScroll = inner.offsetWidth; // remove di...
outer.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps $document[0].body.appendChild(outer);
random_line_split
CleanerML.py
# vim: ts=4:sw=4:expandtab # BleachBit # Copyright (C) 2014 Andrew Ziem # http://bleachbit.sourceforge.net # # 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, either version 3 of the License, or ...
if os_str == 'windows' and sys.platform == 'win32': return True return False def handle_cleaner(self, cleaner): """<cleaner> element""" if not self.os_match(cleaner.getAttribute('os')): return self.cleaner.id = cleaner.getAttribute('id') self...
return True
conditional_block
CleanerML.py
# vim: ts=4:sw=4:expandtab # BleachBit # Copyright (C) 2014 Andrew Ziem # http://bleachbit.sourceforge.net # # 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, either version 3 of the License, or ...
(self, description): """<description> element under <cleaner>""" self.cleaner.description = _(getText(description.childNodes)) self.xlate_cb(self.cleaner.description) def handle_cleaner_running(self, running_elements): """<running> element under <cleaner>""" # example: <runn...
handle_cleaner_description
identifier_name
CleanerML.py
# vim: ts=4:sw=4:expandtab # BleachBit # Copyright (C) 2014 Andrew Ziem # http://bleachbit.sourceforge.net # # 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, either version 3 of the License, or ...
import os import sys import traceback import xml.dom.minidom import Cleaner import Common from Action import ActionProvider from Common import _ from General import boolstr_to_bool, getText from FileUtilities import listdir class CleanerML: """Create a cleaner from CleanerML""" def __init__(self, pathname,...
random_line_split
CleanerML.py
# vim: ts=4:sw=4:expandtab # BleachBit # Copyright (C) 2014 Andrew Ziem # http://bleachbit.sourceforge.net # # 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, either version 3 of the License, or ...
def handle_cleaner_description(self, description): """<description> element under <cleaner>""" self.cleaner.description = _(getText(description.childNodes)) self.xlate_cb(self.cleaner.description) def handle_cleaner_running(self, running_elements): """<running> element under <...
"""<label> element under <cleaner>""" self.cleaner.name = _(getText(label.childNodes)) translate = label.getAttribute('translate') if translate and boolstr_to_bool(translate): self.xlate_cb(self.cleaner.name)
identifier_body
tube-representation.ts
/** * @file Tube Representation * @author Alexander Rose <alexander.rose@weirdbyte.de> * @private */ import { RepresentationRegistry } from '../globals' import { defaults } from '../utils' import CartoonRepresentation, {CartoonRepresentationParameters} from './cartoon-representation' import { Structure } from '../...
getSplineParams (/* params */) { return super.getSplineParams({ directional: false }) } } RepresentationRegistry.add('tube', TubeRepresentation) export default TubeRepresentation
{ var p = params || {} p.aspectRatio = 1.0 p.radiusScale = defaults(p.radiusScale, 2.0) if (p.quality === 'low') { this.radialSegments = 5 } super.init(p) }
identifier_body
tube-representation.ts
/** * @file Tube Representation * @author Alexander Rose <alexander.rose@weirdbyte.de> * @private */ import { RepresentationRegistry } from '../globals' import { defaults } from '../utils' import CartoonRepresentation, {CartoonRepresentationParameters} from './cartoon-representation' import { Structure } from '../...
(params: Partial<CartoonRepresentationParameters>) { var p = params || {} p.aspectRatio = 1.0 p.radiusScale = defaults(p.radiusScale, 2.0) if (p.quality === 'low') { this.radialSegments = 5 } super.init(p) } getSplineParams (/* params */) { return super.getSplineParams({ ...
init
identifier_name
tube-representation.ts
/** * @file Tube Representation * @author Alexander Rose <alexander.rose@weirdbyte.de> * @private */ import { RepresentationRegistry } from '../globals' import { defaults } from '../utils' import CartoonRepresentation, {CartoonRepresentationParameters} from './cartoon-representation' import { Structure } from '../...
} init (params: Partial<CartoonRepresentationParameters>) { var p = params || {} p.aspectRatio = 1.0 p.radiusScale = defaults(p.radiusScale, 2.0) if (p.quality === 'low') { this.radialSegments = 5 } super.init(p) } getSplineParams (/* params */) { return super.getSplinePara...
this.type = 'tube' this.parameters = Object.assign( {}, this.parameters, { aspectRatio: null } )
random_line_split
tube-representation.ts
/** * @file Tube Representation * @author Alexander Rose <alexander.rose@weirdbyte.de> * @private */ import { RepresentationRegistry } from '../globals' import { defaults } from '../utils' import CartoonRepresentation, {CartoonRepresentationParameters} from './cartoon-representation' import { Structure } from '../...
super.init(p) } getSplineParams (/* params */) { return super.getSplineParams({ directional: false }) } } RepresentationRegistry.add('tube', TubeRepresentation) export default TubeRepresentation
{ this.radialSegments = 5 }
conditional_block
log.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Tuxemon # Copyright (C) 2014, William Edwards <shadowapex@gmail.com>, # Benjamin Bean <superman2k5@gmail.com> # # This file is part of Tuxemon. # # Tuxemon is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pu...
for logger_name in config.loggers: # Enable logging logger = logging.getLogger(logger_name) logger.setLevel(int(config.debug_level)) log_hdlr = logging.StreamHandler(sys.stdout) log_hdlr.setLevel(logging.DEBUG) log_hdlr.setFormatter(logging.Formatter("%(asctime)s - %(nam...
conditional_block
log.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Tuxemon # Copyright (C) 2014, William Edwards <shadowapex@gmail.com>, # Benjamin Bean <superman2k5@gmail.com> # # This file is part of Tuxemon. # # Tuxemon is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pu...
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Tuxemon. If not, see <http://www.gnu.org/licenses/>. # # Con...
# (at your option) any later version. # # Tuxemon is distributed in the hope that it will be useful,
random_line_split
lib.rs
// @Author: Cha Dowon <dowon> // @Date: 2016-11-20T11:01:12-05:00 // @Project: BeAM // @Filename: lib.rs // @Last modified by: dowon // @Last modified time: 2016-11-20T11:03:21-05:00 #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] #[macro_use] extern crate error_chain; extern crate log;...
// let color = shoot_ray(&state, ray); // scene.canvas().set_pixel(x, y, color); } // Increment future } } fn shoot_ray(state: &mut RenderState, ray: Ray) { // -> TColor { if state.recursion_level == 0 { // return black } { state.r...
{ // Precalculate bouding box transformations, etc let RenderPayload { scene, .. } = payload; // Iterate through each pixel let (width, height) = (512, 512); // let (width, height) = scene.canvas_dimensions(); // let (region_x, region_y) = scene.region_position(); ...
identifier_body
lib.rs
// @Author: Cha Dowon <dowon> // @Date: 2016-11-20T11:01:12-05:00 // @Project: BeAM // @Filename: lib.rs // @Last modified by: dowon // @Last modified time: 2016-11-20T11:03:21-05:00 #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] #[macro_use] extern crate error_chain; extern crate log;...
{ None, Uniform(i32), Random(i32) } pub struct RenderConfig { pub scene_name: &'static str, // Input scene dir pub output_name: &'static str, // Output file name pub width: u32, // Width of final image pub height: u32, // He...
SampleMode
identifier_name
lib.rs
// @Author: Cha Dowon <dowon> // @Date: 2016-11-20T11:01:12-05:00 // @Project: BeAM // @Filename: lib.rs // @Last modified by: dowon // @Last modified time: 2016-11-20T11:03:21-05:00 #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] #[macro_use] extern crate error_chain; extern crate log;...
{ state.recursion_level -= 1; } /* let intersection = { // let bvh = &state.bvh; // bvh.intersection(ray) }; if let Some(intersection) = intersection { // Found an intersection } */ // TColor::from_channels(0.0, 0.0, 0.0, ...
{ // return black }
conditional_block
lib.rs
// @Author: Cha Dowon <dowon> // @Date: 2016-11-20T11:01:12-05:00 // @Project: BeAM // @Filename: lib.rs // @Last modified by: dowon // @Last modified time: 2016-11-20T11:03:21-05:00 #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] #[macro_use] extern crate error_chain; extern crate log;...
} // Increment future } } fn shoot_ray(state: &mut RenderState, ray: Ray) { // -> TColor { if state.recursion_level == 0 { // return black } { state.recursion_level -= 1; } /* let intersection = { // let bvh = &state.bvh; /...
random_line_split
DetectColor.py
import os import serial import cv2 import time COTH = 130 while True: os.system('fswebcam /home/pi/1.jpg') color = cv2.imread('/home/pi/1.jpg') b,g,r =color[160][170] if (r >= COTH and g < COTH and b < COTH): print 'red' if (r < COTH and g >= COTH and b < COTH):
if (r < COTH and g < COTH and b >= COTH): print 'blue' if (r >= COTH and g >= COTH and b >= COTH): print 'white' if (r < COTH and g < COTH and b < COTH): print 'black' ser = serial.Serial('/dev/ttyAMA0',115200) ser.write('g') print color del(color) time.sleep(1)
print 'green'
conditional_block
DetectColor.py
import os import serial import cv2 import time COTH = 130
print 'red' if (r < COTH and g >= COTH and b < COTH): print 'green' if (r < COTH and g < COTH and b >= COTH): print 'blue' if (r >= COTH and g >= COTH and b >= COTH): print 'white' if (r < COTH and g < COTH and b < COTH): print 'black' ser = serial.Serial('/de...
while True: os.system('fswebcam /home/pi/1.jpg') color = cv2.imread('/home/pi/1.jpg') b,g,r =color[160][170] if (r >= COTH and g < COTH and b < COTH):
random_line_split
models.py
# -*- coding: utf-8 -*- """ flaskbb.management.models ~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains all management related models. :copyright: (c) 2014 by the FlaskBB Team. :license: BSD, see LICENSE for more details. """ from wtforms import (TextField, IntegerField, FloatField, BooleanField, ...
(cls): return cls.query.all() @classmethod def update(cls, settings, app=None): """Updates the cache and stores the changes in the database. :param settings: A dictionary with setting items. """ # update the database for key, value in iteritems(settings)...
get_all
identifier_name
models.py
# -*- coding: utf-8 -*- """ flaskbb.management.models ~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains all management related models. :copyright: (c) 2014 by the FlaskBB Team. :license: BSD, see LICENSE for more details. """ from wtforms import (TextField, IntegerField, FloatField, BooleanField, ...
setting.value = value db.session.add(setting) db.session.commit() cls.invalidate_cache() @classmethod def get_settings(cls, from_group=None): """This will return all settings with the key as the key for the dict and the values are packed again in a...
# update the database for key, value in iteritems(settings): setting = cls.query.filter(Setting.key == key.lower()).first()
random_line_split
models.py
# -*- coding: utf-8 -*- """ flaskbb.management.models ~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains all management related models. :copyright: (c) 2014 by the FlaskBB Team. :license: BSD, see LICENSE for more details. """ from wtforms import (TextField, IntegerField, FloatField, BooleanField, ...
else: coerce_to = text_type setattr( SettingsForm, setting.key, SelectMultipleField( setting.name, choices=setting.extra['choices'](), coerce=coerce_to, ...
coerce_to = setting.extra['coerce']
conditional_block
models.py
# -*- coding: utf-8 -*- """ flaskbb.management.models ~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains all management related models. :copyright: (c) 2014 by the FlaskBB Team. :license: BSD, see LICENSE for more details. """ from wtforms import (TextField, IntegerField, FloatField, BooleanField, ...
# Min number validator field_validators.append( validator_class(min=setting.extra["min"]) ) if "max" in setting.extra: # Max number validator field_validators.append( validator_class(max=...
"""Returns a Form for all settings found in :class:`SettingsGroup`. :param group: The settingsgroup name. It is used to get the settings which are in the specified group. """ class SettingsForm(Form): pass # now parse the settings in this group ...
identifier_body
DataLinks.test.tsx
import React from 'react'; import { mount } from 'enzyme'; import { DataLinks } from './DataLinks'; import { Button } from '@grafana/ui'; import { DataLink } from './DataLink'; import { act } from 'react-dom/test-utils'; describe('DataLinks', () => { let originalGetSelection: typeof window.getSelection; beforeAll(...
it('removes field', async () => { const onChangeMock = jest.fn(); let wrapper: any; await act( // @ts-ignore we shouldn't use Promises in act => the "void | undefined" is here to forbid any sneaky "Promise" returns. async () => { wrapper = await mount(<DataLinks value={testValue} onCha...
});
random_line_split
checkout.rs
use crate::{Command, CommandBoxClone, WorkOption, WorkResult}; use color_printer::{Color, ColorPrinter, ColorSpec}; use command_derive::CommandBoxClone; use gitlib::GitRepo; use std::{io::Write, path::PathBuf}; #[derive(Clone, CommandBoxClone)] pub struct CheckoutCommand { branch: String, } impl CheckoutCommand {...
(branch: String) -> Self { Self { branch } } } struct CheckoutCommandResult { branch: String, path: PathBuf, } impl Command for CheckoutCommand { fn process(&self, repo: GitRepo) -> WorkOption { if let Ok(true) = repo.checkout(&self.branch) { let result = CheckoutCommandRes...
new
identifier_name
checkout.rs
use crate::{Command, CommandBoxClone, WorkOption, WorkResult}; use color_printer::{Color, ColorPrinter, ColorSpec}; use command_derive::CommandBoxClone;
branch: String, } impl CheckoutCommand { pub fn new(branch: String) -> Self { Self { branch } } } struct CheckoutCommandResult { branch: String, path: PathBuf, } impl Command for CheckoutCommand { fn process(&self, repo: GitRepo) -> WorkOption { if let Ok(true) = repo.checkout...
use gitlib::GitRepo; use std::{io::Write, path::PathBuf}; #[derive(Clone, CommandBoxClone)] pub struct CheckoutCommand {
random_line_split
checkout.rs
use crate::{Command, CommandBoxClone, WorkOption, WorkResult}; use color_printer::{Color, ColorPrinter, ColorSpec}; use command_derive::CommandBoxClone; use gitlib::GitRepo; use std::{io::Write, path::PathBuf}; #[derive(Clone, CommandBoxClone)] pub struct CheckoutCommand { branch: String, } impl CheckoutCommand {...
else { None } } } impl WorkResult for CheckoutCommandResult { fn print(&self, printer: &mut ColorPrinter<'_>) { let mut cs = ColorSpec::new(); cs.set_intense(true); cs.set_fg(Some(Color::Yellow)); printer.color_context(&cs, |h| write!(h, " {}", self.branch)...
{ let result = CheckoutCommandResult { path: repo.path().into(), branch: self.branch.clone(), }; Some(Box::new(result)) }
conditional_block
views.py
from app import app from flask import render_template, make_response, redirect # Route decorators to referance urls @app.route('/') def index(): user = {'nickname': 'Kemal'} # fake user posts = [ # fake array of posts { 'author': {'nickname': 'John'}, 'body': 'Beautiful day in...
(): return render_template('scripts.html') @app.route('/about') def about(): return render_template('about.html') @app.route('/people') def people(): return render_template('people.html') @app.route('/research') def research(): return render_template('research.html') # Blog page will be linked to je...
scripts
identifier_name
views.py
from app import app from flask import render_template, make_response, redirect # Route decorators to referance urls @app.route('/') def index(): user = {'nickname': 'Kemal'} # fake user posts = [ # fake array of posts { 'author': {'nickname': 'John'}, 'body': 'Beautiful day in...
@app.errorhandler(500) def internal_server_error(e): return render_template('500.html'), 500
return render_template('404.html'), 404
identifier_body
views.py
from app import app from flask import render_template, make_response, redirect # Route decorators to referance urls @app.route('/') def index(): user = {'nickname': 'Kemal'} # fake user posts = [ # fake array of posts { 'author': {'nickname': 'John'}, 'body': 'Beautiful day in...
} ] return render_template('index.html', title='Home', user=user, posts=posts) @app.route('/scripts') def scripts(): return render_template('scripts.html') @app.route('/about') def about(): return render_template('...
{ 'author': {'nickname': 'Susan'}, 'body': 'The Avengers movie was so cool!'
random_line_split
dst-bad-assign-2.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&self) -> isize { self.f } } pub fn main() { // Assignment. let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box<ToBar> = Box::new(Bar1 {f: 36}); f5.ptr = *z; //~^ ERROR t...
to_val
identifier_name
dst-bad-assign-2.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn to_val(&self) -> isize { self.f } } pub fn main() { // Assignment. let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box<ToBar> = Box::new(Bar1 {f: 36}); f5.ptr = *z; ...
{ Bar }
identifier_body
dst-bad-assign-2.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Bar } fn to_val(&self) -> isize { self.f } } pub fn main() { // Assignment. let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box<ToBar> = Box::new(Bar1 {f: 36}); ...
fn to_val(&self) -> isize; } impl ToBar for Bar1 { fn to_bar(&self) -> Bar {
random_line_split
Snake.test.js
/* * Copyright (c) 2002-2020 "Neo4j," * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j 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 ...
test('Extras renders', () => { render(<Snake />) })
test('Frame renders', () => { const { getByText } = render(<SnakeFrame />) const startBtn = getByText(/start the game!/i) fireEvent.click(startBtn) })
random_line_split
automaticConstructorToggling.ts
/// <reference path='fourslash.ts'/> ////class A<T> { } ////class B<T> {/*B*/ } ////class C<T> { /*C*/constructor(val: T) { } } ////class D<T> { constructor(/*D*/val: T) { } } //// ////new /*Asig*/A<string>(); ////new /*Bsig*/B("");
var B = 'B'; var C = 'C'; var D = 'D' goTo.marker(B); edit.insert('constructor(val: T) { }'); verify.quickInfos({ Asig: "constructor A<string>(): A<string>", Bsig: "constructor B<string>(val: string): B<string>", Csig: "constructor C<string>(val: string): C<string>", Dsig: "constructor D<T>(val...
////new /*Csig*/C(""); ////new /*Dsig*/D<string>(); var A = 'A';
random_line_split
alltest.py
#!/usr/bin/python3 # vim: ai ts=4 sts=4 et sw=4 # Copyright (c) 2009 Intel Corporation # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; version 2 of the License # # This program...
main()
conditional_block
alltest.py
#!/usr/bin/python3 # vim: ai ts=4 sts=4 et sw=4 # Copyright (c) 2009 Intel Corporation # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; version 2 of the License # # This program...
)) unittest.TextTestRunner(verbosity=2).run(suite) if __name__ == '__main__': main()
def main(): suite = unittest.TestSuite(( test_specify.suite(),
random_line_split
alltest.py
#!/usr/bin/python3 # vim: ai ts=4 sts=4 et sw=4 # Copyright (c) 2009 Intel Corporation # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; version 2 of the License # # This program...
(): suite = unittest.TestSuite(( test_specify.suite(), )) unittest.TextTestRunner(verbosity=2).run(suite) if __name__ == '__main__': main()
main
identifier_name
alltest.py
#!/usr/bin/python3 # vim: ai ts=4 sts=4 et sw=4 # Copyright (c) 2009 Intel Corporation # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; version 2 of the License # # This program...
if __name__ == '__main__': main()
suite = unittest.TestSuite(( test_specify.suite(), )) unittest.TextTestRunner(verbosity=2).run(suite)
identifier_body
transpile-ts.ts
'use strict'; import {BaseGulpTask} from '../BaseGulpTask'; import * as gulp from 'gulp'; import {Utils} from '../utils'; import * as yargs from 'yargs'; let $: any = require('gulp-load-plugins')({ lazy: true }); /** * Transpiles all TypeScript as JavaScript as the gulp task 'transpile-ts'. * * @class */ export c...
// use the TypeScript project config file for all settings let tsProject: any = $.typescript.createProject('tsconfig.json'); // compile all TypeScript files, including sourcemaps inline in the generated JavaScript let result: any = tsProject.src() .pipe($.plumber()) .pipe($.if(this._args.v...
constructor() { super(); Utils.log('Transpiling app TypeScript files to JavaScript');
random_line_split
transpile-ts.ts
'use strict'; import {BaseGulpTask} from '../BaseGulpTask'; import * as gulp from 'gulp'; import {Utils} from '../utils'; import * as yargs from 'yargs'; let $: any = require('gulp-load-plugins')({ lazy: true }); /** * Transpiles all TypeScript as JavaScript as the gulp task 'transpile-ts'. * * @class */ export c...
extends BaseGulpTask { /** * @property {string} description - Help description for the task. */ public static description: string = 'Builds all TypeScript as JavaScript'; /** * @property {string[]} aliases - Different options to run the task. */ public static aliases: string[] = ['tts']; ...
GulpTask
identifier_name
atari5200.py
#!/usr/bin/python import os, struct, array from fcntl import ioctl SDL_JOY_0_SELECT = 8 SDL_JOY_0_START = 9 SDL_JOY_0_TRIGGER1 = 0 SDL_JOY_0_TRIGGER2 = 1 SDL_JOY_0_ASTERISK = 2 SDL_JOY_0_HASH = 3 SDL_JOY_0_SECOND_AXIS = 2 # Iterate over the joystick devices. # print('Available devices:') devices = sorted(os.listdir...
elif p[0] == "input_r_x_minus_axis": SDL_JOY_0_SECOND_AXIS = p[1].replace('"', '').replace("-", "") f.close() atari800_cfg = "/home/pi/.atari800.cfg" print "Updating configuration in %s with" % atari800_cfg print "SDL_JOY_0_SELECT=%s" % SDL_JOY_0_SELECT print "SDL_JOY_0_START=%s" % SDL_JOY_0_START...
SDL_JOY_0_HASH = p[1].replace('"', '')
conditional_block
atari5200.py
#!/usr/bin/python import os, struct, array from fcntl import ioctl SDL_JOY_0_SELECT = 8 SDL_JOY_0_START = 9 SDL_JOY_0_TRIGGER1 = 0 SDL_JOY_0_TRIGGER2 = 1 SDL_JOY_0_ASTERISK = 2 SDL_JOY_0_HASH = 3 SDL_JOY_0_SECOND_AXIS = 2 # Iterate over the joystick devices. # print('Available devices:') devices = sorted(os.listdir...
if p[0] == "input_select_btn": SDL_JOY_0_SELECT = p[1].replace('"', '') elif p[0] == "input_start_btn": SDL_JOY_0_START = p[1].replace('"', '') elif p[0] == "input_a_btn": SDL_JOY_0_TRIGGER1 = p[1].replace('"', '') elif p[0] == "input_b_btn": ...
# print "Processing %s" % p[0]
random_line_split
S11.5.2_A3_T1.2.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: Operator x / y returns ToNumber(x) / ToNumber(y) es5id: 11.5.2_A3_T1.2 description: Type(x) and Type(y) vary between primitive number and Number object ---*/ //CHECK#1 if (1 ...
//CHECK#3 if (1 / new Number(1) !== 1) { $ERROR('#3: 1 / new Number(1) === 1. Actual: ' + (1 / new Number(1))); } //CHECK#4 if (new Number(1) / new Number(1) !== 1) { $ERROR('#4: new Number(1) / new Number(1) === 1. Actual: ' + (new Number(1) / new Number(1))); }
{ $ERROR('#2: new Number(1) / 1 === 1. Actual: ' + (new Number(1) / 1)); }
conditional_block
S11.5.2_A3_T1.2.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: Operator x / y returns ToNumber(x) / ToNumber(y) es5id: 11.5.2_A3_T1.2 description: Type(x) and Type(y) vary between primitive number and Number object ---*/ //CHECK#1
//CHECK#2 if (new Number(1) / 1 !== 1) { $ERROR('#2: new Number(1) / 1 === 1. Actual: ' + (new Number(1) / 1)); } //CHECK#3 if (1 / new Number(1) !== 1) { $ERROR('#3: 1 / new Number(1) === 1. Actual: ' + (1 / new Number(1))); } //CHECK#4 if (new Number(1) / new Number(1) !== 1) { $ERROR('#4: new Number(1) / ne...
if (1 / 1 !== 1) { $ERROR('#1: 1 / 1 === 1. Actual: ' + (1 / 1)); }
random_line_split
sfp_template.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sfp_XXX # Purpose: Description of the plug-in. # # Author: Name and e-mail address # # Created: Date # Copyright: (c) Name # Licence: GPL # ----------------------------...
# This is to support the end user in selecting modules based on events # produced. def producedEvents(self): return None # Handle events sent to this module def handleEvent(self, event): eventName = event.eventType srcModuleName = event.module eventData = ev...
return ["*"] # What events this module produces
random_line_split
sfp_template.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sfp_XXX # Purpose: Description of the plug-in. # # Author: Name and e-mail address # # Created: Date # Copyright: (c) Name # Licence: GPL # ----------------------------...
# What events is this module interested in for input # * = be notified about all events. def watchedEvents(self): return ["*"] # What events this module produces # This is to support the end user in selecting modules based on events # produced. def producedEvents(self): ...
self.opts[opt] = userOpts[opt]
conditional_block
sfp_template.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sfp_XXX # Purpose: Description of the plug-in. # # Author: Name and e-mail address # # Created: Date # Copyright: (c) Name # Licence: GPL # ----------------------------...
# What events this module produces # This is to support the end user in selecting modules based on events # produced. def producedEvents(self): return None # Handle events sent to this module def handleEvent(self, event): eventName = event.eventType srcModul...
return ["*"]
identifier_body