code stringlengths 1 199k |
|---|
import logging
from datetime import datetime
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import requests
from companies.models import Company
logger = logging.getLogger('jobs.management.commands')
class Command(BaseCommand):
help = 'Update currently listed comp... |
"""Implementation of compile_html based on nbconvert."""
from __future__ import unicode_literals, print_function
import io
import os
import sys
try:
import IPython
from IPython.nbconvert.exporters import HTMLExporter
if IPython.version_info[0] >= 3: # API changed with 3.0.0
from IPython import n... |
SUCCESS = 0
FAILURE = 1 # NOTE: click.abort() uses this
ALREADY_RUNNING = 2 |
"""Support for Waterfurnaces."""
from datetime import timedelta
import logging
import threading
import time
import voluptuous as vol
from waterfurnace.waterfurnace import WaterFurnace, WFCredentialError, WFException
from homeassistant.components import persistent_notification
from homeassistant.const import (
CONF_... |
LONG_HORN = 750
LONG_HORN_SPACE = LONG_HORN/2
SHORT_HORN = 400
SHORT_HORN_SPACE = SHORT_HORN/2
sequences = {
'CreekFleet': {
# Three long horns immediately (three minutes to start)
0: 'LLL',
# Two long horns a minute later (two minutes to start)
60000: 'LL',
# One short, thre... |
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from ...utils import update_sentry_404s
class Command(BaseCommand):
def handle(self, *args, **kwargs):
update_sentry_404s() |
import ReviewHelper
import pandas as pd
df = ReviewHelper.get_pandas_data_frame_created_from_bibtex_file()
df[df.metaDatasetsUsed.isnull()]
list1 = df.metaDatasetsUsed.str.split(",").tolist()
df1 = pd.DataFrame(list1)
for i in range(df1.columns.size):
df1[i] = df1[i].str.strip()
stacked = df1.stack()
stacked_value_... |
import abjad
from abjad.tools import abctools
class TimespanSpecifier(abctools.AbjadValueObject):
### CLASS VARIABLES ###
__slots__ = (
'_forbid_fusing',
'_forbid_splitting',
'_minimum_duration',
)
### INITIALIZER ###
def __init__(
self,
forbid_fusing=None... |
import re
from collections import defaultdict, Counter
from ttlser import natsort
from pyontutils.core import LabelsBase, Collector, Source, resSource, ParcOnt
from pyontutils.core import makePrefixes
from pyontutils.config import auth
from pyontutils.namespaces import nsExact
from pyontutils.namespaces import NIFRID, ... |
class WallsGate(object):
def dfs(self, rooms):
queue = [(i, j, 0) for i, rows in enumerate(rooms) for j, v in enumerate(rows) if not v]
while queue:
i, j, step = queue.pop()
if rooms[i][j] > step:
rooms[i][j] = step
for newi, newj in ((i + 1, j), (... |
import logging
from django.db.models import DateTimeField, Model, Manager
from django.db.models.query import QuerySet
from django.db.models.fields.related import \
OneToOneField, ManyToManyField, ManyToManyRel
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
from django.... |
from twisted.internet.protocol import Factory
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor
class NonAnonChat(LineReceiver):
def __init__(self, protocols):
self.users = {'john':'john', 'adastra':'adastra'}
self.userName = None
self.userLogged = False
self.protocols = pro... |
import os
from ..sampleParser import SampleParser
class TestSampleParser:
def setup(self):
self.folderName = os.path.join('.', 'tests', 'Export')
self.parser = SampleParser(self.folderName)
def test_getDirectoryFiles(self):
files = self._obtainDirectory()
assert len(files) > 0
... |
"""
IMPORTANT NOTE!
To use this module on Mac OS X, you need the PyObjC module installed.
For Python 3, run:
sudo pip3 install pyobjc-core
sudo pip3 install pyobjc
For Python 2, run:
sudo pip install pyobjc-core
sudo pip install pyobjc
(There's some bug with their installer, so install pyobjc-core first... |
'''
watdo.tests
~~~~~~~~~~~
This module contains tests for watdo.
This particular file contains tools for testing.
:copyright: (c) 2013 Markus Unterwaditzer
:license: MIT, see LICENSE for more details.
''' |
from django.conf.urls import include, url
from ginger.views import utils
__all__ = ('include', 'url', 'scan', 'scan_to_include')
def scan(module, predicate=None):
view_classes = utils.find_views(module, predicate=predicate)
urls = []
for view in view_classes:
if hasattr(view, 'as_urls'):
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('agency', '0013_auto_20150726_0001'),
]
operations = [
migrations.AlterField(
model_name='feedinfo',
name='feed_publisher_name',
... |
'''
Problem 2
@author: Kevin Ji
'''
def sum_even_fibonacci( max_value ):
# Initial two elements
prev_term = 1
cur_term = 2
temp_sum = 2
while cur_term < max_value:
next_term = prev_term + cur_term
prev_term = cur_term
cur_term = next_term
if cur_term % 2 == 0:
... |
import urllib
import ast
import xchat
__module_name__ = "Define"
__module_author__ = "TingPing"
__module_version__ = "2"
__module_description__ = "Show word definitions"
def define(word, word_eol, userdata):
if len(word) >= 2:
_word = xchat.strip(word[1])
_number = 1
if len(word) >= 3:
_number = int(xchat.str... |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline i... |
from __future__ import absolute_import, print_function
import os
import json
import unittest
import six
import gruvi
from gruvi import jsonrpc
from gruvi.jsonrpc import JsonRpcError, JsonRpcVersion
from gruvi.jsonrpc import JsonRpcProtocol, JsonRpcClient, JsonRpcServer
from gruvi.jsonrpc_ffi import ffi as _ffi, lib as ... |
'''
Simple pull of account info
'''
import requests
import datetime
import pickle
import json
import time
import sys
account_url = 'https://api.toodledo.com/3/account/get.php?access_token='
tasks_get_url = 'https://api.toodledo.com/3/tasks/get.php?access_token='
'''
Fields you can use to filter when you get tasks:
http... |
import sys
def genfib():
first, second = 0, 1
while True:
yield first
first, second = second, first + second
def fib(number):
fibs = genfib()
for i in xrange(number + 1):
retval = fibs.next()
return retval
if __name__ == '__main__':
inputfile = sys.argv[1]
with open(i... |
import time
import logging
def time_zone(t):
if t.tm_isdst == 1 and time.daylight == 1:
tz_sec = time.altzone
tz_name = time.tzname[1]
else:
tz_sec = time.timezone
tz_name = time.tzname[0]
if tz_sec > 0:
tz_sign = '-'
else:
tz_sign = '+'
tz_offset = '%... |
from os import walk
from os.path import abspath, normpath
from os.path import join as pj
from setuptools import setup, find_packages
short_descr = "Set of data structures used in openalea such as : graph, grid, topomesh"
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '... |
"""
amtrak
Parse a trip itinerary of amtrak services copied into a text file.
Running the file will take a trip.txt file and output a .json with one record
for each amtrak service in the trip. You can also use the main method of the
module. Both cases, the first parameter would be the input and the second one
would be ... |
import bisect
def is_palindrome(n):
return str(n) == str(n)[::-1]
def generate_palindromes():
return [i * j
for i in range(100, 1000)
for j in range(100, 1000)
if is_palindrome(i * j)]
def find_lt(a, x):
'Find rightmost value less than x'
i = bisect.bisect_left(a, x)
... |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pip... |
import simtk.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_bond_type import AbstractBondType
class HarmonicPotentialBondType(AbstractBondType):
__slots__ = ['length', 'k', 'order', 'c']
@accepts_compatible_units(None, None,
len... |
import unittest
from circleci.error import CircleCIException, BadKeyError, BadVerbError, InvalidFilterError
class TestCircleCIError(unittest.TestCase):
def setUp(self):
self.base = CircleCIException('fake')
self.key = BadKeyError('fake')
self.verb = BadVerbError('fake')
self.filter =... |
from .commutative import Commutative
class Product(Commutative):
def __init__(self, *args):
super(Product, self).__init__(*self.simplified(*args))
def simplified(self, *args):
"""
Returns a sequence containing expressions that make a simplified Product.
Used when ``Product`` is i... |
from datetime import datetime
from flask import Flask
from flask import render_template
from views.todos import todos_view
app = Flask(__name__)
app.register_blueprint(todos_view, url_prefix='/todos')
@app.route('/')
def index():
return render_template('index.html')
@app.route('/time')
def time():
return str(da... |
"""
:created: 2017-09
:author: Alex BROSSARD <abrossard@artfx.fr>
"""
from PySide2 import QtWidgets, QtCore
from pymel import core as pmc
from auri.auri_lib import AuriScriptView, AuriScriptController, AuriScriptModel, grpbox
from auri.scripts.Maya_Scripts import rig_lib
from auri.scripts.Maya_Scripts.rig_lib import Ri... |
x = int(raw_input("What is 'x'?\n"))
y = int(raw_input("What is y?\n"))
print "Using that information, we can do some mathematical equations."
if x > y: #is not None:
print "x, %d, is greater than y, %d." % (x, y)
elif x == y: #is not None:
print "x, %d, is equal to y, %d." % (x, y)
elif x < y: #is not None:
... |
from pyparsing import *
TOP = Forward()
BOTTOM = Forward()
HAND = Forward()
GRAVEYARD = Forward()
LIBRARY = Forward()
BATTLEFIELD = Forward() |
import numpy as n, matplotlib.pyplot as p, scipy.special
import cosmolopy.perturbation as pb
import cosmolopy.density as cd
from scipy.integrate import quad,tplquad
import itertools
from scipy.interpolate import interp1d
from scipy.interpolate import RectBivariateSpline as RBS
import optparse, sys
from sigmas import si... |
import uuid
from operator import attrgetter
from flask import flash, jsonify, redirect, request, session
from sqlalchemy.orm import undefer
from werkzeug.exceptions import BadRequest, Forbidden, NotFound
from indico.core.cache import make_scoped_cache
from indico.core.config import config
from indico.core.db import db
... |
try:
import json
except ImportError:
import simplejson as json
from . import TestCase
from server import ListHostsHandler
class TestListHostsHandler(TestCase):
def setUp(self):
"""
Create an instance each time for testing.
"""
self.instance = ListHostsHandler()
def test_c... |
basedir = '/data/t3serv014/snarayan/deep/v_deepgen_4_akt_small/'
figsdir = '/home/snarayan/public_html/figs/deepgen/v4_akt/' |
import praw
import time
import datetime
import sqlite3
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
USERAGENT = ""
SUBREDDIT = ""
MAXPOSTS = 30
WAIT = 20
DELAY = 518400
'''All done!'''
WAITS = str(WAIT)
sql = sqlite3.connect('sql.db')
print('Loaded SQL Database')
cur = sql.cursor()... |
'''
Pulse characterization
Created Fri May 12 2017
@author: cpkmanchee
'''
import numpy as np
import os.path
import inspect
from beamtools.constants import h,c,pi
from beamtools.common import normalize, gaussian, sech2, alias_dict
from beamtools.import_data_file import import_data_file as _import
from beamtools.import_... |
def prime_sieve(upper):
marked = [False] * (upper-2)
def next_prime():
for i,v in enumerate(marked):
if not v:
yield i+2
next_prime_gen = next_prime()
for p in next_prime_gen:
for n in xrange(2*p - 2, len(marked), p):
marked[n] = True
yield p
def main():
print(sum(prime_sieve(2000000)))
if __name__... |
import functools
from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline impo... |
import numpy
import sys
from env import gidgetConfigVars
import tsvIO
NA_VALUE = -999999
def cleanUpName(aName):
bName = ''
aName = aName.upper()
## ii = aName.find(" - Homo sapiens (human)")
ii = aName.find(" - HOMO SAPIENS (HUMAN)")
if (ii >= 0):
aName = aName[:ii]
aName = aName.strip(... |
from PETScMatOps import * |
from . import claim, util
from .attr_dict import AttrDict
class Statement(AttrDict):
@classmethod
def from_json(cls, statement_doc):
return normalize(statement_doc)
def normalize(statement_doc):
statement_doc = util.ensure_decoded_json(statement_doc)
references = {}
for item in statement_doc... |
from sqlalchemy import Column, ForeignKey, Integer, String, Text, DateTime, Table
from sqlalchemy.orm import relationship, backref
from models import DecBase
from models.document import Document
from models.keyword import Keyword
from jsonschema import *
from json_schemas import *
from models.collection_version import ... |
from tornado import gen
from tornado.httpclient import AsyncHTTPClient, HTTPError, HTTPRequest
from tornado.options import options
from functools import wraps
from tornado import escape
import tornado.ioloop
import base64
import time
import datetime
import json
from math import exp
AsyncHTTPClient.configure("tornado.cu... |
"""
papatcher.py: simple python PA patcher
Copyright (c) 2014 Pyrus <pyrus@coffee-break.at>
See the file LICENSE for copying permission.
"""
from argparse import ArgumentParser
from concurrent import futures
from contextlib import contextmanager
from getpass import getpass
from gzip import decompress
from hashlib impor... |
"""
Module for testing the Blacklist model
"""
import unittest
from app.models.shopping import BlacklistToken, ShoppingList
try:
from .common_functions import BaseModelTestClass
except (ImportError, SystemError):
from common_functions import BaseModelTestClass
class BlacklistModelTest(BaseModelTestClass):
"... |
class InvalidLineException(Exception):
pass |
from pypov.pov import Texture, Pigment, Intersection, Cylinder
from pypov.pov import Union, Difference, Object, Box, Sphere
from pypov.common import grey, white
from pypov.colors import Colors
from lib.base import five_by_ten_edge
from lib.textures import cross_hatch, cross_hatch_2, wall_texture_1
from lib.metadata imp... |
import os
import sys
import getpass
import requests
import ConfigParser
BASE_DIR = os.path.dirname(__file__)
class Auth:
"""GitHub API Auth"""
def __init__(self):
self.auth_url = 'https://api.github.com'
auth_conf = os.path.join(BASE_DIR, 'auth.conf')
if os.path.exists(auth_conf):
... |
"""
DotStar_Emulator
config.py in current working directory will be automatically read and loaded.
Author: Christopher Ross
License: MIT Something Rather
"""
from DotStar_Emulator.manage import manage
if __name__ == "__main__":
manage() |
import datetime
class AuthenticationInfo:
def __init__(self, password, email):
self.Password = password
self.Email = email
class ProfileInfo:
def __init__(self, display_name):
self.DisplayName = display_name
class Token:
def __init__(self, id_token, valid_until):
self.Id = id... |
"""
Django settings for MapaAsentamientosTecho project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
i... |
import os
import codecs
try:
from setuptools import (setup, find_packages)
except ImportError:
from distutils.core import (setup, find_packages)
VERSION = (0, 2, 0)
__version__ = '.'.join(map(str, VERSION[:3])) + "".join(VERSION[3:])
__package_name__ = 'pelican-readtime'
__description__ = 'Plugin for Pelican th... |
from shutit_module import ShutItModule
class test16(ShutItModule):
def build(self, shutit):
shutit.login()
shutit.login(command='bash')
shutit.send('ls',note='We are listing files')
shutit.logout()
shutit.logout()
return True
def module():
return test16(
'shutit.test16.test16.test16', 210790650.00293876... |
from Gaudi.Configuration import *
from GaudiConf import IOHelper
IOHelper('ROOT').inputFiles(['LFN:/lhcb/MC/2012/ALLSTREAMS.DST/00030282/0000/00030282_00000001_1.allstreams.dst',
'LFN:/lhcb/MC/2012/ALLSTREAMS.DST/00030282/0000/00030282_00000002_1.allstreams.dst',
'LFN:/lhcb/MC/2012/ALLSTREAMS.DST/00030282/0000/00030282... |
import os
import dbCalls
summary_file = 'app/assets/images/summary.png'
overall_file = 'app/assets/images/overall.png'
def main():
dbCalls.remove_all()
# remove both summary and overall picture
try:
os.remove(summary_file)
os.remove(overall_file)
except OSError:
pass
if __name__ ... |
def f(k, n):
pass
assert f(1, 2) == 2
assert f(2, 6) == 3
assert f(3, 14) == 14 |
import os
import time
from abc import abstractmethod, ABC
from typing import Dict, Tuple, List
from cereal import car
from common.kalman.simple_kalman import KF1D
from common.realtime import DT_CTRL
from selfdrive.car import gen_empty_fingerprint
from selfdrive.config import Conversions as CV
from selfdrive.controls.li... |
from _external import *
fontconfig = LibWithHeaderChecker('fontconfig', 'fontconfig/fontconfig.h', 'c') |
import base64
import logging
import os
from pathlib import Path
from typing import List
import tensorflow as tf
from adapters.tensorflow.imagenet.node_lookup import NodeLookup
from sn_agent.job.job_descriptor import JobDescriptor
from sn_agent.ontology import Service
from sn_agent.service_adapter import ServiceManager,... |
""" The aomi "seed" loop """
from __future__ import print_function
import os
import difflib
import logging
from shutil import rmtree
import tempfile
from termcolor import colored
import yaml
from future.utils import iteritems # pylint: disable=E0401
from aomi.helpers import dict_unicodeize
from aomi.filez import thaw
... |
import numpy
from wiki_scraper import (
parse_html_simple,
crawl_page)
import pickle
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
import os.path
from parallel_webscrape import scrape_wikipedia
PATH = 'wikimodel/'
class WikiModel():
def __init__(se... |
"""Generates HTML for HTML5 banner ads."""
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import logging
import os
import re
import shlex
import shutil
import time
from subprocess import PIPE, Popen
import pkg_resources
import six
import six.moves.configparser as configparser
f... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('invoice', '0007_profile_invoice_logo'),
]
operations = [
migrations.AddField(
model_name='invoiceitem',
name='quantity',
... |
import socket, struct
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 9123))
try:
while True:
line = raw_input( ">" )
parts = line.split()
if parts[0] == "SET":
if parts[1] == "A":
value = int( parts[2] )
s.send( struct.pack( "<BBBBB", 0, value, 0, 0, 0 ) )
if parts[1]... |
import numpy as np
from Vertex import Vertex
class Polygon:
def __init__(self, newVertexList, newTexelList):
# Create list to store all vertex
self.Vertex = []
for i in newVertexList:
self.Vertex.append(i)
# Create list to store all texel value
self.Texel = []
... |
import re
import json
import urlparse
from holster.enum import Enum
from unidecode import unidecode
from disco.types.base import cached_property
from disco.types.channel import ChannelType
from disco.util.sanitize import S
from disco.api.http import APIException
from rowboat.redis import rdb
from rowboat.util.stats imp... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='UserAddress',
fields=[
... |
import numpy
import six
from chainer.dataset import dataset_mixin
class SubDataset(dataset_mixin.DatasetMixin):
"""Subset of a base dataset.
SubDataset defines a subset of a given base dataset. The subset is defined
as an interval of indexes, optionally with a given permutation.
If ``order`` is given, t... |
import json
import logging
import webapp2
from datetime import datetime
from google.appengine.ext import ndb
from controllers.api.api_base_controller import ApiBaseController
from database.event_query import EventListQuery
from helpers.award_helper import AwardHelper
from helpers.district_helper import DistrictHelper
f... |
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.conf import settings
from django.db import models
from django.core.urlresolvers import reverse
from django.db.models.signals import pre_save
from django.utils import timezone
from django.utils.text import s... |
import re
import os.path
import datetime
import base64
import aql
info = aql.get_aql_info()
HEADER = """#!/usr/bin/env python
""".format(year=datetime.date.today().year,
name=info.name, url=info.url)
AQL_DATE = '_AQL_VERSION_INFO.date = "{date}"'.format(
date=datetime.date.today().isoformat())
MAIN = """... |
from birdseye.server import main
if __name__ == '__main__':
main() |
from ..GenericInstrument import GenericInstrument
from .helper import SignalGenerator, amplitudelimiter
class Wiltron360SS69(GenericInstrument, SignalGenerator):
"""Wiltron 360SS69 10e6, 40e9.
.. figure:: images/SignalGenerator/Wiltron360SS69.jpg
"""
def __init__(self, instrument):
"""."""
... |
default_app_config = 'journeys.apps.JourneyConfig' |
import lassie
from .base import LassieBaseTestCase
class LassieOpenGraphTestCase(LassieBaseTestCase):
def test_open_graph_all_properties(self):
url = 'http://lassie.it/open_graph/all_properties.html'
data = lassie.fetch(url)
self.assertEqual(data['url'], url)
self.assertEqual(data['t... |
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
README = readme_file.read()
with open('HISTORY.rst') as history_file:
HISTORY = history_file.read()
REQUIREMENTS = [
'gitpython',
'requests',
'tqdm',
'requests_cache',
]
TEST_REQUIREMENTS = [
'pytest',
'm... |
from django.db import models
from .bleachfield import BleachField
class BleachCharField(BleachField, models.CharField):
def pre_save(self, model_instance, add):
new_value = getattr(model_instance, self.attname)
clean_value = self.clean_text(new_value)
setattr(model_instance, self.attname, cl... |
import astropy.cosmology as co
aa=co.Planck15
import astropy.io.fits as fits
import matplotlib
import matplotlib
matplotlib.rcParams['agg.path.chunksize'] = 2000000
matplotlib.rcParams.update({'font.size': 12})
matplotlib.use('Agg')
import matplotlib.pyplot as p
import numpy as n
import os
import sys
z_min = float(sys.... |
import html5lib
import traceback
def build_html_dom_from_str(html_str):
return html5lib.parse(html_str, 'dom')
def find_html_element_list_for_tag(element, tag, class_style = None):
elements = element.getElementsByTagName(tag)
if not class_style: return elements
result = []
for e in elements:
... |
from __future__ import unicode_literals
"""
Name: MyArgparse
Author: Andy Liu
Email : andy.liu.ud@hotmail.com
Created: 3/26/2015
Copyright: All rights reserved.
Licence: This program is free software: you can redistribute it
and/or modify it under the terms of the GNU Ge... |
import pytest
from cfme.containers.provider import ContainersProvider
from utils import testgen, version
from cfme.web_ui import toolbar as tb
from utils.appliance.implementations.ui import navigate_to
pytestmark = [
pytest.mark.uncollectif(
lambda: version.current_version() < "5.6"),
pytest.mark.usefix... |
"""
================================================
ABElectronics IO Pi Tests | test get_bus_pullups function
Requires python smbus to be installed
For Python 2 install with: sudo apt-get install python-smbus
For Python 3 install with: sudo apt-get install python3-smbus
run with: python3 get_bus_pullups.py
===========... |
"""Sliplink"""
class Sliplink(object):
"""Sliplink is a link between two nodes in the slipnet.
Attributes:
from_node: The node this link starts at.
to_node: The node this link ends at.
label: The node that labels this link.
fixed_length: A static length of the link has no label."... |
from shutil import copy
from os import remove
import sys
from I_Data_Degradation_Block.Code.Degradation import main as blockI
from II_Cryptography_Block.Code.encrypt import main as blockII
from III_Shamirs_Block.Code.SecretSharing import main as blockIII
from IV_DHT_Block.Code.Parted_Keys_to_OWI_Input import main a... |
import os
import time
import shutil
import signal
import subprocess
from lib.util.mysqlBaseTestCase import mysqlBaseTestCase
from lib.util.mysql_methods import execute_cmd
server_requirements = [[]]
servers = []
server_manager = None
test_executor = None
pamcfg = '/etc/pam.d/mysqld'
class basicTest(mysqlBaseTestCase):
... |
import sys
from fsgamesys.plugins.pluginmanager import PluginManager
"""
DOSBox-FS launcher script used for testing.
"""
def app_main():
executable = PluginManager.instance().find_executable("dosbox-fs")
process = executable.popen(sys.argv[1:])
process.wait() |
"""waybacktrack.py
Use this to extract Way Back Machine's
url-archives of any given domain!
TODO: reiterate entire design!
"""
import time
import os
import urllib2
import random
from math import ceil
try:
from cStringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO
from lxml import html
... |
"""
vUSBf: A KVM/QEMU based USB-fuzzing framework.
Copyright (C) 2015 Sergej Schumilo, OpenSource Security Ralf Spenneberg
This file is part of vUSBf.
See the file LICENSE for copying permission.
"""
__author__ = 'Sergej Schumilo'
from scapy.all import *
class XLEShortField(LEShortField, XShortField):
... |
def f2():
def f3():
print("f3")
f3()
f2() |
import pygame, sys, random, math
from pygame.locals import *
import organisms
import globalVars
class Graphics:
def __init__(self):
self.screen = pygame.display.set_mode((1080, 820))
pygame.display.set_caption('Ecosystem Simulator')
class GUI:
def __init__(self):
self.sliderX = 150
... |
import subprocess
short_name = 'Opt 3'
disp_name = 'Option 3 Submenu'
otype = 'Routine'
need = ['need 1: ', 'need 2: ', 'need 3: ']
answers = []
def run():
global answers
while True:
subprocess.call('clear')
i = 0
while i < len(need):
ans = input(need[i])
if validate(ans):
answers.append(ans)
i +=... |
"""
Django settings for cbs project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '51f... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Role',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, ... |
from .TransmitFeatures import TransmitFeatures
from .GetFeatures import GetFeatures |
"""
Created on Mon Apr 21 10:34:18 2014
@author: eegroopm
"""
import os, sys
import pandas as pd
import numpy as np
class common:
def __init__(self):
self.path = os.path.expanduser('~')
#\u0305 is unicode overline character
#self._overline_strings = [u'1\u0305', u'2\u0305' ,u'3\u0305', u'4\u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.