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 |
|---|---|---|---|---|
ord.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | layers of pointers, if the type includes pointers.
*/
let other_f = match other_fs {
[ref o_f] => o_f,
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
};
let cmp = cx.expr_binary(span, op, self_f.clo... | {
let op = if less {ast::BiLt} else {ast::BiGt};
cs_fold(
false, // need foldr,
|cx, span, subexpr, self_f, other_fs| {
/*
build up a series of chain ||'s and &&'s from the inside
out (hence foldr) to get lexical ordering, i.e. for op ==
`ast::lt`
... | identifier_body |
ord.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
pub fn some_ordering_collapsed(cx: &mut ExtCtxt,
span: Span,
op: OrderingOp,
self_arg_tags: &[ast::Ident]) -> P<ast::Expr> {
let lft = cx.expr_ident(span, self_arg_tags[0]);
let rgt = cx.expr_addr_of(span, cx.expr_iden... | random_line_split | |
ord.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | else {
some_ordering_collapsed(cx, span, PartialCmpOp, tag_tuple)
}
},
cx, span, substr)
}
/// Strict inequality.
fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
span: Span, substr: &Substructure) -> P<Expr> {
let op = if less {ast::BiLt} else {ast::BiGt};
... | {
cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
} | conditional_block |
ord.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
PartialCmpOp, LtOp, LeOp, GtOp, GeOp,
}
pub fn some_ordering_collapsed(cx: &mut ExtCtxt,
span: Span,
op: OrderingOp,
self_arg_tags: &[ast::Ident]) -> P<ast::Expr> {
let lft = cx.expr_ident(span, self_arg_tags[0]);
... | OrderingOp | identifier_name |
compare_predictions.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | if pred == gold_example[1]:
correct += 1
else:
incorrect += 1
print("Incorrect for example %s.\nTarget: %s\nPrediction: %s" %
(gold_example[0], gold_example[1], pred))
print("correct: %s" % correct)
print("incorrect: %s" % incorrect)
print("pct: %s" % str(float(correct) / fl... | incorrect = 0
for pred, gold_example in zip(preds, gold_examples): | random_line_split |
compare_predictions.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | (unused_argv):
gold_examples = tsv_utils.read_tsv(FLAGS.gold)
preds = []
with gfile.GFile(FLAGS.predictions, "r") as f:
for line in f:
preds.append(line.rstrip())
correct = 0
incorrect = 0
for pred, gold_example in zip(preds, gold_examples):
if pred == gold_example[1]:
correct += 1
... | main | identifier_name |
compare_predictions.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
correct = 0
incorrect = 0
for pred, gold_example in zip(preds, gold_examples):
if pred == gold_example[1]:
correct += 1
else:
incorrect += 1
print("Incorrect for example %s.\nTarget: %s\nPrediction: %s" %
(gold_example[0], gold_example[1], pred))
print("correct: %s" % co... | preds.append(line.rstrip()) | conditional_block |
compare_predictions.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
if __name__ == "__main__":
app.run(main)
| gold_examples = tsv_utils.read_tsv(FLAGS.gold)
preds = []
with gfile.GFile(FLAGS.predictions, "r") as f:
for line in f:
preds.append(line.rstrip())
correct = 0
incorrect = 0
for pred, gold_example in zip(preds, gold_examples):
if pred == gold_example[1]:
correct += 1
else:
inco... | identifier_body |
mod.rs | use std::fmt::Debug;
use provider::Output;
use provider::error::Error;
use provider::error::HandleFuncNotDefined;
pub trait InlineProvider: Debug {
fn is_installed(&self, &str, Option<&str>) -> Result<Output, Error> |
fn version(&self, &str, Option<&str>) -> Result<Output, Error> {
let e = HandleFuncNotDefined {
provider: format!("{:?}", self),
func: "version".to_string(),
};
Err(e.into())
}
fn remove(&self, &str, Option<&str>) -> Result<Output, Error> {
let e = ... | {
let e = HandleFuncNotDefined {
provider: format!("{:?}", self),
func: "is_installed".to_string(),
};
Err(e.into())
} | identifier_body |
mod.rs | use std::fmt::Debug;
use provider::Output;
use provider::error::Error;
use provider::error::HandleFuncNotDefined;
pub trait InlineProvider: Debug {
fn | (&self, &str, Option<&str>) -> Result<Output, Error> {
let e = HandleFuncNotDefined {
provider: format!("{:?}", self),
func: "is_installed".to_string(),
};
Err(e.into())
}
fn version(&self, &str, Option<&str>) -> Result<Output, Error> {
let e = HandleFunc... | is_installed | identifier_name |
mod.rs | use std::fmt::Debug;
use provider::Output; | fn is_installed(&self, &str, Option<&str>) -> Result<Output, Error> {
let e = HandleFuncNotDefined {
provider: format!("{:?}", self),
func: "is_installed".to_string(),
};
Err(e.into())
}
fn version(&self, &str, Option<&str>) -> Result<Output, Error> {
... | use provider::error::Error;
use provider::error::HandleFuncNotDefined;
pub trait InlineProvider: Debug { | random_line_split |
MetaFeed.js | // PreMeFi - A MetaFilter viewer for Palm's WebOS
// Copyright (C) 2011 Gaelan D'costa <gdcosta@gmail.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the Lic... | (feedTitle, feedURL) {
/** Feed Title */
this.m_title = feedTitle;
/** Feed URL */
this.m_url = feedURL;
/** List of stories in feed. Note that stories should be stored
* in reverse chronological order.
*/
this.m_list = [];
}
/**
* Asychronously request the latest feed data from the feed URL.
*/
MetaFeed.... | MetaFeed | identifier_name |
MetaFeed.js | // PreMeFi - A MetaFilter viewer for Palm's WebOS
// Copyright (C) 2011 Gaelan D'costa <gdcosta@gmail.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the Lic... | /** Feed Title */
this.m_title = feedTitle;
/** Feed URL */
this.m_url = feedURL;
/** List of stories in feed. Note that stories should be stored
* in reverse chronological order.
*/
this.m_list = [];
}
/**
* Asychronously request the latest feed data from the feed URL.
*/
MetaFeed.prototype.update = func... | random_line_split | |
MetaFeed.js | // PreMeFi - A MetaFilter viewer for Palm's WebOS
// Copyright (C) 2011 Gaelan D'costa <gdcosta@gmail.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the Lic... |
/**
* Asychronously request the latest feed data from the feed URL.
*/
MetaFeed.prototype.update = function() {
Mojo.Controller.getAppController().sendToNotificationChain({
updating : true
});
var request = new Ajax.Request(this.m_url, {
method : "get",
onSuccess : this.updateSuccess.bind(this),
onFailu... | {
/** Feed Title */
this.m_title = feedTitle;
/** Feed URL */
this.m_url = feedURL;
/** List of stories in feed. Note that stories should be stored
* in reverse chronological order.
*/
this.m_list = [];
} | identifier_body |
MetaFeed.js | // PreMeFi - A MetaFilter viewer for Palm's WebOS
// Copyright (C) 2011 Gaelan D'costa <gdcosta@gmail.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the Lic... |
return feed;
};
/**
* Create a JSON structure from a MetaFeed
* @returns {Object} a JSON-structure containing the feed's data
*/
MetaFeed.prototype.toJSONObject = function() {
var object = {};
object.title = this.m_title;
object.url = this.m_url;
object.items = [];
for(var i = 0; i < this.m_list.length; ... | {
var entry = MetaEntry.fromJSON(object.items[i]);
feed.m_list.push(entry);
} | conditional_block |
utils.py | import numpy as np
import os
import scipy.misc
import shutil
import tensorflow as tf
from functools import reduce
from operator import mul
def | (path, mode='RGB', size=None):
img = scipy.misc.imread(path, mode=mode)
if size is not None:
img = scipy.misc.imresize(img, size)
return img
def write_image(img, path):
img = np.clip(img, 0, 255).astype(np.uint8)
scipy.misc.imsave(path, img)
def get_output_filepath(output_path, name, suffi... | read_image | identifier_name |
utils.py | import numpy as np
import os
import scipy.misc
import shutil
import tensorflow as tf
from functools import reduce
from operator import mul
def read_image(path, mode='RGB', size=None):
img = scipy.misc.imread(path, mode=mode)
if size is not None:
img = scipy.misc.imresize(img, size)
return img
def ... | if (os.path.isfile(model_filepath)
and os.path.isfile(model_meta_filepath)):
shutil.copy2(model_filepath, model_filepath + '.bak')
shutil.copy2(model_meta_filepath,
model_meta_filepath + '.bak')
saver.save(sess, model_filepath) | random_line_split | |
utils.py | import numpy as np
import os
import scipy.misc
import shutil
import tensorflow as tf
from functools import reduce
from operator import mul
def read_image(path, mode='RGB', size=None):
img = scipy.misc.imread(path, mode=mode)
if size is not None:
|
return img
def write_image(img, path):
img = np.clip(img, 0, 255).astype(np.uint8)
scipy.misc.imsave(path, img)
def get_output_filepath(output_path, name, suffix='', ext='jpg'):
return os.path.join(output_path, name+'_'+suffix+'.'+ext)
def gram_matrix(mat):
mat = mat.reshape((-1, mat.shape[2]))
... | img = scipy.misc.imresize(img, size) | conditional_block |
utils.py | import numpy as np
import os
import scipy.misc
import shutil
import tensorflow as tf
from functools import reduce
from operator import mul
def read_image(path, mode='RGB', size=None):
|
def write_image(img, path):
img = np.clip(img, 0, 255).astype(np.uint8)
scipy.misc.imsave(path, img)
def get_output_filepath(output_path, name, suffix='', ext='jpg'):
return os.path.join(output_path, name+'_'+suffix+'.'+ext)
def gram_matrix(mat):
mat = mat.reshape((-1, mat.shape[2]))
return np.m... | img = scipy.misc.imread(path, mode=mode)
if size is not None:
img = scipy.misc.imresize(img, size)
return img | identifier_body |
convert_test.py | # -*- coding: utf-8 -*- |
from pytak.please import convert_to_dotted
data = """
{
"title": "main_title",
"components": [
{
"component_id": 100,
"menu": [
{
"title": "menu_title1"
},
{
"title2": "menu_title2"
... |
from __future__ import print_function
import json | random_line_split |
convert_test.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import json
from pytak.please import convert_to_dotted
data = """
{
"title": "main_title",
"components": [
{
"component_id": 100,
"menu": [
{
"title": "menu_title1"
... | assert expected_data == convert_to_dotted(json.loads(data)) | identifier_body | |
convert_test.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import json
from pytak.please import convert_to_dotted
data = """
{
"title": "main_title",
"components": [
{
"component_id": 100,
"menu": [
{
"title": "menu_title1"
... | ():
assert expected_data == convert_to_dotted(json.loads(data))
| test_converter | identifier_name |
find_warcs.py | #!/usr/bin/env python3
from sfmutils.api_client import ApiClient
import argparse
import logging
import sys
log = logging.getLogger(__name__)
def | (sys_argv):
# Arguments
parser = argparse.ArgumentParser(description="Return WARC filepaths for passing to other commandlines.")
parser.add_argument("--harvest-start", help="ISO8601 datetime after which harvest was performed. For example, "
"2015-02-22T14:49:0... | main | identifier_name |
find_warcs.py | #!/usr/bin/env python3
from sfmutils.api_client import ApiClient
import argparse
import logging
import sys
log = logging.getLogger(__name__)
def main(sys_argv):
# Arguments
|
# Logging
logging.basicConfig(format='%(asctime)s: %(name)s --> %(message)s',
level=logging.DEBUG if args.debug else logging.INFO)
logging.getLogger("requests").setLevel(logging.DEBUG if args.debug else logging.INFO)
api_client = ApiClient(args.api_base_url)
collection_ids ... | parser = argparse.ArgumentParser(description="Return WARC filepaths for passing to other commandlines.")
parser.add_argument("--harvest-start", help="ISO8601 datetime after which harvest was performed. For example, "
"2015-02-22T14:49:07Z")
parser.add_argument("--... | identifier_body |
find_warcs.py | #!/usr/bin/env python3
from sfmutils.api_client import ApiClient
import argparse
import logging
import sys
log = logging.getLogger(__name__)
def main(sys_argv):
# Arguments
parser = argparse.ArgumentParser(description="Return WARC filepaths for passing to other commandlines.")
parser.add_argument("--har... | default="False", const="True")
parser.add_argument("--newline", action="store_true", help="Separates WARCs by newline instead of space.")
parser.add_argument("collection", nargs="+", help="Limit to WARCs of this collection. "
"Truncat... | parser.add_argument("--api-base-url", help="Base url of the SFM API. Default is {}.".format(default_api_base_url),
default=default_api_base_url)
parser.add_argument("--debug", type=lambda v: v.lower() in ("yes", "true", "t", "1"), nargs="?", | random_line_split |
find_warcs.py | #!/usr/bin/env python3
from sfmutils.api_client import ApiClient
import argparse
import logging
import sys
log = logging.getLogger(__name__)
def main(sys_argv):
# Arguments
parser = argparse.ArgumentParser(description="Return WARC filepaths for passing to other commandlines.")
parser.add_argument("--har... |
else:
collection_ids.append(collections[0]["collection_id"])
warc_filepaths = set()
for collection_id in collection_ids:
log.debug("Looking up warcs for %s", collection_id)
warcs = api_client.warcs(collection_id=collection_id, harvest_date_start=args.harvest_start,
... | print("Multiple matching collections for {}".format(collection_id_part))
sys.exit(1) | conditional_block |
widget.js | browserManager.removeItem(this);
}
}));
// Widget constructor
const Widget = function Widget(options) {
let w = WidgetTrait.create(Widget.prototype);
w._initWidget(options);
// Return a Cortex of widget in order to hide private attributes like _onEvent
let _public = Cortex(w);
unload.ensure(_public, ... | random_line_split | ||
widget.js | 86
// until then, force display of addon bar directly from sdk code
// https://bugzilla.mozilla.org/show_bug.cgi?id=627484
if (container.collapsed)
this.window.toggleAddonBar();
}
// Now retrieve a reference to the next toolbar item
// by reading currentset attribute on the toolba... | {
// Force image content to size.
// Add-on authors must size their images correctly.
doc.body.firstElementChild.style.width = self._widget.width + "px";
doc.body.firstElementChild.style.height = "16px";
} | conditional_block | |
widget.js | . But only do this the first time we add it to the toolbar
// Otherwise, this code will collide with other instance of Widget module
// during Firefox startup. See bug 685929.
if (ids.indexOf(id) == -1) {
container.setAttribute("currentset", container.currentSet);
// Save DOM attribute in order ... | {
if (e.target.location == "about:blank")
return;
self._symbiont.destroy();
self._symbiont = null;
// This may fail but not always, it depends on how the node is
// moved or removed
try {
self.setContent();
} catch(e) {}
} | identifier_body | |
widget.js | (1);
if (!listeners[onName])
continue;
object.on(name, listeners[onName].bind(object));
}
}
};
/**
* Main Widget class: entry point of the widget API
*
* Allow to control all widget across all existing windows with a single object.
* Widget.getView allow to retrieve a WidgetView instanc... | (v) {}, // Work around Cortex failure with getter without setter
// See bug 653464
_port: null,
postMessage: function WidgetView_postMessage(message) {
if (!this._chrome)
throw new Error(ERR_DESTROYED);
this._chrome.update(this._baseWidget, "postMessage", message);
},
destroy: ... | port | identifier_name |
objects.rs | the License.
//! Stored objects.
use std::collections::HashMap;
use std::io::Read;
use std::rc::Rc;
use chrono::{DateTime, TimeZone};
use fallible_iterator::{FallibleIterator, IntoFallibleIterator};
use osauth::services::OBJECT_STORAGE;
use reqwest::Url;
use super::super::common::{
ContainerRef, IntoVerified, ... | {
ObjectRef::new_verified(value.inner.name)
} | identifier_body | |
objects.rs | 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 to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,... | self.session
.get_endpoint(OBJECT_STORAGE, &[self.container_name(), self.name()])
}
}
impl Refresh for Object {
/// Refresh the object.
fn refresh(&mut self) -> Result<()> {
self.inner = api::get_object(&self.session, &self.c_name, &self.inner.name)?;
Ok(())
}
}
imp... | random_line_split | |
objects.rs | 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 to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,... | (mut self, limit: usize) -> Self {
self.can_paginate = false;
self.query.push("limit", limit);
self
}
/// Convert this query into an iterator executing the request.
///
/// Returns a `FallibleIterator`, which is an iterator with each `next`
/// call returning a `Result`.
... | with_limit | identifier_name |
objects.rs | 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 to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,... |
self.into_iter().one()
}
}
impl ResourceQuery for ObjectQuery {
type Item = Object;
const DEFAULT_LIMIT: usize = 100;
fn can_paginate(&self) -> Result<bool> {
Ok(self.can_paginate)
}
fn extract_marker(&self, resource: &Self::Item) -> String {
resource.name().clone()... | {
// We need only one result. We fetch maximum two to be able
// to check if the query yieled more than one result.
self.query.push("limit", 2);
} | conditional_block |
type_alias.rs | /*type 语句可以给一个已存在类型起一个新的名字。
类型必须要有 CamelCase(驼峰方式)的名称,否则 编译器会产生一个警告。
对规则为例外的是基本类型: usize,f32等等。*/
// `NanoSecond` 是 `u64` 的新名字。
type NanoSecond = u64;
type Inch = u64;
// 使用一个属性来忽略警告。
//#[allow(non_camel_case_types)]
type u64_t = u64;
// 试一试 ^ 试着删掉属性
fn main() {
// `NanoSecond` = `Inch` = `u64_t` = `u64`.
le... | tln!(
"{} nanoseconds + {} inches = {} unit?",
nanoseconds,
inches,
nanoseconds + inches
);
}
| prin | identifier_name |
type_alias.rs | /*type 语句可以给一个已存在类型起一个新的名字。
类型必须要有 CamelCase(驼峰方式)的名称,否则 编译器会产生一个警告。
对规则为例外的是基本类型: usize,f32等等。*/
// `NanoSecond` 是 `u64` 的新名字。
type NanoSecond = u64;
type Inch = u64;
// 使用一个属性来忽略警告。
//#[allow(non_camel_case_types)]
type u64_t = u64;
// 试一试 ^ 试着删掉属性
fn main() {
// `NanoSecond` = `Inch` = `u64_t` = `u64`.
le... |
// 注意类型的别名*没有*提供任何额外的类型安全,因为别名*不是*新的类型
println!(
"{} nanoseconds + {} inches = {} unit?",
nanoseconds,
inches,
nanoseconds + inches
);
} | let inches: Inch = 2 as u64_t; | random_line_split |
type_alias.rs | /*type 语句可以给一个已存在类型起一个新的名字。
类型必须要有 CamelCase(驼峰方式)的名称,否则 编译器会产生一个警告。
对规则为例外的是基本类型: usize,f32等等。*/
// `NanoSecond` 是 `u64` 的新名字。
type NanoSecond = u64;
type Inch = u64;
// 使用一个属性来忽略警告。
//#[allow(non_camel_case_types)]
type u64_t = u64;
// 试一试 ^ 试着删掉属性
fn main() {
// `NanoSecond` = `Inch` = `u64_t` = `u64`.
le... | !(
"{} nanoseconds + {} inches = {} unit?",
nanoseconds,
inches,
nanoseconds + inches
);
}
| identifier_body | |
vcpw15-5.py | , 100, 100)
NAVYBLUE = ( 60, 60, 100)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = ( 0, 255, 0)
BLUE = ( 0, 0, 255)
YELLOW = (255, 255, 0)
ORANGE = (255, 128, 0)
PURPLE = (255, 0, 255)
CYAN = ( 0, 255, 255)
BGCOLOR = NAVYBLUE
LIGHTBGCOLOR = GRAY
BOXCOLOR = W... | (board, boxes, coverage):
# Draws boxes being covered/revealed. "boxes" is a list
# of two-item lists, which have the x & y spot of the box.
for box in boxes:
left, top = leftTopCoordsOfBox(box[0], box[1])
pygame.draw.rect(DISPLAYSURF, BGCOLOR, (left, top, BOXSIZE, BOXSIZE))
sh... | drawBoxCovers | identifier_name |
vcpw15-5.py | too big for the number of shapes/colors defined."
def main():
global FPSCLOCK, DISPLAYSURF
pygame.init()
FPSCLOCK = pygame.time.Clock()
DISPLAYSURF = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))
mousex = 0 # used to store x coordinate of mouse event
mousey = 0 # used to store... | left, top = leftTopCoordsOfBox(boxx, boxy)
if not revealed[boxx][boxy]:
# Draw a covered box.
pygame.draw.rect(DISPLAYSURF, BOXCOLOR, (left, top, BOXSIZE, BOXSIZE))
else:
# Draw the (revealed) icon.
shape, color = getShapeAndC... | conditional_block | |
vcpw15-5.py | , 100, 100)
NAVYBLUE = ( 60, 60, 100)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = ( 0, 255, 0)
BLUE = ( 0, 0, 255)
YELLOW = (255, 255, 0)
ORANGE = (255, 128, 0)
PURPLE = (255, 0, 255)
CYAN = ( 0, 255, 255)
BGCOLOR = NAVYBLUE
LIGHTBGCOLOR = GRAY
BOXCOLOR = W... |
def drawBoxCovers(board, boxes, coverage):
# Draws boxes being covered/revealed. "boxes" is a list
# of two-item lists, which have the x & y spot of the box.
for box in boxes:
left, top = leftTopCoordsOfBox(box[0], box[1])
pygame.draw.rect(DISPLAYSURF, BGCOLOR, (left, top, BOXSIZE... | return board[boxx][boxy][0], board[boxx][boxy][1] | identifier_body |
vcpw15-5.py | 100, 100)
NAVYBLUE = ( 60, 60, 100)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = ( 0, 255, 0)
BLUE = ( 0, 0, 255)
YELLOW = (255, 255, 0)
ORANGE = (255, 128, 0)
PURPLE = (255, 0, 255)
CYAN = ( 0, 255, 255)
BGCOLOR = NAVYBLUE
LIGHTBGCOLOR = GRAY
BOXCOLOR = WH... | elif shape == DIAMOND:
pygame.draw.polygon(DISPLAYSURF, color, ((left + half, top), (left + BOXSIZE - 1, top + half), (left + half, top + BOXSIZE - 1), (left, top + half)))
elif shape == LINES:
for i in range(0, BOXSIZE, 4):
pygame.draw.line(DISPLAYSURF, color, (left, top + i), (... | pygame.draw.circle(DISPLAYSURF, BGCOLOR, (left + half, top + half), quarter - 5)
elif shape == SQUARE:
pygame.draw.rect(DISPLAYSURF, color, (left + quarter, top + quarter, BOXSIZE - half, BOXSIZE - half))
| random_line_split |
mod.rs | #![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
#![allow(unused_variables, dead_code)]
use libc;
use api::osmesa::{OsMesaContext};
use Api;
use ContextError;
use CreationError;
use Event;
use GlAttributes;
use GlContext;
use PixelFormat;
use PixelFormatRequirem... |
#[inline]
fn get_pixel_format(&self) -> PixelFormat {
self.opengl.get_pixel_format()
}
}
impl Drop for Window {
#[inline]
fn drop(&mut self) {
unsafe {
(self.libcaca.caca_free_dither)(self.dither);
(self.libcaca.caca_free_display)(self.display);
}
... | random_line_split | |
mod.rs | #![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
#![allow(unused_variables, dead_code)]
use libc;
use api::osmesa::{OsMesaContext};
use Api;
use ContextError;
use CreationError;
use Event;
use GlAttributes;
use GlContext;
use PixelFormat;
use PixelFormatRequirem... |
#[inline]
pub fn show(&self) {
}
#[inline]
pub fn hide(&self) {
}
#[inline]
pub fn get_position(&self) -> Option<(i32, i32)> {
unimplemented!()
}
#[inline]
pub fn set_position(&self, x: i32, y: i32) {
}
#[inline]
pub fn get_inner_size(&self) -> Optio... | {
} | identifier_body |
mod.rs | #![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
#![allow(unused_variables, dead_code)]
use libc;
use api::osmesa::{OsMesaContext};
use Api;
use ContextError;
use CreationError;
use Event;
use GlAttributes;
use GlContext;
use PixelFormat;
use PixelFormatRequirem... | ;
impl WindowProxy {
#[inline]
pub fn wakeup_event_loop(&self) {
unimplemented!()
}
}
pub struct MonitorId;
#[inline]
pub fn get_available_monitors() -> VecDeque<MonitorId> {
VecDeque::new()
}
#[inline]
pub fn get_primary_monitor() -> MonitorId {
MonitorId
}
impl MonitorId {
#[inline... | WindowProxy | identifier_name |
htmltablerowelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding;
use do... | (&self) -> bool {
*self.type_id() ==
EventTargetTypeId::Node(
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)))
}
}
impl HTMLTableRowElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document)
... | is_htmltablerowelement | identifier_name |
htmltablerowelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding;
use do... | ,
}
}
}
| {} | conditional_block |
htmltablerowelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding;
use do... |
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(bgcolor) => {
self.background_color.set(mutation.new_value(attr).and_then(|value| {
... | {
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
Some(htmlelement as &VirtualMethods)
} | identifier_body |
htmltablerowelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA;
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding;
use do... | *self.type_id() ==
EventTargetTypeId::Node(
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)))
}
}
impl HTMLTableRowElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document)
-> ... | }
impl HTMLTableRowElementDerived for EventTarget {
fn is_htmltablerowelement(&self) -> bool { | random_line_split |
constants.py | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Portello membership system
# Copyright (C) 2014 Klubb Alfa Romeo Norge
#
# 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
# t... |
DEFAULT_MODEL_NAME = 'Annen Alfa Romeo'
MEMBER_TYPE_EXPIRED = 'Utmeldt' | random_line_split | |
lib.rs | extern crate audsp;
extern crate aunorm;
use aunorm::{Normalizer, NormalizerProvider};
use std::collections::HashMap;
pub trait DspProcessor<'a, TSample: audsp::Numeric> {
fn get_properties(& self) -> & PropStorage<'a, TSample, Self>;
fn get_mut_properties(&mut self) -> &mut PropStorage<'a, TSample, Self>;
... | <'a, TSample: audsp::Numeric, TProcessor: DspProcessor<'a, TSample>> where TSample: 'a {
id: u32,
min: TSample,
max: TSample,
default: TSample,
value: TSample,
norm_value: TSample,
caption: &'a str,
measure: &'a str,
norm: Box<Normalizer<TSample> + 'a>,
callback : Box<Fn(&mut TPr... | PropInfo | identifier_name |
lib.rs | extern crate audsp;
extern crate aunorm;
use aunorm::{Normalizer, NormalizerProvider};
use std::collections::HashMap;
pub trait DspProcessor<'a, TSample: audsp::Numeric> {
fn get_properties(& self) -> & PropStorage<'a, TSample, Self>;
fn get_mut_properties(&mut self) -> &mut PropStorage<'a, TSample, Self>;
... | properties: HashMap<u32, PropInfo<'a, TSample, TProcessor>>
}
impl<'a, TSample: audsp::Numeric, TProcessor: DspProcessor<'a, TSample>> PropInfo<'a, TSample, TProcessor> where TSample: 'a {
pub fn set_from_norm(&mut self, norm: TSample, processor: &mut TProcessor) {
self.norm_value = norm;
self.... |
#[derive(Default)]
pub struct PropStorage<'a, TSample: audsp::Numeric, TProcessor: DspProcessor<'a, TSample>> where TSample: 'a { | random_line_split |
urls.py | from django.conf.urls import include, url
from rest_framework.routers import SimpleRouter
from rest_framework_nested.routers import NestedSimpleRouter
from olympia.bandwagon.views import CollectionViewSet, CollectionAddonViewSet
from . import views
accounts = SimpleRouter()
accounts.register(r'account', views.Acco... |
url(r'', include(collections.urls)),
url(r'', include(sub_collections.urls)),
url(r'', include(notifications.urls)),
] | random_line_split | |
soy2html.py | #!/usr/bin/env python
#
# This script is designed to be invoked by soy2html.sh.
# Usage:
#
# buck/docs$ python soy2html.py <output_dir>
#
# This will write all of the static content to the specified output directory.
# You may want to verify that things worked correctly by running:
#
# python -m SimpleHTTPServer ... | import sys
import time
URL_ROOT = 'http://localhost:9814/'
def main(output_dir):
# Iterate over the files in the docs directory and copy them, as
# appropriate.
for root, dirs, files in os.walk('.'):
for file_name in files:
if file_name.endswith('.soy') and not file_name.startswith('... | import os
import subprocess | random_line_split |
soy2html.py | #!/usr/bin/env python
#
# This script is designed to be invoked by soy2html.sh.
# Usage:
#
# buck/docs$ python soy2html.py <output_dir>
#
# This will write all of the static content to the specified output directory.
# You may want to verify that things worked correctly by running:
#
# python -m SimpleHTTPServer ... |
return os.path.join(output_dir, path)
def copy_to_output_dir(path, output_dir, content):
output_file = ensure_dir(path, output_dir)
with open(output_file, 'w') as f:
f.write(content)
def pollForServerReady():
SERVER_START_POLL = 5
print 'Waiting for server to start.'
for _ in range... | output_subdir = os.path.join(output_dir, path[:last_slash])
if not os.path.exists(output_subdir):
os.makedirs(output_subdir) | conditional_block |
soy2html.py | #!/usr/bin/env python
#
# This script is designed to be invoked by soy2html.sh.
# Usage:
#
# buck/docs$ python soy2html.py <output_dir>
#
# This will write all of the static content to the specified output directory.
# You may want to verify that things worked correctly by running:
#
# python -m SimpleHTTPServer ... | ():
SERVER_START_POLL = 5
print 'Waiting for server to start.'
for _ in range(0, SERVER_START_POLL):
result = subprocess.call(['curl', '--fail', '-I', URL_ROOT])
if result == 0:
return
time.sleep(1)
print 'Server failed to start after %s seconds.' % SERVER_START_POLL
... | pollForServerReady | identifier_name |
soy2html.py | #!/usr/bin/env python
#
# This script is designed to be invoked by soy2html.sh.
# Usage:
#
# buck/docs$ python soy2html.py <output_dir>
#
# This will write all of the static content to the specified output directory.
# You may want to verify that things worked correctly by running:
#
# python -m SimpleHTTPServer ... |
if __name__ == '__main__':
output_dir = sys.argv[1]
pollForServerReady()
main(output_dir)
| SERVER_START_POLL = 5
print 'Waiting for server to start.'
for _ in range(0, SERVER_START_POLL):
result = subprocess.call(['curl', '--fail', '-I', URL_ROOT])
if result == 0:
return
time.sleep(1)
print 'Server failed to start after %s seconds.' % SERVER_START_POLL | identifier_body |
test_segmentgroup.py | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... |
def test_set_segid_updates_self(self):
g = self.universe.select_atoms("resid 10:18").segments
g.segids = 'ADK'
assert_equal(g.segids, ['ADK'],
err_msg="old selection was not changed in place after set_segid")
def test_atom_order(self):
assert_equal(self.un... | s = self.universe.select_atoms('all').segments
s.segids = 'ADK'
assert_equal(self.universe.segments.segids, ['ADK'],
err_msg="failed to set_segid on segments") | identifier_body |
test_segmentgroup.py | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... | assert_(isinstance(newg, mda.core.groups.SegmentGroup))
assert_equal(len(newg), len(g))
def test_n_atoms(self):
assert_equal(self.g.n_atoms, 3341)
def test_n_residues(self):
assert_equal(self.g.n_residues, 214)
def test_resids_dim(self):
assert_equal(len(self.g.res... | """test that slicing a SegmentGroup returns a new SegmentGroup (Issue 135)"""
g = self.universe.atoms.segments
newg = g[:] | random_line_split |
test_segmentgroup.py | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... | (object):
# Legacy tests from before 363
@dec.skipif(parser_not_found('DCD'),
'DCD parser not available. Are you using python 3?')
def setUp(self):
"""Set up the standard AdK system in implicit solvent."""
self.universe = mda.Universe(PSF, DCD)
self.g = self.universe.... | TestSegmentGroup | identifier_name |
test_segmentgroup.py | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... |
def test_resnums_dim(self):
assert_equal(len(self.g.resnums), len(self.g))
for seg, resnums in zip(self.g, self.g.resnums):
assert_(len(resnums) == len(seg.residues))
assert_equal(seg.residues.resnums, resnums)
def test_segids_dim(self):
assert_equal(len(self.g... | assert_(len(resids) == len(seg.residues))
assert_equal(seg.residues.resids, resids) | conditional_block |
client_getProductTypes.py | #coding=utf-8
#author='Shichao-Dong'
import requests
def client_getProductTypes():
url="http://172.31.3.73:8888/client/v1/clientAuth.action"
headers={"Connection": "keep-alive",
# "Referer": "http://172.31.3.73:6020/layout_new/login.jsp?url=http://172.31.3.73:6020/layout_new/login.html",
#"Ac... | client_getProductTypes() | conditional_block | |
client_getProductTypes.py | #coding=utf-8
#author='Shichao-Dong'
import requests
def client_getProductTypes():
url="http://172.31.3.73:8888/client/v1/clientAuth.action"
headers={"Connection": "keep-alive",
# "Referer": "http://172.31.3.73:6020/layout_new/login.jsp?url=http://172.31.3.73:6020/layout_new/login.html",
#"Ac... | "User-Agent": "waiqin_android_5216010622618132075",
#"Content-Length": "475",
"Host": "172.31.3.73:8888",
#"clientid": "gaeaclient-android-000004-001002",
#"clientver": "5.7.5",
#"cmd": "STATUSREPORT",
#"wq-lang":"zh_CN",
#"zt": "gzip"
"Coolie":coo... | #"x-requested-with": "XMLHttpRequest",
"Content-Type": "application/x-www-form-urlencoded",
"Accept-Encoding": "gzip,deflate,sdch",
#"Pragm": "=no-cache",
#"Accept": "application/json, text/javascript, */*; q=0.01", | random_line_split |
client_getProductTypes.py | #coding=utf-8
#author='Shichao-Dong'
import requests
def | ():
url="http://172.31.3.73:8888/client/v1/clientAuth.action"
headers={"Connection": "keep-alive",
# "Referer": "http://172.31.3.73:6020/layout_new/login.jsp?url=http://172.31.3.73:6020/layout_new/login.html",
#"Accept-Language": "zh-CN",
#"x-requested-with": "XMLHttpRequest",
"... | client_getProductTypes | identifier_name |
client_getProductTypes.py | #coding=utf-8
#author='Shichao-Dong'
import requests
def client_getProductTypes():
| "info.os":"Android 6.0",
"info.clientId":"gaeaclient-android-000004-001002",
"info.md5":"e95d7df6d46d167ce6984b5ca348eb22",
"info.esn":"352591070002482",
"info.tenantCode":"dongshichao",
"info.userCode":"dong001",
"info.phoneModel":"infocus m535",
"info.appVer":"1.2.18.0"... | url="http://172.31.3.73:8888/client/v1/clientAuth.action"
headers={"Connection": "keep-alive",
# "Referer": "http://172.31.3.73:6020/layout_new/login.jsp?url=http://172.31.3.73:6020/layout_new/login.html",
#"Accept-Language": "zh-CN",
#"x-requested-with": "XMLHttpRequest",
"Content-T... | identifier_body |
PropertiesButton.tsx | import React, {useCallback, useMemo} from "react"
import {useTranslation} from "react-i18next"
import {useSelector} from "react-redux"
import {ReactComponent as Icon} from "../../../../assets/img/toolbarButtons/properties.svg"
import {getProcessToDisplay, getProcessUnsavedNewName, hasError, hasPropertiesErrors} from ".... | () => openNodeWindow(processProperties),
[openNodeWindow, processProperties],
)
return (
<ToolbarButton
name={t("panels.actions.edit-properties.button", "properties")}
hasError={errors && propertiesErrors}
icon={<Icon/>}
disabled={disabled}
onClick={onClick}
/>
)
}
... | const errors = useSelector(hasError)
const processProperties = useMemo(() => NodeUtils.getProcessProperties(processToDisplay, name), [name, processToDisplay])
const onClick = useCallback( | random_line_split |
__init__.py | """Support for the MAX! Cube LAN Gateway."""
import logging
from socket import timeout
from threading import Lock
import time
from maxcube.cube import MaxCube
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SCAN_INTERVAL
import homeassistant.helpers.config_validation as cv
from hom... |
connection_failed = 0
gateways = config[DOMAIN][CONF_GATEWAYS]
for gateway in gateways:
host = gateway[CONF_HOST]
port = gateway[CONF_PORT]
scan_interval = gateway[CONF_SCAN_INTERVAL].total_seconds()
try:
cube = MaxCube(host, port, now=now)
hass.dat... | hass.data[DATA_KEY] = {} | conditional_block |
__init__.py | """Support for the MAX! Cube LAN Gateway."""
import logging
from socket import timeout
from threading import Lock
import time
from maxcube.cube import MaxCube
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SCAN_INTERVAL
import homeassistant.helpers.config_validation as cv
from hom... | notification_id=NOTIFICATION_ID,
)
connection_failed += 1
if connection_failed >= len(gateways):
return False
load_platform(hass, "climate", DOMAIN, {}, config)
load_platform(hass, "binary_sensor", DOMAIN, {}, config)
return True
class MaxCubeHandle:... | """Establish connection to MAX! Cube."""
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
connection_failed = 0
gateways = config[DOMAIN][CONF_GATEWAYS]
for gateway in gateways:
host = gateway[CONF_HOST]
port = gateway[CONF_PORT]
scan_interval = gateway[CONF_SCAN_... | identifier_body |
__init__.py | """Support for the MAX! Cube LAN Gateway."""
import logging
from socket import timeout
from threading import Lock
import time
from maxcube.cube import MaxCube
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SCAN_INTERVAL
import homeassistant.helpers.config_validation as cv
from hom... | NOTIFICATION_ID = "maxcube_notification"
NOTIFICATION_TITLE = "Max!Cube gateway setup"
CONF_GATEWAYS = "gateways"
CONFIG_GATEWAY = vol.Schema(
{
vol.Required(CONF_HOST): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_SCAN_INTERVAL, default=300): cv.tim... | DEFAULT_PORT = 62910
DOMAIN = "maxcube"
DATA_KEY = "maxcube"
| random_line_split |
__init__.py | """Support for the MAX! Cube LAN Gateway."""
import logging
from socket import timeout
from threading import Lock
import time
from maxcube.cube import MaxCube
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SCAN_INTERVAL
import homeassistant.helpers.config_validation as cv
from hom... | (self, cube, scan_interval):
"""Initialize the Cube Handle."""
self.cube = cube
self.cube.use_persistent_connection = scan_interval <= 300 # seconds
self.scan_interval = scan_interval
self.mutex = Lock()
self._updatets = time.monotonic()
def update(self):
""... | __init__ | identifier_name |
FlagsSeries.js | point && point.color) || this.color, lineColor = options.lineColor, lineWidth = (point && point.lineWidth), fill = (point && point.fillColor) || options.fillColor;
if (state) {
fill = options.states[state].fillColor;
lineColor = options.states[state].lineColor;
lineWidth = op... | createPinSymbol | identifier_name | |
FlagsSeries.js | stock/plotoptions/flags-stackdistance/
* A greater stack distance
*
* @product highstock
*/
stackDistance: 12,
/**
* Text alignment for the text inside the flag.
*
* @since 5.0.0
* @product highstock
* @validvalue ["left", "center", "right"]
*/
... |
graphic.isNew = true;
}
if (plotX > 0) { // #3119
plotX -= graphic.strokeWidth() % 2; // #4285
}
// Plant the flag
attribs = {
y: plotY,
anchorY: anchorY
... | {
graphic.shadow(options.shadow);
} | conditional_block |
FlagsSeries.js | highstock
*/
style: {
/** @ignore-option */
fontSize: '11px',
/** @ignore-option */
fontWeight: 'bold'
}
},
/**
* @lends seriesTypes.flags.prototype
*/
{
sorted: false,
noSharedTooltip: true,
allowDG: false,
takeOrdinalPosition: false,
trackerGroups: ... | random_line_split | ||
FlagsSeries.js | series.yAxis, boxesMap = {}, boxes = [], centered;
i = points.length;
while (i--) {
point = points[i];
outsideRight =
(inverted ? point.plotY : point.plotX) >
series.xAxis.len;
plotX = point.plotX;
stackIndex = point.st... | {
symbols[shape + 'pin'] = function (x, y, w, h, options) {
var anchorX = options && options.anchorX, anchorY = options && options.anchorY, path, labelTopOrBottomY;
// For single-letter flags, make sure circular flags are not taller
// than their width
if (shape === 'circle' && h > w... | identifier_body | |
dashboard.utils.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* 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 ... |
export function filterValidDashboardCells(cells: DashboardCell[]): DashboardCell[] {
return (cells || []).filter(cell => isDashboardCellValid(cell));
}
export function isDashboardCellValid(cell: DashboardCell): boolean {
return !!cell?.span;
}
export function findRealDashboardCellIndexByValidIndex(cells: Dashbo... | {
return !!view?.config?.search?.dashboard;
} | identifier_body |
dashboard.utils.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* 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 ... | else {
tabs.splice(0, 0, defaultTab);
}
}
return tabs;
}
export function createDashboardTabId(title: string, usedIds: Set<string>) {
const baseId = removeAccentFromString(title, true)
.replace(/[^a-zA-Z0-9 ]/g, '')
.replace(/ +/g, '-')
.trim();
const separator = baseId.endsWith('-') ? '... | {
// we should replace saved title with translated one
tabs[tabIndex] = {...tabs[tabIndex], title: defaultTab.title};
} | conditional_block |
dashboard.utils.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* 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 ... | (view: View): boolean {
switch (view.perspective) {
case Perspective.Search:
const searchTab = searchTabsMap[view.config?.search?.searchTab || ''];
return !!searchTab;
default:
return true;
}
}
| isViewDisplayableInDashboard | identifier_name |
dashboard.utils.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* 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 ... | const tabIndex = tabs.findIndex(tab => tab.id === defaultTab.id);
if (tabIndex >= 0) {
// we should replace saved title with translated one
tabs[tabIndex] = {...tabs[tabIndex], title: defaultTab.title};
} else {
tabs.splice(0, 0, defaultTab);
}
}
return tabs;
}
export function cre... | const tabs = [...(savedTabs || [])];
for (let i = defaultDashboardTabs.length - 1; i >= 0; i--) {
const defaultTab = defaultDashboardTabs[i]; | random_line_split |
net_vlan.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# Ansible 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 Li... | description:
- Name of the VLAN.
vlan_id:
description:
- ID of the VLAN.
interfaces:
description:
- List of interfaces the VLAN should be configured on.
collection:
description: List of VLANs definitions.
purge:
description:
- Purge VLANs not defined in the collection... | random_line_split | |
unique-vec-res.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 ... | () {
let i1 = &Cell::new(0);
let i2 = &Cell::new(1);
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let r1 = vec!(Box::new(r { i: i1 }));
let r2 = vec!(Box::new(r { i: i2 }));
f(clone(&r1), clone(&r2));
//~^ ERROR the trait `core::clone::Clone` is not implemented for... | main | identifier_name |
unique-vec-res.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 ... |
fn main() {
let i1 = &Cell::new(0);
let i2 = &Cell::new(1);
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let r1 = vec!(Box::new(r { i: i1 }));
let r2 = vec!(Box::new(r { i: i2 }));
f(clone(&r1), clone(&r2));
//~^ ERROR the trait `core::clone::Clone` is not implem... | { t.clone() } | identifier_body |
unique-vec-res.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 ... | }
fn clone<T: Clone>(t: &T) -> T { t.clone() }
fn main() {
let i1 = &Cell::new(0);
let i2 = &Cell::new(1);
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let r1 = vec!(Box::new(r { i: i1 }));
let r2 = vec!(Box::new(r { i: i2 }));
f(clone(&r1), clone(&r2));
//~^ ERR... |
fn f<T>(__isize: Vec<T> , _j: Vec<T> ) { | random_line_split |
appliance-ids-resolver.ts | /*
Copyright (C) 2017 Axel Müller <axel.mueller@avanux.de>
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 License, or
(at your option) any later version.
This program is dis... | private applianceService: ApplianceService) {
}
resolve(route: ActivatedRouteSnapshot): Observable<string[]> {
return this.applianceService.getApplianceHeaders().pipe(map(applianceHeaders => applianceHeaders.map(header => header.id)));
}
}
| onstructor( | identifier_name |
appliance-ids-resolver.ts | /*
Copyright (C) 2017 Axel Müller <axel.mueller@avanux.de>
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 License, or
(at your option) any later version.
This program is dis... |
constructor(private applianceService: ApplianceService) {
}
resolve(route: ActivatedRouteSnapshot): Observable<string[]> {
return this.applianceService.getApplianceHeaders().pipe(map(applianceHeaders => applianceHeaders.map(header => header.id)));
}
} |
@Injectable()
export class ApplianceIdsResolver implements Resolve<string[]> { | random_line_split |
post-handler.ts | import { TiebaThreadMetadataObject } from './metadata-resolver';
import { TiebaUserObject, AuthorHandler } from './author-handler';
export interface PostHandlerOptions {
strip_links?: boolean;
strip_images?: boolean;
strip_small_images?: boolean;
strip_stickers?: boolean;
strip_extra_spaces?: boolean;
}
exp... | (source: string): TiebaThreadPostObject {
const { strip_links, strip_images, strip_small_images, strip_stickers, strip_extra_spaces } = this.options;
const id = PostHandler.extract('id', source);
const updated = PostHandler.extract('updated', source);
const number = PostHandler.extract('number', source)... | parse | identifier_name |
post-handler.ts | import { TiebaThreadMetadataObject } from './metadata-resolver';
import { TiebaUserObject, AuthorHandler } from './author-handler';
export interface PostHandlerOptions {
strip_links?: boolean;
strip_images?: boolean;
strip_small_images?: boolean;
strip_stickers?: boolean;
strip_extra_spaces?: boolean;
}
exp... | number?: number;
author?: TiebaUserObject;
url?: string;
}
export class PostHandler {
static get OPTIONS() {
return {
strip_links: true,
strip_images: false,
strip_small_images: true,
strip_stickers: true,
strip_extra_spaces: true
};
}
static get MIN_IMAGE_WIDTH() {
... | updated?: string; | random_line_split |
post-handler.ts | import { TiebaThreadMetadataObject } from './metadata-resolver';
import { TiebaUserObject, AuthorHandler } from './author-handler';
export interface PostHandlerOptions {
strip_links?: boolean;
strip_images?: boolean;
strip_small_images?: boolean;
strip_stickers?: boolean;
strip_extra_spaces?: boolean;
}
exp... |
}
if (id && content) {
return {
id,
number,
content,
updated,
author,
};
}
return;
}
}
| {
content = content.trim();
} | conditional_block |
http_body.rs | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | () {
proxy_wasm::set_log_level(LogLevel::Trace);
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> { Box::new(HttpBodyRoot) });
}
struct HttpBodyRoot;
impl Context for HttpBodyRoot {}
impl RootContext for HttpBodyRoot {
fn get_type(&self) -> Option<ContextType> {
Some(ContextType::HttpCont... | _start | identifier_name |
http_body.rs | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | Action::Continue
}
} | random_line_split | |
http_body.rs | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
Action::Continue
}
}
| {
let body_str = String::from_utf8(body_bytes).unwrap();
if body_str.contains("secret") {
let new_body = format!("Original message body ({} bytes) redacted.", body_size);
self.set_http_response_body(0, body_size, &new_body.into_bytes());
}
} | conditional_block |
validation_info.ts | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
}
| {
this.dialogRef.close();
} | identifier_body |
validation_info.ts | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | (): void {
this.dialogRef.close();
}
}
| onOkClick | identifier_name |
validation_info.ts | //
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language go... | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at | random_line_split | |
2d.composite.clip.source-over.worker.js | // DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.composite.clip.source-over
// Description:fill() does not affect pixels outside the clip region.
// Note:
importScripts("/resources/testharness.js");
importScripts("/2dcontext/resources/canvas-tests.js");
var t = ... | ctx.fillRect(0, 0, 100, 50);
ctx.globalCompositeOperation = 'source-over';
ctx.rect(-20, -20, 10, 10);
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255");
_assertPixel(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255");
t.d... |
ctx.fillStyle = '#0f0'; | random_line_split |
graphviz.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn dataflow_for_variant(&self, e: EntryOrExit, n: &Node, v: Variant) -> String {
let cfgidx = n.0;
match v {
Loans => self.dataflow_loans_for(e, cfgidx),
Moves => self.dataflow_moves_for(e, cfgidx),
Assigns => self.dataflow_assigns_for(e, cfgidx),
}
... | {
let id = n.1.data.id();
debug!("dataflow_for({:?}, id={}) {:?}", e, id, self.variants);
let mut sets = "".to_string();
let mut seen_one = false;
for &variant in &self.variants {
if seen_one { sets.push_str(" "); } else { seen_one = true; }
sets.push_str(... | identifier_body |
graphviz.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (&self, e: EntryOrExit, n: &Node<'a>) -> String {
let id = n.1.data.id();
debug!("dataflow_for({:?}, id={}) {:?}", e, id, self.variants);
let mut sets = "".to_string();
let mut seen_one = false;
for &variant in &self.variants {
if seen_one { sets.push_str(" "); } else... | dataflow_for | identifier_name |
graphviz.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 ... | pub enum Variant {
Loans,
Moves,
Assigns,
}
impl Variant {
pub fn short_name(&self) -> &'static str {
match *self {
Loans => "loans",
Moves => "moves",
Assigns => "assigns",
}
}
}
pub struct DataflowLabeller<'a, 'tcx: 'a> {
pub inner: cfg... | random_line_split | |
ifmt.rs | use std::fmt;
use std::usize;
struct A;
struct B;
struct C;
impl fmt::LowerHex for A {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("aloha")
}
}
impl fmt::UpperHex for B {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("adios")
}
}
impl fmt::Di... | #![deny(warnings)]
#![allow(unused_must_use)]
#![allow(unknown_features)]
#![feature(box_syntax)]
| random_line_split | |
ifmt.rs | fmt::Result {
f.write_str("aloha")
}
}
impl fmt::UpperHex for B {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("adios")
}
}
impl fmt::Display for C {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad_integral(true, "☃", "123")
}
}
macro_rule... | t!(format!("{:?}", 10_usize), "10");
t!(format!("{:?}", "true"), "\"true\"");
t!(format!("{:?}", "foo\nbar"), "\"foo\\nbar\"");
t!(format!("{:o}", 10_usize), "12");
t!(format!("{:x}", 10_usize), "a");
t!(format!("{:X}", 10_usize), "A");
t!(format!("{}", "foo"), "foo");
t!(format!("{}", "... | // Various edge cases without formats
t!(format!(""), "");
t!(format!("hello"), "hello");
t!(format!("hello {{"), "hello {");
// default formatters should work
t!(format!("{}", 1.0f32), "1");
t!(format!("{}", 1.0f64), "1");
t!(format!("{}", "a"), "a");
t!(format!("{}", "a".to_string... | identifier_body |
ifmt.rs | fmt::Result {
f.write_str("aloha")
}
}
impl fmt::UpperHex for B {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("adios")
}
}
impl fmt::Display for C {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad_integral(true, "☃", "123")
}
}
macro_rule... | format!("{:p}", 0x1234 as *const isize), "0x1234");
t!(format!("{:p}", 0x1234 as *mut isize), "0x1234");
t!(format!("{:x}", A), "aloha");
t!(format!("{:X}", B), "adios");
t!(format!("foo {} ☃☃☃☃☃☃", "bar"), "foo bar ☃☃☃☃☃☃");
t!(format!("{1} {0}", 0, 1), "1 0");
t!(format!("{foo} {bar}", foo=0, ... | t!(format!("{:#p}", 0x1234 as *const isize), "0x0000000000001234");
t!(format!("{:#p}", 0x1234 as *mut isize), "0x0000000000001234");
}
t!( | conditional_block |
ifmt.rs | fmt::Result {
f.write_str("aloha")
}
}
impl fmt::UpperHex for B {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("adios")
}
}
impl fmt::Display for C {
fn | (&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad_integral(true, "☃", "123")
}
}
macro_rules! t {
($a:expr, $b:expr) => { assert_eq!($a, $b) }
}
pub fn main() {
// Various edge cases without formats
t!(format!(""), "");
t!(format!("hello"), "hello");
t!(format!("hello {{"), "hello... | fmt | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.