file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
SendFeedback.tsx | import {
Box,
Button,
CheckCircleIcon,
Flex,
Input,
Serif,
TextArea,
color,
} from "@artsy/palette"
import { SendFeedbackSearchResultsMutation } from "v2/__generated__/SendFeedbackSearchResultsMutation.graphql"
import { SystemContextProps } from "v2/Artsy"
import { withSystemContext } from "v2/Artsy"
im... | </Box>
<Box width="50%">
<Input
name="email"
placeholder="Email address"
onChange={({ currentTarget: { value } }) => {
this.setState({ email: value })
}}
required
error={this.errorForEmail()}
/>
... | this.setState({ name: value })
}}
required
error={this.errorForText("name")}
/> | random_line_split |
SendFeedback.tsx | import {
Box,
Button,
CheckCircleIcon,
Flex,
Input,
Serif,
TextArea,
color,
} from "@artsy/palette"
import { SendFeedbackSearchResultsMutation } from "v2/__generated__/SendFeedbackSearchResultsMutation.graphql"
import { SystemContextProps } from "v2/Artsy"
import { withSystemContext } from "v2/Artsy"
im... | () {
const { relayEnvironment } = this.props
const { message, name, email } = this.state
commitMutation<SendFeedbackSearchResultsMutation>(relayEnvironment, {
// TODO: Inputs to the mutation might have changed case of the keys!
mutation: graphql`
mutation SendFeedbackSearchResultsMutati... | handleClick | identifier_name |
SendFeedback.tsx | import {
Box,
Button,
CheckCircleIcon,
Flex,
Input,
Serif,
TextArea,
color,
} from "@artsy/palette"
import { SendFeedbackSearchResultsMutation } from "v2/__generated__/SendFeedbackSearchResultsMutation.graphql"
import { SystemContextProps } from "v2/Artsy"
import { withSystemContext } from "v2/Artsy"
im... | else {
this.setState({
submitted: true,
})
}
},
})
}
renderPersonalInfoInputs() {
return (
<LoggedOutInputContainer mt={2} alignContent="space-between">
<Box mr={1} width="50%">
<Input
name="name"
placeholder="Yo... | {
logger.error(
new ErrorWithMetadata(
feedbackOrError.mutationError.type,
feedbackOrError.mutationError.message
)
)
} | conditional_block |
SendFeedback.tsx | import {
Box,
Button,
CheckCircleIcon,
Flex,
Input,
Serif,
TextArea,
color,
} from "@artsy/palette"
import { SendFeedbackSearchResultsMutation } from "v2/__generated__/SendFeedbackSearchResultsMutation.graphql"
import { SystemContextProps } from "v2/Artsy"
import { withSystemContext } from "v2/Artsy"
im... |
renderPersonalInfoInputs() {
return (
<LoggedOutInputContainer mt={2} alignContent="space-between">
<Box mr={1} width="50%">
<Input
name="name"
placeholder="Your name"
onChange={({ currentTarget: { value } }) => {
this.setState({ name: va... | {
const { relayEnvironment } = this.props
const { message, name, email } = this.state
commitMutation<SendFeedbackSearchResultsMutation>(relayEnvironment, {
// TODO: Inputs to the mutation might have changed case of the keys!
mutation: graphql`
mutation SendFeedbackSearchResultsMutation(... | identifier_body |
countries.py | # -*- coding: utf-8 -*-
#
# TGiT, Music Tagger for Professionals
# Copyright (C) 2013 Iconoclaste Musique Inc.
#
# 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 2
# of the... | "AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
"AG": "Antigua and Barbuda",
"AR": "Argentina",
"AM": "Armenia",
"AW": "Aruba",
"AU": "Australia",
"AT": "Austria",
"AZ": "Azerbaijan",
"BS": "Bahamas",
"BH": "Bahrain",
"BD": "Ban... | "AF": "Afghanistan",
"AX": "Aland Islan",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
| random_line_split |
simdty.rs | // Copyright 2016 chacha20-poly1305-aead Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed exce... | (e0: T, e1: T, e2: T, e3: T) -> Simd4<T> {
Simd4(e0, e1, e2, e3)
}
}
unsafe impl<T: Safe> Safe for Simd4<T> {}
unsafe impl<T: Safe> Safe for Simd8<T> {}
unsafe impl<T: Safe> Safe for Simd16<T> {}
| new | identifier_name |
simdty.rs | // Copyright 2016 chacha20-poly1305-aead Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed exce... | pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T);
}
pub type u32x4 = Simd4<u32>;
pub type u16x8 = Simd8<u16>;
pub type u8x16 = Simd16<u8>;
#[cfg_attr(feature = "clippy", allow(inline_always))]
impl<T> Simd4<T... | pub T, pub T, pub T, pub T);
pub struct Simd16<T>(pub T, pub T, pub T, pub T, | random_line_split |
simdty.rs | // Copyright 2016 chacha20-poly1305-aead Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed exce... |
}
unsafe impl<T: Safe> Safe for Simd4<T> {}
unsafe impl<T: Safe> Safe for Simd8<T> {}
unsafe impl<T: Safe> Safe for Simd16<T> {}
| {
Simd4(e0, e1, e2, e3)
} | identifier_body |
whatchanged.py | """
The B{0install whatchanged} command-line interface.
"""
# Copyright (C) 2012, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import os
from zeroinstall import _, SafeException
from zeroinstall.cmd import UsageError
syntax = "APP-NAME"
def ... | changes = False
for iface, old_sel in old_selections.items():
new_sel = new_selections.get(iface, None)
if new_sel is None:
print(_("No longer used: %s") % iface)
changes = True
elif old_sel.version != new_sel.version:
print(_("%s: %s -> %s") % (iface, old_sel.version, new_sel.version))
changes = Tr... | identifier_body | |
whatchanged.py | """
The B{0install whatchanged} command-line interface.
"""
# Copyright (C) 2012, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import os
from zeroinstall import _, SafeException
from zeroinstall.cmd import UsageError
syntax = "APP-NAME"
| if len(args) != 1:
raise UsageError()
name = args[0]
app = config.app_mgr.lookup_app(name, missing_ok = False)
history = app.get_history()
if not history:
raise SafeException(_("Invalid application: no selections found! Try '0install destroy {name}'").format(name = name))
import time
last_checked = app.g... | def add_options(parser):
parser.add_option("", "--full", help=_("show diff of the XML"), action='store_true')
def handle(config, options, args): | random_line_split |
whatchanged.py | """
The B{0install whatchanged} command-line interface.
"""
# Copyright (C) 2012, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import os
from zeroinstall import _, SafeException
from zeroinstall.cmd import UsageError
syntax = "APP-NAME"
def ... | (config, options, args):
if len(args) != 1:
raise UsageError()
name = args[0]
app = config.app_mgr.lookup_app(name, missing_ok = False)
history = app.get_history()
if not history:
raise SafeException(_("Invalid application: no selections found! Try '0install destroy {name}'").format(name = name))
import ti... | handle | identifier_name |
whatchanged.py | """
The B{0install whatchanged} command-line interface.
"""
# Copyright (C) 2012, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import os
from zeroinstall import _, SafeException
from zeroinstall.cmd import UsageError
syntax = "APP-NAME"
def ... |
print(_("Last update : {date}").format(date = history[0]))
current_sels = app.get_selections(snapshot_date = history[0])
if len(history) == 1:
print(_("No previous history to compare against."))
print(_("Use '0install select {name}' to see the current selections.").format(name = name))
return
print(_(... | print(_("Last attempted update: {date}").format(date = time.ctime(last_attempt))) | conditional_block |
groupGraphPrediction.js |
function dataVar(name, color) {
this.data = [];
this.name = name;
this.color = color;
}
function Graph(container, measureUnit) {
this.group = [];
maxX = null;
minX = null;
var margin = {
top : 10,
right : 150,
bottom : 10,
left : 60
},
aspectRatio = 3 / 1,
conW = 800 //$(window).width(),
width =... | lse {
//console.log("updating " + measureUnit);
maxX = d3.max(this.group, function (v) {
return d3.max(v.data, function (e) {
return Number(e.timestamp)
});
});
minX = d3.min(this.group, function (v) {
return d3.min(v.data, function (e) {
return Number(e.timestamp)
});
}... | //console.log("updating " + measureUnit +" with date");
minX = d1;
maxX = d2;
} e | conditional_block |
groupGraphPrediction.js |
function dataVar(name, color) |
function Graph(container, measureUnit) {
this.group = [];
maxX = null;
minX = null;
var margin = {
top : 10,
right : 150,
bottom : 10,
left : 60
},
aspectRatio = 3 / 1,
conW = 800 //$(window).width(),
width = conW - margin.left - margin.right,
height = (conW / aspectRatio) - margin.top - margin.bo... | {
this.data = [];
this.name = name;
this.color = color;
} | identifier_body |
groupGraphPrediction.js | function dataVar(name, color) {
this.data = [];
this.name = name;
this.color = color;
}
function Graph(container, measureUnit) {
this.group = [];
maxX = null;
minX = null;
var margin = {
top : 10, | conW = 800 //$(window).width(),
width = conW - margin.left - margin.right,
height = (conW / aspectRatio) - margin.top - margin.bottom;
var gr = d3.select(container).append("svg")
.attr("viewBox", "0 0 " + (width + margin.left + margin.right) + " " + (height + margin.top + margin.bottom))
.attr("preserveAspec... | right : 150,
bottom : 10,
left : 60
},
aspectRatio = 3 / 1, | random_line_split |
groupGraphPrediction.js |
function | (name, color) {
this.data = [];
this.name = name;
this.color = color;
}
function Graph(container, measureUnit) {
this.group = [];
maxX = null;
minX = null;
var margin = {
top : 10,
right : 150,
bottom : 10,
left : 60
},
aspectRatio = 3 / 1,
conW = 800 //$(window).width(),
width = conW - margin.le... | dataVar | identifier_name |
hero.service.ts | /**
* Created by khjan on 2017-03-04.
*/
import {Injectable} from '@angular/core';
import { Headers, Http} from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Hero } from './hero';
@Injectable()
export class HeroService{
private heroesUrl = 'api/heroes';
private headers = new Headers({'Con... |
update(hero : Hero) : Promise<Hero>{
const url = `${this.heroesUrl}/${hero.id}`;
return this.http.put(url, JSON.stringify(hero), {headers : this.headers})
.toPromise()
.then(() => hero)
.catch(this.handleError);
}
create(name : string) : Promise<Hero>{
... | {
const url = `${this.heroesUrl}/${id}`;
return this.http.get(url)
.toPromise()
.then(response => response.json().data as Hero)
.catch(this.handleError);
} | identifier_body |
hero.service.ts | /**
* Created by khjan on 2017-03-04. | import {Injectable} from '@angular/core';
import { Headers, Http} from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Hero } from './hero';
@Injectable()
export class HeroService{
private heroesUrl = 'api/heroes';
private headers = new Headers({'Content-Type': 'application/json'});
cons... | */ | random_line_split |
hero.service.ts | /**
* Created by khjan on 2017-03-04.
*/
import {Injectable} from '@angular/core';
import { Headers, Http} from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Hero } from './hero';
@Injectable()
export class | {
private heroesUrl = 'api/heroes';
private headers = new Headers({'Content-Type': 'application/json'});
constructor(private http:Http){}
getHeroes() : Promise<Hero[]> {
return this.http.get(this.heroesUrl)
.toPromise()
.then(response => response.json().data as Hero[])
... | HeroService | identifier_name |
app.js | var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
var app = express()... |
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: err
});
});
}
// production error handler
// n... | // error handlers | random_line_split |
app.js | var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
var app = express()... |
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});
module.exports = app;
| {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: err
});
});
} | conditional_block |
index.js | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* 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 a... | console.log( 'Mode = %d', mode );
// => 'Mode = 10'
var s2 = hypergeometric.variance;
console.log( 'Variance = %d', s2 );
// => 'Variance = 4.040404040404041'
var y = hypergeometric.cdf( 10.5 );
console.log( 'F(10.5) = %d', y );
// => 'F(10.5) = 0.5984356088532534' | var mode = hypergeometric.mode; | random_line_split |
jquery.mmenu.bootstrap.ts | /*
* Bootstrap wrapper for jQuery mmenu
* Include this file after including the jquery.mmenu plugin for default Bootstrap tabs, pills and navbar support.
*/
(function( $ ) {
const _PLUGIN_ = 'mmenu';
const _WRAPPR_ = 'bootstrap';
// Set some config
$[ _PLUGIN_ ].configuration.classNames.selected = 'active'... | .removeClass( 'dropdown' );
$dropdown
.children( '.dropdown-toggle' )
.find( '.caret' ).remove().end()
.each(
function()
{
$(this).replaceWith( '<span>' + $(this).html() + '</span>' );
}
);
$dropdown
.children( '.dropdown-menu' )
.removeClass( 'dropdown-menu' ... | random_line_split | |
jquery.mmenu.bootstrap.ts | /*
* Bootstrap wrapper for jQuery mmenu
* Include this file after including the jquery.mmenu plugin for default Bootstrap tabs, pills and navbar support.
*/
(function( $ ) {
const _PLUGIN_ = 'mmenu';
const _WRAPPR_ = 'bootstrap';
// Set some config
$[ _PLUGIN_ ].configuration.classNames.selected = 'active'... |
},
dropdown: function()
{
var $dropdown = this.$menu.find( '.dropdown' );
$dropdown
.removeClass( 'dropdown' );
$dropdown
.children( '.dropdown-toggle' )
.find( '.caret' ).remove().end()
.each(
function()
{
$(this).replaceWith( '<span>' + $(this).html() + '</span>' );
... | {
this.$menu.find( '[' + attrs[ a ] + ']' ).removeAttr( attrs[ a ] );
} | conditional_block |
multi-layer.py | import numpy as np
def sigmoid(x):
|
# Network size
N_input = 4
N_hidden = 3
N_output = 2
np.random.seed(42)
# Make some fake data
X = np.random.randn(4)
weights_input_to_hidden = np.random.normal(
0, scale=0.1, size=(N_input, N_hidden))
weights_hidden_to_output = np.random.normal(
0, scale=0.1, size=(N_hidden, N_output))
# Make a forward pa... | """
Calculate sigmoid
"""
return 1 / (1 + np.exp(-x)) | identifier_body |
multi-layer.py | import numpy as np
def | (x):
"""
Calculate sigmoid
"""
return 1 / (1 + np.exp(-x))
# Network size
N_input = 4
N_hidden = 3
N_output = 2
np.random.seed(42)
# Make some fake data
X = np.random.randn(4)
weights_input_to_hidden = np.random.normal(
0, scale=0.1, size=(N_input, N_hidden))
weights_hidden_to_output = np.random.... | sigmoid | identifier_name |
multi-layer.py | import numpy as np
def sigmoid(x):
"""
Calculate sigmoid
""" |
# Network size
N_input = 4
N_hidden = 3
N_output = 2
np.random.seed(42)
# Make some fake data
X = np.random.randn(4)
weights_input_to_hidden = np.random.normal(
0, scale=0.1, size=(N_input, N_hidden))
weights_hidden_to_output = np.random.normal(
0, scale=0.1, size=(N_hidden, N_output))
# Make a forward pas... | return 1 / (1 + np.exp(-x)) | random_line_split |
imagecreator.py |
# Python standard library
from os import path, listdir
from ConfigParser import ConfigParser
# Third-party libraries
from imagecraft import ImageGenerator
# Django settings
from django.conf import settings
# This module
from cleaver import ini_to_context, flatten_context
# Retrieve execution params
MEDIA_ROOT = g... | (ImageGenerator):
"""Dynamically generates images by using arguments instead of constants"""
#layers = None
_default_source_path = CLEVERCSS_IMAGE_SOURCE
_default_output_path = CLEVERCSS_IMAGE_OUTPUT
image_format = 'PNG'
def __init__(self, color_dict, source_path=None, output_path=None,
... | DynamicImageGenerator | identifier_name |
imagecreator.py | # Python standard library
from os import path, listdir
from ConfigParser import ConfigParser
# Third-party libraries
from imagecraft import ImageGenerator
# Django settings
from django.conf import settings
# This module
from cleaver import ini_to_context, flatten_context
# Retrieve execution params
MEDIA_ROOT = ge... | output_path)
def generate_images():
"""Reads the context file and uses it to execute all CLEVERCSS_IMAGE_JOBS
specified in a settings file"""
# If there are no jobs, die
if not CLEVERCSS_IMAGE_JOBS:
return
context = flatten_context(ini_t... | random_line_split | |
imagecreator.py |
# Python standard library
from os import path, listdir
from ConfigParser import ConfigParser
# Third-party libraries
from imagecraft import ImageGenerator
# Django settings
from django.conf import settings
# This module
from cleaver import ini_to_context, flatten_context
# Retrieve execution params
MEDIA_ROOT = g... | layers = values.values()
DynamicImageGenerator(context, layers=layers,
output_filename=filename).render() | conditional_block | |
imagecreator.py |
# Python standard library
from os import path, listdir
from ConfigParser import ConfigParser
# Third-party libraries
from imagecraft import ImageGenerator
# Django settings
from django.conf import settings
# This module
from cleaver import ini_to_context, flatten_context
# Retrieve execution params
MEDIA_ROOT = g... | """Reads the context file and uses it to execute all CLEVERCSS_IMAGE_JOBS
specified in a settings file"""
# If there are no jobs, die
if not CLEVERCSS_IMAGE_JOBS:
return
context = flatten_context(ini_to_context())
# Unpack SortedDict with tuple for values
for filename, values in CLEVE... | identifier_body | |
tokenization_bert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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/LICEN... |
return super(BertTokenizer, cls)._from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
class BasicTokenizer(object):
"""Runs basic tokenization (punctuation splitting, lower casing, etc.)."""
def __init__(self, do_lower_case=True, never_split=None, tokenize_chinese_chars=True):
... | logger.warning("The pre-trained model you are loading is an uncased model but you have set "
"`do_lower_case` to False. We are setting `do_lower_case=True` for you "
"but you may want to check this behavior.")
kwargs['do_lower_case'] = True | conditional_block |
tokenization_bert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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/LICEN... |
def _is_whitespace(char):
"""Checks whether `chars` is a whitespace character."""
# \t, \n, and \r are technically contorl characters but we treat them
# as whitespace since they are generally considered as such.
if char == " " or char == "\t" or char == "\n" or char == "\r":
return True
... | """Runs WordPiece tokenization."""
def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
self.vocab = vocab
self.unk_token = unk_token
self.max_input_chars_per_word = max_input_chars_per_word
def tokenize(self, text):
"""Tokenizes a piece of text into its word pie... | identifier_body |
tokenization_bert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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/LICEN... | (self, token):
""" Converts a token (str/unicode) in an id using the vocab. """
return self.vocab.get(token, self.vocab.get(self.unk_token))
def _convert_id_to_token(self, index):
"""Converts an index (integer) in a token (string/unicode) using the vocab."""
return self.ids_to_token... | _convert_token_to_id | identifier_name |
tokenization_bert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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/LICEN... | else:
split_tokens = self.wordpiece_tokenizer.tokenize(text)
return split_tokens
def _convert_token_to_id(self, token):
""" Converts a token (str/unicode) in an id using the vocab. """
return self.vocab.get(token, self.vocab.get(self.unk_token))
def _convert_id_to_t... | if self.do_basic_tokenize:
for token in self.basic_tokenizer.tokenize(text, never_split=self.all_special_tokens):
for sub_token in self.wordpiece_tokenizer.tokenize(token):
split_tokens.append(sub_token) | random_line_split |
PackageVariable.py | """engine.SCons.Variables.PackageVariable
This file defines the option type for SCons implementing 'package
activation'.
To be used whenever a 'package' may be enabled/disabled and the
package path may be specified.
Usage example:
Examples:
x11=no (disables X11 support)
x11=yes (will search for the... |
def _validator(key, val, env, searchfunc):
# NB: searchfunc is currenty undocumented and unsupported
"""
"""
# todo: write validator, check for path
import os
if env[key] is True:
if searchfunc:
env[key] = searchfunc(key, val)
elif env[key] and not os.path.exists(val):... | """
"""
lval = val.lower()
if lval in __enable_strings: return True
if lval in __disable_strings: return False
#raise ValueError("Invalid value for boolean option: %s" % val)
return val | identifier_body |
PackageVariable.py | """engine.SCons.Variables.PackageVariable
This file defines the option type for SCons implementing 'package
activation'.
To be used whenever a 'package' may be enabled/disabled and the
package path may be specified.
Usage example:
Examples:
x11=no (disables X11 support)
x11=yes (will search for the... | (key, help, default, searchfunc=None):
# NB: searchfunc is currenty undocumented and unsupported
"""
The input parameters describe a 'package list' option, thus they
are returned with the correct converter and validator appended. The
result is usable for input to opts.Add() .
A 'package list' o... | PackageVariable | identifier_name |
PackageVariable.py | """engine.SCons.Variables.PackageVariable
This file defines the option type for SCons implementing 'package
activation'.
To be used whenever a 'package' may be enabled/disabled and the
package path may be specified.
Usage example:
Examples:
x11=no (disables X11 support)
x11=yes (will search for the... |
elif env[key] and not os.path.exists(val):
raise SCons.Errors.UserError(
'Path does not exist for option %s: %s' % (key, val))
def PackageVariable(key, help, default, searchfunc=None):
# NB: searchfunc is currenty undocumented and unsupported
"""
The input parameters describe a 'p... | env[key] = searchfunc(key, val) | conditional_block |
PackageVariable.py | """engine.SCons.Variables.PackageVariable
This file defines the option type for SCons implementing 'package
activation'.
To be used whenever a 'package' may be enabled/disabled and the
package path may be specified. |
Examples:
x11=no (disables X11 support)
x11=yes (will search for the package installation dir)
x11=/usr/local/X11 (will check this path for existance)
To replace autoconf's --with-xxx=yyy
opts = Variables()
opts.Add(PackageVariable('x11',
'use X11 installed here... |
Usage example: | random_line_split |
library_property.py | #!/usr/bin/python
# Copyright 2004 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Test that the <library> property has no effect on "obj" targets. Previously,
# it affected all targets, so
#
# project : ... | project : requirements <library>lib//x ;
exe a : a.cpp foo ;
obj foo : foo.cpp : <variant>release ;
""")
t.write("a.cpp", """
void aux();
int main() { aux(); }
""")
t.write("foo.cpp", """
void gee();
void aux() { gee(); }
""")
t.write("lib/x.cpp", """
void
#if defined(_WIN32)
__declspec(dllexport)
#endif
gee() {}
""... | random_line_split | |
filter.rs | use htslib::bam::record::Record;
pub trait RecordCheck {
fn valid(&self, rec: &Record) -> bool;
fn vir_pos(&self, rec: &Record) -> i32;
}
pub struct SingleChecker {
pub tail_edge: bool,
pub exact_length: bool,
pub read_length: usize,
pub min_quality: u8,
}
fn vir_pos_common(read_length: usize... | (&self, record: &Record) -> bool {
!record.is_unmapped() && (!self.exact_length || record.seq().len() == self.read_length) && record.mapq() >= self.min_quality
}
fn vir_pos(&self, rec: &Record) -> i32 {
vir_pos_common(self.read_length, self.tail_edge, self.exact_length, rec)
}
}
#[derive(C... | valid | identifier_name |
filter.rs | use htslib::bam::record::Record;
pub trait RecordCheck {
fn valid(&self, rec: &Record) -> bool;
fn vir_pos(&self, rec: &Record) -> i32;
}
pub struct SingleChecker {
pub tail_edge: bool,
pub exact_length: bool,
pub read_length: usize,
pub min_quality: u8,
}
fn vir_pos_common(read_length: usize... | return false;
}
}
// filter for specific pair in paired reads
match self.select_pair {
Some( side ) => {
match side {
PairPosition::First => {
if !record.is_first_in_template() {
... | let dist = (record.pos() - record.mpos()).abs() + self.read_length as i32; // TODO FIX!
if dist < self.min_dist || dist > self.max_dist { | random_line_split |
__init__.py | # #START_LICENSE###########################################################
#
#
#
# #END_LICENSE#############################################################
# Note that the use of "from x import *" is safe here. Modules include
# the __all__ variable.
from sys import stderr
from coretype.tree import *
from coretype.... | from nexml import Nexml, NexmlTree
from evol import EvolTree
try:
from coretype.arraytable import *
except ImportError, e:
print >>stderr, "Clustering module could not be loaded"
print e
else:
from clustering.clustertree import *
try:
from phylomedb.phylomeDB3 import *
except ImportError, e:
p... | from phyloxml import Phyloxml, PhyloxmlTree | random_line_split |
__init__.py | # #START_LICENSE###########################################################
#
#
#
# #END_LICENSE#############################################################
# Note that the use of "from x import *" is safe here. Modules include
# the __all__ variable.
from sys import stderr
from coretype.tree import *
from coretype.... |
try:
from phylomedb.phylomeDB3 import *
except ImportError, e:
print >>stderr, " MySQLdb module could not be loaded"
print e
try:
from treeview.main import *
from treeview.faces import *
from treeview import faces
from treeview import layouts
from treeview.svg_colors import *
except I... | from clustering.clustertree import * | conditional_block |
metrics.rs | use memmap::{Protection, Mmap};
use std::fs::File;
use std::io::{ErrorKind, Error};
use std::fmt::{self, Display, Formatter};
use std::str::Chars;
use text::style::{Style, StyleFlags};
use text::default::{DefaultMetrics, character_to_default};
// Each glyph takes up to 9x9 pixels.
#[derive(Debug, Copy, Clone, Eq, Par... |
// Incoming: an ASCII width from 0 to 8.
pub fn from_default_width(width: u8) -> Self {
if width == 0 {
GlyphSize::empty()
} else {
GlyphSize::new(0, (width * 2) - 1)
}
}
/// Returns the left side of the glyph, the X position of the leftmost column of pixels. This is from 0 to 15.
pub fn left(&self... | GlyphSize((left << 4) | (right & 15))
} | random_line_split |
metrics.rs | use memmap::{Protection, Mmap};
use std::fs::File;
use std::io::{ErrorKind, Error};
use std::fmt::{self, Display, Formatter};
use std::str::Chars;
use text::style::{Style, StyleFlags};
use text::default::{DefaultMetrics, character_to_default};
// Each glyph takes up to 9x9 pixels.
#[derive(Debug, Copy, Clone, Eq, Par... |
/// Returns the advance width of the specified character in this font. The advance is the distance from the leftmost point to the rightmost point on the character's baseline.
/// In MC fonts, this is 0.0 to 9.0.
/// Note that this function returns the exact advance after rendering, while Minecraft char sizing may... | {
self.right() + 1 - self.left()
} | identifier_body |
metrics.rs | use memmap::{Protection, Mmap};
use std::fs::File;
use std::io::{ErrorKind, Error};
use std::fmt::{self, Display, Formatter};
use std::str::Chars;
use text::style::{Style, StyleFlags};
use text::default::{DefaultMetrics, character_to_default};
// Each glyph takes up to 9x9 pixels.
#[derive(Debug, Copy, Clone, Eq, Par... | (self) -> Option<usize> {
let mut accumulator = 0;
for adv in self {
accumulator += match adv {
Some(advance) => advance as usize,
None => return None
};
}
Some(accumulator)
}
}
impl<'a, I> Iterator for AdvanceRun<'a, I> where I: Iterator<Item=char> {
type Item = Option<u8>;
fn next(&m... | total | identifier_name |
metrics.rs | use memmap::{Protection, Mmap};
use std::fs::File;
use std::io::{ErrorKind, Error};
use std::fmt::{self, Display, Formatter};
use std::str::Chars;
use text::style::{Style, StyleFlags};
use text::default::{DefaultMetrics, character_to_default};
// Each glyph takes up to 9x9 pixels.
#[derive(Debug, Copy, Clone, Eq, Par... | ,
TryNext::Retry => (),
TryNext::Inner(inner) => return Some(inner)
}
}
}
}
pub struct AdvanceRun<'a, I> where I: Iterator<Item=char> {
iter: I,
bold: bool,
metrics: &'a Metrics
}
impl<'a, I> AdvanceRun<'a, I> where I: Iterator<Item=char> {
pub fn total(self) -> Option<usize> {
let mut accumulator... | {self.current = None; return None} | conditional_block |
analytics_modal.tsx | /*
* Copyright 2019 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | (): m.Children {
const models: Frame[] = [];
_.each(this.supportedAnalytics, (agentAnalytics, pluginId) => {
_.each(agentAnalytics, (metric: AnalyticsCapability, i: number) => {
models.push(this.createModel(i, pluginId, metric));
});
});
return models.map((model: Frame) => <Analytic... | body | identifier_name |
analytics_modal.tsx | /*
* Copyright 2019 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | model = this.namespace.modelFor(uid);
model.url(this.namespace.toUrl(uid, this.getUrlParams()));
model.pluginId(pluginId);
model.title(metric.title);
return model;
}
buttons(): m.ChildArray {
return [];
}
protected abstract getUrlParams(): { [key: string]: string | number };
} |
createModel(index: number, pluginId: string, metric: AnalyticsCapability): Frame {
const uid = this.namespace.uid(index, pluginId, metric.type, metric), | random_line_split |
analytics_modal.tsx | /*
* Copyright 2019 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
body(): m.Children {
const models: Frame[] = [];
_.each(this.supportedAnalytics, (agentAnalytics, pluginId) => {
_.each(agentAnalytics, (metric: AnalyticsCapability, i: number) => {
models.push(this.createModel(i, pluginId, metric));
});
});
return models.map((model: Frame) => <... | {
super(Size.large);
this.entity = entity;
this.supportedAnalytics = supportedAnalytics;
this.namespace = namespace;
} | identifier_body |
capture-and-send.py | #!/usr/bin/env python
# Script to capture the screen with GTK, and format and send
# to a TV backlighting system.
#
# Copyright 2013 Daniel Foote.
#
# 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 Licens... |
# Right side, bottom to top.
x = real_width
for y in range(real_height, 0, -1):
colour = colourfor(pixel_array, x, y, configuration['colour_divisor'])
# print "%d, %d: %X" % (x, y, colour)
network_message += struct.pack('<I', colour)
# Top side, right to left.
y = black_top
for x in range(real_width, 0, ... | colour = colourfor(pixel_array, x, y, configuration['colour_divisor'])
# print "%d, %d: %X" % (x, y, colour)
network_message += struct.pack('<I', colour) | conditional_block |
capture-and-send.py | #!/usr/bin/env python
# Script to capture the screen with GTK, and format and send
# to a TV backlighting system.
#
# Copyright 2013 Daniel Foote.
#
# 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 Licens... | (pa, x, y, scale = 1):
"""
Helper function to get a pixel from a Numpy pixel array and
reassemble it.
"""
raw_pixel = pa[y][x]
red = raw_pixel[0] / scale
green = raw_pixel[1] / scale
blue = raw_pixel[2] / scale
colour = (red * 256 * 256) + (green * 256) + blue
return colour
while True:
start = time.time()
... | colourfor | identifier_name |
capture-and-send.py | #!/usr/bin/env python
# Script to capture the screen with GTK, and format and send
# to a TV backlighting system.
#
# Copyright 2013 Daniel Foote.
#
# 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 Licens... |
while True:
start = time.time()
# Fetch, scale down.
screen_contents = screen_contents.get_from_drawable(window, window.get_colormap(), 0, 0, 0, 0, size[0], size[1])
captime = time.time()
# Scale into the current buffer.
screen_contents.scale(screen_buffers[current_buffer], 0, 0, configuration['size_x'], conf... | """
Helper function to get a pixel from a Numpy pixel array and
reassemble it.
"""
raw_pixel = pa[y][x]
red = raw_pixel[0] / scale
green = raw_pixel[1] / scale
blue = raw_pixel[2] / scale
colour = (red * 256 * 256) + (green * 256) + blue
return colour | identifier_body |
capture-and-send.py | #!/usr/bin/env python
# Script to capture the screen with GTK, and format and send
# to a TV backlighting system.
#
# Copyright 2013 Daniel Foote.
#
# 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 Licens... | # Left side, top to bottom.
x = 0
for y in range(real_height):
colour = colourfor(pixel_array, x, y, configuration['colour_divisor'])
# print "%d, %d: %X" % (x, y, colour)
network_message += struct.pack('<I', colour)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(network_message, (confi... | for x in range(real_width, 0, -1):
colour = colourfor(pixel_array, x, y, configuration['colour_divisor'])
# print "%d, %d: %X" % (x, y, colour)
network_message += struct.pack('<I', colour)
| random_line_split |
AuctionHouseOptions.tests.tsx | ArtworkFiltersState,
ArtworkFiltersStoreProvider,
} from "app/Components/ArtworkFilter/ArtworkFilterStore"
import { renderWithWrappersTL } from "app/tests/renderWithWrappers"
import React from "react"
import { AuctionHouseOptionsScreen } from "./AuctionHouseOptions"
import { getEssentialProps } from "./helper"
des... | import { fireEvent } from "@testing-library/react-native"
import { | random_line_split | |
command.ts | import {
Command,
CommandBus,
CommandBusNotificationMap,
EmittableCommandBus,
ObservableCommandBus,
} from "@tmorin/ceb-messaging-core"
/**
* The map of the internal events for commands handling.
*/
export interface IpcCommandBusNotificationMap extends CommandBusNotificationMap {
command_forwar... | * @template K the type of the internal event
*/
off<K extends keyof IpcCommandBusNotificationMap>(
type?: K,
listener?: (event: IpcCommandBusNotificationMap[K]) => any
): this
}
/**
* The emitter view of an an {@link CommandBus}.
*/
export interface IpcEmitterCommandBus extends EmittableCommandBus ... | /**
* Remove listeners.
* @param type the type of the event
* @param listener the listener | random_line_split |
seal.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... | {
/// Ethereum seal.
#[serde(rename="ethereum")]
Ethereum(Ethereum),
/// Generic seal.
#[serde(rename="generic")]
Generic(Generic),
}
#[cfg(test)]
mod tests {
use serde_json;
use spec::Seal;
#[test]
fn builtin_deserialization() {
let s = r#"[{
"ethereum": {
"nonce": "0x0000000000000042",
"mixH... | Seal | identifier_name |
seal.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... |
//! Spec seal deserialization.
use hash::{H64, H256};
use bytes::Bytes;
/// Ethereum seal.
#[derive(Debug, PartialEq, Deserialize)]
pub struct Ethereum {
/// Seal nonce.
pub nonce: H64,
/// Seal mix hash.
#[serde(rename="mixHash")]
pub mix_hash: H256,
}
/// Generic seal.
#[derive(Debug, PartialEq, Deserialize)... |
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | random_line_split |
seal.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... |
}
| {
let s = r#"[{
"ethereum": {
"nonce": "0x0000000000000042",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},{
"generic": {
"fields": 1,
"rlp": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"
}
}]"#;
let _deserialized: Vec<Seal... | identifier_body |
jquery.simpler-sidebar.js | /*! simpler-sidebar v1.4.9 (https://github.com/dcdeiv/simpler-sidebar)
** Copyright (c) 2015 - 2016 Davide Di Criscito
** Dual licensed under MIT and GPL-2.0
*/
( function( $ ) {
$.fn.simplerSidebar = function( options ) {
var cfg = $.extend( true, $.fn.simplerSidebar.settings, options );
return this.each( function... | else {
console.log( "ERR mask.display: you typed \"" + cfg.mask.display + "\". You should choose between true or false." );
}
//Opening and closing the Sidebar when $opener is clicked
$opener.click( function() {
var isWhat = $sidebar.attr( "data-" + attr ),
csbw = $sidebar.width();
animationReset[... | {
if ( [ true, "true" ].indexOf( cfg.mask.display ) !== -1 ) {
$mask.appendTo( "body" ).css( maskStyle );
}
} | conditional_block |
jquery.simpler-sidebar.js | /*! simpler-sidebar v1.4.9 (https://github.com/dcdeiv/simpler-sidebar)
** Copyright (c) 2015 - 2016 Davide Di Criscito
** Dual licensed under MIT and GPL-2.0
*/
( function( $ ) {
$.fn.simplerSidebar = function( options ) {
var cfg = $.extend( true, $.fn.simplerSidebar.settings, options );
return this.each( function... | $sidebar.on( "click", $links, closeSidebar );
//Adjusting width;
$( window ).resize( function() {
var rsbw, update,
isWhat = $sidebar.attr( "data-" + attr ),
nw = $( window ).width();
if ( nw < winMaxW ) {
rsbw = nw - gap;
} else {
rsbw = sbMaxW;
}
update = {
width: rsbw
}... | random_line_split | |
bug4337.js | /*
* Copyright (c) 2012-2016 André Bargull
* Alle Rechte vorbehalten / All Rights Reserved. Use is subject to license terms.
*
* <https://github.com/anba/es6draft>
*/
const {
assertSame
} = Assert;
// Annex E: Completion reform changes
// https://bugs.ecmascript.org/show_bug.cgi?id=4337
// If-Statement comple... | assertSame(1, eval(`switch (0) { case 0: 1; case 1: }`));
assertSame(1, eval(`switch (0) { case 0: 1; default: }`));
// Try-Statement completion value
assertSame(1, eval(`L: try { throw null } catch (e) { ; } finally { 1; break L; }`)); | random_line_split | |
display-column.directive.ts | import { Directive, EmbeddedViewRef, Input, OnInit, Renderer2, TemplateRef, ViewContainerRef } from '@angular/core';
import { combineLatest } from 'rxjs';
import { PlexColumnDirective } from './columns.directive';
@Directive({
// tslint:disable-next-line:directive-selector
selector: '[plTableCol]'
})
export cl... |
ngOnInit() {
combineLatest([
this.table.columns$,
this.table.displayColumns$
]).subscribe(([definitions, cols]) => {
const colDef = definitions.find(item => item.key === this.name);
if (cols[this.name]) {
this.createView(colDef.right)... | {
} | identifier_body |
display-column.directive.ts | import { Directive, EmbeddedViewRef, Input, OnInit, Renderer2, TemplateRef, ViewContainerRef } from '@angular/core';
import { combineLatest } from 'rxjs';
import { PlexColumnDirective } from './columns.directive';
@Directive({
// tslint:disable-next-line:directive-selector
selector: '[plTableCol]'
})
export cl... |
});
}
private createView(right: boolean) {
if (!this.viewRef) {
this.viewRef = this.view.createEmbeddedView(this.nextRef);
if (right) {
this.render.addClass(this.viewRef.rootNodes[0], 'column-right');
}
}
}
private cleanView(... | {
this.cleanView();
} | conditional_block |
display-column.directive.ts | import { Directive, EmbeddedViewRef, Input, OnInit, Renderer2, TemplateRef, ViewContainerRef } from '@angular/core';
import { combineLatest } from 'rxjs';
import { PlexColumnDirective } from './columns.directive';
@Directive({
// tslint:disable-next-line:directive-selector
selector: '[plTableCol]'
})
export cl... | () {
if (this.viewRef) {
this.view.clear();
this.viewRef.destroy();
this.viewRef = null;
}
}
}
interface ObserveContext<T> {
$implicit: T;
observe: T;
}
| cleanView | identifier_name |
display-column.directive.ts | import { Directive, EmbeddedViewRef, Input, OnInit, Renderer2, TemplateRef, ViewContainerRef } from '@angular/core';
import { combineLatest } from 'rxjs';
import { PlexColumnDirective } from './columns.directive';
@Directive({
// tslint:disable-next-line:directive-selector
selector: '[plTableCol]'
})
export cl... | }
private cleanView() {
if (this.viewRef) {
this.view.clear();
this.viewRef.destroy();
this.viewRef = null;
}
}
}
interface ObserveContext<T> {
$implicit: T;
observe: T;
} | this.viewRef = this.view.createEmbeddedView(this.nextRef);
if (right) {
this.render.addClass(this.viewRef.rootNodes[0], 'column-right');
}
} | random_line_split |
dictutils.py | #
# Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | dct.pop(key) | random_line_split | |
dictutils.py | #
# Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | """
Removes given items from the disct
@param dct: the ditc to look at
@param keys: the keys of items to pop
@return: updated dict
"""
if dct:
for key in keys:
if dct.has_key(key):
dct.pop(key) | identifier_body | |
dictutils.py | #
# Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | dct.pop(key) | conditional_block | |
dictutils.py | #
# Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | (dct, keys=[]):
"""
Removes given items from the disct
@param dct: the ditc to look at
@param keys: the keys of items to pop
@return: updated dict
"""
if dct:
for key in keys:
if dct.has_key(key):
d... | exclude | identifier_name |
issue-2190-1.rs | // Copyright 2012-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-MI... |
})
}
pub fn main() {
spawn(child_no(0));
}
| {
spawn(child_no(x+1));
} | conditional_block |
issue-2190-1.rs | // Copyright 2012-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-MI... | if x < generations {
spawn(child_no(x+1));
}
})
}
pub fn main() {
spawn(child_no(0));
} | random_line_split | |
issue-2190-1.rs | // Copyright 2012-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-MI... | {
spawn(child_no(0));
} | identifier_body | |
issue-2190-1.rs | // Copyright 2012-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-MI... | (mut f: Box<FnMut() + 'static + Send>) {
Builder::new().stack_size(32 * 1024).spawn(move|| f());
}
fn child_no(x: usize) -> Box<FnMut() + 'static + Send> {
Box::new(move|| {
if x < generations {
spawn(child_no(x+1));
}
})
}
pub fn main() {
spawn(child_no(0));
}
| spawn | identifier_name |
ProductPricing.tsx | import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import {
createStyles,
Theme,
withStyles,
WithStyles
} from "@material-ui/core/styles";
import * as React from "react";
import CardTitle from "../../../components/CardTitle";
import ControlledCheckbox from "../.... | value={data.price}
currencySymbol={currency}
onChange={onChange}
/>
</div>
</CardContent>
</Card>
)
);
ProductPricing.displayName = "ProductPricing";
export default ProductPricing; | name="price" | random_line_split |
ChatList.ts | /// <reference path="ChatResponse.ts"/>
/// <reference path="../BasicElement.ts"/>
/// <reference path="../../logic/FlowManager.ts"/>
// namespace
namespace cf {
// interface
export const ChatListEvents = {
CHATLIST_UPDATED: "cf-chatlist-updated"
}
// class
export class ChatList extends BasicElement {
privat... | (event: CustomEvent){
const dto: FlowDTO = (<InputKeyChangeDTO> event.detail).dto;
ConversationalForm.illustrateFlow(this, "receive", event.type, dto);
this.scrollListTo();
}
private onInputKeyChange(event: CustomEvent){
const dto: FlowDTO = (<InputKeyChangeDTO> event.detail).dto;
ConversationalForm... | onInputHeightChange | identifier_name |
ChatList.ts | /// <reference path="ChatResponse.ts"/>
/// <reference path="../BasicElement.ts"/>
/// <reference path="../../logic/FlowManager.ts"/>
// namespace
namespace cf {
// interface
export const ChatListEvents = {
CHATLIST_UPDATED: "cf-chatlist-updated"
}
// class
export class ChatList extends BasicElement {
privat... | let element: ChatResponse = <ChatResponse>this.responses[i];
if(!element.isRobotReponse && element.tag == tagToChange){
// update element thhat user wants to edit
oldReponse = element;
break;
}
}
// reset the current user response
this.currentUserResponse.processResponseAndSetText()... | */
private onUserWantsToEditTag(tagToChange: ITag): void {
let oldReponse: ChatResponse;
for (let i = 0; i < this.responses.length; i++) { | random_line_split |
ChatList.ts | /// <reference path="ChatResponse.ts"/>
/// <reference path="../BasicElement.ts"/>
/// <reference path="../../logic/FlowManager.ts"/>
// namespace
namespace cf {
// interface
export const ChatListEvents = {
CHATLIST_UPDATED: "cf-chatlist-updated"
}
// class
export class ChatList extends BasicElement {
privat... |
public createResponse(isRobotReponse: boolean, currentTag: ITag, value: string = null) : ChatResponse{
const response: ChatResponse = new ChatResponse({
// image: null,
list: this,
tag: currentTag,
eventTarget: this.eventTarget,
isRobotReponse: isRobotReponse,
response: value,
image: ... | {
Dictionary.set(robot ? "robot-image" : "user-image", robot ? "robot" : "human", img);
const newImage: string = robot ? Dictionary.getRobotResponse("robot-image") : Dictionary.get("user-image");
for (let i = 0; i < this.responses.length; i++) {
let element: ChatResponse = <ChatResponse>this.responses[i];... | identifier_body |
lazy.rs | // Copyright 2015 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 ... | } else {
Some((*ptr).clone())
}
}
}
unsafe fn init(&'static self) -> Arc<T> {
// If we successfully register an at exit handler, then we cache the
// `Arc` allocation in our own internal box (it will get deallocated by
// the at exit handl... | random_line_split | |
lazy.rs | // Copyright 2015 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 ... | else if ptr as usize == 1 {
None
} else {
Some((*ptr).clone())
}
}
}
unsafe fn init(&'static self) -> Arc<T> {
// If we successfully register an at exit handler, then we cache the
// `Arc` allocation in our own internal box (it wi... | {
Some(self.init())
} | conditional_block |
lazy.rs | // Copyright 2015 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 ... | (&'static self) -> Arc<T> {
// If we successfully register an at exit handler, then we cache the
// `Arc` allocation in our own internal box (it will get deallocated by
// the at exit handler). Otherwise we just return the freshly allocated
// `Arc`.
let registered = rt::at_exit(... | init | identifier_name |
lazy.rs | // Copyright 2015 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 ... |
unsafe fn init(&'static self) -> Arc<T> {
// If we successfully register an at exit handler, then we cache the
// `Arc` allocation in our own internal box (it will get deallocated by
// the at exit handler). Otherwise we just return the freshly allocated
// `Arc`.
let regis... | {
let _g = self.lock.lock();
unsafe {
let ptr = *self.ptr.get();
if ptr.is_null() {
Some(self.init())
} else if ptr as usize == 1 {
None
} else {
Some((*ptr).clone())
}
}
} | identifier_body |
postcss-loader_vx.x.x.js | // flow-typed signature: aa361ad6f824f985f1402af76a9059ec
// flow-typed version: <<STUB>>/postcss-loader_v^1.1.0/flow_v0.45.0
/**
* This is an autogenerated libdef stub for:
*
* 'postcss-loader'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work w... | }
declare module 'postcss-loader/index.js' {
declare module.exports: $Exports<'postcss-loader'>;
} | random_line_split | |
config.js | define([
"app/config"
], function (config) {
var obj = deepExtend({
baseUrl: './',
paths: {
app: './app',
nls: "./nls",
core: "./core",
service: "./core/loader/service",
controller: "./core/loader/controller",
directive: "./... | ;
}); | {
for (var property in source) {
if (source[property] && source[property].constructor &&
source[property].constructor === Object) {
destination[property] = destination[property] || {};
arguments.callee(destination[property], source[property]);
... | identifier_body |
config.js | define([
"app/config"
], function (config) {
var obj = deepExtend({
baseUrl: './',
paths: {
app: './app',
nls: "./nls",
core: "./core",
service: "./core/loader/service",
controller: "./core/loader/controller",
directive: "./... | exports: 'angular'
},
'angularRoute': ['angular'],
'angularSegment': ['angular'],
'angularView': ['angular'],
'angularMocks':{
deps: ['angular'],
exports:'angular.mock'
},
'jasmine': {
... | shim: {
'angular': { | random_line_split |
config.js | define([
"app/config"
], function (config) {
var obj = deepExtend({
baseUrl: './',
paths: {
app: './app',
nls: "./nls",
core: "./core",
service: "./core/loader/service",
controller: "./core/loader/controller",
directive: "./... |
}
return destination;
};
}); | {
destination[property] = source[property];
} | conditional_block |
config.js | define([
"app/config"
], function (config) {
var obj = deepExtend({
baseUrl: './',
paths: {
app: './app',
nls: "./nls",
core: "./core",
service: "./core/loader/service",
controller: "./core/loader/controller",
directive: "./... | (destination, source) {
for (var property in source) {
if (source[property] && source[property].constructor &&
source[property].constructor === Object) {
destination[property] = destination[property] || {};
arguments.callee(destination[property], sourc... | deepExtend | identifier_name |
apn.d.ts | // Type definitions for node-apn
// Project: https://github.com/argon/node-apn
// Definitions by: Zenorbi <https://github.com/zenorbi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../node/node.d.ts"/>
declare module "apn" {
import events = require("events");
import net = req... | {
/**
* The maximum number of retries which should be performed when sending a notification if an error occurs. A value of 0 will only allow one attempt at sending (0 retries). Set to -1 to disable (default).
*/
public retryLimit:number;
/**
* The UNIX timestamp representing when the notification should... | Notification | identifier_name |
apn.d.ts | // Type definitions for node-apn
// Project: https://github.com/argon/node-apn
// Definitions by: Zenorbi <https://github.com/zenorbi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../node/node.d.ts"/>
declare module "apn" {
import events = require("events");
import net = req... | } | export {Feedback as feedback};
export {Notification as notification}; | random_line_split |
urls.py | from django.conf.urls import *
from apps.profile import views
urlpatterns = patterns('',
url(r'^get_preferences?/?', views.get_preference),
url(r'^set_preference/?', views.set_preference),
url(r'^set_account_settings/?', views.set_account_settings),
url(r'^get_view_setting/?', views.get_view_setting), | url(r'^is_premium/?', views.profile_is_premium, name='profile-is-premium'),
url(r'^paypal_ipn/?', include('paypal.standard.ipn.urls'), name='paypal-ipn'),
url(r'^stripe_form/?', views.stripe_form, name='stripe-form'),
url(r'^activities/?', views.load_activities, name='profile-activities'),
url(r'^pa... | url(r'^set_view_setting/?', views.set_view_setting),
url(r'^set_collapsed_folders/?', views.set_collapsed_folders),
url(r'^paypal_form/?', views.paypal_form),
url(r'^paypal_return/?', views.paypal_return, name='paypal-return'), | random_line_split |
tests.py | from unittest import TestCase
from safeurl.core import getRealURL
class MainTestCase(TestCase):
def test_decodeUrl(self):
self.assertEqual(getRealURL('http://bit.ly/1gaiW96'),
'https://www.yandex.ru/')
def test_decodeUrlArray(self):
self.assertEqual(
getRe... |
def test_errorDecodeUrlArray(self):
self.assertEqual(
getRealURL(
['http://bit.ly.wrong/wrong', 'http://bit.ly.wrong/wrong']),
['Failed', 'Failed'])
def test_errorWithOkDecodeUrlArray(self):
self.assertEqual(
getRealURL(['http://bit.ly.wrong/... | random_line_split | |
tests.py | from unittest import TestCase
from safeurl.core import getRealURL
class MainTestCase(TestCase):
def test_decodeUrl(self):
|
def test_decodeUrlArray(self):
self.assertEqual(
getRealURL(['http://bit.ly/1gaiW96', 'http://bit.ly/1gaiW96']),
['https://www.yandex.ru/', 'https://www.yandex.ru/'])
def test_errorDecodeUrl(self):
self.assertEqual(getRealURL('http://bit.ly.wrong/wrong'),
... | self.assertEqual(getRealURL('http://bit.ly/1gaiW96'),
'https://www.yandex.ru/') | identifier_body |
tests.py | from unittest import TestCase
from safeurl.core import getRealURL
class MainTestCase(TestCase):
def test_decodeUrl(self):
self.assertEqual(getRealURL('http://bit.ly/1gaiW96'),
'https://www.yandex.ru/')
def | (self):
self.assertEqual(
getRealURL(['http://bit.ly/1gaiW96', 'http://bit.ly/1gaiW96']),
['https://www.yandex.ru/', 'https://www.yandex.ru/'])
def test_errorDecodeUrl(self):
self.assertEqual(getRealURL('http://bit.ly.wrong/wrong'),
'Failed')
de... | test_decodeUrlArray | identifier_name |
x86stdcall2.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () { }
| main | identifier_name |
x86stdcall2.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. | // option. This file may not be copied, modified, or distributed
// except according to those terms.
pub type HANDLE = u32;
pub type DWORD = u32;
pub type SIZE_T = u32;
pub type LPVOID = uint;
pub type BOOL = u8;
#[cfg(windows)]
mod kernel32 {
use super::{HANDLE, DWORD, SIZE_T, LPVOID, BOOL};
extern "system"... | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | random_line_split |
x86stdcall2.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | { } | identifier_body | |
merch-display.component.ts | import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { Merch } from '../data/merch';
import { MerchService } from '../data/merch.service';
@Component({
selector: 'app-merch-display',
templateUrl: './merch-display.co... |
goBack(): void {
this.location.back();
}
}
| {
this.merchService
.getMerchList(category)
.then((merch) => (this.merch = merch));
} | identifier_body |
merch-display.component.ts | import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { Merch } from '../data/merch';
import { MerchService } from '../data/merch.service';
@Component({
selector: 'app-merch-display',
templateUrl: './merch-display.co... |
});
}
getMerch(category: string): void {
this.merchService
.getMerchList(category)
.then((merch) => (this.merch = merch));
}
goBack(): void {
this.location.back();
}
}
| {
this._serviceWorker.postMessage({ page: routeParams.category });
} | conditional_block |
merch-display.component.ts | import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { Merch } from '../data/merch';
import { MerchService } from '../data/merch.service';
@Component({
selector: 'app-merch-display',
templateUrl: './merch-display.co... |
getMerch(category: string): void {
this.merchService
.getMerchList(category)
.then((merch) => (this.merch = merch));
}
goBack(): void {
this.location.back();
}
} | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.