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 |
|---|---|---|---|---|
IfcRectangularTrimmedSurface.g.ts | import {BaseIfc} from "./BaseIfc"
import {IfcPresentationLayerAssignment} from "./IfcPresentationLayerAssignment.g"
import {IfcStyledItem} from "./IfcStyledItem.g"
import {IfcDimensionCount} from "./IfcDimensionCount.g"
import {IfcSurface} from "./IfcSurface.g"
import {IfcParameterValue} from "./IfcParameterValue.g"
im... | super()
this.BasisSurface = basisSurface
this.U1 = u1
this.V1 = v1
this.U2 = u2
this.V2 = v2
this.Usense = usense
this.Vsense = vsense
}
getStepParameters() : string {
var parameters = new Array<string>();
parameters.push(BaseIfc.toStepValue(this.BasisSurface))
parameters.push... | constructor(basisSurface : IfcSurface, u1 : IfcParameterValue, v1 : IfcParameterValue, u2 : IfcParameterValue, v2 : IfcParameterValue, usense : IfcBoolean, vsense : IfcBoolean) { | random_line_split |
IfcRectangularTrimmedSurface.g.ts |
import {BaseIfc} from "./BaseIfc"
import {IfcPresentationLayerAssignment} from "./IfcPresentationLayerAssignment.g"
import {IfcStyledItem} from "./IfcStyledItem.g"
import {IfcDimensionCount} from "./IfcDimensionCount.g"
import {IfcSurface} from "./IfcSurface.g"
import {IfcParameterValue} from "./IfcParameterValue.g"
i... | (basisSurface : IfcSurface, u1 : IfcParameterValue, v1 : IfcParameterValue, u2 : IfcParameterValue, v2 : IfcParameterValue, usense : IfcBoolean, vsense : IfcBoolean) {
super()
this.BasisSurface = basisSurface
this.U1 = u1
this.V1 = v1
this.U2 = u2
this.V2 = v2
this.Usense = usense
this.Vsense = vs... | constructor | identifier_name |
type_.rs | use super::misc::MiscMethods;
use super::Backend;
use super::HasCodegen;
use crate::common::TypeKind;
use crate::mir::place::PlaceRef;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Ty};
use rustc_span::DUMMY_SP;
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
use rustc_target::a... |
let tail = self.tcx().struct_tail_erasing_lifetimes(ty, param_env);
match tail.kind() {
ty::Foreign(..) => false,
ty::Str | ty::Slice(..) | ty::Dynamic(..) => true,
_ => bug!("unexpected unsized tail: {:?}", tail),
}
}
}
impl<T> DerivedTypeMethods<'tcx>... | {
return false;
} | conditional_block |
type_.rs | use super::misc::MiscMethods;
use super::Backend;
use super::HasCodegen;
use crate::common::TypeKind;
use crate::mir::place::PlaceRef;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Ty};
use rustc_span::DUMMY_SP;
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
use rustc_target::a... | fn type_f32(&self) -> Self::Type;
fn type_f64(&self) -> Self::Type;
fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type;
fn type_struct(&self, els: &[Self::Type], packed: bool) -> Self::Type;
fn type_kind(&self, ty: Self::Type) -> TypeKind;
fn type_ptr_to(&self, ty: Self::Ty... | fn type_isize(&self) -> Self::Type;
| random_line_split |
type_.rs | use super::misc::MiscMethods;
use super::Backend;
use super::HasCodegen;
use crate::common::TypeKind;
use crate::mir::place::PlaceRef;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Ty};
use rustc_span::DUMMY_SP;
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
use rustc_target::a... | (&self, ty: Ty<'tcx>) -> bool {
ty.is_sized(self.tcx().at(DUMMY_SP), ty::ParamEnv::reveal_all())
}
fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
ty.is_freeze(self.tcx().at(DUMMY_SP), ty::ParamEnv::reveal_all())
}
fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
let param_... | type_is_sized | identifier_name |
type_.rs | use super::misc::MiscMethods;
use super::Backend;
use super::HasCodegen;
use crate::common::TypeKind;
use crate::mir::place::PlaceRef;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Ty};
use rustc_span::DUMMY_SP;
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
use rustc_target::a... |
fn type_i8p_ext(&self, address_space: AddressSpace) -> Self::Type {
self.type_ptr_to_ext(self.type_i8(), address_space)
}
fn type_int(&self) -> Self::Type {
match &self.sess().target.c_int_width[..] {
"16" => self.type_i16(),
"32" => self.type_i32(),
"6... | {
self.type_i8p_ext(AddressSpace::DATA)
} | identifier_body |
error.rs | // Copyright 2015-2017 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 lat... | } | random_line_split | |
error.rs | // Copyright 2015-2017 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 lat... |
}
impl From<UtilError> for Error {
fn from(err: UtilError) -> Self {
Error::Util(err)
}
}
impl<E> From<Box<E>> for Error where Error: From<E> {
fn from(err: Box<E>) -> Self {
Error::from(*err)
}
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
match *self {
Error::... | {
Error::Trie(err)
} | identifier_body |
error.rs | // Copyright 2015-2017 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 lat... | (err: UtilError) -> Self {
Error::Util(err)
}
}
impl<E> From<Box<E>> for Error where Error: From<E> {
fn from(err: Box<E>) -> Self {
Error::from(*err)
}
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
match *self {
Error::Trie(ref err) => write!(f, "{}", err),
Err... | from | identifier_name |
ModalBox.tsx | import React from 'react'
import styled from 'styled-components'
const StyledModalBox = styled.div`
background-color: #ffffff;
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
width: 100%;
overflow-y: hidden;
`
const HeaderText = styled.h2`
font-famil... | display: flex;
justify-content: center;
padding-top: 20px;
`
const Body = styled.div`
display: flex;
align-content: center;
flex: 5;
margin-top: 20px;
justify-content: space-between;
`
export const ModalBox = ({
header,
actions,
children,
}: {
header: any
actions: any... | const Actions = styled.div` | random_line_split |
context.rs | use std::collections::hash_map::Entry;
use std::path::{Path, PathBuf};
use isymtope_generate::*;
use super::*;
pub trait ServerContext {
fn handle_msg(&mut self, msg: Msg) -> IsymtopeServerResult<ResponseMsg>;
}
#[derive(Debug)]
pub struct DefaultServerContext {
app_dir: PathBuf,
srs: DefaultSecureRandom... | {
RenderComplete(RenderResponse),
}
impl ServerContext for DefaultServerContext {
fn handle_msg(&mut self, msg: Msg) -> IsymtopeServerResult<ResponseMsg> {
match msg {
Msg::RenderAppRoute(ref base_url, ref app_name, ref template_path, ref path) => {
// let template_path = i... | ResponseMsg | identifier_name |
context.rs | use std::collections::hash_map::Entry;
use std::path::{Path, PathBuf};
use isymtope_generate::*;
use super::*;
pub trait ServerContext {
fn handle_msg(&mut self, msg: Msg) -> IsymtopeServerResult<ResponseMsg>;
}
#[derive(Debug)]
pub struct DefaultServerContext {
app_dir: PathBuf,
srs: DefaultSecureRandom... |
}
#[derive(Debug)]
pub enum Msg {
RenderAppRoute(String, String, String, String),
}
#[derive(Debug)]
pub enum ResponseMsg {
RenderComplete(RenderResponse),
}
impl ServerContext for DefaultServerContext {
fn handle_msg(&mut self, msg: Msg) -> IsymtopeServerResult<ResponseMsg> {
match msg {
... | {
DefaultServerContext {
app_dir: app_dir.to_owned(),
srs: Default::default(),
cookies: Default::default(),
}
} | identifier_body |
context.rs | use std::collections::hash_map::Entry;
use std::path::{Path, PathBuf};
use isymtope_generate::*;
use super::*;
pub trait ServerContext {
fn handle_msg(&mut self, msg: Msg) -> IsymtopeServerResult<ResponseMsg>;
}
#[derive(Debug)]
pub struct DefaultServerContext {
app_dir: PathBuf,
srs: DefaultSecureRandom... | impl DefaultServerContext {
#[cfg(not(feature = "cookies"))]
pub fn new(app_dir: &Path) -> Self {
DefaultServerContext {
app_dir: app_dir.to_owned(),
srs: Default::default(),
}
}
#[cfg(feature = "cookies")]
pub fn new(app_dir: &Path) -> Self {
Default... | #[cfg(feature = "cookies")]
cookies: Cookies,
}
| random_line_split |
process.ts | import { Process, api } from "./../../src";
const actionhero = new Process();
describe("Core", () => {
describe("Process", () => {
test("a new process can be created", () => {
expect(actionhero.initialized).toBe(false);
expect(actionhero.started).toBe(false);
expect(actionhero.stopped).toBe(fa... | expect(actionhero.stopReasons).toEqual(["some reason"]);
expect(actionhero.initialized).toBe(false);
expect(actionhero.started).toBe(false);
expect(actionhero.stopped).toBe(true);
});
test("the process is injected into the global API import", () => {
//@ts-ignore
actionhero[... | await actionhero.stop("some reason"); | random_line_split |
style.ts | import { Disposable } from './disposable'
import fs from 'fs'
import path from 'path'
import { promisify } from 'util'
const readFile = promisify(fs.readFile)
export default class Style {
private _themeStyle: string
private _commonStyle: string
private _scope: string
constructor(scope: string = 'global') {
... |
return new Disposable(() => {
styleTag.remove()
})
}
async applyCss(root: DocumentFragment, file: string) {
const styleTag = document.createElement('style')
styleTag.textContent = await readFile(file, 'utf8')
const element = root.querySelector(`#${this._scope}-style`)
if (element) {
... | {
element.appendChild(styleTag)
} | conditional_block |
style.ts | import { Disposable } from './disposable'
import fs from 'fs'
import path from 'path'
import { promisify } from 'util'
const readFile = promisify(fs.readFile)
export default class Style {
private _themeStyle: string
private _commonStyle: string
private _scope: string
constructor(scope: string = 'global') {
... | const styleTag = document.createElement('style')
styleTag.textContent = this._commonStyle
const element = root.querySelector('#global-style')
if (element) {
element.appendChild(styleTag)
}
return new Disposable(() => {
styleTag.remove()
})
}
async applyCss(root: DocumentFrag... | }
applyCommon(root: DocumentFragment) { | random_line_split |
style.ts | import { Disposable } from './disposable'
import fs from 'fs'
import path from 'path'
import { promisify } from 'util'
const readFile = promisify(fs.readFile)
export default class Style {
private _themeStyle: string
private _commonStyle: string
private _scope: string
constructor(scope: string = 'global') {
... | (root: DocumentFragment) {
const styleTag = document.createElement('style')
styleTag.textContent = this._themeStyle
const element = root.querySelector('#theme-style')
if (element) {
element.appendChild(styleTag)
}
return new Disposable(() => {
styleTag.remove()
})
}
applyCom... | applyTheme | identifier_name |
style.ts | import { Disposable } from './disposable'
import fs from 'fs'
import path from 'path'
import { promisify } from 'util'
const readFile = promisify(fs.readFile)
export default class Style {
private _themeStyle: string
private _commonStyle: string
private _scope: string
constructor(scope: string = 'global') {
... |
async applyCss(root: DocumentFragment, file: string) {
const styleTag = document.createElement('style')
styleTag.textContent = await readFile(file, 'utf8')
const element = root.querySelector(`#${this._scope}-style`)
if (element) {
element.appendChild(styleTag)
}
return new Disposable((... | {
const styleTag = document.createElement('style')
styleTag.textContent = this._commonStyle
const element = root.querySelector('#global-style')
if (element) {
element.appendChild(styleTag)
}
return new Disposable(() => {
styleTag.remove()
})
} | identifier_body |
radio_box.py | # Created On: 2010-06-02
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from PyQt5.QtCo... | @items.setter
def items(self, value):
self._labels = value
self._update_buttons()
@property
def selected_index(self):
return self._selected_index
@selected_index.setter
def selected_index(self, value):
self._selected_index = value
self._update_se... | @property
def items(self):
return self._labels[:]
| random_line_split |
radio_box.py | # Created On: 2010-06-02
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from PyQt5.QtCo... | (self, value):
self._labels = value
self._update_buttons()
@property
def selected_index(self):
return self._selected_index
@selected_index.setter
def selected_index(self, value):
self._selected_index = value
self._update_selection()
| items | identifier_name |
radio_box.py | # Created On: 2010-06-02
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from PyQt5.QtCo... |
del self._buttons[len(self._labels):]
to_add = self._labels[len(self._buttons):]
for _ in to_add:
button = QRadioButton(self)
self._buttons.append(button)
self._layout.addWidget(button)
button.toggled.connect(self.buttonToggled)
if self._s... | self._layout.removeWidget(button)
button.setParent(None) | conditional_block |
radio_box.py | # Created On: 2010-06-02
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from PyQt5.QtCo... |
@property
def items(self):
return self._labels[:]
@items.setter
def items(self, value):
self._labels = value
self._update_buttons()
@property
def selected_index(self):
return self._selected_index
@selected_index.setter
def selected_ind... | return self._buttons[:] | identifier_body |
uproxy_core.ts | () {
log.debug('Preparing uProxy Core');
copyPasteConnection = new remote_connection.RemoteConnection((update :uproxy_core_api.Update, message?:any) => {
// TODO send this update only when
// update !== uproxy_core_api.Update.SIGNALLING_MESSAGE
// (after v0.8.13)
ui.update(update, messag... | constructor | identifier_name | |
uproxy_core.ts | ;
/**
* Access various social networks using the Social API.
*/
public login = (loginArgs :uproxy_core_api.LoginArgs) :Promise<void> => {
var networkName = loginArgs.network;
if (!(networkName in social_network.networks)) |
var network = this.pendingNetworks_[networkName];
if (typeof network === 'undefined') {
network = new social_network.FreedomNetwork(networkName);
this.pendingNetworks_[networkName] = network;
}
// TODO: save the auto-login default
return network.login(loginArgs.reconnect).then(() => ... | {
log.warn('Network does not exist', networkName);
return Promise.reject(new Error('Network does not exist (' + networkName + ')'));
} | conditional_block |
uproxy_core.ts | ENDING;
/**
* Access various social networks using the Social API.
*/
public login = (loginArgs :uproxy_core_api.LoginArgs) :Promise<void> => {
var networkName = loginArgs.network;
if (!(networkName in social_network.networks)) {
log.warn('Network does not exist', networkName);
return Pr... | public stopCopyPasteGet = () :Promise<void> => {
return copyPasteConnection.stopGet();
}
public startCopyPasteShare = () => {
this.copyPasteSharingMessages_ = [];
copyPasteConnection.startShare(globals.effectiveMessageVersion());
}
public stopCopyPasteShare = () :Promise<void> => {
return co... | public startCopyPasteGet = () : Promise<net.Endpoint> => {
this.copyPasteGettingMessages_ = [];
return copyPasteConnection.startGet(globals.effectiveMessageVersion());
}
| random_line_split |
unique-values-validator.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
* | * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a... | * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or | random_line_split |
unique-values-validator.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 ... | {
return (formArray: FormArray): ValidationErrors | null => {
const values = formArray.controls
.map(form => form.get(valueControlName))
.filter(control => !!control)
.map(control => control.value)
.filter(value => !skipEmpty || value || value === 0);
return values.length !== uniqueVal... | identifier_body | |
unique-values-validator.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 ... | (valueControlName: string, skipEmpty?: boolean): ValidatorFn {
return (formArray: FormArray): ValidationErrors | null => {
const values = formArray.controls
.map(form => form.get(valueControlName))
.filter(control => !!control)
.map(control => control.value)
.filter(value => !skipEmpty || ... | uniqueValuesValidator | identifier_name |
index.ts | /**
* @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
*/
import {chain, noop, Rule, Tree} from '@angular-devkit/schematics';
import {
addModuleImportToModule,
buildCompon... | buildComponent({...options}, {
template: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template',
stylesheet:
'./__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__style__.template',
}),
options.skipImport ? noop() : addNavModulesToModule(opti... | */
export default function(options: Schema): Rule {
return chain([ | random_line_split |
index.ts | /**
* @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
*/
import {chain, noop, Rule, Tree} from '@angular-devkit/schematics';
import {
addModuleImportToModule,
buildCompon... | (options: Schema) {
return (host: Tree) => {
const modulePath = findModuleFromOptions(host, options)!;
addModuleImportToModule(host, modulePath, 'MatGridListModule', '@angular/material/grid-list');
addModuleImportToModule(host, modulePath, 'MatCardModule', '@angular/material/card');
addModuleImportToM... | addNavModulesToModule | identifier_name |
index.ts | /**
* @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
*/
import {chain, noop, Rule, Tree} from '@angular-devkit/schematics';
import {
addModuleImportToModule,
buildCompon... | {
return (host: Tree) => {
const modulePath = findModuleFromOptions(host, options)!;
addModuleImportToModule(host, modulePath, 'MatGridListModule', '@angular/material/grid-list');
addModuleImportToModule(host, modulePath, 'MatCardModule', '@angular/material/card');
addModuleImportToModule(host, module... | identifier_body | |
flow_label.py | # ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... |
# ============= EOF ============================================= | random_line_split | |
flow_label.py | # ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... | (DataLabel):
"""
this label repositions itself if doesn't fit within the
its component bounds.
"""
constrain_x = Bool(True)
constrain_y = Bool(True)
# position_event=Event
id = Str
# _ox=None
# def _draw(self, gc, **kw):
# self.font='modern 18'
# gc.set_font(... | FlowDataLabel | identifier_name |
flow_label.py | # ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... |
except TypeError:
# documentation auto doc hack
class FlowPlotLabel:
pass
class FlowDataLabel(DataLabel):
"""
this label repositions itself if doesn't fit within the
its component bounds.
"""
constrain_x = Bool(True)
constrain_y = Bool(True)
# position_event=Event
... | def overlay(self, component, gc, *args, **kw):
if self.ox:
self.x = self.ox - self.offset_x
self.y = self.oy - self.offset_y
super(FlowPlotLabel, self).overlay(component, gc, *args, **kw)
def hittest(self, pt):
x, y = pt
w, h = se... | identifier_body |
flow_label.py | # ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... |
super(FlowPlotLabel, self).overlay(component, gc, *args, **kw)
def hittest(self, pt):
x, y = pt
w, h = self.get_preferred_size()
return abs(x - self.x) < w and abs(y - self.y) < h
except TypeError:
# documentation auto doc hack
class FlowPlotLabel:
... | self.x = self.ox - self.offset_x
self.y = self.oy - self.offset_y | conditional_block |
schedule-day.resource.spec.ts | import {ScheduleDayResource} from './schedule-day.resource';
describe("ScheduleDayResource", () => {
var scheduleDayResource : ScheduleDayResource;
var resourceServiceMock : any = {
get: function(){},
put: function(){},
post: function(){},
delete: function(){}
};
... | expect(resourceServiceMock.put).toHaveBeenCalled();
});
});
describe("Delete", () => {
var scheduleDay = {_id: "TestId", day: new Date()};
beforeEach(() => {
scheduleDayResource.delete(scheduleDay);
});
... | scheduleDayResource.put(scheduleDay);
});
it("Calls put on the resource service", () => { | random_line_split |
index.rs | use inverted_index::InvertedIndex;
use field_ref::FieldRef;
use vector::Vector;
use builder::Builder;
use serde::ser::{Serialize, Serializer, SerializeStruct};
use std::collections::HashSet;
use std::convert::From;
type FieldVector = (FieldRef, Vector);
pub struct | {
version: String,
inverted_index: InvertedIndex,
field_vectors: Vec<FieldVector>,
fields: HashSet<String>,
pipeline: Vec<String>,
}
impl From<Builder> for Index {
fn from(mut builder: Builder) -> Index {
builder.build();
Index {
version: String::from("2.1.3"),
... | Index | identifier_name |
index.rs | use inverted_index::InvertedIndex;
use field_ref::FieldRef;
use vector::Vector;
use builder::Builder;
use serde::ser::{Serialize, Serializer, SerializeStruct};
use std::collections::HashSet;
use std::convert::From;
type FieldVector = (FieldRef, Vector);
pub struct Index {
version: String,
inverted_index: In... |
}
| {
let mut index = serializer.serialize_struct("Index", 3)?;
index.serialize_field("version", &self.version)?;
index.serialize_field("pipeline", &self.pipeline)?;
index.serialize_field("fields", &self.fields)?;
index.serialize_field("fieldVectors", &self.field_vectors)?;
... | identifier_body |
index.rs | use inverted_index::InvertedIndex;
use field_ref::FieldRef;
use vector::Vector;
use builder::Builder;
use serde::ser::{Serialize, Serializer, SerializeStruct};
use std::collections::HashSet;
use std::convert::From;
type FieldVector = (FieldRef, Vector);
pub struct Index {
version: String,
inverted_index: In... | fields: builder.fields,
}
}
}
impl Serialize for Index {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer
{
let mut index = serializer.serialize_struct("Index", 3)?;
index.serialize_field("version", &self.version)?;
in... | .into_iter()
.map(|(k, v)| (k, v))
.collect(), | random_line_split |
projects.server.controller.js | 'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
errorHandler = require('./errors.server.controller'),
Project = mongoose.model('Project'),
Task = mongoose.model('Task'),
User = mongoose.model('User'),
_ = require('lodash');
/**
* Create a Project
*/
exports.createProject ... |
});
};
/**
* List of Projects
*/
exports.listProjects = function(req, res) {
Project.find({'timeline':req.user.timeline}).where(req.query).sort('-created').populate('user', 'username').populate('tasks', 'projectName personName group cohort startDate endDate').exec(function(err, projects) {
if (err) {
... | {
res.jsonp(project);
} | conditional_block |
projects.server.controller.js | 'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
errorHandler = require('./errors.server.controller'),
Project = mongoose.model('Project'),
Task = mongoose.model('Task'),
User = mongoose.model('User'),
_ = require('lodash');
/**
* Create a Project
*/
exports.createProject ... |
/**
* Project middleware
*/
exports.projectByID = function(req, res, next, id) {
Project.findById(id).populate('user', 'displayName').exec(function(err, project) {
if (err) return next(err);
if (!project) return next(new Error('Failed to load Project ' + id));
req.project = project;
next();
});
}... | }
});
}; | random_line_split |
Layout.js | const types = {
'SHOW_TOP_BAR': 'SHOW_TOP_BAR',
'HIDE_TOP_BAR': 'HIDE_TOP_BAR',
'SHOW_FOOT_BAR': 'SHOW_FOOT_BAR',
'HIDE_FOOT_BAR': 'HIDE_FOOT_BAR'
}
const state = {
showTop: true,
showFoot: true
}
const mutations = {
[types.SHOW_FOOT_BAR] ({showTop}) {
state.showTop = true
},
[types.HIDE_TOP_BAR... | ({commit}) {
commit(types.HIDE_TOP_BAR)
},
showFoot ({commit}) {
commit(types.SHOW_FOOT_BAR)
},
hideFoot ({commit}) {
commit(types.HIDE_FOOT_BAR)
}
}
const getters = {}
export default {
state,
mutations,
actions,
getters
}
| hideTop | identifier_name |
Layout.js | const types = {
'SHOW_TOP_BAR': 'SHOW_TOP_BAR',
'HIDE_TOP_BAR': 'HIDE_TOP_BAR',
'SHOW_FOOT_BAR': 'SHOW_FOOT_BAR',
'HIDE_FOOT_BAR': 'HIDE_FOOT_BAR'
}
const state = {
showTop: true,
showFoot: true
}
const mutations = {
[types.SHOW_FOOT_BAR] ({showTop}) {
state.showTop = true
},
[types.HIDE_TOP_BAR... | commit(types.SHOW_FOOT_BAR)
},
hideFoot ({commit}) {
commit(types.HIDE_FOOT_BAR)
}
}
const getters = {}
export default {
state,
mutations,
actions,
getters
} | commit(types.HIDE_TOP_BAR)
},
showFoot ({commit}) { | random_line_split |
Layout.js | const types = {
'SHOW_TOP_BAR': 'SHOW_TOP_BAR',
'HIDE_TOP_BAR': 'HIDE_TOP_BAR',
'SHOW_FOOT_BAR': 'SHOW_FOOT_BAR',
'HIDE_FOOT_BAR': 'HIDE_FOOT_BAR'
}
const state = {
showTop: true,
showFoot: true
}
const mutations = {
[types.SHOW_FOOT_BAR] ({showTop}) {
state.showTop = true
},
[types.HIDE_TOP_BAR... |
}
const actions = {
showTop ({commit}) {
commit(types.SHOW_TOP_BAR)
},
hideTop ({commit}) {
commit(types.HIDE_TOP_BAR)
},
showFoot ({commit}) {
commit(types.SHOW_FOOT_BAR)
},
hideFoot ({commit}) {
commit(types.HIDE_FOOT_BAR)
}
}
const getters = {}
export default {
state,
mutation... | {
state.showFoot = false
} | identifier_body |
eztv_api.py | """
This is the (unofficial) Python API for EZTV.it
Using this code, you can manage to get the information regarding any TV Show
which is listed on EZTV.it See how to use it thanks to the file "APIExample.py"
"""
from bs4 import BeautifulSoup
import requests
import re
URL = "http://eztv.it"
class EztvException(Exc... |
if (num_episode not in self._season_and_episode[num_season]):
self._season_and_episode[num_season][num_episode] = magnet_link
return self._instance
def episode(self, num_season=None, num_episode=None):
"""
specific episode
return dictionary structure... | self._season_and_episode[num_season] = {} | conditional_block |
eztv_api.py | """
This is the (unofficial) Python API for EZTV.it
Using this code, you can manage to get the information regarding any TV Show
which is listed on EZTV.it See how to use it thanks to the file "APIExample.py"
"""
from bs4 import BeautifulSoup
import requests
import re
URL = "http://eztv.it"
class EztvException(Exc... | (self, num_season=None, num_episode=None):
"""
specific episode
return dictionary structure
might raise SeasonNotFound or EpisodeNotFound exceptions
"""
# specific episode
if (num_season is not None and num_episode is not None):
# verifi... | episode | identifier_name |
eztv_api.py | """
This is the (unofficial) Python API for EZTV.it
Using this code, you can manage to get the information regarding any TV Show
which is listed on EZTV.it See how to use it thanks to the file "APIExample.py"
"""
from bs4 import BeautifulSoup
import requests
import re
URL = "http://eztv.it"
class EztvException(Exc... |
class SeasonNotFound(EztvException):
"""
Season Not Found Exception
"""
class EpisodeNotFound(EztvException):
"""
Episode Not Found Exception
"""
class EztvAPI(object):
"""
EztvAPI Main Handler
"""
_instance = None
_id_tv_show = None
_season_and_episod... | """
TV Show Not Found Exception
""" | identifier_body |
eztv_api.py | """
This is the (unofficial) Python API for EZTV.it
Using this code, you can manage to get the information regarding any TV Show
which is listed on EZTV.it See how to use it thanks to the file "APIExample.py"
"""
from bs4 import BeautifulSoup
import requests
import re
URL = "http://eztv.it"
class EztvException(Exc... | soup('select', {'name': 'SearchString'})).split('</option>')
for tv_show in tv_shows:
tv_show = tv_show.lower()
if all(x in tv_show for x in terms):
# get the id of the show
id_tv_show = re.search(r"\d+", tv_show)
self._id_tv_sh... | terms = name.split(' ')
req = requests.get(URL, timeout=5)
soup = BeautifulSoup(req.content)
tv_shows = str( | random_line_split |
BaseComponent.js | define([
'../util/Class',
'./BaseView',
'../util/Helper',
'../util/DomEvent'
], function (Class, BaseView, helper, DomEvent) {
"use strict";
var protectedAttrs = ['addChild', 'set', 'get', 'attachTo', 'detach', '_addProtectedAttribute',
'style', 'resize', 'on', 'off', 'once', 'focus', 'b... | * @cfg {Object} args.importCmp Component while instantiate the child items
* @cfg {Object} args.importArgs arguments to be passed to the child items
* @cfg {String} args.itemSelector
* @cfg {HTMLElement} [node]
*/
var BaseComponent = Class({
extend: BaseView,
constructor: f... | * @cfg {Object} args
* @cfg {Object} args.parent
* @cfg {String} args.type
* @cfg {String} args.baseClass
* @cfg {Boolean} args.autoImport if import items automatically | random_line_split |
internal_pack_file_viewers.js | 'use strict';
const fs = require('fs');
const sharedData = require('@render/shared_data.js');
const Config = require('@render/config.js');
const { getKeyFromConfig, get } = require('@aux/aux_global.js');
const Logger = require('@render/logger.js');
const aux_webManager = require('@render/aux_web_manager.js');
const au... | () {
this.viewer = this.config.viewer;
if (this.config.viewer === 'auto') {
this.viewer = false;
const onKey = event => {
let lastRule = context.getLastRuleSelected();
let isTab = event && event.code === 'Tab';
let isFile = context... | init | identifier_name |
internal_pack_file_viewers.js | 'use strict';
const fs = require('fs');
const sharedData = require('@render/shared_data.js');
const Config = require('@render/config.js');
const { getKeyFromConfig, get } = require('@aux/aux_global.js');
const Logger = require('@render/logger.js');
const aux_webManager = require('@render/aux_web_manager.js');
const au... | minTxtFileSize: 10,
disableExtensions: [],
userExtensions: [],
viewer: true,
},
viewer: false,
init() {
this.viewer = this.config.viewer;
if (this.config.viewer === 'auto') {
this.viewer = false;
const onKey = event => {
... | return {
config: {
maxTxtFileSize: 100 * 1024, | random_line_split |
internal_pack_file_viewers.js | 'use strict';
const fs = require('fs');
const sharedData = require('@render/shared_data.js');
const Config = require('@render/config.js');
const { getKeyFromConfig, get } = require('@aux/aux_global.js');
const Logger = require('@render/logger.js');
const aux_webManager = require('@render/aux_web_manager.js');
const au... |
},
defineTypeViewers() {
if (!this.config.viewer) return;
const disableExtensions = this.config.disableExtensions || [];
const userExtensions = this.config.userExtensions || [];
const getRuleExtension = rule => {
const drive_path = context.get(rule, 'params... | {
this.viewer = false;
const onKey = event => {
let lastRule = context.getLastRuleSelected();
let isTab = event && event.code === 'Tab';
let isFile = context.get(lastRule, 'params.drive_path');
if (isTab && isFile) {
... | conditional_block |
internal_pack_file_viewers.js | 'use strict';
const fs = require('fs');
const sharedData = require('@render/shared_data.js');
const Config = require('@render/config.js');
const { getKeyFromConfig, get } = require('@aux/aux_global.js');
const Logger = require('@render/logger.js');
const aux_webManager = require('@render/aux_web_manager.js');
const au... | const isText =
drive_path &&
!disableExtensions.includes(drive_path_ext) &&
(drive_path_ext === '' || textextensions.includes(drive_path_ext) || userExtensions.includes(drive_path_ext));
if (!isText) return false;
let stats = null;
... | {
if (!this.config.viewer) return;
const disableExtensions = this.config.disableExtensions || [];
const userExtensions = this.config.userExtensions || [];
const getRuleExtension = rule => {
const drive_path = context.get(rule, 'params.drive_path');
if (!driv... | identifier_body |
document_loader.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/. */
//! Tracking of pending loads in a document.
//!
//! <https://html.spec.whatwg.org/multipage/#the-end>
use dom::b... | _ => false
})
}
pub fn inhibit_events(&mut self) {
self.events_inhibited = true;
}
pub fn events_inhibited(&self) -> bool {
self.events_inhibited
}
pub fn resource_threads(&self) -> &ResourceThreads {
&self.resource_threads
}
} | }
pub fn is_only_blocked_by_iframes(&self) -> bool {
self.blocking_loads.iter().all(|load| match *load {
LoadType::Subframe(_) => true, | random_line_split |
document_loader.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/. */
//! Tracking of pending loads in a document.
//!
//! <https://html.spec.whatwg.org/multipage/#the-end>
use dom::b... | (&mut self) {
self.events_inhibited = true;
}
pub fn events_inhibited(&self) -> bool {
self.events_inhibited
}
pub fn resource_threads(&self) -> &ResourceThreads {
&self.resource_threads
}
}
| inhibit_events | identifier_name |
document_loader.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/. */
//! Tracking of pending loads in a document.
//!
//! <https://html.spec.whatwg.org/multipage/#the-end>
use dom::b... |
}
}
#[derive(JSTraceable, MallocSizeOf)]
pub struct DocumentLoader {
resource_threads: ResourceThreads,
blocking_loads: Vec<LoadType>,
events_inhibited: bool,
}
impl DocumentLoader {
pub fn new(existing: &DocumentLoader) -> DocumentLoader {
DocumentLoader::new_with_threads(existing.resour... | {
debug_assert!(self.load.is_none());
} | conditional_block |
document_loader.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/. */
//! Tracking of pending loads in a document.
//!
//! <https://html.spec.whatwg.org/multipage/#the-end>
use dom::b... |
/// Remove this load from the associated document's list of blocking loads.
pub fn terminate(blocker: &mut Option<LoadBlocker>) {
if let Some(this) = blocker.as_mut() {
this.doc.finish_load(this.load.take().unwrap());
}
*blocker = None;
}
/// Return the url associa... | {
doc.loader_mut().add_blocking_load(load.clone());
LoadBlocker {
doc: Dom::from_ref(doc),
load: Some(load),
}
} | identifier_body |
request.py | from collections import namedtuple
from http.cookies import SimpleCookie
from urllib.parse import parse_qs, unquote, urlunparse
from httptools import parse_url
from sanic.exceptions import InvalidUsage
from sanic.log import error_logger, logger
try:
from ujson import loads as json_loads
except ImportError:
... | random_line_split | ||
request.py | # on Python 3.5 json.loads only supports str not bytes
return json.loads(data.decode())
else:
json_loads = json.loads
DEFAULT_HTTP_CONTENT_TYPE = "application/octet-stream"
# HTTP/1.1: https://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1
# > If the media type remains ... | (self):
if not hasattr(self, "_socket"):
self._get_address()
return self._port
@property
def socket(self):
if not hasattr(self, "_socket"):
self._get_address()
return self._socket
def _get_address(self):
self._socket = self.transport.get_extr... | port | identifier_name |
request.py | # on Python 3.5 json.loads only supports str not bytes
return json.loads(data.decode())
else:
json_loads = json.loads
DEFAULT_HTTP_CONTENT_TYPE = "application/octet-stream"
# HTTP/1.1: https://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1
# > If the media type remains ... |
else:
scheme = "http"
if self.transport.get_extra_info("sslcontext"):
scheme += "s"
return scheme
@property
def host(self):
# it appears that httptools doesn't return the host
# so pull it from the headers
return self.headers.get("Host"... | scheme = "ws" | conditional_block |
request.py | # on Python 3.5 json.loads only supports str not bytes
return json.loads(data.decode())
else:
json_loads = json.loads
DEFAULT_HTTP_CONTENT_TYPE = "application/octet-stream"
# HTTP/1.1: https://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1
# > If the media type remains ... |
async def put(self, payload):
await self._queue.put(payload)
def is_full(self):
return self._queue.full()
class Request(dict):
"""Properties of an HTTP request such as URL, headers, etc."""
__slots__ = (
"__weakref__",
"_cookies",
"_ip",
"_parsed_url... | """ Stop reading when gets None """
payload = await self._queue.get()
self._queue.task_done()
return payload | identifier_body |
utils.ts | const utilRegistry = {
hashStyleRegistry(len: number): { [key: string]: HashStyle } {
return {
none: { file: '', chunk: '' },
all: { chunk: `.[chunkhash:${len}]`, file: `.[hash:${len}]` }
};
},
mainFieldsResolve: {
es5: ['browser', 'module', 'main'],
e... | (type: 'none' | 'all', len = 7): HashStyle {
return utilRegistry.hashStyleRegistry(len)[type];
}
export type HashStyle = { file: string, chunk: string };
export type ModeStyle = 'development' | 'production';
export function sourceMapStyle(mode: 'development' | 'production') {
return mode === 'development' ? '... | hashFormatStyle | identifier_name |
utils.ts | const utilRegistry = {
hashStyleRegistry(len: number): { [key: string]: HashStyle } {
return {
none: { file: '', chunk: '' },
all: { chunk: `.[chunkhash:${len}]`, file: `.[hash:${len}]` }
};
},
mainFieldsResolve: {
es5: ['browser', 'module', 'main'],
e... | }
export function mainFiledsResolve(target: 'es5' | 'es2015'): string[] {
return utilRegistry.mainFieldsResolve[target];
} |
export function sourceMapStyle(mode: 'development' | 'production') {
return mode === 'development' ? 'eval-cheap-module-source-map' : 'cheap-module-source-map'; | random_line_split |
utils.ts | const utilRegistry = {
hashStyleRegistry(len: number): { [key: string]: HashStyle } | ,
mainFieldsResolve: {
es5: ['browser', 'module', 'main'],
es2015: ['es2015', 'browser', 'module', 'main']
}
};
export function hashFormatStyle(type: 'none' | 'all', len = 7): HashStyle {
return utilRegistry.hashStyleRegistry(len)[type];
}
export type HashStyle = { file: string, chunk: str... | {
return {
none: { file: '', chunk: '' },
all: { chunk: `.[chunkhash:${len}]`, file: `.[hash:${len}]` }
};
} | identifier_body |
qa_cell_mapping_cc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 <+YOU OR YOUR COMPANY+>.
#
# This 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, or (at your option)
# any later version.
#... | gr_unittest.run(qa_cell_mapping_cc, "qa_cell_mapping_cc.xml") | conditional_block | |
qa_cell_mapping_cc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 <+YOU OR YOUR COMPANY+>.
#
# This 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, or (at your option)
# any later version.
#... | (self):
self.tb = None
def test_001_t (self):
# set up fg
self.tb.run ()
# check data
if __name__ == '__main__':
gr_unittest.run(qa_cell_mapping_cc, "qa_cell_mapping_cc.xml")
| tearDown | identifier_name |
qa_cell_mapping_cc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 <+YOU OR YOUR COMPANY+>.
#
# This 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, or (at your option)
# any later version.
#... |
def tearDown (self):
self.tb = None
def test_001_t (self):
# set up fg
self.tb.run ()
# check data
if __name__ == '__main__':
gr_unittest.run(qa_cell_mapping_cc, "qa_cell_mapping_cc.xml")
| self.tb = gr.top_block ()
self.tp = drm.transm_params(1, 3, False, 0, 1, 0, 1, 1, 0, False, 24000, "station label", "text message")
vlen_msc = self.tp.msc().N_MUX() * self.tp.ofdm().M_TF()
vlen_sdc = self.tp.sdc().N()
vlen_fac = self.tp.fac().N() * self.tp.ofdm().M_TF()
self.cell... | identifier_body |
qa_cell_mapping_cc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# | # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FI... | # Copyright 2014 <+YOU OR YOUR COMPANY+>.
#
# This is free software; you can redistribute it and/or modify | random_line_split |
mod.rs | #![allow(dead_code)]
use anyhow::Result;
use tokio::io::{self, AsyncWriteExt};
pub use pueue_lib::state::PUEUE_DEFAULT_GROUP;
mod daemon;
mod env;
mod group;
mod message;
mod network;
mod state;
mod task;
mod wait;
pub use daemon::*;
pub use env::*;
pub use group::*;
pub use message::*;
pub use network::*;
pub use s... |
/// A small helper function, which instantly writes the given string to stdout with a newline.
/// Useful for debugging async tests.
pub async fn async_println(out: &str) -> Result<()> {
let mut stdout = io::stdout();
stdout
.write_all(out.as_bytes())
.await
.expect("Failed to write to ... | pub fn sleep_ms(ms: u64) {
std::thread::sleep(std::time::Duration::from_millis(ms));
} | random_line_split |
mod.rs | #![allow(dead_code)]
use anyhow::Result;
use tokio::io::{self, AsyncWriteExt};
pub use pueue_lib::state::PUEUE_DEFAULT_GROUP;
mod daemon;
mod env;
mod group;
mod message;
mod network;
mod state;
mod task;
mod wait;
pub use daemon::*;
pub use env::*;
pub use group::*;
pub use message::*;
pub use network::*;
pub use s... |
/// A small helper function, which instantly writes the given string to stdout with a newline.
/// Useful for debugging async tests.
pub async fn async_println(out: &str) -> Result<()> {
let mut stdout = io::stdout();
stdout
.write_all(out.as_bytes())
.await
.expect("Failed to write to... | {
std::thread::sleep(std::time::Duration::from_millis(ms));
} | identifier_body |
mod.rs | #![allow(dead_code)]
use anyhow::Result;
use tokio::io::{self, AsyncWriteExt};
pub use pueue_lib::state::PUEUE_DEFAULT_GROUP;
mod daemon;
mod env;
mod group;
mod message;
mod network;
mod state;
mod task;
mod wait;
pub use daemon::*;
pub use env::*;
pub use group::*;
pub use message::*;
pub use network::*;
pub use s... | (out: &str) -> Result<()> {
let mut stdout = io::stdout();
stdout
.write_all(out.as_bytes())
.await
.expect("Failed to write to stdout.");
stdout
.write_all("\n".as_bytes())
.await
.expect("Failed to write to stdout.");
stdout.flush().await?;
Ok(())
... | async_println | identifier_name |
google_table_repl.py | import logging
import time
import cStringIO
from PIL import Image
from libmproxy.protocol.http import decoded
import re
def request(context, flow):
try:
logging.debug("request")
if (flow.request.pretty_host(hostheader=True).endswith("docs.google.com")):
#logging.debug("Before:")
... |
except Exception as e:
logging.debug("CHECK CODE, IDIOT!!!!!!!!!!!")
logging.debug(type(e))
logging.debug(e)
def start (context, argv):
logging.basicConfig(filename="log.log",level=logging.DEBUG)
logging.debug("============================================\n")
logging.debug(time... | m = re.match(r'(?P<msg_start>[\w\W]+)(?P<msg_info>\[null,\d+,[^\]]+\])(?P<msg_end>[\w\W]+)', flow.request.content)
if not m:
# logging.debug("Match failed")
return 0
replace = (m.group('msg_start') + '[null,2, "You have been pwned!!!"]'+m.group('msg_end'))
... | conditional_block |
google_table_repl.py | import logging
import time
import cStringIO
from PIL import Image
from libmproxy.protocol.http import decoded
import re
def request(context, flow):
try:
logging.debug("request")
if (flow.request.pretty_host(hostheader=True).endswith("docs.google.com")):
#logging.debug("Before:")
... | (context, argv):
logging.basicConfig(filename="log.log",level=logging.DEBUG)
logging.debug("============================================\n")
logging.debug(time.time())
logging.debug("Startup:\n")
context.log("start")
| start | identifier_name |
google_table_repl.py | import logging
import time
import cStringIO
from PIL import Image
from libmproxy.protocol.http import decoded | try:
logging.debug("request")
if (flow.request.pretty_host(hostheader=True).endswith("docs.google.com")):
#logging.debug("Before:")
#logging.debug(flow.request.content)
m = re.match(r'(?P<msg_start>[\w\W]+)(?P<msg_info>\[null,\d+,[^\]]+\])(?P<msg_end>[\w\W]+)', fl... | import re
def request(context, flow): | random_line_split |
google_table_repl.py | import logging
import time
import cStringIO
from PIL import Image
from libmproxy.protocol.http import decoded
import re
def request(context, flow):
|
def start (context, argv):
logging.basicConfig(filename="log.log",level=logging.DEBUG)
logging.debug("============================================\n")
logging.debug(time.time())
logging.debug("Startup:\n")
context.log("start")
| try:
logging.debug("request")
if (flow.request.pretty_host(hostheader=True).endswith("docs.google.com")):
#logging.debug("Before:")
#logging.debug(flow.request.content)
m = re.match(r'(?P<msg_start>[\w\W]+)(?P<msg_info>\[null,\d+,[^\]]+\])(?P<msg_end>[\w\W]+)', flow.r... | identifier_body |
db2_impl.py | # Copyright 2016 IBM Corp
# All Rights Reserved.
#
# 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... |
def post_restore(self):
"""
Restore from the directory that we untarred into
"""
out, err = utils.execute_with_timeout(system.GET_DB_NAMES,
shell=True)
dbNames = out.split()
for dbName in dbNames:
service.run... | super(DB2Backup, self).__init__(*args, **kwargs)
self.appStatus = service.DB2AppStatus()
self.app = service.DB2App(self.appStatus)
self.admin = service.DB2Admin()
self.restore_location = DB2_BACKUP_DIR | identifier_body |
db2_impl.py | # Copyright 2016 IBM Corp
# All Rights Reserved.
#
# 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... | out, err = utils.execute_with_timeout(system.GET_DB_NAMES,
shell=True)
dbNames = out.split()
for dbName in dbNames:
service.run_command(system.RESTORE_DB % {'dbname': dbName,
'dir': DB2... | def post_restore(self):
"""
Restore from the directory that we untarred into
""" | random_line_split |
db2_impl.py | # Copyright 2016 IBM Corp
# All Rights Reserved.
#
# 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... |
LOG.info(_("Cleaning out restore location post: %s."), DB2_BACKUP_DIR)
operating_system.remove(DB2_BACKUP_DIR, force=True, as_root=True)
| service.run_command(system.RESTORE_DB % {'dbname': dbName,
'dir': DB2_BACKUP_DIR}) | conditional_block |
db2_impl.py | # Copyright 2016 IBM Corp
# All Rights Reserved.
#
# 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... | (self):
"""
Restore from the directory that we untarred into
"""
out, err = utils.execute_with_timeout(system.GET_DB_NAMES,
shell=True)
dbNames = out.split()
for dbName in dbNames:
service.run_command(system.RESTOR... | post_restore | identifier_name |
__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2011-2013 Serpent Consulting Services Pvt. Ltd. (<http://serpentcs.com>).
#
# This progr... | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#######################################... | #
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of | random_line_split |
jquery.wikiEditor.publish.js | /* Publish module for wikiEditor */
( function ( $ ) {
$.wikiEditor.modules.publish = {
/**
* Compatability map
*/
browsers: {
// Left-to-right languages
ltr: {
msie: [['>=', 7]],
firefox: [['>=', 3]],
opera: [['>=', 9.6]],
safari: [['>=', 4]]
},
// Right-to-left languages
rtl: {
ms... |
newCopyWarnHTML += '</ul>';
// No list if there's only one element
$(this).find( '.wikiEditor-publish-dialog-copywarn' ).html(
copyWarnStatements.length > 1 ? newCopyWarnHTML : copyWarnHTML
);
/* END OF REALLY DIRTY HACK */
if ( $( '#wpMinoredit' ).length === 0 )
... | {
if ( copyWarnStatements[i] !== '' ) {
var copyWarnStatement = $.trim( copyWarnStatements[i] ).replace( /\.*$/, '' );
newCopyWarnHTML += '<li>' + copyWarnStatement + '.</li>';
}
} | conditional_block |
jquery.wikiEditor.publish.js | /* Publish module for wikiEditor */
( function ( $ ) {
$.wikiEditor.modules.publish = {
/**
* Compatability map
*/
browsers: {
// Left-to-right languages
ltr: {
msie: [['>=', 7]],
firefox: [['>=', 3]],
opera: [['>=', 9.6]],
safari: [['>=', 4]]
| firefox: [['>=', 3]],
opera: [['>=', 9.6]],
safari: [['>=', 4]]
}
},
/**
* Internally used functions
*/
fn: {
/**
* Creates a publish module within a wikiEditor
* @param context Context object of editor to create module in
* @param config Configuration object to create module from
*/
cr... | },
// Right-to-left languages
rtl: {
msie: [['>=', 8]],
| random_line_split |
manticore_protocol_spdm_GetCaps__req_to_wire.rs | // Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
// !! DO NOT EDIT !!
// To regenerate this file, run `fuzz/generate_proto_tests.py`.
#![no_main]
#![allow(non_snake_case)]
use libfuzzer_sys::fuzz_target;
use mantico... | }); | let _ = Req::borrow(&data).to_wire(&mut &mut out[..]); | random_line_split |
house.py | parts = (('house', 'Jack built'),
('malt', 'lay in'),
('rat', 'ate'),
('cat', 'killed'),
('dog', 'worried'),
('cow with the crumpled horn', 'tossed'),
('maiden all forlorn', 'milked'),
('man all tattered and torn', 'kis... |
def rhymes(v = 11):
if v == 0:
return verse(v)
else:
return verse(v) + ' the ' + rhymes(v-1)
def rhyme():
return '\n'.join([ 'This is the ' + rhymes(v) + '.\n' for v in range(12) ])[:-1]
| return '{}\nthat {}'.format(parts[n][0],parts[n][1]) if n != 0 else '{} that {}'.format(parts[n][0],parts[n][1]) | identifier_body |
house.py | parts = (('house', 'Jack built'),
('malt', 'lay in'),
('rat', 'ate'),
('cat', 'killed'),
('dog', 'worried'),
('cow with the crumpled horn', 'tossed'),
('maiden all forlorn', 'milked'),
('man all tattered and torn', 'kis... | (n):
return '{}\nthat {}'.format(parts[n][0],parts[n][1]) if n != 0 else '{} that {}'.format(parts[n][0],parts[n][1])
def rhymes(v = 11):
if v == 0:
return verse(v)
else:
return verse(v) + ' the ' + rhymes(v-1)
def rhyme():
return '\n'.join([ 'This is the ' + rhymes(v) + '.\n' for v in range(12) ])[:-1]
| verse | identifier_name |
house.py | parts = (('house', 'Jack built'),
('malt', 'lay in'),
('rat', 'ate'),
('cat', 'killed'),
('dog', 'worried'),
('cow with the crumpled horn', 'tossed'),
('maiden all forlorn', 'milked'),
('man all tattered and torn', 'kis... |
else:
return verse(v) + ' the ' + rhymes(v-1)
def rhyme():
return '\n'.join([ 'This is the ' + rhymes(v) + '.\n' for v in range(12) ])[:-1]
| return verse(v) | conditional_block |
house.py | parts = (('house', 'Jack built'),
('malt', 'lay in'),
('rat', 'ate'),
('cat', 'killed'),
('dog', 'worried'),
('cow with the crumpled horn', 'tossed'),
('maiden all forlorn', 'milked'),
('man all tattered and torn', 'kis... |
def rhyme():
return '\n'.join([ 'This is the ' + rhymes(v) + '.\n' for v in range(12) ])[:-1] | else:
return verse(v) + ' the ' + rhymes(v-1) | random_line_split |
regress-208496-001.js | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
/*
*
* Date: 05 June 2... | {
enterFunc('test');
printBugNumber(BUGNUMBER);
printStatus(summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
} | identifier_body | |
regress-208496-001.js | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
/*
*
* Date: 05 June 2... |
exitFunc ('test');
}
| {
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
} | conditional_block |
regress-208496-001.js | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
/*
*
* Date: 05 June 2... |
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function t... | random_line_split | |
regress-208496-001.js | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
/*
*
* Date: 05 June 2... | ()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc('test');
printBugNumber(BUGNUMBER);
printStatus(summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
... | addThis | identifier_name |
issue-3563-3.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 ... |
}
// This is similar to an interface in other languages: it defines a protocol which
// developers can implement for arbitrary concrete types.
trait Canvas {
fn add_point(&mut self, shape: Point);
fn add_rect(&mut self, shape: Rect);
// Unlike interfaces traits support default implementations.
// Got... | {
// Convert each line into a string.
let lines = self.lines.iter()
.map(|line| String::from_chars(line.as_slice()))
.collect::<Vec<String>>();
// Concatenate the lines together using a new-line.
write!(f, "{}", lines.connect("... | identifier_body |
issue-3563-3.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 ... | {
width: int,
height: int,
}
impl Copy for Size {}
struct Rect {
top_left: Point,
size: Size,
}
impl Copy for Rect {}
// Contains the information needed to do shape rendering via ASCII art.
struct AsciiArt {
width: uint,
height: uint,
fill: char,
lines: Vec<Vec<char> > ,
// Thi... | Size | identifier_name |
issue-3563-3.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 ... | } | test_shapes(); | random_line_split |
issue-3563-3.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 ... |
return true;
}
fn test_ascii_art_ctor() {
let art = AsciiArt(3, 3, '*');
assert!(check_strs(art.to_string().as_slice(), "...\n...\n..."));
}
fn test_add_pt() {
let mut art = AsciiArt(3, 3, '*');
art.add_pt(0, 0);
art.add_pt(0, -10);
art.add_pt(1, 2);
assert!(check_strs(art.to_string... | {
println!("Found:\n{}\nbut expected\n{}", actual, expected);
return false;
} | conditional_block |
unixconn.py | # Copyright 2013 dotCloud inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. | # You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.... | random_line_split | |
unixconn.py | # Copyright 2013 dotCloud inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed t... | (self, base_url, socket_path, timeout=60):
super(UnixHTTPConnectionPool, self).__init__(
'localhost', timeout=timeout
)
self.base_url = base_url
self.socket_path = socket_path
self.timeout = timeout
def _new_conn(self):
return UnixHTTPConnection(self.base... | __init__ | identifier_name |
unixconn.py | # Copyright 2013 dotCloud inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed t... |
self.socket_path = socket_path
self.timeout = timeout
self.pools = RecentlyUsedContainer(10,
dispose_func=lambda p: p.close())
super(UnixAdapter, self).__init__()
def get_connection(self, url, proxies=None):
with self.pools.lock:
... | socket_path = '/' + socket_path | conditional_block |
unixconn.py | # Copyright 2013 dotCloud inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed t... |
def connect(self):
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.settimeout(self.timeout)
sock.connect(self.unix_socket)
self.sock = sock
class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
def __init__(self, base_url, socket_path, timeout... | super(UnixHTTPConnection, self).__init__(
'localhost', timeout=timeout
)
self.base_url = base_url
self.unix_socket = unix_socket
self.timeout = timeout | identifier_body |
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()
... | });
});
};
/**
* Show the current project
*/
exports.read = function(req, res) {
res.jsonp(req.project);
};
/**
* Update a project
*/
exports.update = function(req, res) {
var project = req.project;
project = _.extend(project, req.body);
project.lastEditor = req.user;
project.lastEdited =... | if (err) {
console.log(err);
return res.status(400).send('plate layout did not save');
}
return res.json(destPath); | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.