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 |
|---|---|---|---|---|
timeline-element.tsx | import React, { RefObject, useEffect, useRef } from "react"
import { StyledElement, Fadeout } from "./timeline.styled"
const Element: React.FC<{
className: string
getRef?(ref: RefObject<any>): void
}> = ({ className, children, getRef }) => {
const ref = useRef()
useEffect(() => {
getRef?.(ref)
}, [ref.cu... | {
return (
<div className="separator">
<div className="dot"></div>
<div className="connector"></div>
</div>
)
} | identifier_body | |
timeline-element.tsx | import React, { RefObject, useEffect, useRef } from "react"
import { StyledElement, Fadeout } from "./timeline.styled"
const Element: React.FC<{
className: string
getRef?(ref: RefObject<any>): void
}> = ({ className, children, getRef }) => {
const ref = useRef()
useEffect(() => {
getRef?.(ref)
}, [ref.cu... | () {
return (
<div className="separator">
<div className="dot"></div>
<div className="connector"></div>
</div>
)
}
| Separator | identifier_name |
timeline-element.tsx | import React, { RefObject, useEffect, useRef } from "react"
import { StyledElement, Fadeout } from "./timeline.styled"
const Element: React.FC<{
className: string
getRef?(ref: RefObject<any>): void
}> = ({ className, children, getRef }) => {
const ref = useRef()
useEffect(() => {
getRef?.(ref)
}, [ref.cu... | </div>
)
} | return (
<div className="separator">
<div className="dot"></div>
<div className="connector"></div> | random_line_split |
climatechange.rsds.py | -ESM2M',\
]
RCMs=[
'rsds_AFR-44_CCCma-CanESM2_rcp85_r1i1p1_SMHI-RCA4_v1_mon_200601-210012.nc',\
'rsds_AFR-44_CNRM-CERFACS-CNRM-CM5_rcp85_r1i1p1_CLMcom-CCLM4-8-17_v1_mon_200601-210012.nc',\
'rsds_AFR-44_CNRM-CERFACS-CNRM-CM5_rcp85_r1i1p1_SMHI-RCA4_v1_mon_200601-210012.nc',\
'rsds... | ArrRefTemp=[RefTemp] | conditional_block | |
climatechange.rsds.py | \
'HadGEM2-ES',\
'HadGEM2-ES',\
'MPI-ESM-LR',\
'MPI-ESM-LR',\
'NorESM1-M',\
'GFDL-ESM2M',\
]
RCMs=[
'rsds_AFR-44_CCCma-CanESM2_rcp85_r1i1p1_SMHI-RCA4_v1_mon_200601-210012.nc',\
'rsds_AFR-44_CNRM-CERFACS-CNRM-CM5_rcp85_r1i1p1_CLMcom-CCLM4-8-17_v1_m... | 'EC-EARTH',\
'EC-EARTH',\
'IPSL-CM5A-MR',\
'MIROC5',\
'HadGEM2-ES',\
'HadGEM2-ES',\
'HadGEM2-ES',\
'MPI-ESM-LR',\
'MPI-ESM-LR',\
'NorESM1-M',\
'GFDL-ESM2M',\
]
COLORtar=['darkred','black','deeppink','orange',\
'ora... | 'EC-EARTH',\ | random_line_split |
RecipientSignup.js | import React from 'react'
import cookie from 'react-cookie'
import { Link } from 'react-router'
import url from '../../config.js'
// components
import NavBar from './NavBar'
import Header from './Header'
import ToggleDisplay from 'react-toggle-display'
import FlatButton from 'material-ui/lib/flat-button'
import Raised... |
},
handleSubmit: function () {
let _this = this
let dataObject = {
name: this.state.name,
imgURL: this.state.photo,
received: 0,
target: this.state.target,
sobStory: this.state.sobstory,
donorID: cookie.load('donorID')
}
postRequest(url + '/recipients', dataObje... | {
var profileURL = "/recipient/" + data.recipientID
this.setState({'profileURL': profileURL})
this.setState({'alreadyHasTeeth': true})
} | conditional_block |
RecipientSignup.js | import React from 'react'
import cookie from 'react-cookie'
import { Link } from 'react-router'
import url from '../../config.js'
// components
import NavBar from './NavBar'
import Header from './Header'
import ToggleDisplay from 'react-toggle-display'
import FlatButton from 'material-ui/lib/flat-button'
import Raised... | ,
getInitialState: function () {
return {
name: "",
target: 0,
sobstory: "",
photo: "",
isUploaded: false,
alreadyHasTeeth: false,
isLoggedIn: false,
profileURL: ""
}
},
handleName: function (e) {
this.setState({'name': e.target.value})
},
handleT... | {
return {
muiTheme: GetMuiTheme(MyTheme),
}
} | identifier_body |
RecipientSignup.js | import React from 'react'
import cookie from 'react-cookie'
import { Link } from 'react-router'
import url from '../../config.js'
// components
import NavBar from './NavBar'
import Header from './Header'
import ToggleDisplay from 'react-toggle-display'
import FlatButton from 'material-ui/lib/flat-button'
import Raised... |
// database functions
import postRequest from '../postRequest.js'
import getRequest from '../getRequest.js'
// material-ui helpers
import GetMuiTheme from 'material-ui/lib/styles/getMuiTheme'
import MyTheme from '../theme.js';
export default React.createClass ({
childContextTypes : {
muiTheme: React.PropTypes.... | import TextField from 'material-ui/lib/text-field' | random_line_split |
RecipientSignup.js | import React from 'react'
import cookie from 'react-cookie'
import { Link } from 'react-router'
import url from '../../config.js'
// components
import NavBar from './NavBar'
import Header from './Header'
import ToggleDisplay from 'react-toggle-display'
import FlatButton from 'material-ui/lib/flat-button'
import Raised... | () {
return {
muiTheme: GetMuiTheme(MyTheme),
}
},
getInitialState: function () {
return {
name: "",
target: 0,
sobstory: "",
photo: "",
isUploaded: false,
alreadyHasTeeth: false,
isLoggedIn: false,
profileURL: ""
}
},
handleName: function ... | getChildContext | identifier_name |
tabs.rs | // Copyleft (ↄ) meh. <meh@schizofreni.co> | http://meh.schizofreni.co
//
// This file is part of cancer.
//
// cancer 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
// (a... | pub fn next(&self, n: i32, start: u32) -> u32 {
let mut end = start;
if n > 0 {
while end < self.cols {
end += 1;
if self.get(end) {
break;
}
}
}
else {
while end != 0 {
end -= 1;
if self.get(end) {
break;
}
}
}
if end == self.cols && !self.get(end) {
st... | self.inner.clear()
}
| identifier_body |
tabs.rs | // Copyleft (ↄ) meh. <meh@schizofreni.co> | http://meh.schizofreni.co
//
// This file is part of cancer.
//
// cancer 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
// (a... | ols: u32, rows: u32) -> Self {
Tabs {
cols: cols,
rows: rows,
inner: BitVec::from_fn(cols as usize, |i| i % 8 == 0)
}
}
pub fn resize(&mut self, cols: u32, rows: u32) {
self.inner.grow(cols as usize, false);
if cols > self.cols {
for i in (self.cols .. cols).filter(|i| i % 8 == 0) {
self.in... | w(c | identifier_name |
tabs.rs | // Copyleft (ↄ) meh. <meh@schizofreni.co> | http://meh.schizofreni.co
//
// This file is part of cancer.
//
// cancer 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
// (a... | self.cols = cols;
self.rows = rows;
}
pub fn set(&mut self, x: u32, value: bool) {
self.inner.set(x as usize, value);
}
pub fn get(&self, x: u32) -> bool {
self.inner.get(x as usize).unwrap_or(false)
}
pub fn clear(&mut self) {
self.inner.clear()
}
pub fn next(&self, n: i32, start: u32) -> u32 {
... | for i in (self.cols .. cols).filter(|i| i % 8 == 0) {
self.inner.set(i as usize, true);
}
}
| conditional_block |
tabs.rs | // Copyleft (ↄ) meh. <meh@schizofreni.co> | http://meh.schizofreni.co
//
// This file is part of cancer.
//
// cancer 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
// (a... | if n > 0 {
while end < self.cols {
end += 1;
if self.get(end) {
break;
}
}
}
else {
while end != 0 {
end -= 1;
if self.get(end) {
break;
}
}
}
if end == self.cols && !self.get(end) {
start
}
else {
end
}
}
} | random_line_split | |
camel_case_splitter.py | def split_camel_case(input):
def | (camel_case_input):
no_camel_case = ""
if len(camel_case_input) <= 0:
return ""
no_camel_case += camel_case_input[0].lower()
for c in camel_case_input[1:]:
if c.isupper():
no_camel_case += "_" + c.lower()
else:
no_camel_... | remove_camel_case | identifier_name |
camel_case_splitter.py | def split_camel_case(input):
| return retval[:-1].replace("__", "_")
def is_camel_case_name(input):
if '_' in input:
return False
if input.islower():
return False
if input.isupper():
return False
return True | def remove_camel_case(camel_case_input):
no_camel_case = ""
if len(camel_case_input) <= 0:
return ""
no_camel_case += camel_case_input[0].lower()
for c in camel_case_input[1:]:
if c.isupper():
no_camel_case += "_" + c.lower()
else:
... | identifier_body |
camel_case_splitter.py | def split_camel_case(input):
def remove_camel_case(camel_case_input):
no_camel_case = ""
if len(camel_case_input) <= 0:
return ""
no_camel_case += camel_case_input[0].lower()
for c in camel_case_input[1:]:
if c.isupper():
no_camel_case += "_" +... |
return True | return False | conditional_block |
address.js | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... | (contact) {
const buttons = [
<Button
key='editmeta'
icon={ <ContentCreate /> }
label='edit'
onClick={ this.onEditClick }
/>,
<Button
key='delete'
icon={ <ActionDelete /> }
label='delete address'
onClick={ this.showDeleteDialog }
... | renderActionbar | identifier_name |
address.js | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... |
componentWillReceiveProps (nextProps) {
const prevAddress = this.props.params.address;
const nextAddress = nextProps.params.address;
if (prevAddress !== nextAddress) {
this.setVisibleAccounts(nextProps);
}
}
componentWillUnmount () {
this.props.setVisibleAccounts([]);
}
setVisib... | {
this.setVisibleAccounts();
} | identifier_body |
address.js | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... | );
}
onEditClick = () => {
this.setState({
showEditDialog: !this.state.showEditDialog
});
}
closeDeleteDialog = () => {
this.setState({ showDeleteDialog: false });
}
showDeleteDialog = () => {
this.setState({ showDeleteDialog: true });
}
onOpenAdd = () => {
this.setStat... | /> | random_line_split |
address.js | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... |
const { contacts } = this.props;
const { showAdd } = this.state;
if (!showAdd) {
return null;
}
return (
<AddAddress
contacts={ contacts }
onClose={ this.onCloseAdd }
address={ address }
/>
);
}
renderDelete (contact) {
if (!contact) {
... | {
return null;
} | conditional_block |
Execute.py | #!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | # The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ... | random_line_split | |
Execute.py | #!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... |
else:
expect = r"""scons: \*\*\* Error 1
scons: \*\*\* Error 2
scons: \*\*\* nonexistent\.in: No such file or directory"""
test.run(arguments = '.', stdout = None, stderr = None)
test.must_contain_all_lines(test.stderr(), expect.splitlines(), find=TestSCons.search_re)
test.must_match('a.out', "a.in\n")
test.mus... | expect = r"""scons: \*\*\* Error 1
scons: \*\*\* Error 2
scons: \*\*\* nonexistent.in/\*\.\*: (The system cannot find the path specified|Das System kann den angegebenen Pfad nicht finden)""" | conditional_block |
index.d.ts | // Type definitions for belter 1.0
// Project: https://github.com/krakenjs/belter#readme
// Definitions by: sly <https://github.com/SlyBouhafs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace belter;
// Device.js function definitions
export function getUserAgent(): string;
expor... | export function isIEIntranet(): boolean;
export function isMacOsCna(): boolean;
export function supportsPopups(ua: string): boolean;
export function isChrome(ua: string): boolean;
export function isSafari(ua: string): boolean; | export function isElectron(): boolean; | random_line_split |
link-documents-return-blockly-component.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 ... | (): MasterBlockType[] {
return [MasterBlockType.Rule, MasterBlockType.Link];
}
public registerBlock(workspace: any) {
const this_ = this;
Blockly.Blocks[BlocklyUtils.LINK_DOCUMENTS_RETURN] = {
init: function () {
this.jsonInit({
type: BlocklyUtils.LINK_DOCUMENTS_RETURN,
... | getVisibility | identifier_name |
link-documents-return-blockly-component.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either ... |
}
}
}
| {
const linkTypeId = block.getField('LINKTYPE').value_;
block.setOutput(true, linkTypeId + BlocklyUtils.LINK_VAR_SUFFIX);
this.blocklyUtils.checkVariablesType(changeEvent, workspace);
} | conditional_block |
link-documents-return-blockly-component.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either ... |
public getVisibility(): MasterBlockType[] {
return [MasterBlockType.Rule, MasterBlockType.Link];
}
public registerBlock(workspace: any) {
const this_ = this;
Blockly.Blocks[BlocklyUtils.LINK_DOCUMENTS_RETURN] = {
init: function () {
this.jsonInit({
type: BlocklyUtils.LINK_D... | {
super(blocklyUtils, linkTypes);
} | identifier_body |
link-documents-return-blockly-component.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 ... |
declare var Blockly: any;
export class LinkDocumentsReturnBlocklyComponent extends LinkDocumentsNoReturnBlocklyComponent {
public constructor(public blocklyUtils: BlocklyUtils, protected linkTypes: LinkType[]) {
super(blocklyUtils, linkTypes);
}
public getVisibility(): MasterBlockType[] {
return [Maste... | import {isNotNullOrUndefined} from '../../../utils/common.utils'; | random_line_split |
const.py | """Constants for monitoring a Sense energy sensor."""
import asyncio
from sense_energy import SenseAPITimeoutException
DOMAIN = "sense"
DEFAULT_TIMEOUT = 10
ACTIVE_UPDATE_RATE = 60
DEFAULT_NAME = "Sense"
SENSE_DATA = "sense_data"
SENSE_DEVICE_UPDATE = "sense_devices_update"
SENSE_DEVICES_DATA = "sense_devices_data"
... | "washer": "washing-machine",
} | random_line_split | |
App.tsx | import * as React from 'react';
import Container from '@material-ui/core/Container';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
import Link from '@material-ui/core/Link';
import ProTip from './ProTip';
function Copyright() |
export default function App() {
return (
<Container maxWidth="sm">
<Box sx={{ my: 4 }}>
<Typography variant="h4" component="h1" gutterBottom>
Create React App v5-alpha example with TypeScript
</Typography>
<ProTip />
<Copyright />
</Box>
</Container>
);... | {
return (
<Typography variant="body2" color="text.secondary" align="center">
{'Copyright © '}
<Link color="inherit" href="https://material-ui.com/">
Your Website
</Link>{' '}
{new Date().getFullYear()}.
</Typography>
);
}
| identifier_body |
App.tsx | import * as React from 'react';
import Container from '@material-ui/core/Container';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
import Link from '@material-ui/core/Link';
import ProTip from './ProTip';
function Copyright() {
return (
<Typography variant="body2... | ) {
return (
<Container maxWidth="sm">
<Box sx={{ my: 4 }}>
<Typography variant="h4" component="h1" gutterBottom>
Create React App v5-alpha example with TypeScript
</Typography>
<ProTip />
<Copyright />
</Box>
</Container>
);
}
| pp( | identifier_name |
App.tsx | import * as React from 'react';
import Container from '@material-ui/core/Container';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
import Link from '@material-ui/core/Link'; |
function Copyright() {
return (
<Typography variant="body2" color="text.secondary" align="center">
{'Copyright © '}
<Link color="inherit" href="https://material-ui.com/">
Your Website
</Link>{' '}
{new Date().getFullYear()}.
</Typography>
);
}
export default function App() ... | import ProTip from './ProTip'; | random_line_split |
iconfig.interface.d.ts | /// <reference path="../../_references.d.ts" />
declare module config {
/**
* Interface for Platypi Project Config
*/
export interface IPlatypi {
templatesVersion?: string;
cordovaId?: string;
cordovaName?: string;
configPath?: string;
name?: string;
... | path?: string;
registeredName?: string;
}
} | type: string; | random_line_split |
vgg.py | import torch.nn as nn
import math
class VGG(nn.Module):
def __init__(self, features, num_classes=1000):
super(VGG, self).__init__()
self.features = features
self.classifier = nn.Sequential(
nn.Linear(8192, 4096),
nn.ReLU(True),
nn.Dropout(),
... |
in_channels = v
return nn.Sequential(*layers)
cfg = {
'A': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],
'B': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],
'D': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, ... | layers += [conv2d, nn.ReLU(inplace=True)] | conditional_block |
vgg.py | import torch.nn as nn
import math
class VGG(nn.Module):
| def _initialize_weights(self):
for m in self.modules():
if isinstance(m, nn.Conv2d):
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
m.weight.data.normal_(0, math.sqrt(2. / n))
if m.bias is not None:
m.bias.data.zero_()... | def __init__(self, features, num_classes=1000):
super(VGG, self).__init__()
self.features = features
self.classifier = nn.Sequential(
nn.Linear(8192, 4096),
nn.ReLU(True),
nn.Dropout(),
nn.Linear(4096, 4096),
nn.ReLU(True),
... | identifier_body |
vgg.py | import torch.nn as nn
import math
class VGG(nn.Module):
def __init__(self, features, num_classes=1000):
super(VGG, self).__init__()
self.features = features
self.classifier = nn.Sequential(
nn.Linear(8192, 4096),
nn.ReLU(True),
nn.Dropout(),
... | (self, x):
x = self.features(x)
x = x.view(x.size(0), -1)
x = self.classifier(x)
return x
def _initialize_weights(self):
for m in self.modules():
if isinstance(m, nn.Conv2d):
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
... | forward | identifier_name |
vgg.py | import torch.nn as nn
import math
class VGG(nn.Module):
def __init__(self, features, num_classes=1000):
super(VGG, self).__init__()
self.features = features
self.classifier = nn.Sequential(
nn.Linear(8192, 4096),
nn.ReLU(True),
nn.Dropout(),
... | else:
conv2d = nn.Conv2d(in_channels, v, kernel_size=3, padding=1)
if batch_norm:
layers += [conv2d, nn.BatchNorm2d(v), nn.ReLU(inplace=True)]
else:
layers += [conv2d, nn.ReLU(inplace=True)]
in_channels = v
return nn.Sequential(... | random_line_split | |
fs.ts | helper function for 'ls'
function readDir(dir: string, pretty: boolean, columns: boolean, numCols: number, cb: (listing: string) => void): void {
fs.readdir(path.resolve(dir), (err: Error, contents: string[]) => {
if (err || contents.length == 0) {
return cb('');
}
contents = contents.sort();
i... | extends AbstractShellCommand {
public getCommand() {
return 'mkdir';
}
public run(terminal: Shell, args: string[], cb: () => void): void {
if (args.length < 1) {
terminal.stdout("Usage: mkdir <dirname>\n");
return cb();
}
async.each(args, (item: string, next: () => void) => {
fs... | MkdirCommand | identifier_name |
fs.ts | helper function for 'ls'
function readDir(dir: string, pretty: boolean, columns: boolean, numCols: number, cb: (listing: string) => void): void {
fs.readdir(path.resolve(dir), (err: Error, contents: string[]) => {
if (err || contents.length == 0) {
return cb('');
}
contents = contents.sort();
i... |
public run(terminal: Shell, args: string[], cb: () => void): void {
if (args.length < 1) {
terminal.stdout("Usage: mkdir <dirname>\n");
return cb();
}
async.each(args, (item: string, next: () => void) => {
fs.mkdir(item, (err?: Error) => {
if (err) {
terminal.stderr(`C... | {
return 'mkdir';
} | identifier_body |
fs.ts | // helper function for 'ls'
function readDir(dir: string, pretty: boolean, columns: boolean, numCols: number, cb: (listing: string) => void): void {
fs.readdir(path.resolve(dir), (err: Error, contents: string[]) => {
if (err || contents.length == 0) {
return cb('');
}
contents = contents.sort();
... | return () => false;
}
public run(terminal: Shell, args: string[], cb: () => void): void {
var api_key: string = "j07r6fxu4dyd08r";
// For some weird reason. document.URL is undefined?
const URL = window.document.URL ? window.document.URL : location.href;
// Can't connect to Dropbox over HTTP un... | }
public getAutocompleteFilter() {
// takes no completable arguments | random_line_split |
fs.ts | helper function for 'ls'
function readDir(dir: string, pretty: boolean, columns: boolean, numCols: number, cb: (listing: string) => void): void {
fs.readdir(path.resolve(dir), (err: Error, contents: string[]) => {
if (err || contents.length == 0) {
return cb('');
}
contents = contents.sort();
i... |
async.eachSeries(args, (item: string, next: () => void) => {
fs.readFile(item, 'utf8', function (err: Error, data: string): void {
if (err) {
terminal.stderr(`Could not open file '${item}': ${err}\n`);
} else {
terminal.stdout(data);
}
next();
});
... | {
terminal.stdout("Usage: cat <file>\n");
return cb();
} | conditional_block |
test_cluster_config.py | # Copyright (c) 2013 Mirantis 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 writ... | (self, get_config, param_config):
self.assertEqual(get_config, param_config,
msg='configs are not equal: %s != %s'
% (str(get_config), str(param_config)))
def assertConfigOnNode(self, host, config, value):
conf = config.replace(' ', '')
... | assertConfigs | identifier_name |
test_cluster_config.py | # Copyright (c) 2013 Mirantis 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 writ... |
try:
for key, processes in ip_instances.items():
telnetlib.Telnet(key, '22')
for conf, value in param.CLUSTER_MAPREDUCE_CONFIG.items():
self.assertConfigOnNode(key, conf, value)
for conf, value in param.CLUS... | management_ip = instans['management_ip']
self.transfer_script_to_node(
management_ip, 'test_config/config_test_script.sh')
ip_instances[management_ip] = node_group[
'node_processes'] | conditional_block |
test_cluster_config.py | # Copyright (c) 2013 Mirantis 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 writ... |
class ClusterConfigTest(base.ITestCase):
def setUp(self):
super(ClusterConfigTest, self).setUp()
telnetlib.Telnet(self.host, self.port)
def assertConfigs(self, get_config, param_config):
self.assertEqual(get_config, param_config,
msg='configs are not equal: ... | if config in [param.NAMENODE_CONFIG, param.DATANODE_CONFIG]:
body['node_configs']['HDFS'] = config
elif config == param.GENERAL_CONFIG:
body['cluster_configs']['general'] = config
elif config == param.CLUSTER_HDFS_CONFIG:
body['cluster_configs']['HDFS'] = config
elif config == param.... | identifier_body |
test_cluster_config.py | # Copyright (c) 2013 Mirantis 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 writ... | _add_config(cluster_body, param.GENERAL_CONFIG)
_add_config(cluster_body, param.CLUSTER_HDFS_CONFIG)
_add_config(cluster_body, param.CLUSTER_MAPREDUCE_CONFIG)
cluster_id = self.create_cluster_and_get_id(cluster_body)
get_data = self.get_object(self.url_cluster... | cluster_id = None
try: | random_line_split |
new.js | import EditFormNewRoute from 'ember-flexberry/routes/edit-form-new'; | /**
* Name of model projection to be used as record's properties limitation.
*
* @property modelProjection
* @type String
* @default 'SuggestionTypeE'
*/
modelProjection: 'SuggestionTypeE',
/**
* Name of model to be used as form's record type.
*
* @property modelName
* @type String
... |
export default EditFormNewRoute.extend({ | random_line_split |
15.3.4.5-13.b-4.js | /// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyrigh... |
runTestCase(testcase);
| {
function foo() { }
var o = {};
var bf = foo.bind(o);
if (bf.length === 0) {
return true;
}
} | identifier_body |
15.3.4.5-13.b-4.js | /// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyrigh... |
}
runTestCase(testcase);
| {
return true;
} | conditional_block |
15.3.4.5-13.b-4.js | /// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyrigh... |
var bf = foo.bind(o);
if (bf.length === 0) {
return true;
}
}
runTestCase(testcase); |
function testcase() {
function foo() { }
var o = {};
| random_line_split |
15.3.4.5-13.b-4.js | /// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyrigh... | () {
function foo() { }
var o = {};
var bf = foo.bind(o);
if (bf.length === 0) {
return true;
}
}
runTestCase(testcase);
| testcase | identifier_name |
search.service.spec.ts | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | tick();
expect(reposFetcher).toHaveBeenCalledTimes(1);
const reposFetcherArgs = reposFetcher.calls.mostRecent().args as (
| object
| string
)[];
expect(reposFetcherArgs[0]).toEqual('repo');
expect(reposFetcherArgs[1]).toEqual('org');
expect(reposFetcherArgs[2])... |
const filters = [{name: 'orderby', value: 'name'}];
service.search('repo', 'org', filters).subscribe(); | random_line_split |
operator-multidispatch.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | // points can be added, and a point can be added to an integer.
use std::ops;
#[derive(Show,PartialEq,Eq)]
struct Point {
x: int,
y: int
}
impl ops::Add for Point {
type Output = Point;
fn add(self, other: Point) -> Point {
Point {x: self.x + other.x, y: self.y + other.y}
}
}
impl ops::... | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that we can overload the `+` operator for points so that two | random_line_split |
operator-multidispatch.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (self, other: int) -> Point {
Point {x: self.x + other,
y: self.y + other}
}
}
pub fn main() {
let mut p = Point {x: 10, y: 20};
p = p + Point {x: 101, y: 102};
assert_eq!(p, Point {x: 111, y: 122});
p = p + 1;
assert_eq!(p, Point {x: 112, y: 123});
}
| add | identifier_name |
operator-multidispatch.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
}
pub fn main() {
let mut p = Point {x: 10, y: 20};
p = p + Point {x: 101, y: 102};
assert_eq!(p, Point {x: 111, y: 122});
p = p + 1;
assert_eq!(p, Point {x: 112, y: 123});
}
| {
Point {x: self.x + other,
y: self.y + other}
} | identifier_body |
index.tsx | /* eslint-disable import/order */
/* eslint-disable import/first */
// import 'react-app-polyfill/ie11';
// import 'react-app-polyfill/stable';
import React from 'react';
import ReactDOM from 'react-dom';
import {defaultLocale} from './components/utils';
// TODO: need to fetch this from the backend
if (process.env.NOD... |
import moment from 'moment';
import 'moment/locale/nl';
import 'moment/locale/fr';
moment.locale(defaultLocale);
import {registerLocale, setDefaultLocale} from 'react-datepicker';
import nl from 'date-fns/locale/nl';
registerLocale(defaultLocale, nl);
setDefaultLocale(defaultLocale);
// ATTN: See util.ts for ... | {
document.title += ` - ${process.env.NODE_ENV || '???'}`;
} | conditional_block |
index.tsx | /* eslint-disable import/order */
/* eslint-disable import/first */
// import 'react-app-polyfill/ie11';
// import 'react-app-polyfill/stable';
import React from 'react'; | // TODO: need to fetch this from the backend
if (process.env.NODE_ENV !== 'production') {
document.title += ` - ${process.env.NODE_ENV || '???'}`;
}
import moment from 'moment';
import 'moment/locale/nl';
import 'moment/locale/fr';
moment.locale(defaultLocale);
import {registerLocale, setDefaultLocale} from 'r... | import ReactDOM from 'react-dom';
import {defaultLocale} from './components/utils';
| random_line_split |
battery.py | #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# ... | (self):
secondary_text = ''
status_text = '%s%%' % (self._level, )
progress_widget = self._progress_widget
if self._status == _STATUS_NOT_PRESENT:
secondary_text = _('Removed')
progress_widget = None
elif self._status == _STATUS_CHARGING:
seco... | _update_secondary | identifier_name |
battery.py | #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# ... |
elif self._status == _STATUS_CHARGING:
secondary_text = _('Charging')
elif self._status == _STATUS_DISCHARGING:
if self._level <= _WARN_MIN_PERCENTAGE:
secondary_text = _('Very little power remaining')
else:
minutes_remaining = self._t... | secondary_text = _('Removed')
progress_widget = None | conditional_block |
battery.py | #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# ... | dbus_interface=_UP_DEVICE_IFACE)
self._fetch_properties_from_upower()
def _fetch_properties_from_upower(self):
"""Get current values from UPower."""
# pylint: disable=W0201
try:
dbus_props = self._battery_props_iface.GetAll(_UP_DEV... | __gproperties__ = {
'level': (int, None, None, 0, 100, 0, gobject.PARAM_READABLE),
'time-remaining': (int, None, None, 0, sys.maxint, 0,
gobject.PARAM_READABLE), # unit: seconds
'charging': (bool, None, None, False, gobject.PARAM_READABLE),
'discharging': (boo... | identifier_body |
battery.py | #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# ... | logging.error('Cannot access battery properties')
dbus_props = {}
self._level = dbus_props.get('Percentage', 0)
self._state = dbus_props.get('State', _UP_STATE_UNKNOWN)
self._present = dbus_props.get('IsPresent', False)
self._time_to_empty = dbus_props.get('TimeT... | except dbus.DBusException: | random_line_split |
apiQueries.js | import { constants } from '../actions/apiQueries'
function apiQueryReducer (state, action) {
var key = null
var queries = null
switch (action.type) {
case constants.FETCH_API:
key = [action.path, action.params]
queries = Object.assign({}, state.queries)
queries[key] = { isFetching: true }
... | {
switch (action.type) {
case constants.FETCH_API:
case constants.RECEIVE_API:
return Object.assign({}, state, apiQueryReducer(state, action))
default:
return state
}
} | identifier_body | |
apiQueries.js | import { constants } from '../actions/apiQueries'
function | (state, action) {
var key = null
var queries = null
switch (action.type) {
case constants.FETCH_API:
key = [action.path, action.params]
queries = Object.assign({}, state.queries)
queries[key] = { isFetching: true }
return Object.assign({}, state, { queries: queries })
case constan... | apiQueryReducer | identifier_name |
apiQueries.js | import { constants } from '../actions/apiQueries'
function apiQueryReducer (state, action) {
var key = null
var queries = null
switch (action.type) {
case constants.FETCH_API:
key = [action.path, action.params]
queries = Object.assign({}, state.queries)
queries[key] = { isFetching: true }
... | case constants.FETCH_API:
case constants.RECEIVE_API:
return Object.assign({}, state, apiQueryReducer(state, action))
default:
return state
}
} | }
}
export default function apiQueries (state = { queries: [], cachedResources: {} }, action) {
switch (action.type) { | random_line_split |
test_phreg.py | .abspath(__file__))
data = np.genfromtxt(os.path.join(cur_dir, 'results', fname),
delimiter=" ")
time = data[:,0]
status = data[:,1]
entry = data[:,2]
exog = data[:,3:]
return time, status, entry, exog
# Run a single test against R outp... |
prl = (pr1, pr2, pr4)
for i in range(3):
for j in range(i):
assert_allclose(prl[i].standard_errors, prl[j].standard_errors)
def test_offset(self):
np.random.seed(34234)
time = 50 * np.random.uniform(size=200)
status = np.random.randint(0, 2, 20... | assert_allclose(prl[i].predicted_values, prl[j].predicted_values) | conditional_block |
test_phreg.py | .abspath(__file__))
data = np.genfromtxt(os.path.join(cur_dir, 'results', fname),
delimiter=" ")
time = data[:,0]
status = data[:,1]
entry = data[:,2]
exog = data[:,3:]
return time, status, entry, exog
# Run a single test against R outp... |
def test_missing(self):
np.random.seed(34234)
time = 50 * np.random.uniform(size=200)
status = np.random.randint(0, 2, 200).astype(np.float64)
exog = np.random.normal(size=(200,4))
time[0:5] = np.nan
status[5:10] = np.nan
exog[10:15,:] = np.nan
md... | cur_dir = os.path.dirname(os.path.abspath(__file__))
rdir = os.path.join(cur_dir, 'results')
fnames = os.listdir(rdir)
fnames = [x for x in fnames if x.startswith("survival")
and x.endswith(".csv")]
for fname in fnames:
for ties in "breslow","efron":
... | identifier_body |
test_phreg.py | .abspath(__file__))
data = np.genfromtxt(os.path.join(cur_dir, 'results', fname),
delimiter=" ")
time = data[:,0]
status = data[:,1]
entry = data[:,2]
exog = data[:,3:]
return time, status, entry, exog
# Run a single test against R outp... | assert_allclose(np.abs(mart_resid).sum(), 120.72475743348433)
w_avg = rslt.weighted_covariate_averages
assert_allclose(np.abs(w_avg[0]).sum(0),
np.r_[7.31008415, 9.77608674,10.89515885, 13.1106801])
bc_haz = rslt.baseline_cumulative_hazard
v = [np.mean(np.abs(x))... | mart_resid = rslt.martingale_residuals | random_line_split |
test_phreg.py | .abspath(__file__))
data = np.genfromtxt(os.path.join(cur_dir, 'results', fname),
delimiter=" ")
time = data[:,0]
status = data[:,1]
entry = data[:,2]
exog = data[:,3:]
return time, status, entry, exog
# Run a single test against R outp... | (self):
# All regression tests
np.random.seed(34234)
time = 50 * np.random.uniform(size=200)
status = np.random.randint(0, 2, 200).astype(np.float64)
exog = np.random.normal(size=(200,4))
mod = PHReg(time, exog, status)
rslt = mod.fit()
mart_resid = rslt.... | test_post_estimation | identifier_name |
alg_runner.rs | use std::collections::HashMap;
use network::{ DoubleVec, Network, NodeId };
use network::algorithms::{ dijkstra, pagerank };
use usage::{ DEFAULT_BETA, DEFAULT_EPS, DEFAULT_START_ID, Args };
#[derive(Debug, RustcDecodable)]
pub enum Algorithm { dijkstra, pagerank }
pub fn run_algorithm<N: Network>(network: &N, args:... | }
fn print_dijkstra_result(pred: &Vec<NodeId>, cost: &DoubleVec, node_to_id: &HashMap<String, NodeId>) {
let id_to_node: HashMap<NodeId, String> = node_to_id.iter()
.map(|(k,v)| (*v,k.clone()))
.collect();
for i in (0..pred.len()).take(100) {
let to_id = i as NodeId;
let from_no... | random_line_split | |
alg_runner.rs | use std::collections::HashMap;
use network::{ DoubleVec, Network, NodeId };
use network::algorithms::{ dijkstra, pagerank };
use usage::{ DEFAULT_BETA, DEFAULT_EPS, DEFAULT_START_ID, Args };
#[derive(Debug, RustcDecodable)]
pub enum | { dijkstra, pagerank }
pub fn run_algorithm<N: Network>(network: &N, args: &Args, node_to_id: &HashMap<String, NodeId>) {
match args.arg_algorithm {
Algorithm::dijkstra => run_dijkstra(network, args, node_to_id),
Algorithm::pagerank => run_pagerank(network, args, node_to_id),
}
}
fn run_dijks... | Algorithm | identifier_name |
alg_runner.rs | use std::collections::HashMap;
use network::{ DoubleVec, Network, NodeId };
use network::algorithms::{ dijkstra, pagerank };
use usage::{ DEFAULT_BETA, DEFAULT_EPS, DEFAULT_START_ID, Args };
#[derive(Debug, RustcDecodable)]
pub enum Algorithm { dijkstra, pagerank }
pub fn run_algorithm<N: Network>(network: &N, args:... |
fn print_pagerank_results(ranks: &Vec<f64>, node_to_id: &HashMap<String, NodeId>, target_node: Option<&String>) {
match target_node {
None => println!("No target node given."),
Some(name) => {
let id = node_to_id[name] as usize;
println!("Rank of node {}: {} ({:e})", name, ... | {
let id_to_node: HashMap<NodeId, String> = node_to_id.iter()
.map(|(k,v)| (*v,k.clone()))
.collect();
for i in (0..pred.len()).take(100) {
let to_id = i as NodeId;
let from_node = get_node_name(pred.get(i).unwrap(), &id_to_node);
let to_node = get_node_name(&to_id, &id_t... | identifier_body |
syntax_extension_with_dll_deps_2.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn expand_foo(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
-> Box<MacResult+'static> {
let answer = other::the_answer();
MacEager::expr(quote_expr!(cx, $answer))
} | #[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("foo", expand_foo);
} | random_line_split |
syntax_extension_with_dll_deps_2.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let answer = other::the_answer();
MacEager::expr(quote_expr!(cx, $answer))
} | identifier_body | |
syntax_extension_with_dll_deps_2.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
-> Box<MacResult+'static> {
let answer = other::the_answer();
MacEager::expr(quote_expr!(cx, $answer))
}
| expand_foo | identifier_name |
ui_ffi.rs |
// Disable this warning until all code has been fixed
#[allow(non_upper_case_globals)]
extern crate bitflags;
use std::os::raw::{c_char, c_float, c_int, c_uint, c_ushort, c_void};
use scintilla::PDUISCInterface;
include!("ui_ffi_autogen.rs");
#[repr(C)]
pub enum | {
Tab, // for tabbing through fields
LeftArrow, // for text edit
RightArrow,// for text edit
UpArrow, // for text edit
DownArrow, // for text edit
PageUp,
PageDown,
Home, // for text edit
End, // for text edit
Delete, // for text edit
Backspace, // for ... | ImguiKey | identifier_name |
ui_ffi.rs | // Disable this warning until all code has been fixed
#[allow(non_upper_case_globals)]
extern crate bitflags;
use std::os::raw::{c_char, c_float, c_int, c_uint, c_ushort, c_void};
use scintilla::PDUISCInterface;
include!("ui_ffi_autogen.rs");
#[repr(C)]
pub enum ImguiKey {
Tab, // for tabbing through fiel... | Z, // for text edit CTRL+Z: undo
} | C, // for text edit CTRL+C: copy
V, // for text edit CTRL+V: paste
X, // for text edit CTRL+X: cut
Y, // for text edit CTRL+Y: redo | random_line_split |
lib.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/. */
#![feature(append)]
#![feature(arc_unique)]
#![feature(as_unsafe_cell)]
#![feature(borrow_state)]
#![feature(box_r... | #![feature(vec_push_all)]
#![deny(unsafe_code)]
#![allow(non_snake_case)]
#![doc="The script crate contains all matters DOM."]
#![plugin(string_cache_plugin)]
#![plugin(plugins)]
#[macro_use]
extern crate log;
#[macro_use] extern crate bitflags;
extern crate core;
extern crate devtools_traits;
extern crate csspars... | #![feature(slice_chars)]
#![feature(str_utf16)]
#![feature(unicode)] | random_line_split |
lib.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/. */
#![feature(append)]
#![feature(arc_unique)]
#![feature(as_unsafe_cell)]
#![feature(borrow_state)]
#![feature(box_r... | () {
unsafe {
assert_eq!(js::jsapi::JS_Init(), 1);
}
}
| init | identifier_name |
lib.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/. */
#![feature(append)]
#![feature(arc_unique)]
#![feature(as_unsafe_cell)]
#![feature(borrow_state)]
#![feature(box_r... | {
unsafe {
assert_eq!(js::jsapi::JS_Init(), 1);
}
} | identifier_body | |
nsfw.py | import logging
import random
import urllib.parse
import collections
import aiohttp
import discord
import motor.motor_asyncio
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
class BooruError(Exception):
pass
class BooruProvider:
url = ''
@classmethod
def... |
class GelBooru(BooruProvider):
url = 'https://gelbooru.com/index.php?page=dapi&s=post&json=1&q=index'
url_post = 'https://gelbooru.com/index.php?page=post&s=view&id={0}'
@classmethod
def get_author(cls, post):
return post['owner']
class NSFW(Cog, requires=['config']):
"""NSFW commands.
... | eturn 'https:' + url.replace('.net//', '.net/')
| identifier_body |
nsfw.py | import logging
import random
import urllib.parse
import collections
import aiohttp
import discord
import motor.motor_asyncio
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
class BooruError(Exception):
pass
class BooruProvider:
url = ''
@classmethod
def... | joined = '\n'.join(data)
e.description = f'```\n{joined}\n```'
await ctx.send(embed=e)
def setup(bot):
bot.add_jose_cog(NSFW)
| = self.bot.get_user(whip['user_id'])
u = str(u)
data.append(f'{u:30s} -> {whip["whips"]}')
| conditional_block |
nsfw.py | import logging
import random
import urllib.parse
import collections
import aiohttp
import discord
import motor.motor_asyncio
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
class BooruError(Exception):
pass
class BooruProvider:
url = ''
@classmethod
def... | f'They have been whipped {whip["whips"] + 1} times.')
@commands.command()
async def whipboard(self, ctx):
"""Whip leaderboard."""
e = discord.Embed(title='Whip leaderboard')
data = []
cur = self.whip_coll.find().sort('whips',
... | await ctx.send(f'**{ctx.author}** whipped **{person}** ' | random_line_split |
nsfw.py | import logging
import random
import urllib.parse
import collections
import aiohttp
import discord
import motor.motor_asyncio
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
class BooruError(Exception):
pass
class BooruProvider:
url = ''
@classmethod
def... | elf, ctx, *tags):
"""Randomly searches Gelbooru for posts."""
async with ctx.typing():
await self.booru(ctx, GelBooru, tags)
@commands.command()
@commands.is_nsfw()
async def penis(self, ctx):
"""get penis from e621 bb"""
await ctx.invoke(self.bot.get_command('e6... | lbooru(s | identifier_name |
value-colormaker.ts | /**
* @file Value Colormaker
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @private
*/
import { ColormakerRegistry } from '../globals'
import Colormaker, { VolumeColormakerParams, ColormakerScale, manageColor } from './colormaker'
/**
* Color by volume value
*/
class ValueColormaker extends Colormake... | @manageColor
volumeColor (index: number) {
return this.valueScale((this.parameters.volume! as any).data[ index ]) // TODO
}
}
ColormakerRegistry.add('value', ValueColormaker as any)
export default ValueColormaker | /**
* return the color for a volume cell
* @param {Integer} index - volume cell index
* @return {Integer} hex cell color
*/ | random_line_split |
value-colormaker.ts | /**
* @file Value Colormaker
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @private
*/
import { ColormakerRegistry } from '../globals'
import Colormaker, { VolumeColormakerParams, ColormakerScale, manageColor } from './colormaker'
/**
* Color by volume value
*/
class ValueColormaker extends Colormake... | (index: number) {
return this.valueScale((this.parameters.volume! as any).data[ index ]) // TODO
}
}
ColormakerRegistry.add('value', ValueColormaker as any)
export default ValueColormaker
| volumeColor | identifier_name |
newsSelectors.js | /**
* Create selectors for news store
*/
import { createSelector } from 'reselect';
import { isAuthenticatedSelector } from './userSelectors';
import { userBrandsSelector } from './brandSelectors';
const newsStateSelector = state => state.news;
export const newsSelector = createSelector(
newsStateSelector,
use... | );
export const newsErrorSelector = createSelector(
newsStateSelector,
newsState => newsState.error
); | );
export const isFetchingOwnNewsSelector = createSelector(
newsStateSelector,
newsState => newsState.isFetchingOwnNews | random_line_split |
newsSelectors.js | /**
* Create selectors for news store
*/
import { createSelector } from 'reselect';
import { isAuthenticatedSelector } from './userSelectors';
import { userBrandsSelector } from './brandSelectors';
const newsStateSelector = state => state.news;
export const newsSelector = createSelector(
newsStateSelector,
use... |
}
return true;
});
} else {
return newsState.news;
}
}
);
export const isFetchingAllNewsSelector = createSelector(
newsStateSelector,
newsState => newsState.isFetchingAllNews
);
export const isFetchingOwnNewsSelector = createSelector(
newsStateSelector,
newsState => news... | {
return false;
} | conditional_block |
ScheduleRow.tsx | import React from 'react';
import { Schedule } from '@/api/server/schedules/getServerSchedules';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCalendarAlt } from '@fortawesome/free-solid-svg-icons';
import { format } from 'date-fns';
import tw from 'twin.macro';
import ScheduleCronRow fro... | </p>
</div>
</>
); | random_line_split | |
sunat_3_7.py | # -*- encoding: utf-8 -*- | #
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongl... | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 NUMA Extreme Systems (www.numaes.com) for Cubic ERP - Teradata SAC. (http://cubicerp.com). | random_line_split |
sunat_3_7.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 NUMA Extreme Systems (www.numaes.com) for Cubic ERP - Teradata SAC. (http://cubicerp.com).
#
# WARNING: This program as such is intended to be use... | (self, cr, uid, name, context=None):
super(sunat_3_7_report, self).__init__(cr, uid, name, context)
self.localcontext.update( {
'time': time,
})
self.context = context
report_sxw.report_sxw('report.l10n_pe.sunat_3_7', 'l10n_pe.ple_3_7',
'addons/l10n_pe_ple03/report/sunat... | __init__ | identifier_name |
sunat_3_7.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 NUMA Extreme Systems (www.numaes.com) for Cubic ERP - Teradata SAC. (http://cubicerp.com).
#
# WARNING: This program as such is intended to be use... |
report_sxw.report_sxw('report.l10n_pe.sunat_3_7', 'l10n_pe.ple_3_7',
'addons/l10n_pe_ple03/report/sunat_3_7.rml', parser=sunat_3_7_report, header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| def __init__(self, cr, uid, name, context=None):
super(sunat_3_7_report, self).__init__(cr, uid, name, context)
self.localcontext.update( {
'time': time,
})
self.context = context | identifier_body |
pcvilag-dl.py | #!/usr/bin/env python
# coding: utf-8
"""
pcvilag.muskatli.hu downloader
Copyright (C) 2015 Gyulai Gergő
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
(at yo... | get_pics(piclinks, HOME+NAME, BOOK, s)
convertToPDF(HOME+NAME, NAME, BOOK, s)
print "Downloaded and converted files are here: "+HOME+NAME
#############################################################################
if __name__=="__main__":
main()
| heck_root()
url = raw_input("Enter URL:\n")
while(not check_url(url)):
print "It's not a valid url"
url = raw_input("Enter a valid URL:\n")
s = url.split("/")
if s[4]=='cbooks':
NAME = "books"+BS+s[5]+BS
BOOK = True
else:
BOOK = False
NAME = "mags... | identifier_body |
pcvilag-dl.py | #!/usr/bin/env python
# coding: utf-8
"""
pcvilag.muskatli.hu downloader
Copyright (C) 2015 Gyulai Gergő
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
(at yo... | path,u_name, book, full):
print "Converting pictures to one PDF...",
if book:
os.system("convert -limit thread 1 "+path+"src"+BS+"%d.jpg[1-"+str(PICS)+"] "+path+u_name.split(BS)[1]+".pdf")
else:
path = path+full[5]+BS
os.system("convert -limit thread 1 "+path+full[6]+BS+"src"+BS+"%d... | onvertToPDF( | identifier_name |
pcvilag-dl.py | #!/usr/bin/env python
# coding: utf-8
"""
pcvilag.muskatli.hu downloader
Copyright (C) 2015 Gyulai Gergő
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
(at yo... | os.system("convert -limit thread 1 "+path+full[6]+BS+"src"+BS+"%d.jpg[1-"+str(PICS)+"] "+path+u_name.split(BS)[1]+"-"+full[6]+".pdf")
print "DONE"
#MAIN
def main():
check_root()
url = raw_input("Enter URL:\n")
while(not check_url(url)):
print "It's not a valid url"
url = raw_... | random_line_split | |
pcvilag-dl.py | #!/usr/bin/env python
# coding: utf-8
"""
pcvilag.muskatli.hu downloader
Copyright (C) 2015 Gyulai Gergő
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
(at yo... | else:
print "Making folder: \""+u_name.split(BS)[1]+"\" in mags...",
if not os.path.exists(HOME+u_name):
os.mkdir(HOME+u_name, 0755)
if os.path.exists(HOME+u_name) and not os.path.exists(HOME+u_name+full[5]):
os.mkdir(HOME+u_name+full[5], 0755)
if os.... | rint "Making folder: \""+u_name.split(BS)[1]+"\" in books...",
if not os.path.exists(HOME+u_name):
os.mkdir(HOME+u_name, 0755)
if os.path.exists(HOME+u_name) and not os.path.exists(HOME+u_name+BS+"src"+BS):
os.mkdir(HOME+u_name+BS+"src"+BS, 0755)
| conditional_block |
countdown.js | /*! UIkit 3.5.15 | https://www.getuikit.com | (c) 2014 - 2020 YOOtheme | MIT License */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
typeof define === 'function' && define.amd ? define('uikitcountdown', ['uikit-ut... | (date) {
var total = date - Date.now();
return {
total: total,
seconds: total / 1000 % 60,
minutes: total / 1000 / 60 % 60,
hours: total / 1000 / 60 / 60 % 24,
days: total / 1000 / 60 / 60 / 24
};
}
if (typeof window !== 'und... | getTimeSpan | identifier_name |
countdown.js | /*! UIkit 3.5.15 | https://www.getuikit.com | (c) 2014 - 2020 YOOtheme | MIT License */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
typeof define === 'function' && define.amd ? define('uikitcountdown', ['uikit-ut... |
}
}
],
update: {
write: function() {
var this$1 = this;
var timespan = getTimeSpan(this.date);
if (timespan.total <= 0) {
this.stop();
timespan.days
... | {
this.start();
} | conditional_block |
countdown.js | /*! UIkit 3.5.15 | https://www.getuikit.com | (c) 2014 - 2020 YOOtheme | MIT License */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
typeof define === 'function' && define.amd ? define('uikitcountdown', ['uikit-ut... |
if (typeof window !== 'undefined' && window.UIkit) {
window.UIkit.component('countdown', Component);
}
return Component;
})));
| {
var total = date - Date.now();
return {
total: total,
seconds: total / 1000 % 60,
minutes: total / 1000 / 60 % 60,
hours: total / 1000 / 60 / 60 % 24,
days: total / 1000 / 60 / 60 / 24
};
} | identifier_body |
countdown.js | /*! UIkit 3.5.15 | https://www.getuikit.com | (c) 2014 - 2020 YOOtheme | MIT License */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
typeof define === 'function' && define.amd ? define('uikitcountdown', ['uikit-ut... | },
units: function() {
var this$1 = this;
return ['days', 'hours', 'minutes', 'seconds'].filter(function (unit) { return this$1[unit]; });
}
},
connected: function() {
this.start();
},
disconnected: func... | var clsWrapper = ref.clsWrapper;
return uikitUtil.$(clsWrapper.replace('%unit%', 'seconds'), $el); | random_line_split |
SystemGroups.js | import React from 'react';
//
import {Basic} from 'czechidm-core';
import {SystemGroupManager} from '../../redux';
import SystemGroupTable from './SystemGroupTable';
/**
* Table of system groups.
*
* @author Vít Švanda
* @since 11.2.0
*
*/
export default class SystemGroups extends Basic.AbstractContent {
cons... | getNavigationKey() {
return 'system-groups';
}
render() {
return (
<div>
{this.renderPageHeader()}
<Basic.Panel>
<SystemGroupTable uiKey="system-groups-table" manager={this.manager}/>
</Basic.Panel>
</div>
);
}
}
SystemGroups.propTypes = {
};
SystemG... | return 'acc:content.systemGroup';
}
| identifier_body |
SystemGroups.js | import React from 'react';
//
import {Basic} from 'czechidm-core';
import {SystemGroupManager} from '../../redux';
import SystemGroupTable from './SystemGroupTable';
/**
* Table of system groups.
*
* @author Vít Švanda
* @since 11.2.0
*
*/
export default class SystemGroups extends Basic.AbstractContent {
cons... | {
return 'system-groups';
}
render() {
return (
<div>
{this.renderPageHeader()}
<Basic.Panel>
<SystemGroupTable uiKey="system-groups-table" manager={this.manager}/>
</Basic.Panel>
</div>
);
}
}
SystemGroups.propTypes = {
};
SystemGroups.defaultProps =... | tNavigationKey() | identifier_name |
SystemGroups.js | import React from 'react';
//
import {Basic} from 'czechidm-core';
import {SystemGroupManager} from '../../redux';
import SystemGroupTable from './SystemGroupTable';
/**
* Table of system groups.
*
* @author Vít Švanda
* @since 11.2.0
*
*/
export default class SystemGroups extends Basic.AbstractContent {
cons... | render() {
return (
<div>
{this.renderPageHeader()}
<Basic.Panel>
<SystemGroupTable uiKey="system-groups-table" manager={this.manager}/>
</Basic.Panel>
</div>
);
}
}
SystemGroups.propTypes = {
};
SystemGroups.defaultProps = {
}; | }
| random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.