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 |
|---|---|---|---|---|
infragistics.ui.regional-lv.js | /* Latvia +*/
/*global $ */
$.ig = $.ig || {};
$.ig.regional = $.ig.regional || {};
$.ig.regional.lv = {
monthNames: ['Janvāris', 'Februāris', 'Marts', 'Aprīlis', 'Maijs', 'Jūnijs', 'Jūlijs', 'Augusts', 'Septembris', 'Oktobris', 'Novembris', 'Decembris'],
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jūn', '... | currencyPositivePattern: 'n $',
currencyNegativePattern: '-n $',
currencySymbol: 'Ls',
currencyDecimalSeparator: ',',
currencyGroupSeparator: ' ',
percentDecimalSeparator: ',',
percentGroupSeparator: ' '
};
if ($.ig.setRegionalDefault) {
$.ig.setRegionalDefault('lv');
} | random_line_split | |
infragistics.ui.regional-lv.js | /* Latvia +*/
/*global $ */
$.ig = $.ig || {};
$.ig.regional = $.ig.regional || {};
$.ig.regional.lv = {
monthNames: ['Janvāris', 'Februāris', 'Marts', 'Aprīlis', 'Maijs', 'Jūnijs', 'Jūlijs', 'Augusts', 'Septembris', 'Oktobris', 'Novembris', 'Decembris'],
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jūn', '... | RegionalDefault('lv');
}
| conditional_block | |
error_types.rs | use std::error;
use std::fmt;
use std::io;
pub struct GnuplotInitError
{
inner: Box<dyn error::Error + 'static>,
}
impl From<io::Error> for GnuplotInitError
{
fn from(error: io::Error) -> Self
{
GnuplotInitError {
inner: Box::new(error),
}
}
}
impl fmt::Display for GnuplotInitError
{
fn | (&self, f: &mut fmt::Formatter) -> fmt::Result
{
write!(
f,
"Couldn't spawn gnuplot. Make sure it is installed and available in PATH.\nCause: {}",
self.inner
)
}
}
impl fmt::Debug for GnuplotInitError
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result
{
write!(f, "{}", self)
}
}
impl error::Er... | fmt | identifier_name |
error_types.rs | use std::error;
use std::fmt;
use std::io;
pub struct GnuplotInitError
{
inner: Box<dyn error::Error + 'static>,
}
impl From<io::Error> for GnuplotInitError
{
fn from(error: io::Error) -> Self
|
}
impl fmt::Display for GnuplotInitError
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result
{
write!(
f,
"Couldn't spawn gnuplot. Make sure it is installed and available in PATH.\nCause: {}",
self.inner
)
}
}
impl fmt::Debug for GnuplotInitError
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Re... | {
GnuplotInitError {
inner: Box::new(error),
}
} | identifier_body |
error_types.rs | use std::error;
use std::fmt;
use std::io;
pub struct GnuplotInitError
{
inner: Box<dyn error::Error + 'static>,
}
impl From<io::Error> for GnuplotInitError
{
fn from(error: io::Error) -> Self
{
GnuplotInitError { | }
impl fmt::Display for GnuplotInitError
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result
{
write!(
f,
"Couldn't spawn gnuplot. Make sure it is installed and available in PATH.\nCause: {}",
self.inner
)
}
}
impl fmt::Debug for GnuplotInitError
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Res... | inner: Box::new(error),
}
} | random_line_split |
explicit-self-lifetime-mismatch.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <'a,'b> {
x: &'a int,
y: &'b int,
}
impl<'a,'b> Foo<'a,'b> {
// The number of errors is related to the way invariance works.
fn bar(self: Foo<'b,'a>) {}
//~^ ERROR mismatched types: expected `Foo<'a,'b>` but found `Foo<'b,'a>`
//~^^ ERROR mismatched types: expected `Foo<'a,'b>` but found `Foo<'... | Foo | identifier_name |
explicit-self-lifetime-mismatch.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 ... | {} | identifier_body | |
explicit-self-lifetime-mismatch.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 ... | // The number of errors is related to the way invariance works.
fn bar(self: Foo<'b,'a>) {}
//~^ ERROR mismatched types: expected `Foo<'a,'b>` but found `Foo<'b,'a>`
//~^^ ERROR mismatched types: expected `Foo<'a,'b>` but found `Foo<'b,'a>`
//~^^^ ERROR mismatched types: expected `Foo<'b,'a>` but fo... | random_line_split | |
accordion-group.component.ts | import {
Component, HostBinding, Inject, Input, OnDestroy, OnInit
} from '@angular/core';
import { isBs3 } from '../utils/ng2-bootstrap-config';
import { AccordionComponent } from './accordion.component';
/*
* ### Accordion heading
Instead of using `heading` attribute on the `accordion-group`, you can use an `acc... | : boolean {
return isBs3();
}
protected _isOpen: boolean;
protected accordion: AccordionComponent;
public constructor(@Inject(AccordionComponent) accordion: AccordionComponent) {
this.accordion = accordion;
}
public ngOnInit(): any {
this.panelClass = this.panelClass || 'panel-default';
t... | Bs3() | identifier_name |
accordion-group.component.ts | import {
Component, HostBinding, Inject, Input, OnDestroy, OnInit
} from '@angular/core';
import { isBs3 } from '../utils/ng2-bootstrap-config';
import { AccordionComponent } from './accordion.component';
/*
* ### Accordion heading
Instead of using `heading` attribute on the `accordion-group`, you can use an `acc... |
public constructor(@Inject(AccordionComponent) accordion: AccordionComponent) {
this.accordion = accordion;
}
public ngOnInit(): any {
this.panelClass = this.panelClass || 'panel-default';
this.accordion.addGroup(this);
}
public ngOnDestroy(): any {
this.accordion.removeGroup(this);
}
... | }
protected _isOpen: boolean;
protected accordion: AccordionComponent; | random_line_split |
accordion-group.component.ts | import {
Component, HostBinding, Inject, Input, OnDestroy, OnInit
} from '@angular/core';
import { isBs3 } from '../utils/ng2-bootstrap-config';
import { AccordionComponent } from './accordion.component';
/*
* ### Accordion heading
Instead of using `heading` attribute on the `accordion-group`, you can use an `acc... | event.preventDefault();
if (!this.isDisabled) {
this.isOpen = !this.isOpen;
}
}
} | identifier_body | |
accordion-group.component.ts | import {
Component, HostBinding, Inject, Input, OnDestroy, OnInit
} from '@angular/core';
import { isBs3 } from '../utils/ng2-bootstrap-config';
import { AccordionComponent } from './accordion.component';
/*
* ### Accordion heading
Instead of using `heading` attribute on the `accordion-group`, you can use an `acc... | }
}
| this.isOpen = !this.isOpen;
}
| conditional_block |
vldmxcsr.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
fn vldmxcsr_1() {
run_test(&Instruction { mnemonic: Mnemonic::VLDMXCSR, operand1: Some(IndirectScaledIndexedDisplaced(ESI,... | {
run_test(&Instruction { mnemonic: Mnemonic::VLDMXCSR, operand1: Some(IndirectDisplaced(RAX, 2124348144, Some(OperandSize::Dword), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[197, 248, 174, 144, 240, 250, 1... | identifier_body | |
vldmxcsr.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
| run_test(&Instruction { mnemonic: Mnemonic::VLDMXCSR, operand1: Some(IndirectDisplaced(RAX, 2124348144, Some(OperandSize::Dword), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[197, 248, 174, 144, 240, 250, 158... | fn vldmxcsr_1() {
run_test(&Instruction { mnemonic: Mnemonic::VLDMXCSR, operand1: Some(IndirectScaledIndexedDisplaced(ESI, EDX, Two, 683715666, Some(OperandSize::Dword), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: Non... | random_line_split |
vldmxcsr.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
fn | () {
run_test(&Instruction { mnemonic: Mnemonic::VLDMXCSR, operand1: Some(IndirectScaledIndexedDisplaced(ESI, EDX, Two, 683715666, Some(OperandSize::Dword), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[197, 2... | vldmxcsr_1 | identifier_name |
basic.rs | extern crate lichen;
use lichen::parse::Parser;
use lichen::var::Var;
use lichen::eval::Evaluator;
fn main() | // which either advances or continues on during the next step
// see the contrived example to see this
}
}
| {
//load the lichen source file as a string
let bytes = include_bytes!("basic.ls");
let mut src = String::from_utf8_lossy(bytes);
let mut env = Parser::parse_blocks(src.to_mut()).expect("ERROR: Unable to parse source").into_env(); //parse the source and build the environment
let mut ev = Evalu... | identifier_body |
basic.rs | extern crate lichen;
use lichen::parse::Parser;
use lichen::var::Var;
use lichen::eval::Evaluator;
fn | () {
//load the lichen source file as a string
let bytes = include_bytes!("basic.ls");
let mut src = String::from_utf8_lossy(bytes);
let mut env = Parser::parse_blocks(src.to_mut()).expect("ERROR: Unable to parse source").into_env(); //parse the source and build the environment
let mut ev = Ev... | main | identifier_name |
basic.rs | extern crate lichen;
use lichen::parse::Parser;
use lichen::var::Var;
use lichen::eval::Evaluator;
fn main() {
//load the lichen source file as a string
let bytes = include_bytes!("basic.ls");
let mut src = String::from_utf8_lossy(bytes);
let mut env = Parser::parse_blocks(src.to_mut()).expect("... | , // print out the emitted variables
_ => {},
}
}
// if we wanted to we could look at the next_node returned,
// and advance it manually if needed
// you'd do this if the node were an await-style node,
// which either advances or continues on during t... | { println!("{:}", s); } | conditional_block |
basic.rs | extern crate lichen;
use lichen::parse::Parser;
use lichen::var::Var;
use lichen::eval::Evaluator;
fn main() {
//load the lichen source file as a string
let bytes = include_bytes!("basic.ls");
let mut src = String::from_utf8_lossy(bytes);
let mut env = Parser::parse_blocks(src.to_mut()).expect("... | // and advance it manually if needed
// you'd do this if the node were an await-style node,
// which either advances or continues on during the next step
// see the contrived example to see this
}
} | // if we wanted to we could look at the next_node returned, | random_line_split |
error.rs | // OpenAOE: An open source reimplementation of Age of Empires (1997)
// Copyright (c) 2016 Kevin Fuller
//
// 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 wi... | display("invalid palette: {}", reason)
}
}
} | }
errors {
InvalidPalette(reason: &'static str) {
description("invalid palette") | random_line_split |
swanson_bot.py | #!/usr/bin/python
import praw
import re
import os
import pickle
from array import *
import random
#REPLY = "I want all the bacon and eggs you have."
REPLY = array('i',["I want all the bacon and eggs you have", "I know what I'm about son", "I'm not interested in caring about people", "Is this not rap?"])
if not os.pat... | if comment.id not in replies:
if re.search("Ron Swanson", comment.body, re.IGNORECASE):
y = random.randint(0,3)
print "Bot replying to comment: ", comment.id
comment.reply(REPLY[y])
replies.append(comment.id)
# Save new replies
print ... | for comment in flat_comments: | random_line_split |
swanson_bot.py | #!/usr/bin/python
import praw
import re
import os
import pickle
from array import *
import random
#REPLY = "I want all the bacon and eggs you have."
REPLY = array('i',["I want all the bacon and eggs you have", "I know what I'm about son", "I'm not interested in caring about people", "Is this not rap?"])
if not os.pat... |
user_agent = ("Swanson bot 0.1 created by /u/dcooper2.")
r = praw.Reddit(user_agent=user_agent)
r.login(user_data[0], user_data[1])
del user_data
print "Successfully logged in"
# Check for previous replies
if not os.path.isfile("replies.txt"):
replies = []
else:
print "Loading previous reply ids"
with ... | print "Loading credentials"
user_data = pickle.load( open("swanson_config.txt","rb"))
#print user_data | conditional_block |
angle.py | Turak <bence.turak@gmail.com>
"""
import math
import re
RO = 180 * 60 * 60 / math.pi
PI2 = 2 * math.pi
def _deg2rad(angle):
""" Convert DEG to RAD
"""
return math.radians(angle)
def _gon2rad(angle):
""" Convert GON to RAD
"""
return angle / 200.0 * math.pi
def _dms2rad(dms):
""" Conver... |
if __name__ == "__main__":
a = Angle(-0.01112, "DEG")
| """ substract an agle from current
:param a: Angle to substract
"""
self.value -= a.GetAngle('RAD')
return self | identifier_body |
angle.py |
for val in items:
a += val / div
div *= 60.0
a = math.radians(a)
else:
raise ValueError("Angle invalid argument", dms)
return a
def _dm2rad(angle):
""" Convert DDMM.nnnnnn NMEA angle to radian"
"""
w = angle / 100.0
d = int(w)
return math.rad... | print(a1.GetAngle(u)) | conditional_block | |
angle.py | .. moduleauthor:: dr. Zoltan Siki <siki.zoltan@epito.bme.hu>
Bence Turak <bence.turak@gmail.com>
"""
import math
import re
RO = 180 * 60 * 60 / math.pi
PI2 = 2 * math.pi
def _deg2rad(angle):
""" Convert DEG to RAD
"""
return math.radians(angle)
def _gon2rad(angle):
""" Convert GON to... | :synopsis: Ulyxes - an open source project to drive total stations and
publish observation results.
GPL v2.0 license
Copyright (C) 2010- Zoltan Siki <siki.zoltan@epito.bme.hu>
| random_line_split | |
angle.py | Turak <bence.turak@gmail.com>
"""
import math
import re
RO = 180 * 60 * 60 / math.pi
PI2 = 2 * math.pi
def _deg2rad(angle):
""" Convert DEG to RAD
"""
return math.radians(angle)
def _gon2rad(angle):
""" Convert GON to RAD
"""
return angle / 200.0 * math.pi
def _dms2rad(dms):
""" Conver... | (angle):
""" Convert mills to radian
"""
return angle / 6400.0 * 2.0 * math.pi
def _rad2gon(value):
""" Convert radian to GON
"""
return value / math.pi * 200.0
def _rad2sec(value):
""" Convert radian to seconds
"""
return value * RO
def _rad2deg(value):
""" Convert radian to ... | _mil2rad | identifier_name |
views.py | # coding:utf-8
# Create your views here.
from django.shortcuts import render
from django.http import HttpResponse
from arrow_time import today_date_for_influxd_sql
from arrow_time import ten_day_ago_for_influxd_sql | from aircraft_config import AC_WQAR_CONFIG
import json
def home(request):
date_start = today_date_for_influxd_sql()
date_end = today_date_for_influxd_sql()
all_aircraft_list = json.dumps(AC_WQAR_CONFIG().all_aircraft())
where_str = " WHERE time > " + "'" + date_start + "'" + " - 8h" + " AND time < " +... | from influxdb_function import influxDB_interface | random_line_split |
views.py | # coding:utf-8
# Create your views here.
from django.shortcuts import render
from django.http import HttpResponse
from arrow_time import today_date_for_influxd_sql
from arrow_time import ten_day_ago_for_influxd_sql
from influxdb_function import influxDB_interface
from aircraft_config import AC_WQAR_CONFIG
import json
... |
def guide(request):
return render(request, 'guide.html')
| date_start = today_date_for_influxd_sql()
date_end = today_date_for_influxd_sql()
all_aircraft_list = json.dumps(AC_WQAR_CONFIG().all_aircraft())
where_str = " WHERE time > " + "'" + date_start + "'" + " - 8h" + " AND time < " + "'" + date_end + "'" + " + 16h"
infdb_if = influxDB_interface()
sector... | identifier_body |
views.py | # coding:utf-8
# Create your views here.
from django.shortcuts import render
from django.http import HttpResponse
from arrow_time import today_date_for_influxd_sql
from arrow_time import ten_day_ago_for_influxd_sql
from influxdb_function import influxDB_interface
from aircraft_config import AC_WQAR_CONFIG
import json
... | (request):
date_start = today_date_for_influxd_sql()
date_end = today_date_for_influxd_sql()
all_aircraft_list = json.dumps(AC_WQAR_CONFIG().all_aircraft())
where_str = " WHERE time > " + "'" + date_start + "'" + " - 8h" + " AND time < " + "'" + date_end + "'" + " + 16h"
infdb_if = influxDB_interfa... | home | identifier_name |
views.py | # coding:utf-8
# Create your views here.
from django.shortcuts import render
from django.http import HttpResponse
from arrow_time import today_date_for_influxd_sql
from arrow_time import ten_day_ago_for_influxd_sql
from influxdb_function import influxDB_interface
from aircraft_config import AC_WQAR_CONFIG
import json
... |
else:
return render(request, 'home.html', {'result_json': {},
'all_ac':all_aircraft_list})
def guide(request):
return render(request, 'guide.html')
| df = sector_index['index']
result_json = df.to_json(orient="records")
return render(request, 'home.html', {'result_json': result_json,
'all_ac':all_aircraft_list}) | conditional_block |
html.rs | //These tests were "borrowed" from html5ever. Some of them are not applicable,
//since the purpose of Symbiosis is to recreate the original document as
//closely as possible.
extern crate symbiosis_tokenizer;
use std::collections::HashMap;
use symbiosis_tokenizer::{Tokenizer, TokenSink, StrTendril};
use symbiosis_to... | (&mut self, token: Token) {
match token {
Token::SetDoctype(doctype) => {
self.buffer.push_str("<!DOCTYPE");
if let Some(ref name) = doctype.name {
self.buffer.push_str(name);
}
if let Some(ref public_id) = doctype.... | process_token | identifier_name |
html.rs | //These tests were "borrowed" from html5ever. Some of them are not applicable,
//since the purpose of Symbiosis is to recreate the original document as
//closely as possible.
extern crate symbiosis_tokenizer;
use std::collections::HashMap;
use symbiosis_tokenizer::{Tokenizer, TokenSink, StrTendril};
use symbiosis_to... | test!(comment_3, r#"<p>hi <!--world --></p>"#);
test!(comment_4, r#"<p>hi <!-- world --></p>"#);
test!(attr_ns_1, r#"<svg xmlns="bleh"></svg>"#);
test!(attr_ns_2, r#"<svg xmlns:foo="bleh"></svg>"#);
test!(attr_ns_3, r#"<svg xmlns:xlink="bleh"></svg>"#);
test!(attr_ns_4, r#"<svg xlink:href="bleh"></svg>"#); | random_line_split | |
html.rs | //These tests were "borrowed" from html5ever. Some of them are not applicable,
//since the purpose of Symbiosis is to recreate the original document as
//closely as possible.
extern crate symbiosis_tokenizer;
use std::collections::HashMap;
use symbiosis_tokenizer::{Tokenizer, TokenSink, StrTendril};
use symbiosis_to... | else if doctype.system_id.is_some() {
self.buffer.push_str(" SYSTEM");
}
if let Some(ref system_id) = doctype.system_id {
self.buffer.push_str(&format!(" \"{}\"", system_id));
}
self.buffer.push_str(">");
... | {
self.buffer.push_str(&format!(" PUBLIC \"{}\"", public_id));
} | conditional_block |
query_directives.js | }
function querySourceLink($location) {
return {
restrict: 'E',
template: '<span ng-show="query.id && canViewSource">\
<a ng-show="!sourceMode"\
ng-href="{{query.getUrl(true, selectedTab)}}" class="btn btn-default">Show Source\
</a>\
... |
$scope.queryFormatting = true;
$http.post('api/queries/format', {
'query': $scope.query.query
}).success(function (response) {
$scope.query.query = response;
}).finally(function () {
$scope.queryFormatting = false;
})... | {
return {
restrict: 'E',
// don't create new scope to avoid ui-codemirror bug
// seehttps://github.com/angular-ui/ui-codemirror/pull/37
scope: false,
template: '<button type="button" class="btn btn-default btn-s"\
ng-click="formatQuery()">\
<span... | identifier_body |
query_directives.js | }
function | ($location) {
return {
restrict: 'E',
template: '<span ng-show="query.id && canViewSource">\
<a ng-show="!sourceMode"\
ng-href="{{query.getUrl(true, selectedTab)}}" class="btn btn-default">Show Source\
</a>\
<a ng-show="so... | querySourceLink | identifier_name |
query_directives.js | }
function querySourceLink($location) {
return {
restrict: 'E',
template: '<span ng-show="query.id && canViewSource">\
<a ng-show="!sourceMode"\
ng-href="{{query.getUrl(true, selectedTab)}}" class="btn btn-default">Show Source\
</a>\
... |
var fileType = attrs.fileType ? attrs.fileType : "csv";
scope.$watch('queryResult && queryResult.getData()', function(data) {
if (!data) {
return;
}
if (scope.queryResult.getId() == null) {
element.attr('href', '');
} else {
e... | restrict: 'A',
link: function (scope, element, attrs) { | random_line_split |
query_directives.js |
}
scope.link = scope.query.getUrl(false, hash);
}
}
}
function querySourceLink($location) {
return {
restrict: 'E',
template: '<span ng-show="query.id && canViewSource">\
<a ng-show="!sourceMode"\
ng-href="{{query.getUrl(true, sel... | {
hash = scope.visualization.id;
} | conditional_block | |
PTX_oandaInfo.py | from configparser import ConfigParser
import v20
# Create an object config
config = ConfigParser()
# Read the config
config.read("../API_Connection_Oanda/pyalgo.cfg")
ctx = v20.Context(
'api-fxpractice.oanda.com',
443,
True,
application = 'sample_code',
token = config['oanda_v20']['access_token'],... | ():
response = ctx.account.instruments(
config['oanda_v20']['account_id'])
instruments = response.get('instruments')
# instruments[0].dict()
for instrument in instruments:
ins = instrument.dict()
print('%20s | %10s' % (ins['displayName'],
ins['na... | get_instruments | identifier_name |
PTX_oandaInfo.py | from configparser import ConfigParser
import v20
# Create an object config
config = ConfigParser()
# Read the config
config.read("../API_Connection_Oanda/pyalgo.cfg")
ctx = v20.Context(
'api-fxpractice.oanda.com',
443,
True,
application = 'sample_code',
token = config['oanda_v20']['access_token'],... | print('%20s | %10s' % (ins['displayName'],
ins['name'])) | random_line_split | |
PTX_oandaInfo.py | from configparser import ConfigParser
import v20
# Create an object config
config = ConfigParser()
# Read the config
config.read("../API_Connection_Oanda/pyalgo.cfg")
ctx = v20.Context(
'api-fxpractice.oanda.com',
443,
True,
application = 'sample_code',
token = config['oanda_v20']['access_token'],... | ins = instrument.dict()
print('%20s | %10s' % (ins['displayName'],
ins['name'])) | conditional_block | |
PTX_oandaInfo.py | from configparser import ConfigParser
import v20
# Create an object config
config = ConfigParser()
# Read the config
config.read("../API_Connection_Oanda/pyalgo.cfg")
ctx = v20.Context(
'api-fxpractice.oanda.com',
443,
True,
application = 'sample_code',
token = config['oanda_v20']['access_token'],... | response = ctx.account.instruments(
config['oanda_v20']['account_id'])
instruments = response.get('instruments')
# instruments[0].dict()
for instrument in instruments:
ins = instrument.dict()
print('%20s | %10s' % (ins['displayName'],
ins['name'])) | identifier_body | |
harmony-array-includes.js | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
// This file relies on the fact that the following declaration has been made
// in runtime.js:
// var $Array = global.Array;
// --------... | () {
%CheckIsBootstrapping();
%FunctionSetLength(ArrayIncludes, 1);
// Set up the non-enumerable functions on the Array prototype object.
InstallFunctions($Array.prototype, DONT_ENUM, $Array(
"includes", ArrayIncludes
));
}
HarmonyArrayIncludesExtendArrayPrototype();
| HarmonyArrayIncludesExtendArrayPrototype | identifier_name |
harmony-array-includes.js | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
// This file relies on the fact that the following declaration has been made
// in runtime.js:
// var $Array = global.Array;
// --------... | HarmonyArrayIncludesExtendArrayPrototype(); | }
| random_line_split |
harmony-array-includes.js | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
// This file relies on the fact that the following declaration has been made
// in runtime.js:
// var $Array = global.Array;
// --------... |
return false;
}
// -------------------------------------------------------------------
function HarmonyArrayIncludesExtendArrayPrototype() {
%CheckIsBootstrapping();
%FunctionSetLength(ArrayIncludes, 1);
// Set up the non-enumerable functions on the Array prototype object.
InstallFunctions($Array.protot... | {
var elementK = array[k];
if (SameValueZero(searchElement, elementK)) {
return true;
}
++k;
} | conditional_block |
harmony-array-includes.js | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
// This file relies on the fact that the following declaration has been made
// in runtime.js:
// var $Array = global.Array;
// --------... | while (k < len) {
var elementK = array[k];
if (SameValueZero(searchElement, elementK)) {
return true;
}
++k;
}
return false;
}
// -------------------------------------------------------------------
function HarmonyArrayIncludesExtendArrayPrototype() {
%CheckIsBootstrapping();
%Func... | {
var array = ToObject(this);
var len = ToLength(array.length);
if (len === 0) {
return false;
}
var n = ToInteger(fromIndex);
var k;
if (n >= 0) {
k = n;
} else {
k = len + n;
if (k < 0) {
k = 0;
}
}
| identifier_body |
sg-ga-input.js | // ==UserScript==
// @name SteamGifts GA input
// @description Adds input on top menu where you can enter 5characters of GA id and it will open the GA page for you.
// @author Bladito
// @version 1.0.0
// @homepageURL https://greasyfork.org/en/users/55159-bladito
// @match https://www.steamg... | () {
GM_addStyle('#bsg-ga-input { ' +
'width: 100px;' +
'color: white;' +
'background-color: #3d434f;' +
'border: 1px solid #6e7788;' +
'}');
GM_addStyle('#bsg-ga-input:focus { ' +
'co... | addStyles | identifier_name |
sg-ga-input.js | // ==UserScript==
// @name SteamGifts GA input
// @description Adds input on top menu where you can enter 5characters of GA id and it will open the GA page for you.
// @author Bladito
// @version 1.0.0
// @homepageURL https://greasyfork.org/en/users/55159-bladito
// @match https://www.steamg... |
})(jQuery);
| {
GM_addStyle('#bsg-ga-input { ' +
'width: 100px;' +
'color: white;' +
'background-color: #3d434f;' +
'border: 1px solid #6e7788;' +
'}');
GM_addStyle('#bsg-ga-input:focus { ' +
'color... | identifier_body |
sg-ga-input.js | // ==UserScript==
// @name SteamGifts GA input
// @description Adds input on top menu where you can enter 5characters of GA id and it will open the GA page for you.
// @author Bladito
// @version 1.0.0
// @homepageURL https://greasyfork.org/en/users/55159-bladito
// @match https://www.steamg... |
})(jQuery); | 'background-color: #ffd2d2;' +
'border: 1px solid red;' +
'}');
} | random_line_split |
sg-ga-input.js | // ==UserScript==
// @name SteamGifts GA input
// @description Adds input on top menu where you can enter 5characters of GA id and it will open the GA page for you.
// @author Bladito
// @version 1.0.0
// @homepageURL https://greasyfork.org/en/users/55159-bladito
// @match https://www.steamg... |
});
}
});
$('.nav__left-container').append($input);
addStyles();
//---------------------------------------------------------------------------------
function addStyles() {
GM_addStyle('#bsg-ga-input { ' +
'width: 100px;' +
'colo... | {
$('#bsg-ga-input').addClass('bsg-invalid');
} | conditional_block |
terminal-backend-module.ts | /*
* Copyright (C) 2017 TypeFox and others.
*
* 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
*/
import { ContainerModule, Container } from 'inver... | const logger = ctx.container.get<ILogger>(ILogger);
const loggerChild = logger.child({ 'module': 'terminal-backend' });
child.bind(ShellProcessOptions).toConstantValue({});
child.bind(ILogger).toConstantValue(loggerChild);
return child.get(ShellProcess);
... | (options: ShellProcessOptions) => {
const child = new Container({ defaultScope: 'Singleton' });
child.parent = ctx.container;
| random_line_split |
logsc.py | #!/usr/local/bin/python
#$Id: logsc.py,v 1.7 2013/11/15 15:07:06 kenji Exp $
from sqlite3 import dbapi2 as sqlite
import sys
# change integer to string if found
def int2str(p):
if type(p) == int:
return str(p)
else:
return p
if __name__ == '__main__':
con = sqlite.connect("/home/kenji/txt/hamradio/LOGS... | print "-----------"
print "qso_date: ", row[0]
print "time_on: ", row[1]
print "my_call: ", row[2]
print "call: ", row[3]
print "band: ", row[4]
print "mode: ", row[5]
print "rst_sent: ", row[6]
print "qsl_sent: ", row[7]
print "qsl_via: ... | `rst_sent`, `qsl_sent`, `qsl_via`, `comment`, `my_qso_id` from qso
where `call` regexp \'(?i)\' || ? and `qsl_rcvd` <> \'I\'
order by `qso_date` || `time_on`
""", t)
for row in cur.fetchall(): | random_line_split |
logsc.py | #!/usr/local/bin/python
#$Id: logsc.py,v 1.7 2013/11/15 15:07:06 kenji Exp $
from sqlite3 import dbapi2 as sqlite
import sys
# change integer to string if found
def int2str(p):
|
if __name__ == '__main__':
con = sqlite.connect("/home/kenji/txt/hamradio/LOGS/SQLite-log/hamradio_log.sqlite")
# enable extension loading
con.enable_load_extension(True)
# load regexp extension
con.load_extension("/home/kenji/txt/hamradio/LOGS/scripts/sqlite3-pcre/pcre.so")
# disable extension loading af... | if type(p) == int:
return str(p)
else:
return p | identifier_body |
logsc.py | #!/usr/local/bin/python
#$Id: logsc.py,v 1.7 2013/11/15 15:07:06 kenji Exp $
from sqlite3 import dbapi2 as sqlite
import sys
# change integer to string if found
def | (p):
if type(p) == int:
return str(p)
else:
return p
if __name__ == '__main__':
con = sqlite.connect("/home/kenji/txt/hamradio/LOGS/SQLite-log/hamradio_log.sqlite")
# enable extension loading
con.enable_load_extension(True)
# load regexp extension
con.load_extension("/home/kenji/txt/hamradio/LOGS... | int2str | identifier_name |
logsc.py | #!/usr/local/bin/python
#$Id: logsc.py,v 1.7 2013/11/15 15:07:06 kenji Exp $
from sqlite3 import dbapi2 as sqlite
import sys
# change integer to string if found
def int2str(p):
if type(p) == int:
|
else:
return p
if __name__ == '__main__':
con = sqlite.connect("/home/kenji/txt/hamradio/LOGS/SQLite-log/hamradio_log.sqlite")
# enable extension loading
con.enable_load_extension(True)
# load regexp extension
con.load_extension("/home/kenji/txt/hamradio/LOGS/scripts/sqlite3-pcre/pcre.so")
# disable... | return str(p) | conditional_block |
app.component.spec.ts | import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [ | RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it(... | random_line_split | |
ez_setup.py | _URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os... | (version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, download_delay=15):
to_dir = os.path.abspath(to_dir)
rep_modules = 'pkg_resources', 'setuptools'
imported = set(sys.modules).intersection(rep_modules)
try:
import pkg_resources
except ImportError:
... | use_setuptools | identifier_name |
ez_setup.py | DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_... | (Currently using {VC_err.args[0]!r})
""").format(VC_err=VC_err, version=version)
sys.stderr.write(msg)
sys.exit(2)
# otherwise, reload ok
del pkg_resources, sys.modules['pkg_resources']
return _do_download(version, download_base, to_dir, d... | to_dir = os.path.abspath(to_dir)
rep_modules = 'pkg_resources', 'setuptools'
imported = set(sys.modules).intersection(rep_modules)
try:
import pkg_resources
except ImportError:
return _do_download(version, download_base, to_dir, download_delay)
try:
pkg_resources.require("set... | identifier_body |
ez_setup.py | DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_... | try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
except:
return False
finally:
devnull.close()
return True
download_file_wget.viable = has_wget
def download_file_insecure(url, target):
"""
Use Python to download the file, even though it ca... | cmd = ['wget', '--version']
devnull = open(os.path.devnull, 'wb')
try: | random_line_split |
ez_setup.py | DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_... |
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15,
downloader_factory=get_best_downloader):
"""Download setuptools from a specified location and return its filename
`version` should be a valid setuptools vers... | return dl | conditional_block |
join.py | import typer
from controller import log
from controller.app import Application
from controller.deploy.docker import Docker
@Application.app.command(help="Provide instructions to join new nodes")
def join(
manager: bool = typer.Option(
False, "--manager", show_default=False, help="join new node with manag... | ):
manager_address = node.manager_status.addr
if manager:
log.info("To add a manager to this swarm, run the following command:")
token = docker.swarm.get_token("manager")
else:
log.info("To add a worker to this swarm, run the following command:")
token = dock... | Application.print_command(
Application.serialize_parameter("--manager", manager, IF=manager),
)
Application.get_controller().controller_init()
docker = Docker()
manager_address = "N/A"
# Search for the manager address
for node in docker.client.node.list():
role = node.spec.rol... | identifier_body |
join.py | import typer
from controller import log
from controller.app import Application
from controller.deploy.docker import Docker
@Application.app.command(help="Provide instructions to join new nodes")
def | (
manager: bool = typer.Option(
False, "--manager", show_default=False, help="join new node with manager role"
)
) -> None:
Application.print_command(
Application.serialize_parameter("--manager", manager, IF=manager),
)
Application.get_controller().controller_init()
docker = Doc... | join | identifier_name |
join.py | import typer
from controller import log
from controller.app import Application
from controller.deploy.docker import Docker
@Application.app.command(help="Provide instructions to join new nodes")
def join(
manager: bool = typer.Option(
False, "--manager", show_default=False, help="join new node with manag... |
print("")
print(f"docker swarm join --token {token} {manager_address}")
print("")
| log.info("To add a worker to this swarm, run the following command:")
token = docker.swarm.get_token("worker") | conditional_block |
join.py | import typer
from controller import log
from controller.app import Application
from controller.deploy.docker import Docker
@Application.app.command(help="Provide instructions to join new nodes")
def join(
manager: bool = typer.Option(
False, "--manager", show_default=False, help="join new node with manag... |
docker = Docker()
manager_address = "N/A"
# Search for the manager address
for node in docker.client.node.list():
role = node.spec.role
state = node.status.state
availability = node.spec.availability
if (
role == "manager"
and state == "ready"
... | ) -> None:
Application.print_command(
Application.serialize_parameter("--manager", manager, IF=manager),
)
Application.get_controller().controller_init() | random_line_split |
files.ts | _TAG_REQUEST_FAILED,
SET_SKIN_DATA,
LOADED,
LOADING,
} from "../actionTypes";
import LoadQueue from "../loadQueue";
import { removeAllTracks } from "./playlist";
import { setPreamp, setEqBand } from "./equalizer";
import { LoadStyle, Thunk, Track, EqfPreset, SkinData } from "../types";
// Lower is better
const ... | (
fileReferences: FileList,
loadStyle: LoadStyle,
atIndex: number | undefined
): Thunk {
const tracks: Track[] = Array.from(fileReferences).map(file => ({
blob: file,
defaultName: file.name,
}));
return loadMediaFiles(tracks, loadStyle, atIndex);
}
const SKIN_FILENAME_MATCHER = new RegExp("(wsz|zip... | addTracksFromReferences | identifier_name |
files.ts | _TAG_REQUEST_FAILED,
SET_SKIN_DATA,
LOADED,
LOADING,
} from "../actionTypes";
import LoadQueue from "../loadQueue";
import { removeAllTracks } from "./playlist";
import { setPreamp, setEqBand } from "./equalizer";
import { LoadStyle, Thunk, Track, EqfPreset, SkinData } from "../types";
// Lower is better
const ... | skinPlaylistStyle: skinData.playlistStyle,
skinCursors: skinData.cursors,
skinRegion: skinData.region,
skinGenLetterWidths: skinData.genLetterWidths,
skinGenExColors: skinData.genExColors,
} as SkinData,
});
} catch (e) {
console.error(e);
... | skinColors: skinData.colors, | random_line_split |
files.ts | _TAG_REQUEST_FAILED,
SET_SKIN_DATA,
LOADED,
LOADING,
} from "../actionTypes";
import LoadQueue from "../loadQueue";
import { removeAllTracks } from "./playlist";
import { setPreamp, setEqBand } from "./equalizer";
import { LoadStyle, Thunk, Track, EqfPreset, SkinData } from "../types";
// Lower is better
const ... |
}
if (metaData != null) {
const { artist, title, album } = metaData;
dispatch({
type: SET_MEDIA_TAGS,
artist,
title,
album,
// For now, we lie about these next three things.
// TODO: Ideally we would leave these as null and force a media data
... | {
dispatch(fetchMediaDuration(canonicalUrl, id));
} | conditional_block |
files.ts | _TAG_REQUEST_FAILED,
SET_SKIN_DATA,
LOADED,
LOADING,
} from "../actionTypes";
import LoadQueue from "../loadQueue";
import { removeAllTracks } from "./playlist";
import { setPreamp, setEqBand } from "./equalizer";
import { LoadStyle, Thunk, Track, EqfPreset, SkinData } from "../types";
// Lower is better
const ... | }
export function loadMedia(
e: React.DragEvent<HTMLDivElement>,
loadStyle: LoadStyle = LOAD_STYLE.NONE,
atIndex = 0
): Thunk {
const { files } = e.dataTransfer;
return async (dispatch, getState, { handleTrackDropEvent }) => {
if (handleTrackDropEvent) {
const tracks = await handleTrackDropEvent(e... | {
return (dispatch, getState) => {
loadQueue.push(
async () => {
try {
const duration = await genMediaDuration(url);
dispatch({ type: SET_MEDIA_DURATION, duration, id });
} catch (e) {
// TODO: Should we update the state to indicate that we don't know the length... | identifier_body |
test_webserver.py | from twisted.trial.unittest import TestCase
from mock import Mock
from twisted.web.test.test_web import DummyRequest
from twisted.web.http import OK, NOT_FOUND
from cryptosync.resources import make_site
def make_request(uri='', method='GET', args={}):
site = make_site(authenticator=Mock())
request = DummyReq... | (TestCase):
def test_root_resource_ok(self):
request = make_request()
self.assertEquals(request.responseCode, OK)
def test_root_resource_not_found_url(self):
request = make_request(uri='shouldneverfindthisthing')
self.assertEquals(request.responseCode, NOT_FOUND)
class Auth... | RootResourceResponseCodesTestCase | identifier_name |
test_webserver.py | from twisted.trial.unittest import TestCase
from mock import Mock
from twisted.web.test.test_web import DummyRequest
from twisted.web.http import OK, NOT_FOUND
from cryptosync.resources import make_site
def make_request(uri='', method='GET', args={}):
site = make_site(authenticator=Mock())
request = DummyReq... | self._try_auth({k: v}, '{"status": "failure"}') | conditional_block | |
test_webserver.py | from twisted.trial.unittest import TestCase
from mock import Mock
from twisted.web.test.test_web import DummyRequest
from twisted.web.http import OK, NOT_FOUND
from cryptosync.resources import make_site
def make_request(uri='', method='GET', args={}):
site = make_site(authenticator=Mock())
request = DummyReq... |
class AuthResourceTestCase(TestCase):
def _try_auth(self, credentials, expected):
request = make_request(uri='/auth/', method='POST', args=credentials)
self.assertEquals(request.responseCode, OK)
self.assertEquals(request.data, expected)
def test_auth_success_with_good_parameters(s... | def test_root_resource_ok(self):
request = make_request()
self.assertEquals(request.responseCode, OK)
def test_root_resource_not_found_url(self):
request = make_request(uri='shouldneverfindthisthing')
self.assertEquals(request.responseCode, NOT_FOUND) | identifier_body |
test_webserver.py | from twisted.trial.unittest import TestCase
from mock import Mock
from twisted.web.test.test_web import DummyRequest
from twisted.web.http import OK, NOT_FOUND
from cryptosync.resources import make_site
def make_request(uri='', method='GET', args={}): | resource = site.getResourceFor(request)
request.render(resource)
request.data = "".join(request.written)
return request
class RootResourceResponseCodesTestCase(TestCase):
def test_root_resource_ok(self):
request = make_request()
self.assertEquals(request.responseCode, OK)
de... | site = make_site(authenticator=Mock())
request = DummyRequest(uri.split('/'))
request.method = method
request.args = args | random_line_split |
sl-date-picker.js | import ko from 'knockout';
import template from 'text!./sl-date-picker.html';
import moment from 'moment';
import 'bootstrap-daterangepicker';
ko.bindingHandlers.SLDatePickerHandler = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var elem$ = this.myElem = $(element);
... | fromLabel: 'From',
toLabel: 'To',
customRangeLabel: 'Custom',
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'O... | {
elem$.daterangepicker({
format: 'MM/DD/YYYY',
startDate: moment(),
endDate: moment().add(365, 'days'),
singleDatePicker: true,
showDropdowns: true,
showWeekNumbers: true,
timePicker: false,
... | conditional_block |
sl-date-picker.js | import ko from 'knockout';
import template from 'text!./sl-date-picker.html';
import moment from 'moment';
import 'bootstrap-daterangepicker';
ko.bindingHandlers.SLDatePickerHandler = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var elem$ = this.myElem = $(element);
... | {
constructor(params) {
// params
this.isViewMode = params.isViewMode;
this.myDate = params.date;
this.myElem = undefined;
}
}
// This runs when the component is torn down. Put here any logic necessary to clean up,
// for example cancelling setTimeouts or disposing Knockout su... | SLDatePicker | identifier_name |
sl-date-picker.js | import ko from 'knockout';
import template from 'text!./sl-date-picker.html';
import moment from 'moment';
import 'bootstrap-daterangepicker';
ko.bindingHandlers.SLDatePickerHandler = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var elem$ = this.myElem = $(element);
... | applyLabel: 'Submit',
cancelLabel: 'Cancel',
fromLabel: 'From',
toLabel: 'To',
customRangeLabel: 'Custom',
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthNames: ['Jan... | separator: ' to ',
locale: { | random_line_split |
sl-date-picker.js | import ko from 'knockout';
import template from 'text!./sl-date-picker.html';
import moment from 'moment';
import 'bootstrap-daterangepicker';
ko.bindingHandlers.SLDatePickerHandler = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var elem$ = this.myElem = $(element);
... |
}
// This runs when the component is torn down. Put here any logic necessary to clean up,
// for example cancelling setTimeouts or disposing Knockout subscriptions/computeds.
SLDatePicker.prototype.dispose = function() { };
export default { viewModel: SLDatePicker, template: template };
| {
// params
this.isViewMode = params.isViewMode;
this.myDate = params.date;
this.myElem = undefined;
} | identifier_body |
WebGLUtils.ts | module WOZLLA.renderer {
function | (target, source) {
for(var i in source) {
if(typeof target[i] === 'undefined') {
target[i] = source[i];
}
}
return target;
}
/**
* @class WOZLLA.renderer.WebGLUtils
* @abstract
*/
export class WebGLUtils {
public static... | applyProperties | identifier_name |
WebGLUtils.ts | module WOZLLA.renderer {
function applyProperties(target, source) {
for(var i in source) {
if(typeof target[i] === 'undefined') {
target[i] = source[i];
}
}
return target;
}
/**
* @class WOZLLA.renderer.WebGLUtils
* @abstract | public static getGLContext(canvas, options?) {
var gl;
options = applyProperties(options || {}, {
alpha: true,
antialias: true,
premultipliedAlpha: false,
stencil:true
});
try {
gl = c... | */
export class WebGLUtils {
| random_line_split |
WebGLUtils.ts | module WOZLLA.renderer {
function applyProperties(target, source) {
for(var i in source) {
if(typeof target[i] === 'undefined') {
target[i] = source[i];
}
}
return target;
}
/**
* @class WOZLLA.renderer.WebGLUtils
* @abstract
*... |
return shader;
}
public static compileProgram(gl, vertexSrc, fragmentSrc) {
var vertexShader = WebGLUtils.compileShader(gl, gl.VERTEX_SHADER, vertexSrc);
var fragmentShader = WebGLUtils.compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);
var shaderProgra... | {
console.log(gl.getShaderInfoLog(shader));
return null;
} | conditional_block |
polytope.py | lines = []
planes = [Plane(co_nt,co_nt.Vector(islice(part.position,co_nt.dimension))) for part in self.parts]
las = self.line_apothem_square()
for pgroup in combinations(planes,co_nt.dimension-1):
try:
line = plane_line_intersection(co_nt,pgroup)
... | '-pix_fmt','rgb48be',
'-r','60',
'-i','-',
'-an',
'-vcodec',args.type, | random_line_split | |
polytope.py | (self,*args):
return self.shape.any_point(*self.translated(*args))
def contains(self,p):
return self.shape.contains(self.inv_orientation * (p - self.position))
def star_component(x):
return (x.numerator - 1) > x.denominator > 1
class LineSegment:
star = False
def __init__(self,index... | any_point | identifier_name | |
polytope.py | lated(*args))
def contains(self,p):
return self.shape.contains(self.inv_orientation * (p - self.position))
def star_component(x):
return (x.numerator - 1) > x.denominator > 1
class LineSegment:
star = False
def __init__(self,index,convex_ds,polygon):
self.index = index
self.... |
def plane_point_intersection(nt,planes):
assert nt.dimension == len(planes)
try:
return nt.Matrix(p.normal for p in planes).inverse()*nt.Vector(-p.d for p in planes)
except ValueError:
return None
def plane_line_intersection(nt,planes):
assert nt.dimension - 1 == len(planes)
v = ... | return 'Line({0!r},{1!r})'.format(self.p0,self.v) | identifier_body |
polytope.py | lated(*args))
def contains(self,p):
return self.shape.contains(self.inv_orientation * (p - self.position))
def star_component(x):
return (x.numerator - 1) > x.denominator > 1
class LineSegment:
star = False
def __init__(self,index,convex_ds,polygon):
self.index = index
self.... |
id = 1/denom
a = nt.dot(l2.p0 - l1.p0,l1.v)
b = nt.dot(l1.p0 - l2.p0,l2.v)
t1 = id*(a + d*b)
t2 = id*(d*a + b)
p1 = l1.point_at(t1)
p2 = l2.point_at(t2)
if abs(p1-p2) > 0.01: return None
return (p1 + p2) * 0.5, t1, t2
class Node:
def __init__(self,pos,planes,outer,alive=True):... | return None | conditional_block |
md5.d.ts | // Type definitions for js-md5 v0.3.0
// Project: https://github.com/emn178/js-md5
// Definitions by: Roland Greim <https://github.com/tigerxy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/
/// <reference path="../jquery/jquery.d.ts"/>
interface JQuery {
md5(value: string): string;
md5(v... | }
interface md5 {
(value: string): string;
(value: Array<any>): string;
(value: Uint8Array): string;
}
interface String {
md5(value: string): string;
md5(value: Array<any>): string;
md5(value: Uint8Array): string;
}
declare var md5: md5; | random_line_split | |
supertest-as-promised.d.ts | // Type definitions for SuperTest as Promised v2.0.2
// Project: https://github.com/WhoopInc/supertest-as-promised
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../superagent/superagent.d.ts' />
/// <reference path=".... |
interface Promise<T> extends PromiseBluebird<T> {
toPromise(): PromiseBluebird<T>;
}
interface Test extends superagent.Request<Test> {
url: string;
serverAddress(app: any, path: string): string;
expect(status: number): Promise<supertest.Response>;
expect(status: number, body:... | function agent(app?: any): supertest.SuperTest;
interface SuperTest extends superagent.SuperAgent<Test> {
} | random_line_split |
__init__.py | from_bytes(self, data):
data_values = [ord(char) for char in data]
value = 0
for byte_value in data_values:
value <<= 8
value += byte_value
return value
def to_bytes(self, i, size=1):
data = []
for _ in xra... | api_command | identifier_name | |
__init__.py | def __init__(self, api):
self.api = api
def write_lenght(self, length):
self.api.write_bytes(self.length_to_bytes(length))
def length_to_bytes(self, length):
if length < 0x80:
return self.to_bytes(length)
elif length < 0x4000:
length |= 0x8000
... |
def read_bytes(self, length):
received_overal = b''
while len(received_overal) < length:
try:
received = self.socket.recv(
length - len(received_overal))
except socket.error as e:
raise RosAPIConnectionError(str(e))
... | sent_overal = 0
while sent_overal < len(data):
try:
sent = self.socket.send(data[sent_overal:])
except socket.error as e:
raise RosAPIConnectionError(str(e))
if sent == 0:
raise RosAPIConnectionError('Connection closed by remote... | identifier_body |
__init__.py | def __init__(self, api):
self.api = api
def write_lenght(self, length):
self.api.write_bytes(self.length_to_bytes(length))
def length_to_bytes(self, length):
if length < 0x80:
return self.to_bytes(length)
elif length < 0x4000:
length |= 0x8000
... |
return result
def _encode_kwargs(self, kwargs):
return dict((k, v.encode('ascii')) for k, v in kwargs.items())
class RouterboardAPI(object):
def __init__(self, host, username='api', password='', port=8728, ssl=False):
self.host = host
self.username = username
self.pas... | for k in item:
item[k] = item[k].decode('ascii') | conditional_block |
__init__.py | def __init__(self, api):
self.api = api
def write_lenght(self, length):
self.api.write_bytes(self.length_to_bytes(length))
def length_to_bytes(self, length):
if length < 0x80:
return self.to_bytes(length)
elif length < 0x4000:
length |= 0x8000
... | key = key.decode('ascii')
if key in ['.id', '.proplist']:
key = key[1:]
elements.append((key, value))
return dict(elements)
def get(self, **kwargs):
return self.call('print', {}, kwargs)
def detailed_get(self, **kwargs):
return self.c... | for key, value in dictionary.items(): | random_line_split |
base32.rs | // This file is part of the uutils coreutils package.
//
// (c) Jian Zeng <anonymousknight96@gmail.com>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
//
#![crate_name = "uu_base32"]
#[macro_use]
extern crate uucore;
use uucore::encodi... | static SYNTAX: &'static str = "[OPTION]... [FILE]";
static SUMMARY: &'static str = "Base32 encode or decode FILE, or standard input, to standard output.";
static LONG_HELP: &'static str = "
With no FILE, or when FILE is -, read standard input.
The data are encoded as described for the base32 alphabet in RFC
4648.... | random_line_split | |
base32.rs | // This file is part of the uutils coreutils package.
//
// (c) Jian Zeng <anonymousknight96@gmail.com>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
//
#![crate_name = "uu_base32"]
#[macro_use]
extern crate uucore;
use uucore::encodi... | (args: Vec<String>) -> i32 {
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
.optflag("d", "decode", "decode data")
.optflag("i",
"ignore-garbage",
"when decoding, ignore non-alphabetic characters")
.optopt("w",
"wrap",
... | uumain | identifier_name |
base32.rs | // This file is part of the uutils coreutils package.
//
// (c) Jian Zeng <anonymousknight96@gmail.com>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
//
#![crate_name = "uu_base32"]
#[macro_use]
extern crate uucore;
use uucore::encodi... | }
None => 76,
};
if matches.free.len() > 1 {
disp_err!("extra operand ‘{}’", matches.free[0]);
return 1;
}
let input = if matches.free.is_empty() || &matches.free[0][..] == "-" {
BufReader::new(Box::new(stdin()) as Box<Read>)
} else {
let path = Path... | {
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
.optflag("d", "decode", "decode data")
.optflag("i",
"ignore-garbage",
"when decoding, ignore non-alphabetic characters")
.optopt("w",
"wrap",
"wrap encoded lines after... | identifier_body |
lib.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(box_syntax)]
#![feature(fnbox)]
#![feature(mpsc_select)]
#![feature(plugin)]
#![feature(plugin)]
#![plu... | extern crate tinyfiledialogs;
extern crate unicase;
extern crate url;
extern crate util;
extern crate uuid;
extern crate webrender_traits;
extern crate websocket;
pub mod about_loader;
pub mod chrome_loader;
pub mod cookie;
pub mod cookie_storage;
pub mod data_loader;
pub mod file_loader;
pub mod hsts;
pub mod http_lo... | extern crate rustc_serialize;
extern crate threadpool;
extern crate time;
#[cfg(any(target_os = "macos", target_os = "linux"))] | random_line_split |
materialize-css.d.ts | */
interface DropDownOptions {
/**
* The duration of the transition enter in milliseconds.
* Default: 300
*/
inDuration?:number;
/**
* The duration of the transition out in milliseconds.
* Default: 225
*/
outDuration?:number;
... | * Default: 400
*/
height?: number;
/**
* Set the duration of the transition animation in ms.
* Default: 500
*/
transition?: number;
/**
* Set the duration between transitions in ms.
* Default: 6000
*/
inter... | * Set height of slider. | random_line_split |
regress-133211.js | // Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... |
var o = {};
var x = {};
Object.defineProperty(o, "foo", { get: undefined });
Object.defineProperty(x, "foo", { get: undefined, set: undefined });
var pd = Object.getOwnPropertyDescriptor(o, "foo");
assertEquals(undefined, pd.set); |
// Make sure we don't leak maps when reading intermediate property descriptors. | random_line_split |
archive_cache.rs | use {
crate::{
cache::{ArchivedStructured, CacheRead, CacheWrite, OwnedRef, Structured},
deser::Deser,
storage::{Error, StorageRead, StorageWrite},
Addr,
},
log::warn,
rkyv::{
archived_value,
de::deserializers::AllocDeserializer,
ser::{serializers:... |
}
// we could have a concurrency issue here, where we read from storage twice.
// This is low-risk (ie won't corrupt data/etc), and should be tweaked based on
// what results in better performance.
// Optimizing for duplicate cache inserts vs holding the lock longer.
// ... | {
return Ok(Arc::clone(&buf));
} | conditional_block |
archive_cache.rs | use {
crate::{
cache::{ArchivedStructured, CacheRead, CacheWrite, OwnedRef, Structured},
deser::Deser,
storage::{Error, StorageRead, StorageWrite},
Addr,
},
log::warn,
rkyv::{
archived_value,
de::deserializers::AllocDeserializer,
ser::{serializers:... | <T>(&self, structured: T) -> Result<Addr, Error>
where
T: Into<Structured> + Send,
{
let structured = structured.into();
let addr = {
let deser_buf = Deser::default().to_vec(&structured).unwrap();
Addr::hash(&deser_buf)
};
let mut serializer = Writ... | write_structured | identifier_name |
archive_cache.rs | use {
crate::{
cache::{ArchivedStructured, CacheRead, CacheWrite, OwnedRef, Structured},
deser::Deser,
storage::{Error, StorageRead, StorageWrite},
Addr,
},
log::warn,
rkyv::{
archived_value,
de::deserializers::AllocDeserializer,
ser::{serializers:... |
fn into_owned(self) -> Structured {
let archived = self.as_ref();
let mut deserializer = AllocDeserializer;
let deserialized = archived.deserialize(&mut deserializer).unwrap();
deserialized
}
}
#[async_trait::async_trait]
impl<S> CacheWrite for ArchiveCache<S>
where
S: Stora... | {
unsafe {
archived_value::<Structured>(
self.0.as_slice(),
// we're only serializing to the beginning of the buf.
0,
)
}
} | identifier_body |
archive_cache.rs | use {
crate::{
cache::{ArchivedStructured, CacheRead, CacheWrite, OwnedRef, Structured},
deser::Deser,
storage::{Error, StorageRead, StorageWrite},
Addr,
},
log::warn,
rkyv::{
archived_value,
de::deserializers::AllocDeserializer,
ser::{serializers:... | let addr = Addr::hash(&buf);
self.write_buf(&addr, buf).await?;
Ok(addr)
}
async fn write_structured<T>(&self, structured: T) -> Result<Addr, Error>
where
T: Into<Structured> + Send,
{
let structured = structured.into();
let addr = {
let deser_... | random_line_split | |
slope_histogram_cumulative_graph.py | #!/usr/bin/env python
#/******************************************************************************
# * $Id$
# *
# * Project: GDAL Make Histogram and Cumulative graph from Tab delimited tab as
# generated by gdal_hist.py
# * Purpose: Take a gdal_hist.py output and create a histogram plot using matp... |
#set None for commandline options
name = ""
infile = None
outfile = None
# =============================================================================
# Parse command line arguments.
# =============================================================================
i = 1
while i < len(sys.argv):
arg = sys.argv[i]... | print 'Usage: slope_histogram_cumulative_graph.py -name "InSight E1" slope_histogram_table.tab outfile.png'
print " This program is geared to run on a table as generated by gdal_hist.py"
print 'slope_histogram_cumulative_graph.py -name "E_Marg_CE 01" DEM_1m_E_Marg_CE_adir_1m_hist.xls DEM_1m_E_Marg_CE_adir_1m_h... | identifier_body |
slope_histogram_cumulative_graph.py | #!/usr/bin/env python
#/******************************************************************************
# * $Id$
# *
# * Project: GDAL Make Histogram and Cumulative graph from Tab delimited tab as
# generated by gdal_hist.py
# * Purpose: Take a gdal_hist.py output and create a histogram plot using matp... | ():
print 'Usage: slope_histogram_cumulative_graph.py -name "InSight E1" slope_histogram_table.tab outfile.png'
print " This program is geared to run on a table as generated by gdal_hist.py"
print 'slope_histogram_cumulative_graph.py -name "E_Marg_CE 01" DEM_1m_E_Marg_CE_adir_1m_hist.xls DEM_1m_E_Marg_CE_a... | usage | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.