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 |
|---|---|---|---|---|
Rc.py | from Components.Pixmap import MovingPixmap, MultiPixmap
from Tools.Directories import resolveFilename, SCOPE_SKIN
from xml.etree.ElementTree import ElementTree
from Components.config import config, ConfigInteger
from Components.RcModel import rc_model
from boxbranding import getBoxType
config.misc.rcused = Config... |
def selectKey(self, key):
if self.isDefaultRc:
rc = self.rcs[config.misc.rcused.value]
else:
try:
rc = self.rcs[2]
except:
rc = self.rcs[config.misc.rcused.value]
if rc.has_key(key):
rcpos = self['... | self['rc'].show() | identifier_body |
karma.conf.js | module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: 'src/main/javascript/app',
frameworks: ['jasmine'],
files: [
'lib/lodash/dist/lodash.js',
'lib/angular/angular.js',
'lib/angular... | // enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// ... | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
| random_line_split |
clap_app.rs | /*
Precached - A Linux process monitor and pre-caching daemon
Copyright (C) 2017-2020 the precached developers
This file is part of precached.
Precached 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 Softwar... | .multiple(true)
.help(tr!("precachedtop-output-verbosity")),
)
.subcommand(
SubCommand::with_name("help").setting(AppSettings::DeriveDisplayOrder), // .about(tr!("precachedtop-help")),
)
.subcommand(
SubCommand::with_name("completio... | {
App::new("precachedtop")
.version(env!("CARGO_PKG_VERSION"))
.author("X3n0m0rph59 <x3n0m0rph59@gmail.com>")
// .versionless_subcommands(true)
// .subcommand_required_else_help(true)
.setting(AppSettings::GlobalVersion)
.setting(AppSettings::DeriveDisplayOrder)
... | identifier_body |
clap_app.rs | /*
Precached - A Linux process monitor and pre-caching daemon
Copyright (C) 2017-2020 the precached developers
This file is part of precached. |
Precached 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 later version.
Precached is distributed in the hope that it will be useful,
... | random_line_split | |
clap_app.rs | /*
Precached - A Linux process monitor and pre-caching daemon
Copyright (C) 2017-2020 the precached developers
This file is part of precached.
Precached 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 Softwar... | <'a, 'b>() -> App<'a, 'b>
where
'a: 'b,
{
App::new("precachedtop")
.version(env!("CARGO_PKG_VERSION"))
.author("X3n0m0rph59 <x3n0m0rph59@gmail.com>")
// .versionless_subcommands(true)
// .subcommand_required_else_help(true)
.setting(AppSettings::GlobalVersion)
.se... | get_app | identifier_name |
index.js | /**
* Copyright 2013-2018 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the L... | else if (this.databaseType === 'couchbase') {
this.prodDatabaseType = 'couchbase';
} else if (this.databaseType === 'cassandra') {
this.prodDatabaseType = 'cassandra';
} else if (this.databaseType === 'no') {
// no database, on... | {
this.prodDatabaseType = 'mongodb';
} | conditional_block |
index.js | /**
* Copyright 2013-2018 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the L... | () {
return {};
}
get install() {
if (useBlueprint) return;
return this._install();
}
// Public API method used by the getter and also by Blueprints
_end() {
return {};
}
get end() {
if (useBlueprint) return;
return this._end();
}
};
| _install | identifier_name |
index.js | /**
* Copyright 2013-2018 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the L... |
};
}
get configuring() {
if (useBlueprint) return;
return this._configuring();
}
// Public API method used by the getter and also by Blueprints
_default() {
return {
getSharedConfigOptions() {
if (this.configOptions.clientFramework) {
... | {
// Make dist dir available in templates
if (this.buildTool === 'maven') {
this.BUILD_DIR = 'target/';
} else {
this.BUILD_DIR = 'build/';
}
this.CLIENT_DIST_DIR = this.BUILD_DIR + constants.CLIENT_D... | identifier_body |
index.js | /**
* Copyright 2013-2018 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the L... | this.serverPort = '8080';
}
this.enableSwaggerCodegen = configuration.get('enableSwaggerCodegen');
this.serviceDiscoveryType =
configuration.get('serviceDiscoveryType') === 'no' ? false : configuration.get('serviceDiscoveryType');... | this.serverPort = configuration.get('serverPort');
if (this.serverPort === undefined) { | random_line_split |
views.py | # -*- encoding: utf-8 -*-
__author__ = 'ray'
__date__ = '2/27/15'
from flask import jsonify, abort
from flask.views import MethodView
from ..models import ThemeModel
class ThemeView(MethodView):
""" Theme View
Retrieve description of a list of available themes.
:param theme_model: A theme model that ... |
for theme in self._theme_model.iter_themes():
collection.append(theme.to_dict())
return jsonify(result=collection)
else:
theme = self._theme_model.get_theme(tag)
if theme is None:
abort(404)
return jsonify(result=the... | """
if tag is None:
collection = list() | random_line_split |
views.py | # -*- encoding: utf-8 -*-
__author__ = 'ray'
__date__ = '2/27/15'
from flask import jsonify, abort
from flask.views import MethodView
from ..models import ThemeModel
class ThemeView(MethodView):
""" Theme View
Retrieve description of a list of available themes.
:param theme_model: A theme model that ... | (self, tag):
"""Return description of the theme. Raise :http:statuscode:`404` if
not found.
:param name: Name of a theme.
:type name: str
"""
if tag is None:
collection = list()
for theme in self._theme_model.iter_themes():
coll... | get | identifier_name |
views.py | # -*- encoding: utf-8 -*-
__author__ = 'ray'
__date__ = '2/27/15'
from flask import jsonify, abort
from flask.views import MethodView
from ..models import ThemeModel
class ThemeView(MethodView):
""" Theme View
Retrieve description of a list of available themes.
:param theme_model: A theme model that ... |
else:
theme = self._theme_model.get_theme(tag)
if theme is None:
abort(404)
return jsonify(result=theme.to_dict())
| collection = list()
for theme in self._theme_model.iter_themes():
collection.append(theme.to_dict())
return jsonify(result=collection) | conditional_block |
views.py | # -*- encoding: utf-8 -*-
__author__ = 'ray'
__date__ = '2/27/15'
from flask import jsonify, abort
from flask.views import MethodView
from ..models import ThemeModel
class ThemeView(MethodView):
""" Theme View
Retrieve description of a list of available themes.
:param theme_model: A theme model that ... |
def get(self, tag):
"""Return description of the theme. Raise :http:statuscode:`404` if
not found.
:param name: Name of a theme.
:type name: str
"""
if tag is None:
collection = list()
for theme in self._theme_model.iter_themes():
... | assert isinstance(theme_model, ThemeModel)
self._theme_model = theme_model | identifier_body |
t9.py | """
"""
import imp
import os
import sys
KEY_MAP = {0: [],
1: [],
2: [u'a', u'b', u'c'],
3: [u'd', u'e', u'f'],
4: [u'g', u'h', u'i'],
5: [u'j', u'k', u'l'],
6: [u'm', u'n', u'o'],
7: [u'p', u'q', u'r', u's'],
8: [u't', u'u', u'v']... |
def _sort(self, words):
return sorted(words,
key=lambda x: self.data.WORDS.get(x, 0),
reverse=True)
def map_words(self, number):
"""
Map a string of numbers from a phone's key pad to possible
words.
@param number: A string o... | """
Map numbers from a dial pad to characters.
@param number: A string of numbers dialed from a key pad.
@type number: C{int}
"""
ret_chars = []
for num in str(number):
chars = KEY_MAP[int(num)]
if not chars:
break
ret_... | identifier_body |
t9.py | """
"""
import imp
import os
import sys
KEY_MAP = {0: [],
1: [],
2: [u'a', u'b', u'c'],
3: [u'd', u'e', u'f'],
4: [u'g', u'h', u'i'],
5: [u'j', u'k', u'l'],
6: [u'm', u'n', u'o'],
7: [u'p', u'q', u'r', u's'],
8: [u't', u'u', u'v']... | If it does not exist then use existing data to build it.
"""
if os.path.exists(self.data_module):
self.data = imp.load_source('data', self.data_module)
else:
msg = "WARNING: Data module is not loaded. "
msg += "Please build by running `make build-data`... |
def load(self):
"""
Load up words and tri data structure that is saved to disk. | random_line_split |
t9.py | """
"""
import imp
import os
import sys
KEY_MAP = {0: [],
1: [],
2: [u'a', u'b', u'c'],
3: [u'd', u'e', u'f'],
4: [u'g', u'h', u'i'],
5: [u'j', u'k', u'l'],
6: [u'm', u'n', u'o'],
7: [u'p', u'q', u'r', u's'],
8: [u't', u'u', u'v']... |
else:
msg = "WARNING: Data module is not loaded. "
msg += "Please build by running `make build-data`"
print msg
sys.exit(1)
def map_number(self, number):
"""
Map numbers from a dial pad to characters.
@param number: A string of numbe... | self.data = imp.load_source('data', self.data_module) | conditional_block |
t9.py | """
"""
import imp
import os
import sys
KEY_MAP = {0: [],
1: [],
2: [u'a', u'b', u'c'],
3: [u'd', u'e', u'f'],
4: [u'g', u'h', u'i'],
5: [u'j', u'k', u'l'],
6: [u'm', u'n', u'o'],
7: [u'p', u'q', u'r', u's'],
8: [u't', u'u', u'v']... | (self, number):
"""
Map numbers from a dial pad to characters.
@param number: A string of numbers dialed from a key pad.
@type number: C{int}
"""
ret_chars = []
for num in str(number):
chars = KEY_MAP[int(num)]
if not chars:
... | map_number | identifier_name |
setup.py | # 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/.
from setuptools import setup
PACKAGE_NAME = 'mozdevice'
PACKAGE_VERSION = '0.44'
deps = ['mozfile >= 1.0',
'mozlog >= 2.1',
'moznetwork >= 0.24',
'mozprocess >= 0.1... | # This Source Code Form is subject to the terms of the Mozilla Public | random_line_split | |
index.js | "use strict";
var flatMap = function (arr, fn) {
return Array.prototype.concat.apply([], arr.map(fn));
};
var xmlQuery = function (ast) {
var nodes = Array.isArray(ast) ? ast : (ast ? [ast] : []);
var length = nodes.length;
var get = function (index) { return nodes[index]; };
var children = function... | };
var has = function (sel) {
if (nodes.length === 0) {
return false;
}
if (nodes.some(function (node) { return node.name === sel; })) {
return true;
}
return children().has(sel);
};
var attr = function (name) {
if (length) {
... | return xmlQuery(flatMap(nodes, function (node) { return findInNode(node, sel); })); | random_line_split |
index.js | "use strict";
var flatMap = function (arr, fn) {
return Array.prototype.concat.apply([], arr.map(fn));
};
var xmlQuery = function (ast) {
var nodes = Array.isArray(ast) ? ast : (ast ? [ast] : []);
var length = nodes.length;
var get = function (index) { return nodes[index]; };
var children = function... |
return children().has(sel);
};
var attr = function (name) {
if (length) {
var attrs = nodes[0].attributes;
return name ? attrs[name] : attrs;
}
};
var eq = function (index) { return xmlQuery(nodes[index]); };
var first = function () { return eq(0); };... | {
return true;
} | conditional_block |
hworld.component.js | (function() {
"use strict";
var module = angular.module("QMCUtilities");
function doSomething($http) {
return $http.get("./hworld/hworld")
.then(function(result) {
return result.data;
});
}
function getVersion($http) {
return $http.get("./ver... | }()); | random_line_split | |
hworld.component.js | (function() {
"use strict";
var module = angular.module("QMCUtilities");
function doSomething($http) {
return $http.get("./hworld/hworld")
.then(function(result) {
return result.data;
});
}
function getVersion($http) {
return $http.get("./ver... |
module.component("helloWorld", {
transclude: true,
templateUrl: "plugins/hworld/helloWorld.html",
controllerAs: "model",
controller: ["$http", hWorldController]
});
}()); | {
var model = this;
model.response = "";
model.$onInit = function() {
model.response = "Argghhhh";
getVersion($http)
.then(function(result) {
model.version = result;
});
}
model.clickMe = function() {
... | identifier_body |
hworld.component.js | (function() {
"use strict";
var module = angular.module("QMCUtilities");
function | ($http) {
return $http.get("./hworld/hworld")
.then(function(result) {
return result.data;
});
}
function getVersion($http) {
return $http.get("./version")
.then(function(result) {
return result.data
});
}
... | doSomething | identifier_name |
ccloud_lib.py | #!/usr/bin/env python
#
# Copyright 2020 Confluent 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... | def parse_args():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
description="Confluent Python Client example to produce messages \
to Confluent Cloud")
parser._action_groups.pop()
required = parser.add_argument_group('required arguments')
requir... | """
return dict(count=self.count)
| random_line_split |
ccloud_lib.py | #!/usr/bin/env python
#
# Copyright 2020 Confluent 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... |
#conf['ssl.ca.location'] = certifi.where()
return conf
def pop_schema_registry_params_from_config(conf):
"""Remove potential Schema Registry related configurations from dictionary"""
conf.pop('schema.registry.url', None)
conf.pop('basic.auth.user.info', None)
conf.pop('basic.auth.credentia... | line = line.strip()
if len(line) != 0 and line[0] != "#":
parameter, value = line.strip().split('=', 1)
conf[parameter] = value.strip() | conditional_block |
ccloud_lib.py | #!/usr/bin/env python
#
# Copyright 2020 Confluent 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... |
def to_dict(self):
"""
The Avro Python library does not support code generation.
For this reason we must provide a dict representation of our class for serialization.
"""
return dict(count=self.count)
def parse_args():
"""Parse command line arguments"""
p... | """
Count stores the deserialized Avro record for the Kafka value.
"""
# Use __slots__ to explicitly declare all data members.
__slots__ = ["count", "id"]
def __init__(self, count=None):
self.count = count
# Unique id used to track produce request success/failures.
# Do... | identifier_body |
ccloud_lib.py | #!/usr/bin/env python
#
# Copyright 2020 Confluent 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... | (self, name=None):
self.name = name
# Unique id used to track produce request success/failures.
# Do *not* include in the serialized object.
self.id = uuid4()
@staticmethod
def dict_to_name(obj, ctx):
return Name(obj['name'])
@staticmethod
def name_to_dict(name,... | __init__ | identifier_name |
parse-rss.js | var config = require('config');
var rest = require('restler');
var fs = require("fs");
var dateformat = require("dateformat");
var jsonfile = require("jsonfile");
var rssBaseURL = config.get('rssBaseURL');
var apps = config.get('apps');
var maxPage = config.get('maxPage');
var now = new Date()
var timestamp = datefor... |
function printText(app, text, rating) {
allReviews = "logs/"+app.id+"-all-"+timestamp+".txt";
fs.appendFileSync(allReviews, text + "\n");
if (rating < 3) {
reviews = "logs/"+app.id+"-negative-"+timestamp+".txt";
} else {
reviews = "logs/"+app.id+"-positive-"+timestamp+".txt";
}
fs.appendFileSync(r... | {
jsonfile.writeFile("logs/"+app.id+"-"+timestamp+".stats", app.stats, {spaces: 2});
} | identifier_body |
parse-rss.js | var config = require('config');
var rest = require('restler');
var fs = require("fs");
var dateformat = require("dateformat");
var jsonfile = require("jsonfile");
var rssBaseURL = config.get('rssBaseURL');
var apps = config.get('apps');
var maxPage = config.get('maxPage');
var now = new Date()
var timestamp = datefor... |
function getReviews(app) {
var url = rssBaseURL + "page=" + app.page + "/id=" + app.id + "/sortBy=mostRecent/json";
console.log("%s(%d), page %d: %s", app.name, app.id, app.page, url);
rest.get(url).on('success', function(result) {
data = JSON.parse(result);
//console.dir(data, {depth:null});
entrie... | {
cleanFile("logs/"+apps[i].id+"-all-"+timestamp+".txt");
cleanFile("logs/"+apps[i].id+"-negative-"+timestamp+".txt");
cleanFile("logs/"+apps[i].id+"-positive-"+timestamp+".txt");
apps[i].page = 1;
ignoresReg = new RegExp(apps[i].ignores, "gi");
console.log(ignoresReg);
apps[i].ignoresReg = ignoresReg;
... | conditional_block |
parse-rss.js | var config = require('config');
var rest = require('restler');
var fs = require("fs");
var dateformat = require("dateformat");
var jsonfile = require("jsonfile");
var rssBaseURL = config.get('rssBaseURL');
var apps = config.get('apps');
var maxPage = config.get('maxPage');
var now = new Date()
var timestamp = datefor... | (app, text, rating) {
allReviews = "logs/"+app.id+"-all-"+timestamp+".txt";
fs.appendFileSync(allReviews, text + "\n");
if (rating < 3) {
reviews = "logs/"+app.id+"-negative-"+timestamp+".txt";
} else {
reviews = "logs/"+app.id+"-positive-"+timestamp+".txt";
}
fs.appendFileSync(reviews, text + "\n")... | printText | identifier_name |
parse-rss.js | var config = require('config');
var rest = require('restler');
var fs = require("fs");
var dateformat = require("dateformat");
var jsonfile = require("jsonfile");
var rssBaseURL = config.get('rssBaseURL');
var apps = config.get('apps');
var maxPage = config.get('maxPage');
var now = new Date()
var timestamp = datefor... | app.stats.ratings[rating]++;
if (app.page < maxPage) {
app.page++;
getReviews(app);
} else {
printStats(app);
}
}
});
}
function cleanFile(file) {
if (fs.existsSync(file)) {
fs.unlinkSync(file);
}
}
function printStats(app) {
jsonfile.writeFile("logs/"+a... | printText(app, text, rating); | random_line_split |
class.AbstractEditor.js | ("editor:close", function(){
Event.stopObserving(document, "keydown", this.keyObs);
}.bind(this));
}
if(this.actions.get("closeButton")){
this.actions.get("closeButton").observe("click", function(){
hideLightBox(true);
}.bind(this) );
if(this.editorOptions.context.setCloseValidation)... | random_line_split | ||
class.AbstractEditor.js | , link);
if(link.getAttribute('access_key')){
var aK = link.getAttribute('access_key');
if(Event[aK]) aK = Event[aK];
this.registeredActions.set(aK, link.id);
if(!(!isNaN(parseFloat(aK)) && isFinite(aK))) title += " (" + aK + ")";
}
link.setAttribute("title", title);
}, t... | {
dContent = $$('.dialogContent')[0];
w = parseInt(dContent.getWidth())+'px';
} | conditional_block | |
main.rs | extern crate iron;
extern crate rustc_serialize;
extern crate queryst;
use rustc_serialize::json::{self, Json};
use iron::prelude::*;
use iron::status;
use queryst::parse;
#[derive(RustcEncodable)]
pub struct PadJson {
str: String
}
fn left_pad(string: &str, len: u32, ch: &str) -> String {
let mut i ... |
fn main() {
fn handler(req: &mut Request) -> IronResult<Response> {
let query = req.url.query.clone().unwrap_or("".to_string());
let query_params: Json = parse(&query.to_string()).unwrap();
let obj = query_params.as_object().unwrap();
let string : &str = obj.get("s... | i = i + 1;
}
return padded_string;
} | random_line_split |
main.rs | extern crate iron;
extern crate rustc_serialize;
extern crate queryst;
use rustc_serialize::json::{self, Json};
use iron::prelude::*;
use iron::status;
use queryst::parse;
#[derive(RustcEncodable)]
pub struct PadJson {
str: String
}
fn left_pad(string: &str, len: u32, ch: &str) -> String {
let mut i ... | (req: &mut Request) -> IronResult<Response> {
let query = req.url.query.clone().unwrap_or("".to_string());
let query_params: Json = parse(&query.to_string()).unwrap();
let obj = query_params.as_object().unwrap();
let string : &str = obj.get("str").unwrap().as_string().u... | handler | identifier_name |
main.rs | extern crate iron;
extern crate rustc_serialize;
extern crate queryst;
use rustc_serialize::json::{self, Json};
use iron::prelude::*;
use iron::status;
use queryst::parse;
#[derive(RustcEncodable)]
pub struct PadJson {
str: String
}
fn left_pad(string: &str, len: u32, ch: &str) -> String {
let mut i ... |
Iron::new(handler).http("localhost:3000").unwrap();
}
| {
let query = req.url.query.clone().unwrap_or("".to_string());
let query_params: Json = parse(&query.to_string()).unwrap();
let obj = query_params.as_object().unwrap();
let string : &str = obj.get("str").unwrap().as_string().unwrap();
let len : u32 = obj.get... | identifier_body |
base.ts | import {
RegistrationType,
IDynamicDependency,
Factory,
Initializer,
Disposer
} from './common'
import { IContainer } from '../../build'
import { OwnerType, ScopeType } from '../../common'
export interface IRegistrationBase {
id: string
service: {}
factory?: Factory<{}>
... | params: {}[]
container?: IContainer
instance?: {}
registrationType?: RegistrationType
isLazy: boolean
dependenciesValue: IDynamicDependency[]
cloneFor: (container: IContainer) => IRegistrationBase
clone: () => IRegistrationBase
copyDependency: (dependency: IDynamicDependency)... | owner: OwnerType
initializer?: Initializer<{}>
disposer?: Disposer<{}>
args: {}[]
| random_line_split |
C.py | #!/usr/bin/python
#
# Problem: Making Chess Boards
# Language: Python
# Author: KirarinSnow
# Usage: python thisfile.py <input.in >output.out
from heapq import *
def process(r1, r2, c1, c2):
for i in range(r1, r2):
for j in range(c1, c2):
if 0 <= i < m and 0 <= j < n:
if g[i]... |
for case in range(int(raw_input())):
m, n = map(int, raw_input().split())
v = [eval('0x'+raw_input()) for i in range(m)]
g = map(lambda x: map(lambda y: (x>>y)%2, range(n)[::-1]), v)
s = [[1 for i in range(n)] for j in range(m)]
q = []
... | if 0 <= i < m and 0 <= j < n:
g[i][j] = None | conditional_block |
C.py | #!/usr/bin/python
#
# Problem: Making Chess Boards
# Language: Python
# Author: KirarinSnow
# Usage: python thisfile.py <input.in >output.out
from heapq import *
def process(r1, r2, c1, c2):
for i in range(r1, r2):
for j in range(c1, c2):
if 0 <= i < m and 0 <= j < n: | elif i == 0 or j == 0:
s[i][j] = 1
elif g[i-1][j] != g[i][j] and g[i][j-1] != g[i][j] and \
g[i-1][j-1] == g[i][j]:
s[i][j] = 1 + min(s[i-1][j], s[i][j-1], s[i-1][j-1])
else:
s[i][j] = 1
... | if g[i][j] == None:
s[i][j] = 0 | random_line_split |
C.py | #!/usr/bin/python
#
# Problem: Making Chess Boards
# Language: Python
# Author: KirarinSnow
# Usage: python thisfile.py <input.in >output.out
from heapq import *
def process(r1, r2, c1, c2):
|
def clear(r1, r2, c1, c2):
for i in range(r1, r2):
for j in range(c1, c2):
if 0 <= i < m and 0 <= j < n:
g[i][j] = None
for case in range(int(raw_input())):
m, n = map(int, raw_input().split())
v = [eval('0x'+raw_input()) for i in range(m)]
g = map(... | for i in range(r1, r2):
for j in range(c1, c2):
if 0 <= i < m and 0 <= j < n:
if g[i][j] == None:
s[i][j] = 0
elif i == 0 or j == 0:
s[i][j] = 1
elif g[i-1][j] != g[i][j] and g[i][j-1] != g[i][j] and \
... | identifier_body |
C.py | #!/usr/bin/python
#
# Problem: Making Chess Boards
# Language: Python
# Author: KirarinSnow
# Usage: python thisfile.py <input.in >output.out
from heapq import *
def process(r1, r2, c1, c2):
for i in range(r1, r2):
for j in range(c1, c2):
if 0 <= i < m and 0 <= j < n:
if g[i]... | (r1, r2, c1, c2):
for i in range(r1, r2):
for j in range(c1, c2):
if 0 <= i < m and 0 <= j < n:
g[i][j] = None
for case in range(int(raw_input())):
m, n = map(int, raw_input().split())
v = [eval('0x'+raw_input()) for i in range(m)]
g = map(lambda x: m... | clear | identifier_name |
CharactersController.js | var Character = require('../models/character');
function charactersIndex(req, res){
Character.find({}, function(err, characters){
if (err) return res.status(404).json({ message: "Error while finding characters." });
res.status(200).json({ characters: characters });
});
}
function characterCreate(req, res)... |
function characterUpdate(req, res){
Character.findById(req.params.id, function(err, character){
if (!character) return res.status(404).json({ message: "Character not found."});
if (err) return res.status(500).json({ message: err });
character.String = req.body.String || chara... | {
Character.findById(req.params.id, function(err, character){
if (!character) return res.status(404).json({ message: "Character not found."});
if (err) return res.status(500).json({ message: err });
res.status(200).json({ character: character });
});
} | identifier_body |
CharactersController.js | var Character = require('../models/character');
function charactersIndex(req, res){
Character.find({}, function(err, characters){
if (err) return res.status(404).json({ message: "Error while finding characters." });
res.status(200).json({ characters: characters });
});
}
function characterCreate(req, res)... | character.save(function(err){
if (err) return res.status(200).json({ message: "Unable to save character." + err });
res.status(201).json(character);
});
}
function characterShow(req, res){
Character.findById(req.params.id, function(err, character){
if (!character) return res.status(404).json({ messag... | kFrequency : req.body.kFrequency,
kTraditionalVariant : req.body.kTraditionalVariant
});
| random_line_split |
CharactersController.js | var Character = require('../models/character');
function charactersIndex(req, res){
Character.find({}, function(err, characters){
if (err) return res.status(404).json({ message: "Error while finding characters." });
res.status(200).json({ characters: characters });
});
}
function | (req, res){
if (!req.body.String || !req.body.kMandarin || !req.body.kDefinition){
return res.status(400).json({ message: "String, kMandarin, and kDefinition are required fields." });
}
var character = new Character({
String : req.body.String,
kMandarin : req.body.kMandarin,
... | characterCreate | identifier_name |
impl-not-adjacent-to-type.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
pub x: i32,
pub y: i32,
}
}
impl foo::Point {
fn x(&self) -> i32 { self.x }
}
fn main() {
assert_eq!((foo::Point { x: 1, y: 3}).x(), 1);
}
| Point | identifier_name |
impl-not-adjacent-to-type.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | fn x(&self) -> i32 { self.x }
}
fn main() {
assert_eq!((foo::Point { x: 1, y: 3}).x(), 1);
} | pub y: i32,
}
}
impl foo::Point { | random_line_split |
impl-not-adjacent-to-type.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
assert_eq!((foo::Point { x: 1, y: 3}).x(), 1);
} | identifier_body | |
instruction_analyzer.rs | //! Implements Instruction-level analysis used for lifting when information from radare2 is
//! insufficient.
//!
//! Instruction analysis may be abbreviated as `IA`
use std::borrow::Cow;
use capstone_rust::capstone as cs;
// TODO: Register must be replaced by Register information from arch-rs.
// This will be a part... |
/// Return a `Vec` of registers that are written to by this instruction
fn registers_written(&self) -> Vec<&IOperand> {
self.info().expect("Unable to get InstructionInfo").writes.iter().filter(|&x| match x {
&IOperand::Register(_) => true,
_ => false,
}).collect()
}... | {
self.info().expect("Unable to get InstructionInfo").reads.iter().filter(|&x| match x {
&IOperand::Register(_) => true,
_ => false,
}).collect()
} | identifier_body |
instruction_analyzer.rs | //! Implements Instruction-level analysis used for lifting when information from radare2 is
//! insufficient.
//!
//! Instruction analysis may be abbreviated as `IA`
use std::borrow::Cow;
use capstone_rust::capstone as cs;
// TODO: Register must be replaced by Register information from arch-rs.
// This will be a part... | (&self) -> bool {
self.info().expect("Unable to get InstructionInfo").writes.iter().any(|x| match x {
&IOperand::Memory { base: _, index: _, scale: _, disp: _ } => true,
_ => false,
})
}
/// Returns memory written to by the instruction, in standard sib form
fn memor... | has_memory_written | identifier_name |
instruction_analyzer.rs | //! Implements Instruction-level analysis used for lifting when information from radare2 is
//! insufficient.
//!
//! Instruction analysis may be abbreviated as `IA`
use std::borrow::Cow;
use capstone_rust::capstone as cs;
// TODO: Register must be replaced by Register information from arch-rs.
// This will be a part... | Err(e) => return Err(Cow::from(e.to_string())),
};
for instr in buf.iter() {
// TODO: Look into prefixes for opcode.
// See how this information is set in capstone.
self.info.mnemonic = Cow::from(instr.mnemonic);
let details = instr.detail.unw... | fn analyze(&mut self) -> Result<(), IAError> {
// Disassembly exactly one instruction
let buf = match self.cs.disasm(self.bytes.as_slice(), 0x0, 1) {
Ok(d) => d, | random_line_split |
CacheService.ts | import {Inject, Injectable, extended, REST_TYPE} from "TinyDecorations";
import {Cacheable, Cached, CacheEvict, CachePut} from "Cache";
import {IPromise, IQService, ITimeoutService} from "angular";
import Restable = extended.Restable;
import Rest = extended.Rest;
export const STANDARD_CACHE_KEY = "StandardCache";
expo... | }
@Cacheable()
cacheablePromise(instr: string): IPromise<any> {
var deferred = this.$q.defer();
this.cacheableCallCnt++;
this.cacheablePutVale = instr;
deferred.resolve(instr);
return deferred.promise;
}
@Cacheable()
cacheable2(instr: string): string {... | random_line_split | |
CacheService.ts | import {Inject, Injectable, extended, REST_TYPE} from "TinyDecorations";
import {Cacheable, Cached, CacheEvict, CachePut} from "Cache";
import {IPromise, IQService, ITimeoutService} from "angular";
import Restable = extended.Restable;
import Rest = extended.Rest;
export const STANDARD_CACHE_KEY = "StandardCache";
expo... | {
basicPutValue!: string;
cacheablePutVale!: string;
cacheableCallCnt: number = 0;
constructor(@Inject("$q") private $q: IQService,@Inject("$timeout") private $timeout: ITimeoutService) {
}
@CachePut()
@Rest({
url: "/myRequest",
method: REST_TYPE.GET,
decorator... | CacheService | identifier_name |
CacheService.ts | import {Inject, Injectable, extended, REST_TYPE} from "TinyDecorations";
import {Cacheable, Cached, CacheEvict, CachePut} from "Cache";
import {IPromise, IQService, ITimeoutService} from "angular";
import Restable = extended.Restable;
import Rest = extended.Rest;
export const STANDARD_CACHE_KEY = "StandardCache";
expo... |
} | {
} | identifier_body |
tpl.js | /**
* Adapted from the official plugin text.js
*
* Uses UnderscoreJS micro-templates : http://documentcloud.github.com/underscore/#template
* @author Julien Cabanès <julien@zeeagency.com>
* @version 0.2
*
* @license RequireJS text 0.24.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
* Avail... | };
xhr.send(null);
};
} else if (typeof process !== "undefined" &&
process.versions &&
!!process.versions.node) {
//Using special require.nodeRequire, something added by r.js.
fs = require.nodeRequire('fs');
get = function (url, callback) {
c... |
callback(xhr.responseText);
}
| conditional_block |
tpl.js | /**
* Adapted from the official plugin text.js
*
* Uses UnderscoreJS micro-templates : http://documentcloud.github.com/underscore/#template
* @author Julien Cabanès <julien@zeeagency.com>
* @version 0.2
*
* @license RequireJS text 0.24.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
* Avail... | 'with(obj||{}){__p.push(\'' +
str.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'")
.replace(c.interpolate, function(match, code) {
return "'," + code.replace(/\\'/g, "'") + ",'";
})
.replace(c.evaluate || null, function(match, code) {
return "');" ... | var c = templateSettings;
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' + | random_line_split |
struct.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-Z... | // http://rust-lang.org/COPYRIGHT.
// | random_line_split |
struct.rs | // Copyright 2013 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 pair = Pair { x: 1, y: 2 };
let _z = ();
} | identifier_body | |
struct.rs | // Copyright 2013 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 ... | {
x: int,
y: int
}
fn main() {
let pair = Pair { x: 1, y: 2 };
let _z = ();
}
| Pair | identifier_name |
Transition.ts | import { Demo } from "./Demo"
/**
* 遷移パラメータ
*/
export interface Transition {
/**
* 表示中のページの種類
*/
pageType: string;
/**
* 現在の試聴音源データソースの種類
*/
currentDemoSource: string;
/**
* 1ページあたりの表示数
*/
displayPerPage: number;
/**
* 検索文字列
*/
searchText: st... | currentEventId: number;
/**
* 選択から除外するサークルスペース頭文字
*/
excludeInitials: string[];
/**
* お気に入りだけを表示するかどうか
*/
isFavoriteOnly: boolean;
/**
* 現在のページ数
*/
currentPage: number;
} | * 現在の即売会ID
*/ | random_line_split |
DocumentTitle.tsx | import { ReactElement } from 'react';
import * as React from 'react';
import store from '../Store';
import { push } from 'react-router-redux';
interface Props {
/**
* 要显示的标题内容
*/
title: string;
}
/**
* 修改文档标题组件
*/
export default class extends React.Component<Props> {
/**
* 初始化时根据props中的t... | return React.Children.only(this.props.children);
} else {
//没有则什么也不显示
return null;
}
}
} | render() {
if (this.props.children) {
//如果标签之间有内容则显示内容 | random_line_split |
DocumentTitle.tsx | import { ReactElement } from 'react';
import * as React from 'react';
import store from '../Store';
import { push } from 'react-router-redux';
interface Props {
/**
* 要显示的标题内容
*/
title: string;
}
/**
* 修改文档标题组件
*/
export default class extends React.Component<Props> {
/**
* 初始化时根据props中的t... | ly(this.props.children);
} else {
//没有则什么也不显示
return null;
}
}
} | identifier_body | |
DocumentTitle.tsx | import { ReactElement } from 'react';
import * as React from 'react';
import store from '../Store';
import { push } from 'react-router-redux';
interface Props {
/**
* 要显示的标题内容
*/
title: string;
}
/**
* 修改文档标题组件
*/
export default class extends React.Component<Props> {
/**
* 初始化时根据props中的t... | else {
//没有则什么也不显示
return null;
}
}
} | conditional_block | |
DocumentTitle.tsx | import { ReactElement } from 'react';
import * as React from 'react';
import store from '../Store';
import { push } from 'react-router-redux';
interface Props {
/**
* 要显示的标题内容
*/
title: string;
}
/**
* 修改文档标题组件
*/
export default class extends React.Component<Props> {
/**
* 初始化时根据props中的t... | nextProps.title || 'CC98论坛';
document.title = title;
}
}
render() {
if (this.props.children) {
//如果标签之间有内容则显示内容
return React.Children.only(this.props.children);
} else {
//没有则什么也不显示
return null;
}
}
} | const title = | identifier_name |
gravity.rs | extern crate nalgebra as na;
extern crate ncollide;
extern crate nphysics;
extern crate nphysics_testbed2d;
use na::{Vec2, Pnt3, Translation};
use ncollide::shape::{Ball, Plane};
use nphysics::world::World;
use nphysics::object::RigidBody;
use nphysics_testbed2d::Testbed;
fn main() | */
let mut rb = RigidBody::new_static(Plane::new(Vec2::new(0.0, -1.0)), 0.3, 0.6);
rb.append_translation(&Vec2::new(0.0, 10.0));
world.add_body(rb);
/*
* Create the balls
*/
let num = 1000usize;
let rad = 0.5;
let shift = 2.5 * rad;
let centerx = shift * (num ... | {
let mut testbed = Testbed::new_empty();
/*
* World
*/
let mut world = World::new();
world.set_gravity(Vec2::new(0.0, 9.81));
/*
* First plane
*/
let mut rb = RigidBody::new_static(Plane::new(Vec2::new(0.0, 1.0)), 0.3, 0.6);
rb.append_translation(&Vec2::new(0.0, -10.0... | identifier_body |
gravity.rs | extern crate nalgebra as na;
extern crate ncollide;
extern crate nphysics;
extern crate nphysics_testbed2d;
use na::{Vec2, Pnt3, Translation};
use ncollide::shape::{Ball, Plane};
use nphysics::world::World;
use nphysics::object::RigidBody;
use nphysics_testbed2d::Testbed;
fn | () {
let mut testbed = Testbed::new_empty();
/*
* World
*/
let mut world = World::new();
world.set_gravity(Vec2::new(0.0, 9.81));
/*
* First plane
*/
let mut rb = RigidBody::new_static(Plane::new(Vec2::new(0.0, 1.0)), 0.3, 0.6);
rb.append_translation(&Vec2::new(0.0, -1... | main | identifier_name |
gravity.rs | extern crate nalgebra as na;
extern crate ncollide;
extern crate nphysics;
extern crate nphysics_testbed2d;
use na::{Vec2, Pnt3, Translation};
use ncollide::shape::{Ball, Plane};
use nphysics::world::World;
use nphysics::object::RigidBody;
use nphysics_testbed2d::Testbed;
fn main() {
let mut testbed = Testbed::ne... | for j in 0usize .. 2 {
let x = i as f32 * 2.5 * rad - centerx;
let y = j as f32 * 2.5 * rad - centery * 2.0;
let mut rb = RigidBody::new_dynamic(Ball::new(rad), 1.0, 0.3, 0.6);
rb.append_translation(&Vec2::new(x, y));
let color;
if j ==... | let shift = 2.5 * rad;
let centerx = shift * (num as f32) / 2.0;
let centery = 2.0;
for i in (0usize .. num) { | random_line_split |
gravity.rs | extern crate nalgebra as na;
extern crate ncollide;
extern crate nphysics;
extern crate nphysics_testbed2d;
use na::{Vec2, Pnt3, Translation};
use ncollide::shape::{Ball, Plane};
use nphysics::world::World;
use nphysics::object::RigidBody;
use nphysics_testbed2d::Testbed;
fn main() {
let mut testbed = Testbed::ne... |
let body = world.add_body(rb);
testbed.set_color(&body, color);
}
}
/*
* Run the simulation.
*/
testbed.set_world(world);
testbed.run();
}
| {
// double the gravity for the green balls.
rb.set_lin_acc_scale(Vec2::new(0.0, 2.0));
color = Pnt3::new(0.0, 1.0, 0.0);
} | conditional_block |
IC7443.py | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=2>
# Usage of IC 7443
# <codecell>
from __future__ import print_function
from BinPy import *
# <codecell>
# Usage of IC 7443:
ic = IC_7443()
print(ic.__doc__)
# <codecell>
# The Pin configuration is:
inp = {8: 0, 12: 0, 13: 1, 14: 0, 15:... | ic.setIC(ic.run())
# Draw the final configuration
ic.drawIC()
# <codecell>
# Seting the outputs to the current IC configuration using --
# ic.setIC(ic.run()) --
ic.setIC(ic.run())
# Draw the final configuration
ic.drawIC()
# Run the IC
print (ic.run())
# <codecell>
# Connector Outputs
c = Connector()
# Set ... | # Seting the outputs to the current IC configuration using --
# ic.setIC(ic.run()) --\n
| random_line_split |
poly2wkt.py | #!/usr/bin/python
import sys
import argparse
def loopfile(polyfile):
polyline=''
with open(polyfile,'r') as f:
read_data = f.readlines()
f.close()
polylines = []
polyline = ""
countend = 0
# countpoly = 0
for l in read_data:
s = l.strip()
if len(s) > 1:
try:
x = ''
y = ''
... |
if out == "":
out = wkt
if (out is None):
out = wkt
if (args.outfile is not None):
with open(args.outfile,'w') as f:
f.write(out)
f.close()
if (args.silent == False):
print out
| out = "CREATE TABLE %s (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT);\n" % (tablename)
out += "SELECT AddGeometryColumn('%s', 'geom', 4326, 'POLYGON', 2);\n" % (tablename)
out += "INSERT INTO %s (geom) values (GeometryFromText('%s',4326));\n" % (tablename,wkt) | conditional_block |
poly2wkt.py | #!/usr/bin/python
import sys
import argparse
def loopfile(polyfile):
polyline=''
with open(polyfile,'r') as f:
read_data = f.readlines()
f.close()
polylines = []
polyline = ""
countend = 0
# countpoly = 0
for l in read_data:
s = l.strip()
if len(s) > 1:
try:
x = ''
y = ''
... |
parser = argparse.ArgumentParser(description='convert a .poly file in .wkt format')
parser.add_argument('infile', metavar='infile', type=str,
help='inputfile')
parser.add_argument('-o',dest='outfile', type=str,help='output file',default=None)
parser.add_argument('-i', '--insertsql', dest='sqlst... | polygon=""
if len(polylines) >0:
polygon = "POLYGON ("
for p in polylines:
polygon += p +","
polygon = polygon[0:len(polygon)-1]
polygon += ")"
return polygon | identifier_body |
poly2wkt.py | #!/usr/bin/python
import sys
import argparse
def loopfile(polyfile):
polyline=''
with open(polyfile,'r') as f:
read_data = f.readlines()
f.close()
polylines = []
polyline = ""
countend = 0
# countpoly = 0
for l in read_data:
s = l.strip()
if len(s) > 1:
try:
x = ''
y = ''
... | (polylines):
polygon=""
if len(polylines) >0:
polygon = "POLYGON ("
for p in polylines:
polygon += p +","
polygon = polygon[0:len(polygon)-1]
polygon += ")"
return polygon
parser = argparse.ArgumentParser(description='convert a .poly file in .wkt format')
par... | createwkt | identifier_name |
poly2wkt.py | #!/usr/bin/python
import sys
import argparse
def loopfile(polyfile):
polyline=''
with open(polyfile,'r') as f:
read_data = f.readlines()
f.close()
polylines = []
polyline = ""
countend = 0
# countpoly = 0
for l in read_data:
s = l.strip()
if len(s) > 1:
try:
x = ''
y = ''
... | pass
if len(s) == 1:
polyline = "("
# countpoly += 1
# if countpoly == 1:
# polyline = "POLYGON (("
#
# else:
# polyline = "POLYGON (("
if s == "END":
countend += 1
if (countend%2) == 1:
polyline = polyline[0:le... | y = v
polyline += x + " " + y + ","
except ValueError: | random_line_split |
options_wnd.ts | _) {
void Option_.all_[key as keyof AllowedOptions].onSave_()
}
nextTick_((): void => { document.documentElement!.classList.remove("loading") })
void isVApiReady_.then(disconnect_)
location.hash && nextTick_(window.onhashchange as () => void)
enableNextTick_(kReadyInfo.NONE, kReadyInfo.LOCK);
Option_.a... | {
event.preventDefault();
} | conditional_block | |
options_wnd.ts | ["onclick"] = function (this: HTMLElement): void {
const target = $("#" + (this.dataset as KnownOptionsDataset).autoResize)
let height = target.scrollHeight, width = target.scrollWidth, dw = width - target.clientWidth;
if (height <= target.clientHeight && dw <= 0) { return; }
const maxWidth = Math.max(M... |
})(_ref);
if (OnEdge) {
nextTick_((tipForNoShadow): void => {
tipForNoShadow.innerHTML = '(On Edge, may need "<kbd>#VimiumUI</kbd>" as prefix if no Shadow DOM)';
}, $("#tipForNoShadow"));
}
nextTick_((): void => { setTimeout((): void => {
const ref2 = $$("[data-href]")
for (let _i = ref2... | {
const el = this.querySelector("[data-permission]") as TextElement | null;
this.onclick = null as never;
if (!el) { return; }
const key = (el.dataset as KnownOptionsDataset).permission
el.placeholder = oTrans_("lackPermission", [key ? `: "${key}"` : ""]);
} | identifier_body |
options_wnd.ts | ["onclick"] = function (this: HTMLElement): void {
const target = $("#" + (this.dataset as KnownOptionsDataset).autoResize)
let height = target.scrollHeight, width = target.scrollWidth, dw = width - target.clientWidth;
if (height <= target.clientHeight && dw <= 0) { return; }
const maxWidth = Math.max(M... | (this: HTMLElement): void {
const el = this.querySelector("[data-permission]") as TextElement | null;
this.onclick = null as never;
if (!el) { return; }
const key = (el.dataset as KnownOptionsDataset).permission
el.placeholder = oTrans_("lackPermission", [key ? `: "${key}"` : ""]);
}
... | onclick | identifier_name |
options_wnd.ts | ["onclick"] = function (this: HTMLElement): void {
const target = $("#" + (this.dataset as KnownOptionsDataset).autoResize)
let height = target.scrollHeight, width = target.scrollWidth, dw = width - target.clientWidth;
if (height <= target.clientHeight && dw <= 0) { return; }
const maxWidth = Math.max(M... |
if (OnChrome && Build.MinCVer < BrowserVer.MinEnsuredWebkitUserSelectAll
&& CurCVer_ < BrowserVer.MinEnsuredWebkitUserSelectAll) {
_ref = $$(".sel-all");
func = function (this: HTMLElement, event): void {
if (event.target !== this) { return; }
event.preventDefault();
getSelection().selectAllChi... | } as ElementWithDelay["onclick"];
_ref = $$("[data-delay]");
for (let _i = _ref.length; 0 <= --_i; ) {
_ref[_i].onclick = func;
} | random_line_split |
suggestionsObservable.js | (function() {
'use strict';
var module = angular.module('offerFormDirective');
module.factory('requestSuggestions', ['$http', function($http) {
return function(args) {
return Rx.Observable.fromPromise(
$http.post('/api/v1/restaurants/' + args.restaurantID + '/offer_suggestions', {
ti... | title: title,
};
});
})
.filter(R.propSatisfies(R.complement(R.isNil), 'suggestions'))
.filter(R.complement(onlySuggestionSelected))
.map(R.prop('suggestions'));
};
}]);
})(); | .map(function(suggestions) {
return {
suggestions: suggestions, | random_line_split |
suggestionsObservable.js | (function() {
'use strict';
var module = angular.module('offerFormDirective');
module.factory('requestSuggestions', ['$http', function($http) {
return function(args) {
return Rx.Observable.fromPromise(
$http.post('/api/v1/restaurants/' + args.restaurantID + '/offer_suggestions', {
ti... | (args) {
var suggestions = args.suggestions;
var title = args.title;
return suggestions.length == 1 && suggestions[0].title === title;
}
module.factory('suggestionsObservable', ['requestSuggestions', function(requestSuggestions) {
return function(args) {
var titleObservable = args.titleObserv... | onlySuggestionSelected | identifier_name |
suggestionsObservable.js | (function() {
'use strict';
var module = angular.module('offerFormDirective');
module.factory('requestSuggestions', ['$http', function($http) {
return function(args) {
return Rx.Observable.fromPromise(
$http.post('/api/v1/restaurants/' + args.restaurantID + '/offer_suggestions', {
ti... |
module.factory('suggestionsObservable', ['requestSuggestions', function(requestSuggestions) {
return function(args) {
var titleObservable = args.titleObservable;
var restaurantID = args.restaurantID;
var scheduler = args.scheduler || Rx.Scheduler.default;
return titleObservable
... | {
var suggestions = args.suggestions;
var title = args.title;
return suggestions.length == 1 && suggestions[0].title === title;
} | identifier_body |
mobile-result.component.ts | import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Currency, Image } from 'app/api/models';
import { FormatService } from 'app/core/format.service';
import { truthyAttr } from 'app/shared/helper';
import { LayoutService } from 'app/core/layout.service';
/**
* Has some optional... | (
private format: FormatService,
public layout: LayoutService) {
}
ngOnInit() {
this.hasAvatar = !!this.avatarImage || !!this.avatarIcon;
this.hasAmount = !!this.amount;
this.mainClass = this.hasAvatar ? 'col-9 col-xs-10' : 'col-12';
if (this.hasAvatar) {
this.avatarClass = 'col-3 col... | constructor | identifier_name |
mobile-result.component.ts | import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Currency, Image } from 'app/api/models';
import { FormatService } from 'app/core/format.service';
import { truthyAttr } from 'app/shared/helper';
import { LayoutService } from 'app/core/layout.service';
/**
* Has some optional... |
if (this.hasAmount) {
this.amountClass = {
amount: true,
'p-0': true,
positive: this.amountColor && this.format.isPositive(this.amount),
negative: this.amountColor && this.format.isNegative(this.amount),
};
}
}
}
| {
this.avatarClass = 'col-3 col-xs-2 avatar';
} | conditional_block |
mobile-result.component.ts | import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Currency, Image } from 'app/api/models';
import { FormatService } from 'app/core/format.service';
import { truthyAttr } from 'app/shared/helper';
import { LayoutService } from 'app/core/layout.service';
/**
* Has some optional... | this.hasAmount = !!this.amount;
this.mainClass = this.hasAvatar ? 'col-9 col-xs-10' : 'col-12';
if (this.hasAvatar) {
this.avatarClass = 'col-3 col-xs-2 avatar';
}
if (this.hasAmount) {
this.amountClass = {
amount: true,
'p-0': true,
positive: this.amountColor && ... | random_line_split | |
mobile-result.component.ts | import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Currency, Image } from 'app/api/models';
import { FormatService } from 'app/core/format.service';
import { truthyAttr } from 'app/shared/helper';
import { LayoutService } from 'app/core/layout.service';
/**
* Has some optional... |
ngOnInit() {
this.hasAvatar = !!this.avatarImage || !!this.avatarIcon;
this.hasAmount = !!this.amount;
this.mainClass = this.hasAvatar ? 'col-9 col-xs-10' : 'col-12';
if (this.hasAvatar) {
this.avatarClass = 'col-3 col-xs-2 avatar';
}
if (this.hasAmount) {
this.amountClass = {
... | {
} | identifier_body |
generator.js | var _ = require("underscore-keypath");
var path = require("path");
var cli = require("cli");
var model = require("./parts/lib/model");
var Handlebars = require("handlebars");
var fs = require("fs");
var moment = require("moment");
var model = require("./parts/lib/model");
var template = Handlebars.compile(fs.readFileS... |
else{
contents = contents.concat(["/**"], lines, ["*/"]);
}
});
return contents.join("\n");
});
function Generator(options){
this.options = options;
return this;
}
Generator.prototype = {
generate : function(){
var me = this;
model.prefix = this.options.fieldPrefix;
model.fieldStyle = this.option... | {
contents = contents.concat("/**" + lines[0] + " */");
} | conditional_block |
generator.js | var _ = require("underscore-keypath");
var path = require("path");
var cli = require("cli");
var model = require("./parts/lib/model");
var Handlebars = require("handlebars");
var fs = require("fs");
var moment = require("moment");
var model = require("./parts/lib/model");
var template = Handlebars.compile(fs.readFileS... | }
else{
contents = contents.concat(["/**"], lines, ["*/"]);
}
});
return contents.join("\n");
});
function Generator(options){
this.options = options;
return this;
}
Generator.prototype = {
generate : function(){
var me = this;
model.prefix = this.options.fieldPrefix;
model.fieldStyle = this.opt... | if(lines.length == 1){
contents = contents.concat("/**" + lines[0] + " */"); | random_line_split |
generator.js | var _ = require("underscore-keypath");
var path = require("path");
var cli = require("cli");
var model = require("./parts/lib/model");
var Handlebars = require("handlebars");
var fs = require("fs");
var moment = require("moment");
var model = require("./parts/lib/model");
var template = Handlebars.compile(fs.readFileS... |
Generator.prototype = {
generate : function(){
var me = this;
model.prefix = this.options.fieldPrefix;
model.fieldStyle = this.options.fieldStyle;
var generator = require(path.join(__dirname, "parts", this.options.type));
_(this.options.inputs).each(function(each){
generator.process.call(me, each);
... | {
this.options = options;
return this;
} | identifier_body |
generator.js | var _ = require("underscore-keypath");
var path = require("path");
var cli = require("cli");
var model = require("./parts/lib/model");
var Handlebars = require("handlebars");
var fs = require("fs");
var moment = require("moment");
var model = require("./parts/lib/model");
var template = Handlebars.compile(fs.readFileS... | (options){
this.options = options;
return this;
}
Generator.prototype = {
generate : function(){
var me = this;
model.prefix = this.options.fieldPrefix;
model.fieldStyle = this.options.fieldStyle;
var generator = require(path.join(__dirname, "parts", this.options.type));
_(this.options.inputs).each(fun... | Generator | identifier_name |
mod.rs | use std::io;
use cfg_if::cfg_if;
use socket2::Socket;
cfg_if! {
if #[cfg(unix)] {
mod unix;
pub use self::unix::*;
}
}
#[cfg(unix)]
pub fn | <S>(socket: &S, ipv6_only: bool) -> io::Result<()>
where
S: std::os::unix::io::AsRawFd,
{
use std::os::unix::io::{FromRawFd, IntoRawFd};
let fd = socket.as_raw_fd();
let sock = unsafe { Socket::from_raw_fd(fd) };
let result = sock.set_only_v6(ipv6_only);
sock.into_raw_fd();
result
}
#[cfg(... | set_ipv6_only | identifier_name |
mod.rs | use std::io;
use cfg_if::cfg_if;
use socket2::Socket;
cfg_if! {
if #[cfg(unix)] {
mod unix;
pub use self::unix::*;
}
}
#[cfg(unix)]
pub fn set_ipv6_only<S>(socket: &S, ipv6_only: bool) -> io::Result<()>
where
S: std::os::unix::io::AsRawFd,
{
use std::os::unix::io::{FromRawFd, IntoRawF... |
#[cfg(windows)]
pub fn set_ipv6_only<S>(socket: &S, ipv6_only: bool) -> io::Result<()>
where
S: std::os::windows::io::AsRawSocket,
{
use std::os::windows::io::{FromRawSocket, IntoRawSocket};
let handle = socket.as_raw_socket();
let sock = unsafe { Socket::from_raw_socket(handle) };
let result = so... | result
} | random_line_split |
mod.rs | use std::io;
use cfg_if::cfg_if;
use socket2::Socket;
cfg_if! {
if #[cfg(unix)] {
mod unix;
pub use self::unix::*;
}
}
#[cfg(unix)]
pub fn set_ipv6_only<S>(socket: &S, ipv6_only: bool) -> io::Result<()>
where
S: std::os::unix::io::AsRawFd,
|
#[cfg(windows)]
pub fn set_ipv6_only<S>(socket: &S, ipv6_only: bool) -> io::Result<()>
where
S: std::os::windows::io::AsRawSocket,
{
use std::os::windows::io::{FromRawSocket, IntoRawSocket};
let handle = socket.as_raw_socket();
let sock = unsafe { Socket::from_raw_socket(handle) };
let result = s... | {
use std::os::unix::io::{FromRawFd, IntoRawFd};
let fd = socket.as_raw_fd();
let sock = unsafe { Socket::from_raw_fd(fd) };
let result = sock.set_only_v6(ipv6_only);
sock.into_raw_fd();
result
} | identifier_body |
feed_parse_extractMajimeHomeBlog.py | def | (item):
'''
Parser for 'majime.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterous', 'oel'... | extractMajimeHomeBlog | identifier_name |
feed_parse_extractMajimeHomeBlog.py | def extractMajimeHomeBlog(item):
| ('Manowa', 'Manowa Mamono Taosu Nouryoku Ubau Watashi Tsuyokunaru', 'translated'),
('Cat ', 'Me and My Beloved Cat (Girlfriend)', 'translated'),
]
for prefix, series, tl_type in chp_prefixes:
if item['title'].lower().startswith(prefix.lower()):
re... | '''
Parser for 'majime.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterous', 'oel'),
]
f... | identifier_body |
feed_parse_extractMajimeHomeBlog.py | def extractMajimeHomeBlog(item):
'''
Parser for 'majime.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loitero... |
return False | turn buildReleaseMessageWithType(item, series, vol, chp, frag=frag, postfix=postfix, tl_type=tl_type)
| conditional_block |
feed_parse_extractMajimeHomeBlog.py | def extractMajimeHomeBlog(item):
'''
Parser for 'majime.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower(): |
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterous', 'oel'),
]
for tagname, name, tl_type in tagmap:
if tagname in item['tags']:
return buildReleaseMessageWithType(item, name, vol, chp, frag=frag, postfix=postfix, tl_type=tl_type)
if item['tags'] ... | return None | random_line_split |
preload.js | // Generated by CoffeeScript 1.10.0
(function() {
var preloaded,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
preloaded = [];
| var i, img, len, results;
if (typeof images === 'string') {
images = [images];
}
results = [];
for (i = 0, len = images.length; i < len; i++) {
img = images[i];
if (indexOf.call(preloaded, img) >= 0) {
continue;
}
$('<img />').attr('src', img).hide().appendTo('b... | arcs.preload = function(images) { | random_line_split |
CanvasDisplay.ts | import {Display} from "./display";
const DISPLAY_WIDTH = 64;
const DISPLAY_HEIGHT = 32;
const EMPTY_FILL_COLOR = 'black';
const PIXEL_COLOR = 'yellow';
export default class CanvasDisplay implements Display{
private frameBuffer: Array<Array<number>> = [];
private screen = document.querySelector('canvas') as H... |
drawPixel(x: number, y: number, value: number): number {
this.frameBuffer[y][x] ^= value
if (this.frameBuffer[y][x]) {
this.context.fillStyle = PIXEL_COLOR;
this.context.fillRect(
x * this.screenSizeMultiplier,
y * this.screenSizeMultiplier,... | {
this.initializeDisplay();
this.context.fillStyle = EMPTY_FILL_COLOR
this.context.fillRect(
0,
0,
this.screen.width,
this.screen.height
)
} | identifier_body |
CanvasDisplay.ts | import {Display} from "./display";
const DISPLAY_WIDTH = 64;
const DISPLAY_HEIGHT = 32;
const EMPTY_FILL_COLOR = 'black';
const PIXEL_COLOR = 'yellow';
export default class CanvasDisplay implements Display{
private frameBuffer: Array<Array<number>> = [];
private screen = document.querySelector('canvas') as H... | (): void {
const newFrameBuffer: Array<Array<number>> = [];
for (let i = 0; i < DISPLAY_WIDTH; i++) {
newFrameBuffer.push([]);
for (let j = 0; j < DISPLAY_HEIGHT; j++) {
newFrameBuffer[i].push(0);
}
}
this.frameBuffer = newFrameBuffe... | initializeDisplay | identifier_name |
CanvasDisplay.ts | import {Display} from "./display";
const DISPLAY_WIDTH = 64;
const DISPLAY_HEIGHT = 32;
const EMPTY_FILL_COLOR = 'black';
const PIXEL_COLOR = 'yellow';
export default class CanvasDisplay implements Display{
private frameBuffer: Array<Array<number>> = [];
private screen = document.querySelector('canvas') as H... |
}
this.frameBuffer = newFrameBuffer;
}
}
| {
newFrameBuffer[i].push(0);
} | conditional_block |
CanvasDisplay.ts | import {Display} from "./display";
const DISPLAY_WIDTH = 64;
const DISPLAY_HEIGHT = 32;
const EMPTY_FILL_COLOR = 'black';
const PIXEL_COLOR = 'yellow';
export default class CanvasDisplay implements Display{
| private screen = document.querySelector('canvas') as HTMLCanvasElement;
private context = this.screen.getContext('2d') as CanvasRenderingContext2D;
private screenSizeMultiplier = 15;
constructor() {
this.screen.width = DISPLAY_WIDTH * this.screenSizeMultiplier;
this.screen.height = DISP... | private frameBuffer: Array<Array<number>> = []; | random_line_split |
ModuleLoader.ts | import {Observer} from '@enbock/state-value-observer/ValueObserver';
import React from 'react';
interface LoadedModuleDictionary {
[name: string]: typeof React.Component,
}
export default class ModuleLoader {
moduleState: Observer<typeof React.Component | null>;
dictionary: LoadedModuleDictionary;
pathToRoot:... | else {
module = this.dictionary[modulePath];
}
this.moduleState.value = module;
}
}
| {
const filePath = (this.pathToRoot + modulePath + '.js').replace('.././', '../');
module = (await import(filePath)).default as typeof React.Component;
this.dictionary[modulePath] = module;
} | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.