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 |
|---|---|---|---|---|
pyrarcr-0.2.py | #!/usr/bin/env python3
##### ##### ##### ##### #### ####
# # # # # # # # # # #### #### # # #
##### #### ##### ##### ##### # # # # ####
# # # # # # # # # # # # #
# # # # # # # # #### # #### # ####
#finds the password of a desired ... | (rf):
alphabet="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890"
start=time.time()
tryn=0
for a in range(1,len(alphabet)+1):
for b in itertools.product(alphabet,repeat=a):
k="".join(b)
if rf[-4:]==".rar":
print("Trying:",k)
kf=os.popen("unrar t -y -p%s %s 2>&1|grep 'All OK'"%(k,rf))
... | rc | identifier_name |
pyrarcr-0.2.py | #!/usr/bin/env python3
##### ##### ##### ##### #### ####
# # # # # # # # # # #### #### # # # |
#finds the password of a desired rar or zip file using a brute-force algorithm
##will fail to find the password if the password has a character that isnt in
##the english alphabet or isnt a number (you can change the char. list though)
#now using itertools!
#importing needed modules
import time,os,sys,shutil,itertool... | ##### #### ##### ##### ##### # # # # ####
# # # # # # # # # # # # #
# # # # # # # # #### # #### # #### | random_line_split |
pyrarcr-0.2.py | #!/usr/bin/env python3
##### ##### ##### ##### #### ####
# # # # # # # # # # #### #### # # #
##### #### ##### ##### ##### # # # # ####
# # # # # # # # # # # # #
# # # # # # # # #### # #### # ####
#finds the password of a desired ... |
#checking if the file exists/running the function
if len(sys.argv)==2:
if os.path.exists(sys.argv[1]):
rc(sys.argv[1])
else:
print("ERROR: File doesn't exist.\nExiting...")
else:
print("Usage:",os.path.basename(__file__),"[rar file]")
print("Example:",os.path.basename(__file__),"foobar.rar")
| alphabet="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890"
start=time.time()
tryn=0
for a in range(1,len(alphabet)+1):
for b in itertools.product(alphabet,repeat=a):
k="".join(b)
if rf[-4:]==".rar":
print("Trying:",k)
kf=os.popen("unrar t -y -p%s %s 2>&1|grep 'All OK'"%(k,rf))
tryn... | identifier_body |
test_titles.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | (rst.Directive):
has_content = True
def run(self):
return []
def fake_role(name, rawtext, text, lineno, inliner,
options=None, content=None):
return [], []
directives.register_directive('seqdiag', FakeDirective)
directives.register_directive('blockdiag', FakeDirective)
directives.... | FakeDirective | identifier_name |
test_titles.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | return titles
def _check_titles(self, titles):
self.assertEqual(7, len(titles))
problem = 'Problem description'
self.assertIn(problem, titles)
self.assertEqual(0, len(titles[problem]))
proposed = 'Proposed change'
self.assertIn(proposed, titles)
sel... | if node.tagname == 'section':
section = self._get_title(node)
titles[section['name']] = section['subtitles'] | random_line_split |
test_titles.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
elif node.tagname == 'section':
subsection = self._get_title(node)
section['subtitles'].append(subsection['name'])
return section
def _get_titles(self, spec):
titles = {}
for node in spec:
if node.tagname == 'section':
... | section['name'] = node.rawsource | conditional_block |
test_titles.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
def fake_role(name, rawtext, text, lineno, inliner,
options=None, content=None):
return [], []
directives.register_directive('seqdiag', FakeDirective)
directives.register_directive('blockdiag', FakeDirective)
directives.register_directive('nwdiag', FakeDirective)
directives.register_directive('ac... | return [] | identifier_body |
RemoveParentModulesPlugin.js | /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function chunkContainsModule(chunk, module) {
var chunks = module.chunks;
var modules = chunk.modules;
if(chunks.length < modules.length) {
return chunks.indexOf(chunk) >= 0;
} else {
return modules.indexOf(modul... |
module.exports = RemoveParentModulesPlugin;
RemoveParentModulesPlugin.prototype.apply = function(compiler) {
compiler.plugin("compilation", function(compilation) {
compilation.plugin(["optimize-chunks-basic", "optimize-extracted-chunks-basic"], function(chunks) {
chunks.forEach(function(chunk) {
var cache =... | {} | identifier_body |
RemoveParentModulesPlugin.js | /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function chunkContainsModule(chunk, module) {
var chunks = module.chunks;
var modules = chunk.modules;
if(chunks.length < modules.length) {
return chunks.indexOf(chunk) >= 0;
} else {
return modules.indexOf(modul... | (set, items) {
items.forEach(function(item) {
if(set.indexOf(item) < 0)
set.push(item);
});
}
function debugIds(chunks) {
var list = chunks.map(function(chunk) {
return chunk.debugId;
});
if(list.some(function(dId) {
return typeof dId !== "number";
})) return "no";
list.sort();
return list.join(",")... | addToSet | identifier_name |
RemoveParentModulesPlugin.js | /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function chunkContainsModule(chunk, module) {
var chunks = module.chunks;
var modules = chunk.modules;
if(chunks.length < modules.length) {
return chunks.indexOf(chunk) >= 0;
} else {
return modules.indexOf(modul... | function hasModule(chunk, module, checkedChunks) {
if(chunkContainsModule(chunk, module)) return [chunk];
if(chunk.entry) return false;
return allHaveModule(chunk.parents.filter(function(c) {
return checkedChunks.indexOf(c) < 0;
}), module, checkedChunks);
}
function allHaveModule(someChunks, module, checkedChun... | }
| random_line_split |
jquery.pretty-text-diff.min.js | // Generated by CoffeeScript 1.7.1
/*
@preserve jQuery.PrettyTextDiff 1.0.4
See https://github.com/arnab/jQuery.PrettyTextDiff/ | */
(function() {
var $;
$ = jQuery;
$.fn.extend({
prettyTextDiff: function(options) {
var dmp, settings;
settings = {
originalContainer: ".original",
changedContainer: ".changed",
diffContainer: ".diff",
clea... | random_line_split | |
jquery.pretty-text-diff.min.js | // Generated by CoffeeScript 1.7.1
/*
@preserve jQuery.PrettyTextDiff 1.0.4
See https://github.com/arnab/jQuery.PrettyTextDiff/
*/
(function() {
var $;
$ = jQuery;
$.fn.extend({
prettyTextDiff: function(options) {
var dmp, settings;
settings = {
origina... |
$.fn.prettyTextDiff.debug("Original text found: ", original, settings);
$.fn.prettyTextDiff.debug("Changed text found: ", changed, settings);
diffs = dmp.diff_main(original, changed);
if (settings.cleanup) {
dmp.diff_cleanupSemantic(d... | {
original = $(settings.originalContainer, this).text();
changed = $(settings.changedContainer, this).text();
} | conditional_block |
write.rs | use std::fmt;
use std::io;
pub trait AnyWrite {
type wstr: ?Sized;
type Error;
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error>;
fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error>;
}
impl<'a> AnyWrite for fmt::Write + 'a {
type wstr = str;
type Error ... |
}
| {
io::Write::write_all(self, s)
} | identifier_body |
write.rs | use std::fmt;
use std::io;
pub trait AnyWrite {
type wstr: ?Sized;
type Error;
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error>;
fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error>;
}
impl<'a> AnyWrite for fmt::Write + 'a {
type wstr = str;
type Error ... | (&mut self, s: &Self::wstr) -> Result<(), Self::Error> {
fmt::Write::write_str(self, s)
}
}
impl<'a> AnyWrite for io::Write + 'a {
type wstr = [u8];
type Error = io::Error;
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> {
io::Write::write_fmt(self, fmt)
}
... | write_str | identifier_name |
write.rs | use std::fmt;
use std::io;
pub trait AnyWrite {
type wstr: ?Sized;
type Error;
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error>;
fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error>;
}
impl<'a> AnyWrite for fmt::Write + 'a {
type wstr = str;
type Error ... | fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error> {
io::Write::write_all(self, s)
}
} | random_line_split | |
datelib.py | #!/usr/bin/env python
# Copyright 2002 Google Inc. 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.0
#
# Unless required... | (cls, timestring, tz=None):
"""Use dateutil.parser to convert string into timestamp.
dateutil.parser understands ISO8601 which is really handy.
Args:
timestring: string with datetime
tz: optional timezone, if timezone is omitted from timestring.
Returns:
New Timestamp or None if una... | _StringToTime | identifier_name |
datelib.py | #!/usr/bin/env python
# Copyright 2002 Google Inc. 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.0
#
# Unless required... |
def normalize(self, dt, unused_is_dst=False):
"""Correct the timezone information on the given datetime."""
if dt.tzinfo is None:
raise ValueError('Naive time - no tzinfo set')
return dt.replace(tzinfo=self)
LocalTimezone = LocalTimezoneClass()
class BaseTimestamp(datetime.datetime):
"""Our ... | """Convert naive time to local time."""
if dt.tzinfo is not None:
raise ValueError('Not naive datetime (tzinfo is already set)')
return dt.replace(tzinfo=self) | identifier_body |
datelib.py | #!/usr/bin/env python
# Copyright 2002 Google Inc. 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.0
#
# Unless required... |
Returns:
An integer representing the number of seconds represented by the interval
string, or None if the interval string could not be decoded.
"""
total = 0
while interval:
match = _INTERVAL_REGEXP.match(interval)
if not match:
return None
try:
num = int(match.group(1))
ex... |
Args:
interval: String to interpret as an interval. A basic interval looks like
"<number><suffix>". Complex intervals consisting of a chain of basic
intervals are also allowed. | random_line_split |
datelib.py | #!/usr/bin/env python
# Copyright 2002 Google Inc. 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.0
#
# Unless required... |
return result
# Conversions from interval suffixes to number of seconds.
# (m => 60s, d => 86400s, etc)
_INTERVAL_CONV_DICT = {'s': 1}
_INTERVAL_CONV_DICT['m'] = 60 * _INTERVAL_CONV_DICT['s']
_INTERVAL_CONV_DICT['h'] = 60 * _INTERVAL_CONV_DICT['m']
_INTERVAL_CONV_DICT['d'] = 24 * _INTERVAL_CONV_DICT['h']
_INTERV... | result = tz.localize(result) | conditional_block |
netdata.py | # -*- coding: utf-8 -*-
"""
Display network speed and bandwidth usage.
Configuration parameters:
cache_timeout: refresh interval for this module (default 2)
format: display format for this module
*(default '{nic} [\?color=down LAN(Kb): {down}↓ {up}↑]
[\?color=total T(Mb): {download}↓ {upload}↑ ... | lculate network speed and network traffic.
"""
data = GetData(self.nic)
received_bytes, transmitted_bytes = data.netBytes()
# net_speed (statistic)
down = (received_bytes - self.old_received) / 1024.
up = (transmitted_bytes - self.old_transmitted) / 1024.
self.ol... | Ca | identifier_name |
netdata.py | # -*- coding: utf-8 -*-
"""
Display network speed and bandwidth usage.
Configuration parameters:
cache_timeout: refresh interval for this module (default 2)
format: display format for this module
*(default '{nic} [\?color=down LAN(Kb): {down}↓ {up}↑]
[\?color=total T(Mb): {download}↓ {upload}↑ ... | """
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
| speed and network traffic.
"""
data = GetData(self.nic)
received_bytes, transmitted_bytes = data.netBytes()
# net_speed (statistic)
down = (received_bytes - self.old_received) / 1024.
up = (transmitted_bytes - self.old_transmitted) / 1024.
self.old_received = rec... | identifier_body |
netdata.py | # -*- coding: utf-8 -*-
"""
Display network speed and bandwidth usage.
Configuration parameters:
cache_timeout: refresh interval for this module (default 2)
format: display format for this module
*(default '{nic} [\?color=down LAN(Kb): {down}↓ {up}↑]
[\?color=total T(Mb): {download}↓ {upload}↑ ... | """
Calculate network speed and network traffic.
"""
data = GetData(self.nic)
received_bytes, transmitted_bytes = data.netBytes()
# net_speed (statistic)
down = (received_bytes - self.old_received) / 1024.
up = (transmitted_bytes - self.old_transmitted) / 1024... | s fh:
for line in fh:
fields = line.strip().split()
if fields[1] == '00000000' and int(fields[3], 16) & 2:
self.nic = fields[0]
break
if self.nic is None:
self.nic = 'lo'
self.... | conditional_block |
netdata.py | # -*- coding: utf-8 -*-
""" | Display network speed and bandwidth usage.
Configuration parameters:
cache_timeout: refresh interval for this module (default 2)
format: display format for this module
*(default '{nic} [\?color=down LAN(Kb): {down}↓ {up}↑]
[\?color=total T(Mb): {download}↓ {upload}↑ {total}↕]')*
nic: networ... | random_line_split | |
scopemeasure_stopover_adds_an_extra_line_to_the_log_upon_each_call.rs | use libnewsboat::{
logger::{self, Level},
scopemeasure::ScopeMeasure,
};
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
use std::path::Path;
use tempfile::TempDir;
fn file_lines_count(logfile: &Path) -> Result<usize> {
let file = File::open(logfile)?;
let reader = BufReader::new(file);
... | {
for calls in &[1, 2, 5] {
let tmp = TempDir::new().unwrap();
let logfile = {
let mut logfile = tmp.path().to_owned();
logfile.push("example.log");
logfile
};
{
logger::get_instance().set_logfile(logfile.to_str().unwrap());
... | identifier_body | |
scopemeasure_stopover_adds_an_extra_line_to_the_log_upon_each_call.rs | use libnewsboat::{
logger::{self, Level},
scopemeasure::ScopeMeasure,
};
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
use std::path::Path;
use tempfile::TempDir;
fn | (logfile: &Path) -> Result<usize> {
let file = File::open(logfile)?;
let reader = BufReader::new(file);
Ok(reader.lines().count())
}
#[test]
fn stopover_adds_an_extra_line_to_the_log_upon_each_call() {
for calls in &[1, 2, 5] {
let tmp = TempDir::new().unwrap();
let logfile = {
... | file_lines_count | identifier_name |
scopemeasure_stopover_adds_an_extra_line_to_the_log_upon_each_call.rs | use libnewsboat::{
logger::{self, Level},
scopemeasure::ScopeMeasure,
};
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
use std::path::Path;
use tempfile::TempDir;
fn file_lines_count(logfile: &Path) -> Result<usize> {
let file = File::open(logfile)?;
let reader = BufReader::new(file);
... | for calls in &[1, 2, 5] {
let tmp = TempDir::new().unwrap();
let logfile = {
let mut logfile = tmp.path().to_owned();
logfile.push("example.log");
logfile
};
{
logger::get_instance().set_logfile(logfile.to_str().unwrap());
... | #[test]
fn stopover_adds_an_extra_line_to_the_log_upon_each_call() { | random_line_split |
mod.rs | use std::time::{Instant, Duration};
use super::Figure;
/// This struct is responsible for logging the average frame duration to stdout
/// once a second.
pub struct FpsLog {
last_second: Instant,
avg_duration_ns: u64,
ticks: u64,
}
impl FpsLog {
pub fn new() -> FpsLog {
FpsLog {
la... | /// Dump the frame time to std out
fn print(&self) {
let frame_time_ms = self.avg_duration_ns / 1000000;
println!("avg frame time: {}ns which is {}ms",
self.avg_duration_ns, frame_time_ms);
}
/// Reset internal state which is used to calculate frame duration
fn rese... | avg_duration_ns: 0,
ticks: 0
}
}
| random_line_split |
mod.rs | use std::time::{Instant, Duration};
use super::Figure;
/// This struct is responsible for logging the average frame duration to stdout
/// once a second.
pub struct FpsLog {
last_second: Instant,
avg_duration_ns: u64,
ticks: u64,
}
impl FpsLog {
pub fn new() -> FpsLog {
FpsLog {
la... | (&self) {
let frame_time_ms = self.avg_duration_ns / 1000000;
println!("avg frame time: {}ns which is {}ms",
self.avg_duration_ns, frame_time_ms);
}
/// Reset internal state which is used to calculate frame duration
fn reset(&mut self) {
self.last_second = Instant::... | print | identifier_name |
mod.rs | use std::time::{Instant, Duration};
use super::Figure;
/// This struct is responsible for logging the average frame duration to stdout
/// once a second.
pub struct FpsLog {
last_second: Instant,
avg_duration_ns: u64,
ticks: u64,
}
impl FpsLog {
pub fn new() -> FpsLog |
/// Dump the frame time to std out
fn print(&self) {
let frame_time_ms = self.avg_duration_ns / 1000000;
println!("avg frame time: {}ns which is {}ms",
self.avg_duration_ns, frame_time_ms);
}
/// Reset internal state which is used to calculate frame duration
fn re... | {
FpsLog {
last_second: Instant::now(),
avg_duration_ns: 0,
ticks: 0
}
} | identifier_body |
mod.rs | use std::time::{Instant, Duration};
use super::Figure;
/// This struct is responsible for logging the average frame duration to stdout
/// once a second.
pub struct FpsLog {
last_second: Instant,
avg_duration_ns: u64,
ticks: u64,
}
impl FpsLog {
pub fn new() -> FpsLog {
FpsLog {
la... |
self.add_frame_duration(duration);
}
}
| {
self.print();
self.reset();
} | conditional_block |
classadbase_1_1_timer_item.js | [ "start", "d0/db0/classadbase_1_1_timer_item.html#ad86504a79d82c1e25633ebf56a089120", null ],
[ "stop", "d0/db0/classadbase_1_1_timer_item.html#a04551c02abdd8803c1c7329be496a3c4", null ],
[ "timerHandler", "d0/db0/classadbase_1_1_timer_item.html#aadf5574e948f85d696ab571f3d9fcc69", null ]
]; | var classadbase_1_1_timer_item =
[
[ "TimerItem", "d0/db0/classadbase_1_1_timer_item.html#a72988b767c5f2d44d3e7d0da58837d33", null ],
[ "~TimerItem", "d0/db0/classadbase_1_1_timer_item.html#a605e9a82245eeccfe12f96ccf93aab1b", null ],
[ "setDelTimerCallback", "d0/db0/classadbase_1_1_timer_item.html#a9eb85cc8... | random_line_split | |
simpleamt.py | import argparse, json
import boto3
from boto.mturk.connection import MTurkConnection
from boto.mturk.qualification import *
from jinja2 import Environment, FileSystemLoader
"""
A bunch of free functions that we use in all scripts.
"""
| """
Get a jinja2 Environment object that we can use to find templates.
"""
return Environment(loader=FileSystemLoader(config['template_directories']))
def json_file(filename):
with open(filename, 'r') as f:
return json.load(f)
def get_parent_parser():
"""
Get an argparse parser with arguments that... | def get_jinja_env(config): | random_line_split |
simpleamt.py | import argparse, json
import boto3
from boto.mturk.connection import MTurkConnection
from boto.mturk.qualification import *
from jinja2 import Environment, FileSystemLoader
"""
A bunch of free functions that we use in all scripts.
"""
def get_jinja_env(config):
"""
Get a jinja2 Environment object that we can use... | (hit_properties):
"""
Replace some of the human-readable keys from the raw HIT properties
JSON data structure with boto-specific objects.
"""
qual = Qualifications()
if 'country' in hit_properties:
qual.add(LocaleRequirement('In', hit_properties['country']))
del hit_properties['country']
if 'h... | setup_qualifications | identifier_name |
simpleamt.py | import argparse, json
import boto3
from boto.mturk.connection import MTurkConnection
from boto.mturk.qualification import *
from jinja2 import Environment, FileSystemLoader
"""
A bunch of free functions that we use in all scripts.
"""
def get_jinja_env(config):
"""
Get a jinja2 Environment object that we can use... |
def get_parent_parser():
"""
Get an argparse parser with arguments that are always needed
"""
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--prod', action='store_false', dest='sandbox',
default=True,
help="Whether to run on the production... | with open(filename, 'r') as f:
return json.load(f) | identifier_body |
simpleamt.py | import argparse, json
import boto3
from boto.mturk.connection import MTurkConnection
from boto.mturk.qualification import *
from jinja2 import Environment, FileSystemLoader
"""
A bunch of free functions that we use in all scripts.
"""
def get_jinja_env(config):
"""
Get a jinja2 Environment object that we can use... |
if aws_secret_key is not None:
kwargs['aws_secret_access_key'] = aws_secret_key
if sandbox:
host = 'mechanicalturk.sandbox.amazonaws.com'
else:
host='mechanicalturk.amazonaws.com'
return MTurkConnection(host=host, **kwargs)
def setup_qualifications(hit_properties):
"""
Replace some of the hu... | kwargs['aws_access_key_id'] = aws_access_key | conditional_block |
record_all_old.py | import time
import threading
import logging
import serial
import io
import sim900
import sys
if __name__ == "__main__":
#this is a bad file for recording the diode temps and voltages
#eventually it will be merged with recording the resistance bridges
#and actually use the sim900 file functions
#cre... | sim.close_sim900()
print "ports closed" | print "done writing"
sim.close_sim922() | random_line_split |
record_all_old.py | import time
import threading
import logging
import serial
import io
import sim900
import sys
if __name__ == "__main__":
#this is a bad file for recording the diode temps and voltages
#eventually it will be merged with recording the resistance bridges
#and actually use the sim900 file functions
#cre... |
except KeyboardInterrupt:
f.close()
print "done writing"
sim.close_sim922()
sim.close_sim900()
print "ports closed"
| sim.connect_sim922()
dio_temps = sim.get_sim922_temp()
dio_temps = dio_temps.rstrip()
time.sleep(1)
dio_volts = sim.get_sim922_volts()
dio_volts = dio_volts.rstrip()
sim.close_sim922()
print "diode"
time.sleep(1)
... | conditional_block |
greenlets.py | import distutils.version
try:
import greenlet
getcurrent = greenlet.greenlet.getcurrent
GreenletExit = greenlet.greenlet.GreenletExit
preserves_excinfo = (distutils.version.LooseVersion(greenlet.__version__)
>= distutils.version.LooseVersion('0.3.2'))
greenlet = greenlet.greenlet | from py.magic import greenlet
getcurrent = greenlet.getcurrent
GreenletExit = greenlet.GreenletExit
preserves_excinfo = False
except ImportError:
try:
from stackless import greenlet
getcurrent = greenlet.getcurrent
GreenletExit = greenlet.G... | except ImportError, e:
raise
try: | random_line_split |
test.rs | #![crate_name = "test"]
#![feature(libc)]
#![feature(start)]
extern crate libc;
extern crate wx;
use libc::c_void;
use wx::_unsafe::*;
use wx::defs::*;
use wx::base::*;
use wx::core::*;
mod macros;
wxApp!(wx_main);
extern "C"
fn wx_main() |
fn make_frame() -> Frame {
let frame = Frame::new(&Window::null(), ID_ANY, "Hello, wxRust!", -1, -1, -1, -1, DEFAULT_FRAME_STYLE);
let menubar = make_menubar();
frame.setMenuBar(&menubar);
make_button(&frame);
frame
}
fn make_menubar() -> MenuBar {
let menubar = MenuBar::new(0);
... | {
let frame = make_frame();
frame.show();
frame.raise();
} | identifier_body |
test.rs | #![crate_name = "test"]
#![feature(libc)]
#![feature(start)]
extern crate libc;
extern crate wx;
use libc::c_void;
use wx::_unsafe::*;
use wx::defs::*;
use wx::base::*;
use wx::core::*;
mod macros;
wxApp!(wx_main);
extern "C"
fn wx_main() {
let frame = make_frame();
frame.show();
frame.raise();
}
f... |
println!("hello!");
let parent = Window::from(data);
let msgDlg = MessageDialog::new(&parent, "Pushed!!", "The Button", OK);
msgDlg.showModal();
}
fn make_button<T: WindowMethods>(parent: &T) -> Button {
let button = Button::new(parent, ID_ANY, "Push me!", 10, 10, 50, 30, 0);
let closure = Cl... | {
// Comes here when the target widget is destroyed.
return;
} | conditional_block |
test.rs | #![crate_name = "test"]
#![feature(libc)]
#![feature(start)]
extern crate libc;
extern crate wx;
use libc::c_void;
use wx::_unsafe::*;
use wx::defs::*;
use wx::base::*;
use wx::core::*;
mod macros;
wxApp!(wx_main);
extern "C"
fn wx_main() {
let frame = make_frame();
frame.show();
frame.raise();
}
f... | <T: WindowMethods>(parent: &T) -> Button {
let button = Button::new(parent, ID_ANY, "Push me!", 10, 10, 50, 30, 0);
let closure = Closure::new(MyButton_clicked as *mut c_void, parent.ptr());
unsafe {
button.connect(ID_ANY, ID_ANY, expEVT_COMMAND_BUTTON_CLICKED(), closure.ptr());
}
button
}
| make_button | identifier_name |
test.rs | #![crate_name = "test"]
#![feature(libc)]
#![feature(start)]
extern crate libc;
extern crate wx;
use libc::c_void;
use wx::_unsafe::*;
use wx::defs::*;
use wx::base::*;
use wx::core::*;
mod macros;
wxApp!(wx_main);
extern "C"
fn wx_main() {
let frame = make_frame();
frame.show();
frame.raise();
}
f... | }
fn make_menubar() -> MenuBar {
let menubar = MenuBar::new(0);
let fileMenu = Menu::new("", 0);
let fileNew = MenuItem::newEx(ID_ANY, "New", "Create a new file.", 0, &Menu::null());
fileMenu.appendItem(&fileNew);
menubar.append(&fileMenu, "File");
menubar
}
extern "C"
fn MyButton_clicke... | make_button(&frame);
frame | random_line_split |
outlook.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... | # '\\Software\\Microsoft\\Office\\15.0\\Outlook\\Search\\Catalog'
REG_TYPE = 'NTUSER'
def GetEntries(self, key, **unused_kwargs):
"""Collect the values under Outlook and return event for each one."""
value_index = 0
for value in key.GetValues():
# Ignore the default value.
if not val... | # '\\Software\\Microsoft\\Office\\12.0\\Outlook\\Catalog'
# MS Outlook 2010 Search Catalog:
# '\\Software\\Microsoft\\Office\\14.0\\Outlook\\Search\\Catalog'
# MS Outlook 2013 Search Catalog: | random_line_split |
outlook.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... | """Collect the values under Outlook and return event for each one."""
value_index = 0
for value in key.GetValues():
# Ignore the default value.
if not value.name:
continue
# Ignore any value that is empty or that does not contain an integer.
if not value.data or not value.DataIs... | identifier_body | |
outlook.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... | (self, key, **unused_kwargs):
"""Collect the values under Outlook and return event for each one."""
value_index = 0
for value in key.GetValues():
# Ignore the default value.
if not value.name:
continue
# Ignore any value that is empty or that does not contain an integer.
if ... | GetEntries | identifier_name |
outlook.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... |
# Ignore any value that is empty or that does not contain an integer.
if not value.data or not value.DataIsInteger():
continue
# TODO: change this 32-bit integer into something meaningful, for now
# the value name is the most interesting part.
text_dict = {}
text_dict[valu... | continue | conditional_block |
autorizada.js | var mongoose = require('mongoose');
var u = require('../utils');
var autorizadaSchema = new mongoose.Schema({
nome: String,
cpf: { type: String, unique: true },
celular: String,
dtInicial: Date,
dtFinal: Date,
autorizador: String,
apto: Number,
bloco: String,
contato: String
});
va... | module.exports = A; | random_line_split | |
state.rs | use nalgebra::{Point2, Scalar, Vector2};
use std::collections::HashSet;
use std::hash::Hash;
use event::{ElementState, React};
/// An atomic state of an input element.
pub trait State: Copy + Eq {
// TODO: Use a default type (`Self`) here once that feature stabilizes.
/// Representation of a difference betwee... | }
/// An input element, such as a button, key, or position.
pub trait Element: Copy + Sized {
/// Representation of the state of the element.
type State: State;
}
/// A state with a composite representation. This is used for input elements
/// which have a cardinality greater than one. For example, a mouse ma... | T: Eq + Scalar,
{
type Difference = Vector2<T>; | random_line_split |
state.rs | use nalgebra::{Point2, Scalar, Vector2};
use std::collections::HashSet;
use std::hash::Hash;
use event::{ElementState, React};
/// An atomic state of an input element.
pub trait State: Copy + Eq {
// TODO: Use a default type (`Self`) here once that feature stabilizes.
/// Representation of a difference betwee... |
}
impl State for bool {
type Difference = Self;
}
impl State for ElementState {
type Difference = Self;
}
impl<T> State for Point2<T>
where
T: Eq + Scalar,
{
type Difference = Vector2<T>;
}
/// An input element, such as a button, key, or position.
pub trait Element: Copy + Sized {
/// Represent... | {
if live == snapshot {
None
}
else {
Some(live)
}
} | identifier_body |
state.rs | use nalgebra::{Point2, Scalar, Vector2};
use std::collections::HashSet;
use std::hash::Hash;
use event::{ElementState, React};
/// An atomic state of an input element.
pub trait State: Copy + Eq {
// TODO: Use a default type (`Self`) here once that feature stabilizes.
/// Representation of a difference betwee... |
else {
ElementState::Released
}
}
}
/// Provides a transition state for an input element.
pub trait InputTransition<E>
where
E: Element,
{
/// Gets the transition state of an input element.
fn transition(&self, element: E) -> Option<E::State>;
}
impl<E, T> InputTransition<... | {
ElementState::Pressed
} | conditional_block |
state.rs | use nalgebra::{Point2, Scalar, Vector2};
use std::collections::HashSet;
use std::hash::Hash;
use event::{ElementState, React};
/// An atomic state of an input element.
pub trait State: Copy + Eq {
// TODO: Use a default type (`Self`) here once that feature stabilizes.
/// Representation of a difference betwee... | (&self, element: E) -> E::State {
if self.composite().contains(&element) {
ElementState::Pressed
}
else {
ElementState::Released
}
}
}
/// Provides a transition state for an input element.
pub trait InputTransition<E>
where
E: Element,
{
/// Gets the ... | state | identifier_name |
dispnew.rs | //! Updating of data structures for redisplay.
use std::{cmp, ptr};
use remacs_lib::current_timespec;
use remacs_macros::lisp_fn;
use crate::{
eval::unbind_to,
frame::selected_frame,
frame::{LispFrameLiveOrSelected, LispFrameRef},
lisp::{ExternalPtr, LispObject},
lists::{LispConsCircularChecks, L... | #[lisp_fn(c_name = "redraw_frame", name = "redraw-frame", min = "0")]
pub fn redraw_frame_lisp(frame: LispFrameLiveOrSelected) {
redraw_frame(frame.into());
}
/// Clear and redisplay all visible frames.
#[lisp_fn]
pub fn redraw_display() {
for_each_frame!(frame => {
if frame.visible() != 0 {
... | }
/// Clear frame FRAME and output again what is supposed to appear on it.
/// If FRAME is omitted or nil, the selected frame is used. | random_line_split |
dispnew.rs | //! Updating of data structures for redisplay.
use std::{cmp, ptr};
use remacs_lib::current_timespec;
use remacs_macros::lisp_fn;
use crate::{
eval::unbind_to,
frame::selected_frame,
frame::{LispFrameLiveOrSelected, LispFrameRef},
lisp::{ExternalPtr, LispObject},
lists::{LispConsCircularChecks, L... |
include!(concat!(env!("OUT_DIR"), "/dispnew_exports.rs"));
| {
let force: bool = force.is_not_nil();
unsafe {
swallow_events(true);
let ret =
(detect_input_pending_run_timers(true) && !force && !globals.redisplay_dont_pause)
|| globals.Vexecuting_kbd_macro.is_not_nil();
if ret {
let count = c_specpdl_inde... | identifier_body |
dispnew.rs | //! Updating of data structures for redisplay.
use std::{cmp, ptr};
use remacs_lib::current_timespec;
use remacs_macros::lisp_fn;
use crate::{
eval::unbind_to,
frame::selected_frame,
frame::{LispFrameLiveOrSelected, LispFrameRef},
lisp::{ExternalPtr, LispObject},
lists::{LispConsCircularChecks, L... | (w: LispWindowRef, on_p: bool) {
let mut w = Some(w);
while let Some(mut win) = w {
if let Some(contents) = win.contents.as_window() {
set_window_update_flags(contents, on_p);
} else {
win.set_must_be_updated_p(on_p);
}
let next = win.next;
w = if... | set_window_update_flags | identifier_name |
scheduler.rs | use std::io;
use std::io::prelude::*;
use std::collections::{HashSet, HashMap};
use std::str::FromStr;
use time;
use regex::Regex;
use error::Error;
use error::Error::ErrCronFormat;
pub type SchedulerResult<'a> = Result<Scheduler<'a>, Error>;
#[derive(Debug)]
pub struct Scheduler<'a> {
seconds: &'a str,
min... |
}
fn parse_intervals_field(inter: &str, min: u32, max: u32) -> Result<HashSet<u32>, Error> {
let mut points = HashSet::new();
let parts: Vec<&str> = inter.split(",").collect();
for part in parts {
let x: Vec<&str> = part.split("/").collect();
let y: Vec<&str> = x[0].split("-").collect();
... | {
let (second, minute, hour, day, month, weekday) = (t.tm_sec as u32,
t.tm_min as u32,
t.tm_hour as u32,
t.tm_mday as u32,
... | identifier_body |
scheduler.rs | use std::io;
use std::io::prelude::*;
use std::collections::{HashSet, HashMap};
use std::str::FromStr;
use time;
use regex::Regex;
use error::Error;
use error::Error::ErrCronFormat;
pub type SchedulerResult<'a> = Result<Scheduler<'a>, Error>;
#[derive(Debug)]
pub struct Scheduler<'a> {
seconds: &'a str,
min... | (intervals: &'a str) -> SchedulerResult {
let reRes = Regex::new(r"^\s*((\*(/\d+)?)|[0-9-,/]+)(\s+((\*(/\d+)?)|[0-9-,/]+)){4,5}\s*$");
match reRes {
Ok(re) => {
if !re.is_match(intervals) {
return Err(ErrCronFormat(format!("invalid format: {}", intervals)... | new | identifier_name |
scheduler.rs | use std::io;
use std::io::prelude::*;
use std::collections::{HashSet, HashMap};
use std::str::FromStr;
use time;
use regex::Regex;
use error::Error;
use error::Error::ErrCronFormat;
pub type SchedulerResult<'a> = Result<Scheduler<'a>, Error>;
#[derive(Debug)]
pub struct Scheduler<'a> {
seconds: &'a str,
min... | }
#[test]
fn test_parse_intervals() {
assert!(Scheduler::new("*/2 1-8,11 * * *").is_ok());
assert!(Scheduler::new("0 */2 1-8,11 * * *").is_ok());
assert!(Scheduler::new("*/2 1-4,16,11,17 * * *").is_ok());
assert!(Scheduler::new("05 */2 1-8,11 * * * *").is_err());
assert!(Scheduler::new("05 */ 1-8,1... |
Ok(points) | random_line_split |
linux.py | # Copyright (C) 2010-2013 Claudio Guarnieri.
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import logging
import datetime
import re
import dateutil.parser
from lib.cuckoo.common.abstrac... |
def __iter__(self):
for event in self.eventstream:
for k, v in self.kwfilters.items():
if event[k] != v:
continue
del event["type"]
yield event
def __nonzero__(self):
return True
class LinuxSystemTap(BehaviorHan... | self.eventstream = eventstream
self.kwfilters = kwfilters | identifier_body |
linux.py | # Copyright (C) 2010-2013 Claudio Guarnieri.
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import logging
import datetime
import re
import dateutil.parser
from lib.cuckoo.common.abstrac... | (self, eventstream, **kwfilters):
self.eventstream = eventstream
self.kwfilters = kwfilters
def __iter__(self):
for event in self.eventstream:
for k, v in self.kwfilters.items():
if event[k] != v:
continue
del event["type"]
... | __init__ | identifier_name |
linux.py | # Copyright (C) 2010-2013 Claudio Guarnieri.
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import logging
import datetime
import re
import dateutil.parser
from lib.cuckoo.common.abstrac... |
def parse(self, path):
parser = StapParser(open(path))
for event in parser:
pid = event["pid"]
if pid not in self.pids_seen:
self.pids_seen.add(pid)
ppid = self.forkmap.get(pid, -1)
process = {
"pid": pid... | self.matched = True
return True | conditional_block |
linux.py | # Copyright (C) 2010-2013 Claudio Guarnieri.
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import logging
import datetime
import re
import dateutil.parser
from lib.cuckoo.common.abstrac... | return True
def parse(self, path):
parser = StapParser(open(path))
for event in parser:
pid = event["pid"]
if pid not in self.pids_seen:
self.pids_seen.add(pid)
ppid = self.forkmap.get(pid, -1)
process = {
... | self.matched = True | random_line_split |
test_instance.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import os
from . import spd
# K temps: [0.0, 100.0, 150.0, 200.0, 225.0, 250.0, 275.0, 300.0, 325.0, 350.0, 375.0, 400.0, 425.0, 450.0, 475.0, 500.0, 525.0, 550.0]
# C temps: [273, 373.0, 423.0, 473.0, 498.0, 523.0, 548.... | (calculate=calculate):
for stat in calculate:
spec = spd.PintPars(gui.Data, '0238x6011044', 473., 623., 'magic', [stat])
spec.reqd_stats()
print('---------')
print(calculate)
def many_specimens(calculate=calculate):
from itertools import combinations
c = combinations(calculate,... | make_specimens | identifier_name |
test_instance.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import os
from . import spd
# K temps: [0.0, 100.0, 150.0, 200.0, 225.0, 250.0, 275.0, 300.0, 325.0, 350.0, 375.0, 400.0, 425.0, 450.0, 475.0, 500.0, 525.0, 550.0]
# C temps: [273, 373.0, 423.0, 473.0, 498.0, 523.0, 548.... |
#spec.calculate_all_statistics()
SCAT_spec = spd.PintPars(gui.Data, '0238x6011044', 273., 673.) # 0, 400
SCAT_spec2 = spd.PintPars(gui.Data, '0238x6011044', 273., 698.) # 0, 425
SCAT_spec.York_Regression()
SCAT_spec2.York_Regression()
#new_spec = spd.PintPars(gui.Data, '0238x5721062', 100. + 2... | print('combo', combo)
spec = spd.PintPars(gui.Data, '0238x6011044', 473., 623., 'magic', combo)
spec.reqd_stats()
print('XXXXXXXXXXXXXXX') | conditional_block |
test_instance.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import os
from . import spd
# K temps: [0.0, 100.0, 150.0, 200.0, 225.0, 250.0, 275.0, 300.0, 325.0, 350.0, 375.0, 400.0, 425.0, 450.0, 475.0, 500.0, 525.0, 550.0]
# C temps: [273, 373.0, 423.0, 473.0, 498.0, 523.0, 548.... | #gui10 = tgs.Arai_GUI('consistency_tests/Yamamoto_etal_2003_magic_measurements.txt') | #gui6 = tgs.Arai_GUI('consistency_tests/Muxworthy_etal_2011_magic_measurements.txt')
#gui7 = tgs.Arai_GUI('consistency_tests/Paterson_etal_2010_magic_measurements.txt')
#gui8 = tgs.Arai_GUI('consistency_tests/Selkin_etal_2000_magic_measurements.txt') | random_line_split |
test_instance.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import os
from . import spd
# K temps: [0.0, 100.0, 150.0, 200.0, 225.0, 250.0, 275.0, 300.0, 325.0, 350.0, 375.0, 400.0, 425.0, 450.0, 475.0, 500.0, 525.0, 550.0]
# C temps: [273, 373.0, 423.0, 473.0, 498.0, 523.0, 548.... |
def many_specimens(calculate=calculate):
from itertools import combinations
c = combinations(calculate, 2)
for combo in c:
print('combo', combo)
spec = spd.PintPars(gui.Data, '0238x6011044', 473., 623., 'magic', combo)
spec.reqd_stats()
print('XXXXXXXXXXXXXXX')
#spec.c... | for stat in calculate:
spec = spd.PintPars(gui.Data, '0238x6011044', 473., 623., 'magic', [stat])
spec.reqd_stats()
print('---------')
print(calculate) | identifier_body |
projects.component.spec.ts | import { Observable } from 'rxjs';
import { provide } from '@angular/core';
import {
describe, it, inject, beforeEachProviders, expect
} from '@angular/core/testing';
import { ProjectsService } from './projects.service.ts';
import { ProjectsComponent } from './projects.component.ts';
/**
* The test mock for a {{#c... |
/**
* The {{#crossLink "ProjectsComponent"}}{{/crossLink}} validator.
* This test validates that the projects are listed in sort order.
*
* @module projects
* @class ProjectsComponentSpec
*/
describe('The Projects component', function() {
it('should sort the projects', test((component, service) => {
// Th... | {
return inject(
[ProjectsComponent, ProjectsService],
(component: ProjectsComponent, service: ProjectsService) => {
body(component, service);
}
);
} | identifier_body |
projects.component.spec.ts | import { Observable } from 'rxjs';
import { provide } from '@angular/core';
import {
describe, it, inject, beforeEachProviders, expect
} from '@angular/core/testing';
import { ProjectsService } from './projects.service.ts';
import { ProjectsComponent } from './projects.component.ts';
/**
* The test mock for a {{#c... | }); | random_line_split | |
projects.component.spec.ts | import { Observable } from 'rxjs';
import { provide } from '@angular/core';
import {
describe, it, inject, beforeEachProviders, expect
} from '@angular/core/testing';
import { ProjectsService } from './projects.service.ts';
import { ProjectsComponent } from './projects.component.ts';
/**
* The test mock for a {{#c... | (project: string): Observable<Object[]> {
let values = [
{name: 'QIN_Test', description: 'Test'},
{name: 'QIN', description: 'Production'}
];
return Observable.of(values);
}
}
beforeEachProviders(() => {
return [
ProjectsComponent,
provide(ProjectsService, {useClass: ProjectsServic... | getProjects | identifier_name |
eventloop.js | // JavaScript 运行机制详解:再谈Event Loop
// http://www.ruanyifeng.com/blog/2014/10/event-loop.html
// 除了放置异步任务的事件,"任务队列"还可以放置定时事件,即指定某些代码在多少时间之后执行。
// 这叫做"定时器"(timer)功能,也就是定时执行的代码。
// 定时器功能主要由setTimeout()和setInterval()这两个函数来完成,
// 它们的内部运行机制完全一样,区别在于前者指定的代码是一次性执行,后者则为反复执行。
// 以下主要讨论setTimeout()。
// setTimeout()接受两个参数,第一个是回调... |
// 现在,再看setImmediate。
setImmediate(function A() {
console.log(1111);
setImmediate(function B(){console.log(2222);});
});
setTimeout(function timeout() {
console.log('setImmediate TIMEOUT FIRED');
}, 0);
// 上面代码中,setImmediate与setTimeout(fn,0)各自添加了一个回调函数A和timeout,都是在下一次Event Loop触发。
// 那么,哪个回调函数先执行呢?答案是不确定。
// 运行... | // 2
// TIMEOUT FIRED
// 上面代码中,由于process.nextTick方法指定的回调函数,总是在当前"执行栈"的尾部触发,
// 所以不仅函数A比setTimeout指定的回调函数timeout先执行,而且函数B也比timeout先执行。
// 这说明,如果有多个process.nextTick语句(不管它们是否嵌套),将全部在当前"执行栈"执行。 | random_line_split |
certificate.rs | //
// Copyright 2021 The Project Oak Authors
//
// 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 o... | <T>(
&mut self,
public_key: &PKeyRef<T>,
tee_certificate: Vec<u8>,
) -> anyhow::Result<&mut Self>
where
T: HasPublic,
{
let public_key_hash = get_sha256(&public_key.public_key_to_der()?);
let tee_report = Report::new(&public_key_hash);
let attestation_... | add_tee_extension | identifier_name |
certificate.rs | //
// Copyright 2021 The Project Oak Authors
//
// 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 o... |
fn set_version(&mut self, version: i32) -> anyhow::Result<&mut Self> {
self.builder.set_version(version)?;
Ok(self)
}
fn set_serial_number(&mut self, serial_number_size: i32) -> anyhow::Result<&mut Self> {
let serial_number = {
let mut serial = BigNum::new()?;
... | {
let builder = X509::builder()?;
Ok(Self { builder })
} | identifier_body |
certificate.rs | //
// Copyright 2021 The Project Oak Authors
//
// 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 o... |
let certificate = builder.build(key_pair)?;
Ok(certificate)
}
/// Generates an X.509 certificate based on the certificate signing `request`.
///
/// `add_tee_extension` indicates whether to add a custom extension containing a TEE report.
pub fn sign_certificate(
&self,
... | {
builder.add_tee_extension(key_pair, tee_certificate)?;
} | conditional_block |
certificate.rs | //
// Copyright 2021 The Project Oak Authors
//
// 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 o... | .build(&self.builder.x509v3_context(root_certificate, None))?;
self.builder.append_extension(subject_key_identifier)?;
Ok(self)
}
fn add_subject_alt_name_extension(&mut self) -> anyhow::Result<&mut Self> {
let subject_alt_name = SubjectAlternativeName::new()
.dns... | random_line_split | |
variables_3.js | var searchData=
[
['direction',['direction',['../structplatform.html#a886d551d5381dc3e53f17825ffc51641',1,'platform::direction()'],['../structprojectile.html#a886d551d5381dc3e53f17825ffc51641',1,'projectile::direction()']]],
['dirx',['dirX',['../struct_character.html#ab1761c91e3594dec827fe60e992d2e1a',1,'Character'... | ['doublejump',['doubleJump',['../struct_character.html#a917917ad1fee47a2101d4ece8dbd33e8',1,'Character']]]
]; | random_line_split | |
viewport.followedge.js | Crafty.viewport.followEdge = (function() {
var oldTarget, offx, offy, edx, edy
function change() |
function stopFollow() {
if (oldTarget) {
oldTarget.unbind('Move', change)
oldTarget.unbind('ViewportScale', change)
oldTarget.unbind('ViewportResize', change)
}
}
Crafty._preBind("StopCamera", stopFollow)
return function(target, offsetx, offsety, edgex, edgey) {
if (!target || !target.has('2D'))
... | {
var scale = Crafty.viewport._scale
// if (this.x > -Crafty.viewport.x + Crafty.viewport.width / 2 + edx - 10) {
Crafty.viewport.scroll('_x', -(this.x + (this.w / 2) - (Crafty.viewport.width / 2 / scale) - offx * scale) + edx)
Crafty.viewport.scroll('_y', -(this.y + (this.h / 2) - (Crafty.viewport.height / 2 /... | identifier_body |
viewport.followedge.js | Crafty.viewport.followEdge = (function() {
var oldTarget, offx, offy, edx, edy
function | () {
var scale = Crafty.viewport._scale
// if (this.x > -Crafty.viewport.x + Crafty.viewport.width / 2 + edx - 10) {
Crafty.viewport.scroll('_x', -(this.x + (this.w / 2) - (Crafty.viewport.width / 2 / scale) - offx * scale) + edx)
Crafty.viewport.scroll('_y', -(this.y + (this.h / 2) - (Crafty.viewport.height / ... | change | identifier_name |
viewport.followedge.js | Crafty.viewport.followEdge = (function() {
var oldTarget, offx, offy, edx, edy
function change() {
var scale = Crafty.viewport._scale
// if (this.x > -Crafty.viewport.x + Crafty.viewport.width / 2 + edx - 10) {
Crafty.viewport.scroll('_x', -(this.x + (this.w / 2) - (Crafty.viewport.width / 2 / scale) - offx * ... |
}
Crafty._preBind("StopCamera", stopFollow)
return function(target, offsetx, offsety, edgex, edgey) {
if (!target || !target.has('2D'))
return
Crafty.trigger("StopCamera")
oldTarget = target
offx = (typeof offsetx !== 'undefined') ? offsetx : 0
offy = (typeof offsety !== 'undefined') ? offsety : 0
... | {
oldTarget.unbind('Move', change)
oldTarget.unbind('ViewportScale', change)
oldTarget.unbind('ViewportResize', change)
} | conditional_block |
viewport.followedge.js | Crafty.viewport.followEdge = (function() {
var oldTarget, offx, offy, edx, edy
function change() {
var scale = Crafty.viewport._scale
// if (this.x > -Crafty.viewport.x + Crafty.viewport.width / 2 + edx - 10) {
Crafty.viewport.scroll('_x', -(this.x + (this.w / 2) - (Crafty.viewport.width / 2 / scale) - offx * ... | })() | } | random_line_split |
webpack.config.ts | import * as path from 'path';
import * as webpack from 'webpack';
import TerserPlugin from 'terser-webpack-plugin';
import * as pkg from '../package.json';
const debug = process.argv.indexOf('--mode=development') > 0;
const license = `opensource.org/licenses/${pkg.license}`;
const copyright = `(c) ${new Date().getFu... | libraryTarget: 'umd',
globalObject: 'this'
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
options: {
configFile: path.j... | random_line_split | |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# PROJETO LAVAGEM A SECO
#
# MAIN
#
# Felipe Bandeira da Silva
# 26 jul 15
#
import logging
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.options
import tornado.websocket
import tornado.httpserver
import os.path
from tornado.concurrent im... | # porta que o servidor irá usar
app.listen(options.port)
# carrega o servidor mas não inicia
main_loop = tornado.ioloop.IOLoop.instance()
# Aqui será a principal tarefa do lavagem, leitura e acionamento
tarefa_atualizacao_html_loop = tornado.ioloop.PeriodicCallback(tarefa_atualizacao_html,\
... | random_line_split | |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# PROJETO LAVAGEM A SECO
#
# MAIN
#
# Felipe Bandeira da Silva
# 26 jul 15
#
import logging
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.options
import tornado.websocket
import tornado.httpserver
import os.path
from tornado.concurrent im... | websocket: aviso: conexão finalizada/perdida'
clients.remove(self)
fecha_navegador()
inicia_navegador()
def envia_cmd_websocket(cmd, arg):
# Facilita o trabalho repetitivo de envia mensagem para todo os clientes
# Envia um comando e seu argumento para todos os clientes
for c in cl... | tornado: | identifier_name |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# PROJETO LAVAGEM A SECO
#
# MAIN
#
# Felipe Bandeira da Silva
# 26 jul 15
#
import logging
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.options
import tornado.websocket
import tornado.httpserver
import os.path
from tornado.concurrent im... | resultado = queue_direcao.get()
envia_cmd_websocket("d", str(resultado))
if not queue_distancia.empty():
resultado = queue_distancia.get()
envia_cmd_websocket("x", str(resultado)[:6])
def main():
print u"Iniciando o servidor Tornado"
fecha_navegador()
tarefa_controle = m... | envia_cmd_websocket("v", str(resultado))
if not queue_direcao.empty():
| conditional_block |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# PROJETO LAVAGEM A SECO
#
# MAIN
#
# Felipe Bandeira da Silva
# 26 jul 15
#
import logging
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.options
import tornado.websocket
import tornado.httpserver
import os.path
from tornado.concurrent im... | andler(tornado.websocket.WebSocketHandler):
# Todo cliente se encarrega de conectar-se ao servidor websocket.
# Quando existe uma nova conexão é salvo qual cliente foi.
def open(self):
print 'tornado: websocket: aviso: nova conexão de um cliente'
clients.append(self)
self.write_mess... | .html", title="LAVAGEM A SECO", \
ip_host=get_ip_address()+":"+str(options.port), \
msg_status="LIGADO")
class WebSocketH | identifier_body |
print_context.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use PageSetup; | use std::mem;
glib_wrapper! {
pub struct PrintContext(Object<ffi::GtkPrintContext, PrintContextClass>);
match fn {
get_type => || ffi::gtk_print_context_get_type(),
}
}
impl PrintContext {
pub fn create_pango_context(&self) -> Option<pango::Context> {
unsafe {
from_glib_fu... | use cairo;
use ffi;
use glib::translate::*;
use pango;
use std::fmt; | random_line_split |
print_context.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use PageSetup;
use cairo;
use ffi;
use glib::translate::*;
use pango;
use std::fmt;
use std::mem;
glib_wrapper! {
pub struct PrintContext(Object<ffi::GtkPrintContext, PrintConte... |
pub fn get_dpi_y(&self) -> f64 {
unsafe {
ffi::gtk_print_context_get_dpi_y(self.to_glib_none().0)
}
}
pub fn get_hard_margins(&self) -> Option<(f64, f64, f64, f64)> {
unsafe {
let mut top = mem::uninitialized();
let mut bottom = mem::uninitializ... | {
unsafe {
ffi::gtk_print_context_get_dpi_x(self.to_glib_none().0)
}
} | identifier_body |
print_context.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use PageSetup;
use cairo;
use ffi;
use glib::translate::*;
use pango;
use std::fmt;
use std::mem;
glib_wrapper! {
pub struct PrintContext(Object<ffi::GtkPrintContext, PrintConte... | (&self) -> Option<pango::FontMap> {
unsafe {
from_glib_none(ffi::gtk_print_context_get_pango_fontmap(self.to_glib_none().0))
}
}
pub fn get_width(&self) -> f64 {
unsafe {
ffi::gtk_print_context_get_width(self.to_glib_none().0)
}
}
pub fn set_cair... | get_pango_fontmap | identifier_name |
print_context.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use PageSetup;
use cairo;
use ffi;
use glib::translate::*;
use pango;
use std::fmt;
use std::mem;
glib_wrapper! {
pub struct PrintContext(Object<ffi::GtkPrintContext, PrintConte... | else { None }
}
}
pub fn get_height(&self) -> f64 {
unsafe {
ffi::gtk_print_context_get_height(self.to_glib_none().0)
}
}
pub fn get_page_setup(&self) -> Option<PageSetup> {
unsafe {
from_glib_none(ffi::gtk_print_context_get_page_setup(self.to_g... | { Some((top, bottom, left, right)) } | conditional_block |
trie.rs | /* Copyright 2017 Joel Pedraza
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaime... | {
node_type: NodeType,
children: [Node; boggle_util::ALPHABET_SIZE],
child_set: BitSet32,
}
impl Trie {
pub fn new() -> Self {
Trie {
node_type: NodeType::Prefix,
children: Default::default(),
child_set: BitSet32::new(),
}
}
pub fn node_type(&s... | Trie | identifier_name |
trie.rs | /* Copyright 2017 Joel Pedraza
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaime... | trie: &'a Trie,
iter: IndexIter32<'a>,
}
impl<'a> TrieIterator<'a> {
fn new(trie: &'a Trie) -> TrieIterator<'a> {
TrieIterator {
trie: trie,
iter: trie.child_set.iter_ones(),
}
}
}
impl<'a> Iterator for TrieIterator<'a> {
type Item = (&'a Trie, u8);
fn ... |
pub struct TrieIterator<'a> { | random_line_split |
trie.rs | /* Copyright 2017 Joel Pedraza
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaime... |
} else {
None
}
}
pub fn iter(&self) -> TrieIterator {
TrieIterator::new(self)
}
}
pub struct TrieIterator<'a> {
trie: &'a Trie,
iter: IndexIter32<'a>,
}
impl<'a> TrieIterator<'a> {
fn new(trie: &'a Trie) -> TrieIterator<'a> {
TrieIterator {
... | {
let rest = &s[1..];
child.cns(rest)
} | conditional_block |
_hasnolatorlon.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... | (self,db,place):
if place.get_latitude().strip and place.get_longitude().strip():
return False
return True
| apply | identifier_name |
_hasnolatorlon.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... |
return True
| return False | conditional_block |
_hasnolatorlon.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... | if place.get_latitude().strip and place.get_longitude().strip():
return False
return True | identifier_body | |
_hasnolatorlon.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... | # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# gen.filters.rules/Place/_HasNoLatOrLon.py
#-------------------------------------------------------------... | # GNU General Public License for more details.
# | random_line_split |
sort.py | #!/usr/bin/env python
import sys, argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', type=str, action='store', dest='input', default=None, help="Input file")
args = parser.parse_args()
stats = dict()
if args.input is None:
print "Error: No input fi... | if __name__ == "__main__":
main() | random_line_split | |
sort.py | #!/usr/bin/env python
import sys, argparse
def | ():
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', type=str, action='store', dest='input', default=None, help="Input file")
args = parser.parse_args()
stats = dict()
if args.input is None:
print "Error: No input file"
with open(args.input) as in_file:
for... | main | identifier_name |
sort.py | #!/usr/bin/env python
import sys, argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', type=str, action='store', dest='input', default=None, help="Input file")
args = parser.parse_args()
stats = dict()
if args.input is None:
|
with open(args.input) as in_file:
for line in in_file.readlines():
time = int(line.split()[0])
tx_bytes = int(line.split()[1])
stats[time] = tx_bytes
stats = sorted(stats.items())
start_time = stats[0][0]
prev_tx = stats[0][1]
no_traffic_flag = True
f... | print "Error: No input file" | conditional_block |
sort.py | #!/usr/bin/env python
import sys, argparse
def main():
|
if __name__ == "__main__":
main()
| parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', type=str, action='store', dest='input', default=None, help="Input file")
args = parser.parse_args()
stats = dict()
if args.input is None:
print "Error: No input file"
with open(args.input) as in_file:
for line in... | identifier_body |
menu.js | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file | * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language govern... | * to you 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
* | random_line_split |
visitors.js | import * as virtualTypes from "./path/lib/virtual-types";
import * as messages from "babel-messages";
import * as t from "babel-types";
import clone from "lodash/clone";
/**
* explode() will take a visitor object with all of the various shorthands
* that we support, and validates & normalizes it into a common format... |
export function merge(visitors: Array, states: Array = []) {
let rootVisitor = {};
for (let i = 0; i < visitors.length; i++) {
let visitor = visitors[i];
let state = states[i];
explode(visitor);
for (let type in visitor) {
let visitorType = visitor[type];
// if we have state then o... | {
let fns = [].concat(val);
for (let fn of fns) {
if (typeof fn !== "function") {
throw new TypeError(`Non-function found defined in ${path} with type ${typeof fn}`);
}
}
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.