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 |
|---|---|---|---|---|
projects.server.controller.js | require('sys'),
exec = require('child_process').exec,
multiparty = require('multiparty'),
util = require('util'),
http = require('http'),
uuid = require('node-uuid');
/**
* Create a project
*/
exports.create = function(req, res) {
var log = new Log({
user: req.user,
timestamp: Date.now()
... |
});
};
/**
* Delete an project
*/
exports.delete = function(req, res) {
var project = req.project;
project.remove(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp... | {
log._id = doc._id;
project.logs.push(log._id);
project.save(function(err) {
if (err) {
log.remove(function(err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
... | conditional_block |
bs-datepicker-container.ts | // datepicker container component
import { BsCustomDates } from '../themes/bs/bs-custom-dates-view.component';
import { BsDatepickerEffects } from '../reducer/bs-datepicker.effects';
import { Observable, Subscription } from 'rxjs';
import {
BsDatepickerViewMode,
BsNavigationEvent,
CalendarCellViewModel,
CellHov... |
viewMode?: Observable<BsDatepickerViewMode|undefined>;
monthsCalendar?: Observable<MonthsCalendarViewModel[]|undefined>;
yearsCalendar?: Observable<YearsCalendarViewModel[]|undefined>;
options$!: Observable<DatepickerRenderOptions|undefined>;
_daysCalendar$!: Observable<DaysCalendarViewModel[]|undefined>;
... | {
this._effects?.setDateTooltipTexts(value);
} | identifier_body |
bs-datepicker-container.ts | // datepicker container component
import { BsCustomDates } from '../themes/bs/bs-custom-dates-view.component';
import { BsDatepickerEffects } from '../reducer/bs-datepicker.effects';
import { Observable, Subscription } from 'rxjs';
import {
BsDatepickerViewMode,
BsNavigationEvent,
CalendarCellViewModel,
CellHov... | }
} | random_line_split | |
bs-datepicker-container.ts | // datepicker container component
import { BsCustomDates } from '../themes/bs/bs-custom-dates-view.component';
import { BsDatepickerEffects } from '../reducer/bs-datepicker.effects';
import { Observable, Subscription } from 'rxjs';
import {
BsDatepickerViewMode,
BsNavigationEvent,
CalendarCellViewModel,
CellHov... | (event: BsNavigationEvent): void {}
// eslint-disable-next-line
dayHoverHandler(event: CellHoverEvent): void {}
// eslint-disable-next-line
weekHoverHandler(event: WeekViewModel): void {}
// eslint-disable-next-line
monthHoverHandler(event: CellHoverEvent): void {}
// eslint-disable-next-line
yearHo... | navigateTo | identifier_name |
doc.rs | use std::cell::{RefCell, UnsafeCell};
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::fmt::{Display, Error, Formatter};
use std::rc::Rc;
use super::parser::{Builder, ParserError, ShowType};
pub struct ContainerData {
direct_children_vec: Vec<(Key, Rc<DirectChild>)>,
dire... |
}
struct DocBuilder;
impl Builder for DocBuilder {
type Table = Container;
type Array = Container;
type Key = Key;
type Value = ();
fn root_table(lead_ws: &str) -> Self::Table { Container::new(ContainerKind::Root, lead_ws.to_string()) }
fn table(lead_ws: &str) -> Self::Table { Cont... | {
unimplemented!()
} | identifier_body |
doc.rs | use std::cell::{RefCell, UnsafeCell};
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::fmt::{Display, Error, Formatter};
use std::rc::Rc;
use super::parser::{Builder, ParserError, ShowType};
pub struct ContainerData {
direct_children_vec: Vec<(Key, Rc<DirectChild>)>,
dire... | Float(f64),
Boolean(bool),
Datetime(String),
Array(Vec<ArrayElement>),
InlineTable(Container),
}
enum ArrayElement {
String(String),
Integer(i64),
Float(f64),
Boolean(bool),
Datetime(String),
Array(Vec<ArrayElement>),
}
#[derive(PartialEq, Eq, Hash)]
pub st... | Integer(i64),
| random_line_split |
doc.rs | use std::cell::{RefCell, UnsafeCell};
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::fmt::{Display, Error, Formatter};
use std::rc::Rc;
use super::parser::{Builder, ParserError, ShowType};
pub struct ContainerData {
direct_children_vec: Vec<(Key, Rc<DirectChild>)>,
dire... | {
String(String),
Integer(i64),
Float(f64),
Boolean(bool),
Datetime(String),
Array(Vec<ArrayElement>),
}
#[derive(PartialEq, Eq, Hash)]
pub struct Key {
text: String,
lead: String,
trail: String
}
impl Display for Key {
fn fmt(&self, f: &mut Formatter) -> Resu... | ArrayElement | identifier_name |
resolve_files.sync.js | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
len = files.length;
out = new Array( len );
debug( 'Resolving %d files...', len );
for ( i = 0; i < len; i++ ) {
file = files[ i ];
k = i + 1;
debug( 'Resolving file: %s (%d of %d).', file, k, len );
bool = exists( file );
if ( !bool ) {
err = new Error( 'file does not exist. Unable to resolve file: ... | var err;
var i;
var k; | random_line_split |
resolve_files.sync.js | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | ( files ) {
var bool;
var file;
var out;
var len;
var err;
var i;
var k;
len = files.length;
out = new Array( len );
debug( 'Resolving %d files...', len );
for ( i = 0; i < len; i++ ) {
file = files[ i ];
k = i + 1;
debug( 'Resolving file: %s (%d of %d).', file, k, len );
bool = exists( file );
i... | resolveFiles | identifier_name |
resolve_files.sync.js | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | debug( 'Encountered an error while resolving file: %s (%d of %d). Error: %s', file, k, len, err.message );
return err;
}
debug( 'Resolved file: %s (%d of %d). File: %s.', file, k, len, file );
out[ i ] = file;
}
debug( 'Resolved all files.' );
return out;
}
// EXPORTS //
module.exports = resolveFiles... | {
var bool;
var file;
var out;
var len;
var err;
var i;
var k;
len = files.length;
out = new Array( len );
debug( 'Resolving %d files...', len );
for ( i = 0; i < len; i++ ) {
file = files[ i ];
k = i + 1;
debug( 'Resolving file: %s (%d of %d).', file, k, len );
bool = exists( file );
if ( !bool ... | identifier_body |
resolve_files.sync.js | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
debug( 'Resolved file: %s (%d of %d). File: %s.', file, k, len, file );
out[ i ] = file;
}
debug( 'Resolved all files.' );
return out;
}
// EXPORTS //
module.exports = resolveFiles;
| {
err = new Error( 'file does not exist. Unable to resolve file: '+file+'.' );
debug( 'Encountered an error while resolving file: %s (%d of %d). Error: %s', file, k, len, err.message );
return err;
} | conditional_block |
ngram-process.js | "use strict";
var filters = require('./filters'),
uniq = require('uniq');
var doNgram = function doNgram (string, resultData, config) {
var ngramCount = string.length - config.n + 1,
ngram,
previousNgram = null,
ngramData,
i;
for (i = 0; i < ngramCount; i++) {
ngra... | ];
resultData.elements[keys[i]] = ngramDesc;
}
resultData.e = resultData.elements;
resultData.fe = resultData.firstElements;
delete resultData.elements;
delete resultData.firstElements;
};
var stringToRegExp = function stringToRegExp (string) {
var match = string.match(/^\/(.... | random_line_split | |
ngram-process.js | "use strict";
var filters = require('./filters'),
uniq = require('uniq');
var doNgram = function doNgram (string, resultData, config) {
var ngramCount = string.length - config.n + 1,
ngram,
previousNgram = null,
ngramData,
i;
for (i = 0; i < ngramCount; i++) {
ngra... | else {
previousNgram.children[ngram]++;
}
}
}
previousNgram = ngramData;
}
};
var postProcessData = function postProcessData (resultData, compressFloat) {
var keys = Object.keys(resultData.elements),
childrenKeys,
validFirst = {}... | {
previousNgram.children[ngram] = 1;
} | conditional_block |
fr-MQ.js | /**
* @license
* Copyright Google LLC 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 | (function(global) {
global.ng = global.ng || {};
global.ng.common = global.ng.common || {};
global.ng.common.locales = global.ng.common.locales || {};
const u = undefined;
function plural(n) {
let i = Math.floor(Math.abs(n));
if (i === 0 || i === 1) return 1;
return 5;
}
global.ng.common.locales['fr-mq'] = [
'f... | */
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
| random_line_split |
fr-MQ.js | /**
* @license
* Copyright Google LLC 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
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
(function(global) {
global... |
global.ng.common.locales['fr-mq'] = [
'fr-MQ',
[['AM', 'PM'], u, u],
u,
[
['D', 'L', 'M', 'M', 'J', 'V', 'S'], ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
['di', 'lu', 'ma', 'me', 'je', 've', 'sa']
],
u,
... | {
let i = Math.floor(Math.abs(n));
if (i === 0 || i === 1) return 1;
return 5;
} | identifier_body |
fr-MQ.js | /**
* @license
* Copyright Google LLC 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
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
(function(global) {
global... | (n) {
let i = Math.floor(Math.abs(n));
if (i === 0 || i === 1) return 1;
return 5;
}
global.ng.common.locales['fr-mq'] = [
'fr-MQ',
[['AM', 'PM'], u, u],
u,
[
['D', 'L', 'M', 'M', 'J', 'V', 'S'], ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
['dimanche', 'lundi', 'mardi', 'mercredi', '... | plural | identifier_name |
main.js | /**
* ReactionCore methods (server)
*/
_.extend(ReactionCore, {
getCurrentShopCursor: function () {
let domain = this.getDomain();
let cursor = ReactionCore.Collections.Shops.find({
domains: domain
}, {
limit: 1
});
if (!cursor.count()) {
ReactionCollections.Log.debug("Add a d... |
},
getShopId: function () {
const currentShop = this.getCurrentShop();
if (typeof currentShop === "object") {
return currentShop._id;
}
},
getDomain: function () {
let absoluteUrl = Meteor.absoluteUrl();
if (typeof absoluteUrl === "string") {
return absoluteUrl.split("/")[2].spl... | {
return currentShopCursor.fetch()[0];
} | conditional_block |
main.js | /**
* ReactionCore methods (server)
*/
_.extend(ReactionCore, {
getCurrentShopCursor: function () {
let domain = this.getDomain();
let cursor = ReactionCore.Collections.Shops.find({
domains: domain
}, {
limit: 1 | ReactionCollections.Log.debug("Add a domain entry to shops for ",
domain);
}
return cursor;
},
getCurrentShop: function () {
const currentShopCursor = this.getCurrentShopCursor();
// also, we could check in such a way: `currentShopCursor instanceof Object`
// but not instanceof som... | });
if (!cursor.count()) { | random_line_split |
setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import re
import os
from setuptools import find_packages
name = 'firecares-harvester'
package = 'harvester'
description = 'FireCARES Harvester'
url = 'https://github.com/FireCARES/harvester'
author = 'Prominent Edge'
author_email = 'contact@pr... |
def get_package_data(package):
"""
Return all files under the root package, that are not in a
package themselves.
"""
walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
for dirpath, dirnames, filenames in os.walk(package)
if not os.path.exists(os.path.join(dirpa... | """
Return root package and all sub-packages.
"""
return [dirpath
for dirpath, dirnames, filenames in os.walk(package)
if os.path.exists(os.path.join(dirpath, '__init__.py'))] | identifier_body |
setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import re
import os
from setuptools import find_packages
name = 'firecares-harvester'
package = 'harvester'
description = 'FireCARES Harvester'
url = 'https://github.com/FireCARES/harvester'
author = 'Prominent Edge'
author_email = 'contact@pr... |
return {package: filepaths}
setup(
name=name,
version=get_version(package),
url=url,
license=license,
description=description,
author=author,
author_email=author_email,
packages=find_packages(exclude=["tests.*", "tests"]),
package_data=get_package_data('.'),
include_packag... | filepaths.extend([os.path.join(base, filename)
for filename in filenames]) | conditional_block |
setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import re
import os
from setuptools import find_packages
name = 'firecares-harvester'
package = 'harvester'
description = 'FireCARES Harvester'
url = 'https://github.com/FireCARES/harvester'
author = 'Prominent Edge'
author_email = 'contact@pr... | (package):
"""
Return all files under the root package, that are not in a
package themselves.
"""
walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
for dirpath, dirnames, filenames in os.walk(package)
if not os.path.exists(os.path.join(dirpath, '__init__.py'))]
... | get_package_data | identifier_name |
setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import re
import os
from setuptools import find_packages
name = 'firecares-harvester'
package = 'harvester'
description = 'FireCARES Harvester'
url = 'https://github.com/FireCARES/harvester'
author = 'Prominent Edge'
author_email = 'contact@pr... | setup(
name=name,
version=get_version(package),
url=url,
license=license,
description=description,
author=author,
author_email=author_email,
packages=find_packages(exclude=["tests.*", "tests"]),
package_data=get_package_data('.'),
include_package_data=True,
install_requires=[... | for filename in filenames])
return {package: filepaths}
| random_line_split |
TreeWidget.py | 0
root.images = images
class TreeNode:
def __init__(self, canvas, parent, item):
self.canvas = canvas
self.parent = parent
self.item = item
self.state = 'collapsed'
self.selected = False
self.children = []
self.x = self.y = None
se... | (self):
top = self.y - 2
bottom = self.lastvisiblechild().y + 17
height = bottom - top
visible_top = self.canvas.canvasy(0)
visible_height = self.canvas.winfo_height()
visible_bottom = self.canvas.canvasy(visible_height)
if visible_top <= top and bottom <= ... | view | identifier_name |
TreeWidget.py | 0
root.images = images
class TreeNode:
def __init__(self, canvas, parent, item):
self.canvas = canvas
self.parent = parent
self.item = item
self.state = 'collapsed'
self.selected = False
self.children = []
self.x = self.y = None
se... |
def edit(self, event=None):
self.entry = Entry(self.label, bd=0, highlightthickness=1, width=0)
self.entry.insert(0, self.label['text'])
self.entry.selection_range(0, END)
self.entry.pack(ipadx=5)
self.entry.focus_set()
self.entry.bind("<Return>", self.edit_... | if self.selected and self.item.IsEditable():
self.edit(event)
else:
self.select(event) | identifier_body |
TreeWidget.py | 0
root.images = images
class TreeNode:
def __init__(self, canvas, parent, item):
self.canvas = canvas
self.parent = parent
self.item = item
self.state = 'collapsed'
self.selected = False
self.children = []
self.x = self.y = None
se... |
else:
self.expand()
self.item.OnDoubleClick()
return "break"
def expand(self, event=None):
if not self.item._IsExpandable():
return
if self.state != 'expanded':
self.state = 'expanded'
self.update()
sel... | self.collapse() | conditional_block |
TreeWidget.py |
root.images = images
class TreeNode:
def __init__(self, canvas, parent, item):
self.canvas = canvas
self.parent = parent
self.item = item
self.state = 'collapsed'
self.selected = False
self.children = []
self.x = self.y = None
sel... |
def __init__(self):
"""Constructor. Do whatever you need to do."""
def GetText(self):
"""Return text string to display."""
def GetLabelText(self):
"""Return label text string to display in front of text (if any)."""
expandable = None
def _IsExpandable(self):... | """
| random_line_split |
message.js | 'use strict';
var Backbone = require('backbone');
module.exports = Backbone.View.extend({
tagName: 'div',
className: 'message-item',
render: function() {
var timestamp = window.layerSample.dateFormat(this.model.sentAt);
var parts = '';
if (!this.model.isDestroyed) { | parts += '<div class="bubble text">' + part.body + '</div>';
break;
case 'text/quote':
parts += '<div class="bubble quote">' + part.body + '</div>';
break;
}
});
this.$el.append('<div class="avatar-image"><img src="' + this.model.sender.avat... | this.model.parts.forEach(function(part) {
switch(part.mimeType) {
case 'text/plain': | random_line_split |
lib.rs | mod chaperone;
pub mod compositor;
pub mod property;
pub mod render_models;
pub mod system;
pub use tracking::*;
pub use sys::VkDevice_T;
pub use sys::VkInstance_T;
pub use sys::VkPhysicalDevice_T;
pub use sys::VkQueue_T;
static INITIALIZED: AtomicBool = AtomicBool::new(false);
/// Initialize OpenVR
///
/// # Pani... | {
Left = sys::EVREye_Eye_Left as isize,
Right = sys::EVREye_Eye_Right as isize,
}
/// Helper to call OpenVR functions that return strings
unsafe fn get_string<F: FnMut(*mut std::os::raw::c_char, u32) -> u32>(mut f: F) -> Option<CString> {
let n = f(ptr::null_mut(), 0);
if n == 0 {
return None;... | Eye | identifier_name |
lib.rs | mod chaperone;
pub mod compositor;
pub mod property;
pub mod render_models;
pub mod system;
pub use tracking::*;
pub use sys::VkDevice_T;
pub use sys::VkInstance_T;
pub use sys::VkPhysicalDevice_T;
pub use sys::VkQueue_T;
static INITIALIZED: AtomicBool = AtomicBool::new(false);
/// Initialize OpenVR
///
/// # Pani... | pub const DPAD_DOWN: sys::EVRButtonId = sys::EVRButtonId_k_EButton_DPad_Down;
pub const A: sys::EVRButtonId = sys::EVRButtonId_k_EButton_A;
pub const PROXIMITY_SENSOR: sys::EVRButtonId = sys::EVRButtonId_k_EButton_ProximitySensor;
pub const AXIS0: sys::EVRButtonId = sys::EVRButtonId_k_EButton_Axis0;
... | pub const GRIP: sys::EVRButtonId = sys::EVRButtonId_k_EButton_Grip;
pub const DPAD_LEFT: sys::EVRButtonId = sys::EVRButtonId_k_EButton_DPad_Left;
pub const DPAD_UP: sys::EVRButtonId = sys::EVRButtonId_k_EButton_DPad_Up;
pub const DPAD_RIGHT: sys::EVRButtonId = sys::EVRButtonId_k_EButton_DPad_Right; | random_line_split |
lib.rs | mod chaperone;
pub mod compositor;
pub mod property;
pub mod render_models;
pub mod system;
pub use tracking::*;
pub use sys::VkDevice_T;
pub use sys::VkInstance_T;
pub use sys::VkPhysicalDevice_T;
pub use sys::VkQueue_T;
static INITIALIZED: AtomicBool = AtomicBool::new(false);
/// Initialize OpenVR
///
/// # Pani... |
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum ApplicationType {
/// Some other kind of application that isn't covered by the other entries
Other = sys::EVRApplicationType_VRApplication_Other as isize,
/// Application will submit 3D frames
Scene = sys::EVRApplicationType_VRApplication_S... | {
sys::VR_ShutdownInternal();
INITIALIZED.store(false, Ordering::Release);
} | conditional_block |
email_parser.py | from copy import deepcopy
from datetime import datetime
from datetime import timezone
from email.utils import mktime_tz
from email.utils import parsedate_tz
from io import BytesIO
from itertools import chain
from mimetypes import guess_type
from typing import Callable
from typing import Iterable
from typing import List... | (mailparts: Iterable[MailPart]) -> Iterable[dict]:
attachment_parts = (part for part in mailparts if not part.is_body)
for part in attachment_parts:
filename = part.sanitized_filename
payload = part.get_payload()
attachment_id = part.content_id
if filename and payload:
... | _parse_attachments | identifier_name |
email_parser.py | from copy import deepcopy
from datetime import datetime
from datetime import timezone
from email.utils import mktime_tz
from email.utils import parsedate_tz
from io import BytesIO
from itertools import chain
from mimetypes import guess_type
from typing import Callable
from typing import Iterable
from typing import List... |
def format_attachments(email: dict) -> dict:
attachments = email.get('attachments', [])
if not attachments:
return email
formatted_attachments = deepcopy(attachments)
is_any_attachment_changed = False
for i, attachment in enumerate(attachments):
filename = attachment.get('filen... | message = PyzMessage.factory(mime_email)
return {
'sent_at': _parse_sent_at(message),
'to': _parse_addresses(message, 'to'),
'cc': _parse_addresses(message, 'cc'),
'bcc': _parse_addresses(message, 'bcc'),
'from': _parse_address(message, 'from'),
'subject': message.ge... | identifier_body |
email_parser.py | from copy import deepcopy
from datetime import datetime
from datetime import timezone
from email.utils import mktime_tz
from email.utils import parsedate_tz
from io import BytesIO
from itertools import chain
from mimetypes import guess_type
from typing import Callable
from typing import Iterable
from typing import List... | return sorted(email for _, email in message.get_addresses(address_type) if email)
def _parse_address(message: PyzMessage, address_type: str) -> Optional[str]:
return next(iter(_parse_addresses(message, address_type)), None)
def _parse_sent_at(message: PyzMessage) -> Optional[str]:
rfc_822 = message.get_... | random_line_split | |
email_parser.py | from copy import deepcopy
from datetime import datetime
from datetime import timezone
from email.utils import mktime_tz
from email.utils import parsedate_tz
from io import BytesIO
from itertools import chain
from mimetypes import guess_type
from typing import Callable
from typing import Iterable
from typing import List... |
has_http_prefix = url.startswith('http://')
has_https_prefix = url.startswith('https://')
return has_http_prefix or has_https_prefix
def format_inline_images(email: dict, on_error: Callable) -> dict:
email_body = email.get('body', '')
if not email_body:
return email
soup = BeautifulS... | return False | conditional_block |
messages.ts | /*
* MIT License
* | * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*... | * Copyright (c) 2019 Choko (choko@curioswitch.org)
* | random_line_split |
check_button.rs | // This file was generated by gir (b7f5189) from gir-files (71d73f0)
// DO NOT EDIT
use Actionable;
use Bin;
use Button;
use Container;
use ToggleButton;
use Widget;
use ffi;
use glib::object::Downcast;
use glib::object::IsA;
use glib::translate::*;
glib_wrapper! {
pub struct CheckButton(Object<ffi::GtkCheckButto... |
pub trait CheckButtonExt {}
impl<O: IsA<CheckButton>> CheckButtonExt for O {} | Widget::from_glib_none(ffi::gtk_check_button_new_with_mnemonic(label.to_glib_none().0)).downcast_unchecked()
}
}
} | random_line_split |
check_button.rs | // This file was generated by gir (b7f5189) from gir-files (71d73f0)
// DO NOT EDIT
use Actionable;
use Bin;
use Button;
use Container;
use ToggleButton;
use Widget;
use ffi;
use glib::object::Downcast;
use glib::object::IsA;
use glib::translate::*;
glib_wrapper! {
pub struct CheckButton(Object<ffi::GtkCheckButto... | () -> CheckButton {
assert_initialized_main_thread!();
unsafe {
Widget::from_glib_none(ffi::gtk_check_button_new()).downcast_unchecked()
}
}
pub fn new_with_label(label: &str) -> CheckButton {
assert_initialized_main_thread!();
unsafe {
Widget::fr... | new | identifier_name |
check_button.rs | // This file was generated by gir (b7f5189) from gir-files (71d73f0)
// DO NOT EDIT
use Actionable;
use Bin;
use Button;
use Container;
use ToggleButton;
use Widget;
use ffi;
use glib::object::Downcast;
use glib::object::IsA;
use glib::translate::*;
glib_wrapper! {
pub struct CheckButton(Object<ffi::GtkCheckButto... |
}
pub trait CheckButtonExt {}
impl<O: IsA<CheckButton>> CheckButtonExt for O {}
| {
assert_initialized_main_thread!();
unsafe {
Widget::from_glib_none(ffi::gtk_check_button_new_with_mnemonic(label.to_glib_none().0)).downcast_unchecked()
}
} | identifier_body |
lib.rs | // This file is part of Twig (ported to Rust).
//
// For the copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//! # Twig Templating for Rust
//!
//! **Work in progress** - This library is still in development and not yet ready for use.
//! Take a look at th... | //! ## Syntax and Semantics
//!
//! Twig uses a syntax similar to the Django and Jinja template languages which inspired the Twig runtime environment.
//!
//! ```html
//! <!DOCTYPE html>
//! <html>
//! <head>
//! <title>Display a thread of posts</title>
//! </head>
//! <body>
//! <h1>{{ thread.t... | //! | random_line_split |
login.ts | import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
import {BackendService} from "../../app/Services/backendService";
import {HomePage} from "../home/home";
import {Storage} from '@ionic/storage';
/*
Generated class for the Login page.
See http://ionicframework.com/docs/... | private handleError(error) {
console.log(error);
if (error.status === 403) {
this.responseText = "Das eingegebene Passwort ist falsch.";
}
else {
this.responseText = "Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.";
}
}
} | this.storage.set('jwt', data.jwt).then(() => {
this.navCtrl.setRoot(HomePage);
});
}
| random_line_split |
login.ts | import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
import {BackendService} from "../../app/Services/backendService";
import {HomePage} from "../home/home";
import {Storage} from '@ionic/storage';
/*
Generated class for the Login page.
See http://ionicframework.com/docs/... |
else {
this.backendService.postLoginUser(this.newUsername, this.enteredPassword).subscribe(
data => this.handleResponse(data),
error => this.handleError(error),
() => console.log("Request Finished")
);
}
}
private handleResponse(data) {
this.responseText = "Sie habe... | {
this.responseText = "Bitte geben Sie ein Passwort ein";
} | conditional_block |
login.ts | import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
import {BackendService} from "../../app/Services/backendService";
import {HomePage} from "../home/home";
import {Storage} from '@ionic/storage';
/*
Generated class for the Login page.
See http://ionicframework.com/docs/... |
private handleError(error) {
console.log(error);
if (error.status === 403) {
this.responseText = "Das eingegebene Passwort ist falsch.";
}
else {
this.responseText = "Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.";
}
}
}
| {
this.responseText = "Sie haben sich erfolgreich eingeloggt.";
this.backendService.saveJWT(data.jwt);
this.storage.set('jwt', data.jwt).then(() => {
this.navCtrl.setRoot(HomePage);
});
} | identifier_body |
login.ts | import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
import {BackendService} from "../../app/Services/backendService";
import {HomePage} from "../home/home";
import {Storage} from '@ionic/storage';
/*
Generated class for the Login page.
See http://ionicframework.com/docs/... | {
public enteredPassword: string;
public responseText: string;
private newUsername: string;
constructor(public navCtrl: NavController, private backendService: BackendService, private navParams: NavParams, private storage: Storage) {
this.newUsername = navParams.get("newUsername");
}
public clickLogin... | LoginPage | identifier_name |
v1kpdb.rs | use std::cell::{RefCell};
use std::rc::Rc;
use chrono::{DateTime, Local};
use kpdb::crypter::Crypter;
use kpdb::parser::Parser;
use kpdb::v1error::V1KpdbError;
use kpdb::v1group::V1Group;
use kpdb::v1entry::V1Entry;
use kpdb::v1header::V1Header;
use super::super::sec_str::SecureString;
#[doc = "
V1Kpdb implements a ... | if id >= new_id {
new_id = id + 1;
}
}
let new_group = Rc::new(RefCell::new(V1Group::new()));
new_group.borrow_mut().title = title;
match expire {
Some(s) => { new_group.borrow_mut().expire = s },
None => {}, // is 12-28-29... | random_line_split | |
v1kpdb.rs | use std::cell::{RefCell};
use std::rc::Rc;
use chrono::{DateTime, Local};
use kpdb::crypter::Crypter;
use kpdb::parser::Parser;
use kpdb::v1error::V1KpdbError;
use kpdb::v1group::V1Group;
use kpdb::v1entry::V1Entry;
use kpdb::v1header::V1Header;
use super::super::sec_str::SecureString;
#[doc = "
V1Kpdb implements a ... | (&self, item: &T)
-> Result<usize, V1KpdbError> {
for index in 0..self.len() {
if *(self[index].borrow()) == *item {
return Ok(index);
}
}
Err(V1KpdbError::ParentErr)
}
}
impl V1Kpdb {
/// Call this to create a new database inst... | get_index | identifier_name |
SEO.tsx | import React, { ReactElement } from 'react'
import Helmet from 'react-helmet'
import { useStaticQuery, graphql } from 'gatsby'
const IMAGE =
'https://pennlabs-assets.s3.amazonaws.com/metadata-images/penn-labs.png'
const URL = 'pennlabs.org'
type Meta =
| { name: string; content: any; property?: undefined }
| { ... | },
{
property: `og:image`,
content: image,
},
{
property: `og:image-alt`,
content: 'Penn Labs Logo',
},
{
name: `twitter:site`,
content: url,
},
{
name: `twitter:card`,
content... | content: url, | random_line_split |
package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | (PythonPackage):
"""Flask-SocketIO gives Flask applications access to low latency
bi-directional communications between the clients and the server.
The client-side application can use any of the SocketIO official clients
libraries in Javascript, C++, Java and Swift, or any compatible client to
estab... | PyFlaskSocketio | identifier_name |
package.py | # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU L... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack. | random_line_split | |
package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | """Flask-SocketIO gives Flask applications access to low latency
bi-directional communications between the clients and the server.
The client-side application can use any of the SocketIO official clients
libraries in Javascript, C++, Java and Swift, or any compatible client to
establish a permanent conn... | identifier_body | |
webkit-sqlite.js | Lawnchair.adapter('webkit-sqlite', (function () {
// private methods
var fail = function (e, i) { console.log('error in sqlite adaptor!', e, i) }
, now = function () { return new Date() } // FIXME need to use better date fn
// not entirely sure if this is needed...
if (!Function.prototype.bind) {
... | , that = this
, keys = "SELECT id FROM " + this.record + " ORDER BY timestamp DESC"
this.db.transaction(function(t) {
var win = function (xxx, results) {
if (results.rows.length == 0 ) {
cb.call(that, [])
... |
keys: function (callback) {
var cb = this.lambda(callback) | random_line_split |
CounterButton.js | import React, { Component } from 'react';
/**
* Button that counts how many times it was pressed and exposes a `@public` method to reset itself.
*/
export default class CounterButton extends Component {
constructor() {
super();
this.state = {
value: 0,
};
}
/**
* Sets the counter to a particular value... |
render() {
return (
<button className="button" onClick={this.increment.bind(this)}>
{this.state.value}
</button>
);
}
} | increment() {
this.setState({
value: this.state.value + 1,
});
} | random_line_split |
CounterButton.js | import React, { Component } from 'react';
/**
* Button that counts how many times it was pressed and exposes a `@public` method to reset itself.
*/
export default class CounterButton extends Component {
constructor() {
super();
this.state = {
value: 0,
};
}
/**
* Sets the counter to a particular value... |
}
| {
return (
<button className="button" onClick={this.increment.bind(this)}>
{this.state.value}
</button>
);
} | identifier_body |
CounterButton.js | import React, { Component } from 'react';
/**
* Button that counts how many times it was pressed and exposes a `@public` method to reset itself.
*/
export default class | extends Component {
constructor() {
super();
this.state = {
value: 0,
};
}
/**
* Sets the counter to a particular value.
*
* @public
* @version 1.0.5
* @param {Number} [newValue=0] New value for the counter
* @returns {string} Test
*/
set(newValue = 0) {
this.setState({
value: parseInt... | CounterButton | identifier_name |
0208_create_role_executive.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-11-22 07:11
from __future__ import unicode_literals
from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations
def add_executive_group(apps, schema_editor):
# create group
|
class Migration(migrations.Migration):
dependencies = [
('base', '0207_auto_20171220_1035'),
]
operations = [
migrations.RunPython(add_executive_group),
] | db_alias = schema_editor.connection.alias
emit_post_migrate_signal(2, False, db_alias)
Group = apps.get_model('auth', 'Group')
Permission = apps.get_model('auth', 'Permission')
executive_group, created = Group.objects.get_or_create(name='executive')
if created:
# Learning unit
can_ac... | identifier_body |
0208_create_role_executive.py | # -*- coding: utf-8 -*- |
from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations
def add_executive_group(apps, schema_editor):
# create group
db_alias = schema_editor.connection.alias
emit_post_migrate_signal(2, False, db_alias)
Group = apps.get_model('auth', 'Group')
Permission =... | # Generated by Django 1.11.2 on 2017-11-22 07:11
from __future__ import unicode_literals | random_line_split |
0208_create_role_executive.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-11-22 07:11
from __future__ import unicode_literals
from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations
def add_executive_group(apps, schema_editor):
# create group
db_alias = schema_editor.connection.al... |
class Migration(migrations.Migration):
dependencies = [
('base', '0207_auto_20171220_1035'),
]
operations = [
migrations.RunPython(add_executive_group),
] | can_access_learningunit = Permission.objects.get(codename='can_access_learningunit')
executive_group.permissions.add(can_access_learningunit) | conditional_block |
0208_create_role_executive.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-11-22 07:11
from __future__ import unicode_literals
from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations
def | (apps, schema_editor):
# create group
db_alias = schema_editor.connection.alias
emit_post_migrate_signal(2, False, db_alias)
Group = apps.get_model('auth', 'Group')
Permission = apps.get_model('auth', 'Permission')
executive_group, created = Group.objects.get_or_create(name='executive')
if c... | add_executive_group | identifier_name |
default.py | EE @ COMMUNITY BUILDS FOR WRITING THE FORCE CLOSE FUNCTION AND ANY OTHER DEVS WHO CREATED ANY MODULES USED##
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
base='https://github.com/RuiNascimento/krepo'
ADDON=xbmcaddon.Addon(id='plugin.video.kbuildwin')
... | fanart=None
description=None
try:
url=urllib.unquote_plus(params["url"])
except:
pass
try:
name=urllib.unquote_plus(params["name"])
except:
pass
try:
iconimage=urllib.unquote_plus(params["iconimage"])
except:
pass
try:
mode=int(params["mode"])
except:
... | mode=None
iconimage=None | random_line_split |
default.py | @ COMMUNITY BUILDS FOR WRITING THE FORCE CLOSE FUNCTION AND ANY OTHER DEVS WHO CREATED ANY MODULES USED##
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
base='https://github.com/RuiNascimento/krepo'
ADDON=xbmcaddon.Addon(id='plugin.video.kbuildwin')
... |
def wizard(name,url,description):
path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
dp = xbmcgui.DialogProgress()
dp.create("Selected Build","Downloading ",'', 'Please Wait')
lib=os.path.join(path, name+'.zip')
try:
os.remove(lib)
except:
pass
... | req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
return link | identifier_body |
default.py | @ COMMUNITY BUILDS FOR WRITING THE FORCE CLOSE FUNCTION AND ANY OTHER DEVS WHO CREATED ANY MODULES USED##
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
base='https://github.com/RuiNascimento/krepo'
ADDON=xbmcaddon.Addon(id='plugin.video.kbuildwin')
... | (url):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
return link
def wizard(name,url,description):
path = xb... | OPEN_URL | identifier_name |
default.py | @ COMMUNITY BUILDS FOR WRITING THE FORCE CLOSE FUNCTION AND ANY OTHER DEVS WHO CREATED ANY MODULES USED##
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
base='https://github.com/RuiNascimento/krepo'
ADDON=xbmcaddon.Addon(id='plugin.video.kbuildwin')
... |
elif myplatform == 'android': # Android
print "############ try android force close #################"
try: os.system('adb shell am force-stop org.xbmc.kodi')
except: pass
try: os.system('adb shell am force-stop org.kodi')
except: pass
try: os.system('adb shell ... | print "############ try linux force close #################"
try: os.system('killall XBMC')
except: pass
try: os.system('killall Kodi')
except: pass
try: os.system('killall -9 xbmc.bin')
except: pass
try: os.system('killall -9 kodi.bin')
except: pass
... | conditional_block |
profile.js | var RichText = require('../services/RichText')
module.exports = function ($stateProvider) {
$stateProvider
.state('profile', {
parent: 'main',
url: '/u/:id',
abstract: true,
resolve: /*@ngInject*/ {
isSelf: function(currentUser, $stateParams) {
return currentUser && currentUser.id ===... | else {
return User.get({id: $stateParams.id}).$promise;
}
},
showModal: function(isSelf, onboarding) {
// hack -- this is only here so it shows before the controller's other content appears
if (isSelf && onboarding && onboarding.currentStep() === 'profile')
onboa... | {
return currentUser;
} | conditional_block |
profile.js | var RichText = require('../services/RichText')
module.exports = function ($stateProvider) {
$stateProvider
.state('profile', {
parent: 'main',
url: '/u/:id',
abstract: true,
resolve: /*@ngInject*/ {
isSelf: function(currentUser, $stateParams) {
return currentUser && currentUser.id ===... | templateUrl: '/ui/profile/contributions.tpl.html',
controller: 'ProfileContributionsCtrl'
}
}
})
.state('profile.thanks', {
url: '/thanks',
resolve: {
thanks: ['user', function(user) {
return user.thanks().$promise;
}]
},
views: {
tab: {
te... | },
views: {
tab: { | random_line_split |
api-error-handler.js | /**
* Tests for the main app routes.
*/
var expect = require('chai').expect;
var lodash = require('lodash');
var nestedDescribe = require('nested-describe');
var apiErrHandler = require('../../../server/middleware/api-error-handler');
var middlewareFixtures = require('../fixtures').load('middleware');
var testUtils... | it('should not handle errors from outside the API', function(done) {
var req = testUtils.getHTTPRequest({method: 'GET', url: '/'});
var res = testUtils.getHTTPResponse();
var err = new Error('test');
apiErrHandler()(err, req, res, function() {
expect(res._getData()).to.be.equal('');
done(... | random_line_split | |
tests.py | # import time
# import unittest
import doctest
from django.test import LiveServerTestCase #, TestCase
from selenium import webdriver
import pug.nlp.util
# from pug.dj import db as djdb
# from traceback import print_exc
class | (LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(5)
def tearDown(self):
self.browser.quit()
def test_home_page(self):
# User opens web browser, and goes to the home (root url) page
self.browser.get(self.live_ser... | HomeTest | identifier_name |
tests.py | # import time
# import unittest
import doctest
from django.test import LiveServerTestCase #, TestCase
from selenium import webdriver
import pug.nlp.util
# from pug.dj import db as djdb
# from traceback import print_exc
class HomeTest(LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox... | # self.assertGreater(len(bars), 5)
class AdminTest(LiveServerTestCase):
pass
# def setUp(self):
# self.browser = webdriver.Firefox()
# self.browser.implicitly_wait(1)
# def tearDown(self):
# self.browser.quit()
# def test_admin_interface_login_page(self):
# # ... | self.browser.get(self.live_server_url + '/dashboard')
# FIXME: during testing, line_plot() script doesn't load, but with runserver they do (but test statistics don't)
# # HTML page with more than 1 SVG element and more than 100 bytes for the first 2 plots
# plots = self.browser.find_elements_by... | identifier_body |
tests.py | # import time
# import unittest
import doctest
from django.test import LiveServerTestCase #, TestCase
from selenium import webdriver
import pug.nlp.util
# from pug.dj import db as djdb
# from traceback import print_exc
class HomeTest(LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox... | # self.assertGreater(len(plots[1].text), 50)
# bars = self.browser.find_elements_by_css_selector('rect.bar')
# # HTML page with more than 6 rect elements classed "bar"
# self.assertGreater(len(bars), 5)
class AdminTest(LiveServerTestCase):
pass
# def setUp(self):
# sel... | # # bar chart with at least some text | random_line_split |
AngularTestContext.js | /*
* Copyright 2015. Author: Jeffrey Hing. All Rights Reserved.
*
* MIT License
*
* AngularTestContext class.
*/
'use strict';
//-------------------------------------
// Module exports
//-------------------------------------
module.exports = AngularTestContext;
//-------------------------------------
// Module... |
} else {
moduleDependencies.push(arg);
}
}
m.injector = angular.injector(moduleDependencies);
}
var proto = AngularTestContext.prototype;
/*
* Compiles the HTML against the provided scope properties.
*
* @param {string} html
* @param {object} [scopeProperties]
* The prope... | {
moduleDependencies.push(arg[j]);
} | conditional_block |
AngularTestContext.js | /*
* Copyright 2015. Author: Jeffrey Hing. All Rights Reserved.
*
* MIT License
*
* AngularTestContext class.
*/
'use strict';
//-------------------------------------
// Module exports
//-------------------------------------
module.exports = AngularTestContext;
//-------------------------------------
// Module... |
var proto = AngularTestContext.prototype;
/*
* Compiles the HTML against the provided scope properties.
*
* @param {string} html
* @param {object} [scopeProperties]
* The properties to add to the scope at compilation.
* @return {object} The root element of the compiled HTML.
*/
proto.compile = function(htm... | {
var m = this[MODEL] = {};
m.scope = null;
var moduleDependencies = ['ng'];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (arg instanceof Array) {
for (var j = 0; j < arg.length; j++) {
moduleDependencies.push(arg[j]);
... | identifier_body |
AngularTestContext.js | /*
* Copyright 2015. Author: Jeffrey Hing. All Rights Reserved.
*
* MIT License
*
* AngularTestContext class.
*/
'use strict';
//-------------------------------------
// Module exports
//-------------------------------------
module.exports = AngularTestContext;
//-------------------------------------
// Module... | return m.injector.instantiate(constructor, {'$scope': this.scope()});
}; | var m = this[MODEL]; | random_line_split |
AngularTestContext.js | /*
* Copyright 2015. Author: Jeffrey Hing. All Rights Reserved.
*
* MIT License
*
* AngularTestContext class.
*/
'use strict';
//-------------------------------------
// Module exports
//-------------------------------------
module.exports = AngularTestContext;
//-------------------------------------
// Module... | () {
var m = this[MODEL] = {};
m.scope = null;
var moduleDependencies = ['ng'];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (arg instanceof Array) {
for (var j = 0; j < arg.length; j++) {
moduleDependencies.push(arg[j]);
... | AngularTestContext | identifier_name |
integration_test.rs | // Copyright 2020 The Tink-Rust 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 applicable law or ag... | {
tink_aead::init();
// Check for AES-GCM key manager.
tink_core::registry::get_key_manager(tink_tests::AES_GCM_TYPE_URL).unwrap();
// Check for ChaCha20Poly1305 key manager.
tink_core::registry::get_key_manager(tink_tests::CHA_CHA20_POLY1305_TYPE_URL).unwrap();
// Check for XChaCha20Poly1305... | identifier_body | |
integration_test.rs | // Copyright 2020 The Tink-Rust 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 applicable law or ag... |
// Check for AES-GCM key manager.
tink_core::registry::get_key_manager(tink_tests::AES_GCM_TYPE_URL).unwrap();
// Check for ChaCha20Poly1305 key manager.
tink_core::registry::get_key_manager(tink_tests::CHA_CHA20_POLY1305_TYPE_URL).unwrap();
// Check for XChaCha20Poly1305 key manager.
tink_co... | fn test_aead_init() {
tink_aead::init(); | random_line_split |
integration_test.rs | // Copyright 2020 The Tink-Rust 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 applicable law or ag... | () {
tink_aead::init();
let kh = tink_core::keyset::Handle::new(&tink_aead::aes256_gcm_key_template()).unwrap();
// NOTE: save the keyset to a safe location. DO NOT hardcode it in source code.
// Consider encrypting it with a remote key in Cloud KMS, AWS KMS or HashiCorp Vault.
// See https://githu... | example | identifier_name |
statfs.rs | use {Errno, Result, NixPath};
use std::os::unix::io::AsRawFd;
pub mod vfs {
#[cfg(target_pointer_width = "32")]
pub mod hwdep {
use libc::{c_uint};
pub type FsType = c_uint;
pub type BlockSize = c_uint;
pub type NameLen = c_uint;
pub type FragmentSize = c_uint;
p... |
pub fn fstatfs<T: AsRawFd>(fd: &T, stat: &mut vfs::Statfs) -> Result<()> {
unsafe {
Errno::clear();
Errno::result(ffi::fstatfs(fd.as_raw_fd(), stat)).map(drop)
}
}
| {
unsafe {
Errno::clear();
let res = try!(
path.with_nix_path(|path| ffi::statfs(path.as_ptr(), stat))
);
Errno::result(res).map(drop)
}
} | identifier_body |
statfs.rs | use {Errno, Result, NixPath};
use std::os::unix::io::AsRawFd;
pub mod vfs {
#[cfg(target_pointer_width = "32")]
pub mod hwdep {
use libc::{c_uint};
pub type FsType = c_uint;
pub type BlockSize = c_uint;
pub type NameLen = c_uint;
pub type FragmentSize = c_uint;
p... | <P: ?Sized + NixPath>(path: &P, stat: &mut vfs::Statfs) -> Result<()> {
unsafe {
Errno::clear();
let res = try!(
path.with_nix_path(|path| ffi::statfs(path.as_ptr(), stat))
);
Errno::result(res).map(drop)
}
}
pub fn fstatfs<T: AsRawFd>(fd: &T, stat: &mut vfs::Statfs... | statfs | identifier_name |
statfs.rs | use {Errno, Result, NixPath};
use std::os::unix::io::AsRawFd;
pub mod vfs {
#[cfg(target_pointer_width = "32")]
pub mod hwdep {
use libc::{c_uint};
pub type FsType = c_uint;
pub type BlockSize = c_uint;
pub type NameLen = c_uint;
pub type FragmentSize = c_uint;
p... | pub const CRAMFS_MAGIC : FsType = 0x28cd3d45;
pub const DEVFS_SUPER_MAGIC : FsType = 0x1373;
pub const EFS_SUPER_MAGIC : FsType = 0x00414A53;
pub const EXT_SUPER_MAGIC : FsType = 0x137D;
pub const EXT2_OLD_SUPER_MAGIC : FsType = 0xEF51;
pub const EXT2_SUPER_MAGIC : FsTy... | random_line_split | |
warning.js | /**
* @license
* Visual Blocks Editor
*
* Copyright 2012 Google Inc.
* https://blockly.googlecode.com/
*
* 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/l... |
};
/**
* Dispose of this warning.
*/
Blockly.Warning.prototype.dispose = function() {
this.block_.warning = null;
Blockly.Icon.prototype.dispose.call(this);
};
| {
this.setVisible(false);
this.setVisible(true);
} | conditional_block |
warning.js | /**
* @license
* Visual Blocks Editor
*
* Copyright 2012 Google Inc.
* https://blockly.googlecode.com/
*
* 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/l... | return;
}
this.text_ = text;
if (this.isVisible()) {
this.setVisible(false);
this.setVisible(true);
}
};
/**
* Dispose of this warning.
*/
Blockly.Warning.prototype.dispose = function() {
this.block_.warning = null;
Blockly.Icon.prototype.dispose.call(this);
}; | * @param {string} text Warning text.
*/
Blockly.Warning.prototype.setText = function(text) {
if (this.text_ == text) { | random_line_split |
asconiusDB.py | import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# Note: The original ordering of chapters and verses was extremely complex.
# As a result, chapters are the bold headers and subsections are each p tag.
# Case 1: Sec... | collSOUP = BeautifulSoup(collOpen, 'html5lib')
author = collSOUP.title.string.strip()
colltitle = 'QUINTUS ASCONIUS PEDIANUS'
date = 'c. 9 B.C. - c. A.D. 76'
textsURL = [collURL]
with sqlite3.connect('texts.db') as db:
c = db.cursor()
c.execute(
'CREATE TABLE ... | def main():
collURL = 'http://www.thelatinlibrary.com/asconius.html'
collOpen = urllib.request.urlopen(collURL)
| random_line_split |
asconiusDB.py | import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# Note: The original ordering of chapters and verses was extremely complex.
# As a result, chapters are the bold headers and subsections are each p tag.
# Case 1: Sec... | chapter = text
verse = 0
continue
passage = text
verse+=1
if passage.startswith('Asconius'):
continue
c.execute("INSERT INTO texts VALUES (?,?,?,?,?,?,?, ?, ?, ?, ?)",
(None, colltitle, title, 'Latin', ... | chapter = '-1'
verse = 0
for p in ptags:
# make sure it's not a paragraph without the main text
try:
if p['class'][0].lower() in ['border', 'pagehead', 'shortborder', 'smallboarder', 'margin',
'internal_navigation']: # these are not p... | identifier_body |
asconiusDB.py | import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# Note: The original ordering of chapters and verses was extremely complex.
# As a result, chapters are the bold headers and subsections are each p tag.
# Case 1: Sec... |
logger.info("Program runs successfully.")
if __name__ == '__main__':
main()
| openurl = urllib.request.urlopen(url)
textsoup = BeautifulSoup(openurl, 'html5lib')
try:
title = textsoup.title.string.split(':')[1].strip()
except:
title = textsoup.title.string.strip()
getp = textsoup.find_all('p')
pars... | conditional_block |
asconiusDB.py | import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# Note: The original ordering of chapters and verses was extremely complex.
# As a result, chapters are the bold headers and subsections are each p tag.
# Case 1: Sec... | (ptags, c, colltitle, title, author, date, URL):
# ptags contains all <p> tags. c is the cursor object.
chapter = '-1'
verse = 0
for p in ptags:
# make sure it's not a paragraph without the main text
try:
if p['class'][0].lower() in ['border', 'pagehead', 'shortborde... | parsecase1 | identifier_name |
navbar.tsx | /** @jsx jsx */
import { jsx, Flex } from "strict-ui"
import { Text, Button, AnchorButton } from "gatsby-interface"
import { useQuery } from "urql"
import { FeedbackFish } from "@feedback-fish/react"
import externalLinkIcon from "../external-link.svg"
import graphqlIcon from "../graphql.svg"
import { Link } from "gatsb... | }
`,
})
const [developState, restartDevelop] = useDevelopState()
return (
<Flex
as="nav"
justifyContent="space-between"
alignItems="center"
sx={{
borderBottom: `default`,
paddingY: 5,
}}
>
<Flex
as={Link}
// @ts-ignore
... | {
npmPackageJson(id: "name") {
value
} | random_line_split |
buildFederatedSchema.ts | import {
DocumentNode,
GraphQLSchema,
isObjectType,
isUnionType,
GraphQLUnionType,
GraphQLObjectType,
specifiedDirectives,
} from 'graphql';
import {
buildSchemaFromSDL,
transformSchema,
GraphQLSchemaModule,
modulesFromSDL,
addResolversToSchema,
GraphQLResolverMap,
} from 'apollo-graphql';
imp... | (
modulesOrSDL:
| (GraphQLSchemaModule | DocumentNode)[]
| DocumentNode
| LegacySchemaModule,
): GraphQLSchema {
// ApolloServer supports passing an array of DocumentNode along with a single
// map of resolvers to build a schema. Long term we don't want to support this
// style anymore as we move to... | buildFederatedSchema | identifier_name |
buildFederatedSchema.ts | import {
DocumentNode,
GraphQLSchema,
isObjectType,
isUnionType,
GraphQLUnionType,
GraphQLObjectType,
specifiedDirectives,
} from 'graphql';
import {
buildSchemaFromSDL,
transformSchema,
GraphQLSchemaModule,
modulesFromSDL,
addResolversToSchema,
GraphQLResolverMap,
} from 'apollo-graphql';
imp... | return module;
});
} else {
shapedModulesOrSDL = modulesOrSDL;
}
const modules = modulesFromSDL(shapedModulesOrSDL);
let schema = buildSchemaFromSDL(
modules,
new GraphQLSchema({
query: undefined,
directives: [...specifiedDirectives, ...federationDirectives],
}),
);
... | {
// ApolloServer supports passing an array of DocumentNode along with a single
// map of resolvers to build a schema. Long term we don't want to support this
// style anymore as we move towards a more structured approach to modules,
// however, it has tripped several teams up to not support this signature
//... | identifier_body |
buildFederatedSchema.ts | import {
DocumentNode,
GraphQLSchema,
isObjectType,
isUnionType,
GraphQLUnionType,
GraphQLObjectType,
specifiedDirectives,
} from 'graphql';
import {
buildSchemaFromSDL,
transformSchema,
GraphQLSchemaModule,
modulesFromSDL,
addResolversToSchema,
GraphQLResolverMap,
} from 'apollo-graphql';
imp... | ...schema.toConfig(),
query: new GraphQLObjectType({
name: 'Query',
fields: {},
}),
});
}
const entityTypes = Object.values(schema.getTypeMap()).filter(
type => isObjectType(type) && typeIncludesDirective(type, 'key'),
);
const hasEntities = entityTypes.length > 0;
... |
// Add an empty query root type if none has been defined
if (!schema.getQueryType()) {
schema = new GraphQLSchema({ | random_line_split |
buildFederatedSchema.ts | import {
DocumentNode,
GraphQLSchema,
isObjectType,
isUnionType,
GraphQLUnionType,
GraphQLObjectType,
specifiedDirectives,
} from 'graphql';
import {
buildSchemaFromSDL,
transformSchema,
GraphQLSchemaModule,
modulesFromSDL,
addResolversToSchema,
GraphQLResolverMap,
} from 'apollo-graphql';
imp... |
const modules = modulesFromSDL(shapedModulesOrSDL);
let schema = buildSchemaFromSDL(
modules,
new GraphQLSchema({
query: undefined,
directives: [...specifiedDirectives, ...federationDirectives],
}),
);
// At this point in time, we have a schema to be printed into SDL which is
// re... | {
shapedModulesOrSDL = modulesOrSDL;
} | conditional_block |
batching.js | /*
* Copyright 2012 the original author or authors
* @license MIT, see LICENSE.txt for details
*
* @author Scott Andrews
*/
(function (define) {
'use strict';
var undef;
/**
* Aggregate messages into batches as they are received.
*/
define(function (require) {
var msgs = require('..');
/**
* Ag... | */
msgs.prototype.batchingAggregator = msgs.utils.optionalName(function batchingAggregator(name, opts) {
var timeout, batch;
batch = [];
opts = opts || {};
opts.batch = opts.batch || 0;
opts.timeout = opts.timeout || 0;
if (opts.batch <= 0 && opts.timeout <= 0) {
throw new Error('Invalid co... | * @param {string|Channel} [opts.input] the channel to receive message
* from
* @param {string|Channel} [opts.error] channel to receive errors
* @returns the aggregator
* @throws on invalid configuration, batch size or timeout is required | random_line_split |
batching.js | /*
* Copyright 2012 the original author or authors
* @license MIT, see LICENSE.txt for details
*
* @author Scott Andrews
*/
(function (define) {
'use strict';
var undef;
/**
* Aggregate messages into batches as they are received.
*/
define(function (require) {
var msgs = require('..');
/**
* Ag... |
return this.aggregator(name, function (message, release) {
batch.push(message.payload);
if (opts.batch > 0 && batch.length >= opts.batch) {
releaseHelper(release);
}
else if (!timeout && opts.timeout > 0) {
timeout = setTimeout(function () {
releaseHelper(release);
}, opts.time... | {
release(batch);
batch = [];
clearTimeout(timeout);
timeout = undef;
} | identifier_body |
batching.js | /*
* Copyright 2012 the original author or authors
* @license MIT, see LICENSE.txt for details
*
* @author Scott Andrews
*/
(function (define) {
'use strict';
var undef;
/**
* Aggregate messages into batches as they are received.
*/
define(function (require) {
var msgs = require('..');
/**
* Ag... |
else if (!timeout && opts.timeout > 0) {
timeout = setTimeout(function () {
releaseHelper(release);
}, opts.timeout);
}
}, opts);
});
return msgs;
});
}(
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }
// Boilerplate f... | {
releaseHelper(release);
} | conditional_block |
batching.js | /*
* Copyright 2012 the original author or authors
* @license MIT, see LICENSE.txt for details
*
* @author Scott Andrews
*/
(function (define) {
'use strict';
var undef;
/**
* Aggregate messages into batches as they are received.
*/
define(function (require) {
var msgs = require('..');
/**
* Ag... | (release) {
release(batch);
batch = [];
clearTimeout(timeout);
timeout = undef;
}
return this.aggregator(name, function (message, release) {
batch.push(message.payload);
if (opts.batch > 0 && batch.length >= opts.batch) {
releaseHelper(release);
}
else if (!timeout && opts.ti... | releaseHelper | identifier_name |
material.module.ts | import { NgModule } from '@angular/core';
import {
MdAutocompleteModule,
MdButtonModule,
MdButtonToggleModule,
MdCardModule,
MdCheckboxModule,
MdChipsModule,
MdCoreModule,
MdDatepickerModule,
MdDialogModule,
MdExpansionModule,
MdGridListModule,
MdIconModule,
MdInputModule,
MdListModule,
| MdRadioModule,
MdRippleModule,
MdSelectModule,
MdSidenavModule,
MdSliderModule,
MdSlideToggleModule,
MdSnackBarModule,
MdSortModule,
MdTableModule,
MdTabsModule,
MdToolbarModule,
MdTooltipModule,
} from '@angular/material';
@NgModule({
exports: [
MdAutocompleteModule,
MdButtonModule,
... | MdMenuModule,
MdNativeDateModule,
MdProgressBarModule,
MdProgressSpinnerModule,
| random_line_split |
material.module.ts | import { NgModule } from '@angular/core';
import {
MdAutocompleteModule,
MdButtonModule,
MdButtonToggleModule,
MdCardModule,
MdCheckboxModule,
MdChipsModule,
MdCoreModule,
MdDatepickerModule,
MdDialogModule,
MdExpansionModule,
MdGridListModule,
MdIconModule,
MdInputModule,
MdListModule,
... | {}
| MaterialModule | identifier_name |
piWebAPI.js | var activeElements = [];
var sleepElements = [];
var promises = [];
$.ajax("https://osiproghackuc2015.osisoft.com/piwebapi/assetdatabases/D0EgxEhIf8KUieOFdFcX1IWQZ8qIGYDdE0m5aJCwNb4x_gSlVQSVRFUjAwMVxQSUZJVE5FU1M/elements", {
type : 'GET',
headers: { "Authorization" : "Basic " + btoa("osiproghack\\hackuser051:bO2r... | }));
} | } | random_line_split |
piWebAPI.js |
var activeElements = [];
var sleepElements = [];
var promises = [];
$.ajax("https://osiproghackuc2015.osisoft.com/piwebapi/assetdatabases/D0EgxEhIf8KUieOFdFcX1IWQZ8qIGYDdE0m5aJCwNb4x_gSlVQSVRFUjAwMVxQSUZJVE5FU1M/elements", {
type : 'GET',
headers: { "Authorization" : "Basic " + btoa("osiproghack\\hackuser051:bO2... |
}
}).done(function(){
$.when.apply($,promises).done(function(){
spinner.stop(target);
var blackout = document.getElementById('blackout');
$('#blackout').css('opacity', '0');
$('#blackout').css('width', '0%');
$('#blackout').css('height', '0%');
});
});
var getSubElements = function(personEleme... | {
var item = results.Items[i];
getSubElements(item);
} | conditional_block |
index.js | /**
* Copyright 2013, 2014 IBM Corp.
*
* 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... | (id) {
checkTypeInUse(id);
return registry.removeNode(id);
}
function removeModule(module) {
var info = registry.getNodeModuleInfo(module);
for (var i=0;i<info.nodes.length;i++) {
checkTypeInUse(info.nodes[i]);
}
return registry.removeModule(module);
}
function disableNode(id) {
c... | removeNode | identifier_name |
index.js | /**
* Copyright 2013, 2014 IBM Corp.
*
* 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... |
return registry.removeModule(module);
}
function disableNode(id) {
checkTypeInUse(id);
return registry.disableNode(id);
}
module.exports = {
// Lifecycle
init: init,
load: registry.load,
// Node registry
createNode: createNode,
getNode: flows.get,
addNode: registry.... | {
checkTypeInUse(info.nodes[i]);
} | conditional_block |
index.js | /**
* Copyright 2013, 2014 IBM Corp.
*
* 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... |
function removeModule(module) {
var info = registry.getNodeModuleInfo(module);
for (var i=0;i<info.nodes.length;i++) {
checkTypeInUse(info.nodes[i]);
}
return registry.removeModule(module);
}
function disableNode(id) {
checkTypeInUse(id);
return registry.disableNode(id);
}
module.ex... | {
checkTypeInUse(id);
return registry.removeNode(id);
} | identifier_body |
index.js | /**
* Copyright 2013, 2014 IBM Corp.
*
* 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... | // Flow handling
loadFlows: flows.load,
stopFlows: flows.stopFlows,
setFlows: flows.setFlows,
getFlows: flows.getFlows,
// Credentials
addCredentials: credentials.add,
getCredentials: credentials.get,
deleteCredentials: credentials.delete
} | cleanNodeList: registry.cleanNodeList,
| random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.