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
WorkerClient.js
const JSONRPC = { Client: require("../Client") }; /** * Extend this class to link to extra worker RPC APIs on the master. */ class WorkerClient extends JSONRPC.Client
/** * @returns {never} */ async gracefulExit() { return this.rpc("gracefulExit", [], /*bNotification*/ true); } /** * This works as an internal router to a JSONRPC.Server's endpoints, used as libraries. * * Proxies RPC requests directly into potentially an internet facing JSONRPC.Server'...
{
random_line_split
WorkerClient.js
const JSONRPC = { Client: require("../Client") }; /** * Extend this class to link to extra worker RPC APIs on the master. */ class
extends JSONRPC.Client { /** * @returns {never} */ async gracefulExit() { return this.rpc("gracefulExit", [], /*bNotification*/ true); } /** * This works as an internal router to a JSONRPC.Server's endpoints, used as libraries. * * Proxies RPC requests directly into potentially an int...
WorkerClient
identifier_name
test_memoize_1.py
import argparse import parsl from parsl.app.app import python_app from parsl.tests.configs.local_threads import config @python_app(cache=True) def random_uuid(x, cache=True): import uuid return str(uuid.uuid4()) def test_python_memoization(n=2): """Testing python memoization disable """ x = ran...
x = test_python_memoization(n=4)
parsl.set_stream_logger()
conditional_block
test_memoize_1.py
import argparse import parsl from parsl.app.app import python_app from parsl.tests.configs.local_threads import config @python_app(cache=True) def
(x, cache=True): import uuid return str(uuid.uuid4()) def test_python_memoization(n=2): """Testing python memoization disable """ x = random_uuid(0) print(x.result()) for i in range(0, n): foo = random_uuid(0) print(foo.result()) assert foo.result() == x.result(), ...
random_uuid
identifier_name
test_memoize_1.py
import argparse import parsl from parsl.app.app import python_app from parsl.tests.configs.local_threads import config @python_app(cache=True) def random_uuid(x, cache=True): import uuid return str(uuid.uuid4()) def test_python_memoization(n=2):
if __name__ == '__main__': parsl.clear() parsl.load(config) parser = argparse.ArgumentParser() parser.add_argument("-c", "--count", default="10", help="Count of apps to launch") parser.add_argument("-d", "--debug", action='store_true', help="Count ...
"""Testing python memoization disable """ x = random_uuid(0) print(x.result()) for i in range(0, n): foo = random_uuid(0) print(foo.result()) assert foo.result() == x.result(), "Memoized results were not used"
identifier_body
test_memoize_1.py
import argparse import parsl from parsl.app.app import python_app from parsl.tests.configs.local_threads import config @python_app(cache=True) def random_uuid(x, cache=True): import uuid return str(uuid.uuid4()) def test_python_memoization(n=2): """Testing python memoization disable """ x = ran...
parsl.set_stream_logger() x = test_python_memoization(n=4)
if args.debug:
random_line_split
jquery.fancytree.persist.js
List, mode, dfd) { var i, key, l, node, foundOne = false, expandOpts = tree.options.persist.expandOpts, deferredList = [], missingKeyList = []; keyList = keyList || []; dfd = dfd || $.Deferred(); for (i = 0, l = keyList.length; i < l; i++) { key = keyList[i]; node = tree.getNodeByKe...
{ // nothing to do dfd = new $.Deferred().resolve(); }
conditional_block
jquery.fancytree.persist.js
.get, set: function(key, value) { Cookies.set(key, value, this.options.persist.cookie); }, remove: Cookies.remove, }; } else if ($ && typeof $.cookie === "function") { // Fall back to https://github.com/carhartl/jquery-cookie cookieStore = { get: $.cookie, set: function(key, value) { $.coo...
"_loadLazyNodes: " + node + " is lazy: loading..." ); if (mode === "expand") { deferredList.push(node.setExpanded(true, expandOpts)); } else { deferredList.push(node.load()); } } else { tree.debug("_loadLazyNodes: " + node + " already loaded."); node.setExpanded(true,...
{ var i, key, l, node, foundOne = false, expandOpts = tree.options.persist.expandOpts, deferredList = [], missingKeyList = []; keyList = keyList || []; dfd = dfd || $.Deferred(); for (i = 0, l = keyList.length; i < l; i++) { key = keyList[i]; node = tree.getNodeByKey(key); if (no...
identifier_body
jquery.fancytree.persist.js
.get, set: function(key, value) { Cookies.set(key, value, this.options.persist.cookie); }, remove: Cookies.remove, }; } else if ($ && typeof $.cookie === "function") { // Fall back to https://github.com/carhartl/jquery-cookie cookieStore = { get: $.cookie, set: function(key, value) { $.coo...
* @alias Fancytree#getPersistData * @requires jquery.fancytree.persist.js */ $.ui.fancytree._FancytreeClass.prototype.getPersistData = function() { var local = this.ext.persist, prefix = local.cookiePrefix, delim = local.cookieDelimiter, res = {}; res[ACTIVE] = local._data(prefix + ACTIVE); res[E...
* [ext-persist] Return persistence information from cookies * * Called like * $.ui.fancytree.getTree("#tree").getPersistData(); *
random_line_split
jquery.fancytree.persist.js
.get, set: function(key, value) { Cookies.set(key, value, this.options.persist.cookie); }, remove: Cookies.remove, }; } else if ($ && typeof $.cookie === "function") { // Fall back to https://github.com/carhartl/jquery-cookie cookieStore = { get: $.cookie, set: function(key, value) { $.coo...
(tree, local, keyList, mode, dfd) { var i, key, l, node, foundOne = false, expandOpts = tree.options.persist.expandOpts, deferredList = [], missingKeyList = []; keyList = keyList || []; dfd = dfd || $.Deferred(); for (i = 0, l = keyList.length; i < l; i++) { key = keyList[i]; node =...
_loadLazyNodes
identifier_name
Canvas.js
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.drawing.manager.Canvas"]){ //_hasResource checks added by build. Do not use _hasResource direc...
else if(dojox.gfx.renderer == "silverlight"){ this.id = this.domNode.firstChild.id }else{ //this.gfxSurface.rawNode.id = this.id; } this.underlay = this.gfxSurface.createGroup(); this.surface = this.gfxSurface.createGroup(); this.overlay = this.gfxSurface.createGroup(); t...
{ //this.gfxSurface.rawNode.parentNode.id = this.id; }
conditional_block
Canvas.js
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.drawing.manager.Canvas"]){ //_hasResource checks added by build. Do not use _hasResource direc...
if(this.width>this.parentWidth){ this.height -= sw; } this.mouse.resize(this.width,this.height); this.gfxSurface.setDimensions(this.width, this.height); this.domNode.parentNode.scrollTop = scrolly || 0; this.domNode.parentNode.scrollLeft = scrollx || 0; if(this.useSc...
this.width -= sw; }
random_line_split
audits.controller.js
'use strict'; angular.module('ontimeApp') .controller('AuditsController', function ($scope, $filter, AuditsService) { $scope.onChangeDate = function () { var dateFormat = 'yyyy-MM-dd'; var fromDate = $filter('date')($scope.fromDate, dateFormat); var toDate = $filter('dat...
$scope.fromDate = fromDate; }; $scope.today(); $scope.previousMonth(); $scope.onChangeDate(); });
{ fromDate = new Date(fromDate.getFullYear(), fromDate.getMonth() - 1, fromDate.getDate()); }
conditional_block
audits.controller.js
'use strict'; angular.module('ontimeApp')
var toDate = $filter('date')($scope.toDate, dateFormat); AuditsService.findByDates(fromDate, toDate).then(function (data) { $scope.audits = data; }); }; // Date picker configuration $scope.today = function () { // Today + 1 day - ...
.controller('AuditsController', function ($scope, $filter, AuditsService) { $scope.onChangeDate = function () { var dateFormat = 'yyyy-MM-dd'; var fromDate = $filter('date')($scope.fromDate, dateFormat);
random_line_split
_nova.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
endpoint_override=nova_url) return c def novaclient(request, version=None): if isinstance(version, api_versions.APIVersion): version = version.get_string() return cached_novaclient(request, version) def get_novaclient_with_instance_desc(request): microversion = ge...
( username, token_id, project_id, project_domain_id, nova_url, auth_url ) = get_auth_params_from_request(request) if version is None: version = VERSIONS.get_active_version()['version'] c = nova_client.Client(version, username...
identifier_body
_nova.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
(request, version=None): ( username, token_id, project_id, project_domain_id, nova_url, auth_url ) = get_auth_params_from_request(request) if version is None: version = VERSIONS.get_active_version()['version'] c = nova_client.Client(version, ...
cached_novaclient
identifier_name
_nova.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
elif hasattr(self.image, 'name'): return self.image.name elif 'name' in self.image: return self.image['name'] else: try: image = glance.image_get(self.request, self.image['id']) self.image['name'] = image.name r...
return None
conditional_block
_nova.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
min_ver, max_ver = api_versions._get_server_version_range(client) return (microversions.get_microversion_for_features( 'nova', features, api_versions.APIVersion, min_ver, max_ver)) def get_auth_params_from_request(request): """Extracts properties needed by novaclient call from the request object. ...
random_line_split
auth-route-guard.ts
import { Injectable } from '@angular/core'; import { PermissionCheckerService } from 'abp-ng2-module'; import { AppSessionService } from '../session/app-session.service'; import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router'; @Injectable()...
if (this._permissionChecker.isGranted('Pages.Users')) { return '/app/admin/users'; } return '/app/home'; } }
{ return '/account/login'; }
conditional_block
auth-route-guard.ts
import { Injectable } from '@angular/core';
import { PermissionCheckerService } from 'abp-ng2-module'; import { AppSessionService } from '../session/app-session.service'; import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router'; @Injectable() export class AppRouteGuard implements CanAc...
random_line_split
auth-route-guard.ts
import { Injectable } from '@angular/core'; import { PermissionCheckerService } from 'abp-ng2-module'; import { AppSessionService } from '../session/app-session.service'; import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router'; @Injectable()...
implements CanActivate, CanActivateChild { constructor( private _permissionChecker: PermissionCheckerService, private _router: Router, private _sessionService: AppSessionService, ) { } canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { if (!t...
AppRouteGuard
identifier_name
project.service.ts
import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/throw'; import { Project } from '../models/project'; import {...
public GetInfo(infoKey: string): Observable<Info> { return this.http.get(`/api/projects/info/${infoKey}`, this.options) .map(response => response.json() as Info) .catch(error => Observable.throw(error)); } public GetAllProjects(): Observable<Project[]> { return this....
this.headers = new Headers({ 'Content-Type': 'application/json' }); this.options = new RequestOptions({ headers: this.headers }); }
identifier_body
project.service.ts
import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/throw'; import { Project } from '../models/project'; import {...
headers: Headers; options: RequestOptions; constructor(private http: Http) { this.headers = new Headers({ 'Content-Type': 'application/json' }); this.options = new RequestOptions({ headers: this.headers }); } public GetInfo(infoKey: string): Observable<Info> { return this.h...
@Injectable() export class ProjectService {
random_line_split
project.service.ts
import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/throw'; import { Project } from '../models/project'; import {...
rojectId: string): Observable<Project> { return this.http.get(`/api/projects/${projectId}`, this.options) .map(response => response.json() as Project) .catch(error => Observable.throw(error)); } public SaveProject(apiKey: string, project: Project): Observable<Project> { ...
tProject(p
identifier_name
servers.py
from src.tools.dictionaries import PostLoadedDict # Utility class ################################################ class ServerImplementationDict(PostLoadedDict): def __missing__(self, key): try: return super().__missing__(key) except KeyError: return NotImplemented ########...
# provided by the server loader # CONSTANTS (STRINGS, BOOLEANS, INTS, ETC.) @property def name(self): return self.__data['str_name'] @property def internal_shortname(self): return self.__data['str_shortname'] @property def beta(self): r...
def __init__(self, shortname, loader): # Not preloaded # loaders must produce dictionaries (or an appropriate iterable) # with the required keys. # The reason for this is that code for certain servers need not be loaded # if it's not going to be used at all # It also prev...
identifier_body
servers.py
from src.tools.dictionaries import PostLoadedDict # Utility class ################################################ class ServerImplementationDict(PostLoadedDict): def __missing__(self, key): try: return super().__missing__(key) except KeyError: return NotImplemented ########...
@property def Auth(self): # I really don't know how to call this. return self.__data['cls_auth'] @property def auth_fields(self): return self.__data['list_authkeys'] # 2- Server Elements: @property def Player(self): return self.__data['cls_player'] ...
# CLASSES # 1- Credentials:
random_line_split
servers.py
from src.tools.dictionaries import PostLoadedDict # Utility class ################################################ class ServerImplementationDict(PostLoadedDict): def
(self, key): try: return super().__missing__(key) except KeyError: return NotImplemented ################################################ class Server(): def __init__(self, shortname, loader): # Not preloaded # loaders must produce dictionaries (or an appro...
__missing__
identifier_name
subst_output.rs
// Test substitutions involving only the outputs of the function. extern crate crucible; use crucible::*; use crucible::method_spec::{MethodSpec, MethodSpecBuilder, clobber_globals}; fn f(x: u8) -> (u8, u8) { (x, x + 1) } fn f_spec() -> MethodSpec { let x = <u8>::symbolic("x"); let mut msb = MethodSpecBu...
#[crux_test] fn use_f() { f_spec().enable(); let a = u8::symbolic("a"); crucible_assume!(0 < a && a < 10); let (b0, b1) = f(a); crucible_assert!(b0 == a); crucible_assert!(b1 == b0 + 1); }
msb.gather_asserts(); msb.finish() }
random_line_split
subst_output.rs
// Test substitutions involving only the outputs of the function. extern crate crucible; use crucible::*; use crucible::method_spec::{MethodSpec, MethodSpecBuilder, clobber_globals}; fn f(x: u8) -> (u8, u8) { (x, x + 1) } fn f_spec() -> MethodSpec { let x = <u8>::symbolic("x"); let mut msb = MethodSpecBu...
() { f_spec().enable(); let a = u8::symbolic("a"); crucible_assume!(0 < a && a < 10); let (b0, b1) = f(a); crucible_assert!(b0 == a); crucible_assert!(b1 == b0 + 1); }
use_f
identifier_name
subst_output.rs
// Test substitutions involving only the outputs of the function. extern crate crucible; use crucible::*; use crucible::method_spec::{MethodSpec, MethodSpecBuilder, clobber_globals}; fn f(x: u8) -> (u8, u8) { (x, x + 1) } fn f_spec() -> MethodSpec { let x = <u8>::symbolic("x"); let mut msb = MethodSpecBu...
{ f_spec().enable(); let a = u8::symbolic("a"); crucible_assume!(0 < a && a < 10); let (b0, b1) = f(a); crucible_assert!(b0 == a); crucible_assert!(b1 == b0 + 1); }
identifier_body
DkBygningDa.py
from Monument import Monument, Dataset import importer_utils as utils import importer as importer
if self.has_non_empty_attribute("kommune"): if utils.count_wikilinks(self.kommune) == 1: adm_location = utils.q_from_first_wikilink("da", self.kommune) self.add_statement("located_adm", adm_location) def set_location(self): """ Set location based ...
class DkBygningDa(Monument): def set_adm_location(self):
random_line_split
DkBygningDa.py
from Monument import Monument, Dataset import importer_utils as utils import importer as importer class DkBygningDa(Monument): def set_adm_location(self): if self.has_non_empty_attribute("kommune"): if utils.count_wikilinks(self.kommune) == 1: adm_location = utils.q_from_first...
def set_monuments_all_id(self): """Map monuments_all ID to fields in this table.""" self.monuments_all_id = "{!s}-{!s}-{!s}".format( self.kommunenr, self.ejendomsnr, self.bygningsnr) def __init__(self, db_row_dict, mapping, data_files, existing): Monument.__init__(self, db...
self.add_statement( "inception", utils.package_time({"year": inception}))
conditional_block
DkBygningDa.py
from Monument import Monument, Dataset import importer_utils as utils import importer as importer class DkBygningDa(Monument): def set_adm_location(self): if self.has_non_empty_attribute("kommune"): if utils.count_wikilinks(self.kommune) == 1: adm_location = utils.q_from_first...
(self): """ Set location based on 'by' column. If there's one wikilinked item, confirm that the corresponding WD item is of a type that's a subclass of 'human settlement', using query results downloaded by importer. If not wikilinked, check if there's a dawp arti...
set_location
identifier_name
DkBygningDa.py
from Monument import Monument, Dataset import importer_utils as utils import importer as importer class DkBygningDa(Monument): def set_adm_location(self): if self.has_non_empty_attribute("kommune"): if utils.count_wikilinks(self.kommune) == 1: adm_location = utils.q_from_first...
def __init__(self, db_row_dict, mapping, data_files, existing): Monument.__init__(self, db_row_dict, mapping, data_files, existing) self.set_monuments_all_id() self.update_labels() self.exists("da") self.set_commonscat() self.set_image("billede") self.set_co...
"""Map monuments_all ID to fields in this table.""" self.monuments_all_id = "{!s}-{!s}-{!s}".format( self.kommunenr, self.ejendomsnr, self.bygningsnr)
identifier_body
runserver.py
from __future__ import unicode_literals import errno import os import re import socket import sys from datetime import datetime from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError from django.core.servers.basehttp import get_internal_wsgi_applicati...
if not self.addr: self.addr = '::1' if self.use_ipv6 else '127.0.0.1' self._raw_ipv6 = bool(self.use_ipv6) self.run(**options) def run(self, **options): """ Runs the server, using the autoreloader if needed """ use_reloader = options.get('use...
raise CommandError('"%s" is not a valid IPv6 address.' % self.addr)
conditional_block
runserver.py
from __future__ import unicode_literals import errno import os import re import socket import sys from datetime import datetime from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError from django.core.servers.basehttp import get_internal_wsgi_applicati...
def handle(self, *args, **options): from django.conf import settings if not settings.DEBUG and not settings.ALLOWED_HOSTS: raise CommandError('You must set settings.ALLOWED_HOSTS if DEBUG is False.') self.use_ipv6 = options.get('use_ipv6') if self.use_ipv6 and not soc...
""" Returns the default WSGI handler for the runner. """ return get_internal_wsgi_application()
identifier_body
runserver.py
from __future__ import unicode_literals import errno import os import re import socket import sys from datetime import datetime from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError from django.core.servers.basehttp import get_internal_wsgi_applicati...
""" use_reloader = options.get('use_reloader') if use_reloader: autoreload.main(self.inner_run, None, options) else: self.inner_run(None, **options) def inner_run(self, *args, **options): from django.conf import settings from django.utils imp...
""" Runs the server, using the autoreloader if needed
random_line_split
runserver.py
from __future__ import unicode_literals import errno import os import re import socket import sys from datetime import datetime from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError from django.core.servers.basehttp import get_internal_wsgi_applicati...
(self, *args, **options): """ Returns the default WSGI handler for the runner. """ return get_internal_wsgi_application() def handle(self, *args, **options): from django.conf import settings if not settings.DEBUG and not settings.ALLOWED_HOSTS: raise Com...
get_handler
identifier_name
CoursesView.js
; define('views/courses/CoursesView', ['appframework', 'mustache', 'controllers/Courses', 'i18n!nls/courses', 'routers/coursesrouter'], (function ($, mustache, controller, courses, router) { var courseTemplate, currentSearch; var $coursesSearch, $courses; var doInit = function (data) { router.init(); ...
}, 150); } */ }); }; var doShowError = function (msg) { if (msg) { $.ui.popup(msg); } }; var doShowCourse = function (data) { var html = mustache.to_html(courseTemplate, data); $courses.html($courses.html() + html); }; var doClearCourses = function () { $courses...
setTimeout(function(){ $('body').addClass('moveDown');
random_line_split
CoursesView.js
; define('views/courses/CoursesView', ['appframework', 'mustache', 'controllers/Courses', 'i18n!nls/courses', 'routers/coursesrouter'], (function ($, mustache, controller, courses, router) { var courseTemplate, currentSearch; var $coursesSearch, $courses; var doInit = function (data) { router.init(); ...
else { $courses.unbind('tap', onCourseSelection); $coursesSearch.unbind('input', onCourseSearch); } }; var doShowLoader = function (status, message) { if (status) { $.ui.showMask(message || courses.loading); } else { $.ui.hideMask(); } }; var onCourseSelection = function (evt)...
{ $courses.bind('tap', onCourseSelection); $coursesSearch.bind('input', onCourseSearch); }
conditional_block
defaults.js
module.exports = { /** * number | Maxiumum number of files that UploadJs will allow to contain. */ max: Infinity, /** * object: { * key: array * } * defined grouping of file types for allowed_types by MIME type */ types: { images: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif']...
/** * string | The name of the parameter that each file is set as in the upload request. */ param: 'file', /** * object | Keyed object of additional parameters to send with the upload request. */ additionalParams: {}, /** * object | Keyed object of additional headers to send...
* string | The URL that is called when uploading a file */ url: '',
random_line_split
PyGenere.py
'G':2.015, 'H':6.094, 'I':6.996, 'J':0.153, 'K':0.772, 'L':4.025, 'M':2.406, 'N':6.749, 'O':7.507, 'P':1.929, 'Q':0.095, 'R':5.987, 'S':6.327, 'T':9.056, 'U':2.758, 'V':0.978, 'W':2.360, 'X':0.150, 'Y':1.974, 'Z':0.074, 'max_val':1...
sum = 0 for (k, v) in dictionary.items(): sum += (v - self.__lang_data[k])**2 return sum
identifier_body
PyGenere.py
c/frequency.html (English) http://www.characterfrequency.com/ (French, Italian, Portuguese, Spanish) http://www.santacruzpl.org/readyref/files/g-l/ltfrqger.shtml (German) """ # Unless otherwise specified, test for codewords between (and including) # these two lengths: __default_min_codeword_len...
elif self.__lang == 'FR': self.__lang_data = self.__french_data elif self.__lang == 'IT': self.__lang_data = self.__italian_data elif self.__lang == 'PT': self.__lang_data = self.__portuguese_data else: self.__lang = 'EN' return se...
self.__lang_data = self.__spanish_data
conditional_block
PyGenere.py
c/frequency.html (English) http://www.characterfrequency.com/ (French, Italian, Portuguese, Spanish) http://www.santacruzpl.org/readyref/files/g-l/ltfrqger.shtml (German) """ # Unless otherwise specified, test for codewords between (and including) # these two lengths: __default_min_codeword_len...
'A':12.09, 'B':1.21, 'C':4.20, 'D':4.65, 'E':13.89, 'F':0.642, 'G':1.11, 'H':1.13, 'I':6.38, 'J':0.461, 'K':0.038, 'L':5.19, 'M':2.86, 'N':7.23, 'O':9.58, 'P':2.74, 'Q':1.37, 'R':6.14, 'S':7.43, 'T':4.49, 'U':4...
'U':4.05, 'V':1.55, 'W':0.0104, 'X':0.272, 'Y':0.0165, 'Z':0.400, 'max_val':13.89, 'kappa':0.0745 } __spanish_data = {
random_line_split
PyGenere.py
(self, key): """Encipher input (plaintext) using the Vigenere cipher and return it (ciphertext).""" ciphertext = [] k = 0 n = len(key) for i in range(len(self)): p = self[i] if p.isalpha(): ciphertext.append(chr((ord(p) + ord( ...
encipher
identifier_name
ServerSocketEvent.ts
import { LoggerTimer } from 'logger-timer'; import { ServerEventName, IPlayer } from '../interfaces'; import { Game } from '../../server/core/game/game'; import { Player } from './entity'; export class ServerSocketEvent { protected timer: LoggerTimer; protected get playerName(): string { return this.socket.p...
} protected gameMessage(err: string) { this.emit(ServerEventName.GameMessage, { message: err }); } protected socketAddress() { return this.socket.request.headers['x-forwarded-for']; } protected setPlayer(player: IPlayer) { if(!player) { this.socket.playerName = null; return; }...
this.emit(ServerEventName.GameMessage, { message: err, type: 'danger' }); } protected gameWarning(err: string) { this.emit(ServerEventName.GameMessage, { message: err, type: 'warning' });
random_line_split
ServerSocketEvent.ts
import { LoggerTimer } from 'logger-timer'; import { ServerEventName, IPlayer } from '../interfaces'; import { Game } from '../../server/core/game/game'; import { Player } from './entity'; export class ServerSocketEvent { protected timer: LoggerTimer; protected get playerName(): string { return this.socket....
this.socket.playerName = player.name; } constructor(protected game: Game, private socket) { } }
{ this.socket.playerName = null; return; }
conditional_block
ServerSocketEvent.ts
import { LoggerTimer } from 'logger-timer'; import { ServerEventName, IPlayer } from '../interfaces'; import { Game } from '../../server/core/game/game'; import { Player } from './entity'; export class ServerSocketEvent { protected timer: LoggerTimer; protected get playerName(): string { return this.socket....
(err: string) { this.emit(ServerEventName.GameMessage, { message: err, type: 'success' }); } protected gameError(err: string) { this.emit(ServerEventName.GameMessage, { message: err, type: 'danger' }); } protected gameWarning(err: string) { this.emit(ServerEventName.GameMessage, { message: err, ty...
gameSuccess
identifier_name
ServerSocketEvent.ts
import { LoggerTimer } from 'logger-timer'; import { ServerEventName, IPlayer } from '../interfaces'; import { Game } from '../../server/core/game/game'; import { Player } from './entity'; export class ServerSocketEvent { protected timer: LoggerTimer; protected get playerName(): string { return this.socket....
constructor(protected game: Game, private socket) { } }
{ if(!player) { this.socket.playerName = null; return; } this.socket.playerName = player.name; }
identifier_body
test_pqr.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # MDAnalysis --- http://www.mdanalysis.org # Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # ...
u.atoms.total_charge(), self.ref_charmm_totalcharge, 3, "Total charge (in CHARMM) does not match expected value.") class TestPQRWriterMissingAttrs(object): # pqr requires names, resids, resnames, segids, radii, charges def setUp(self): self.reqd_attributes = ['names', 'resids', ...
assert_almost_equal(
random_line_split
test_pqr.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # MDAnalysis --- http://www.mdanalysis.org # Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # ...
(self): try: os.unlink(self.outfile) except OSError: pass del self.tmpdir del self.outfile del self.reqd_attributes @staticmethod def assert_writing_warns(u, outfile): # write the test universe, and check warning is raised assert_w...
tearDown
identifier_name
test_pqr.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # MDAnalysis --- http://www.mdanalysis.org # Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # ...
attrs = self.reqd_attributes attrs.remove('charges') u = make_Universe(attrs, trajectory=True) self.assert_writing_warns(u, self.outfile) u2 = mda.Universe(self.outfile) assert_(all(u2.atoms.charges == 0.0))
identifier_body
GuardianOfElune.js
import { t } from '@lingui/macro'; import { formatPercentage } from 'common/format'; import SPELLS from 'common/SPELLS'; import { SpellLink } from 'interface'; import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer'; import Events from 'parser/core/Events'; import BoringSpellValue from 'parser/ui/BoringSpellVa...
suggestions(when) { const unusedGoEProcs = 1 - this.consumedGoEProc / this.GoEProcsTotal; when(unusedGoEProcs) .isGreaterThan(0.3) .addSuggestion((suggest, actual, recommended) => suggest( <span> You wasted {formatPercentage(unusedGoEProcs)}% of your{' '} ...
} }
random_line_split
GuardianOfElune.js
import { t } from '@lingui/macro'; import { formatPercentage } from 'common/format'; import SPELLS from 'common/SPELLS'; import { SpellLink } from 'interface'; import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer'; import Events from 'parser/core/Events'; import BoringSpellValue from 'parser/ui/BoringSpellVa...
(when) { const unusedGoEProcs = 1 - this.consumedGoEProc / this.GoEProcsTotal; when(unusedGoEProcs) .isGreaterThan(0.3) .addSuggestion((suggest, actual, recommended) => suggest( <span> You wasted {formatPercentage(unusedGoEProcs)}% of your{' '} <SpellLink i...
suggestions
identifier_name
GuardianOfElune.js
import { t } from '@lingui/macro'; import { formatPercentage } from 'common/format'; import SPELLS from 'common/SPELLS'; import { SpellLink } from 'interface'; import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer'; import Events from 'parser/core/Events'; import BoringSpellValue from 'parser/ui/BoringSpellVa...
const GoETimeframe = this.lastGoEProcTime + GOE_DURATION; if (event.timestamp > GoETimeframe) { this.nonGoEIronFur += 1; } else { this.consumedGoEProc += 1; this.GoEIronFur += 1; debug && console.log(`Guardian of Elune Proc Consumed / Timestamp: ${event.timestamp}`); ...
{ this.nonGoEIronFur += 1; return; }
conditional_block
progress-http.service.d.ts
import { Http, RequestOptionsArgs, RequestOptions, Request, Response, ConnectionBackend } from "@angular/http"; import { Observable } from "rxjs/Observable"; import { HttpWithDownloadProgressListener, HttpWithUploadProgressListener, Progress } from "./interfaces"; import { XHRBackendFactory } from "./XHRBackendFactory"...
extends Http implements HttpWithUploadProgressListener, HttpWithDownloadProgressListener { private xhrBackendFactory; private requestOptions; private httpFactory; private _uploadCallback; private _downloadCallback; private http; constructor(xhrBackendFactory: XHRBackendFactory, requestOptio...
ProgressHttp
identifier_name
progress-http.service.d.ts
import { Http, RequestOptionsArgs, RequestOptions, Request, Response, ConnectionBackend } from "@angular/http"; import { Observable } from "rxjs/Observable"; import { HttpWithDownloadProgressListener, HttpWithUploadProgressListener, Progress } from "./interfaces"; import { XHRBackendFactory } from "./XHRBackendFactory"...
private http; constructor(xhrBackendFactory: XHRBackendFactory, requestOptions: RequestOptions, httpFactory: HttpFactory, backend: ConnectionBackend); request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>; withDownloadProgressListener(listener: (progress: Progress) => void):...
private httpFactory; private _uploadCallback; private _downloadCallback;
random_line_split
psqworker.py
#!/usr/bin/env python # Copyright 2015 Google 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...
if not path: path = os.getcwd() sys.path.insert(0, path) queue = import_queue(queue) import psq worker = psq.Worker(queue=queue) worker.listen() if __name__ == '__main__': main()
with open(os.path.expanduser(pid), "w") as f: f.write(str(os.getpid()))
conditional_block
psqworker.py
#!/usr/bin/env python # Copyright 2015 Google 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 import_queue(location): module, attr = location.rsplit('.', 1) module = import_module(module) queue = getattr(module, attr) if hasattr(queue, '__call__'): queue = queue() return queue @click.command() @click.option( '--path', '-p', help='Import path. By default, this is the ...
root_logger = logging.getLogger() root_logger.setLevel(logging.INFO) handler = logging.StreamHandler() formatter = ColoredFormatter( "%(log_color)s%(levelname)-8s%(reset)s %(asctime)s %(green)s%(name)s" "%(reset)s %(message)s", reset=True, log_colors={ 'DEBUG': ...
identifier_body
psqworker.py
#!/usr/bin/env python # Copyright 2015 Google 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...
worker.listen() if __name__ == '__main__': main()
worker = psq.Worker(queue=queue)
random_line_split
psqworker.py
#!/usr/bin/env python # Copyright 2015 Google 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...
(): # pragma: no cover root_logger = logging.getLogger() root_logger.setLevel(logging.INFO) handler = logging.StreamHandler() formatter = ColoredFormatter( "%(log_color)s%(levelname)-8s%(reset)s %(asctime)s %(green)s%(name)s" "%(reset)s %(message)s", reset=True, log_col...
setup_logging
identifier_name
user.rs
use diesel; use diesel::prelude::*; use diesel::pg::PgConnection; use lower; use regex::Regex; use rocket::http::Status; use rocket::response::Failure; use bcrypt::{hash, verify, DEFAULT_COST}; use std::time::SystemTime; use schema::users; #[derive(Queryable, Identifiable)] pub struct User { pub id: i64, pub ...
} } // Verifies the user's password pub fn authenticate(conn: &PgConnection, user: &User) -> Result<bool, Failure> { use schema::users::dsl::*; let result = users .filter(lower(username).eq(user.username.to_lowercase())) .first::<User>(conn); if re...
{ use diesel::prelude::*; match hash(&new_user.password[..], DEFAULT_COST) { Ok(hashed) => { new_user.password = hashed; } Err(e) => { println!("Errow while hasing a password: {}", e); return Err(Failure(Status::Interna...
identifier_body
user.rs
use diesel; use diesel::prelude::*; use diesel::pg::PgConnection; use lower; use regex::Regex; use rocket::http::Status; use rocket::response::Failure; use bcrypt::{hash, verify, DEFAULT_COST}; use std::time::SystemTime; use schema::users; #[derive(Queryable, Identifiable)] pub struct User { pub id: i64, pub ...
(conn: &PgConnection) -> Result<Vec<User>, Failure> { use diesel::prelude::*; use schema::users::dsl::*; let result = users.load::<User>(conn); match result { Ok(result) => Ok(result), Err(e) => { println!("Error while fetching the users: {}", e)...
all
identifier_name
user.rs
use diesel; use diesel::prelude::*; use diesel::pg::PgConnection; use lower; use regex::Regex; use rocket::http::Status; use rocket::response::Failure; use bcrypt::{hash, verify, DEFAULT_COST}; use std::time::SystemTime; use schema::users; #[derive(Queryable, Identifiable)] pub struct User { pub id: i64, pub ...
Err(_) => Ok(false), } } // Find & return a user by id pub fn find(conn: &PgConnection, user_id: i64) -> Result<User, Failure> { use diesel::prelude::*; use schema::users::dsl::*; let result = users.filter(id.eq(user_id)).first::<User>(conn); match resu...
match verify(&result.unwrap().password_hash[..], &user.password_hash[..]) { Ok(_) => Ok(true),
random_line_split
generic-form.component.spec.ts
/* * generic-form.component.spec.ts * Tests generic form. * Copyright 2018 Grzegorz Mrukwa
you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRAN...
Licensed under the Apache License, Version 2.0 (the "License");
random_line_split
generic-form.component.spec.ts
/* * generic-form.component.spec.ts * Tests generic form. * Copyright 2018 Grzegorz Mrukwa 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/LICEN...
getLayout(layoutUrl: string): any { return new Observable(observer => { if (layoutUrl !== someLayoutUrl) { observer.error('Layout URL is wrong.'); } observer.next(layout); observer.complete(); }); } } describe('GenericFormComponent', () => { let fetchService: GenericForm...
{ return new Observable(observer => { if (schemaUrl !== someSchemaUrl) { observer.error('Schema URL is wrong.'); } observer.next(schema); observer.complete(); }); }
identifier_body
generic-form.component.spec.ts
/* * generic-form.component.spec.ts * Tests generic form. * Copyright 2018 Grzegorz Mrukwa 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/LICEN...
observer.next(layout); observer.complete(); }); } } describe('GenericFormComponent', () => { let fetchService: GenericFormFetchService; let component: GenericFormComponent; let fixture: ComponentFixture<GenericFormComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ ...
{ observer.error('Layout URL is wrong.'); }
conditional_block
generic-form.component.spec.ts
/* * generic-form.component.spec.ts * Tests generic form. * Copyright 2018 Grzegorz Mrukwa 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/LICEN...
{ getSchema(schemaUrl: string): any { return new Observable(observer => { if (schemaUrl !== someSchemaUrl) { observer.error('Schema URL is wrong.'); } observer.next(schema); observer.complete(); }); } getLayout(layoutUrl: string): any { return new Observable(observer ...
MockFetchService
identifier_name
test_spatial_reference.py
# -*- coding: utf-8 -*- import pytest from numpy import array from numpy.testing import assert_array_almost_equal from gdal2mbtiles.constants import (EPSG_WEB_MERCATOR, EPSG3857_EXTENTS) from gdal2mbtiles.gdal import SpatialReference @pytest.fixture def epsg_3857_from_proj4(): ...
(epsg_3857_from_epsg): extents = epsg_3857_from_epsg.GetWorldExtents() extents = array(extents) assert_array_almost_equal(extents, EPSG3857_EXTENTS, decimal=3)
test_epsg_3857_from_epsg
identifier_name
test_spatial_reference.py
# -*- coding: utf-8 -*- import pytest from numpy import array from numpy.testing import assert_array_almost_equal from gdal2mbtiles.constants import (EPSG_WEB_MERCATOR,
EPSG3857_EXTENTS) from gdal2mbtiles.gdal import SpatialReference @pytest.fixture def epsg_3857_from_proj4(): """ Return a gdal spatial reference object with 3857 crs using the ImportFromProj4 method. """ spatial_ref = SpatialReference() spatial_ref.ImportFro...
random_line_split
test_spatial_reference.py
# -*- coding: utf-8 -*- import pytest from numpy import array from numpy.testing import assert_array_almost_equal from gdal2mbtiles.constants import (EPSG_WEB_MERCATOR, EPSG3857_EXTENTS) from gdal2mbtiles.gdal import SpatialReference @pytest.fixture def epsg_3857_from_proj4(): ...
def test_epsg_3857_proj4(epsg_3857_from_proj4): extents = epsg_3857_from_proj4.GetWorldExtents() extents = array(extents) assert_array_almost_equal(extents, EPSG3857_EXTENTS, decimal=3) def test_epsg_3857_from_epsg(epsg_3857_from_epsg): extents = epsg_3857_from_epsg.GetWorldExtents() extents = ...
""" Return a gdal spatial reference object with 3857 crs using the FromEPSG method. """ spatial_ref = SpatialReference.FromEPSG(EPSG_WEB_MERCATOR) return spatial_ref
identifier_body
tokens.rs
use files::dump; pub struct
<'a> { pub name: &'a str, pub range: (usize, usize), pub value: String, pub line_number: usize, } impl <'a> Token<'a> { #[allow(dead_code)] pub fn clone(&self) -> Token<'a> { Token { name: self.name.clone(), range: self.range.clone(), valu...
Token
identifier_name
tokens.rs
use files::dump; pub struct Token<'a> { pub name: &'a str, pub range: (usize, usize), pub value: String, pub line_number: usize, } impl <'a> Token<'a> { #[allow(dead_code)] pub fn clone(&self) -> Token<'a> { Token { name: self.name.clone(), range: se...
} fn format_for_print(&self, console_out: bool) -> String { // Create a String of 100 consecutive spaces let mut spaces = String::new(); for _ in (0..100) { spaces.push_str(" "); } // Spacing definitions let name_column_width = 30; ...
{ dump(file_path, lexed_token_string); }
conditional_block
tokens.rs
use files::dump; pub struct Token<'a> { pub name: &'a str, pub range: (usize, usize), pub value: String, pub line_number: usize, } impl <'a> Token<'a> { #[allow(dead_code)] pub fn clone(&self) -> Token<'a> { Token { name: self.name.clone(), range: se...
lexed_token_string.push_str(token.name); if name_pad_length > 0 { lexed_token_string.push_str(&spaces[..name_pad_length]); } else { lexed_token_string.push_str(" "); } // Line number lexed_token_string.push_str("ln:"); lexed_token_string.push_str(...
{ // Create a String of 100 consecutive spaces let mut spaces = String::new(); for _ in (0..100) { spaces.push_str(" "); } // Spacing definitions let name_column_width = 30; let line_number_column_width = 20; let mut lexed_token_strin...
identifier_body
tokens.rs
use files::dump; pub struct Token<'a> { pub name: &'a str, pub range: (usize, usize), pub value: String, pub line_number: usize, } impl <'a> Token<'a> { #[allow(dead_code)] pub fn clone(&self) -> Token<'a> { Token { name: self.name.clone(), range: se...
} lexed_token_string } }
if console_out { println!("\t{}\t{:?}\t{}", token.name, token.range, token.value); }
random_line_split
html5.py
""" A HTML5 target. """ from targets import _ from html import TYPE import html NAME = _('HTML5 page') EXTENSION = 'html' HEADER = """\ <!DOCTYPE html> <html> <head> <meta charset="%(ENCODING)s"> <title>%(HEADER1)s</title> <meta name="generator" content="http://txt2tags.org"> <link rel="stylesheet" href="%(STYLE)s"...
HTML5TAGS = { 'title1Open' : '<section~A~>\n<h1>\a</h1>' , 'title1Close' : '</section>' , 'title2Open' : '<section~A~>\n<h2>\a</h2>' , 'title2Close' : '</section>' , 'title3Open' : '<section~A~>\n<h3>\a</h3>' , 'title...
TAGS[tag] = TAGS[tag].lower()
conditional_block
html5.py
""" A HTML5 target. """ from targets import _ from html import TYPE import html NAME = _('HTML5 page') EXTENSION = 'html' HEADER = """\ <!DOCTYPE html> <html> <head> <meta charset="%(ENCODING)s"> <title>%(HEADER1)s</title> <meta name="generator" content="http://txt2tags.org"> <link rel="stylesheet" href="%(STYLE)s"...
TAGS.update(HTML5TAGS) RULES = html.RULES.copy() #Update the rules to use explicit <section> </section> tags HTML5RULES = { 'titleblocks' : 1, } RULES.update(HTML5RULES)
'tocOpen' : '<nav>' , 'tocClose' : '</nav>' , 'EOD' : '</article></body></html>' }
random_line_split
text.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="text-decoration" ...
% endif Ok(()) } } </%helpers:shorthand>
{ dest.write_str(" ")?; self.text_decoration_color.to_css(dest)?; }
conditional_block
text.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="text-decoration" ...
% if product == "gecko" or data.testing: if self.text_decoration_style != &text_decoration_style::SpecifiedValue::solid { dest.write_str(" ")?; self.text_decoration_style.to_css(dest)?; } if self.text_decoration_color....
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { self.text_decoration_line.to_css(dest)?;
random_line_split
text.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="text-decoration" ...
(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> { % if product == "gecko" or data.testing: let (mut line, mut style, mut color, mut any) = (None, None, None, false); % else: let (mut line, mut any) = (None, false); % endif loop { ...
parse_value
identifier_name
text.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="text-decoration" ...
parse_component!(line, text_decoration_line); % if product == "gecko" or data.testing: parse_component!(style, text_decoration_style); parse_component!(color, text_decoration_color); % endif break; } if !any { ...
{ % if product == "gecko" or data.testing: let (mut line, mut style, mut color, mut any) = (None, None, None, false); % else: let (mut line, mut any) = (None, false); % endif loop { macro_rules! parse_component { ($value:ident, $module...
identifier_body
htmltableheadercellelement.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::HTMLTableHeaderCellElementBinding; use dom::bindings::codegen::InheritTypes:...
prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTableHeaderCellElement> { let element = HTMLTableHeaderCellElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTableHeaderCellElementBinding::Wrap) } }
#[allow(unrooted_must_root)] pub fn new(localName: DOMString,
random_line_split
htmltableheadercellelement.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::HTMLTableHeaderCellElementBinding; use dom::bindings::codegen::InheritTypes:...
(&self) -> bool { *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element( ElementTypeId::HTMLElement( HTMLElementTypeId::HTMLTableCellElement( HTMLTabl...
is_htmltableheadercellelement
identifier_name
rom_fp256bn_64.rs
NLEN] = [ 0xEDE336303B9F8B, 0x92FFEE9FEC54E8, 0x13C1C063C55F79, 0xA12F2EAC0123FA, 0x8E559B2A, ]; pub const MCONST: Chunk = 0x6C964E0537E5E5; pub const CURVE_COF_I: isize = 1; pub const CURVE_A: isize = 0; pub const CURVE_B_I: isize = 3; pub const CURVE_B: [Chunk; NLEN] = [0x3, 0x0, 0x0, 0x0, 0x0];...
[ [0x5EB8061615001, 0xD1, 0x0, 0x0, 0x0], [ 0xAA5DACA05AA80C, 0x65FB1299921A8D, 0x5EEE71A4
0xFFFFFFFF, ], [0x5EB8061615002, 0xD1, 0x0, 0x0, 0x0], ],
random_line_split
iteratorCaller.js
'use strict'; const SwiftTransformStream = require('swift-transform').Transform; const pTry = require('p-try'); class IteratorCallerStream extends SwiftTransformStream { constructor(iterator, concurrency) { super({ objectMode: true, concurrency }); this._iterator = iterator; this._count =...
// ------------------------------------------------- _transform(data, encoding, callback) { data.index = this._count++; // eslint-disable-line no-plusplus // Execute the iterator // Note that the iterator can throw synchronously as well as return non-promise values pTry(() => ...
getCount() { return this._count; }
random_line_split
iteratorCaller.js
'use strict'; const SwiftTransformStream = require('swift-transform').Transform; const pTry = require('p-try'); class
extends SwiftTransformStream { constructor(iterator, concurrency) { super({ objectMode: true, concurrency }); this._iterator = iterator; this._count = 0; } getCount() { return this._count; } // ------------------------------------------------- _transform(data...
IteratorCallerStream
identifier_name
iteratorCaller.js
'use strict'; const SwiftTransformStream = require('swift-transform').Transform; const pTry = require('p-try'); class IteratorCallerStream extends SwiftTransformStream { constructor(iterator, concurrency) { super({ objectMode: true, concurrency }); this._iterator = iterator; this._count =...
} module.exports = function (iterator, concurrency) { return new IteratorCallerStream(iterator, concurrency); };
{ data.index = this._count++; // eslint-disable-line no-plusplus // Execute the iterator // Note that the iterator can throw synchronously as well as return non-promise values pTry(() => this._iterator(data)) // Invoke callback asyncronously so that errors are not swalled by th...
identifier_body
make_decoys.py
#!/usr/bin/env python ''' Copyright (C) 2015 The Regents of the University of California. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any late...
(self, fasta, outfile): super(Writer, self).__init__(fasta) self.outfile = outfile for spacers, metadata, sequence in self: while spacers: print(file=self.outfile) spacers -= 1 print(metadata, file=self.outfile) print(sequen...
__init__
identifier_name
make_decoys.py
#!/usr/bin/env python ''' Copyright (C) 2015 The Regents of the University of California. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any late...
''' Parses the given FASTA file in a generator method, yielding each new sequence and header to produce a new decoy ''' def __init__(self, fileobj): super(ParseFasta, self).__init__() self.fileobj = fileobj def __iter__(self): '''Yields the header and processed sequenc...
class ParseFasta(object):
random_line_split
make_decoys.py
#!/usr/bin/env python ''' Copyright (C) 2015 The Regents of the University of California. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any late...
def find_entry(self, remainder): '''Iterator yielding each seperate entry in a FASTA file''' spacers = 0 metadata = [] if remainder: metadata.append(remainder) remainder = '' sequence = [] for line in self.fileobj: line = line.s...
'''Generates an iterator which returns all the entries in the file''' remainder = '' while True: spacers, metadata, sequence, remainder = self.find_entry(remainder) if metadata: yield spacers, metadata, sequence else: break
identifier_body
make_decoys.py
#!/usr/bin/env python ''' Copyright (C) 2015 The Regents of the University of California. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any late...
elif line.startswith(('>',)) and not sequence: metadata.append(line) elif line.startswith(('>',)): # new scan. sequence info for previous already added remainder = line break else: sequence.append(lin...
spacers += 1
conditional_block
select_same_fill_color.py
# Sketch - A Python-based interactive drawing program # Copyright (C) 1999 by Bernhard Herzog # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at ...
# # CurrentProperties(): # # This document method returns the properties of the currently # selected object. If more than one objects are selected or no # object is selected or the selected object doesn't have # properties, a special property object EmptyProperties is # returned. # # ...
# the currently selected object. This is implemented as an advanced # script. It doesn't have to deal with undo because it only changes the # set of currently selected objects and not the objects themselves. # # Conceps and Methods:
random_line_split
select_same_fill_color.py
# Sketch - A Python-based interactive drawing program # Copyright (C) 1999 by Bernhard Herzog # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at ...
# register script import Sketch.Scripting Sketch.Scripting.AddFunction('select_same_fill_color', 'Select Same Fill Color', select_same_fill_color, script_type = Sketch.Scripting.AdvancedScript)
doc = context.document select = [] properties = doc.CurrentProperties() if properties.HasFill(): color = properties.fill_pattern.Color() layer = doc.ActiveLayer() doc.SelectNone() for obj in layer.GetObjects(): if obj.has_fill: prop = obj.Properti...
identifier_body
select_same_fill_color.py
# Sketch - A Python-based interactive drawing program # Copyright (C) 1999 by Bernhard Herzog # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at ...
(context): doc = context.document select = [] properties = doc.CurrentProperties() if properties.HasFill(): color = properties.fill_pattern.Color() layer = doc.ActiveLayer() doc.SelectNone() for obj in layer.GetObjects(): if obj.has_fill: prop...
select_same_fill_color
identifier_name
select_same_fill_color.py
# Sketch - A Python-based interactive drawing program # Copyright (C) 1999 by Bernhard Herzog # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at ...
doc.SelectObject(select, Sketch.const.SelectAdd) # register script import Sketch.Scripting Sketch.Scripting.AddFunction('select_same_fill_color', 'Select Same Fill Color', select_same_fill_color, script_type = Sketch.S...
prop = obj.Properties() if prop.HasFill() and prop.fill_pattern.is_Solid \ and color == prop.fill_pattern.Color(): select.append(obj)
conditional_block
trait_default_method_xc_aux.rs
#[allow(default_methods)]; pub struct Something { x: int } pub trait A { fn f(&self) -> int; fn g(&self) -> int { 10 } fn h(&self) -> int { 10 } } impl A for int { fn f(&self) -> int { 10 } } impl A for Something { fn f(&self) -> int { 10 } } trait B<T> { fn thing<U>(&self, x: T, y: U) -> ...
} impl<T> B<T> for int { } impl B<float> for bool { } pub trait TestEquality { fn test_eq(&self, rhs: &Self) -> bool; fn test_neq(&self, rhs: &Self) -> bool { !self.test_eq(rhs) } } impl TestEquality for int { fn test_eq(&self, rhs: &int) -> bool { *self == *rhs } }
{ (x, y) }
identifier_body
trait_default_method_xc_aux.rs
#[allow(default_methods)]; pub struct Something { x: int } pub trait A { fn f(&self) -> int; fn g(&self) -> int { 10 } fn h(&self) -> int { 10 } } impl A for int { fn f(&self) -> int { 10 } }
trait B<T> { fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) } } impl<T> B<T> for int { } impl B<float> for bool { } pub trait TestEquality { fn test_eq(&self, rhs: &Self) -> bool; fn test_neq(&self, rhs: &Self) -> bool { !self.test_eq(rhs) } } impl TestEquality for int { fn test_eq(...
impl A for Something { fn f(&self) -> int { 10 } }
random_line_split
trait_default_method_xc_aux.rs
#[allow(default_methods)]; pub struct
{ x: int } pub trait A { fn f(&self) -> int; fn g(&self) -> int { 10 } fn h(&self) -> int { 10 } } impl A for int { fn f(&self) -> int { 10 } } impl A for Something { fn f(&self) -> int { 10 } } trait B<T> { fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) } } impl<T> B<T> for int { } im...
Something
identifier_name
forms.spec.js
//define(function(require) { // 'use strict'; // // var FormEntities = require('entities/forms'); // //var FormEntity = require('entities/form'); // var forms = new FormEntities(); // // var FormEntitiesFixtures = { // GET: { // forms: [ // { // templat...
// }, // // fieldsets: [{ // legend: 'Member Information', // fields: ['title', 'name', 'email', 'testHidden'] // }], // // data: { // title: 'Mr', // n...
random_line_split
nwdiag.py
.utils.rst.nodes import nwdiag.utils.rst.directives from blockdiag.utils.bootstrap import detectfont from blockdiag.utils.compat import u, string_types from blockdiag.utils.fontmap import FontMap # fontconfig; it will be initialized on `builder-inited` event. fontmap = None class nwdiag_node(nwdiag.utils.rst.nodes.n...
def get_image_format_for(builder): if builder.format == 'html': image_format = builder.config.nwdiag_html_image_format.upper() elif builder.format == 'latex': if builder.config.nwdiag_tex_image_format: image_format = builder.config.nwdiag_tex_image_format.upper() else: ...
def html_depart_nwdiag(self, node): self.body.append(self.context.pop()) self.body.append(self.context.pop())
random_line_split