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
layoutwidget.py
""" # Title is only required for windows, not overlay components title = "" keyctx = "" def key_responder(self): """ Returns the object responding to key input. Usually self, but may be a wrapped object. """ return self def focus_changed(self): ...
class LayoutWidget: """ All top-level layout widgets and all widgets that may be set in an overlay must comply with this API.
random_line_split
layoutwidget.py
class LayoutWidget: """ All top-level layout widgets and all widgets that may be set in an overlay must comply with this API. """ # Title is only required for windows, not overlay components title = "" keyctx = "" def key_responder(self): """ Returns the obje...
def layout_pushed(self, prev): """ We have just pushed a window onto the stack. """ pass
""" We are just about to pop a window off the stack, or exit an overlay. """ pass
identifier_body
dell_storagecenter_iscsi.py
# Copyright 2015 Dell 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 agree...
# the Target_Portal stuff. # 3. OS brick is calling us in single path mode so # we want to return Target_Portal and # Target_Portals as alternates. iscsiprops = (api.find_iscsi_properties(scv...
scvolume = api.find_volume(volume_name) # Our return. iscsiprops = {} ip = None port = None if not multipath: # We want to make sure we point to the specified ...
conditional_block
dell_storagecenter_iscsi.py
# Copyright 2015 Dell 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 agree...
def __init__(self, *args, **kwargs): super(DellStorageCenterISCSIDriver, self).__init__(*args, **kwargs) self.backend_name = ( self.configuration.safe_get('volume_backend_name') or 'Dell-iSCSI') def initialize_connection(self, volume, connector): # Initialize_con...
"""Implements commands for Dell StorageCenter ISCSI management. To enable the driver add the following line to the cinder configuration: volume_driver=cinder.volume.drivers.dell.DellStorageCenterISCSIDriver Version history: 1.0.0 - Initial driver 1.1.0 - Added extra spec support for St...
identifier_body
dell_storagecenter_iscsi.py
# Copyright 2015 Dell 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 agree...
(dell_storagecenter_common.DellCommonDriver, driver.ISCSIDriver): """Implements commands for Dell StorageCenter ISCSI management. To enable the driver add the following line to the cinder configuration: volume_driver=cinder.volume.drivers.dell.DellStorageCenterISCSID...
DellStorageCenterISCSIDriver
identifier_name
dell_storagecenter_iscsi.py
# Copyright 2015 Dell 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 agree...
volume_name = volume.get('id') LOG.debug('Terminate connection: %(vol)s:%(initiator)s', {'vol': volume_name, 'initiator': initiator_name}) with self._client.open_connection() as api: try: scserver = api.find_server(initiator_name) ...
def terminate_connection(self, volume, connector, force=False, **kwargs): # Grab some initial info. initiator_name = connector.get('initiator')
random_line_split
lib.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() -> ! { // FIXME(#14674): This really needs to do something other than just abort // here, but any printing done must be *guaranteed* to not // allocate. unsafe { core::intrinsics::abort() } }
oom
identifier_name
lib.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// duplicating the lang-items when building in test cfg; but also need // to allow code to have `use boxed::HEAP;` // and `use boxed::Box;` declarations. #[cfg(not(test))] pub mod boxed; #[cfg(test)] mod boxed { pub use std::boxed::{Box, HEAP}; } #[cfg(test)] mod boxed_test; pub mod arc; pub mod rc; pub mod raw_vec; /...
pub mod heap; // Primitive types using the heaps above // Need to conditionally define the mod from `boxed.rs` to avoid
random_line_split
lib.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ // FIXME(#14674): This really needs to do something other than just abort // here, but any printing done must be *guaranteed* to not // allocate. unsafe { core::intrinsics::abort() } }
identifier_body
instance_inspector.ts
"use strict"; import { inject, injectable } from "inversify"; import { IInstanceInspector, IConfiguration } from "./interfaces"; import { spawn } from "child_process"; @injectable() export class InstanceInspector implements IInstanceInspector { private static get POLICYFILE_BANNER(): string { return "----->"; } ...
return new Promise<string[]>((resolve, reject) => { let buffer = ""; let list = spawn("kitchen", ["list", "--bare"], { cwd: this.configuration.getWorkingDirectory(), shell: true, }); list.stdout.on("data", (data) => { ...
random_line_split
instance_inspector.ts
"use strict"; import { inject, injectable } from "inversify"; import { IInstanceInspector, IConfiguration } from "./interfaces"; import { spawn } from "child_process"; @injectable() export class InstanceInspector implements IInstanceInspector { private static get POLICYFILE_BANNER(): string
private configuration: IConfiguration; public constructor( @inject("IConfiguration") configuration: IConfiguration ) { this.configuration = configuration; } public list(): Thenable<string[]> { return new Promise<string[]>((resolve, reject) => { let buffer = "";...
{ return "----->"; }
identifier_body
instance_inspector.ts
"use strict"; import { inject, injectable } from "inversify"; import { IInstanceInspector, IConfiguration } from "./interfaces"; import { spawn } from "child_process"; @injectable() export class InstanceInspector implements IInstanceInspector { private static get POLICYFILE_BANNER(): string { return "----->"; } ...
(): Thenable<string[]> { return new Promise<string[]>((resolve, reject) => { let buffer = ""; let list = spawn("kitchen", ["list", "--bare"], { cwd: this.configuration.getWorkingDirectory(), shell: true, }); list.stdout.on("data", (...
list
identifier_name
index.js
var LiveStream = require('../') var SubLevel = require('level-sublevel') var db = SubLevel(require('level-test')()('test-level-live-stream')) var assert = require('assert') var i = 10 var j = 10
LiveStream(db, {tail: true}).on('data', function (data) { console.log(data) if(data.type === 'put') assert.equal(data.key, j--) }) LiveStream(db, {old: false}).on('data', function (data) { if(data.type === 'put') assert.equal(data.key, k--) }) var a = [] var int = setInterval(function () { var key = i...
var k = 10
random_line_split
install.py
#!/usr/bin/env python2 """ :Synopsis: Specialized Class for installing essential components. :Install-logs: All logs are saved in the directory **hackademic-logs**. """ import os import sys import subprocess from logging_manager import LoggingManager sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(_...
All logs during the install are saved to hackademic_logs/install.logs """ print("[+] Installing Docker and necessary supporting plugins") print("[+] This could take some time. Please wait ...") try: subprocess.check_call("docker -v", stdout=subprocess.PIPE, ...
will skip the installation.
random_line_split
install.py
#!/usr/bin/env python2 """ :Synopsis: Specialized Class for installing essential components. :Install-logs: All logs are saved in the directory **hackademic-logs**. """ import os import sys import subprocess from logging_manager import LoggingManager sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(_...
def install_finish(self): print("[+] Installation is Successful. Happy hacking !") def main(): docker = Install() docker.install_docker() docker.docker_image() docker.build_docker() docker.install_pip_tools() docker.install_finish() if __name__ == '__main__': main()
self.run_command("sudo -E pip install --upgrade " + i)
conditional_block
install.py
#!/usr/bin/env python2 """ :Synopsis: Specialized Class for installing essential components. :Install-logs: All logs are saved in the directory **hackademic-logs**. """ import os import sys import subprocess from logging_manager import LoggingManager sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(_...
def main(): docker = Install() docker.install_docker() docker.docker_image() docker.build_docker() docker.install_pip_tools() docker.install_finish() if __name__ == '__main__': main()
print("[+] Installation is Successful. Happy hacking !")
identifier_body
install.py
#!/usr/bin/env python2 """ :Synopsis: Specialized Class for installing essential components. :Install-logs: All logs are saved in the directory **hackademic-logs**. """ import os import sys import subprocess from logging_manager import LoggingManager sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(_...
(self): self.user = os.environ['USER'] self.install = LoggingManager() self.file_location = os.path.abspath(os.path.dirname(__file__)) self.pip_install_tools = self.file_location + "/pip.txt" return def run_command(self, command): print "[+] Running the command: %s" ...
__init__
identifier_name
SegmentInput.story.tsx
import React, { useState } from 'react'; import { action } from '@storybook/addon-actions'; import { SegmentInput, Icon } from '@savantly/sprout-ui'; const SegmentFrame = ({ children }: any) => ( <> <div className="gf-form-inline"> <div className="gf-form"> <span className="gf-form-label width-8 qu...
}; export const BasicInputWithPlaceholder = () => { const [value, setValue] = useState(''); return ( <SegmentFrame> <SegmentInput placeholder="add text" value={value} onChange={text => { setValue(text as string); action('Segment value changed')(text); }...
component: SegmentInput,
random_line_split
connector.oracle.ts
import {DBConnector, SqlBinding, SqlMaker} from './index'; class OracleSqlMaker extends SqlMaker { quote(value: string) { return `"${value.replace(/"/g, '""')}"`; } insert(table: string, columns: string[], sql_values: SqlBinding[], output_columns: string[]) : SqlBinding { let sql =`INSERT INTO ${this.qu...
(oracledb, db) { return db.close(); }, select(oracledb, db, sql_select: SqlBinding) : Promise<object[]> { return new Promise<any>((resolve, reject) => { db.execute(sql_select.sql, sql_select.bind, (err, result) => { if (err) return reject(err); let rows = result.rows.map(row => { ...
destroy
identifier_name
connector.oracle.ts
import {DBConnector, SqlBinding, SqlMaker} from './index'; class OracleSqlMaker extends SqlMaker { quote(value: string) { return `"${value.replace(/"/g, '""')}"`; } insert(table: string, columns: string[], sql_values: SqlBinding[], output_columns: string[]) : SqlBinding { let sql =`INSERT INTO ${this.qu...
}); }); }, run(oracledb, db, sql: SqlBinding) : Promise<any> { return new Promise<any>((resolve, reject) => { db.execute(sql.sql, sql.bind, (err, result) => err ? reject(err) : resolve()); }); }, beginTransaction(oracledb, db): Promise<void> { return new Promise<any>((resolve, reject...
err ? reject(err) : resolve(output_columns.map((c, i) => result.outBinds[`r${i}`][0]))
random_line_split
connector.oracle.ts
import {DBConnector, SqlBinding, SqlMaker} from './index'; class OracleSqlMaker extends SqlMaker { quote(value: string) { return `"${value.replace(/"/g, '""')}"`; } insert(table: string, columns: string[], sql_values: SqlBinding[], output_columns: string[]) : SqlBinding { let sql =`INSERT INTO ${this.qu...
select_index_list() : SqlBinding { return { sql: `SELECT OWNER || "." || INDEX_NAME index_name, OWNER || "." || TABLE_NAME table_name FROM ALL_INDEXES`, bind: [] }; } } export const OracleDBConnectorFactory = DBConnector.createSimple<any, { connectString: string, user?: string, password?: string }, any>({...
{ return { sql: `SELECT OWNER || "." || TABLE_NAME table_name FROM ALL_TABLES`, bind: [] }; }
identifier_body
get_code_stats.py
') if i > -1: x = x[0:i] i = x.rfind('/') if i > -1: x = x[0:i] return x else: return self.rootPath def getRelativePath(self, path): endsWithSlash = path.endswith('/') path = os.path.abspa...
(p): i = p.rfind('.') if i > -1: return p[i+1:] in ['cpp','h','java','py'] return False def statPathIsComponent(p): return p == '' or (p.endswith('/') and p.find('/') == len(p) - 1) _FLOAT_TYPE = type(0.1) def getReportLine(key, number, showKB = False, formatSpecifier='%02f'): numtxt = num...
statPathIsFile
identifier_name
get_code_stats.py
code') if i > -1: x = x[0:i] i = x.rfind('/') if i > -1: x = x[0:i] return x else: return self.rootPath def getRelativePath(self, path): endsWithSlash = path.endswith('/') path = os.path.a...
report += '\nStats for %s' % desc dict = stats.statsByPath[path] keys = [k for k in dict.keys() if not isValuesKeyName(k)] keys.sort() for key in keys: showKB = key.startswith('byte') report += '\n ' + getReportLine(key, dict[key], showKB) i...
report = '' components = [p for p in stats.statsByPath.keys() if statPathIsComponent(p)] files = [p for p in stats.statsByPath.keys() if statPathIsFile(p)] components.sort() files.sort() uberDict = stats.statsByPath[''] avg, stdev = getAggregateStats(uberDict, 'byte count, impl') tooBigs = {...
identifier_body
get_code_stats.py
s for %s', (k, p)) dict[k] = [number] else: dict[statName] = dict[statName] + number if shouldAggregate: dict[k].append(number) _CPP_TESTNAME_PAT = re.compile(r'^\s*(SIMPLE_TEST\s*\(\s*(.*?)\s*\)|class\s+([a-zA-Z_0-9]+)\s*:\s*(public|p...
# files isn't always practical. In C++ and python, however, there are good # ways to split into smaller files.
random_line_split
get_code_stats.py
') if i > -1: x = x[0:i] i = x.rfind('/') if i > -1: x = x[0:i] return x else: return self.rootPath def getRelativePath(self, path): endsWithSlash = path.endswith('/') path = os.path.abspa...
else: lbl = 'excellent coverage' return '%0.2f (%s)' % (ratio, lbl) def generateReport(stats): #print(stats.statsByPath) report = '' components = [p for p in stats.statsByPath.keys() if statPathIsComponent(p)] files = [p for p in stats.statsByPath.keys() if statPathIsFile(p)] compo...
lbl = 'good coverage'
conditional_block
report.py
import os from django_extensions.management.jobs import DailyJob import nbformat from nbconvert.preprocessors import ExecutePreprocessor from nbconvert import HTMLExporter
def execute(self): print("Cleaning lowfat/reports/html ...") old_reports = os.listdir("lowfat/reports/html") for old_report in old_reports: print("- Removing lowfat/reports/html/{}".format(old_report)) os.remove("lowfat/reports/html/{}".format(old_report)) pri...
class Job(DailyJob): help = "Convert Jupyter Notebook in lowfat/reports to HTML page in lowfat/reports/html."
random_line_split
report.py
import os from django_extensions.management.jobs import DailyJob import nbformat from nbconvert.preprocessors import ExecutePreprocessor from nbconvert import HTMLExporter class
(DailyJob): help = "Convert Jupyter Notebook in lowfat/reports to HTML page in lowfat/reports/html." def execute(self): print("Cleaning lowfat/reports/html ...") old_reports = os.listdir("lowfat/reports/html") for old_report in old_reports: print("- Removing lowfat/reports/h...
Job
identifier_name
report.py
import os from django_extensions.management.jobs import DailyJob import nbformat from nbconvert.preprocessors import ExecutePreprocessor from nbconvert import HTMLExporter class Job(DailyJob): help = "Convert Jupyter Notebook in lowfat/reports to HTML page in lowfat/reports/html." def execute(self): ...
file_.write(body)
if not notebook_filename.endswith(".ipynb"): continue print("Processing lowfat/reports/{}".format(notebook_filename)) # Based on Executing notebooks, nbconvert Documentation by Jupyter Development Team. # https://nbconvert.readthedocs.io/en/latest/execute_api.html ...
conditional_block
report.py
import os from django_extensions.management.jobs import DailyJob import nbformat from nbconvert.preprocessors import ExecutePreprocessor from nbconvert import HTMLExporter class Job(DailyJob): help = "Convert Jupyter Notebook in lowfat/reports to HTML page in lowfat/reports/html." def execute(self): ...
# Kernel is provided by https://github.com/django-extensions/django-extensions/ execute_preprocessor = ExecutePreprocessor(timeout=600, kernel_name='django_extensions') execute_preprocessor.preprocess(notebook, {'metadata': {'path': '.'}}) html_exporter =...
print("Cleaning lowfat/reports/html ...") old_reports = os.listdir("lowfat/reports/html") for old_report in old_reports: print("- Removing lowfat/reports/html/{}".format(old_report)) os.remove("lowfat/reports/html/{}".format(old_report)) print("Cleaning of lowfat/reports/...
identifier_body
tdAddBasic1.py
OSE distribution, in which case the provisions of the CDDL are applicable instead of those of the GPL. You may elect to license modified versions of this file under the terms and conditions of either the GPL or the CDDL or both. """ __version__ = "$Revision: 100880 $" # Standard Python imports. import os; import sy...
(self, oSession, oTxsSession, oTestVm): """ Installs the Windows guest additions using the test execution service. Since this involves rebooting the guest, we will have to create a new TXS session. """ asLogFile = []; # Delete relevant log files. if oTestVm.sKind...
testWindowsInstallAdditions
identifier_name
tdAddBasic1.py
import base; from testdriver import vbox; from testdriver import vboxcon; # Sub test driver imports. sys.path.append(os.path.dirname(os.path.abspath(__file__))); # For sub-test drivers. from tdAddGuestCtrl import SubTstDrvAddGuestCtrl; class tdAddBasic1(vbox.TestDriver): # py...
reporter.error('IGuest::additionsVersion is empty.'); return False;
conditional_block
tdAddBasic1.py
OSE distribution, in which case the provisions of the CDDL are applicable instead of those of the GPL. You may elect to license modified versions of this file under the terms and conditions of either the GPL or the CDDL or both. """ __version__ = "$Revision: 100880 $" # Standard Python imports. import os; import sy...
reporter.testDone(); reporter.testStart('IGuest::additionsRunLevel'); self.testIGuest_additionsRunLevel(oGuest, oTestVm); reporter.testDone(); ## @todo test IAdditionsFacilities. return (fRc, oTxsSession); def testWindowsInstallAdditions(self, ...
# Check the additionsVersion attribute. It must not be empty. reporter.testStart('IGuest::additionsVersion'); fRc = self.testIGuest_additionsVersion(oGuest);
random_line_split
tdAddBasic1.py
OSE distribution, in which case the provisions of the CDDL are applicable instead of those of the GPL. You may elect to license modified versions of this file under the terms and conditions of either the GPL or the CDDL or both. """ __version__ = "$Revision: 100880 $" # Standard Python imports. import os; import sy...
# # The actual install. # Enable installing the optional auto-logon modules (VBoxGINA/VBoxCredProv) + (Direct)3D support. # Also tell the installer to produce the appropriate log files. # fRc = self.txsRunTest(oTxsSession, 'VBoxWindowsAdditions.exe', 5 * 60 * 1000, \ ...
""" Installs the Windows guest additions using the test execution service. Since this involves rebooting the guest, we will have to create a new TXS session. """ asLogFile = []; # Delete relevant log files. if oTestVm.sKind in ('WindowsNT4',): sWinDir = 'C:/W...
identifier_body
where-clauses.rs
// run-pass trait Equal { fn equal(&self, other: &Self) -> bool; fn equals<T,U>(&self, this: &T, that: &T, x: &U, y: &U) -> bool where T: Eq, U: Eq; } impl<T> Equal for T where T: Eq { fn equal(&self, other: &T) -> bool { self == other } fn equals<U,X>(&self, this: &U, other: &U...
fn equal<T>(x: &T, y: &T) -> bool where T: Eq { x == y } fn main() { println!("{}", equal(&1, &2)); println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); println!("{}", "hello".equals::<isize,&str>(&1, &1, &"foo", &"bar")); }
this == other && x == y } }
random_line_split
where-clauses.rs
// run-pass trait Equal { fn equal(&self, other: &Self) -> bool; fn equals<T,U>(&self, this: &T, that: &T, x: &U, y: &U) -> bool where T: Eq, U: Eq; } impl<T> Equal for T where T: Eq { fn equal(&self, other: &T) -> bool { self == other } fn equals<U,X>(&self, this: &U, other: &U...
() { println!("{}", equal(&1, &2)); println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); println!("{}", "hello".equals::<isize,&str>(&1, &1, &"foo", &"bar")); }
main
identifier_name
where-clauses.rs
// run-pass trait Equal { fn equal(&self, other: &Self) -> bool; fn equals<T,U>(&self, this: &T, that: &T, x: &U, y: &U) -> bool where T: Eq, U: Eq; } impl<T> Equal for T where T: Eq { fn equal(&self, other: &T) -> bool { self == other } fn equals<U,X>(&self, this: &U, other: &U...
{ println!("{}", equal(&1, &2)); println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); println!("{}", "hello".equals::<isize,&str>(&1, &1, &"foo", &"bar")); }
identifier_body
index.d.ts
interface File { /** Name of the form field associated with this file. */ fieldname: string; /** Name of the file on the uploader's computer. */ originalname: string; /** * Value of the `Content-Transfer-Encodin...
xtends Error { constructor(code: ErrorCode, field?: string); /** Name of the MulterError constructor. */ name: string; /** Identifying error code. */ code: ErrorCode; /** Descriptive error message. */ message: string; /** Name of the multipart form field a...
lterError e
identifier_name
index.d.ts
*/ interface File { /** Name of the form field associated with this file. */ fieldname: string; /** Name of the file on the uploader's computer. */ originalname: string; /** * Value of the `Content-Transfer-Enc...
* passed to Busboy directly, and the details of properties can be found * at https://github.com/mscdex/busboy#busboy-methods. */ limits?: { /** Maximum size of each form field name in bytes. (Default: 100) */ fieldNameSize?: number | undefined; /** ...
/** * An object specifying various limits on incoming data. This object is
random_line_split
FEATURE_GET_TLV_PROPERTIES.py
#! /usr/bin/env python """ # FEATURE_GET_TLV_PROPERTIES.py: Unitary test for
# FEATURE_GET_TLV_PROPERTIES # Copyright (C) 2012,2016 Ludovic Rousseau """ # 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) ...
random_line_split
FEATURE_GET_TLV_PROPERTIES.py
#! /usr/bin/env python """ # FEATURE_GET_TLV_PROPERTIES.py: Unitary test for # FEATURE_GET_TLV_PROPERTIES # Copyright (C) 2012,2016 Ludovic Rousseau """ # 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 Fre...
print "%s: %s" % (key, tlv[key])
conditional_block
wrappers.py
in into request objects to add extra functionality. Example:: from werkzeug.wrappers import Request as RequestBase from werkzeug.contrib.wrappers import JSONRequestMixin class Request(RequestBase, JSONRequestMixin): pass Afterwards this request object provides the extra ...
def _get_routing_args(self): return self.environ.get('wsgiorg.routing_args', (()))[0] def _set_routing_args(self, value): if self.shallow: raise RuntimeError('A shallow request tried to modify the WSGI ' 'environment. If you really want to do that, ' ...
.. _specification: http://www.wsgi.org/wsgi/Specifications/routing_args """
random_line_split
wrappers.py
into request objects to add extra functionality. Example:: from werkzeug.wrappers import Request as RequestBase from werkzeug.contrib.wrappers import JSONRequestMixin class Request(RequestBase, JSONRequestMixin): pass Afterwards this request object provides the extra fun...
rv = {} if not self.shallow: self.routing_vars = rv return rv def _set_routing_vars(self, value): if self.shallow: raise RuntimeError('A shallow request tried to modify the WSGI ' 'environment. If you really want to do that, '...
return rv[1]
conditional_block
wrappers.py
into request objects to add extra functionality. Example:: from werkzeug.wrappers import Request as RequestBase from werkzeug.contrib.wrappers import JSONRequestMixin class Request(RequestBase, JSONRequestMixin): pass Afterwards this request object provides the extra fun...
(self, value): if self.shallow: raise RuntimeError('A shallow request tried to modify the WSGI ' 'environment. If you really want to do that, ' 'set `shallow` to False.') self.environ['wsgiorg.routing_args'] = (value, self.routin...
_set_routing_args
identifier_name
wrappers.py
into request objects to add extra functionality. Example:: from werkzeug.wrappers import Request as RequestBase from werkzeug.contrib.wrappers import JSONRequestMixin class Request(RequestBase, JSONRequestMixin): pass Afterwards this request object provides the extra fun...
class RoutingArgsRequestMixin(object): """This request mixin adds support for the wsgiorg routing args `specification`_. .. _specification: http://www.wsgi.org/wsgi/Specifications/routing_args """ def _get_routing_args(self): return self.environ.get('wsgiorg.routing_args', (()))[0] ...
"""Parse the data into an instance of proto_type.""" if 'protobuf' not in self.environ.get('CONTENT_TYPE', ''): raise BadRequest('Not a Protobuf request') obj = proto_type() try: obj.ParseFromString(self.data) except Exception: raise BadRequest("Unabl...
identifier_body
case_conversion_pipes_spec.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {LowerCasePipe, TitleCasePipe, UpperCasePipe} from '@angular/common'; export function main()
beforeEach(() => { pipe = new TitleCasePipe(); }); it('should return titlecase', () => { expect(pipe.transform('foo')).toEqual('Foo'); }); it('should titlecase when there is a new value', () => { expect(pipe.transform('bar')).toEqual('Bar'); expect(pipe.transform('foo')).toEqual('Foo'); })...
{ describe('LowerCasePipe', () => { let pipe: LowerCasePipe; beforeEach(() => { pipe = new LowerCasePipe(); }); it('should return lowercase', () => { expect(pipe.transform('FOO')).toEqual('foo'); }); it('should lowercase when there is a new value', () => { expect(pipe.transform('FOO')).toEqua...
identifier_body
case_conversion_pipes_spec.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {LowerCasePipe, TitleCasePipe, UpperCasePipe} from '@angular/common'; export function
() { describe('LowerCasePipe', () => { let pipe: LowerCasePipe; beforeEach(() => { pipe = new LowerCasePipe(); }); it('should return lowercase', () => { expect(pipe.transform('FOO')).toEqual('foo'); }); it('should lowercase when there is a new value', () => { expect(pipe.transform('FOO')).toE...
main
identifier_name
case_conversion_pipes_spec.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {LowerCasePipe, TitleCasePipe, UpperCasePipe} from '@angular/common'; export function main() { describe('L...
let pipe: UpperCasePipe; beforeEach(() => { pipe = new UpperCasePipe(); }); it('should return uppercase', () => { expect(pipe.transform('foo')).toEqual('FOO'); }); it('should uppercase when there is a new value', () => { expect(pipe.transform('foo')).toEqual('FOO'); expect(pipe.transform(...
() => { expect(() => pipe.transform(<any>{})).toThrowError(); }); }); describe('UpperCasePipe', () => {
random_line_split
unique.js
/* Copyright Ben Trask and other contributors. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify...
(array) { var r = [], l = array.length, x; for(var i = 0; i < l; ++i) { x = array[i]; if(-1 === r.indexOf(x)) r.push(x); } return r; }
unique
identifier_name
unique.js
/* Copyright Ben Trask and other contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ...
random_line_split
unique.js
/* Copyright Ben Trask and other contributors. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify...
{ var r = [], l = array.length, x; for(var i = 0; i < l; ++i) { x = array[i]; if(-1 === r.indexOf(x)) r.push(x); } return r; }
identifier_body
pickle_potential.py
#!/usr/bin/env python2 # # Copyright (C) 2013-2017(H) # Max Planck Institute for Polymer Research # # This file is part of ESPResSo++. # # ESPResSo++ 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,...
# -*- coding: utf-8 -*- import espressopp system, integrator = espressopp.standard_system.LennardJones(0,(10,10,10)) system.storage.addParticles([[1,0,espressopp.Real3D(5,5,5)]],'id','type','pos') system.storage.addParticles([[2,0,espressopp.Real3D(5,6,5)]],'id','type','pos') system.storage.addParticles([[3,1,espress...
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #
random_line_split
_styleguide.js
/* ========================================================================== Styleguide -- Version: 0.4.1 - Updated: 2/22/2014 ========================================================================== */ // Create Hex color code from color return function hexc(colorval) { var parts = colorval.match(/^rgb\...
} var x = $(this).children('.swatch-color').css('backgroundColor'); hexc(x); $(this).children('.swatch-info').append('<p>' + color + '</p>'); $(this).children('.swatch-info').append('<p>' + x + '</p>'); }); (function($) { $.fn.vs = function() { // View source buttons $('.vs').click(function(){ ...
{ $(this).children('.swatch-info').prepend('<p>$' + classList[i] + '</p>'); break; }
conditional_block
_styleguide.js
/* ========================================================================== Styleguide -- Version: 0.4.1 - Updated: 2/22/2014 ========================================================================== */ // Create Hex color code from color return function
(colorval) { var parts = colorval.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); delete(parts[0]); for (var i = 1; i <= 3; ++i) { parts[i] = parseInt(parts[i]).toString(16); if (parts[i].length == 1) parts[i] = '0' + parts[i]; } color = '#' + parts.join(''); } // Get color value of swatch and print to di...
hexc
identifier_name
_styleguide.js
/* ========================================================================== Styleguide -- Version: 0.4.1 - Updated: 2/22/2014 ========================================================================== */ // Create Hex color code from color return function hexc(colorval) { var parts = colorval.match(/^rgb\(...
} }(jQuery)); $('.vs').vs(); // Get font-family property and return $('.fonts').each(function(){ var fonts = $(this).css('font-family'); $(this).prepend(fonts); });
$('.vs').click(function(){ $(this).parent().next().find('.prettyprint').toggle(); $(this).not('.disabled').toggleClass('js-active'); return false; });
random_line_split
_styleguide.js
/* ========================================================================== Styleguide -- Version: 0.4.1 - Updated: 2/22/2014 ========================================================================== */ // Create Hex color code from color return function hexc(colorval)
// Get color value of swatch and print to div var color = ''; $('.swatch').each(function() { var classList = $(this).children('.swatch-color').attr('class').split(' '); for(i=0; i <= classList.length-1; i++){ if(classList[i].match(/color-/g)){ $(this).children('.swatch-info').prepend('<p>$' + classList[i] + '<...
{ var parts = colorval.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); delete(parts[0]); for (var i = 1; i <= 3; ++i) { parts[i] = parseInt(parts[i]).toString(16); if (parts[i].length == 1) parts[i] = '0' + parts[i]; } color = '#' + parts.join(''); }
identifier_body
keygenerator.js
(backupInfo) { if (goog.isDefAndNotNull(backupInfo) && backupInfo.count % 2) { throw new e2e.error.InvalidArgumentsError('Keys must be restored in pairs'); } this.eccSeed_ = goog.isDefAndNotNull(backupInfo) ? (backupInfo.seed || null) : null; this.eccCount_ = goog.isDefAndNotNull(backupInfo) ? (backup...
{ this.eccSeed_ = e2e.random.getRandomBytes( e2e.openpgp.KeyGenerator.ECC_SEED_SIZE); this.eccCount_ = 0; }
conditional_block
keygenerator.js
6'); goog.require('e2e.openpgp'); goog.require('e2e.openpgp.DummyS2k'); goog.require('e2e.openpgp.EncryptedCipher'); goog.require('e2e.openpgp.Mpi'); goog.require('e2e.openpgp.block.TransferablePublicKey'); goog.require('e2e.openpgp.block.TransferableSecretKey'); goog.require('e2e.openpgp.error.UnsupportedError'); goog...
throw new e2e.error.InvalidArgumentsError('Keys must be restored in pairs'); } this.eccSeed_ = goog.isDefAndNotNull(backupInfo) ? (backupInfo.seed || null) : null; this.eccCount_ = goog.isDefAndNotNull(backupInfo) ? (backupInfo.count || null) : null; }; /** * Generates and imports to the key ri...
e2e.openpgp.KeyGenerator.prototype.setGeneratorState = function(backupInfo) { if (goog.isDefAndNotNull(backupInfo) && backupInfo.count % 2) {
random_line_split
base_command.js
import ejs from 'ejs' import fs from 'fs' import mkdirp from 'mkdirp' /** * @class */ export default class BaseCommand { /** * @param {String} source * @param {String} destination */ copyFile(source, destination) { fs.createReadStream(source).pipe(fs.createWriteStream(destination)); this.logEntr...
* @param {String} path */ createEmptyFile(path) { fs.closeSync(fs.openSync(path, 'w')); this.logEntryCreatedEvent(path); } /** * @param {String} data * @param {String} path */ createFile(path, data) { fs.writeFileSync(path, data); this.logEntryCreatedEvent(path); } /** * ...
} /**
random_line_split
base_command.js
import ejs from 'ejs' import fs from 'fs' import mkdirp from 'mkdirp' /** * @class */ export default class BaseCommand { /** * @param {String} source * @param {String} destination */ copyFile(source, destination) { fs.createReadStream(source).pipe(fs.createWriteStream(destination)); this.logEntr...
/** * @param {String} destination * @param {Object=} parameters * @param {String} source */ createFileFromTemplate({ destination, parameters, source }) { this.createFile( destination, ejs.render( fs.readFileSync( source, { encoding: 'utf8' ...
{ fs.writeFileSync(path, data); this.logEntryCreatedEvent(path); }
identifier_body
base_command.js
import ejs from 'ejs' import fs from 'fs' import mkdirp from 'mkdirp' /** * @class */ export default class BaseCommand { /** * @param {String} source * @param {String} destination */ copyFile(source, destination) { fs.createReadStream(source).pipe(fs.createWriteStream(destination)); this.logEntr...
({ destination, parameters, source }) { this.createFile( destination, ejs.render( fs.readFileSync( source, { encoding: 'utf8' } ), parameters || {} ) ); } /** * @param {String} path */ logEntryCreatedEvent(path) { ...
createFileFromTemplate
identifier_name
datacenterinfo.rs
use serde::ser::{Serialize, Serializer, SerializeStruct}; use serde::de::{Deserialize, Deserializer, Visitor, Error as DeError, MapAccess}; use std::fmt; use super::DcName; use super::AmazonMetaData; // Field name constants const NAME: &'static str = "name"; const METADATA: &'static str = "metadata"; // The eureka API...
maybe_name = Some(map.next_value()?); }, Field::Metadata => { if maybe_metadata.is_some() { return Err(DeError::duplicate_field(METADATA)); } ...
{ return Err(DeError::duplicate_field(NAME)); }
conditional_block
datacenterinfo.rs
use serde::ser::{Serialize, Serializer, SerializeStruct}; use serde::de::{Deserialize, Deserializer, Visitor, Error as DeError, MapAccess}; use std::fmt; use super::DcName; use super::AmazonMetaData; // Field name constants const NAME: &'static str = "name"; const METADATA: &'static str = "metadata"; // The eureka API...
(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str("Expecting `name` or `metadata` ") } fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: DeError, { match v { ...
expecting
identifier_name
datacenterinfo.rs
use serde::ser::{Serialize, Serializer, SerializeStruct}; use serde::de::{Deserialize, Deserializer, Visitor, Error as DeError, MapAccess}; use std::fmt; use super::DcName; use super::AmazonMetaData; // Field name constants const NAME: &'static str = "name"; const METADATA: &'static str = "metadata"; // The eureka API...
CLASS => Ok(Field::Class), _ => Err(DeError::unknown_field(v, FIELDS)) } } } deserializer.deserialize_identifier(FieldVisitor) } } struct DataCenterInfoVisitor...
match v { NAME => Ok(Field::Name), METADATA => Ok(Field::Metadata),
random_line_split
question-4-1.js
var answers = []; var validate = () => { $("#afev-answer-1").animate( { backgroundColor: "green"} ); var good = true; if (answers.indexOf(1) === -1) { good = false; } if (answers.indexOf(2) !== -1) { $("#afev-answer-2").animate( { backgroundColor: "red"} ...
if (good) { $("#afev-secret-right").show(); } else { $("#afev-secret-wrong").show(); } $("#afev-secret-response").show(); } window.onload = () => { for (var i = 0; i < 5; i++) { let index = i + 1; $("#afev-answer-" + index).on("click", () => { answe...
{ $("#afev-answer-3").animate( { backgroundColor: "red"} ); good = false; }
conditional_block
question-4-1.js
var answers = []; var validate = () => { $("#afev-answer-1").animate( { backgroundColor: "green"} ); var good = true; if (answers.indexOf(1) === -1) { good = false; } if (answers.indexOf(2) !== -1) { $("#afev-answer-2").animate( { backgroundColor: "red"} ...
localStorage.setItem("afev-score", "10000"); } initLayout(); };
random_line_split
index.ts
import { createSelector } from 'reselect'; import { ActionReducer } from '@ngrx/store'; import { environment } from '../../../environments/environment'; /** * The compose function is one of our most handy tools. In basic terms, you give * it any number of functions and it returns a function. This new function * tak...
{ if (environment.production) { return productionReducer(state, action); } else { return developmentReducer(state, action); } }
identifier_body
index.ts
import { createSelector } from 'reselect'; import { ActionReducer } from '@ngrx/store'; import { environment } from '../../../environments/environment'; /** * The compose function is one of our most handy tools. In basic terms, you give * it any number of functions and it returns a function. This new function * tak...
(state: any, action: any) { if (environment.production) { return productionReducer(state, action); } else { return developmentReducer(state, action); } }
reducer
identifier_name
index.ts
import { createSelector } from 'reselect'; import { ActionReducer } from '@ngrx/store'; import { environment } from '../../../environments/environment'; /** * The compose function is one of our most handy tools. In basic terms, you give * it any number of functions and it returns a function. This new function * tak...
import { storeFreeze } from 'ngrx-store-freeze'; import { storeLogger } from "ngrx-store-logger"; /** * combineReducers is another useful metareducer that takes a map of reducer * functions and creates a new reducer that gathers the values * of each reducer and stores them using the reducer's key. Think of it * al...
random_line_split
index.ts
import { createSelector } from 'reselect'; import { ActionReducer } from '@ngrx/store'; import { environment } from '../../../environments/environment'; /** * The compose function is one of our most handy tools. In basic terms, you give * it any number of functions and it returns a function. This new function * tak...
else { return developmentReducer(state, action); } }
{ return productionReducer(state, action); }
conditional_block
run.py
import math import string lookup_map = {} def memcache_read(n): global lookup_map if lookup_map.has_key(n): return lookup_map[n] else: return None def memcache_write(n, value): global lookup_map lookup_map[n] = value def get_chain_length(n): # check cache cache = memcache_read(n) if cache !...
#print max_chain_num #print max_chain_length return max_chain_num if __name__ == '__main__': #print find_longest_chain_under_N(3) print find_longest_chain_under_N(1000000)
chain_length = get_chain_length(i) memcache_write(i, chain_length) if chain_length > max_chain_length: max_chain_length = chain_length max_chain_num = i
conditional_block
run.py
import math import string lookup_map = {} def memcache_read(n):
def memcache_write(n, value): global lookup_map lookup_map[n] = value def get_chain_length(n): # check cache cache = memcache_read(n) if cache != None: return cache # no cache, so caculate if n <= 1: memcache_write(1, 1) return 1 if n % 2 == 0: n = n / 2 else: n = 3*n + 1 retu...
global lookup_map if lookup_map.has_key(n): return lookup_map[n] else: return None
identifier_body
run.py
import math import string lookup_map = {} def
(n): global lookup_map if lookup_map.has_key(n): return lookup_map[n] else: return None def memcache_write(n, value): global lookup_map lookup_map[n] = value def get_chain_length(n): # check cache cache = memcache_read(n) if cache != None: return cache # no cache, so caculate if n <= 1...
memcache_read
identifier_name
run.py
import math import string lookup_map = {} def memcache_read(n): global lookup_map if lookup_map.has_key(n): return lookup_map[n] else: return None def memcache_write(n, value): global lookup_map lookup_map[n] = value def get_chain_length(n): # check cache cache = memcache_read(n) if cache !=...
#print find_longest_chain_under_N(3) print find_longest_chain_under_N(1000000)
if __name__ == '__main__':
random_line_split
terms.rs
//! A module that describes a logical term in a formula //! //! A term consists of a series of symbol values that can have //! new values pushed into it. Insertions will make sure that the //! term is symbol is unique in a term /// A logical symbol in a term #[derive(Copy, Clone, Debug, Hash, Eq)] pub struct Symbol {...
pub fn merge(&mut self, other: Term) { let ovec: Vec<Symbol> = other.symbols; for sym in ovec.iter() { self.insert(sym.clone()); } } } /// A helper macro that creates terms with a variable amount of symbols /// based on the more user friendly syntax /// /// term!["A", "!B...
/// Merge two terms together in a very naive way. This function will only check /// for same duplicates (to avoid { A, A, B } situations). This will however allow /// { A, ¬A } scenarios. Those need to be removed manually
random_line_split
terms.rs
//! A module that describes a logical term in a formula //! //! A term consists of a series of symbol values that can have //! new values pushed into it. Insertions will make sure that the //! term is symbol is unique in a term /// A logical symbol in a term #[derive(Copy, Clone, Debug, Hash, Eq)] pub struct Symbol {...
&self, other: &Term) -> bool { for s in &self.symbols { if !other.contains(s) { return false; } } for s in &other.symbols { if !self.contains(s) { return false; } } // return self.symbols == other.s...
q(
identifier_name
terms.rs
//! A module that describes a logical term in a formula //! //! A term consists of a series of symbol values that can have //! new values pushed into it. Insertions will make sure that the //! term is symbol is unique in a term /// A logical symbol in a term #[derive(Copy, Clone, Debug, Hash, Eq)] pub struct Symbol {...
} for s in &other.symbols { if !self.contains(s) { return false; } } // return self.symbols == other.symbols; return true; } } impl Term { /// Simple linear `contains` function for a Term. Avoid using this /// as it can l...
return false; }
conditional_block
hrtb-debruijn-in-receiver.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() -> Foo<'a> { panic!() } fn insert(&'a mut self) { } } fn main() { let mut foo = Foo::new(); foo.insert(); foo.insert(); //~ ERROR cannot borrow }
new
identifier_name
hrtb-debruijn-in-receiver.rs
// Copyright 2014 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. // Test the case...
// http://rust-lang.org/COPYRIGHT.
random_line_split
hrtb-debruijn-in-receiver.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn main() { let mut foo = Foo::new(); foo.insert(); foo.insert(); //~ ERROR cannot borrow }
{ }
identifier_body
pager-templates-constants.ts
class PagerTemplateConstants { public static PAGE_TO_FIRST_PLACEHOLDER: string = '${settings.firstPage}'; public static PAGE_TO_LAST_PLACEHOLDER: string = '${settings.lastPage}';
public static PAGE_RANGE_PLACEHOLDER: string = '${pageRange.displayPage}'; public static DEFAULT_PAGE_TO_BEGINNING_HTML: string = '|<'; public static DEFAULT_PAGE_TO_END_HTML: string = '>|'; public static DEFAULT_PAGE_RETREAT_HTML: string = '<'; public static DEFAULT_PAGE_ADVANCE_HTML: string = '>';...
random_line_split
pager-templates-constants.ts
class
{ public static PAGE_TO_FIRST_PLACEHOLDER: string = '${settings.firstPage}'; public static PAGE_TO_LAST_PLACEHOLDER: string = '${settings.lastPage}'; public static PAGE_RANGE_PLACEHOLDER: string = '${pageRange.displayPage}'; public static DEFAULT_PAGE_TO_BEGINNING_HTML: string = '|<'; public static...
PagerTemplateConstants
identifier_name
dom_html_base_font_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DOMNode; use DOMObject; use glib::GString; use glib::object::IsA; use glib::translate::*; use libc; use std::fmt; use webk...
fn set_face(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_face(self.as_ref().to_glib_none().0, value.to_glib_none().0); } } fn set_size(&self, value: libc::c_long) { unsafe { webkit2_webextension_sys::webkit_do...
random_line_split
dom_html_base_font_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DOMNode; use DOMObject; use glib::GString; use glib::object::IsA; use glib::translate::*; use libc; use std::fmt; use webk...
(&self, value: libc::c_long) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_size(self.as_ref().to_glib_none().0, value); } } } impl fmt::Display for DOMHTMLBaseFontElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "DOMHTML...
set_size
identifier_name
dom_html_base_font_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DOMNode; use DOMObject; use glib::GString; use glib::object::IsA; use glib::translate::*; use libc; use std::fmt; use webk...
fn set_size(&self, value: libc::c_long) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_size(self.as_ref().to_glib_none().0, value); } } } impl fmt::Display for DOMHTMLBaseFontElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { w...
{ unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_face(self.as_ref().to_glib_none().0, value.to_glib_none().0); } }
identifier_body
sync.py
# !/usr/bin/python # -*- coding=utf-8 -*- import json import urllib2 from books.models import Book domain = "http://smartebook.zmapp.com:9026" # 同步图书详情 def sync_book(bid, cm): # 完结了的图书不更新信息 if Book.objects.filter(id=bid, status=1).count() == 0: page = urllib2.urlopen("http://wap.cmread.com/r/p/view...
print sync_bookshelf()
random_line_split
sync.py
# !/usr/bin/python # -*- coding=utf-8 -*- import json import urllib2 from books.models import Book domain = "http://smartebook.zmapp.com:9026" # 同步图书详情 def sync_book(bid, cm): # 完结了的图书不更新信息 if Book.objects.filter(id=bid, status=1).count() == 0: page = urllib2.urlopen("http://wap.cmread.com/r/p/view...
in page = urllib2.urlopen(url) result = json.loads(page.read()) print result books = result['bookshelf'] update_count = 0 for index, b in enumerate(books): if sync_book(b['book_id'], 'zm'): update_count += 1 return len(books), update_count print sync_bookshelf()
identifier_body
sync.py
# !/usr/bin/python # -*- coding=utf-8 -*- import json import urllib2 from books.models import Book domain = "http://smartebook.zmapp.com:9026" # 同步图书详情 def sync_book(bid, cm): # 完结了的图书不更新信息 if Book.objects.filter(id=bid, status=1).count() == 0: page = urllib2.urlopen("http://wap.cmread.com/r/p/view...
book.save(force_insert=True) return True except Exception, e: print e.message return False # 同步书架 def sync_bookshelf(): url = "%s/smart_book/get_bookshelf" % domain page = urllib2.urlopen(url) result = json.loads(page.read()) print result books = result['b...
ate_fields=( 'name', 'brief', 'desc', 'cover_url', 'cover_url_small', 'status', 'first_cid', 'last_cid', 'chapter_size', 'score', 'word_size', 'click_amount', 'kw', 'price', 'charge_mode')) else:
conditional_block
sync.py
# !/usr/bin/python # -*- coding=utf-8 -*- import json import urllib2 from books.models import Book domain = "http://smartebook.zmapp.com:9026" # 同步图书详情 def sync_book(bi
# 完结了的图书不更新信息 if Book.objects.filter(id=bid, status=1).count() == 0: page = urllib2.urlopen("http://wap.cmread.com/r/p/viewdata.jsp?bid=%s&cm=%s&vt=9" % (bid, cm)) data = page.read() try: result = json.loads(data, encoding="utf-8") print result update =...
d, cm):
identifier_name
empty.py
# vim:ts=4:et # ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This prog...
elif name in ["CoMOffset", "CoPOffset", "CoLOffset"]: setattr(mu, name, (mu.inverse @ obj.matrix_world.col[3])[:3]) if not obj.children: return None return muobj type_handlers = { type(None): handle_empty }
muobj.transform.localRotation @= attachnode.rotation_correction
conditional_block
empty.py
# vim:ts=4:et # ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This prog...
# so support multiple group root objects if o.hide_render or not is_group_root(o, objects): continue child = export.make_obj(mu, o, mu.path) if child: muobj.children.append(child) export.exported_objects = saved_exported_objects def handle_empty(obj, muobj, m...
objects = collect_objects(group) for n in objects: o = objects[n] # while KSP models (part/prop/internal) will have only one root # object, grouping might be used for other purposes (eg, greeble)
random_line_split
empty.py
# vim:ts=4:et # ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This prog...
(col): for o in col.objects: objects[o.name] = o for c in col.children: collect(c) collect(collection) return objects def export_collection(obj, muobj, mu): saved_exported_objects = set(export.exported_objects) group = obj.instance_collection objects = collec...
collect
identifier_name
empty.py
# vim:ts=4:et # ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This prog...
def collect_objects(collection): objects = {} def collect(col): for o in col.objects: objects[o.name] = o for c in col.children: collect(c) collect(collection) return objects def export_collection(obj, muobj, mu): saved_exported_objects = set(export.exporte...
if not obj.parent: return True return obj.parent.name not in objects
identifier_body
fastdom.js
/* Based on: Copyright (c) 2016 Wilson Page wilsonpage@me.com https://github.com/wilsonpage/fastdom */ import { requestAnimationFrame } from './index'; export const fastdom = { reads: [], writes: [], measure: function(task) { this.reads.push(task); scheduleFlush(this); ...
function remove(array, item) { var index = array.indexOf(item); return !!~index && !!array.splice(index, 1); }
{ var task; while (task = tasks.shift()) { task(); } }
identifier_body
fastdom.js
/* Based on: Copyright (c) 2016 Wilson Page wilsonpage@me.com https://github.com/wilsonpage/fastdom */ import { requestAnimationFrame } from './index'; export const fastdom = { reads: [], writes: [], measure: function(task) { this.reads.push(task); scheduleFlush(this); ...
(array, item) { var index = array.indexOf(item); return !!~index && !!array.splice(index, 1); }
remove
identifier_name
fastdom.js
/* Based on: Copyright (c) 2016 Wilson Page wilsonpage@me.com https://github.com/wilsonpage/fastdom */ import { requestAnimationFrame } from './index'; export const fastdom = { reads: [], writes: [], measure: function(task) { this.reads.push(task); scheduleFlush(this); ...
} function flush(fastdom) { runTasks(fastdom.reads); runTasks(fastdom.writes.splice(0, fastdom.writes.length)); fastdom.scheduled = false; if (fastdom.reads.length || fastdom.writes.length) { scheduleFlush(fastdom); } } function runTasks(tasks) { var task; while (task = tasks....
{ fastdom.scheduled = true; requestAnimationFrame(flush.bind(null, fastdom)); }
conditional_block
fastdom.js
/* Based on: Copyright (c) 2016 Wilson Page wilsonpage@me.com https://github.com/wilsonpage/fastdom */ import { requestAnimationFrame } from './index'; export const fastdom = { reads: [], writes: [], measure: function(task) { this.reads.push(task); scheduleFlush(this); ...
while (task = tasks.shift()) { task(); } } function remove(array, item) { var index = array.indexOf(item); return !!~index && !!array.splice(index, 1); }
random_line_split
new-age.js
(function($) { "use strict"; // Start of use strict // jQuery for page scrolling feature - requires jQuery Easing plugin $('a.page-scroll').bind('click', function(event) { var $anchor = $(this); $('html, body').stop().animate({ scrollTop: ($($anchor.attr('href')).offset().top - ...
$('.navbar-toggle:visible').click(); }); // Offset for Main Navigation $('#mainNav').affix({ offset: { top: 50 } }) })(jQuery); // End of use strict ((window.gitter = {}).chat = {}).options = { room: 'FMeat/Lobby' };
}); // Closes the Responsive Menu on Menu Item Click $('.navbar-collapse ul li a').click(function() {
random_line_split
jflapfile.py
from filetypes.basefile import BaseFile from filetypes.plainfile import PlainFile from filetypes.plainfile import ReviewTest import filetypes class JFLAPReviewTest(ReviewTest): def __init__(self, dict_, file_type): super().__init__(dict_, file_type) def run(self, path): """A JFLAP review test ...
(PlainFile): yaml_type = 'jflap' extensions = ['jff'] supported_tests = PlainFile.supported_tests.copy() supported_tests.append(JFLAPReviewTest) def __init__(self, dict_): BaseFile.__init__(self, dict_) if 'tests' in dict_: for t in dict_['tests']: test_...
JFLAPFile
identifier_name
jflapfile.py
from filetypes.basefile import BaseFile from filetypes.plainfile import PlainFile from filetypes.plainfile import ReviewTest import filetypes class JFLAPReviewTest(ReviewTest): def __init__(self, dict_, file_type): super().__init__(dict_, file_type) def run(self, path): """A JFLAP review test ...
else: results.append(result) return results def __str__(self): return self.path + " (JFLAP file)"
for r in result: results.append(r)
conditional_block
jflapfile.py
from filetypes.basefile import BaseFile from filetypes.plainfile import PlainFile from filetypes.plainfile import ReviewTest import filetypes class JFLAPReviewTest(ReviewTest):
class JFLAPFile(PlainFile): yaml_type = 'jflap' extensions = ['jff'] supported_tests = PlainFile.supported_tests.copy() supported_tests.append(JFLAPReviewTest) def __init__(self, dict_): BaseFile.__init__(self, dict_) if 'tests' in dict_: for t in dict_['tests']: ...
def __init__(self, dict_, file_type): super().__init__(dict_, file_type) def run(self, path): """A JFLAP review test calls the ReviewTest run() method but suppresses printing the file. """ return super().run(path, False)
identifier_body