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
cal_accuracy_v3.py
#! /usr/bin/env python import utility_function as uf import sys import cv2 import numpy as np def read_file_list(file_name): # assume the first argument is the image name and the second one is the label name_list = list() label_list = list() with open(file_name, "r") as f: s = f.read() ...
(file_name, res_list, radius): with open(file_name, "r") as f: file_data = f.read() file_data = uf.delete_last_empty_line(file_data) data_list = file_data.split("\n") if (len(data_list) == 0): print("empty file " + file_name) return for i in range(len(...
read_triplet_res_file
identifier_name
cal_accuracy_v3.py
#! /usr/bin/env python import utility_function as uf import sys import cv2 import numpy as np def read_file_list(file_name): # assume the first argument is the image name and the second one is the label name_list = list() label_list = list() with open(file_name, "r") as f: s = f.read() ...
exit(1) res_file_name = sys.argv[1] label_file_name = sys.argv[2] res_name, res_list = read_file_list(res_file_name) label_name, label_list = read_file_list(label_file_name) diff_count = 0 for i in range(len(res_name)): if (res_name[i] != label_name[i]): print("n1...
random_line_split
cal_accuracy_v3.py
#! /usr/bin/env python import utility_function as uf import sys import cv2 import numpy as np def read_file_list(file_name): # assume the first argument is the image name and the second one is the label name_list = list() label_list = list() with open(file_name, "r") as f: s = f.read() ...
if __name__ == "__main__": if (len(sys.argv) < 3): print("Usage: cal_accuracy_v3.py res_file_name.txt label_file.txt") exit(1) res_file_name = sys.argv[1] label_file_name = sys.argv[2] res_name, res_list = read_file_list(res_file_name) label_name, label_list = read_file_list(la...
index = uf.file_name_to_int(d_l[0]) res_list[index] = True # image = cv2.imread(d_l[0]) # cv2.imshow("res", image) # cv2.waitKey(100)
conditional_block
marc4.js
/* * Crypto-JS v2.5.3 * http://code.google.com/p/crypto-js/ * (c) 2009-2012 by Jeff Mott. All rights reserved. * http://code.google.com/p/crypto-js/wiki/License */ (function(){ // Shortcuts var C = Crypto,
var MARC4 = C.MARC4 = { /** * Public API */ encrypt: function (message, password) { var // Convert to bytes m = UTF8.stringToBytes(message), // Generate random IV iv = util.randomBytes(16), // Generate key k = password.constructor == String ? // Derive key fro...
util = C.util, charenc = C.charenc, UTF8 = charenc.UTF8, Binary = charenc.Binary;
random_line_split
Field.d.ts
Shape, FieldValue } from "../index"; /** * These are the props to give to `Field`. * Any others will be passed through to your component. */ interface BaseFieldProps { /** * A string path, in dot-and-bracket notation, corresponding to a value * in the form values. It may be as simple as 'firstName' or...
*/ dirty: boolean; /** * The name prop that you passed in. */ name: string; /** * true if the current value is the same as the initialized value, * false otherwise. */ pristine: boolean; /** * The current value of the field. */ value: FieldValue; ...
/** * true if the current value is different from the initialized value, * false otherwise.
random_line_split
Field.d.ts
Shape, FieldValue } from "../index"; /** * These are the props to give to `Field`. * Any others will be passed through to your component. */ interface BaseFieldProps { /** * A string path, in dot-and-bracket notation, corresponding to a value * in the form values. It may be as simple as 'firstName' or...
extends Component<any> implements GenericField<any, any> { /** * true if the current value is different from the initialized value, * false otherwise. */ dirty: boolean; /** * The name prop that you passed in. */ name: string; /** * true if the current value is the s...
Field
identifier_name
post_create.js
var marked = require("marked"); module.exports = function(req, data, ctx, session) { if (!session.loggedIn) return req.fail("ENOPERM"); var html = marked(data.content); ctx.db.query( "INSERT INTO posts (html, raw_text, user_id, thread_id) "+ "VALUES ($1, $2, $3, $4) "+ "RETURNING id", [html, data.conten...
req.reply( { "id": res.rows[0].id }); } } module.exports.args = { "content": "string", "thread_id": "number" } module.exports.perms = [ "newpost" ]
random_line_split
post_create.js
var marked = require("marked"); module.exports = function(req, data, ctx, session) { if (!session.loggedIn) return req.fail("ENOPERM"); var html = marked(data.content); ctx.db.query( "INSERT INTO posts (html, raw_text, user_id, thread_id) "+ "VALUES ($1, $2, $3, $4) "+ "RETURNING id", [html, data.conten...
(err, res) { if (err) { ctx.util.log("warning", "Failed query to create new post.", err); return req.fail("EUNKNOWN"); } req.reply( { "id": res.rows[0].id }); } } module.exports.args = { "content": "string", "thread_id": "number" } module.exports.perms = [ "newpost" ]
queryCallback
identifier_name
post_create.js
var marked = require("marked"); module.exports = function(req, data, ctx, session) { if (!session.loggedIn) return req.fail("ENOPERM"); var html = marked(data.content); ctx.db.query( "INSERT INTO posts (html, raw_text, user_id, thread_id) "+ "VALUES ($1, $2, $3, $4) "+ "RETURNING id", [html, data.conten...
} module.exports.args = { "content": "string", "thread_id": "number" } module.exports.perms = [ "newpost" ]
{ if (err) { ctx.util.log("warning", "Failed query to create new post.", err); return req.fail("EUNKNOWN"); } req.reply( { "id": res.rows[0].id }); }
identifier_body
std_unstable.rs
use std::time::Duration; pub(crate) trait AsMillis_ { fn as_millis_(self) -> u128; } impl AsMillis_ for Duration { fn as_millis_(self) -> u128 { 1000 * u128::from(self.as_secs()) + u128::from(self.subsec_millis()) } } pub(crate) trait RemoveItem_ { type Item; fn remove_item_(&mut self, it...
) { assert_eq!(left.transpose_(), right); } test(None, Ok(None)); test(Some(Ok(())), Ok(Some(()))); test(Some(Err(())), Err(())); } }
fn test_transpose_() { fn test( left: Option<std::result::Result<(), ()>>, right: std::result::Result<Option<()>, ()>,
random_line_split
std_unstable.rs
use std::time::Duration; pub(crate) trait AsMillis_ { fn as_millis_(self) -> u128; } impl AsMillis_ for Duration { fn as_millis_(self) -> u128 { 1000 * u128::from(self.as_secs()) + u128::from(self.subsec_millis()) } } pub(crate) trait RemoveItem_ { type Item; fn remove_item_(&mut self, it...
() { fn test( left: Option<std::result::Result<(), ()>>, right: std::result::Result<Option<()>, ()>, ) { assert_eq!(left.transpose_(), right); } test(None, Ok(None)); test(Some(Ok(())), Ok(Some(()))); test(Some(Err(())), Err(())); ...
test_transpose_
identifier_name
std_unstable.rs
use std::time::Duration; pub(crate) trait AsMillis_ { fn as_millis_(self) -> u128; } impl AsMillis_ for Duration { fn as_millis_(self) -> u128 { 1000 * u128::from(self.as_secs()) + u128::from(self.subsec_millis()) } } pub(crate) trait RemoveItem_ { type Item; fn remove_item_(&mut self, it...
test(None, Ok(None)); test(Some(Ok(())), Ok(Some(()))); test(Some(Err(())), Err(())); } }
{ assert_eq!(left.transpose_(), right); }
identifier_body
form-fileupload.js
var FormFileUpload = function () { return { //main function to initiate the module init: function () { // Initialize the jQuery File Upload widget: $('#fileupload').fileupload({ disableImageResize: false, autoUpload: false, ...
if ($.support.cors) { $.ajax({ type: 'HEAD' }).fail(function () { $('<div class="alert alert-danger"/>') .text('Upload server currently unavailable - ' + new Date()) ...
); // Upload server status check for browsers with CORS support:
random_line_split
form-fileupload.js
var FormFileUpload = function () { return { //main function to initiate the module init: function () { // Initialize the jQuery File Upload widget: $('#fileupload').fileupload({ disableImageResize: false, autoUpload: false, ...
// Load & display existing files: $('#fileupload').addClass('fileupload-processing'); $.ajax({ // Uncomment the following to send cross-domain cookies: //xhrFields: {withCredentials: true}, url: $('#fileupload').fileupload('opt...
{ $.ajax({ type: 'HEAD' }).fail(function () { $('<div class="alert alert-danger"/>') .text('Upload server currently unavailable - ' + new Date()) .appendTo('#fil...
conditional_block
RichTooltip-dbg.js
, event in that order. * To override this automatic resolution, one of the prefixes "aggregation:", "association:" * or "event:" can be added to the name of the setting (such a prefixed name must be * enclosed in single or double quotes). * * The supported settings are: * <ul> * <li>Properties * <ul> * <li>{...
* @function */ /** * Getter for property <code>imageAltText</code>. * This is the alt text for the image * * Default value is empty/<code>undefined</code> * * @return {string} the value of property <code>imageAltText</code> * @public * @since 1.11.1 * @name sap.ui.commons.RichTooltip#getImageAltText * @fu...
* @public * @since 1.11.1 * @name sap.ui.commons.RichTooltip#setValueStateText
random_line_split
RichTooltip-dbg.js
event in that order. * To override this automatic resolution, one of the prefixes "aggregation:", "association:" * or "event:" can be added to the name of the setting (such a prefixed name must be * enclosed in single or double quotes). * * The supported settings are: * <ul> * <li>Properties * <ul> * <li>{@...
} }; /** * This returns the previously set text. Since a FormattedTextView is used for * rendering and stuff the corresponding property of the FormattedTextView is * being read and returned. If no text was set an empty string is being * returned. * * @returns {sap.ui.core.string} the ValueState text that was p...
{ this.setAggregation("individualStateText", oValueStateText); }
conditional_block
mod.rs
//! Representation of Cranelift IR functions. mod builder; pub mod condcodes; pub mod dfg; pub mod entities; mod extfunc; mod extname; pub mod function; mod globalvalue; mod heap; pub mod immediates; pub mod instructions; pub mod jumptable; pub mod layout; mod libcall; mod memflags; mod progpoint; mod sourceloc; pub m...
pub use crate::ir::instructions::{ InstructionData, Opcode, ValueList, ValueListPool, VariableArgs, }; pub use crate::ir::jumptable::JumpTableData; pub use crate::ir::layout::Layout; pub use crate::ir::libcall::{get_libcall_funcref, get_probestack_funcref, LibCall}; pub use crate::ir::memflags::MemFlags; pub use cr...
pub use crate::ir::function::Function; pub use crate::ir::globalvalue::GlobalValueData; pub use crate::ir::heap::{HeapData, HeapStyle};
random_line_split
p210_Course_Schedule_II.py
''' - Leetcode problem: 210 - Difficulty: Medium - Brief problem description: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of cour...
ordered_course = [] while zero_dq: course = zero_dq.popleft() ordered_course.append(course) nb = dag.get(course, []) for c in nb: in_degree[c] = in_degree.get(c) - 1 if in_degree[c] == 0: zero_dq.appen...
zero_dq.append(i)
conditional_block
p210_Course_Schedule_II.py
''' - Leetcode problem: 210 - Difficulty: Medium - Brief problem description: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of cour...
zero_dq.append(c) if len(ordered_course) == numCourses: return ordered_course else: return []
dag = defaultdict(list) in_degree = {} for p in prerequisites: in_degree[p[0]] = in_degree.get(p[0], 0) + 1 dag[p[1]].append(p[0]) zero_dq = deque() for i in range(numCourses): if not in_degree.get(i): zero_dq.append(i) ordere...
identifier_body
p210_Course_Schedule_II.py
''' - Leetcode problem: 210 - Difficulty: Medium - Brief problem description: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of cour...
in_degree = {} for p in prerequisites: in_degree[p[0]] = in_degree.get(p[0], 0) + 1 dag[p[1]].append(p[0]) zero_dq = deque() for i in range(numCourses): if not in_degree.get(i): zero_dq.append(i) ordered_course = [] wh...
class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: dag = defaultdict(list)
random_line_split
p210_Course_Schedule_II.py
''' - Leetcode problem: 210 - Difficulty: Medium - Brief problem description: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of cour...
: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: dag = defaultdict(list) in_degree = {} for p in prerequisites: in_degree[p[0]] = in_degree.get(p[0], 0) + 1 dag[p[1]].append(p[0]) zero_dq = deque() for i in range(nu...
Solution
identifier_name
app.routes.ts
import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { AuthGuard } from 'guards'; import { DashboardComponent } from 'features/dashboard'; import { ErrorComponent } from 'components/shared-components'; /** NOTE Official Ref: https://angular.io/docs/ts/latest/guid...
path: '', component: DashboardComponent } ] }, { path: 'dashboard', canActivate: [AuthGuard], // redirectTo: '/pages', component: DashboardComponent }, { path: 'auth', loadChildren: './features/auth/auth.module#AuthModule' }, { path: '**', component:...
path: '', canActivate: [AuthGuard], children: [ {
random_line_split
app.routes.ts
import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { AuthGuard } from 'guards'; import { DashboardComponent } from 'features/dashboard'; import { ErrorComponent } from 'components/shared-components'; /** NOTE Official Ref: https://angular.io/docs/ts/latest/guid...
{ }
AppRoutingModule
identifier_name
sbp.ts
/** * @license * Copyright Google LLC 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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; func...
(n: number): number { return 5; } export default [ 'sbp', [['Lwamilawu', 'Pashamihe'], u, u], u, [ ['M', 'J', 'J', 'J', 'A', 'I', 'J'], ['Mul', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], ['Mulungu', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alahamisi', 'Ijumaa', 'Jumamosi'], ['Mul', 'Jtt', 'Jnn', 'Jtn'...
plural
identifier_name
sbp.ts
/** * @license * Copyright Google LLC 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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; func...
export default [ 'sbp', [['Lwamilawu', 'Pashamihe'], u, u], u, [ ['M', 'J', 'J', 'J', 'A', 'I', 'J'], ['Mul', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], ['Mulungu', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alahamisi', 'Ijumaa', 'Jumamosi'], ['Mul', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'] ], u, ...
{ return 5; }
identifier_body
sbp.ts
/** * @license * Copyright Google LLC 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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; func...
['M', 'J', 'J', 'J', 'A', 'I', 'J'], ['Mul', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], ['Mulungu', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alahamisi', 'Ijumaa', 'Jumamosi'], ['Mul', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'] ], u, [ ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], ...
export default [ 'sbp', [['Lwamilawu', 'Pashamihe'], u, u], u, [
random_line_split
endpoints_client.py
# Copyright 2016 Red Hat, 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 agreed to in writing, ...
"""Delete an endpoint.""" url = '/endpoints/%s' % endpoint_id resp, body = self.delete(url) self.expected_success(204, resp.status) return rest_client.ResponseBody(resp, body)
identifier_body
endpoints_client.py
# Copyright 2016 Red Hat, 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 agreed to in writing, ...
return rest_client.ResponseBody(resp, body)
random_line_split
endpoints_client.py
# Copyright 2016 Red Hat, 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 agreed to in writing, ...
(self, service_id, region_id, **kwargs): """Create an endpoint for service.""" post_body = { 'service_id': service_id, 'region': region_id, 'publicurl': kwargs.get('publicurl'), 'adminurl': kwargs.get('adminurl'), 'internalurl': kwargs.get('int...
create_endpoint
identifier_name
gulpfile.js
const elixir = require('laravel-elixir'); require('laravel-elixir-vue-2'); var jsuglify = require('gulp-uglify'); var rename = require('gulp-rename'); var node_path = 'node_modules'; var paths = { 'jquery': node_path + '/jquery', 'bootstrap': node_path + '/bootstrap', 'icheck': node_path + '/icheck', ...
.copy(paths.fontawesome + '/css/font-awesome.min.css', 'public/font-awesome/css/font-awesome.min.css') .copy('resources/assets/fonts', 'public/fonts') .copy('resources/assets/js/admin', 'public/js/admin') .webpack('admin.js') .jsminify() // .webpack('jquery.validate.js',...
.copy(paths.bootstrap + '/dist/css/bootstrap.min.css', 'public/bootstrap/css/bootstrap.min.css') .copy(paths.fontawesome + '/fonts', 'public/font-awesome/fonts')
random_line_split
usb_dbus_system.py
#! /usr/bin/env python # DBus to turn USB on or off (by unbinding the driver) # The System D-bus import dbus import dbus.service from gi.repository import GLib from dbus.mainloop.glib import DBusGMainLoop from usb_inhibit import USB_inhibit class USB_Service_Blocker(dbus.service.Object): inhibitor_work = False ...
@dbus.service.method(dbus_interface='org.gnome.USBBlocker.inhibit') def stop(self): print("Stop monitoring Dbus system message") if self.inhibitor_work: self.usb_monitor.stop() self.inhibitor_work = False @dbus.service.method(dbus_interface='org.gnome.USBBlocker...
print("Start monitoring Dbus system message") if not self.inhibitor_work: self.usb_monitor.start() self.inhibitor_work = True
identifier_body
usb_dbus_system.py
#! /usr/bin/env python # DBus to turn USB on or off (by unbinding the driver) # The System D-bus import dbus import dbus.service from gi.repository import GLib from dbus.mainloop.glib import DBusGMainLoop from usb_inhibit import USB_inhibit class USB_Service_Blocker(dbus.service.Object): inhibitor_work = False ...
@dbus.service.method(dbus_interface='org.gnome.USBBlocker.device', in_signature='ss', out_signature='b') def enable_device(self, bus_id, dev_id): print (bus_id) print (dev_id) import time; time.sleep(0.03) return self.usb_mon...
self.usb_monitor.stop() self.inhibitor_work = False
conditional_block
usb_dbus_system.py
#! /usr/bin/env python # DBus to turn USB on or off (by unbinding the driver) # The System D-bus import dbus import dbus.service from gi.repository import GLib from dbus.mainloop.glib import DBusGMainLoop from usb_inhibit import USB_inhibit class USB_Service_Blocker(dbus.service.Object): inhibitor_work = False ...
(self): print("Start monitoring Dbus system message") if not self.inhibitor_work: self.usb_monitor.start() self.inhibitor_work = True @dbus.service.method(dbus_interface='org.gnome.USBBlocker.inhibit') def stop(self): print("Stop monitoring Dbus system ...
start
identifier_name
usb_dbus_system.py
#! /usr/bin/env python # DBus to turn USB on or off (by unbinding the driver) # The System D-bus import dbus import dbus.service from gi.repository import GLib from dbus.mainloop.glib import DBusGMainLoop from usb_inhibit import USB_inhibit class USB_Service_Blocker(dbus.service.Object): inhibitor_work = False ...
self.inhibitor_work = True @dbus.service.method(dbus_interface='org.gnome.USBBlocker.inhibit') def stop(self): print("Stop monitoring Dbus system message") if self.inhibitor_work: self.usb_monitor.stop() self.inhibitor_work = False @dbus.service.metho...
random_line_split
test_geometric.py
import pytest from .utils import * import psi4 from qcengine.testing import using @pytest.mark.parametrize('engine', [ pytest.param('optking'), pytest.param('geometric', marks=using('geometric')), ]) # yapf: disable @pytest.mark.parametrize('inp', [ pytest.param({'name': 'hf', 'options': {'scf_type': '...
'value' : 90.0 }] } } e, wfn = psi4.optimize(inp['name'], return_wfn=True, engine='geometric', optimizer_keywords=geometric_keywords) assert compare_values(inp['ref_ene'], e, 6) assert compare_values(inp['ref_nuc'], h2o.nuclear_repulsion_energy(), 3)
"""Constrained optimization of the square water molecule""" h2o = psi4.geometry(""" O H 1 1.0 H 1 1.0 2 90.0 """) psi4.set_options({'basis': 'cc-pvdz', 'g_convergence': 'gau_tight' }) psi4.set_options(inp['options']) # geometric s...
identifier_body
test_geometric.py
import pytest from .utils import * import psi4 from qcengine.testing import using @pytest.mark.parametrize('engine', [ pytest.param('optking'), pytest.param('geometric', marks=using('geometric')), ]) # yapf: disable @pytest.mark.parametrize('inp', [ pytest.param({'name': 'hf', 'options': {'scf_type': '...
(inp): """Constrained optimization of the square water molecule""" h2o = psi4.geometry(""" O H 1 1.0 H 1 1.0 2 90.0 """) psi4.set_options({'basis': 'cc-pvdz', 'g_convergence': 'gau_tight' }) psi4.set_options(inp['options']) # ...
test_h2o_constrained
identifier_name
test_geometric.py
import pytest from .utils import * import psi4 from qcengine.testing import using @pytest.mark.parametrize('engine', [ pytest.param('optking'), pytest.param('geometric', marks=using('geometric')), ]) # yapf: disable @pytest.mark.parametrize('inp', [ pytest.param({'name': 'hf', 'options': {'scf_type': '...
e, wfn = psi4.optimize(inp['name'], return_wfn=True, engine='geometric', optimizer_keywords=geometric_keywords) assert compare_values(inp['ref_ene'], e, 6) assert compare_values(inp['ref_nuc'], h2o.nuclear_repulsion_energy(), 3)
}
random_line_split
client.js
/** * MySql: https://github.com/felixge/node-mysql */ function MySql () { this.client = require('mysql'); this.connection = null; this.config = null; this.mysql = true; this.name = 'mysql'; } MySql.prototype.connect = function (options, done) { this.connection = this.client.createConnectio...
return 'varchar('+column.character_maximum_length+')'; case /^boolean$/.test(column.Type): return 'char'; default: return column.Type; } } PostgreSQL.prototype.getColumnsInfo = function (data) { var columns = {}; for (var key in data) { var column = data[ke...
{ switch (true) { case /^double precision$/.test(column.Type): return 'double'; case /^numeric$/.test(column.Type): return column.numeric_precision ? 'decimal('+column.numeric_precision+','+column.numeric_scale+')' : 'decimal' ...
identifier_body
client.js
/** * MySql: https://github.com/felixge/node-mysql */ function MySql () { this.client = require('mysql'); this.connection = null; this.config = null; this.mysql = true; this.name = 'mysql'; } MySql.prototype.connect = function (options, done) { this.connection = this.client.createConnection...
if (config.pg) return new PostgreSQL(); if (config.sqlite) return new SQLite(); else throw new Error('Not supported database type!'); } exports = module.exports = Client;
function Client (config) { if (config.mysql) return new MySql();
random_line_split
client.js
/** * MySql: https://github.com/felixge/node-mysql */ function MySql () { this.client = require('mysql'); this.connection = null; this.config = null; this.mysql = true; this.name = 'mysql'; } MySql.prototype.connect = function (options, done) { this.connection = this.client.createConnectio...
(column) { switch (true) { case /^double precision$/.test(column.Type): return 'double'; case /^numeric$/.test(column.Type): return column.numeric_precision ? 'decimal('+column.numeric_precision+','+column.numeric_scale+')' : 'decimal' ...
getType
identifier_name
mod.rs
// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html /// The minimum schema version we can open. pub(super) const SCHEMA_MIN_VERSION: u8 = 11; /// The version new files are initially created with. pub(super) const SCHEMA_STARTING_VERSION: u8 =...
self.upgrade_tags_to_schema17()?; self.db.execute_batch("update col set ver = 17")?; } // fixme: on the next schema upgrade, change _collapsed to _expanded // in DeckCommon and invert existing values, so that we can avoid // serializing the values in the default c...
{ if ver < 14 { self.db .execute_batch(include_str!("schema14_upgrade.sql"))?; self.upgrade_deck_conf_to_schema14()?; self.upgrade_tags_to_schema14()?; self.upgrade_config_to_schema14()?; } if ver < 15 { self.db ...
identifier_body
mod.rs
// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html /// The minimum schema version we can open. pub(super) const SCHEMA_MIN_VERSION: u8 = 11; /// The version new files are initially created with. pub(super) const SCHEMA_STARTING_VERSION: u8 =...
(&self, ver: u8, server: bool) -> Result<()> { if ver < 14 { self.db .execute_batch(include_str!("schema14_upgrade.sql"))?; self.upgrade_deck_conf_to_schema14()?; self.upgrade_tags_to_schema14()?; self.upgrade_config_to_schema14()?; } ...
upgrade_to_latest_schema
identifier_name
mod.rs
// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html /// The minimum schema version we can open. pub(super) const SCHEMA_MIN_VERSION: u8 = 11; /// The version new files are initially created with. pub(super) const SCHEMA_STARTING_VERSION: u8 =...
// fixme: on the next schema upgrade, change _collapsed to _expanded // in DeckCommon and invert existing values, so that we can avoid // serializing the values in the default case, and use // DeckCommon::default() in new_normal() and new_filtered() Ok(()) } pub(super)...
{ self.upgrade_tags_to_schema17()?; self.db.execute_batch("update col set ver = 17")?; }
conditional_block
mod.rs
// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html /// The minimum schema version we can open. pub(super) const SCHEMA_MIN_VERSION: u8 = 11; /// The version new files are initially created with. pub(super) const SCHEMA_STARTING_VERSION: u8 =...
if ver < 17 { self.upgrade_tags_to_schema17()?; self.db.execute_batch("update col set ver = 17")?; } // fixme: on the next schema upgrade, change _collapsed to _expanded // in DeckCommon and invert existing values, so that we can avoid // serializing the v...
random_line_split
to_tx2.py
# -*- coding: utf-8 -*- """ Created on Thu Nov 6 15:32:36 2014 @author: commun Converts filtered data sets to tx2 format used in Aarhusinv. CHANGELOG: """ #import of needed modules import numpy as np #~ def to_tx2(path_filt, path_tx2, electrode_spacing, ngates=20, pulselength=2): #~ path_filt = '../shiprock...
b = (filt[:,1]-1)*elec_sp m = (filt[:,2]-1)*elec_sp n = (filt[:,3]-1)*elec_sp am = np.sqrt((m-a)**2) an = np.sqrt((n-a)**2) bm = np.sqrt((m-b)**2) bn = np.sqrt((n-b)**2) k = 2*np.pi*(1/(1/am-1/an-1/bm+1/bn)) #~ out[:,16] = filt[:,4] out[:,16] = k[:]*filt[:,4] #deviation resistance out[:,17] = filt[:,6]/10 #resist...
a = (filt[:,0]-1)*elec_sp
random_line_split
to_tx2.py
# -*- coding: utf-8 -*- """ Created on Thu Nov 6 15:32:36 2014 @author: commun Converts filtered data sets to tx2 format used in Aarhusinv. CHANGELOG: """ #import of needed modules import numpy as np #~ def to_tx2(path_filt, path_tx2, electrode_spacing, ngates=20, pulselength=2): #~ path_filt = '../shiprock...
#ip flag #~ out[:,21+ngats*3:21+ngates*4] #stacking out[:,21+ngates*4] = filt[:,50] #current = (50% of pulse length) out[:,22+ngates*4] = pl/2 #wave type out[:,23+ngates*4] = pl/2 #Ton = pulse length [s] out[:,24+ngates*4] = pl*1000 #Toff = pulse length [s] out[:,25+ngates*4] = pl*1000 #Tend = time used to ...
out[:,21+ngates*2:21+ngates*3] = 0.1
conditional_block
phyloK2.py
# by Art FY Poon, 2012 # modified by Rosemary McCloskey, 2014 from Bio import Phylo from numpy import zeros import math import multiprocessing as mp class PhyloKernel: def __init__(self, kmat=None, rotate='ladder', rotate2='none', subtree=False, ...
else: gravitate(t, subtree=subtree, mode=rotate2) if self.normalize != 'none': self.normalize_tree(t, mode=self.normalize) if self.resolve_poly: collapse_polytomies(t) self.annotate_tree(t) self.trees.appen...
pass
conditional_block
phyloK2.py
# by Art FY Poon, 2012 # modified by Rosemary McCloskey, 2014 from Bio import Phylo from numpy import zeros import math import multiprocessing as mp class PhyloKernel: def __init__(self, kmat=None, rotate='ladder', rotate2='none', subtree=False, ...
(self): for i in range(self.ntrees): for j in range(i, self.ntrees): self.kmat[i,j] = self.kmat[j,i] = self.kernel(self.trees[i], self.trees[j]) if self.verbose: print('%d\t%d\t%f' % (i, j, self.kmat[i,j])) sel...
compute_matrix
identifier_name
phyloK2.py
# by Art FY Poon, 2012 # modified by Rosemary McCloskey, 2014 from Bio import Phylo from numpy import zeros import math import multiprocessing as mp class PhyloKernel: def __init__(self, kmat=None, rotate='ladder', rotate2='none', subtree=False, ...
def compute_matrix(self): for i in range(self.ntrees): for j in range(i, self.ntrees): self.kmat[i,j] = self.kmat[j,i] = self.kernel(self.trees[i], self.trees[j]) if self.verbose: print('%d\t%d\t%f' % (i, j, self.kmat[i,j...
""" Add annotations to Clade objects in place """ for tip in t.get_terminals(): tip.production = 0 for i, node in enumerate(t.get_nonterminals(order='postorder')): children = node.clades nterms = sum( [c.production == 0 for c in children] ) ...
identifier_body
phyloK2.py
# by Art FY Poon, 2012 # modified by Rosemary McCloskey, 2014 from Bio import Phylo from numpy import zeros import math import multiprocessing as mp class PhyloKernel: def __init__(self, kmat=None, rotate='ladder',
rotate2='none', subtree=False, normalize='mean', sigma=1, gaussFactor=1, withLengths=True, decayFactor=0.1, verbose=False, resolve_poly=False): """ requir...
random_line_split
resolve-inconsistent-binding-mode.rs
// Copyright 2012 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 ...
//~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 c(_) => {} } } fn matcher4(x: opts) { match x { a(ref mut i) | b(ref i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 c(_) => {} } } fn matcher5(x: opts) { ...
{}
conditional_block
resolve-inconsistent-binding-mode.rs
// Copyright 2012 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 matcher2(x: opts) { match x { a(ref i) | b(i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 c(_) => {} } } fn matcher3(x: opts) { match x { a(ref mut i) | b(ref const i) => {} //~ ERROR variable `i` is bound with different mode in pattern #...
a(ref i) | b(i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 c(_) => {} } }
random_line_split
resolve-inconsistent-binding-mode.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(x: opts) { match x { a(ref i) | b(i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 c(_) => {} } } fn matcher3(x: opts) { match x { a(ref mut i) | b(ref const i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pa...
matcher2
identifier_name
Cmn.ts
/******************************************************************************* * 共通変数ファイル * * Copyright (c) 2014. dmp Inc. All Rights Reserved. * * @author: Nobuyuki Kondo * @uri: http://www.dmp.co.jp/ * @version: 2.0 ******************************************************************************/ /// <referen...
v9 : false, v10: false, v11: false } }, ie : { ie : false, ie8_lte: false, ie9_lte: false }, engine : { webkit: false, gecko : false, presto: false }, tablet : { iPad : false, android: false }, smartPhone : { iPhone : fal...
ie : { v6 : false, v7 : false, v8 : false,
random_line_split
vm.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
pub fn sgate_sel(&self) -> Option<CapSel> { None } pub fn setup(&self) { } pub fn map_pages(&self, _vpe: &VPEDesc, _virt: goff, _phys: GlobAddr, _pages: usize, _attr: MapFlags) -> Result<(), Error> { Err(Error::new(Code::NotSup)) } pub fn unmap_pages(...
{ None }
identifier_body
vm.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
(&self, _vpe: &VPEDesc, _virt: goff, _phys: GlobAddr, _pages: usize, _attr: MapFlags) -> Result<(), Error> { Err(Error::new(Code::NotSup)) } pub fn unmap_pages(&self, _vpe: &VPEDesc, _virt: goff, _pages: usize) -> Result<(), Error> { Err(Error::new(Code::NotSup)) } }
map_pages
identifier_name
vm.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
pub fn unmap_pages(&self, _vpe: &VPEDesc, _virt: goff, _pages: usize) -> Result<(), Error> { Err(Error::new(Code::NotSup)) } }
random_line_split
sch3.py
#!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController from mininet.cli import CLI from mininet.log import setLogLevel, info import time import os import subprocess import csv import StringIO import iptc HOSTS = 3 p1_log = open('logs-example/log.p1.txt', 'w') p2_log...
def myNet(): global p1 global p2 global p3 global p4 cPort1=6666 cPort2=6667 hosts=[] kill = 0 net = Mininet( topo=None, build=False, autoSetMacs=True) con1 = net.addController( 'c0', controller=RemoteController, ip='127.0.0.1', port=cPort1) con2 = net.addController( 'c1', controller=RemoteController, ...
rule=iptc.Rule() rule.protocol = "tcp" match = rule.create_match("tcp") match.dport = str(port) chain = iptc.Chain(iptc.Table(iptc.Table.FILTER), "INPUT") rule.target = rule.create_target("DROP") chain.delete_rule(rule)
identifier_body
sch3.py
#!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController from mininet.cli import CLI from mininet.log import setLogLevel, info import time import os import subprocess import csv import StringIO import iptc HOSTS = 3 p1_log = open('logs-example/log.p1.txt', 'w') p2_log...
(port): rule=iptc.Rule() rule.protocol = "tcp" match = rule.create_match("tcp") match.dport = str(port) chain = iptc.Chain(iptc.Table(iptc.Table.FILTER), "INPUT") rule.target = rule.create_target("DROP") chain.insert_rule(rule) def unClosePort(port): rule=iptc.Rule() rule.protocol = "tcp" match = rule.create...
closePort
identifier_name
sch3.py
#!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController from mininet.cli import CLI from mininet.log import setLogLevel, info import time import os import subprocess import csv import StringIO import iptc HOSTS = 3 p1_log = open('logs-example/log.p1.txt', 'w') p2_log...
chain.insert_rule(rule) def unClosePort(port): rule=iptc.Rule() rule.protocol = "tcp" match = rule.create_match("tcp") match.dport = str(port) chain = iptc.Chain(iptc.Table(iptc.Table.FILTER), "INPUT") rule.target = rule.create_target("DROP") chain.delete_rule(rule) def myNet(): global p1 global p2 global ...
match.dport = str(port) chain = iptc.Chain(iptc.Table(iptc.Table.FILTER), "INPUT") rule.target = rule.create_target("DROP")
random_line_split
sch3.py
#!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController from mininet.cli import CLI from mininet.log import setLogLevel, info import time import os import subprocess import csv import StringIO import iptc HOSTS = 3 p1_log = open('logs-example/log.p1.txt', 'w') p2_log...
f.close() if len(con67) == HOSTS: uptime = time.time() print 'new master ready at %.10f' %uptime break print 'now wait for hping3 to finish..' hosts[0].cmdPrint('wait %hping3') print 'hping3 finished at %.10f' %time.time() print 'open the port..' unClosePort(cPort1) print 'stopping mininet' ...
con67.append(uuid)
conditional_block
apInv.py
#!usr/bin/env python from pysnmp.entity.rfc3413.oneliner import cmdgen import shlex import subprocess import re import os import sys import smtplib from devices.models import AP as AccessPoint ## This file is used to update the access point inventory data. Use the ## updateAccessPoints function to run the update. The ...
toHeaderBuild = [] for to in email["to"]: toHeaderBuild.append("<" + to + ">") msg = "From: <" + email["from"] + "> \nTo: " + ', '.join(toHeaderBuild) + " \nSubject: " + subject + " \n" + messageBody s = smtplib.SMTP(email["server"]) s.sendmail(email["from"], email["to"], msg) s.quit()
for ap in APs: messageBody += "\t" + ap.ip + "\t" + ap.name + "\n"
random_line_split
apInv.py
#!usr/bin/env python from pysnmp.entity.rfc3413.oneliner import cmdgen import shlex import subprocess import re import os import sys import smtplib from devices.models import AP as AccessPoint ## This file is used to update the access point inventory data. Use the ## updateAccessPoints function to run the update. The ...
return APs ## Add or update all access points using Django. def updateAccessPoints(path, AP_OIDs, controller_IPs): APs = snmpwalk(AP_OIDs, controller_IPs) for AP in APs: if APs[AP]["serial"] != "0": ## make a new AP object if necessary try: new_AP = AccessPo...
num = str(name)[len(OIDs["mac"]):].strip('.') try: if key not in APs[num]: APs[num][key] = str(val.prettyPrint()) except: APs[num] = {key: str(val.prettyPrint())}
conditional_block
apInv.py
#!usr/bin/env python from pysnmp.entity.rfc3413.oneliner import cmdgen import shlex import subprocess import re import os import sys import smtplib from devices.models import AP as AccessPoint ## This file is used to update the access point inventory data. Use the ## updateAccessPoints function to run the update. The ...
## Add or update all access points using Django. def updateAccessPoints(path, AP_OIDs, controller_IPs): APs = snmpwalk(AP_OIDs, controller_IPs) for AP in APs: if APs[AP]["serial"] != "0": ## make a new AP object if necessary try: new_AP = AccessPoint(serialno=AP...
APs = dict() cmdGen = cmdgen.CommandGenerator() for key in OIDs: for controller in controllers: errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd( cmdgen.CommunityData('spa'), cmdgen.UdpTransportTarget((controller, 161)), ...
identifier_body
apInv.py
#!usr/bin/env python from pysnmp.entity.rfc3413.oneliner import cmdgen import shlex import subprocess import re import os import sys import smtplib from devices.models import AP as AccessPoint ## This file is used to update the access point inventory data. Use the ## updateAccessPoints function to run the update. The ...
(controller_IPs, status_oid, email): AP_command = [] for controller in controller_IPs: AP_command.append("snmpwalk -v2c -c spa " + controller + " " + status_oid) # Get the names of the APs connected to each controller. # Compare to APs stored in the database to determine which are down and ...
updateStatus
identifier_name
ch5_1.py
""" 5.1 - Probabilistic Modeling: Error Propagation ================================================ In this example we will show how easy we can propagate uncertainty from GemPy parameters to final structural models. """ # %% import sys, os sys.path.append("../../gempy") os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,...
(): device_loc = np.array([[6e3, 0, 3700]]) p2d = gp.plot_2d(geo_model, show_topography=True) well_1 = 3.5e3 well_2 = 3.62e3 p2d.axes[0].scatter([3e3], [well_1], marker='^', s=400, c='#71a4b3', zorder=10) p2d.axes[0].scatter([9e3], [well_2], marker='^', s=400, c='#71a4b3', zorder=10) p2d.ax...
plot_geo_setting
identifier_name
ch5_1.py
""" 5.1 - Probabilistic Modeling: Error Propagation ================================================ In this example we will show how easy we can propagate uncertainty from GemPy parameters to final structural models. """ # %% import sys, os sys.path.append("../../gempy") os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,...
# %% plot_geo_setting() # %% # Computing model # --------------- # %% gp.set_interpolator(geo_model) # %% gp.compute_model(geo_model) plot_geo_setting() # %% # Adding Random variables # ----------------------- # Although that can work as a good approximation, the truth is that modelling # hundreds of meters u...
device_loc = np.array([[6e3, 0, 3700]]) p2d = gp.plot_2d(geo_model, show_topography=True) well_1 = 3.5e3 well_2 = 3.62e3 p2d.axes[0].scatter([3e3], [well_1], marker='^', s=400, c='#71a4b3', zorder=10) p2d.axes[0].scatter([9e3], [well_2], marker='^', s=400, c='#71a4b3', zorder=10) p2d.axes[0].sc...
identifier_body
ch5_1.py
""" 5.1 - Probabilistic Modeling: Error Propagation ================================================ In this example we will show how easy we can propagate uncertainty from GemPy parameters to final structural models. """ # %% import sys, os sys.path.append("../../gempy") os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,...
# instead deterministic values. GemPy is specially efficiency for these type of # tasks: # %% geo_model.modify_surface_points(2, Z=500) gp.compute_model(geo_model) plot_geo_setting() Z = np.random.normal(1000, 500, size=2) geo_model.modify_surface_points([2, 3], Z=Z) gp.compute_model(geo_model) plot_geo_setting() # ...
# hundreds of meters underground is not specially precise. That's why in many # cases we would like to model our input data as probability distributions
random_line_split
ch5_1.py
""" 5.1 - Probabilistic Modeling: Error Propagation ================================================ In this example we will show how easy we can propagate uncertainty from GemPy parameters to final structural models. """ # %% import sys, os sys.path.append("../../gempy") os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,...
lith_blocks = lith_blocks.reshape(n_iterations, -1) # %% prob_block = compute_prob(lith_blocks) # %% p2dp = gp.plot_2d(geo_model, show_lith=False, show_boundaries=False, show_data=False, regular_grid=prob_block[2], kwargs_regular_grid={'cmap': 'viridis', ...
Z = np.random.normal(1000, 500, size=2) geo_model.modify_surface_points([2, 3], Z=Z) gp.compute_model(geo_model) lith_blocks = np.append(lith_blocks, geo_model.solutions.lith_block)
conditional_block
deactivate.py
# Copyright (c) 2014 by Ecreall under licence AGPL terms # available on http://www.gnu.org/licenses/agpl.html # licence: AGPL # author: Amen Souissi from pyramid.view import view_config from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS from pontus.view import BasicView from lac.content.processes....
results = self.execute(None) return results[0] DEFAULTMAPPING_ACTIONS_VIEWS.update({Deactivate: DeactivateView})
viewid = 'deactivateview' def update(self):
random_line_split
deactivate.py
# Copyright (c) 2014 by Ecreall under licence AGPL terms # available on http://www.gnu.org/licenses/agpl.html # licence: AGPL # author: Amen Souissi from pyramid.view import view_config from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS from pontus.view import BasicView from lac.content.processes....
DEFAULTMAPPING_ACTIONS_VIEWS.update({Deactivate: DeactivateView})
title = _('Deactivate the member') name = 'deactivate' behaviors = [Deactivate] viewid = 'deactivateview' def update(self): results = self.execute(None) return results[0]
identifier_body
deactivate.py
# Copyright (c) 2014 by Ecreall under licence AGPL terms # available on http://www.gnu.org/licenses/agpl.html # licence: AGPL # author: Amen Souissi from pyramid.view import view_config from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS from pontus.view import BasicView from lac.content.processes....
(self): results = self.execute(None) return results[0] DEFAULTMAPPING_ACTIONS_VIEWS.update({Deactivate: DeactivateView})
update
identifier_name
setup.py
#!/usr/bin/env python import re from os import path as op from setuptools import setup def
(fname): try: return open(op.join(op.dirname(__file__), fname)).read() except IOError: return '' _meta = _read('bottle_manage.py') _license = re.search(r'^__license__\s*=\s*"(.*)"', _meta, re.M).group(1) _project = re.search(r'^__project__\s*=\s*"(.*)"', _meta, re.M).group(1) _version = re.sear...
_read
identifier_name
setup.py
#!/usr/bin/env python import re from os import path as op from setuptools import setup def _read(fname): try: return open(op.join(op.dirname(__file__), fname)).read() except IOError: return '' _meta = _read('bottle_manage.py') _license = re.search(r'^__license__\s*=\s*"(.*)"', _meta, re.M).g...
install_requires=install_requires, )
py_modules=['bottle_manage'],
random_line_split
setup.py
#!/usr/bin/env python import re from os import path as op from setuptools import setup def _read(fname):
_meta = _read('bottle_manage.py') _license = re.search(r'^__license__\s*=\s*"(.*)"', _meta, re.M).group(1) _project = re.search(r'^__project__\s*=\s*"(.*)"', _meta, re.M).group(1) _version = re.search(r'^__version__\s*=\s*"(.*)"', _meta, re.M).group(1) install_requires = [ l for l in _read('requirements.txt').sp...
try: return open(op.join(op.dirname(__file__), fname)).read() except IOError: return ''
identifier_body
transfer.py
__author__ = 'PC-LiNing' from bigchaindb import Bigchain b=Bigchain() testuser1_pub='3EQyWna5Gniok73MXdT8m9kgSx6DuRYWUbmehCe4cmXU' testuser1_priv='EZYk1RJtMkySRwNtpiY7AeGQyYLaeu5XsrJHzzVBL3wn' testuser2_pub='9ooi6zKXdLVmM2ZyUZjRTWcW3TXt2CtnHSbVZnXLxHJM' testuser2_priv='AZQ1Y4odynAuYEkSQhVKGqNKU4Zp5QidoLwmkfZCjYqL' ...
# node create transaction for b, testuser2_last=b.get_owned_ids(testuser2_pub).pop() payload_B = { "msg" : "node send +50 to B,is +50", "issue" : "earn", "category" : "currency", "amount" : 50, "asset":"", # final owner 's account "ac...
b.write_transaction(tx_create_signed)
conditional_block
transfer.py
__author__ = 'PC-LiNing' from bigchaindb import Bigchain b=Bigchain() testuser1_pub='3EQyWna5Gniok73MXdT8m9kgSx6DuRYWUbmehCe4cmXU' testuser1_priv='EZYk1RJtMkySRwNtpiY7AeGQyYLaeu5XsrJHzzVBL3wn' testuser2_pub='9ooi6zKXdLVmM2ZyUZjRTWcW3TXt2CtnHSbVZnXLxHJM' testuser2_priv='AZQ1Y4odynAuYEkSQhVKGqNKU4Zp5QidoLwmkfZCjYqL' ...
"category" : "currency", "amount" : 50, "asset":"", # final owner 's account "account":300, "previous":testuser1_last['txid'], "trader":testuser2_pub } tx_create= b.create_transaction(b.me, testuser1_pub, None, 'CREATE', payl...
payload_A = { "msg" : "node send -50 to A,is -50", "issue" : "cost",
random_line_split
overloaded-autoderef.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 ...
() { assert_eq!(Rc::new(5u).to_uint(), Some(5)); assert_eq!((~&~&Rc::new(~~&~5u)).to_uint(), Some(5)); let point = Rc::new(Point {x: 2, y: 4}); assert_eq!(point.x, 2); assert_eq!(point.y, 4); let i = Rc::new(RefCell::new(2)); let i_value = *i.borrow(); *i.borrow_mut() = 5; assert_eq...
main
identifier_name
overloaded-autoderef.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 ...
} pub fn main() { assert_eq!(Rc::new(5u).to_uint(), Some(5)); assert_eq!((~&~&Rc::new(~~&~5u)).to_uint(), Some(5)); let point = Rc::new(Point {x: 2, y: 4}); assert_eq!(point.x, 2); assert_eq!(point.y, 4); let i = Rc::new(RefCell::new(2)); let i_value = *i.borrow(); *i.borrow_mut() = 5;...
#[deriving(Eq, Show)] struct Point { x: int, y: int
random_line_split
os.rs
FreeEnvironmentStringsW }; pub fn errno() -> i32 { unsafe { libc::GetLastError() as i32 } } /// Get a detailed string description for the given error number pub fn error_string(errnum: i32) -> String { use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::LPWSTR; use libc::typ...
impl<'a> Iterator for SplitPaths<'a> { type Item = PathBuf; fn next(&mut self) -> Option<PathBuf> { // On Windows, the PATH environment variable is semicolon separated. // Double quotes are used as a way of introducing literal semicolons // (since c:\some;dir is a valid Windows path). ...
{ SplitPaths { data: unparsed.encode_wide(), must_yield: true, } }
identifier_body
os.rs
FreeEnvironmentStringsW }; pub fn errno() -> i32 { unsafe { libc::GetLastError() as i32 } } /// Get a detailed string description for the given error number pub fn error_string(errnum: i32) -> String { use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::LPWSTR; use libc::typ...
(&mut self) -> Option<OsString> { self.range.next().map(|i| unsafe { let ptr = *self.cur.offset(i); let mut len = 0; while *ptr.offset(len) != 0 { len += 1; } // Push it onto the list. let ptr = ptr as *const u16; let buf = slice::from_raw...
next
identifier_name
os.rs
FreeEnvironmentStringsW }; pub fn errno() -> i32 { unsafe { libc::GetLastError() as i32 } } /// Get a detailed string description for the given error number pub fn error_string(errnum: i32) -> String { use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::LPWSTR; use libc::typ...
Env { base: ch, cur: ch } } } pub struct SplitPaths<'a> { data: EncodeWide<'a>, must_yield: bool, } pub fn split_paths(unparsed: &OsStr) -> SplitPaths { SplitPaths { data: unparsed.encode_wide(), must_yield: true, } } impl<'a> Iterator for SplitPaths<'a> { type Item =...
{ panic!("failure getting env string from OS: {}", io::Error::last_os_error()); }
conditional_block
os.rs
FreeEnvironmentStringsW }; pub fn errno() -> i32 { unsafe { libc::GetLastError() as i32 } } /// Get a detailed string description for the given error number pub fn error_string(errnum: i32) -> String { use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::LPWSTR; use libc::typ...
let v = super::to_utf16_os(n); unsafe { if libc::SetEnvironmentVariableW(v.as_ptr(), ptr::null()) == 0 { panic!("failed to unset env: {}", io::Error::last_os_error()); } } } pub struct Args { range: Range<isize>, cur: *mut *mut u16, } impl Iterator for Args { type I...
} } } pub fn unsetenv(n: &OsStr) {
random_line_split
0047.py
"""empty message Revision ID: 0047 add smtp Revises: 0046 remove long description Create Date: 2020-11-08 01:28:28.386704 """ # revision identifiers, used by Alembic. revision = '0047 add smtp' down_revision = '0046 remove long description' from alembic import op import sqlalchemy as sa def
(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('email_providers', sa.Column('smtp_password', sa.String(), nullable=True)) op.add_column('email_providers', sa.Column('smtp_server', sa.String(), nullable=True)) op.add_column('email_providers', sa.Column('smtp_user', sa.Str...
upgrade
identifier_name
0047.py
"""empty message Revision ID: 0047 add smtp Revises: 0046 remove long description Create Date: 2020-11-08 01:28:28.386704
# revision identifiers, used by Alembic. revision = '0047 add smtp' down_revision = '0046 remove long description' from alembic import op import sqlalchemy as sa def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('email_providers', sa.Column('smtp_password', sa.String...
"""
random_line_split
0047.py
"""empty message Revision ID: 0047 add smtp Revises: 0046 remove long description Create Date: 2020-11-08 01:28:28.386704 """ # revision identifiers, used by Alembic. revision = '0047 add smtp' down_revision = '0046 remove long description' from alembic import op import sqlalchemy as sa def upgrade(): # ### c...
op.drop_column('email_providers', 'smtp_user') op.drop_column('email_providers', 'smtp_server') op.drop_column('email_providers', 'smtp_password') op.drop_column('email_providers', 'available') op.drop_column('email_providers', 'created_at') # ### end Alembic commands ###
identifier_body
hocsinh_lophoc-model.js
import { sequelize, Sequelize } from './index'; import HocSinh from './hocsinh-model'; import LopHoc from './lophoc-model'; const HocSinh_LopHoc = sequelize.define('HOCSINH_LOPHOC', { maHocSinh: { type: Sequelize.INTEGER, primaryKey: true, notNull: true, field: 'MA_HOC_SINH' },...
}, passed: { type: Sequelize.BOOLEAN, defaultValue: false, field: 'PASSED' } }); HocSinh.hasMany(HocSinh_LopHoc, { foreignKey: 'maHocSinh', sourceKey: 'hocSinh_pkey' }); HocSinh_LopHoc.belongsTo(HocSinh, { foreignKey: 'maHocSinh', targetKey: 'hocSinh_pkey' }); LopHoc.hasMany(HocSin...
tongCaNam: { type: Sequelize.DECIMAL(4, 2), field: 'TONG_CA_NAM'
random_line_split
urls.py
from django.conf.urls import include, patterns, url from django.views.generic.base import RedirectView
from mdn.urls import mdn_urlpatterns from webplatformcompat.routers import router from .views import RequestView, ViewFeature webplatformcompat_urlpatterns = patterns( '', url(r'^$', RequestView.as_view( template_name='webplatformcompat/home.jinja2'), name='home'), url(r'^about/', Request...
random_line_split
GridLayer.js
min for (var i = 0, len = layers.length, zIndex; i < len; i++) { zIndex = layers[i].style.zIndex; if (layers[i] !== this._container && zIndex) { edgeZIndex = compare(edgeZIndex, +zIndex); } } if (isFinite(edgeZIndex)) { this.options.zIndex = edgeZIndex + compare(-1, 1); this._updateZIndex(...
_pruneTiles: function () { var key, tile; var zoom = this._map.getZoom(); if (zoom > this.options.maxZoom || zoom < this.options.minZoom) { return this._removeAllTiles(); } for (key in this._tiles) { tile = this._tiles[key]; tile.retain = tile.current; } for (key in this._tiles) { tile = th...
},
random_line_split
GridLayer.js
min for (var i = 0, len = layers.length, zIndex; i < len; i++) { zIndex = layers[i].style.zIndex; if (layers[i] !== this._container && zIndex) { edgeZIndex = compare(edgeZIndex, +zIndex); } } if (isFinite(edgeZIndex)) { this.options.zIndex = edgeZIndex + compare(-1, 1); this._updateZIndex(...
else { if (tile.active) { willPrune = true; } tile.active = true; } } if (willPrune) { this._pruneTiles(); } if (nextFrame) { L.Util.cancelAnimFrame(this._fadeFrame); this._fadeFrame = L.Util.requestAnimFrame(this._updateOpacity, this); } }, _initContainer: function () { if (this._conta...
{ nextFrame = true; }
conditional_block
test_server_rescue.py
# Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
super(ServerRescueV3Test, cls).resource_setup() # Server for positive tests resp, server = cls.create_test_server(wait_until='BUILD') cls.server_id = server['id'] cls.password = server['admin_password'] cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE') ...
msg = "Server rescue not available." raise cls.skipException(msg)
conditional_block
test_server_rescue.py
# Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
raise cls.skipException(msg) super(ServerRescueV3Test, cls).resource_setup() # Server for positive tests resp, server = cls.create_test_server(wait_until='BUILD') cls.server_id = server['id'] cls.password = server['admin_password'] cls.servers_client.wait_for...
random_line_split
test_server_rescue.py
# Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
self.assertEqual(202, resp.status) self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
@classmethod def resource_setup(cls): if not CONF.compute_feature_enabled.rescue: msg = "Server rescue not available." raise cls.skipException(msg) super(ServerRescueV3Test, cls).resource_setup() # Server for positive tests resp, server = cls.create_test_serv...
identifier_body
test_server_rescue.py
# Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
(base.BaseV3ComputeTest): @classmethod def resource_setup(cls): if not CONF.compute_feature_enabled.rescue: msg = "Server rescue not available." raise cls.skipException(msg) super(ServerRescueV3Test, cls).resource_setup() # Server for positive tests resp...
ServerRescueV3Test
identifier_name
NoMatch.tsx
import * as React from 'react'; import { BrowserRouter as Router, RouteComponentProps, Route, Link, Switch, Redirect } from 'react-router-dom'; const NoMatchExample = () => ( <Router> <div> <ul>
<li><Link to="/">Home</Link></li> <li><Link to="/old-match">Old Match, to be redirected</Link></li> <li><Link to="/will-match">Will Match</Link></li> <li><Link to="/will-not-match">Will Not Match</Link></li> <li><Link to="/also/will/not/match">Also Will Not Match</Link></li> ...
random_line_split
bs.ts
/* Bosnian locals for flatpickr */ import { CustomLocale } from "../types/locale"; import { FlatpickrFn } from "../types/instance"; const fp = typeof window !== "undefined" && window.flatpickr !== undefined ? window.flatpickr : ({ l10ns: {}, } as FlatpickrFn); export const Bosnian: CustomLocal...
weekdays: { shorthand: ["Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"], longhand: [ "Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota", ], }, months: { shorthand: [ "Jan", "Feb", "Mar", "Apr", "Ma...
random_line_split
compositor_thread.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/. */ //! Communication with the compositor thread. use SendableFrameTree; use compositor::CompositingReason; use eucli...
fn try_recv_compositor_msg(&mut self) -> Option<Msg> { self.try_recv().ok() } fn recv_compositor_msg(&mut self) -> Msg { self.recv().unwrap() } } pub trait RenderListener { fn recomposite(&mut self, reason: CompositingReason); } impl RenderListener for Box<CompositorProxy + 'static...
fn recv_compositor_msg(&mut self) -> Msg; } /// A convenience implementation of `CompositorReceiver` for a plain old Rust `Receiver`. impl CompositorReceiver for Receiver<Msg> {
random_line_split
compositor_thread.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/. */ //! Communication with the compositor thread. use SendableFrameTree; use compositor::CompositingReason; use eucli...
(&mut self) -> Msg { self.recv().unwrap() } } pub trait RenderListener { fn recomposite(&mut self, reason: CompositingReason); } impl RenderListener for Box<CompositorProxy + 'static> { fn recomposite(&mut self, reason: CompositingReason) { self.send(Msg::Recomposite(reason)); } } ///...
recv_compositor_msg
identifier_name
compositor_thread.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/. */ //! Communication with the compositor thread. use SendableFrameTree; use compositor::CompositingReason; use eucli...
Msg::HeadParsed => write!(f, "HeadParsed"), Msg::CollectMemoryReports(..) => write!(f, "CollectMemoryReports"), Msg::Status(..) => write!(f, "Status"), Msg::GetClientWindow(..) => write!(f, "GetClientWindow"), Msg::MoveTo(..) => write!(f, "MoveTo"), ...
{ match *self { Msg::Exit => write!(f, "Exit"), Msg::ShutdownComplete => write!(f, "ShutdownComplete"), Msg::ScrollFragmentPoint(..) => write!(f, "ScrollFragmentPoint"), Msg::ChangeRunningAnimationsState(..) => write!(f, "ChangeRunningAnimationsState"), ...
identifier_body
test_msg_types.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Daniel Zhang (張道博)' __copyright__ = 'Copyright (c) 2014, University of Hawaii Smart Energy Project' __license__ = 'https://raw.github' \ '.com/Hawaii-Smart-Energy-Project/Maui-Smart-Grid/master/BSD' \ '-LICENSE.txt' import unittes...
: pass if __name__ == '__main__': RUN_SELECTED_TESTS = True if RUN_SELECTED_TESTS: selected_tests = ['test_aggregation_types'] mySuite = unittest.TestSuite() for t in selected_tests: mySuite.addTest(MSGTypesTester(t)) unittest.TextTestRunner().run(mySuite...
wn(self)
identifier_name