file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
cholesky.rs
#[cfg(feature = "serde-serialize")] use serde::{Deserialize, Serialize}; use num::One; use simba::scalar::ComplexField; use crate::allocator::Allocator; use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix, Vector}; use crate::constraint::{SameNumberOfRows, ShapeConstraint}; use crate::dimensio...
/// Returns `None` if the input matrix is not definite-positive. The input matrix is assumed /// to be symmetric and only the lower-triangular part is read. pub fn cholesky(self) -> Option<Cholesky<N, D>> { Cholesky::new(self.into_owned()) } }
///
random_line_split
cholesky.rs
#[cfg(feature = "serde-serialize")] use serde::{Deserialize, Serialize}; use num::One; use simba::scalar::ComplexField; use crate::allocator::Allocator; use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix, Vector}; use crate::constraint::{SameNumberOfRows, ShapeConstraint}; use crate::dimensio...
// The diagonal element is either zero or its square root could not // be taken (e.g. for negative real numbers). return None; } Some(Cholesky { chol: matrix }) } /// Retrieves the lower-triangular factor of the Cholesky decomposition with its strictly ...
{ if let Some(denom) = diag.try_sqrt() { unsafe { *matrix.get_unchecked_mut((j, j)) = denom; } let mut col = matrix.slice_range_mut(j + 1.., j); col /= denom; continue; ...
conditional_block
cholesky.rs
#[cfg(feature = "serde-serialize")] use serde::{Deserialize, Serialize}; use num::One; use simba::scalar::ComplexField; use crate::allocator::Allocator; use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix, Vector}; use crate::constraint::{SameNumberOfRows, ShapeConstraint}; use crate::dimensio...
(&self) -> &MatrixN<N, D> { &self.chol } /// Solves the system `self * x = b` where `self` is the decomposed matrix and `x` the unknown. /// /// The result is stored on `b`. pub fn solve_mut<R2: Dim, C2: Dim, S2>(&self, b: &mut Matrix<N, R2, C2, S2>) where S2: StorageMut<N, R2, ...
l_dirty
identifier_name
cholesky.rs
#[cfg(feature = "serde-serialize")] use serde::{Deserialize, Serialize}; use num::One; use simba::scalar::ComplexField; use crate::allocator::Allocator; use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix, Vector}; use crate::constraint::{SameNumberOfRows, ShapeConstraint}; use crate::dimensio...
/// Computes the inverse of the decomposed matrix. pub fn inverse(&self) -> MatrixN<N, D> { let shape = self.chol.data.shape(); let mut res = MatrixN::identity_generic(shape.0, shape.1); self.solve_mut(&mut res); res } /// Given the Cholesky decomposition of a matrix ...
{ let mut res = b.clone_owned(); self.solve_mut(&mut res); res }
identifier_body
store.ts
import { configureStore } from '@reduxjs/toolkit'; import { createWrapper } from 'next-redux-wrapper'; import { appApi } from '@blog/client/web/api'; import { createSlice, PayloadAction } from '@reduxjs/toolkit'; interface State { theme: 'light' | 'dark'; } const initialState: State = { theme: 'light', }; int...
export type AppStore = ReturnType<typeof makeStore>; export type RootState = ReturnType<AppStore['getState']>; export type AppDispatch = AppStore['dispatch']; export const wrapper = createWrapper<AppStore>(makeStore, { debug: true });
}, middleware: (gDM) => gDM().concat(appApi.middleware), });
random_line_split
store.ts
import { configureStore } from '@reduxjs/toolkit'; import { createWrapper } from 'next-redux-wrapper'; import { appApi } from '@blog/client/web/api'; import { createSlice, PayloadAction } from '@reduxjs/toolkit'; interface State { theme: 'light' | 'dark'; } const initialState: State = { theme: 'light', }; int...
, }, }); export const { setTheme } = app.actions; export const makeStore = () => configureStore({ reducer: { app: app.reducer, [appApi.reducerPath]: appApi.reducer, }, middleware: (gDM) => gDM().concat(appApi.middleware), }); export type AppStore = ReturnTy...
{ const { theme } = action.payload; localStorage.setItem('theme', theme); state.theme = theme; }
identifier_body
store.ts
import { configureStore } from '@reduxjs/toolkit'; import { createWrapper } from 'next-redux-wrapper'; import { appApi } from '@blog/client/web/api'; import { createSlice, PayloadAction } from '@reduxjs/toolkit'; interface State { theme: 'light' | 'dark'; } const initialState: State = { theme: 'light', }; int...
(state, action: PayloadAction<ThemeDataLoaded>) { const { theme } = action.payload; localStorage.setItem('theme', theme); state.theme = theme; }, }, }); export const { setTheme } = app.actions; export const makeStore = () => configureStore({ reducer: { ...
setTheme
identifier_name
rollbarLogger.js
import omit from 'lodash/omit'; import get from 'lodash/get'; import isFunction from 'lodash/isFunction'; import { bunyanLevelToRollbarLevelName } from '../common/rollbar'; // Rollbar script exposes this global immediately, whether or not its already initialized export const isGlobalRollbarConfigured = () => !!get(gl...
/** * Transport logs to Rollbar * @param {Object} data * @returns {undefined} */ ClientRollbarLogger.prototype.write = function (data = {}) { const rollbarLevelName = bunyanLevelToRollbarLevelName(data.level); const scopeData = omit(data, ['err', 'level']); const payload = Object.assign({ level: rollbarLev...
{ // Rollbar may already be initialized, but thats ok // https://rollbar.com/docs/notifier/rollbar.js/configuration/ global.Rollbar.configure({ accessToken: token, environment, captureUncaught: true, captureUnhandledRejections: true, payload: { environment, javascript: { co...
identifier_body
rollbarLogger.js
import omit from 'lodash/omit'; import get from 'lodash/get'; import isFunction from 'lodash/isFunction'; import { bunyanLevelToRollbarLevelName } from '../common/rollbar'; // Rollbar script exposes this global immediately, whether or not its already initialized export const isGlobalRollbarConfigured = () => !!get(gl...
else { global.Rollbar.error(data.msg, data.err, payload); } };
{ logFn.call(global.Rollbar, data.msg, data.err, payload); }
conditional_block
rollbarLogger.js
import omit from 'lodash/omit'; import get from 'lodash/get'; import isFunction from 'lodash/isFunction'; import { bunyanLevelToRollbarLevelName } from '../common/rollbar'; // Rollbar script exposes this global immediately, whether or not its already initialized export const isGlobalRollbarConfigured = () => !!get(gl...
environment, javascript: { code_version: codeVersion, source_map_enabled: true, }, }, }); } /** * Transport logs to Rollbar * @param {Object} data * @returns {undefined} */ ClientRollbarLogger.prototype.write = function (data = {}) { const rollbarLevelName = bunyanLevelTo...
accessToken: token, environment, captureUncaught: true, captureUnhandledRejections: true, payload: {
random_line_split
rollbarLogger.js
import omit from 'lodash/omit'; import get from 'lodash/get'; import isFunction from 'lodash/isFunction'; import { bunyanLevelToRollbarLevelName } from '../common/rollbar'; // Rollbar script exposes this global immediately, whether or not its already initialized export const isGlobalRollbarConfigured = () => !!get(gl...
({ token, environment, codeVersion }) { // Rollbar may already be initialized, but thats ok // https://rollbar.com/docs/notifier/rollbar.js/configuration/ global.Rollbar.configure({ accessToken: token, environment, captureUncaught: true, captureUnhandledRejections: true, payload: { envir...
ClientRollbarLogger
identifier_name
destinations.js
import {assert} from 'chai' import {toConsole} from '../src/destinations' import {Message} from '../src/message' import {addDestination} from '../src/output' import {assertContainsFields} from '../src/testing' describe('toConsole', function() { /** @test {toConsole} */ it('performs a noop if no suitable meth...
assertContainsFields( messages[0], {x: 123}) }) })
remove = addDestination(toConsole(console)) Message.create({x: 123}).write() remove()
random_line_split
jp2kakadu.py
# Copyright 2014 NeuroData (http://neurodata.io) # # 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 __name__ == "__main__": main()
parser = argparse.ArgumentParser(description='Convert JP2 to PNG') parser.add_argument('path', action="store", help='Directory with JP2 Files') parser.add_argument('location', action="store", help='Directory to write to') result = parser.parse_args() # Reading all the jp2 files in that directory filelist = ...
identifier_body
jp2kakadu.py
# Copyright 2014 NeuroData (http://neurodata.io) # # 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...
main()
conditional_block
jp2kakadu.py
# Copyright 2014 NeuroData (http://neurodata.io) # # 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...
print "Opening: {}".format( name ) # Identifying the subdirectory to place the data under if name.find('F') != -1: subfile = 'F/' elif name.find('IHC') != -1: subfile = 'IHC/' elif name.find('N') != -1: subfile = 'N/' # Determine the write location of the file. This was /m...
filelist = glob.glob(result.path+'*.jp2') for name in filelist:
random_line_split
jp2kakadu.py
# Copyright 2014 NeuroData (http://neurodata.io) # # 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...
(): parser = argparse.ArgumentParser(description='Convert JP2 to PNG') parser.add_argument('path', action="store", help='Directory with JP2 Files') parser.add_argument('location', action="store", help='Directory to write to') result = parser.parse_args() # Reading all the jp2 files in that directory fi...
main
identifier_name
completion_docs.ts
/* * Copyright 2021 Google LLC * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY;...
View [the full documentation](${DOCS_ROOT}/language/explore.html#limiting-access-to-fields). `; export const COMPLETION_DOCS: { [kind: string]: { [property: string]: string }; } = { model_property: { explore: MODEL_EXPLORE_DOC, source: MODEL_SOURCE_DOC, query: MODEL_QUERY_DOC, sql: MODEL_SQL_DOC, ...
explore: airports is table('malloy-data.faa.airports') { except: [ c_ldg_rts, aero_cht, cntl_twr ] } \`\`\`
random_line_split
versions_repository.py
import logging import os from lib import exception from lib import repository from lib.constants import REPOSITORIES_DIR LOG = logging.getLogger(__name__) def get_versions_repository(config): """ Get the packages metadata Git repository, cloning it if does not yet exist. Args: config (dict...
def read_version_and_milestone(versions_repo): """ Read current version and milestone (alpha or beta) from VERSION file Args: versions_repo (GitRepository): packages metadata git repository Returns: version_milestone (str): version and milestone. Format: <version>-<milest...
""" Prepare the packages metadata Git repository, cloning it and checking out at the chosen branch. Args: config (dict): configuration dictionary Raises: exception.RepositoryError: if the clone or checkout are unsuccessful """ versions_repo = get_versions_repository...
identifier_body
versions_repository.py
import logging import os from lib import exception from lib import repository from lib.constants import REPOSITORIES_DIR LOG = logging.getLogger(__name__) def
(config): """ Get the packages metadata Git repository, cloning it if does not yet exist. Args: config (dict): configuration dictionary Raises: exception.RepositoryError: if the clone is unsuccessful """ path = os.path.join(config.get('work_dir'), RE...
get_versions_repository
identifier_name
versions_repository.py
import logging import os from lib import exception from lib import repository from lib.constants import REPOSITORIES_DIR LOG = logging.getLogger(__name__) def get_versions_repository(config): """ Get the packages metadata Git repository, cloning it if does not yet exist. Args: config (dict...
def setup_versions_repository(config): """ Prepare the packages metadata Git repository, cloning it and checking out at the chosen branch. Args: config (dict): configuration dictionary Raises: exception.RepositoryError: if the clone or checkout are unsuccessful ""...
random_line_split
testRBTCoM.py
from __future__ import print_function import unittest import numpy as np import pydrake import os.path class TestRBTCoM(unittest.TestCase): def testCoM0(self):
def testCoMJacobian(self): r = pydrake.rbtree.RigidBodyTree(os.path.join(pydrake.getDrakePath(), "examples/Pendulum/Pendulum.urdf")) q = r.getRandomConfiguration() kinsol = r.doKinematics(q, np.zeros((7, 1))) J = r.centerOfMassJacobian(kinso...
r = pydrake.rbtree.RigidBodyTree(os.path.join(pydrake.getDrakePath(), "examples/Pendulum/Pendulum.urdf")) kinsol = r.doKinematics(np.zeros((7, 1)), np.zeros((7, 1))) c = r.centerOfMass(kinsol) self.assertTrue(np.allclose(c.flat, [0.0, 0.0, -0.2425], at...
identifier_body
testRBTCoM.py
from __future__ import print_function import unittest import numpy as np import pydrake import os.path class TestRBTCoM(unittest.TestCase): def
(self): r = pydrake.rbtree.RigidBodyTree(os.path.join(pydrake.getDrakePath(), "examples/Pendulum/Pendulum.urdf")) kinsol = r.doKinematics(np.zeros((7, 1)), np.zeros((7, 1))) c = r.centerOfMass(kinsol) self.assertTrue(np.allclose(c.flat, [0.0, 0...
testCoM0
identifier_name
testRBTCoM.py
from __future__ import print_function import unittest import numpy as np import pydrake import os.path class TestRBTCoM(unittest.TestCase): def testCoM0(self): r = pydrake.rbtree.RigidBodyTree(os.path.join(pydrake.getDrakePath(), "examples/Pendulum/Pendulum.urdf"))...
unittest.main()
conditional_block
testRBTCoM.py
from __future__ import print_function import unittest import numpy as np import pydrake import os.path class TestRBTCoM(unittest.TestCase): def testCoM0(self): r = pydrake.rbtree.RigidBodyTree(os.path.join(pydrake.getDrakePath(), "examples/Pendulum/Pendulum.urdf"))...
J = r.centerOfMassJacobian(kinsol) self.assertTrue(np.allclose(J.flat, [1., 0., 0., 0., -0.2425, 0., -0.25, 0., 1., 0., 0.2425, 0., 0., 0., 0., 0., 1., 0., 0., 0., 0.], atol=1e-4)) if __name__ == '__main__': unittest.main()
kinsol = r.doKinematics(q, np.zeros((7, 1)))
random_line_split
mime.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
{ const filterAndSortedMimes = filterAndSortMimes(result.mimes, mime.guessMimeTypes(nameHint)); result.mimes = filterAndSortedMimes; return result; }
identifier_body
mime.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(instream: streams.Readable, nameHint: string, option?: DetectMimesOption): TPromise<IMimeAndEncoding> { return doDetectMimesFromStream(instream, option).then(encoding => handleMimeResult(nameHint, encoding) ); } /** * Opens the given file to detect its mime type. Returns an array of mime types sorted from most s...
detectMimesFromStream
identifier_name
mime.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
else { autoGuessEncoding = arg1 && arg1.autoGuessEncoding; } return autoGuessEncoding ? AUTO_GUESS_BUFFER_MAX_LEN : NO_GUESS_BUFFER_MAX_LEN; } export interface IMimeAndEncoding { encoding: string; mimes: string[]; } export interface DetectMimesOption { autoGuessEncoding?: boolean; } function doDetectMimesFr...
{ autoGuessEncoding = arg1; }
conditional_block
mime.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
return stream.readExactlyByFile(absolutePath, maxBufferLen(option)).then((readResult: stream.ReadResult) => { return detectMimeAndEncodingFromBuffer(readResult, option && option.autoGuessEncoding); }); } export function detectMimeAndEncodingFromBuffer({ buffer, bytesRead }: stream.ReadResult, autoGuessEncoding?: b...
function doDetectMimesFromFile(absolutePath: string, option?: DetectMimesOption): TPromise<IMimeAndEncoding> {
random_line_split
sp_2_conf.py
from pathutils import full_path CONFIG = { "entityid" : "urn:mace:example.com:saml:roland:sp", "name" : "urn:mace:example.com:saml:roland:sp", "description": "My own SP", "service": { "sp": { "endpoints":{ "assertion_consumer_service": ["http://lingon.catalogix.se:80...
"organization": { "name": ("AB Exempel", "se"), "display_name": ("AB Exempel", "se"), "url": "http://www.example.org", }, "contact_person": [{ "given_name": "Roland", "sur_name": "Hedberg", "telephone_number": "+46 70 100 0000", "email_address": ["...
"subject_data": full_path("subject_data.db"), "accepted_time_diff": 60, "attribute_map_dir" : full_path("attributemaps"),
random_line_split
cache.ts
import {cleanCache, installPkgs, install} from '../src' import {add as addDistTag} from './support/distTags' import testDefaults from './support/testDefaults' import tape = require('tape') import promisifyTape from 'tape-promise' import exists = require('exists-file') import path = require('path') import prepare from '...
test('should skip cahe even if it exists when cacheTTL = 0', async function (t) { const project = prepare(t) const latest = 'stable' await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', latest) await installPkgs(['pkg-with-1-dep'], testDefaults({save: true, tag: latest, cacheTTL: 60 * 60})) await project...
await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') })
random_line_split
firefox_run.py
import os from outlawg import Outlawg from fftool import ( DIR_CONFIGS, local ) from ini_handler import IniHandler Log = Outlawg() env = IniHandler() env.load_os_config(DIR_CONFIGS) def launch_firefox(profile_path, channel, logging, nspr_log_modules=''):
"""relies on the other functions (download, install, profile) having completed. """ FIREFOX_APP_BIN = env.get(channel, 'PATH_FIREFOX_BIN_ENV') Log.header('LAUNCH FIREFOX') print("Launching Firefox {0} with profile: {1}".format( channel, profile_path) ) cmd = '"{0}" -profil...
identifier_body
firefox_run.py
import os from outlawg import Outlawg from fftool import ( DIR_CONFIGS, local ) from ini_handler import IniHandler Log = Outlawg() env = IniHandler() env.load_os_config(DIR_CONFIGS) def
(profile_path, channel, logging, nspr_log_modules=''): """relies on the other functions (download, install, profile) having completed. """ FIREFOX_APP_BIN = env.get(channel, 'PATH_FIREFOX_BIN_ENV') Log.header('LAUNCH FIREFOX') print("Launching Firefox {0} with profile: {1}".format( cha...
launch_firefox
identifier_name
firefox_run.py
import os from outlawg import Outlawg from fftool import ( DIR_CONFIGS, local ) from ini_handler import IniHandler Log = Outlawg() env = IniHandler() env.load_os_config(DIR_CONFIGS) def launch_firefox(profile_path, channel, logging, nspr_log_modules=''): """relies on the other functions (download, instal...
local(cmd, logging)
Log.header('FIREFOX NSPR_LOG_MODULES LOGGING') os.environ['NSPR_LOG_MODULES'] = nspr_log_modules
conditional_block
firefox_run.py
import os from outlawg import Outlawg from fftool import ( DIR_CONFIGS, local ) from ini_handler import IniHandler Log = Outlawg() env = IniHandler() env.load_os_config(DIR_CONFIGS) def launch_firefox(profile_path, channel, logging, nspr_log_modules=''):
""" FIREFOX_APP_BIN = env.get(channel, 'PATH_FIREFOX_BIN_ENV') Log.header('LAUNCH FIREFOX') print("Launching Firefox {0} with profile: {1}".format( channel, profile_path) ) cmd = '"{0}" -profile "{1}"'.format(FIREFOX_APP_BIN, profile_path) print('CMD: ' + cmd) # NSPR_...
"""relies on the other functions (download, install, profile) having completed.
random_line_split
RecurringSelect.js
var React = require('react'); var RulePicker = require('./RulePicker.js'); var TimePicker = require('react-time-picker'); var DatePicker = require('react-date-picker'); var RuleSummary = require("./RuleSummary.js"); var moment = require('moment'); var Tabs = require('react-simpletabs'); var RecurringSelect = React.cre...
startTime: time }); }, handleSave: function(e) { var hash = this.state; console.log(hash.validations); var iceCubeHash = {}; var start = moment(hash.startTime, "hh:mm a A"); var minute = start.minute(); var hour = start.hour(); var rule_type; switch (hash.rule) { case...
}); }, handleTimeChange: function(time) { this.setState({
random_line_split
auracite_web.rs
#![feature(plugin)] #![plugin(rocket_codegen)] extern crate auracite; extern crate rocket; use auracite::{web, lodestone}; use auracite::env::load_var; use rocket::config::Config; fn main() { rocket::custom(config(), true) .mount("/", routes![web::root::web_root, web::assets::static_asset]) .moun...
() -> Config { use rocket::config::*; let env = Environment::active().unwrap(); let mut config = Config::build(env); config = config.address("0.0.0.0"); let port = load_var("PORT", "8080"); if let Some(port) = port.parse().ok() { config = config.port(port); } config.finalize()...
config
identifier_name
auracite_web.rs
#![feature(plugin)] #![plugin(rocket_codegen)] extern crate auracite; extern crate rocket; use auracite::{web, lodestone}; use auracite::env::load_var; use rocket::config::Config; fn main()
fn config() -> Config { use rocket::config::*; let env = Environment::active().unwrap(); let mut config = Config::build(env); config = config.address("0.0.0.0"); let port = load_var("PORT", "8080"); if let Some(port) = port.parse().ok() { config = config.port(port); } config...
{ rocket::custom(config(), true) .mount("/", routes![web::root::web_root, web::assets::static_asset]) .mount("/lodestone", routes![lodestone::rss, lodestone::jsonfeed]) .catch(errors![web::core::not_found]) .launch(); }
identifier_body
auracite_web.rs
#![feature(plugin)] #![plugin(rocket_codegen)] extern crate auracite; extern crate rocket; use auracite::{web, lodestone}; use auracite::env::load_var; use rocket::config::Config; fn main() { rocket::custom(config(), true) .mount("/", routes![web::root::web_root, web::assets::static_asset]) .moun...
config.finalize().unwrap() }
{ config = config.port(port); }
conditional_block
auracite_web.rs
#![feature(plugin)] #![plugin(rocket_codegen)] extern crate auracite; extern crate rocket;
fn main() { rocket::custom(config(), true) .mount("/", routes![web::root::web_root, web::assets::static_asset]) .mount("/lodestone", routes![lodestone::rss, lodestone::jsonfeed]) .catch(errors![web::core::not_found]) .launch(); } fn config() -> Config { use rocket::config::*; ...
use auracite::{web, lodestone}; use auracite::env::load_var; use rocket::config::Config;
random_line_split
rep.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2013 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # ...
if __name__ == '__main__': ctx = zmq.Context() rep = ctx.socket(zmq.REP) rep.bind('tcp://*:5555') print 'reply init sucess ...' try: rep.recv() except KeyboardInterrupt: print 'W: interrupte received, proceeding ...' count = 0 signal.signal(signal.SIGINT, signal_handler) while True: ...
global interrupted interrupted = True
identifier_body
rep.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2013 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # ...
ctx = zmq.Context() rep = ctx.socket(zmq.REP) rep.bind('tcp://*:5555') print 'reply init sucess ...' try: rep.recv() except KeyboardInterrupt: print 'W: interrupte received, proceeding ...' count = 0 signal.signal(signal.SIGINT, signal_handler) while True: try: msg = rep.recv(zmq.D...
conditional_block
rep.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2013 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # ...
(signum, frame): global interrupted interrupted = True if __name__ == '__main__': ctx = zmq.Context() rep = ctx.socket(zmq.REP) rep.bind('tcp://*:5555') print 'reply init sucess ...' try: rep.recv() except KeyboardInterrupt: print 'W: interrupte received, proceeding ...' count = 0 sign...
signal_handler
identifier_name
rep.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2013 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # ...
if interrupted: print 'W: interrupte received, Killing server ...' break rep.close()
pass count += 1
random_line_split
runner.py
import os import subprocess # This is an example for using Kataja to launch a visualisation from a python script that doesn't use kataja # structures, but can output bracket trees. Kataja is launched as a separate process so it doesn't stop the # main script. def send_to_kataja(tree, image_file=''): # return os...
# tree = """[.{CP} [.{DP(0)} [.{D'} [.{D} which ] [.{NP} [.{N'} [.N wine ] ] ] ] ] [.{C'} [.C \epsilon [.{VP} [.{DP} [.{D'} [.D the ] [.{NP} [.{N'} [.N queen ] ] ] ] ] [.{V'} [.V prefers ] [.{DP} t(0) ] ] ] ] ] ] # """ tree = """[.{FP} {Graham Greene_i} [.{F'} on_j [.{TP} t_i [.{T'} t_j [.{AuxP} t_j [.{PrtP} kirjoi...
args = ['python', 'Kataja.py'] if image_file: args.append('-image_out') args.append(image_file) args.append(tree) if os.name == 'posix': # return os.spawnv(os.P_NOWAIT, '', args) return subprocess.Popen(args, preexec_fn=os.setpgrp, stdout=subprocess.DEVNULL) elif os.name ...
identifier_body
runner.py
import os import subprocess # This is an example for using Kataja to launch a visualisation from a python script that doesn't use kataja # structures, but can output bracket trees. Kataja is launched as a separate process so it doesn't stop the # main script. def send_to_kataja(tree, image_file=''): # return os...
elif os.name == 'nt' and hasattr(os, 'P_DETACH'): return os.spawnv(os.P_DETACH, 'python', args) # python Kataja.py -image_out test.pdf "[ [ A {word} ] [.T did [.V happen ] ] ]" # tree = """[.{CP} [.{DP(0)} [.{D'} [.{D} which ] [.{NP} [.{N'} [.N wine ] ] ] ] ] [.{C'} [.C \epsilon [.{VP} [.{DP} [.{D'}...
return subprocess.Popen(args, preexec_fn=os.setpgrp, stdout=subprocess.DEVNULL)
conditional_block
runner.py
import os import subprocess # This is an example for using Kataja to launch a visualisation from a python script that doesn't use kataja # structures, but can output bracket trees. Kataja is launched as a separate process so it doesn't stop the # main script. def send_to_kataja(tree, image_file=''): # return os...
# tree = """[.{CP} [.{DP(0)} [.{D'} [.{D} which ] [.{NP} [.{N'} [.N wine ] ] ] ] ] [.{C'} [.C \epsilon [.{VP} [.{DP} [.{D'} [.D the ] [.{NP} [.{N'} [.N queen ] ] ] ] ] [.{V'} [.V prefers ] [.{DP} t(0) ] ] ] ] ] ] # """ tree = """[.{FP} {Graham Greene_i} [.{F'} on_j [.{TP} t_i [.{T'} t_j [.{AuxP} t_j [.{PrtP} kirjoitta...
random_line_split
runner.py
import os import subprocess # This is an example for using Kataja to launch a visualisation from a python script that doesn't use kataja # structures, but can output bracket trees. Kataja is launched as a separate process so it doesn't stop the # main script. def
(tree, image_file=''): # return os.system(f'python Kataja.py -image_out test.pdf "{tree}"') args = ['python', 'Kataja.py'] if image_file: args.append('-image_out') args.append(image_file) args.append(tree) if os.name == 'posix': # return os.spawnv(os.P_NOWAIT, '', args) ...
send_to_kataja
identifier_name
aws_provider_bag_test.py
import pytest from mock import Mock from sigopt.orchestrate.services.aws_provider_bag import AwsProviderServiceBag class TestOrchestrateServiceBag(object): @pytest.fixture def orchestrate_services(self):
def test_orchestrate_service_bag(self, orchestrate_services): services = AwsProviderServiceBag(orchestrate_services) assert services.cloudformation_service is not None assert services.cloudformation_service.client is not None assert services.cloudformation_service.cloudformation is not None asser...
return Mock()
random_line_split
aws_provider_bag_test.py
import pytest from mock import Mock from sigopt.orchestrate.services.aws_provider_bag import AwsProviderServiceBag class TestOrchestrateServiceBag(object): @pytest.fixture def orchestrate_services(self):
def test_orchestrate_service_bag(self, orchestrate_services): services = AwsProviderServiceBag(orchestrate_services) assert services.cloudformation_service is not None assert services.cloudformation_service.client is not None assert services.cloudformation_service.cloudformation is not None asse...
return Mock()
identifier_body
aws_provider_bag_test.py
import pytest from mock import Mock from sigopt.orchestrate.services.aws_provider_bag import AwsProviderServiceBag class
(object): @pytest.fixture def orchestrate_services(self): return Mock() def test_orchestrate_service_bag(self, orchestrate_services): services = AwsProviderServiceBag(orchestrate_services) assert services.cloudformation_service is not None assert services.cloudformation_service.client is not None...
TestOrchestrateServiceBag
identifier_name
index.js
/** * gb-vat * * @module gb-vat * @autor Grzegorz Bylica (grzegorz.bylica@gmail.com) */
var getVATNet = function(gross,rate) { var net = gross/(1+rate/100); console.log("net:"+net); var int = parseInt((net * 100), 10); console.log("int:"+int); var digit = parseInt(net * 1000, 10) - (int * 10); console.log("digit:"+digit); if (digit === 0) { int=int; } else { if (digit < -5) { ...
//var vatRates = require('./vat_rates.json'); var exports = module.exports = {};
random_line_split
index.js
/** * gb-vat * * @module gb-vat * @autor Grzegorz Bylica (grzegorz.bylica@gmail.com) */ //var vatRates = require('./vat_rates.json'); var exports = module.exports = {}; var getVATNet = function(gross,rate) { var net = gross/(1+rate/100); console.log("net:"+net); var int = parseInt((net * 100), 10); console...
} return int/100; } var getVATGross = function(net,rate) { return 0; } exports.getVATNet = getVATNet; exports.getVATGross = getVATGross;
{ int = int + 1; }
conditional_block
react_flight_codegen_test.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @generated SignedSource<<569f1efa26994d3ed3c24325d2914203>> */ mod react_flight_codegen;
fn flight_invalid() { let input = include_str!("react_flight_codegen/fixtures/flight.invalid.graphql"); let expected = include_str!("react_flight_codegen/fixtures/flight.invalid.expected"); test_fixture(transform_fixture, "flight.invalid.graphql", "react_flight_codegen/fixtures/flight.invalid.expected", inp...
use react_flight_codegen::transform_fixture; use fixture_tests::test_fixture; #[test]
random_line_split
react_flight_codegen_test.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @generated SignedSource<<569f1efa26994d3ed3c24325d2914203>> */ mod react_flight_codegen; use react_flight_codegen::transform_...
() { let input = include_str!("react_flight_codegen/fixtures/flight-props.graphql"); let expected = include_str!("react_flight_codegen/fixtures/flight-props.expected"); test_fixture(transform_fixture, "flight-props.graphql", "react_flight_codegen/fixtures/flight-props.expected", input, expected); }
flight_props
identifier_name
react_flight_codegen_test.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @generated SignedSource<<569f1efa26994d3ed3c24325d2914203>> */ mod react_flight_codegen; use react_flight_codegen::transform_...
#[test] fn flight_props() { let input = include_str!("react_flight_codegen/fixtures/flight-props.graphql"); let expected = include_str!("react_flight_codegen/fixtures/flight-props.expected"); test_fixture(transform_fixture, "flight-props.graphql", "react_flight_codegen/fixtures/flight-props.expected", inp...
{ let input = include_str!("react_flight_codegen/fixtures/flight.invalid.graphql"); let expected = include_str!("react_flight_codegen/fixtures/flight.invalid.expected"); test_fixture(transform_fixture, "flight.invalid.graphql", "react_flight_codegen/fixtures/flight.invalid.expected", input, expected); }
identifier_body
gulpfile.js
// Include gulp var gulp = require('gulp'); // Include Our Plugins var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var rename = require('gulp-rename'); var header = require('gulp-header'); var footer = require('gulp-footer'); // Build Task gulp.task('default', function() { gulp.src([ "src/...
.pipe(uglify({ output: { comments: /^!/i } })) .pipe(gulp.dest('./dist')); });
"}\n\n" + "})();")) .pipe(gulp.dest('./dist')) .pipe(rename('legends.min.js'))
random_line_split
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::CharacterDataBinding::Chara...
(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOptionElement { HTMLOptionElement { htmlelement: HTMLElement::new_inherited(HTMLOptionElementTypeId, localName, prefix, document) } } #[allow(unrooted_must_root)] pub fn new(localName: DOMString,...
new_inherited
identifier_name
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::CharacterDataBinding::Chara...
} impl HTMLOptionElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOptionElement { HTMLOptionElement { htmlelement: HTMLElement::new_inherited(HTMLOptionElementTypeId, localName, prefix, document) } } #[allow(unrooted...
{ *self.type_id() == NodeTargetTypeId(ElementNodeTypeId(HTMLOptionElementTypeId)) }
identifier_body
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::CharacterDataBinding::Chara...
let elem: JSRef<Element> = ElementCast::from_ref(self); elem.set_bool_attribute(&atom!("disabled"), disabled) } // http://www.whatwg.org/html/#dom-option-text fn Text(self) -> DOMString { let node: JSRef<Node> = NodeCast::from_ref(self); let mut content = String::new(); ...
// http://www.whatwg.org/html/#dom-option-disabled fn SetDisabled(self, disabled: bool) {
random_line_split
jobs.full.component.ts
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { JobsService } from '../services/jobs.service'; import { JobModel } from '../models/job.model'; import { ButtonsComponent } from './buttons.component'; @Component({ selector: 'my-fu...
onGetJob() { this.sub = this.route.params .subscribe( params => { this.jobId = params['id'] this.jobsService.getJob(this.jobId) .subscribe( job => this.job = job, err => console.error(err) ) } ) } statusWas...
{}
identifier_body
jobs.full.component.ts
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { JobsService } from '../services/jobs.service'; import { JobModel } from '../models/job.model'; import { ButtonsComponent } from './buttons.component'; @Component({ selector: 'my-fu...
this.onGetJob(); } }
ngOnInit() {
random_line_split
jobs.full.component.ts
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { JobsService } from '../services/jobs.service'; import { JobModel } from '../models/job.model'; import { ButtonsComponent } from './buttons.component'; @Component({ selector: 'my-fu...
implements OnInit { job: JobModel = new JobModel(); jobId: string; private sub: any; constructor(private jobsService: JobsService, private route: ActivatedRoute, private router: Router) {} onGetJob() { this.sub = this.route.params .subscribe( params => { ...
JobsFullComponent
identifier_name
jobs.full.component.ts
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { JobsService } from '../services/jobs.service'; import { JobModel } from '../models/job.model'; import { ButtonsComponent } from './buttons.component'; @Component({ selector: 'my-fu...
}, error => console.error(error) ) } ngOnInit() { this.onGetJob(); } }
{ this.router.navigate(['admin/dashboard']) }
conditional_block
component.ts
/*! * V4Fire Client Core * https://github.com/V4Fire/Client * * Released under the MIT license * https://github.com/V4Fire/Client/blob/master/LICENSE */ import watch, { set, mute, unmute, WatchHandlerParams } from 'core/object/watch'; import * as init from 'core/component/construct'; import { beforeRenderHooks ...
if (meta.fields[String(path[0])]?.forceUpdate !== false) { ctx.$forceUpdate(); } let {obj} = info; if (path.length > 1) { if (Object.isDictionary(obj)) { const key = String(path[path.length - 1]), desc = Object.getOwnPropertyDescriptor(obj, key); // If we re...
{ return; }
conditional_block
component.ts
/*! * V4Fire Client Core * https://github.com/V4Fire/Client * * Released under the MIT license * https://github.com/V4Fire/Client/blob/master/LICENSE */ import watch, { set, mute, unmute, WatchHandlerParams } from 'core/object/watch'; import * as init from 'core/component/construct'; import { beforeRenderHooks ...
function watcher(value: unknown, oldValue: unknown, info: WatchHandlerParams): void { const {path} = info; ctx.lastSelfReasonToRender = { path, value, oldValue }; if (beforeRenderHooks[ctx.hook] === true) { return; } if (meta.fields[String(path[0])]?.forceUpdate !...
return ctx.$fields;
random_line_split
component.ts
/*! * V4Fire Client Core * https://github.com/V4Fire/Client * * Released under the MIT license * https://github.com/V4Fire/Client/blob/master/LICENSE */ import watch, { set, mute, unmute, WatchHandlerParams } from 'core/object/watch'; import * as init from 'core/component/construct'; import { beforeRenderHooks ...
(this: ComponentInterface): void { init.beforeUpdateState(this); }, updated(this: ComponentInterface): void { init.updatedState(this); }, activated(this: ComponentInterface): void { init.activatedState(this); }, deactivated(this: ComponentInterface): void { init.deactivatedState(this); }, ...
beforeUpdate
identifier_name
component.ts
/*! * V4Fire Client Core * https://github.com/V4Fire/Client * * Released under the MIT license * https://github.com/V4Fire/Client/blob/master/LICENSE */ import watch, { set, mute, unmute, WatchHandlerParams } from 'core/object/watch'; import * as init from 'core/component/construct'; import { beforeRenderHooks ...
, updated(this: ComponentInterface): void { init.updatedState(this); }, activated(this: ComponentInterface): void { init.activatedState(this); }, deactivated(this: ComponentInterface): void { init.deactivatedState(this); }, beforeDestroy(this: ComponentInterface): void { init.beforeDestroy...
{ init.beforeUpdateState(this); }
identifier_body
ch04_05.py
#!/usr/bin/env python def print_banner(s): print('##------------------------------------------------------------------------------') print(f'## {s}') print('##------------------------------------------------------------------------------') print_banner('First implementation') class Base: def foo(self...
try: print('Instantiate c = Concrete()') c = Concrete() except TypeError as err: print(f'Got this TypeError error: {err!r}')
except TypeError as err: print(f'Got this TypeError error: {err!r}')
random_line_split
ch04_05.py
#!/usr/bin/env python def print_banner(s): print('##------------------------------------------------------------------------------') print(f'## {s}') print('##------------------------------------------------------------------------------') print_banner('First implementation') class Base: def foo(self...
assert issubclass(Concrete, Base) try: print('Instantiate b = Base()') b = Base() except TypeError as err: print(f'Got this TypeError error: {err!r}') try: print('Instantiate c = Concrete()') c = Concrete() except TypeError as err: print(f'Got this TypeError error: {err!r}')
pass
identifier_body
ch04_05.py
#!/usr/bin/env python def print_banner(s): print('##------------------------------------------------------------------------------') print(f'## {s}') print('##------------------------------------------------------------------------------') print_banner('First implementation') class Base: def foo(self...
(self): pass class Concrete(Base): def foo(self): pass assert issubclass(Concrete, Base) try: print('Instantiate b = Base()') b = Base() except TypeError as err: print(f'Got this TypeError error: {err!r}') try: print('Instantiate c = Concrete()') c = Concrete() except TypeErr...
bar
identifier_name
variables_69.js
var searchData= [ ['image',['image',['../classImageHandler.html#a0ce1a69f70d8e75e0eea611a8e85d7ee',1,'ImageHandler']]], ['imagebuffermap',['imageBufferMap',['../classVideoImageBuffer.html#ae11339c099fee47945d3cf0abde6ccf4',1,'VideoImageBuffer']]], ['imagedetection',['imageDetection',['../classMainWindow.html#a63e...
['imgprocflags',['imgProcFlags',['../classPlaybackThread.html#a07256da1d599cd767e9d7c9485cf6e4c',1,'PlaybackThread::imgProcFlags()'],['../classProcessingThread.html#aa47c3d593cec9d8e64a3ab9f2f7e9c0d',1,'ProcessingThread::imgProcFlags()']]], ['imgprocsettings',['imgProcSettings',['../classPlaybackThread.html#a698215...
['imagehandler',['imageHandler',['../classMainWindow.html#aa2fc040e0d83598d3c476767b51d5b81',1,'MainWindow']]], ['imageprocessingflags',['imageProcessingFlags',['../classMainWindow.html#ac253195291425116bf374d391f60e0fa',1,'MainWindow']]], ['imageprocessingsettings',['imageProcessingSettings',['../classImageProce...
random_line_split
memoize_tests.py
# coding=utf-8 from multiprocessing import Process import unittest from unittest import TestCase from .. import SharedCacheServer, SharedCache, Memoize import time __author__ = 'matheus2740' class MemoizeTests(TestCase): def setUp(self): pass def tearDown(self): fun.remove_local_namespaces(...
@Memoize('test', 60) def fun(*args): return 1 if __name__ == '__main__': unittest.main()
server = SharedCacheServer() i1 = fun() def verify(): i2 = fun() assert i1 == i2 p = Process(target=verify) p.start() p.join() assert fun.get_stats()['hits'] == 1 assert fun.get_stats()['puts'] == 1 assert fun.get_stats()['gets']...
identifier_body
memoize_tests.py
# coding=utf-8 from multiprocessing import Process import unittest from unittest import TestCase from .. import SharedCacheServer, SharedCache, Memoize import time __author__ = 'matheus2740' class MemoizeTests(TestCase): def setUp(self): pass def tearDown(self): fun.remove_local_namespaces(...
unittest.main()
conditional_block
memoize_tests.py
# coding=utf-8 from multiprocessing import Process import unittest from unittest import TestCase from .. import SharedCacheServer, SharedCache, Memoize import time __author__ = 'matheus2740' class MemoizeTests(TestCase): def setUp(self): pass def tearDown(self): fun.remove_local_namespaces(...
return 1 if __name__ == '__main__': unittest.main()
random_line_split
memoize_tests.py
# coding=utf-8 from multiprocessing import Process import unittest from unittest import TestCase from .. import SharedCacheServer, SharedCache, Memoize import time __author__ = 'matheus2740' class MemoizeTests(TestCase): def
(self): pass def tearDown(self): fun.remove_local_namespaces() def test_simple_call(self): server = SharedCacheServer() i1 = fun() i2 = fun() i2 = fun() i2 = fun() i2 = fun() assert i1 == i2 assert fun.get_stats()['hits'] == 4 ...
setUp
identifier_name
decode.rs
extern crate byteorder; use std::env; use std::fs::File; use decode::byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian}; use common::Voxel; static FILE_VER: u8 = 1; pub fn parse_voxel(file: &mut File) -> Vec<Vec<Voxel>> { let sig = file.read_uint::<BigEndian>(3).unwrap(); if sig != 0x525654 {...
if sig != 0x565054 { panic!("UNKOWN FILETYPE"); } let ver = file.read_u8().unwrap(); let frame_count = file.read_u8().unwrap(); let color_count = file.read_u8().unwrap(); let mut frames: Vec<Vec<(u8, u8, u8)>> = Vec::new(); for frame_id in 0..frame_count { if file.read_u8()...
pub fn parse_pallete(file: &mut File) -> Vec<Vec<(u8, u8, u8)>> { let sig = file.read_u8().unwrap();
random_line_split
decode.rs
extern crate byteorder; use std::env; use std::fs::File; use decode::byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian}; use common::Voxel; static FILE_VER: u8 = 1; pub fn parse_voxel(file: &mut File) -> Vec<Vec<Voxel>> { let sig = file.read_uint::<BigEndian>(3).unwrap(); if sig != 0x525654 {...
let voxel_count = file.read_u32::<BigEndian>().unwrap(); let mut frame: Vec<Voxel> = Vec::new(); for voxel_id in 0..voxel_count { let x = file.read_i8().unwrap(); let y = file.read_i8().unwrap(); let z = file.read_i8().unwrap(); let mut color: (...
{ panic!("ERROR: FILE CORRUPTED: {}", frame_tag); }
conditional_block
decode.rs
extern crate byteorder; use std::env; use std::fs::File; use decode::byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian}; use common::Voxel; static FILE_VER: u8 = 1; pub fn parse_voxel(file: &mut File) -> Vec<Vec<Voxel>> { let sig = file.read_uint::<BigEndian>(3).unwrap(); if sig != 0x525654 {...
(file: &mut File) -> Vec<Vec<(u8, u8, u8)>> { let sig = file.read_u8().unwrap(); if sig != 0x565054 { panic!("UNKOWN FILETYPE"); } let ver = file.read_u8().unwrap(); let frame_count = file.read_u8().unwrap(); let color_count = file.read_u8().unwrap(); let mut frames: Vec<Vec<(u8, u8...
parse_pallete
identifier_name
decode.rs
extern crate byteorder; use std::env; use std::fs::File; use decode::byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian}; use common::Voxel; static FILE_VER: u8 = 1; pub fn parse_voxel(file: &mut File) -> Vec<Vec<Voxel>>
pub fn parse_pallete(file: &mut File) -> Vec<Vec<(u8, u8, u8)>> { let sig = file.read_u8().unwrap(); if sig != 0x565054 { panic!("UNKOWN FILETYPE"); } let ver = file.read_u8().unwrap(); let frame_count = file.read_u8().unwrap(); let color_count = file.read_u8().unwrap(); let mut f...
{ let sig = file.read_uint::<BigEndian>(3).unwrap(); if sig != 0x525654 { panic!("UNKOWN FILETYPE"); } let ver = file.read_u8().unwrap(); if ver > FILE_VER { panic!("ERROR: FILE VERSION IS GREATER THAN PROGRAM VERSION"); } let frame_count = file.read_u8().unwrap(); le...
identifier_body
data_ikr.py
import numpy as np ### Digitised data for HL-1 i_Kr channel. # I-V curves. def IV_Toyoda(): """Data points in IV curve for i_Kr. Data from Figure 1E from Toyoda 2010. Reported as mean \pm SEM from 10 cells. """ x = [-80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40] y = np.asarray([0...
### Activation kinetics. def ActKin_Toyoda(): """Data points for activation time constants for i_Kr. Data from Figure 3C in Toyoda 2010. Reported as mean \pm SEM for 10 cells. """ x = [-30, -20, -10, 0, 10, 20, 30, 40] y = np.asarray([457.75075987841944, 259.87841945288756, 184.194528875379...
"""Data points from activation curve for i_Kr. Data from Figure 2B in Toyoda 2010. Reported as mean \pm SEM for 10 cells. """ x = [-80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50] y = np.asarray([9.784726905999186E-4, 0.002037953817909388, 0.006032853017018169, 0.011008045321...
identifier_body
data_ikr.py
import numpy as np ### Digitised data for HL-1 i_Kr channel. # I-V curves. def IV_Toyoda(): """Data points in IV curve for i_Kr. Data from Figure 1E from Toyoda 2010. Reported as mean \pm SEM from 10 cells. """ x = [-80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40] y = np.asarray([0...
30.48086665107951, 35.819499649286854, 61.22281973345798, 165.04169589275978, 310.8097576182683, 474.81490141064614, 467.3875769620451]) sem = np.abs(y-sem) sd = np.sqrt(N) * sem return x, y.tolist(), sd.tolist() def DeactKinRelAmp_Toyoda(): """Data points for relati...
random_line_split
data_ikr.py
import numpy as np ### Digitised data for HL-1 i_Kr channel. # I-V curves. def IV_Toyoda(): """Data points in IV curve for i_Kr. Data from Figure 1E from Toyoda 2010. Reported as mean \pm SEM from 10 cells. """ x = [-80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40] y = np.asarray([0...
(): """Data points for relative amplitude of fast to slow component. Data from Figure 3D in Toyoda 2010. Reported as mena \pm SEM for 10 cells. """ x = [-120, -110, -100, -90, -80, -70, -60, -50, -40, -30] y = np.asarray([0.9269882659713168, 0.908735332464146, 0.8370273794002607, 0.7131681...
DeactKinRelAmp_Toyoda
identifier_name
common.py
#!/usr/bin/env python # # Common client code # # Copyright 2016 Markus Zoeller import os from launchpadlib.launchpad import Launchpad def get_project_client(project_name): cachedir = os.path.expanduser("~/.launchpadlib/cache/") if not os.path.exists(cachedir): os.makedirs(cachedir, 0o700) launchp...
(self, link, title, age): self.link = link self.title = title.encode('ascii', 'replace') self.age = age def __str__(self): data = {'link': self.link, 'title': self.title, 'age': self.age} return "{link} ({title}) - ({age} days)".format(**data) def __cmp__(self, other): ...
__init__
identifier_name
common.py
#!/usr/bin/env python # # Common client code # # Copyright 2016 Markus Zoeller import os from launchpadlib.launchpad import Launchpad def get_project_client(project_name): cachedir = os.path.expanduser("~/.launchpadlib/cache/") if not os.path.exists(cachedir): os.makedirs(cachedir, 0o700) launchp...
def __cmp__(self, other): return cmp(self.age, other.age)
random_line_split
common.py
#!/usr/bin/env python # # Common client code # # Copyright 2016 Markus Zoeller import os from launchpadlib.launchpad import Launchpad def get_project_client(project_name): cachedir = os.path.expanduser("~/.launchpadlib/cache/") if not os.path.exists(cachedir):
launchpad = Launchpad.login_anonymously(project_name + '-bugs', 'production', cachedir) project = launchpad.projects[project_name] return project def remove_first_line(invalid_json): return '\n'.join(invalid_json.split('\n')[1:]) class BugReport(object): ...
os.makedirs(cachedir, 0o700)
conditional_block
common.py
#!/usr/bin/env python # # Common client code # # Copyright 2016 Markus Zoeller import os from launchpadlib.launchpad import Launchpad def get_project_client(project_name):
def remove_first_line(invalid_json): return '\n'.join(invalid_json.split('\n')[1:]) class BugReport(object): def __init__(self, link, title, age): self.link = link self.title = title.encode('ascii', 'replace') self.age = age def __str__(self): data = {'link': self.link, ...
cachedir = os.path.expanduser("~/.launchpadlib/cache/") if not os.path.exists(cachedir): os.makedirs(cachedir, 0o700) launchpad = Launchpad.login_anonymously(project_name + '-bugs', 'production', cachedir) project = launchpad.projects[project_name] ret...
identifier_body
problem-048.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // #![feature(test)] extern crate test; /// Compute n^p mod b fn modular_pow(n: u64, p: u64, b: u64) -> u64 { let mut pow = n % b; for _ in 1..p { pow = (pow * (n % b)) % b; } pow } pub fn ...
}
{ b.iter(|| solution()); }
identifier_body
problem-048.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // #![feature(test)] extern crate test; /// Compute n^p mod b fn modular_pow(n: u64, p: u64, b: u64) -> u64 { let mut pow = n % b; for _ in 1..p { pow = (pow * (n % b)) % b; } pow } pub fn ...
#[cfg(test)] mod tests { use super::*; use test::Bencher; #[test] fn correct() { assert_eq!(9110846700, solution()); } #[bench] fn bench(b: &mut Bencher) { b.iter(|| solution()); } }
random_line_split
problem-048.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // #![feature(test)] extern crate test; /// Compute n^p mod b fn modular_pow(n: u64, p: u64, b: u64) -> u64 { let mut pow = n % b; for _ in 1..p { pow = (pow * (n % b)) % b; } pow } pub fn
() -> u64 { const BASE: u64 = 10000000000; let mut sum = 0; for n in 1..1001 { sum += modular_pow(n, n, BASE); } sum % BASE } fn main() { println!("The sum is {}", solution()); } #[cfg(test)] mod tests { use super::*; use test::Bencher; #[test] fn correct() { a...
solution
identifier_name
EventTypeLegend.ts
import { Component, EventEmitter, Input, Output, TemplateRef } from '@angular/core'; import { CalendarEvent } from '../../../utils/calendar-utils/CalendarUtils'; @Component({
template: ` <ng-template #defaultTemplate> <div class="cal-event-legend"> <div class="cal-event-type" *ngFor="let type of events | groupBy: 'type'" (click)="$event.stopPropagation(); eventTypeClicked.emit({ event: type?.key })" > <div class="cal-event-...
selector: 'novo-event-type-legend',
random_line_split
EventTypeLegend.ts
import { Component, EventEmitter, Input, Output, TemplateRef } from '@angular/core'; import { CalendarEvent } from '../../../utils/calendar-utils/CalendarUtils'; @Component({ selector: 'novo-event-type-legend', template: ` <ng-template #defaultTemplate> <div class="cal-event-legend"> <div ...
{ @Input() events: CalendarEvent[]; @Input() customTemplate: TemplateRef<any>; @Output() eventTypeClicked: EventEmitter<any> = new EventEmitter(); }
NovoEventTypeLegendElement
identifier_name
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(PythonPackage): """This module provides a nearly complete wrapping of the Oracle/Sleepycat C API for the Database Environment, Database, Cursor, Log Cursor, Sequence and Transaction objects, and each of these is exposed as a Python type in the bsddb3.db module.""" homepage = "https://pypi...
PyBsddb3
identifier_name
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
"""This module provides a nearly complete wrapping of the Oracle/Sleepycat C API for the Database Environment, Database, Cursor, Log Cursor, Sequence and Transaction objects, and each of these is exposed as a Python type in the bsddb3.db module.""" homepage = "https://pypi.python.org/pypi/bsdd...
identifier_body
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory.
# For details, see https://github.com/spack/spack # Please also see the NOTICE and LICENSE files for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (as # published by the Free Software Foundation) version 2....
# # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 #
random_line_split
gobject.rs
// This file is part of Grust, GObject introspection bindings for Rust // // Copyright (C) 2013, 2014 Mikhail Zabaluev <mikhail.zabaluev@gmail.com> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Softw...
unsafe impl wrap::Wrapper for Object { type Raw = ffi::GObject; } pub mod cast { use grust::object; pub trait AsObject { fn as_object(&self) -> &super::Object; } impl<T> AsObject for T where T: object::Upcast<super::Object> { #[inline] fn as_object(&self) -> &super::Objec...
random_line_split
gobject.rs
// This file is part of Grust, GObject introspection bindings for Rust // // Copyright (C) 2013, 2014 Mikhail Zabaluev <mikhail.zabaluev@gmail.com> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Softw...
(&self) -> &super::Object { self.upcast() } } } unsafe impl object::ObjectType for Object { fn get_type() -> GType { unsafe { GType::from_raw(ffi::g_object_get_type()) } } }
as_object
identifier_name
gobject.rs
// This file is part of Grust, GObject introspection bindings for Rust // // Copyright (C) 2013, 2014 Mikhail Zabaluev <mikhail.zabaluev@gmail.com> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Softw...
} } unsafe impl object::ObjectType for Object { fn get_type() -> GType { unsafe { GType::from_raw(ffi::g_object_get_type()) } } }
{ self.upcast() }
identifier_body
index-show.directive.ts
import { Directive, Renderer2, ElementRef, Input, OnInit, AfterViewInit } from '@angular/core'; @Directive({ selector: '[appIndexShow]', host: { '(mouseenter)': 'onMouseEnter()', '(mouseleave)': 'onMouseLeave()' } }) export class IndexShowDirective implements OnInit, AfterViewInit { constructor( p...
} onMouseEnter() { this.el.nativeElement.style.boxShadow = 'rgba(220,218,218,0.3) 0px 5px 10px'; this.el.nativeElement.querySelector('.act_title').style.color = '#fe345e'; this.el.nativeElement.querySelector('.liveLayer').style.display = 'block'; } onMouseLeave() { this.el.nativeElement.style....
ngAfterViewInit() {
random_line_split
index-show.directive.ts
import { Directive, Renderer2, ElementRef, Input, OnInit, AfterViewInit } from '@angular/core'; @Directive({ selector: '[appIndexShow]', host: { '(mouseenter)': 'onMouseEnter()', '(mouseleave)': 'onMouseLeave()' } }) export class IndexShowDirective implements OnInit, AfterViewInit { constructor( p...
onMouseEnter() { this.el.nativeElement.style.boxShadow = 'rgba(220,218,218,0.3) 0px 5px 10px'; this.el.nativeElement.querySelector('.act_title').style.color = '#fe345e'; this.el.nativeElement.querySelector('.liveLayer').style.display = 'block'; } onMouseLeave() { this.el.nativeElement.style.box...
{ }
identifier_body
index-show.directive.ts
import { Directive, Renderer2, ElementRef, Input, OnInit, AfterViewInit } from '@angular/core'; @Directive({ selector: '[appIndexShow]', host: { '(mouseenter)': 'onMouseEnter()', '(mouseleave)': 'onMouseLeave()' } }) export class IndexShowDirective implements OnInit, AfterViewInit { constructor( p...
() { this.el.nativeElement.style.boxShadow = 'rgba(220,218,218,0.3) 0px 5px 10px'; this.el.nativeElement.querySelector('.act_title').style.color = '#fe345e'; this.el.nativeElement.querySelector('.liveLayer').style.display = 'block'; } onMouseLeave() { this.el.nativeElement.style.boxShadow = ''; ...
onMouseEnter
identifier_name