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 |
|---|---|---|---|---|
all_c.js | compileUnit']]],
['numaddchild',['numAddChild',['../dwarfDbgGetDbgInfo_8c.html#a6620daa01bc49c37e1850f9101cd240b',1,'dwarfDbgGetDbgInfo.c']]],
['numaddsibling',['numAddSibling',['../dwarfDbgGetDbgInfo_8c.html#a5f08554c0dc92b8611b48e024e84c7d5',1,'dwarfDbgGetDbgInfo.c']]],
['numattr',['numAttr',['../structdieInfo.... | ['numsubprograminfo',['numSubProgramInfo',['../structcompileUnit.html#a61551a73c12d2c6a7e2bd35037940a21',1,'compileUnit']]],
['numtypestr',['numTypeStr',['../structdwarfDbgTypeInfo.html#a954ab297265cb3b7e36f3ce5d74367c9',1,'dwarfDbgTypeInfo']]],
['numvariableinfo',['numVariableInfo',['../structsubProgramInfo.html... | random_line_split | |
pipeline.py | _kids', vk16_ptr, vk16_len)
self.meta.put(self.txn, 'name', ujson.dumps(self.result_table._name))
self.meta.put(self.txn, 'fields', ujson.dumps(self.result_table._fields))
self.meta.put(self.txn, 'partition', ujson.dumps(self.result_table._partition))
for index, (subdb, s... | (self,
master,
wheres,
project=(),
order_by=(),
join=(),
distinct=False,
desc=False,
limit=0,
partition=0,
nest=False,
pre_order_stag... | __init__ | identifier_name |
pipeline.py | = [repeat(index, blen)] if gen_where_index else []
row_iter = prefix_gen + [otab.mget(col, bitmap) if col is not None else repeat(None, blen)
for col in key_names[index]]
for row in izip(*row_iter):
yield row, empty
finally:
if... | # print "JOIN: %s %s %s" % (newrecord, first_record, record)
interface.output(newlabel).add(newrecord, value)
| random_line_split | |
pipeline.py | for c in project])
group_by_stage = []
if any(efs):
# If all columns in project are aggregations, use process_skip_group
# to skip the internal groupby
if all([isinstance(c, Aggregation) for c in project]):
process_group_fn = process_skip_group
... | sort_range = [i + select_offset for i, c in enumerate(select_columns) if isinstance(c, Column) and not c.is_binary]
if order_by_columns:
scols = ["%s%s" % (c.table._name if c.table else '', c.name) for c in select_columns]
ocols = ["%s%s" % (c.table._name if c.table else '', c.name) for c in order_b... | identifier_body | |
pipeline.py | self.order_by = self._resolve(order_by, project)
partition = partition or _NPART
binaries = [i for i, c in enumerate(project) if isinstance(c, (Column, Aggregation)) and c.is_binary]
# if nest is true, use output_schema to store the output table
self.output_table = None
... | try:
accums = [f(a, v) if f and a is not None else None
for f, a, v in zip(ffuncs, accums, record)]
except Exception as e:
raise e | conditional_block | |
files_b.js | var searchData=
[
['phy_2ed',['phy.d',['../phy_8d.html',1,'']]],
['phy_5fksz8051mll_2ed',['phy_ksz8051mll.d',['../phy__ksz8051mll_8d.html',1,'']]],
['pwr_2ec',['pwr.c',['../pwr_8c.html',1,'']]],
['pwr_2eh',['pwr.h',['../pwr_8h.html',1,'']]],
['pwr_5fcommon_5fall_2ec',['pwr_common_all.c',['../pwr__common__all_... | ['pwr_5fcommon_5fall_2ed',['pwr_common_all.d',['../pwr__common__all_8d.html',1,'']]],
['pwr_5fcommon_5fall_2eh',['pwr_common_all.h',['../pwr__common__all_8h.html',1,'']]]
]; | random_line_split | |
setup.py | # -*- coding: utf-8 -*-
"""
EVODjango Django extensions for development aid
===============================================
.. module:: pyevo
:platform: Unix, Windows
:synopsis: EVODjango Django extensions for development aid
.. moduleauthor:: (C) 2013 Oliver Gutiérrez
""" | README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='evodjango',
packages = find_packages(),
version='0.1',
description='EVODjango Django extension... | # Python imports
import os
from setuptools import setup, find_packages
| random_line_split |
rfc7894.py | #
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
# Alternative Challenge Password Attributes for EST
#
# ASN.1 source from:
# https://www.rfc-editor.org/rfc/rfc7894.txt
#
from pyasn1.type impo... | (univ.Choice):
pass
DirectoryString.componentType = namedtype.NamedTypes(
namedtype.NamedType('teletexString', char.TeletexString().subtype(
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
namedtype.NamedType('printableString', char.PrintableString().subtype(
subtypeSpec=constraint.Va... | DirectoryString | identifier_name |
rfc7894.py | #
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
# Alternative Challenge Password Attributes for EST
#
# ASN.1 source from:
# https://www.rfc-editor.org/rfc/rfc7894.txt
#
from pyasn1.type impo... |
DirectoryString.componentType = namedtype.NamedTypes(
namedtype.NamedType('teletexString', char.TeletexString().subtype(
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
namedtype.NamedType('printableString', char.PrintableString().subtype(
subtypeSpec=constraint.ValueSizeConstraint(1, 25... | pass | identifier_body |
rfc7894.py | #
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
# Alternative Challenge Password Attributes for EST
#
# ASN.1 source from:
# https://www.rfc-editor.org/rfc/rfc7894.txt
#
from pyasn1.type impo... |
# SingleAttribute is the same as Attribute in RFC 5652, except that the
# attrValues SET must have one and only one member
Attribute = rfc7191.SingleAttribute
# DirectoryString is the same as RFC 5280, except the length is limited to 255
class DirectoryString(univ.Choice):
pass
DirectoryString.componentType =... | from pyasn1_modules import rfc6402
from pyasn1_modules import rfc7191
| random_line_split |
hello.rs | use std::ops::Add;
fn main() {
println!("hello, world");
println!("> Primitives");
primitives();
println!("> Tuples");
tuples();
println!("> Arrays");
arrays();
println!("> Structs");
structs();
println!("> References");
references();
println!("> Enums");
enums();
}
... |
fn tuples() {
fn reverse(pair: (i32, i32)) -> (i32, i32) {
let (x, y) = pair;
(y, x)
}
let pair = (3, 2);
let reversed = reverse(pair);
println!("reversed: ({}, {})", reversed.0, reversed.1);
}
fn arrays() {
fn sum(slice: &[i32]) -> i32 {
let mut total = 0;
for... | {
// List of Rust primitive types
// https://doc.rust-lang.org/book/primitive-types.html
println!("1 + 2 = {}", 1 + 2);
println!("1 - 2 = {}", 1 - 2);
println!("true and true = {}", true && true);
let x: char = 'x';
println!("x = {}", x);
let y: f32 = 3.14;
println!("y = {}", y);
} | identifier_body |
hello.rs | use std::ops::Add;
fn main() {
println!("hello, world");
println!("> Primitives");
primitives();
println!("> Tuples");
tuples();
println!("> Arrays");
arrays();
println!("> Structs");
structs();
println!("> References");
references();
println!("> Enums");
enums();
}
... | () {
// standard enum.
enum Color {
RED,
GREEN,
BLACK,
};
fn categorize_color(c: Color) {
match c {
Color::RED => println!("color is red!"),
Color::GREEN => println!("color is green!"),
_ => println!("Unknown color."),
}
}
... | enums | identifier_name |
hello.rs | use std::ops::Add;
fn main() {
println!("hello, world");
println!("> Primitives");
primitives();
println!("> Tuples");
tuples();
println!("> Arrays");
arrays();
println!("> Structs");
structs();
println!("> References");
references();
println!("> Enums");
enums();
}
... | enum Option {
None,
Some(i32),
}
fn app(o: Option, function: fn(i32) -> i32) -> Option {
match o {
Option::None => Option::None,
Option::Some(x) => Option::Some(function(x)),
}
}
fn add_one(x: i32) -> i32 {
x + 1
}
fn print_valu... | categorize_color(Color::BLACK);
// pattern matching enum. | random_line_split |
create_bidder_mutation.ts | import { GraphQLNonNull, GraphQLString } from "graphql"
import { mutationWithClientMutationId } from "graphql-relay"
import Bidder from "schema/v2/bidder"
import { ResolverContext } from "types/graphql"
export default mutationWithClientMutationId<any, any, ResolverContext>({
name: "CreateBidder",
description: "Cre... |
return createBidderLoader({ sale_id })
},
})
| {
return new Error("You need to be signed in to perform this action")
} | conditional_block |
create_bidder_mutation.ts | import { GraphQLNonNull, GraphQLString } from "graphql"
import { mutationWithClientMutationId } from "graphql-relay"
import Bidder from "schema/v2/bidder"
import { ResolverContext } from "types/graphql"
export default mutationWithClientMutationId<any, any, ResolverContext>({
name: "CreateBidder",
description: "Cre... | mutateAndGetPayload: ({ saleID: sale_id }, { createBidderLoader }) => {
if (!createBidderLoader) {
return new Error("You need to be signed in to perform this action")
}
return createBidderLoader({ sale_id })
},
}) | },
}, | random_line_split |
models.py | import (
CASCADE_AND_AUTOUPDATE,
SET_NULL_AND_AUTOUPDATE,
RESTModelMixin,
)
from .access_permissions import (
GroupAccessPermissions,
PersonalNoteAccessPermissions,
UserAccessPermissions,
)
class UserManager(BaseUserManager):
"""
Customized manager that creates new users only with a p... | (self):
# Strip white spaces from the name parts
first_name = self.first_name.strip()
last_name = self.last_name.strip()
# The user has a last_name and a first_name
if first_name and last_name:
name = " ".join((self.first_name, self.last_name))
# The user has... | __str__ | identifier_name |
models.py | .models import (
CASCADE_AND_AUTOUPDATE,
SET_NULL_AND_AUTOUPDATE,
RESTModelMixin,
)
from .access_permissions import (
GroupAccessPermissions,
PersonalNoteAccessPermissions,
UserAccessPermissions,
)
class UserManager(BaseUserManager):
"""
Customized manager that creates new users only w... |
else:
counter = 0
while True:
counter += 1
test_name = f"{base_name} {counter}"
if not self.filter(username=test_name).exists():
generated_username = test_name
break
return generated_usernam... | generated_username = base_name | conditional_block |
models.py | import (
CASCADE_AND_AUTOUPDATE,
SET_NULL_AND_AUTOUPDATE,
RESTModelMixin,
)
from .access_permissions import (
GroupAccessPermissions,
PersonalNoteAccessPermissions,
UserAccessPermissions,
)
class UserManager(BaseUserManager):
"""
Customized manager that creates new users only with a p... |
email = models.EmailField(blank=True)
last_email_send = models.DateTimeField(blank=True, null=True)
# TODO: Try to remove the default argument in the following fields.
structure_level = models.CharField(max_length=255, blank=True, default="")
title = models.CharField(max_length=50, blank=True, ... | """
Model for users in OpenSlides. A client can login as an user with
credentials. An user can also just be used as representation for a person
in other OpenSlides apps like motion submitter or (assignment) election
candidates.
"""
access_permissions = UserAccessPermissions()
USERNAME_FIEL... | identifier_body |
models.py | admin'. The user
becomes member of the group 'Admin'.
"""
created = False
try:
admin = self.get(username="admin")
except ObjectDoesNotExist:
admin = self.model(username="admin", last_name="Administrator")
created = True
admin.default_pa... |
user = models.OneToOneField(User, on_delete=CASCADE_AND_AUTOUPDATE)
notes = JSONField() | random_line_split | |
homework.js | /**
* @file homework.js
* @author Vladimir Deminenko
* @date 11.07.2017
*/
'use strict';
function Calculator() {
let a = 0;
let b = 0;
this.read = () => {
a = +prompt('first number:', '0');
b = +prompt('second number:', '0');
};
this.sum = () => {
return a + b;
};... | }
| {
if (typeof this === 'undefined') {
throw new TypeError('Cannot call a class as a function');
}
let step = 0;
this.up = () => {
step++;
return this;
};
this.down = () => {
step--;
return this;
};
this.showStep = () => step; | identifier_body |
homework.js | /**
* @file homework.js
* @author Vladimir Deminenko
* @date 11.07.2017
*/
'use strict';
function Calculator() {
let a = 0;
let b = 0;
this.read = () => {
a = +prompt('first number:', '0');
b = +prompt('second number:', '0');
};
this.sum = () => {
return a + b;
};... | () {
const methods = {
'+': (a, b) => a + b,
'-': (a, b) => a - b
};
this.calculate = (str) => {
let method = getSmartCalculatorMethod(str, methods);
if (method) {
return methods[method.op](method.arg1, method.arg2);
}
throw new TypeError('calcu... | ExtendableCalculator | identifier_name |
homework.js | /**
* @file homework.js
* @author Vladimir Deminenko
* @date 11.07.2017
*/
'use strict';
function Calculator() {
let a = 0;
let b = 0;
this.read = () => {
a = +prompt('first number:', '0');
b = +prompt('second number:', '0');
};
this.sum = () => {
return a + b;
};... | throw new TypeError('calculate error');
};
this.addMethod = (methodName = null, func = null) => {
if (!methodName
|| typeof methodName !== 'string'
|| !func
|| typeof func !== 'function') {
throw new TypeError('addMethod() error');
}
... | return methods[method.op](method.arg1, method.arg2);
}
| random_line_split |
homework.js | /**
* @file homework.js
* @author Vladimir Deminenko
* @date 11.07.2017
*/
'use strict';
function Calculator() {
let a = 0;
let b = 0;
this.read = () => {
a = +prompt('first number:', '0');
b = +prompt('second number:', '0');
};
this.sum = () => {
return a + b;
};... |
return {arg1, arg2, op};
}
function ExtendableCalculator() {
const methods = {
'+': (a, b) => a + b,
'-': (a, b) => a - b
};
this.calculate = (str) => {
let method = getSmartCalculatorMethod(str, methods);
if (method) {
return methods[method.op](method.ar... | {
return null;
} | conditional_block |
embed.js | // NOTE: this file should only be included when embedding the inspector - no other files should be included (this will do everything)
// If gliEmbedDebug == true, split files will be used, otherwise the cat'ed scripts will be inserted
(function() {
var pathRoot = "";
var useDebug = window["gliEmbedDebug"];
... |
;
function insertStylesheet(url) {
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = url;
insertHeaderNode(link);
return link;
}
;
function insertScript(url) {
var script = document.createElement("script");
scri... | {
var targets = [ document.body, document.head, document.documentElement ];
for (var n = 0; n < targets.length; n++) {
var target = targets[n];
if (target) {
if (target.firstElementChild) {
target.insertBefore(node, target.firstElementChild);
... | identifier_body |
embed.js | // NOTE: this file should only be included when embedding the inspector - no other files should be included (this will do everything)
// If gliEmbedDebug == true, split files will be used, otherwise the cat'ed scripts will be inserted
(function() {
var pathRoot = "";
var useDebug = window["gliEmbedDebug"];
... | () {
gliloader.pathRoot = pathRoot;
if (useDebug) {
// In debug mode load all the scripts
gliloader.load([ "host", "replay", "ui" ]);
}
}
;
script.onreadystatechange = function() {
if (("loaded" === script.readyState... | scriptLoaded | identifier_name |
embed.js | // NOTE: this file should only be included when embedding the inspector - no other files should be included (this will do everything)
// If gliEmbedDebug == true, split files will be used, otherwise the cat'ed scripts will be inserted
(function() {
var pathRoot = "";
var useDebug = window["gliEmbedDebug"];
... | var contextNames = [ "moz-webgl", "webkit-3d", "experimental-webgl", "webgl" ];
var requestingWebGL = contextNames.indexOf(arguments[0]) != -1;
if (requestingWebGL) {
// Page is requesting a WebGL context!
// TODO: something
}
var result = originalGetCon... | var ignoreCanvas = this.internalInspectorSurface;
if (ignoreCanvas) {
return originalGetContext.apply(this, arguments);
}
| random_line_split |
embed.js | // NOTE: this file should only be included when embedding the inspector - no other files should be included (this will do everything)
// If gliEmbedDebug == true, split files will be used, otherwise the cat'ed scripts will be inserted
(function() {
var pathRoot = "";
var useDebug = window["gliEmbedDebug"];
... |
var result = originalGetContext.apply(this, arguments);
if (result == null) {
return null;
}
if (requestingWebGL) {
// TODO: pull options from somewhere?
result = gli.host.inspectContext(this, result);
var hostUI = new gli.host.HostUI(re... | {
// Page is requesting a WebGL context!
// TODO: something
} | conditional_block |
actions.ts | import { ThunkResult } from '../../../types';
import { getNewVariabelIndex, getVariable, getVariables } from '../state/selectors';
import {
changeVariableNameFailed,
changeVariableNameSucceeded,
clearIdInEditor,
setIdInEditor,
variableEditorMounted,
variableEditorUnMounted,
} from './reducer';
import { vari... |
const variables = getVariables(getState());
const foundVariables = variables.filter(v => v.name === newName && v.id !== identifier.id);
if (foundVariables.length) {
errorText = 'Variable with the same name already exists';
}
if (errorText) {
dispatch(changeVariableNameFailed({ newNam... | {
errorText = 'Only word and digit characters are allowed in variable names';
} | conditional_block |
actions.ts | import { ThunkResult } from '../../../types';
import { getNewVariabelIndex, getVariable, getVariables } from '../state/selectors';
import {
changeVariableNameFailed,
changeVariableNameSucceeded,
clearIdInEditor,
setIdInEditor,
variableEditorMounted,
variableEditorUnMounted,
} from './reducer';
import { vari... | errorText = 'Only word and digit characters are allowed in variable names';
}
const variables = getVariables(getState());
const foundVariables = variables.filter(v => v.name === newName && v.id !== identifier.id);
if (foundVariables.length) {
errorText = 'Variable with the same name alread... | errorText = "Template names cannot begin with '__', that's reserved for Grafana's global variables";
}
if (!newName.match(/^\w+$/)) { | random_line_split |
regexify.py | from re import compile
# ----------------- Local variables ----------------- #
__reCompiles = []
# ----------------- Global methods ----------------- #
def compileTitleRe():
"""Generates and compiles regex patterns"""
rePats = [
r'[\{\(\[].*?[\)\]\}/\\]',
r'^.*?\(',
r'[\)\]\}\-\'\"... | (title):
"""Applies regular expression methods and trims whitespace to the specified
format
title: the string to be regexified
"""
return __reCompiles[3].sub( # replace multiple \s with one \s
' ', __reCompiles[2].sub( # replace excess punctuations with one \s
'', __reCompile... | regexify | identifier_name |
regexify.py | from re import compile
# ----------------- Local variables ----------------- #
__reCompiles = []
# ----------------- Global methods ----------------- #
def compileTitleRe():
|
def regexify(title):
"""Applies regular expression methods and trims whitespace to the specified
format
title: the string to be regexified
"""
return __reCompiles[3].sub( # replace multiple \s with one \s
' ', __reCompiles[2].sub( # replace excess punctuations with one \s
... | """Generates and compiles regex patterns"""
rePats = [
r'[\{\(\[].*?[\)\]\}/\\]',
r'^.*?\(',
r'[\)\]\}\-\'\"\,:]',
r'\s+'
]
__reCompiles.extend([compile(pat) for pat in rePats]) | identifier_body |
regexify.py | from re import compile
# ----------------- Local variables ----------------- #
__reCompiles = []
# ----------------- Global methods ----------------- #
def compileTitleRe():
"""Generates and compiles regex patterns""" | r'[\)\]\}\-\'\"\,:]',
r'\s+'
]
__reCompiles.extend([compile(pat) for pat in rePats])
def regexify(title):
"""Applies regular expression methods and trims whitespace to the specified
format
title: the string to be regexified
"""
return __reCompiles[3].sub( # replace mult... |
rePats = [
r'[\{\(\[].*?[\)\]\}/\\]',
r'^.*?\(', | random_line_split |
9_billion_names_of_god_the_integer.rs | // http://rosettacode.org/wiki/9_billion_names_of_God_the_integer
extern crate num;
use std::cmp::min;
use num::{BigUint, Zero, One};
pub struct Solver {
// The `cache` is a private implementation detail,
// it would be an improvement to throw away unused values
// from the cache (to reduce memory for la... |
}
#[cfg(not(test))]
fn main() {
let mut solver = Solver::new();
println!("rows");
for n in 1..11 {
println!("{}: {}", n, solver.row_string(n));
}
println!("sums");
for &y in &[23, 123, 1234, 12345] {
println!("{}: {}", y, solver.row_sum(y));
}
}
#[cfg(test)]
mod test {
... | {
for l in self.cache.len()..idx + 1 {
let mut r : Vec<BigUint> = vec![Zero::zero()];
for x in 1..l + 1 {
let w = {
let y = &r[x-1];
let z = &self.cache[l-x][min(x, l-x)];
y + z
};
... | identifier_body |
9_billion_names_of_god_the_integer.rs | // http://rosettacode.org/wiki/9_billion_names_of_God_the_integer
extern crate num;
use std::cmp::min;
use num::{BigUint, Zero, One};
pub struct Solver {
// The `cache` is a private implementation detail,
// it would be an improvement to throw away unused values
// from the cache (to reduce memory for la... | use num::BigUint;
#[test]
fn test_cumulative() {
let mut solver = Solver::new();
let mut t = |n: usize, expected: &str| {
assert_eq!(solver.row_sum(n), &expected.parse::<BigUint>().unwrap());
};
t(23, "1255");
t(123, "2552338241");
t(1234, "15697... | #[cfg(test)]
mod test {
use super::Solver; | random_line_split |
9_billion_names_of_god_the_integer.rs | // http://rosettacode.org/wiki/9_billion_names_of_God_the_integer
extern crate num;
use std::cmp::min;
use num::{BigUint, Zero, One};
pub struct Solver {
// The `cache` is a private implementation detail,
// it would be an improvement to throw away unused values
// from the cache (to reduce memory for la... | (&mut self, idx: usize) -> &[BigUint] {
for l in self.cache.len()..idx + 1 {
let mut r : Vec<BigUint> = vec![Zero::zero()];
for x in 1..l + 1 {
let w = {
let y = &r[x-1];
let z = &self.cache[l-x][min(x, l-x)];
y... | cumulative | identifier_name |
GamesModule.tsx | import { css, StyleSheet } from 'aphrodite';
import { margin } from 'css-verbose';
import * as React from 'react';
import { VitrineComponent } from '../../features/VitrineComponent';
import * as lessVars from 'less-vars-loader?camelCase&resolveVariables!../../../resources/less/theme/globals/site.variables';
interfac... | extends VitrineComponent<Props, any> {
public constructor(props: Props) {
super(props);
this.state = {
clicked: this.props.clicked
};
}
private imageClick = () => {
this.setState(
{
clicked: !this.state.clicked
},
() => {
this.props.clickHandler(this.stat... | GamesModule | identifier_name |
GamesModule.tsx | import { css, StyleSheet } from 'aphrodite';
import { margin } from 'css-verbose';
import * as React from 'react';
import { VitrineComponent } from '../../features/VitrineComponent';
import * as lessVars from 'less-vars-loader?camelCase&resolveVariables!../../../resources/less/theme/globals/site.variables';
interfac... | margin: (15).px(),
opacity: 0.05,
transition: `${320}ms ease`,
width: (150).px()
},
iconWrapper: {
margin: margin(0, 'auto'),
width: (85).percents()
}
}); | random_line_split | |
GamesModule.tsx | import { css, StyleSheet } from 'aphrodite';
import { margin } from 'css-verbose';
import * as React from 'react';
import { VitrineComponent } from '../../features/VitrineComponent';
import * as lessVars from 'less-vars-loader?camelCase&resolveVariables!../../../resources/less/theme/globals/site.variables';
interfac... |
private imageClick = () => {
this.setState(
{
clicked: !this.state.clicked
},
() => {
this.props.clickHandler(this.state.clicked);
}
);
};
public render(): JSX.Element {
return (
<div className={css(styles.iconWrapper)}>
<img
alt={this... | {
super(props);
this.state = {
clicked: this.props.clicked
};
} | identifier_body |
find_item.py | from ..errors import InvalidEnumValue
from ..folders.base import BaseFolder
from ..items import ID_ONLY, ITEM_TRAVERSAL_CHOICES, SHAPE_CHOICES, Item
from ..util import MNS, TNS, create_element, set_xml_value
from .common import EWSPagingService, folder_ids_element, shape_element
class FindItem(EWSPagingService):
... |
def get_payload(
self,
folders,
additional_fields,
restriction,
order_fields,
query_string,
shape,
depth,
calendar_view,
page_size,
offset=0,
):
payload = create_element(f"m:{self.SERVICE_NAME}", attrs=dict(Travers... | if self.shape == ID_ONLY and self.additional_fields is None:
return Item.id_from_xml(elem)
return BaseFolder.item_model_from_tag(elem.tag).from_xml(elem=elem, account=self.account) | identifier_body |
find_item.py | from ..errors import InvalidEnumValue
from ..folders.base import BaseFolder
from ..items import ID_ONLY, ITEM_TRAVERSAL_CHOICES, SHAPE_CHOICES, Item
from ..util import MNS, TNS, create_element, set_xml_value
from .common import EWSPagingService, folder_ids_element, shape_element
class FindItem(EWSPagingService):
... |
return payload
| payload.append(query_string.to_xml(version=self.account.version)) | conditional_block |
find_item.py | from ..errors import InvalidEnumValue
from ..folders.base import BaseFolder
from ..items import ID_ONLY, ITEM_TRAVERSAL_CHOICES, SHAPE_CHOICES, Item
from ..util import MNS, TNS, create_element, set_xml_value
from .common import EWSPagingService, folder_ids_element, shape_element
class FindItem(EWSPagingService):
... | order_fields,
shape,
query_string,
depth,
calendar_view,
max_items,
offset,
):
"""Find items in an account.
:param folders: the folders to act on
:param additional_fields: the extra fields that should be returned with the item, as Fiel... | def call(
self,
folders,
additional_fields,
restriction, | random_line_split |
find_item.py | from ..errors import InvalidEnumValue
from ..folders.base import BaseFolder
from ..items import ID_ONLY, ITEM_TRAVERSAL_CHOICES, SHAPE_CHOICES, Item
from ..util import MNS, TNS, create_element, set_xml_value
from .common import EWSPagingService, folder_ids_element, shape_element
class FindItem(EWSPagingService):
... | (self, *args, **kwargs):
super().__init__(*args, **kwargs)
# A hack to communicate parsing args to _elems_to_objs()
self.additional_fields = None
self.shape = None
def call(
self,
folders,
additional_fields,
restriction,
order_fields,
... | __init__ | identifier_name |
erAutoDiscover.js | to the General Public License
* 3.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.gnu.org/licenses/gpl.html
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, eit... | }
tag = null;
// Try to get the SMTP address if it is available
var tag = aResp.XPath("/a1:Autodiscover/a2:Response/a2:User/a2:AutoDiscoverSMTPAddress");
if (tag.length > 0) {
SMTPaddress = tag[0].value;
}
else {
exchWebService.commonFunct... | else {
exchWebService.commonFunctions.LOG("autodiscoverOk but Displayname is not available."); | random_line_split |
erAutoDiscover.js | to the General Public License
* 3.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.gnu.org/licenses/gpl.html
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, eit... | (aArgument, aCbOk, aCbError, aListener) {
this.mCbOk = aCbOk;
this.mCbError = aCbError;
this.mArgument = aArgument;
var self = this;
this.parent = new ExchangeRequest(aArgument,
function (aExchangeRequest, aResp) {
self.onSendOk(aExchangeRequest, aResp);
},
func... | erAutoDiscoverRequest | identifier_name |
erAutoDiscover.js | to the General Public License
* 3.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.gnu.org/licenses/gpl.html
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, eit... | }
erAutoDiscoverRequest.prototype = {
execute: function _execute() {
// This autodiscover is of the type POX (http://msdn.microsoft.com/en-us/library/bb204189.aspx)
// This is compatible with exchange 2007 and 2010. For 2010 we could also
// use SOAP (http://msdn.microsoft.com/en-us/libr... | {
this.mCbOk = aCbOk;
this.mCbError = aCbError;
this.mArgument = aArgument;
var self = this;
this.parent = new ExchangeRequest(aArgument,
function (aExchangeRequest, aResp) {
self.onSendOk(aExchangeRequest, aResp);
},
function (aExchangeRequest, aCode, aMsg) {
... | identifier_body |
erAutoDiscover.js | the General Public License
* 3.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.gnu.org/licenses/gpl.html
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either... |
}
if (aError) {
this.onSendError(aExchangeRequest, aCode, aMsg);
}
else {
if (this.mCbOk) {
this.mCbOk(ewsUrls, DisplayName, SMTPaddress, redirectAddr);
}
}
this.isRunning = false;
ewsUrls = null;
},
o... | {
aMsg = "autodiscoverOk error getting ewsUrls from:" + this.parent.currentUrl;
aCode = this.parent.ER_ERROR_AUTODISCOVER_GET_EWSULR;
aError = true;
} | conditional_block |
settings.py | # """Django Actions Log settings file."""
#
from __future__ import unicode_literals
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
CREATE = 100
SUCCESS = 110
ACTIVATE = 130
AUTH = 150
VIEW = 180
UPDATE = 200
SUSPEND = 250 | ERROR = 1000
LOG_ACTION_CHOICES_DEFAULT = [
(CREATE, _("create")),
(SUCCESS, _("success")),
(ACTIVATE, _("activate")),
(AUTH, _("authorize")),
(VIEW, _("view")),
(UPDATE, _("update")),
(SUSPEND, _("suspend")),
(UNSUSPEND, _("unsuspend")),
(DELETE, _("delete")),
(TERMINATE, _("te... | UNSUSPEND = 260
DELETE = 300
TERMINATE = 500
FAILED = 999 | random_line_split |
linked_list.rs | use List::*;
enum List {
// Cons: 元组结构体,包含一个元素和一个指向下一节点的指针
Cons(u32, Box<List>),
// Nil: 末结点,表明链表结束
Nil,
}
impl List {
// 创建一个空链表
fn new() -> List {
Nil
}
// 向头部节点前一个位置追加元素
fn prepend(self, elem: u32) -> List {
Cons(elem, Box::new(self))
}
// 返回链表的长度
f... | identifier_body | ||
linked_list.rs | use List::*;
enum List {
// Cons: 元组结构体,包含一个元素和一个指向下一节点的指针
Cons(u32, Box<List>),
// Nil: 末结点,表明链表结束
Nil,
}
impl List {
// 创建一个空链表
fn new() -> List {
Nil
}
// 向头部节点前一个位置追加元素
fn prepend(self, elem: u32) -> List {
Cons(elem, Box::new(self))
}
// 返回链表的长度
f... | println!("{}", list.stringify());
} | println!("linked list has length: {}", list.len()); | random_line_split |
linked_list.rs | use List::*;
enum List {
// Cons: 元组结构体,包含一个元素和一个指向下一节点的指针
Cons(u32, Box<List>),
// Nil: 末结点,表明链表结束
Nil,
}
impl List {
// 创建一个空链表
fn new() -> List {
Nil
}
// 向头部节点前一个位置追加元素
fn prepend(self, elem: u32) -> List {
Cons(elem, Box::new(self))
}
// 返回链表的长度
f... | // `self` 必须匹配,因为这个方法的行为取决于 `self` 的变化类型
// `self` 为 `&List` 类型,`*self` 为 `List` 类型,一个具体的 `T` 类型的匹配
// 要参考引用 `&T` 的匹配
match *self {
// 不能得到 tail 的所有权,因为 `self` 是借用的;
// 而是得到一个 tail 引用
Cons(_, ref tail) => 1 + tail.len(),
// 基本情形:空列表的长度为 0
... | 32 {
| identifier_name |
oppia-noninteractive-link.directive.ts | // Copyright 2014 The Oppia Authors. 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 ap... |
}
// This following check disbales the link in Editor being caught
// by tabbing while in Exploration Editor mode.
if (ContextService.isInExplorationEditorMode()) {
ctrl.tabIndexVal = -1;
}
};
}]
};
}
]);
| {
ctrl.text = ctrl.url;
} | conditional_block |
oppia-noninteractive-link.directive.ts | // Copyright 2014 The Oppia Authors. 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 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Directive for the Link rich-text component.
*
* IMPORTANT NOTE: The naming convention for customization args that a... | //
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS, | random_line_split |
pool.rs | //! Client Connection Pooling
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::io::{self, Read, Write};
use std::net::{SocketAddr, Shutdown};
use std::sync::{Arc, Mutex};
use net::{NetworkConnector, NetworkStream, HttpConnector, ContextVerifier};
/// The `NetworkConnector` that behaves as a connectio... | <S> {
inner: Option<(Key, S)>,
is_closed: bool,
is_drained: bool,
pool: Arc<Mutex<PoolImpl<S>>>
}
impl<S: NetworkStream> Read for PooledStream<S> {
#[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
match self.inner.as_mut().unwrap().1.read(buf) {
Ok(0) => {... | PooledStream | identifier_name |
pool.rs | //! Client Connection Pooling
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::io::{self, Read, Write};
use std::net::{SocketAddr, Shutdown};
use std::sync::{Arc, Mutex};
use net::{NetworkConnector, NetworkStream, HttpConnector, ContextVerifier};
/// The `NetworkConnector` that behaves as a connectio... | pool.connect("127.0.0.1", 3000, "http").unwrap().is_drained = true;
{
let locked = pool.inner.lock().unwrap();
assert_eq!(locked.conns.len(), 1);
assert_eq!(locked.conns.get(&key).unwrap().len(), 1);
}
pool.connect("127.0.0.1", 3000, "http").unwrap().i... | random_line_split | |
pool.rs | //! Client Connection Pooling
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::io::{self, Read, Write};
use std::net::{SocketAddr, Shutdown};
use std::sync::{Arc, Mutex};
use net::{NetworkConnector, NetworkStream, HttpConnector, ContextVerifier};
/// The `NetworkConnector` that behaves as a connectio... |
}
impl<S: NetworkStream> NetworkStream for PooledStream<S> {
#[inline]
fn peer_addr(&mut self) -> io::Result<SocketAddr> {
self.inner.as_mut().unwrap().1.peer_addr()
}
#[inline]
fn close(&mut self, how: Shutdown) -> io::Result<()> {
self.is_closed = true;
self.inner.as_mut... | {
self.inner.as_mut().unwrap().1.flush()
} | identifier_body |
Range.js | (body, options) {
var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0);
this.start = now.clone().add(-3, 'days').valueOf(); // Number
this.end = now.clone().add(4, 'days').valueOf(); // Number
this.body = body;
this.deltaDifference = 0;
this.scaleOffset = 0;
this.startToFront = false;
th... | Range | identifier_name | |
Range.js | , this.end);
interval -= duration;
var width = (direction == 'horizontal') ? this.body.domProps.center.width : this.body.domProps.center.height;
if (this.options.rtl) {
var diffRange = delta / width * interval;
} else {
var diffRange = -delta / width * interval;
}
var newStart = this.props.touch... | * For example, try scale = 0.9 or 1.1
* @param {Number} scale Scaling factor. Values above 1 will zoom out,
* values below 1 will zoom in.
* @param {Number} [center] Value representing a date around which will
* be zoomed. | random_line_split | |
Range.js | Function' in animation) ? animation.easingFunction : 'easeInOutQuad';
var easingFunction = util.easingFunctions[easingName];
if (!easingFunction) {
throw new Error('Unknown easing function ' + JSON.stringify(easingName) + '. ' +
'Choose from: ' + Object.keys(util.easingFunctions).join(', '));
... |
};
/**
* Start dragging horizontally or vertically
* @param {Event} event
* @private
*/
Range.prototype._onDragStart = function(event) {
this.deltaDifference = 0;
this.previousDelta = 0;
// only allow dragging when configured as movable
if (!this.options.moveable) return;
// only start dragging when t... | {
return {
offset: 0,
scale: 1
};
} | conditional_block |
Range.js | min: null,
max: null,
zoomMin: 10, // milliseconds
zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000 // milliseconds
};
this.options = util.extend({}, this.defaultOptions);
this.props = {
touch: {}
};
this.animationTimer = null;
// drag listeners for dragging
... | {
var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0);
this.start = now.clone().add(-3, 'days').valueOf(); // Number
this.end = now.clone().add(4, 'days').valueOf(); // Number
this.body = body;
this.deltaDifference = 0;
this.scaleOffset = 0;
this.startToFront = false;
this.endToFront = ... | identifier_body | |
combustible.py | # -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 NOEL-BARON Léo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
#... | qualite.apercu = "{objet.qualite}"
qualite.prompt = "Qualité du combustible : "
qualite.aide_courte = \
"Entrez la |ent|qualité|ff| du combustible, entre |cmd|1|ff| " \
"(mauvais) et |cmd|10|ff| (très bon).\n\n" \
"Qualité actuelle : {objet.qualite}"
| Travail sur les enveloppes"""
l_terrains = sorted(type(self).importeur.salle.terrains.keys())
terrains = enveloppes["t"]
terrains.apercu = "{objet.aff_terrains}"
terrains.prompt = "Entrez un terrain : "
terrains.aide_courte = \
"Entrez les |ent|terrains|ff| où l'on pe... | identifier_body |
combustible.py | # -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 NOEL-BARON Léo
# All rights reserved.
# | # * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse... | # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer. | random_line_split |
combustible.py | # -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 NOEL-BARON Léo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
#... | self, cle=""):
"""Constructeur de l'objet"""
BaseType.__init__(self, cle)
self.terrains = []
self.rarete = 1
self.qualite = 2
# Editeurs
self.etendre_editeur("t", "terrains", Selection, self, "terrains",
list(importeur.salle.terrains.keys(... | _init__( | identifier_name |
saxutils.py | 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: saxutils.py
"""A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os
import urlparse
import urllib
import types
import handler
import xmlreader
try:
_StringTypes = [
types.Stri... |
def endPrefixMapping(self, prefix):
self._cont_handler.endPrefixMapping(prefix)
def startElement(self, name, attrs):
self._cont_handler.startElement(name, attrs)
def endElement(self, name):
self._cont_handler.endElement(name)
def startElementNS(self, name, qname, attrs):
... |
def startPrefixMapping(self, prefix, uri):
self._cont_handler.startPrefixMapping(prefix, uri) | random_line_split |
saxutils.py | 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: saxutils.py
"""A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os
import urlparse
import urllib
import types
import handler
import xmlreader
try:
_StringTypes = [
types.Stri... |
def prepare_input_source(source, base=''):
"""This function takes an InputSource and an optional base URL and
returns a fully resolved InputSource object ready for reading."""
if type(source) in _StringTypes:
source = xmlreader.InputSource(source)
elif hasattr(source, 'read'):
f = sou... | self._parent = parent | identifier_body |
saxutils.py | 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: saxutils.py
"""A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os
import urlparse
import urllib
import types
import handler
import xmlreader
try:
_StringTypes = [
types.Stri... |
return s
def escape(data, entities={}):
"""Escape &, <, and > in a string of data.
You can escape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
"""
d... | s = s.replace(key, value) | conditional_block |
saxutils.py | 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: saxutils.py
"""A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os
import urlparse
import urllib
import types
import handler
import xmlreader
try:
_StringTypes = [
types.Stri... | (self, parent=None):
xmlreader.XMLReader.__init__(self)
self._parent = parent
def error(self, exception):
self._err_handler.error(exception)
def fatalError(self, exception):
self._err_handler.fatalError(exception)
def warning(self, exception):
self._err_handler.war... | __init__ | identifier_name |
__init__.py | from pycddb.dataset import Dataset
from lingpy import Wordlist, csv2list
from lingpy.compare.partial import _get_slices
def prepare(ds):
errs = 0
wl = Wordlist(ds.raw('bds.tsv'))
W = {}
for k in wl:
value = wl[k, 'value']
tokens = wl[k, 'tokens']
doc = wl[k, 'doculect']
... | for l, n in zip(header[5:], line[5:]):
if n:
note = '' if 'X' else n
invs[l] += [[sis, ipa, struc, stype, note]]
ds.write_inventories(invs) | if len(struc.split()) != len(ipa.split()):
print(i+2, 'warn', struc, ' | ', ipa) | random_line_split |
__init__.py | from pycddb.dataset import Dataset
from lingpy import Wordlist, csv2list
from lingpy.compare.partial import _get_slices
def | (ds):
errs = 0
wl = Wordlist(ds.raw('bds.tsv'))
W = {}
for k in wl:
value = wl[k, 'value']
tokens = wl[k, 'tokens']
doc = wl[k, 'doculect']
if value:
morphemes = []
for a, b in _get_slices(wl[k, 'tokens']):
ipa = ''.join(tokens[a:b]... | prepare | identifier_name |
__init__.py | from pycddb.dataset import Dataset
from lingpy import Wordlist, csv2list
from lingpy.compare.partial import _get_slices
def prepare(ds):
| print(errs, clpa, struc)
if '«' in clpa:
errs += 1
print(errs, ipa, clpa, struc)
W[k] = [doc, wl[k, 'concept'], wl[k, 'concepticon_id'], value,
clpa, struc, wl[k, 'partial_ids']]
W[0] = ['doculect', 'concept', 'concepticon_i... | errs = 0
wl = Wordlist(ds.raw('bds.tsv'))
W = {}
for k in wl:
value = wl[k, 'value']
tokens = wl[k, 'tokens']
doc = wl[k, 'doculect']
if value:
morphemes = []
for a, b in _get_slices(wl[k, 'tokens']):
ipa = ''.join(tokens[a:b])
... | identifier_body |
__init__.py | from pycddb.dataset import Dataset
from lingpy import Wordlist, csv2list
from lingpy.compare.partial import _get_slices
def prepare(ds):
errs = 0
wl = Wordlist(ds.raw('bds.tsv'))
W = {}
for k in wl:
value = wl[k, 'value']
tokens = wl[k, 'tokens']
doc = wl[k, 'doculect']
... | W[0] = ['doculect', 'concept', 'concepticon_id', 'value', 'segments', 'structure', 'cogids']
ds.write_wordlist(Wordlist(W))
def inventories(ds):
data = csv2list(ds.raw('inv.tsv'))
header = data[0]
invs = {l: [] for l in ds.languages}
for i, line in enumerate(data[1:]):
stype, sis, ipa, ... | morphemes = []
for a, b in _get_slices(wl[k, 'tokens']):
ipa = ''.join(tokens[a:b])
morphemes += [ipa]
ipa = ' '.join(morphemes)
clpa = ds.transform(ipa, 'CLPA')
struc = ds.transform(ipa, 'Structure')
try:
... | conditional_block |
server.js | var http = require('http'),
fs = require('fs');
var people = {};
//var port = process.env.OPENSHIFT_NODEJS_PORT || "1337";
var port = "1337";
//var serverUrl = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
var serverUrl = "127.0.0.1";
var app = http.createServer(function (request, response)
{
//console.log(... | if (people[client.id] == undefined || people[client.id] == null)
{
people[client.id] = {name:name, html:'<span onclick="msgTo(\''+client.id+'\')" title="Type a message and click here to send in private">'+name+'</span>'}; //data["name"];
io.sockets.to(client.id).emit('messageMe', 'Server', 'You have connected... | io.sockets.emit("update-people", people);
console.log("New join: " + name);
});
client.on('sendTo', function(id, msg, name){ | random_line_split |
server.js | var http = require('http'),
fs = require('fs');
var people = {};
//var port = process.env.OPENSHIFT_NODEJS_PORT || "1337";
var port = "1337";
//var serverUrl = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
var serverUrl = "127.0.0.1";
var app = http.createServer(function (request, response)
{
//console.log(... |
io.sockets.to(id).emit('messageMe', people[client.id]["name"] + '<span style="color:red"> in PVT</span>', msg);
io.sockets.to(client.id).emit('messageMe', people[client.id]["name"] + '<span style="color:red"> in PVT</span>', msg);
});
client.on("sendAll", function(msg, name){
if (people[client.id] == u... | {
people[client.id] = {name:name, html:'<span onclick="msgTo(\''+client.id+'\')" title="Type a message and click here to send in private">'+name+'</span>'}; //data["name"];
io.sockets.to(client.id).emit('messageMe', 'Server', 'You have connected.');
io.sockets.emit("update", name + " has joined the server.")
... | conditional_block |
ThumbnailGrid.stories.js | import React from "react";
import { storiesOf, fixtures } from "helpers/storybook/exports";
import ThumbnailGrid from "..";
import EntityThumbnail from "global/components/atomic/EntityThumbnail";
import shuffle from "lodash/shuffle";
const issues = fixtures
.collectionFactory("issue", 3)
.map(issue => issue.data)
... | <div className="container bg-white">
<ThumbnailGrid>
{({ stack }) =>
entities.map(item => (
<EntityThumbnail
key={item.id}
entity={item}
onUncollect={() => console.log("clicked uncollect")}
stack={stack}
... | storiesOf("Global/ThumbnailGrid", module)
.add("Grid", () => {
return ( | random_line_split |
main.rs | pub mod externs;
/// Filesystems
pub mod fs;
/// Various graphical methods
pub mod graphics;
/// Network
pub mod network;
/// Panic
pub mod panic;
/// Programs
pub mod programs;
/// Schemes
pub mod schemes;
/// Scheduling
pub mod scheduler;
/// Sync primatives
pub mod sync;
/// System calls
pub mod syscall;
/// USB inp... | } else {
if event.code == EVENT_KEY && event.b as u8 == event::K_F1 && event.c > 0 {
console.draw = true;
console.redraw = true;
} else {
// TODO: Magical orbital hack
... | }
_ => (),
} | random_line_split |
main.rs | pub mod externs;
/// Filesystems
pub mod fs;
/// Various graphical methods
pub mod graphics;
/// Network
pub mod network;
/// Panic
pub mod panic;
/// Programs
pub mod programs;
/// Schemes
pub mod schemes;
/// Scheduling
pub mod scheduler;
/// Sync primatives
pub mod sync;
/// System calls
pub mod syscall;
/// USB inp... | (font_data: usize, tss_data: usize) {
// Zero BSS, this initializes statics that are set to 0
{
extern {
static mut __bss_start: u8;
static mut __bss_end: u8;
}
let start_ptr = &mut __bss_start;
let end_ptr = &mut __bss_end;
if start_ptr as *cons... | init | identifier_name |
main.rs | pub mod externs;
/// Filesystems
pub mod fs;
/// Various graphical methods
pub mod graphics;
/// Network
pub mod network;
/// Panic
pub mod panic;
/// Programs
pub mod programs;
/// Schemes
pub mod schemes;
/// Scheduling
pub mod scheduler;
/// Sync primatives
pub mod sync;
/// System calls
pub mod syscall;
/// USB inp... |
context_switch(false);
}
}
/// Event poll loop
fn poll_loop() {
loop {
env().on_poll();
unsafe { context_switch(false) };
}
}
/// Event loop
fn event_loop() {
{
let mut console = env().console.lock();
console.instant = false;
}
let mut cmd = String:... | {
loop {
asm!("cli" : : : : "intel", "volatile");
let mut halt = true;
for i in env().contexts.lock().iter().skip(1) {
if i.interrupted {
halt = false;
break;
}
}
if halt {
asm!("sti" : : : : "intel", "vo... | identifier_body |
main.rs | pub mod externs;
/// Filesystems
pub mod fs;
/// Various graphical methods
pub mod graphics;
/// Network
pub mod network;
/// Panic
pub mod panic;
/// Programs
pub mod programs;
/// Schemes
pub mod schemes;
/// Scheduling
pub mod scheduler;
/// Sync primatives
pub mod sync;
/// System calls
pub mod syscall;
/// USB inp... |
}
unsafe { context_switch(false) };
}
}
static BSS_TEST_ZERO: usize = 0;
static BSS_TEST_NONZERO: usize = usize::MAX;
/// Initialize kernel
unsafe fn init(font_data: usize, tss_data: usize) {
// Zero BSS, this initializes statics that are set to 0
{
extern {
static mu... | {
console.redraw = false;
console.display.flip();
} | conditional_block |
app.js | // @flow
import React, {Component, PropTypes as t} from 'react';
import AddObservations from './add-observations';
import Breadcrumbs from '../share/breadcrumbs';
import ButtonSet from '../share/button-set';
import DataDisplay from './data-display';
import DataEntry from './data-entry';
import DateRange from '../share/... | () {
const {hash} = getLocationParts(window.location);
const {
activeCrumb,
description,
endDate,
error,
name,
productCategories,
productTargets,
projectMap,
selectedCategory,
selectedTarget,
startDate,
} = this.state;
const buttons = [... | render | identifier_name |
app.js | // @flow
import React, {Component, PropTypes as t} from 'react';
import AddObservations from './add-observations';
import Breadcrumbs from '../share/breadcrumbs';
import ButtonSet from '../share/button-set';
import DataDisplay from './data-display';
import DataEntry from './data-entry';
import DateRange from '../share/... |
render() {
const {hash} = getLocationParts(window.location);
const {
activeCrumb,
description,
endDate,
error,
name,
productCategories,
productTargets,
projectMap,
selectedCategory,
selectedTarget,
startDate,
} = this.state;
const bu... |
onSelected = (event: EventType) =>
this.setState({selected: event.target.value}); | random_line_split |
urls.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django
from account.views import ChangePasswordView, SignupView, LoginView
from django.conf.urls import include, url
from django.contrib import admin
from example_thirdparty.forms import SignupFormWithCaptcha |
# aliases to match original django-registration urls
url(r"^accounts/password/$", ChangePasswordView.as_view(),
name="auth_password_change"),
url(r"^accounts/signup/$",
SignupView.as_view(form_class=SignupFormWithCaptcha),
name="registration_register"),
url(r"^accounts/login/$",... |
urlpatterns = [
url(r'^admin/', include(admin.site.urls) if django.VERSION < (1, 10) else admin.site.urls), | random_line_split |
useInputValueToggle.js | import { computed, toRefs } from '@vue/composition-api'
export const useInputValueToggleProps = {
label: {
type: String
},
options: {
type: Array,
default: () => ([
{ value: 0 },
{ value: 1, color: 'var(--primary)' }
])
},
hints: {
type: Array
}
}
export const useInputValue... |
const tooltip = computed(() => {
const { 0: { tooltip: defaultTooltip } = {} , [txValue.value]: { tooltip: mappedTooltip } = {} } = options.value
return mappedTooltip || defaultTooltip
})
return {
// middleware
value: txValue,
onInput: txOnInput,
// state
max,
label,
color,
... | const icon = computed(() => {
const { 0: { icon: defaultIcon } = {} , [txValue.value]: { icon: mappedIcon } = {} } = options.value
return mappedIcon || defaultIcon
}) | random_line_split |
index.js | var contentNames = ['upload', 'chat', 'about'];
function init() {
for (var i = 0; i < contentNames.length; i++) {
var elem = document.getElementById(contentNames[i] + 'Link');
elem.href = '#' + contentNames[i];
}
var chatForm = document.getElementById('chatForm');
chatForm.onsubmit = s... | (elem) {
elem.style.display = "block";
setTimeout(function () {
elem.classList.remove('hidden');
}, 100);
}
function hideElement(elem) {
elem.classList.add('hidden');
setTimeout(function () {
elem.style.display = 'none';
}, 200);
}
function refreshChat() {
var chatContent =... | showElement | identifier_name |
index.js | var contentNames = ['upload', 'chat', 'about'];
function init() {
for (var i = 0; i < contentNames.length; i++) {
var elem = document.getElementById(contentNames[i] + 'Link');
elem.href = '#' + contentNames[i];
}
var chatForm = document.getElementById('chatForm');
chatForm.onsubmit = s... |
};
r.open('GET', 'chat_content.html', true);
r.send();
}
var chatRefreshTimer = undefined;
function startChatRefresh() {
chatRefreshTimer = setInterval(refreshChat, 1000);
}
function submitChat() {
var chatForm = document.getElementById('chatForm');
var r = new XMLHttpRequest();
r.onready... | {
chatContent.innerHTML = r.responseText;
} | conditional_block |
index.js | var contentNames = ['upload', 'chat', 'about'];
function init() {
for (var i = 0; i < contentNames.length; i++) {
var elem = document.getElementById(contentNames[i] + 'Link');
elem.href = '#' + contentNames[i];
}
var chatForm = document.getElementById('chatForm');
chatForm.onsubmit = s... |
function refreshChat() {
var chatContent = document.getElementById('chatContent');
var r = new XMLHttpRequest();
r.onreadystatechange = function () {
if (r.readyState == 4) {
chatContent.innerHTML = r.responseText;
}
};
r.open('GET', 'chat_content.html', true);
r.sen... | } | random_line_split |
index.js | var contentNames = ['upload', 'chat', 'about'];
function init() {
for (var i = 0; i < contentNames.length; i++) {
var elem = document.getElementById(contentNames[i] + 'Link');
elem.href = '#' + contentNames[i];
}
var chatForm = document.getElementById('chatForm');
chatForm.onsubmit = s... |
var chatRefreshTimer = undefined;
function startChatRefresh() {
chatRefreshTimer = setInterval(refreshChat, 1000);
}
function submitChat() {
var chatForm = document.getElementById('chatForm');
var r = new XMLHttpRequest();
r.onreadystatechange = function () {
if (r.readyState == 4) {
... | {
var chatContent = document.getElementById('chatContent');
var r = new XMLHttpRequest();
r.onreadystatechange = function () {
if (r.readyState == 4) {
chatContent.innerHTML = r.responseText;
}
};
r.open('GET', 'chat_content.html', true);
r.send();
} | identifier_body |
cleanup-rvalue-scopes.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 ... |
#![feature(macro_rules)]
use std::ops::Drop;
static mut FLAGS: u64 = 0;
struct Box<T> { f: T }
struct AddFlags { bits: u64 }
fn AddFlags(bits: u64) -> AddFlags {
AddFlags { bits: bits }
}
fn arg(exp: u64, _x: &AddFlags) {
check_flags(exp);
}
fn pass<T>(v: T) -> T {
v
}
fn check_flags(exp: u64) {
... | // Test that destructors for rvalue temporaries run either at end of
// statement or end of block, as appropriate given the temporary
// lifetime rules. | random_line_split |
cleanup-rvalue-scopes.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 bits(&self) -> u64 {
self.bits
}
}
impl Drop for AddFlags {
fn drop(&mut self) {
unsafe {
FLAGS = FLAGS + self.bits;
}
}
}
macro_rules! end_of_block(
($pat:pat, $expr:expr) => (
{
println!("end_of_block({})", stringify!({let $pat = $expr... | {
check_flags(exp);
self
} | identifier_body |
cleanup-rvalue-scopes.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 ... | (&mut self) {
unsafe {
FLAGS = FLAGS + self.bits;
}
}
}
macro_rules! end_of_block(
($pat:pat, $expr:expr) => (
{
println!("end_of_block({})", stringify!({let $pat = $expr;}));
{
// Destructor here does not run until exit from the bloc... | drop | identifier_name |
translate.py | # -*- coding: utf-8 -*-
"""
Translator module that uses the Google Translate API.
Adapted from Terry Yin's google-translate-python.
Language detection added by Steven Loria.
"""
from __future__ import absolute_import
import json
import re
import codecs
from textblob.compat import PY2, request, urlencode
from textblob.... | (self, url, host=None, type_=None, data=None):
encoded_data = urlencode(data).encode('utf-8')
req = request.Request(url=url, headers=self.headers, data=encoded_data)
if host or type_:
req.set_proxy(host=host, type=type_)
resp = request.urlopen(req)
content = resp.read... | _get_json5 | identifier_name |
translate.py | # -*- coding: utf-8 -*-
"""
Translator module that uses the Google Translate API.
Adapted from Terry Yin's google-translate-python.
Language detection added by Steven Loria.
"""
from __future__ import absolute_import
import json
import re
import codecs
from textblob.compat import PY2, request, urlencode
from textblob.... |
return None
def _get_translation_from_json5(self, content):
result = u""
json_data = json.loads(content)
if 'sentences' in json_data:
result = ''.join([s['trans'] for s in json_data['sentences']])
return _unescape(result)
def _get_json5(self, url, host=None... | return json_data['src'] | conditional_block |
translate.py | # -*- coding: utf-8 -*-
"""
Translator module that uses the Google Translate API.
Adapted from Terry Yin's google-translate-python.
Language detection added by Steven Loria.
"""
from __future__ import absolute_import
import json
import re
import codecs
from textblob.compat import PY2, request, urlencode
from textblob.... |
def _get_json5(self, url, host=None, type_=None, data=None):
encoded_data = urlencode(data).encode('utf-8')
req = request.Request(url=url, headers=self.headers, data=encoded_data)
if host or type_:
req.set_proxy(host=host, type=type_)
resp = request.urlopen(req)
... | result = u""
json_data = json.loads(content)
if 'sentences' in json_data:
result = ''.join([s['trans'] for s in json_data['sentences']])
return _unescape(result) | identifier_body |
translate.py | # -*- coding: utf-8 -*-
"""
Translator module that uses the Google Translate API. | import json
import re
import codecs
from textblob.compat import PY2, request, urlencode
from textblob.exceptions import TranslatorError
class Translator(object):
"""A language translator and detector.
Usage:
::
>>> from textblob.translate import Translator
>>> t = Translator()
>>... |
Adapted from Terry Yin's google-translate-python.
Language detection added by Steven Loria.
"""
from __future__ import absolute_import | random_line_split |
htmloptionelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLOptionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOpti... |
}
| {
self.htmlelement.reflector()
} | identifier_body |
htmloptionelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLOptionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOpti... | (&self) -> bool {
self.type_id == NodeTargetTypeId(ElementNodeTypeId(HTMLOptionElementTypeId))
}
}
impl HTMLOptionElement {
pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLOptionElement {
HTMLOptionElement {
htmlelement: HTMLElement::new_inherited(HTMLO... | is_htmloptionelement | identifier_name |
htmloptionelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLOptionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLOpti... | use dom::document::Document;
use dom::element::HTMLOptionElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::htmlelement::HTMLElement;
use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
pub struct HTMLOptionElement {
pub htmlelement: HTMLElem... | random_line_split | |
app.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import calendar
import json
import locale
import re
import requests
from bs4 import BeautifulSoup
# Use German month names
locale.setlocale(locale.LC_ALL, 'de_DE.utf8')
URL = "http://www.theater-chemnitz.de/spielplan/repertoire"
BASE_URL = "http://www.t... | (year, month):
plan = requests.get("{}/{}/{:02d}/".format(URL, year, month))
if plan.status_code != 200:
logger.error('got non-200 return code while scraping', exc_info=True)
return []
soup = BeautifulSoup(plan.text.replace(' ', ' '), "lxml")
news_items = soup.find_all("div", class_... | get_plays | identifier_name |
app.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import calendar
import json
import locale
import re
import requests
from bs4 import BeautifulSoup
# Use German month names
locale.setlocale(locale.LC_ALL, 'de_DE.utf8')
URL = "http://www.theater-chemnitz.de/spielplan/repertoire"
BASE_URL = "http://www.t... | # Gastspiel, Premiere etc.
special_raw = block_top.find(class_="cc_premiere")
if special_raw:
special = special_raw.get_text()
if special in ["Gastspiel"]: # Ausnahmen
continue
category_raw = date.find(class_="cc_type")... | plan = requests.get("{}/{}/{:02d}/".format(URL, year, month))
if plan.status_code != 200:
logger.error('got non-200 return code while scraping', exc_info=True)
return []
soup = BeautifulSoup(plan.text.replace(' ', ' '), "lxml")
news_items = soup.find_all("div", class_="cc_news_item")
... | identifier_body |
app.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import calendar
import json
import locale
import re
import requests
from bs4 import BeautifulSoup
# Use German month names
locale.setlocale(locale.LC_ALL, 'de_DE.utf8')
URL = "http://www.theater-chemnitz.de/spielplan/repertoire"
BASE_URL = "http://www.t... | day = int(date.find(class_="cc_day").get_text().strip('.'))
play = {
"month": month,
"day": day,
"year": year
}
time_raw = date.find(class_="cc_timeresp").get_text().split(' ')[0].split(':')
play["hour"] = int(ti... | news_items = soup.find_all("div", class_="cc_news_item")
plays = []
for block_top in news_items:
date = block_top.find("div", class_="cc_news_date")
if date: | random_line_split |
app.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import calendar
import json
import locale
import re
import requests
from bs4 import BeautifulSoup
# Use German month names
locale.setlocale(locale.LC_ALL, 'de_DE.utf8')
URL = "http://www.theater-chemnitz.de/spielplan/repertoire"
BASE_URL = "http://www.t... |
desciption_raw = block_top.find("h3")
if desciption_raw:
play["description"] = desciption_raw.get_text()
tickets_raw = block_top.find("a", class_="cc_ticket")
play["tickets"] = tickets_raw["href"] if tickets_raw else None
# ID & URL
... | continue | conditional_block |
schema.py | # testing/schema.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from . import exclusions
from .. import schema, event
from . import config
__all_... | kw.update(table_options)
if exclusions.against(config._current, 'mysql'):
if 'mysql_engine' not in kw and 'mysql_type' not in kw:
if 'test_needs_fk' in test_opts or 'test_needs_acid' in test_opts:
kw['mysql_engine'] = 'InnoDB'
else:
kw['mysql_engi... | test_opts = dict([(k, kw.pop(k)) for k in list(kw)
if k.startswith('test_')])
| random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.