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 |
|---|---|---|---|---|
config_dump.rs | /*
* 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 t... |
Err(err) => {
*response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
*response.body_mut() = Body::from(format!("failed to create config dump: {err}"));
}
}
response
}
fn create_config_dump_json(
cluster_manager: SharedClusterManager,
filter_manager: Shared... | {
*response.status_mut() = StatusCode::OK;
response
.headers_mut()
.insert("Content-Type", HeaderValue::from_static("application/json"));
*response.body_mut() = Body::from(body);
} | conditional_block |
config_dump.rs | /*
* 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 t... | (
cluster_manager: SharedClusterManager,
filter_manager: SharedFilterManager,
) -> Result<String, serde_json::Error> {
let endpoints = {
let cluster_manager = cluster_manager.read();
// Clone the list of endpoints immediately so that we don't hold on
// to the cluster manager's lock ... | create_config_dump_json | identifier_name |
config_dump.rs | /*
* 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 t... |
fn create_config_dump_json(
cluster_manager: SharedClusterManager,
filter_manager: SharedFilterManager,
) -> Result<String, serde_json::Error> {
let endpoints = {
let cluster_manager = cluster_manager.read();
// Clone the list of endpoints immediately so that we don't hold on
// to... | {
let mut response = Response::new(Body::empty());
match create_config_dump_json(cluster_manager, filter_manager) {
Ok(body) => {
*response.status_mut() = StatusCode::OK;
response
.headers_mut()
.insert("Content-Type", HeaderValue::from_static("app... | identifier_body |
config_dump.rs | /*
* 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 t... | clusters: vec![ClusterDump {
name: "default-quilkin-cluster",
endpoints,
}],
filterchain: FilterChainDump { filters },
};
serde_json::to_string_pretty(&dump)
}
#[cfg(test)]
mod tests {
use super::handle_request;
use crate::cluster::cluster_manager::Clust... | };
let dump = ConfigDump { | random_line_split |
api.js | //@flow
const API_URL = "https://api.dribbble.com/v1/",
ACCESS_TOKEN = "8d9bd601f9461955b330d88c44f2930257364de98cddc2064d93cdcb300cb91d";
function | (URL) {
return fetch(URL, {
headers: {
"Authorization": "Bearer " + ACCESS_TOKEN
}
}).then((response) => response.json())
}
export function getShotsByType(type: string, pageNumber: ?number): ?Object {
var URL = API_URL + "shots/?list=" + type;
if (pageNumber) {
URL +... | fetchData | identifier_name |
api.js | //@flow
const API_URL = "https://api.dribbble.com/v1/",
ACCESS_TOKEN = "8d9bd601f9461955b330d88c44f2930257364de98cddc2064d93cdcb300cb91d";
function fetchData(URL) {
return fetch(URL, {
headers: {
"Authorization": "Bearer " + ACCESS_TOKEN
}
}).then((response) => response.json())... | {
return fetchData(url);
} | identifier_body | |
api.js | //@flow
const API_URL = "https://api.dribbble.com/v1/",
ACCESS_TOKEN = "8d9bd601f9461955b330d88c44f2930257364de98cddc2064d93cdcb300cb91d";
function fetchData(URL) {
return fetch(URL, {
headers: {
"Authorization": "Bearer " + ACCESS_TOKEN
}
}).then((response) => response.json())... |
return fetchData(URL);
}
export function getResources(url: ?string): ?Object {
return fetchData(url);
}
| {
URL += "&per_page=10&page=" + pageNumber;
} | conditional_block |
api.js | //@flow
const API_URL = "https://api.dribbble.com/v1/",
ACCESS_TOKEN = "8d9bd601f9461955b330d88c44f2930257364de98cddc2064d93cdcb300cb91d";
function fetchData(URL) { | }).then((response) => response.json())
}
export function getShotsByType(type: string, pageNumber: ?number): ?Object {
var URL = API_URL + "shots/?list=" + type;
if (pageNumber) {
URL += "&per_page=10&page=" + pageNumber;
}
return fetchData(URL);
}
export function getResources(url: ?string... | return fetch(URL, {
headers: {
"Authorization": "Bearer " + ACCESS_TOKEN
} | random_line_split |
states-int-test.js | var flow = require('js-flow'),
assert = require('assert'),
tubes = require('evo-tubes');
describe('evo-states', function () {
var TIMEOUT = 60000;
var sandbox;
beforeEach(function (done) {
this.timeout(TIMEOUT);
(sandbox = new tubes.Sandbox())
.add(new tubes.Environmen... | });
}); | })
.with(sandbox.res('evo-states'))
.run(done) | random_line_split |
util.py | #__author__ = 'hello'
# -*- coding: cp936 -*-
import re
import os
import random
import json
import string
import ctypes
from myexception import *
PATH = './img/'
dm2 = ctypes.WinDLL('./CrackCaptchaAPI.dll')
if not os.path.exists('./img'):
os.mkdir('./img')
def str_tr(content):
instr = "0123456789"
outs... |
def GetCaptcha(content):
global PATH
filename = ''.join(random.sample(string.ascii_letters,8))
filename += '.jpg'
filename = PATH+filename
img = None
try:
img = open(filename,'wb')
img.write(content)
except IOError:
raise FileCanNotCreate('open file error')
fina... | s = ''
pattern = re.compile('securityCToken = "([+-]?\d*)"')
match = pattern.search(content)
if match:
s = match.group(1)
return s | identifier_body |
util.py | #__author__ = 'hello'
# -*- coding: cp936 -*-
import re
import os
import random
import json
import string
import ctypes
from myexception import *
PATH = './img/'
dm2 = ctypes.WinDLL('./CrackCaptchaAPI.dll')
if not os.path.exists('./img'):
os.mkdir('./img')
def str_tr(content):
instr = "0123456789"
outs... | msg['Subject'] = Header(subject,'utf-8')
msg['From'] = sender
msg['To'] = receiver
try:
send_smtp = smtplib.SMTP()
send_smtp.connect(smtpserver)
send_smtp.login(user,pas)
send_smtp.sendmail(sender,receiver,msg.as_string())
send_smtp.close()
print 'ok'
... | random_line_split | |
util.py | #__author__ = 'hello'
# -*- coding: cp936 -*-
import re
import os
import random
import json
import string
import ctypes
from myexception import *
PATH = './img/'
dm2 = ctypes.WinDLL('./CrackCaptchaAPI.dll')
if not os.path.exists('./img'):
os.mkdir('./img')
def str_tr(content):
instr = "0123456789"
outs... | ():
return ''.join(random.sample(string.ascii_letters,8))
def getCToken(content):
s = ''
pattern = re.compile('securityCToken = "([+-]?\d*)"')
match = pattern.search(content)
if match:
s = match.group(1)
return s
def GetCaptcha(content):
global PATH
filename = ''.join(random.... | getEightRandomString | identifier_name |
util.py | #__author__ = 'hello'
# -*- coding: cp936 -*-
import re
import os
import random
import json
import string
import ctypes
from myexception import *
PATH = './img/'
dm2 = ctypes.WinDLL('./CrackCaptchaAPI.dll')
if not os.path.exists('./img'):
os.mkdir('./img')
def str_tr(content):
instr = "0123456789"
outs... |
dm2.D2File.argtypes=[ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_short, ctypes.c_int, ctypes.c_char_p]
dm2.D2File.restype = ctypes.c_int
key = ctypes.c_char_p('fa6fd217145f273b59d7e72c1b63386e')
id = ctypes.c_long(54)
user = ctypes.c_char_p('test')
pas = ctypes... | img.close() | conditional_block |
log.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
""" Log Config
"""
__author__ = 'Zagfai'
__date__ = '2018-06'
SANIC_LOGGING_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
'format':
'%(levelname)s [%(asctime)s %(name)s:%(lineno)d] %(me... | 'formatter': 'default',
},
"access_console": {
"class": "logging.StreamHandler",
"formatter": "access",
},
},
'loggers': {
'': {
'level': 'INFO',
'handlers': ['console'],
'propagate': True
},
... | },
'handlers': {
'console': {
'class': 'logging.StreamHandler', | random_line_split |
download_package.py | #!/usr/bin/env python3
"""
librepo - download a package
"""
import os
import sys
import shutil
from pprint import pprint
import librepo
DESTDIR = "downloaded_metadata"
PROGRESSBAR_LEN = 40
finished = False
def callback(data, total_to_download, downloaded):
|
if __name__ == "__main__":
pkgs = [
("ImageMagick-djvu", "Packages/i/ImageMagick-djvu-6.7.5.6-3.fc17.i686.rpm"),
("i2c-tools-eepromer", "Packages/i/i2c-tools-eepromer-3.1.0-1.fc17.i686.rpm")
]
h = librepo.Handle()
h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linu... | """Progress callback"""
global finished
if total_to_download != downloaded:
finished = False
if total_to_download <= 0 or finished == True:
return
completed = int(downloaded / (total_to_download / PROGRESSBAR_LEN))
print("%30s: [%s%s] %8s/%8s\r" % (data, '#'*completed, '-'*(PROGRE... | identifier_body |
download_package.py | #!/usr/bin/env python3
"""
librepo - download a package
"""
import os
import sys
import shutil
from pprint import pprint
import librepo
DESTDIR = "downloaded_metadata"
PROGRESSBAR_LEN = 40
finished = False
def callback(data, total_to_download, downloaded):
"""Progress callback"""
global finished
if to... |
if __name__ == "__main__":
pkgs = [
("ImageMagick-djvu", "Packages/i/ImageMagick-djvu-6.7.5.6-3.fc17.i686.rpm"),
("i2c-tools-eepromer", "Packages/i/i2c-tools-eepromer-3.1.0-1.fc17.i686.rpm")
]
h = librepo.Handle()
h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linu... | print()
finished = True
return | conditional_block |
download_package.py | #!/usr/bin/env python3
"""
librepo - download a package
"""
import os
import sys
import shutil
from pprint import pprint
import librepo
DESTDIR = "downloaded_metadata"
PROGRESSBAR_LEN = 40
finished = False
def callback(data, total_to_download, downloaded):
"""Progress callback"""
global finished
if to... | ("ImageMagick-djvu", "Packages/i/ImageMagick-djvu-6.7.5.6-3.fc17.i686.rpm"),
("i2c-tools-eepromer", "Packages/i/i2c-tools-eepromer-3.1.0-1.fc17.i686.rpm")
]
h = librepo.Handle()
h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"])
h.... |
if __name__ == "__main__":
pkgs = [ | random_line_split |
download_package.py | #!/usr/bin/env python3
"""
librepo - download a package
"""
import os
import sys
import shutil
from pprint import pprint
import librepo
DESTDIR = "downloaded_metadata"
PROGRESSBAR_LEN = 40
finished = False
def | (data, total_to_download, downloaded):
"""Progress callback"""
global finished
if total_to_download != downloaded:
finished = False
if total_to_download <= 0 or finished == True:
return
completed = int(downloaded / (total_to_download / PROGRESSBAR_LEN))
print("%30s: [%s%s] %8s... | callback | identifier_name |
class-attributes-1.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 ... | {
name: ~str,
}
impl Drop for cat {
#[cat_dropper]
fn drop(&mut self) { error2!("{} landed on hir feet" , self . name); }
}
#[cat_maker]
fn cat(name: ~str) -> cat { cat{name: name,} }
pub fn main() { let _kitty = cat(~"Spotty"); }
| cat | identifier_name |
class-attributes-1.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 ... | }
impl Drop for cat {
#[cat_dropper]
fn drop(&mut self) { error2!("{} landed on hir feet" , self . name); }
}
#[cat_maker]
fn cat(name: ~str) -> cat { cat{name: name,} }
pub fn main() { let _kitty = cat(~"Spotty"); } |
struct cat {
name: ~str, | random_line_split |
class-attributes-1.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 ... |
}
#[cat_maker]
fn cat(name: ~str) -> cat { cat{name: name,} }
pub fn main() { let _kitty = cat(~"Spotty"); }
| { error2!("{} landed on hir feet" , self . name); } | identifier_body |
app.js | // this sets the background color of the master UIView (when there are no windows/tab groups on it)
Ti.UI.setBackgroundColor('#000');
Ti.UI.iPhone.statusBarStyle = Ti.UI.iPhone.StatusBar.OPAQUE_BLACK;
//Create main app namespace
var demo={};
//Create a few helpers
demo.myHelpers = {
isAndroid : function(){
return (T... | }else{
demo.mainWindow.open();
} | tabGroup.addTab(tab1);
// open tab group
tabGroup.open(); | random_line_split |
app.js | // this sets the background color of the master UIView (when there are no windows/tab groups on it)
Ti.UI.setBackgroundColor('#000');
Ti.UI.iPhone.statusBarStyle = Ti.UI.iPhone.StatusBar.OPAQUE_BLACK;
//Create main app namespace
var demo={};
//Create a few helpers
demo.myHelpers = {
isAndroid : function(){
return (T... | else{
demo.mainWindow.open();
}
| {
var tabGroup = Ti.UI.createTabGroup();
var tab1 = Ti.UI.createTab({window:demo.mainWindow});
tabGroup.addTab(tab1);
// open tab group
tabGroup.open();
} | conditional_block |
local_transactions.rs | // Copyright 2015, 2016 Parity Technologies (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 la... | } | } | random_line_split |
local_transactions.rs | // Copyright 2015, 2016 Parity Technologies (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 la... |
let to_remove = self.transactions
.iter()
.filter(|&(_, status)| !status.is_current())
.map(|(hash, _)| *hash)
.take(number_of_old - self.max_old)
.collect::<Vec<_>>();
for hash in to_remove {
self.transactions.remove(&hash);
}
}
}
#[cfg(test)]
mod tests {
use util::U256;
use ethkey::{Ran... | {
return;
} | conditional_block |
local_transactions.rs | // Copyright 2015, 2016 Parity Technologies (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 la... |
pub fn mark_mined(&mut self, tx: SignedTransaction) {
self.transactions.insert(tx.hash(), Status::Mined(tx));
self.clear_old();
}
pub fn contains(&self, hash: &H256) -> bool {
self.transactions.contains_key(hash)
}
pub fn all_transactions(&self) -> &LinkedHashMap<H256, Status> {
&self.transactions
}
... | {
self.transactions.insert(tx.hash(), Status::Dropped(tx));
self.clear_old();
} | identifier_body |
local_transactions.rs | // Copyright 2015, 2016 Parity Technologies (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 la... | (&self) -> bool {
*self == Status::Pending || *self == Status::Future
}
}
/// Keeps track of local transactions that are in the queue or were mined/dropped recently.
#[derive(Debug)]
pub struct LocalTransactionsList {
max_old: usize,
transactions: LinkedHashMap<H256, Status>,
}
impl Default for LocalTransactions... | is_current | identifier_name |
lib.rs | // This is a part of rust-encoding.
// Copyright (c) 2013-2015, Kang Seonghoon.
// See README.md and LICENSE.txt for details.
//! # Encoding 0.3.0-dev
//!
//! Character encoding support for Rust. (also known as `rust-encoding`)
//! It is based on [WHATWG Encoding Standard](http://encoding.spec.whatwg.org/),
//! and al... | cfg(test)]
mod tests {
use super::*;
#[test]
fn test_decode() {
fn test_one(input: &[u8], expected_result: &str, expected_encoding: &str) {
let (result, used_encoding) = decode(
input, DecoderTrap::Strict, all::ISO_8859_1 as EncodingRef);
let result = result.... | use all::{UTF_8, UTF_16LE, UTF_16BE};
if input.starts_with(&[0xEF, 0xBB, 0xBF]) {
(UTF_8.decode(&input[3..], trap), UTF_8 as EncodingRef)
} else if input.starts_with(&[0xFE, 0xFF]) {
(UTF_16BE.decode(&input[2..], trap), UTF_16BE as EncodingRef)
} else if input.starts_with(&[0xFF, 0xFE]) {
... | identifier_body |
lib.rs | // This is a part of rust-encoding.
// Copyright (c) 2013-2015, Kang Seonghoon.
// See README.md and LICENSE.txt for details.
//! # Encoding 0.3.0-dev
//!
//! Character encoding support for Rust. (also known as `rust-encoding`)
//! It is based on [WHATWG Encoding Standard](http://encoding.spec.whatwg.org/),
//! and al... | #[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_decode() {
fn test_one(input: &[u8], expected_result: &str, expected_encoding: &str) {
let (result, used_encoding) = decode(
input, DecoderTrap::Strict, all::ISO_8859_1 as EncodingRef);
let result = resul... | (fallback_encoding.decode(input, trap), fallback_encoding)
}
}
| conditional_block |
lib.rs | // This is a part of rust-encoding.
// Copyright (c) 2013-2015, Kang Seonghoon.
// See README.md and LICENSE.txt for details.
//! # Encoding 0.3.0-dev
//!
//! Character encoding support for Rust. (also known as `rust-encoding`)
//! It is based on [WHATWG Encoding Standard](http://encoding.spec.whatwg.org/),
//! and al... | //!
//! ### Data Table
//!
//! By default, Encoding comes with ~480 KB of data table ("indices").
//! This allows Encoding to encode and decode legacy encodings efficiently,
//! but this might not be desirable for some applications.
//!
//! Encoding provides the `no-optimized-legacy-encoding` Cargo feature
//! to reduc... | random_line_split | |
lib.rs | // This is a part of rust-encoding.
// Copyright (c) 2013-2015, Kang Seonghoon.
// See README.md and LICENSE.txt for details.
//! # Encoding 0.3.0-dev
//!
//! Character encoding support for Rust. (also known as `rust-encoding`)
//! It is based on [WHATWG Encoding Standard](http://encoding.spec.whatwg.org/),
//! and al... | ut: &[u8], trap: DecoderTrap, fallback_encoding: EncodingRef)
-> (Result<String, Cow<'static, str>>, EncodingRef) {
use all::{UTF_8, UTF_16LE, UTF_16BE};
if input.starts_with(&[0xEF, 0xBB, 0xBF]) {
(UTF_8.decode(&input[3..], trap), UTF_8 as EncodingRef)
} else if input.starts_with(&[0xFE,... | de(inp | identifier_name |
page_privacy.py | from __future__ import absolute_import, unicode_literals
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from wagtail.wagtailadmin.forms import PageViewRestrictionForm
from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
from wagtail.wagtailcore.mode... |
else:
restriction = form.save(commit=False)
restriction.page = page
form.save()
return render_modal_workflow(
request, None, 'wagtailadmin/page_privacy/set_privacy_done.js', {
'is_public': (form.cleaned_data['r... | restriction.delete() | conditional_block |
page_privacy.py | from __future__ import absolute_import, unicode_literals
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from wagtail.wagtailadmin.forms import PageViewRestrictionForm
from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
from wagtail.wagtailcore.mode... | page = get_object_or_404(Page, id=page_id)
page_perms = page.permissions_for_user(request.user)
if not page_perms.can_set_view_restrictions():
raise PermissionDenied
# fetch restriction records in depth order so that ancestors appear first
restrictions = page.get_view_restrictions().order_by('p... | identifier_body | |
page_privacy.py | from __future__ import absolute_import, unicode_literals
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from wagtail.wagtailadmin.forms import PageViewRestrictionForm
from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
from wagtail.wagtailcore.mode... | (request, page_id):
page = get_object_or_404(Page, id=page_id)
page_perms = page.permissions_for_user(request.user)
if not page_perms.can_set_view_restrictions():
raise PermissionDenied
# fetch restriction records in depth order so that ancestors appear first
restrictions = page.get_view_re... | set_privacy | identifier_name |
page_privacy.py | from __future__ import absolute_import, unicode_literals
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from wagtail.wagtailadmin.forms import PageViewRestrictionForm
from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
from wagtail.wagtailcore.mode... | # display a message indicating that there is a restriction at ancestor level -
# do not provide the form for setting up new restrictions
return render_modal_workflow(
request, 'wagtailadmin/page_privacy/ancestor_privacy.html', None,
{
'page_with_restrictio... | 'restriction_type': 'none'
})
if restriction_exists_on_ancestor: | random_line_split |
ovirt_quota_facts.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# 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 License, or
#... |
if __name__ == '__main__':
main()
| argument_spec = ovirt_facts_full_argument_spec(
data_center=dict(required=True),
name=dict(default=None),
)
module = AnsibleModule(argument_spec)
if module._name == 'ovirt_quotas_facts':
module.deprecate("The 'ovirt_quotas_facts' module is being renamed 'ovirt_quota_facts'", version... | identifier_body |
ovirt_quota_facts.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# 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 License, or
#... | ():
argument_spec = ovirt_facts_full_argument_spec(
data_center=dict(required=True),
name=dict(default=None),
)
module = AnsibleModule(argument_spec)
if module._name == 'ovirt_quotas_facts':
module.deprecate("The 'ovirt_quotas_facts' module is being renamed 'ovirt_quota_facts'",... | main | identifier_name |
ovirt_quota_facts.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# 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 License, or
#... | description: "List of dictionaries describing the quotas. Quota attributes are mapped to dictionary keys,
all quotas attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/quota."
returned: On success.
type: list
'''
import fnmatch
import tra... | ovirt_quotas: | random_line_split |
ovirt_quota_facts.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# 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 License, or
#... |
module.exit_json(
changed=False,
ansible_facts=dict(
ovirt_quotas=[
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
... | quotas = quotas_service.list() | conditional_block |
mdn.py | # -*- coding: utf-8 -*-
from collections import defaultdict
import json
import logging
from ._compat import ElementTree, urlopen
MDN_SITEMAP = 'https://developer.mozilla.org/sitemaps/en-US/sitemap.xml'
SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9'
log = logging.getLogger(__name__)
def | ():
"""
Generate a cross-reference dictionary for the MDN JavaScript Reference.
:rtype: dict
"""
with urlopen(MDN_SITEMAP) as f:
xml = ElementTree.parse(f)
refs = defaultdict(dict)
for loc in xml.iterfind('{{{ns}}}url/{{{ns}}}loc'.format(ns=SITEMAP_NS)):
url = loc.text
... | parse | identifier_name |
mdn.py | # -*- coding: utf-8 -*-
from collections import defaultdict
import json
import logging
from ._compat import ElementTree, urlopen
MDN_SITEMAP = 'https://developer.mozilla.org/sitemaps/en-US/sitemap.xml'
SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9'
log = logging.getLogger(__name__)
def parse():
"""... |
else:
ref_type = 'data'
elif len(parts) == 2:
cls, attr = parts
with urlopen('{url}$json'.format(url=url)) as f:
metadata = json.loads(f.read().decode('utf-8'))
name = '{0}.{1}'.format(cls, attr)
if 'Method' in metadata... | ref_type = 'class' | conditional_block |
mdn.py | # -*- coding: utf-8 -*-
from collections import defaultdict
import json
import logging
from ._compat import ElementTree, urlopen
MDN_SITEMAP = 'https://developer.mozilla.org/sitemaps/en-US/sitemap.xml'
SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9'
log = logging.getLogger(__name__)
| :rtype: dict
"""
with urlopen(MDN_SITEMAP) as f:
xml = ElementTree.parse(f)
refs = defaultdict(dict)
for loc in xml.iterfind('{{{ns}}}url/{{{ns}}}loc'.format(ns=SITEMAP_NS)):
url = loc.text
if 'JavaScript/Reference/Global_Objects/' not in url:
continue
url... | def parse():
"""
Generate a cross-reference dictionary for the MDN JavaScript Reference.
| random_line_split |
mdn.py | # -*- coding: utf-8 -*-
from collections import defaultdict
import json
import logging
from ._compat import ElementTree, urlopen
MDN_SITEMAP = 'https://developer.mozilla.org/sitemaps/en-US/sitemap.xml'
SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9'
log = logging.getLogger(__name__)
def parse():
| """
Generate a cross-reference dictionary for the MDN JavaScript Reference.
:rtype: dict
"""
with urlopen(MDN_SITEMAP) as f:
xml = ElementTree.parse(f)
refs = defaultdict(dict)
for loc in xml.iterfind('{{{ns}}}url/{{{ns}}}loc'.format(ns=SITEMAP_NS)):
url = loc.text
if 'J... | identifier_body | |
gdb-pretty-struct-and-enums.rs | // Copyright 2013-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... | c_style_enum: CStyleEnum,
mixed_enum: MixedEnum,
}
enum NestedEnum {
NestedVariant1(NestedStruct),
NestedVariant2 { abc: NestedStruct }
}
fn main() {
let regular_struct = RegularStruct {
the_first_field: 101,
the_second_field: 102.5,
the_third_field: false,
the_fou... | random_line_split | |
gdb-pretty-struct-and-enums.rs | // Copyright 2013-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... | {
MixedEnumCStyleVar,
MixedEnumTupleVar(u32, u16, bool),
MixedEnumStructVar { field1: f64, field2: i32 }
}
struct NestedStruct {
regular_struct: RegularStruct,
tuple_struct: TupleStruct,
empty_struct: EmptyStruct,
c_style_enum: CStyleEnum,
mixed_enum: MixedEnum,
}
enum NestedEnum {
... | MixedEnum | identifier_name |
gdb-pretty-struct-and-enums.rs | // Copyright 2013-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... | { () } | identifier_body | |
extendablemessageevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::ExtendableMessageEventBinding;
use dom::bindings::codegen::Bindings::Extenda... |
// https://w3c.github.io/ServiceWorker/#extendablemessage-event-origin-attribute
fn Origin(&self) -> DOMString {
self.origin.clone()
}
// https://w3c.github.io/ServiceWorker/#extendablemessage-event-lasteventid-attribute
fn LastEventId(&self) -> DOMString {
self.lastEventId.clone(... | {
self.data.get()
} | identifier_body |
extendablemessageevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::ExtendableMessageEventBinding;
use dom::bindings::codegen::Bindings::Extenda... | impl ExtendableMessageEvent {
pub fn dispatch_jsval(target: &EventTarget,
scope: &GlobalScope,
message: HandleValue) {
let Extendablemessageevent = ExtendableMessageEvent::new(
scope, atom!("message"), false, false, message,
DOMStri... | random_line_split | |
extendablemessageevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::ExtendableMessageEventBinding;
use dom::bindings::codegen::Bindings::Extenda... | (&self) -> DOMString {
self.lastEventId.clone()
}
// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
| LastEventId | identifier_name |
UserAvatar.tsx | import * as React from 'react'
import {Persona, PersonaSize} from 'office-ui-fabric-react/lib/Persona'
import {UserMap, formatUrl} from 'yam-data'
import './UserAvatar.css'
export enum UserAvatarSize {
tiny = 12,
extraSmall = 32,
small = 40,
regular = 48,
large = 72,
extraLarge = 100
}
export interface Us... | () {
const {user, size = UserAvatarSize.regular, showDetails = false} = this.props
const actualSize = Math.round(size * window.devicePixelRatio)
const name = user && user.get('name')
const title = user && user.get('job_title')
const imageUrl = user && user.get('mugshot_url')
const formattedImag... | render | identifier_name |
UserAvatar.tsx | import * as React from 'react'
import {Persona, PersonaSize} from 'office-ui-fabric-react/lib/Persona'
import {UserMap, formatUrl} from 'yam-data'
import './UserAvatar.css'
export enum UserAvatarSize {
tiny = 12,
extraSmall = 32,
small = 40,
regular = 48,
large = 72,
extraLarge = 100
}
export interface Us... | public render () {
const {user, size = UserAvatarSize.regular, showDetails = false} = this.props
const actualSize = Math.round(size * window.devicePixelRatio)
const name = user && user.get('name')
const title = user && user.get('job_title')
const imageUrl = user && user.get('mugshot_url')
cons... | }
export default class UserAvatar extends React.PureComponent<UserAvatarProps, {}> { | random_line_split |
0012_auto_20160212_1210.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class | (migrations.Migration):
dependencies = [
('characters', '0011_auto_20160212_1144'),
]
operations = [
migrations.CreateModel(
name='CharacterSpells',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=T... | Migration | identifier_name |
0012_auto_20160212_1210.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('characters', '0011_auto_20160212_1144'),
]
operations = [
migrations.CreateModel(
name='CharacterSpells', | 'verbose_name': 'Karakt\xe4rers magi',
'verbose_name_plural': 'Karakt\xe4rers magi',
},
),
migrations.AlterModelOptions(
name='spellextras',
options={'verbose_name': 'Magi extra', 'verbose_name_plural': 'Magi extra'},
),
... | fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('character', models.ForeignKey(verbose_name='Karakt\xe4r', to='characters.Character')),
],
options={ | random_line_split |
0012_auto_20160212_1210.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
| dependencies = [
('characters', '0011_auto_20160212_1144'),
]
operations = [
migrations.CreateModel(
name='CharacterSpells',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('char... | identifier_body | |
constellation_msg.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/. */
//! The high-level interface from script to constellation. Using this abstract interface helps
//! reduce coupling... | pub type PanicMsg = (Option<PipelineId>, String, String);
#[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)]
pub struct WindowSizeData {
/// The size of the initial layout viewport, before parsing an
/// http://www.w3.org/TR/css-device-adapt/#initial-viewport
pub initial_viewport: TypedSize2D<Viewp... | }
}
| random_line_split |
constellation_msg.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/. */
//! The high-level interface from script to constellation. Using this abstract interface helps
//! reduce coupling... |
}
impl ConvertPipelineIdFromWebRender for webrender_traits::PipelineId {
fn from_webrender(&self) -> PipelineId {
PipelineId {
namespace_id: PipelineNamespaceId(self.0),
index: PipelineIndex(self.1),
}
}
}
/// [Policies](https://w3c.github.io/webappsec-referrer-policy/... | {
let PipelineNamespaceId(namespace_id) = self.namespace_id;
let PipelineIndex(index) = self.index;
webrender_traits::PipelineId(namespace_id, index)
} | identifier_body |
constellation_msg.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/. */
//! The high-level interface from script to constellation. Using this abstract interface helps
//! reduce coupling... | () -> PipelineId {
PipelineId {
namespace_id: PipelineNamespaceId(0),
index: PipelineIndex(0),
}
}
}
impl fmt::Display for PipelineId {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let PipelineNamespaceId(namespace_id) = self.namespace_id;
let... | fake_root_pipeline_id | identifier_name |
15.2.3.7-6-a-90.js | // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 15.2.3.7-6-a-90
description: >
Object.defineProperties will not throw TypeError when
P.configurable is false, both properties.[[Get]] and P.[[Get]] are
two obj... | (value) {
obj.setVerifyHelpProp = value;
}
function get_func() {
return 10;
}
Object.defineProperty(obj, "foo", {
get: get_func,
set: set_func,
enumerable: false,
configurable: false
});
Object.defineProperties(obj, {
foo: {
get: get_func
}
});
verifyEqualTo(obj, "foo", get_fun... | set_func | identifier_name |
15.2.3.7-6-a-90.js | // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. |
/*---
es5id: 15.2.3.7-6-a-90
description: >
Object.defineProperties will not throw TypeError when
P.configurable is false, both properties.[[Get]] and P.[[Get]] are
two objects which refer to the same object (8.12.9 step 11.a.ii)
includes: [propertyHelper.js]
---*/
var obj = {};
function set_func(value)... | random_line_split | |
15.2.3.7-6-a-90.js | // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 15.2.3.7-6-a-90
description: >
Object.defineProperties will not throw TypeError when
P.configurable is false, both properties.[[Get]] and P.[[Get]] are
two obj... |
Object.defineProperty(obj, "foo", {
get: get_func,
set: set_func,
enumerable: false,
configurable: false
});
Object.defineProperties(obj, {
foo: {
get: get_func
}
});
verifyEqualTo(obj, "foo", get_func());
verifyWritable(obj, "foo", "setVerifyHelpProp");
verifyNotEnumerable(obj, "fo... | {
return 10;
} | identifier_body |
AlreadyIncluded.js | /**
* Copyright 2016-present Telldus Technologies AB.
*
* This file is part of the Telldus Live! app.
*
* Telldus Live! app is free : 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
*... | onPress={this.onPressNext}
iconName={'checkmark'}
iconSize={iconSize}
iconStyle={iconStyle}
/>
</View>
);
}
getStyles(): Object {
const { appLayout } = this.props;
const { height, width } = appLayout;
const isPortrait = height > width;
const deviceWidth = isPortrait ? width : height;
const {... | infoContainer={infoContainer}
textStyle={infoTextStyle}
infoIconStyle={statusIconStyle}/>
</ThemedScrollView>
<FloatingButton | random_line_split |
AlreadyIncluded.js | /**
* Copyright 2016-present Telldus Technologies AB.
*
* This file is part of the Telldus Live! app.
*
* Telldus Live! app is free : 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
*... | extends View<Props, null> {
props: Props;
onPressNext: () => void;
constructor(props: Props) {
super(props);
this.onPressNext = this.onPressNext.bind(this);
}
componentDidMount() {
const { onDidMount, intl } = this.props;
const { formatMessage } = intl;
onDidMount(`${capitalize(formatMessage(i18n.defaultHeader... | AlreadyIncluded | identifier_name |
ioapiset.rs | // 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 option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according ... | pub fn GetOverlappedResultEx(
hFile: HANDLE,
lpOverlapped: LPOVERLAPPED,
lpNumberOfBytesTransferred: LPDWORD,
dwMilliseconds: DWORD,
bAlertable: BOOL,
) -> BOOL;
pub fn CancelSynchronousIo(
hThread: HANDLE,
) -> BOOL;
} | lpOverlapped: LPOVERLAPPED,
) -> BOOL;
pub fn CancelIo(
hFile: HANDLE,
) -> BOOL; | random_line_split |
country.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from uslug import uSlug as slugify
__all__ = ['Country']
class Country(models.Model):
name = models.CharField(_('Country name'), max_length=128, unique=True, db_index=True, blank=False, null=False)
slu... | (self, *args, **kwargs):
if not self.full_name:
self.full_name = self.name
self.slug = slugify(self.name, instance=self)
super(Country, self).save(*args, **kwargs)
| save | identifier_name |
country.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from uslug import uSlug as slugify
__all__ = ['Country']
class Country(models.Model):
name = models.CharField(_('Country name'), max_length=128, unique=True, db_index=True, blank=False, null=False)
slu... | super(Country, self).save(*args, **kwargs) | random_line_split | |
country.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from uslug import uSlug as slugify
__all__ = ['Country']
class Country(models.Model):
name = models.CharField(_('Country name'), max_length=128, unique=True, db_index=True, blank=False, null=False)
slu... |
self.slug = slugify(self.name, instance=self)
super(Country, self).save(*args, **kwargs)
| self.full_name = self.name | conditional_block |
country.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from uslug import uSlug as slugify
__all__ = ['Country']
class Country(models.Model):
name = models.CharField(_('Country name'), max_length=128, unique=True, db_index=True, blank=False, null=False)
slu... |
class Meta:
app_label = 'worldwide'
db_table = app_label + '-country'
verbose_name = _('country')
verbose_name_plural = _('countries')
ordering = ('name', 'full_name', 'iso_2',)
def save(self, *args, **kwargs):
if not self.full_name:
self.full_name ... | return self.full_name | identifier_body |
ActionManager.ts | namespace phasereditor2d.scene.ui.editor {
export class ActionManager {
private _editor: SceneEditor;
constructor(editor: SceneEditor) {
this._editor = editor;
}
deleteObjects() {
const objects = this._editor.getSelectedGameObjects();
// creat... |
}
const container = this._editor.getSceneMaker().createContainerWithObjects(sel);
this._editor.getUndoManager().add(new undo.JoinObjectsInContainerOperation(this._editor, container));
this._editor.setSelection([container]);
this._editor.refreshOutline();
... | {
alert("Nested containers are not supported");
return;
} | conditional_block |
ActionManager.ts | namespace phasereditor2d.scene.ui.editor {
export class ActionManager {
private _editor: SceneEditor;
constructor(editor: SceneEditor) {
this._editor = editor;
}
deleteObjects() {
const objects = this._editor.getSelectedGameObjects();
// creat... |
}
} | {
const sel = this._editor.getSelectedGameObjects();
for (const obj of sel) {
if (obj instanceof Phaser.GameObjects.Container || obj.parentContainer) {
alert("Nested containers are not supported");
return;
}
}
... | identifier_body |
ActionManager.ts | namespace phasereditor2d.scene.ui.editor {
export class ActionManager {
| }
deleteObjects() {
const objects = this._editor.getSelectedGameObjects();
// create the undo-operation before destroy the objects
this._editor.getUndoManager().add(new undo.RemoveObjectsOperation(this._editor, objects));
for (const obj of objects) {
... | private _editor: SceneEditor;
constructor(editor: SceneEditor) {
this._editor = editor; | random_line_split |
ActionManager.ts | namespace phasereditor2d.scene.ui.editor {
export class ActionManager {
private _editor: SceneEditor;
constructor(editor: SceneEditor) {
this._editor = editor;
}
deleteObjects() {
const objects = this._editor.getSelectedGameObjects();
// creat... | () {
const sel = this._editor.getSelectedGameObjects();
for (const obj of sel) {
if (obj instanceof Phaser.GameObjects.Container || obj.parentContainer) {
alert("Nested containers are not supported");
return;
}
... | joinObjectsInContainer | identifier_name |
face-two-tone.js | import { h } from 'omi';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(h(h.f, null, h("path", {
d: "M17.5 8c.46 0 .91-.05 1.34-.12C17.44 5.56 14.9 4 12 4c-.46 0-.91.05-1.34.12C12.06 6.44 14.6 8 17.5 8zM8.08 5.03C6.37 6 5.05 7.58 4.42 9.47c1.71-.97 3.03-2.55 3.66-4.44z",
opacity: ".... | cy: "13",
r: "1.25"
}), h("circle", {
cx: "15",
cy: "13",
r: "1.25"
})), 'FaceTwoTone'); | cx: "9", | random_line_split |
searches.action.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 class SetConfig implements Action {
public readonly type = SearchesActionType.SET_CONFIG;
public constructor(public payload: {searchId: string; config: SearchConfig}) {}
}
export class Clear implements Action {
public readonly type = SearchesActionType.CLEAR;
}
export type All = Add... | random_line_split | |
searches.action.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 ... | (public payload: {searchId: string}) {}
}
export class SetConfig implements Action {
public readonly type = SearchesActionType.SET_CONFIG;
public constructor(public payload: {searchId: string; config: SearchConfig}) {}
}
export class Clear implements Action {
public readonly type = SearchesAction... | constructor | identifier_name |
api.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {BoundTarget, DirectiveMeta} from '@angular/compiler';
import * as ts from 'typescript';
import {Reference} ... | * for that component.
*/
export interface TypeCheckBlockMetadata {
/**
* Semantic information about the template of the component.
*/
boundTarget: BoundTarget<TypeCheckableDirectiveMeta>;
/*
* Pipes used in the template of the component.
*/
pipes: Map<string, Reference<ClassDeclaration<ts.ClassDe... | hasNgTemplateContextGuard: boolean;
}
/**
* Metadata required in addition to a component class in order to generate a type check block (TCB) | random_line_split |
find.spec.js | import Database from "almaden";
import Collection from "../../lib/collection.js";
import Model from "../../../";
import {ModelQuery} from "../../lib/modelFinder.js";
import {User} from "../testClasses.js";
import databaseConfig from "../databaseConfig.json";
let userFixtures = require("../fixtures/users.json");
desc... | it("should return a ModelQuery instance", () => {
User.find.should.be.instanceOf(ModelQuery);
});
it("should return a collection", () => {
users.should.be.instanceOf(Collection);
});
it("should return the right collection", () => {
users.should.eql(userCollection);
});
it("should allow to s... | });
| random_line_split |
find.spec.js | import Database from "almaden";
import Collection from "../../lib/collection.js";
import Model from "../../../";
import {ModelQuery} from "../../lib/modelFinder.js";
import {User} from "../testClasses.js";
import databaseConfig from "../databaseConfig.json";
let userFixtures = require("../fixtures/users.json");
desc... | extends Model {}
let car,
database,
query;
describe("(static way)", () => {
beforeEach(() => {
database = new Database(databaseConfig);
Car.database = database;
query = database.spy("select * from `cars`", []);
car = new Car();
});
... | Car | identifier_name |
select_with_weak.rs | use std::pin::Pin;
use std::task::Context;
use std::task::Poll;
use futures::stream::{Fuse, Stream};
pub trait SelectWithWeakExt: Stream {
fn select_with_weak<S>(self, other: S) -> SelectWithWeak<Self, S>
where
S: Stream<Item = Self::Item>,
Self: Sized;
}
impl<T> SelectWithWeakExt for T
where
T: Stream,
{
fn... |
}
/// An adapter for merging the output of two streams.
///
/// The merged stream produces items from either of the underlying streams as
/// they become available, and the streams are polled in a round-robin fashion.
/// Errors, however, are not merged: you get at most one error at a time.
///
/// Finishes when stro... | {
new(self, other)
} | identifier_body |
select_with_weak.rs | use std::pin::Pin;
use std::task::Context;
use std::task::Poll;
use futures::stream::{Fuse, Stream};
pub trait SelectWithWeakExt: Stream {
fn select_with_weak<S>(self, other: S) -> SelectWithWeak<Self, S>
where
S: Stream<Item = Self::Item>,
Self: Sized;
}
impl<T> SelectWithWeakExt for T
where
T: Stream,
{
fn... | <S>(self, other: S) -> SelectWithWeak<Self, S>
where
S: Stream<Item = Self::Item>,
Self: Sized,
{
new(self, other)
}
}
/// An adapter for merging the output of two streams.
///
/// The merged stream produces items from either of the underlying streams as
/// they become available, and the streams are polled i... | select_with_weak | identifier_name |
select_with_weak.rs | use std::pin::Pin;
use std::task::Context;
use std::task::Poll;
use futures::stream::{Fuse, Stream};
pub trait SelectWithWeakExt: Stream {
fn select_with_weak<S>(self, other: S) -> SelectWithWeak<Self, S>
where
S: Stream<Item = Self::Item>,
Self: Sized;
}
impl<T> SelectWithWeakExt for T
where
T: Stream,
{
fn... | }
}
}
} | Poll::Ready(Some(item)) => return Poll::Ready(Some(item)),
Poll::Ready(None) | Poll::Pending => (),
} | random_line_split |
panic-runtime-abort.rs | // Copyright 2016 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 ... | () {}
#[no_mangle]
pub extern fn __rust_start_panic() {}
#[no_mangle]
pub extern fn rust_eh_personality() {}
| __rust_maybe_catch_panic | identifier_name |
panic-runtime-abort.rs | // Copyright 2016 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 ... |
// compile-flags:-C panic=abort
// no-prefer-dynamic
#![feature(panic_runtime)]
#![crate_type = "rlib"]
#![no_std]
#![panic_runtime]
#[no_mangle]
pub extern fn __rust_maybe_catch_panic() {}
#[no_mangle]
pub extern fn __rust_start_panic() {}
#[no_mangle]
pub extern fn rust_eh_personality() {} | // except according to those terms. | random_line_split |
panic-runtime-abort.rs | // Copyright 2016 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 | |
alternating_color_fades.py | import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
|
def all_blue():
"""
Create an all-blue frame.
"""
g.setColor('#0000ff')
g.setIntensity(255)
return g.getFrame()
def main(config, controller=None):
log.info("Running script %s" % __name__)
# global g
# g = get_default_fixture_group(config)
q = controller or dmx.Controller(config.get('base', 'address'), bpm=... | """
Create an all-red frame.
"""
g.setColor('#ff0000')
g.setIntensity(255)
return g.getFrame() | identifier_body |
alternating_color_fades.py | import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def | ():
"""
Create an all-red frame.
"""
g.setColor('#ff0000')
g.setIntensity(255)
return g.getFrame()
def all_blue():
"""
Create an all-blue frame.
"""
g.setColor('#0000ff')
g.setIntensity(255)
return g.getFrame()
def main(config, controller=None):
log.info("Running script %s" % __name__)
# global g
# g =... | all_red | identifier_name |
alternating_color_fades.py | import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
"""
Create an all-red frame.
"""
g.setColor('#ff0000')
g.setIntensity(255)
return g.getFrame()
def all_... | # global g
# g = get_default_fixture_group(config)
q = controller or dmx.Controller(config.get('base', 'address'), bpm=60, nodaemon=True, runout=True)
q.add(fades.create_multifade([
all_red(),
all_blue(),
] * 3, secs=5.0))
if not controller:
q.start() | log.info("Running script %s" % __name__) | random_line_split |
alternating_color_fades.py | import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
"""
Create an all-red frame.
"""
g.setColor('#ff0000')
g.setIntensity(255)
return g.getFrame()
def all_... | q.start() | conditional_block | |
test_serializers.py | from nose.tools import * # noqa: F403
from tests.base import AdminTestCase
from osf_tests.factories import NodeFactory, UserFactory
from osf.utils.permissions import ADMIN
from admin.nodes.serializers import serialize_simple_user_and_node_permissions, serialize_node
class TestNodeSerializers(AdminTestCase):
def... | assert_equal(info['title'], node.title)
assert_equal(info['children'], [])
assert_equal(info['id'], node._id)
assert_equal(info['public'], node.is_public)
assert_equal(len(info['contributors']), 1)
assert_false(info['deleted'])
def test_serialize_deleted(self):
... | random_line_split | |
test_serializers.py | from nose.tools import * # noqa: F403
from tests.base import AdminTestCase
from osf_tests.factories import NodeFactory, UserFactory
from osf.utils.permissions import ADMIN
from admin.nodes.serializers import serialize_simple_user_and_node_permissions, serialize_node
class TestNodeSerializers(AdminTestCase):
def... | user = UserFactory()
node = NodeFactory(creator=user)
info = serialize_simple_user_and_node_permissions(node, user)
assert_is_instance(info, dict)
assert_equal(info['id'], user._id)
assert_equal(info['name'], user.fullname)
assert_equal(info['permission'], ADMIN) | identifier_body | |
test_serializers.py | from nose.tools import * # noqa: F403
from tests.base import AdminTestCase
from osf_tests.factories import NodeFactory, UserFactory
from osf.utils.permissions import ADMIN
from admin.nodes.serializers import serialize_simple_user_and_node_permissions, serialize_node
class | (AdminTestCase):
def test_serialize_node(self):
node = NodeFactory()
info = serialize_node(node)
assert_is_instance(info, dict)
assert_equal(info['parent'], node.parent_id)
assert_equal(info['title'], node.title)
assert_equal(info['children'], [])
assert_equal... | TestNodeSerializers | identifier_name |
data.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
//Grab everything with import 'rxjs/Rx';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/ca... |
customersBaseUrl: string = this.baseUrl + '/api/customers';
ordersBaseUrl: string = this.baseUrl + '/api/orders';
orders: IOrder[];
states: IState[];
//constructor(private http: Http) { }
getCustomers() : Observable<ICustomer[]> {
return this.http.get(this.customersBaseUrl)
... | export class DataService extends BaseDataService {
baseUrl: string = 'http://localhost:3010'; | random_line_split |
data.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
//Grab everything with import 'rxjs/Rx';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/ca... | calculateCustomersOrderTotal(customers: ICustomer[]) {
for (let customer of customers) {
if (customer && customer.orders) {
let total = 0;
for (let order of customer.orders) {
total += order.itemCost;
}
customer.... | return Observable.create((observer: Observer<any>) => {
observer.next(data);
observer.complete();
});
}
| identifier_body |
data.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
//Grab everything with import 'rxjs/Rx';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/ca... | }
}
}
| let total = 0;
for (let order of customer.orders) {
total += order.itemCost;
}
customer.orderTotal = total;
}
| conditional_block |
data.service.ts | import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
//Grab everything with import 'rxjs/Rx';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/ca... | ustomers: ICustomer[]) {
for (let customer of customers) {
if (customer && customer.orders) {
let total = 0;
for (let order of customer.orders) {
total += order.itemCost;
}
customer.orderTotal = total;
}
... | lculateCustomersOrderTotal(c | identifier_name |
issue-27362.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 | // aux-build:issue-27362.rs
// ignore-cross-compile
// ignore-test This test fails on beta/stable #32019
extern crate issue_27362;
pub use issue_27362 as quux;
// @matches issue_27362/quux/fn.foo.html '//pre' "pub const fn foo()"
// @matches issue_27362/quux/fn.bar.html '//pre' "pub const unsafe fn bar()"
// @matches... | // http://www.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
// except according to those terms.
| random_line_split |
Divider.js | /* @flow */
import * as React from 'react';
import cn from 'classnames';
import { StyleClasses } from '../theme/styleClasses';
type Props = {
// An optional inline-style to apply to the overlay.
style: ?Object,
// An optional css className to apply.
className: ?string,
// Boolean if this divider should be in... | class Divider extends React.PureComponent<Props, *> {
props: Props;
render() {
const { className, inset, vertical, ...props } = this.props;
const Component = vertical ? 'div' : 'hr';
return (
<Component
{...props}
className={cn(
BASE_ELEMENT,
{
'bo... | * event listeners on to the component.
*/ | random_line_split |
settings.py | """
Django settings for quixotic_webapp project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
i... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': parameters.DB_NAME,
'USER': parameters.DB_USER,
'PASSWORD': parameters.DB_PASSWORD,
'HOST': parameters.DB_HOST,
}
}
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#aut... | WSGI_APPLICATION = 'quixotic_webapp.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases | random_line_split |
app.component.spec.ts | import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TestBed } from '@angular/core/testing';
import { APP_BASE_HREF } from '@angular/common';
import {
async
} from '@angular/core/testing';
import {
Route
} from '@angular/router';
import {
RouterTestingModule
} from '@... | {
}
| TestComponent | identifier_name |
app.component.spec.ts | import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TestBed } from '@angular/core/testing';
import { APP_BASE_HREF } from '@angular/common';
import {
async
} from '@angular/core/testing';
import {
Route
} from '@angular/router';
import {
RouterTestingModule
} from '@... | .then(() => {
let fixture = TestBed.createComponent(TestComponent);
let compiled = fixture.nativeElement;
expect(compiled).toBeTruthy();
});
}));
});
}
@Component({
selector: 'test-cmp',
template: '<sd-app></sd-app>'
})
class TestComponent {
} | TestBed
.compileComponents() | random_line_split |
places_sidebar.rs | // Copyright 2013-2015, The Gtk-rs Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
//! GtkPlacesSidebar — Sidebar that displays frequently-used places in the file system
use f... |
#[cfg(gtk_3_12)]
pub fn get_local_only(&self) -> bool {
unsafe { to_bool(ffi::gtk_places_sidebar_get_local_only(GTK_PLACES_SIDEBAR(self.unwrap_widget()))) }
}
#[cfg(gtk_3_14)]
pub fn set_show_enter_location(&self, show_enter_location: bool) {
unsafe { ffi::gtk_places_sidebar_set_sh... | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.