code stringlengths 1 199k |
|---|
"""This module defines the data structures used to represent a grammar.
These are a bit arcane because they are derived from the data
structures used by Python's 'pgen' parser generator.
There's also a table here mapping operators to their names in the
token module; the Python tokenize module reports all operators as t... |
from _external import *
from avutil import *
from z import *
from x264 import *
from lame import *
from bz2 import *
from xvid import *
avcodec = LibWithHeaderChecker(
'avcodec',
'libavcodec/avcodec.h',
'c',
dependencies=[
avutil,
z,
x264,
# xavs,
lame,
bz2,
xvid]
) |
import os
import scipy.stats
from add_exp import add_exp
import sys
from random import shuffle
import numpy
from calc_HW_deviations import hwe
def myMean(myList):
if(len(myList)) == 0:
return('NA')
else:
return(sum(myList)/len(myList))
if len(sys.argv) < 5:
print('python eQTL_kw_hets.py [exp file] [date] [ht/per... |
import inspect
from checks import is_collection
from itertools import islice
def recursive_iter(enumerables):
'''
Walks nested list-like elements as though they were sequentially available
recursive_iter([[1,2], 3])
# => 1, 2, 3
'''
if not is_collection(enumerables) or isinstance(enumerables, (b... |
from django_assets import Bundle, register
js = Bundle(
'js/vendor/jquery.scrollto.js',
'js/home.js',
output='gen/home.%(version)s.js')
css = Bundle(
'css/home.css',
output='gen/home.%(version)s.css')
register('js_home', js)
register('css_home', css) |
from collections import namedtuple
import ui
import csv
fields = ('year', 'month', 'day', 'high_price')
data_record = namedtuple('data_record', fields)
_csv_filename = 'myoutputv4.csv'
'''
A Solution put fwd by @ccc. This is a very flexible and works correctly in
py2.7 and 3.6
Note: Only making minimal use of the name... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('User', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='rol',
),
] |
def parse_octal():
pass |
from __future__ import unicode_literals
from django.apps import AppConfig
class TaskTrackerConfig(AppConfig):
name = 'task_tracker' |
import htmlgenerator.generator as htmlgen
def run():
page = htmlgen.HtmlGenerator()
page.h1("Hello, world!")
page.p("This HTML page was generated by the Python HTMLGenerator class.")
page.write("helloworld.html")
if __name__ == "__main__":
run() |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import OrderedDict
from collections import namedtuple
import gdb
import pwndbg.color.memory as M
import pwndbg.events
import pwndbg.typeinfo
from pwndbg.c... |
from django import forms
from django.forms import ModelForm
from .models import User
class registerUserForm(ModelForm):
username = forms.CharField(label="Username", max_length=100, required=True,
widget=forms.TextInput(attrs={'placeholder': 'Username'}),)
email = forms.EmailField(... |
import roomai.games.common
from roomai.games.texasholdem.TexasHoldemUtil import AllPokerCardsDict
from roomai.games.texasholdem.TexasHoldemUtil import PokerCard
class TexasHoldemActionChance(roomai.games.common.AbstractActionChance):
'''
The TexasHoldemActionChance is the action used by the chance action\n
... |
from django_bolts.views.resource import Resource
from django_bolts.views.decorators import view
from django_bolts.forms import get_all_forms
from django.shortcuts import redirect
from django.http import Http404
class DevResource(Resource):
url_prefix = 'lab'
template_prefix = 'lab'
abstract = False
def ... |
from __future__ import absolute_import, unicode_literals
import pytest
import mock
from statemachine import Transition, State, exceptions, StateMachine
def test_transition_representation(campaign_machine):
s = repr([t for t in campaign_machine.transitions if t.identifier == 'produce'][0])
print(s)
assert s ... |
"""
Created on Thu Sep 15 16:40:12 2016
@author: mark
This file contains methods for calculating kinetics values that don't
necessarily require cantera or another outside less known software package.
all rates are currently only in kcal/mol (except arrhenius)
"""
import numpy as np
def calculate_arr_rate(a,n,ea,T):
... |
import unittest
import breakable
class TestLog(unittest.TestCase):
def test_log_print(self):
breakable.log._print('plain')
def test_log_print_prefix(self):
breakable.log._print('plain', prefix='==>')
def test_log_print_color(self):
breakable.log._print('plain', color=breakable.log.re... |
from setuptools import setup
import re
import ast
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('jikji/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name = 'jikji',
packages = ['jikji'],
version = version,
description = 'P... |
num_list = [1,2,3,2,12,3,1,3,21,2,2,3,4111,22,3333,444,111,4,5,777,65555,45,33,45]
max2 = max1 = num_list[0]
"""
if n > max2:
if n > max1:
xxxxx
elif n < max1:
xxxxx
else:
do nothing
"""
for n in num_list:
if n > max2:
if n > max1:
max2 = max1
max1 = n
... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'monitoring.tests.south_settings')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
from wagtail.wagtailsearch import index
tag_search_field = index.RelatedFields('tags', [
index.SearchField('name'),
]) |
"""ANSII Color formatting for output in terminal."""
from __future__ import print_function
import os
__ALL__ = ['colored', 'cprint']
VERSION = (1, 1, 0)
ATTRIBUTES = dict(
list(
zip(
[
'bold',
'dark',
'',
'underline',
... |
import Tkinter
import ttk
root = Tkinter.Tk()
style = ttk.Style()
style.map("C.TButton",
foreground=[('pressed', 'red'), ('active', 'blue')],
background=[('pressed', '!disabled', 'black'), ('active', 'white')]
)
colored_btn = ttk.Button(text="Test", style="C.TButton").pack()
root.mainloop(... |
SYSTEM_ATTRIBUTES = ['info']
ASSOCIATION_ATTRIBUTES = ['info'] |
from setuptools import setup
setup(
name='war',
version='1.0',
entry_points={
'console_scripts': [
'war = war:main'
]
},
test_suite='war.test',
packages=['war'],
license=open('LICENSE').readline(),
long_description=open('README.mdown').read(),
) |
import os
root_path = "/"
node_id="cli6"
server_list = "127.0.0.1:4180,127.0.0.1:4181,127.0.0.1:4182"
server_list = "192.168.86.242:7771,192.168.86.242:7772,192.168.86.242:7773"
server_list = "192.168.86.242:2181,192.168.86.242:2182,192.168.86.242:2183"
zknode_type_ephemeral = 1
zknode_type_sequence = 2
write_try_limit... |
from __future__ import unicode_literals
import core.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0007_auto_20170129_2041'),
]
operations = [
migrations.AlterField(
model_name='sponsoredevent',
name... |
from math import *
fzn = float(input('Введите начальное значение переменной: '))
fzk = float(input('Введите конечное значение переменной: '))
fh = float(input('Введите шаг, с которым проверяем значения \
суммы: '))
v = 0
zn=int(fzn//fh)
zk=int(fzk//fh)
AMax = zn
Summ = 0
for z in range(zn,zk):
s = z*fh
A = ((((... |
import lxml
import lxml.sax
from xml.sax.handler import ContentHandler
NS = 'http://www.w3.org/1999/xhtml'
NSMAP = {'h': 'http://www.w3.org/1999/xhtml',
#'a': 'http://www.w3.org/2005/Atom',
'geo': 'http://www.w3.org/2003/01/geo/wgs84_pos#',
'aero':'urn:uuid:1469bf5a-50a9-4c9b-813c-af19f9d6824... |
import math
class Tile:
MAX_ZOOM = 16;
MIN_ZOOM = 1;
@classmethod
def tile_id_from_lat_long(cls, latitude, longitude, zoom):
row = Tile.row_from_latitude(latitude, zoom)
column = Tile.column_from_longitude(longitude, zoom)
return Tile.tile_id_from_row_column(row, column, zoom)
... |
from django.conf.urls import url
from apps.article.dashboard import views
urlpatterns = [
url(r'^$', views.article_index, name='dashboard_article_index'),
url(r'^new/$', views.article_create, name='dashboard_article_create'),
url(r'^(?P<article_id>\d+)/$', views.article_detail, name='dashboard_article_detai... |
"""
know that some blocks will never get exited successfully, and modify the CFG accordingly
"""
def w():
def t():
return True
if t():
x = 0
else:
raise Exception()
print x
for i in xrange(5):
y = i
if t():
break
else:
assert 0
prin... |
from __future__ import unicode_literals
from django.forms import ModelForm,forms
from django import forms
from django.db import models
from datetime import date
import os
class File(models.Model):
file = models.FileField(upload_to='cloud/uploads/%Y%m%d')
date = models.DateField(auto_now_add=False, default=date.... |
from dltb.base.busy import BusyObservable
from base import Controller as BaseController, View as BaseView
class Training(BusyObservable, method='training_changed',
changes={'training_changed', 'epoch_changed',
'batch_changed', 'metric_changed',
'optimizer_c... |
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'rmoq'
copyright = u'2015, Rol... |
from __future__ import unicode_literals
from jinja2 import contextfilter
from pprint import pformat
from cgi import escape as html_escape
def html_format(variable):
data = pformat(variable, indent=4)
data = html_escape(data)
data = data.replace(' ', ' ')
data = data.replace('\n... |
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import base64
import binascii
import ctypes
import ctypes.util
import hashlib
import optparse
import os
import re
import struct
import time
import slow_ed25519
import slownacl_curve25519
import ed25519_exts_ref... |
import pygame as pg
from .scene import Scene
class StatsScene(Scene):
"""docstring for StatsScene"""
def __init__(self):
super(StatsScene, self).__init__()
myfont = pg.font.SysFont('Arial', 30)
self.textsurface = myfont.render('Some Text', False, (0, 0, 0))
def update(self, dt):
... |
from __future__ import unicode_literals
from django import forms
from django.forms.widgets import CheckboxSelectMultiple
from ..forms.choices import FREQUENCY_CHOICES
from ..forms.choices import WEEKDAY_CHOICES
from ..forms.fields import RecurrenceField
class RecurrenceFormMixin(forms.Form):
freq = forms.ChoiceFiel... |
import unittest
import os
import subprocess
import sys
import meshcat
import meshcat.geometry as g
class TestPortScan(unittest.TestCase):
"""
Test that the ZMQ server can correctly handle its default ports
already being in use.
"""
def setUp(self):
# the blocking_vis will take up the default... |
import gi, signal, path # Importados GI, el handler de GTK para python3
gi.require_version('Gtk', '3.0') # GI necesita que definan la versión de GTK base. Uso la GTK 3.0
from gi.repository import Gtk, Gdk # Ahora que definimos GI, importamos GTK y Gdk
from prefs import PrefsWindow
from readPrefs import *
class VidaliaE... |
from itertools import chain
from operator import attrgetter
import numpy as np
from sklearn.exceptions import FitFailedWarning
from sklearn.linear_model.base import LinearModel
def dominates(a, b):
return all(ai <= bi for ai, bi in zip(a, b)) and not a == b
def _get_fit(m, attrs):
if attrs:
get_fit = at... |
CLIENT_ID = u'YOUR_CLIENT_ID'
CLIENT_SECRET = u'YOUR_CLIENT_SECRET'
ACCESS_TOKEN = u'EXAMPLE_USER_ACCESS_TOKEN'
REDIRECT_URI = u'http://fondu.com/oauth/authorize' |
def copy_file( in_fn, out_fn ):
try:
dirname = os.path.dirname( out_fn )
if not os.path.exists( dirname ):
_ = os.makedirs( dirname )
except:
pass
return shutil.copy( in_fn, out_fn )
def run( x ):
return copy_file( *x )
if __name__ == '__main__':
import os, glob, shutil
import multiprocessing as mp
base... |
from __future__ import unicode_literals
import autoslug.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0005_auto_20160510_1331'),
]
operations = [
migrations.CreateModel(
name='Tag',
fields=[
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import textwrap
import types
import py
import six
import pytest
from _pytest.main import EXIT_NOTESTSCOLLECTED
from _pytest.main import EXIT_USAGEERROR
from _pytest.warnings import SHOW_PYTE... |
from bitarray import bitarray
import numpy as np
from rig.type_casts import NumpyFixToFloatConverter
from .region import Region
from nengo_spinnaker.utils.type_casts import fix_to_np
class RecordingRegion(Region):
def __init__(self, n_steps):
self.n_steps = n_steps
def sizeof(self, vertex_slice):
... |
"""
HPPB Dataset Loader.
"""
import os
import logging
import deepchem
import numpy as np
logger = logging.getLogger(__name__)
HPPB_URL = "http://deepchem.io.s3-website-us-west-1.amazonaws.com/datasets/hppb.csv"
DEFAULT_DATA_DIR = deepchem.utils.get_data_dir()
def remove_missing_entries(dataset):
"""Remove missing ent... |
"""
Command-line argument processing functions
"""
from optparse import OptionParser
def make_parser(doc="", usage=None, add_options=True):
"""Make a parser object.
:param doc:
:param usage:
:param add_options: default True whether to add -v and -t options by default
:return: None
"""
if not... |
import paho.mqtt.publish as publish
import paho.mqtt.client as mqtt
import logging
import json
class HiverizeMQTTLogger:
def __init__(self, mqtt_server, mqtt_topic):
self.mqtt_server = mqtt_server
self.mqtt_topic = mqtt_topic
self.backend = mqtt.Client(clean_session=True)
self.backen... |
__revision__ = "test/TEX/variant_dir_style_dup0.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
"""
Test creation of a fully-featured TeX document (with bibliography
and index) in a variant_dir.
Also test that the target can be named differently than what
Latex produces by default.
Also test that style fil... |
def build(basefile, outfile, rs, vs, rm, e):
currentdir = os.getcwd()
tmpfile = "apricot.tmp.{}".format(e)
b = "{}/{}".format(currentdir, basefile)
t = "{}/{}".format(currentdir, tmpfile)
shutil.copy(b, t)
# outputファイルを生成
fl = open(outfile, 'w')
# メイン処理
f = open(tmpfile, 'r')
cod... |
__author__ = 'Aleksandar Savkov'
import re
import warnings
import requests
from bs4 import BeautifulSoup
from os import makedirs
def get_next_cat_page(soup, affix_type):
atags = soup.findAll(name='a',
attrs={'title': 'Category:English %ses' % affix_type})
urls = [x['href'] for x in atag... |
import numpy as np
from itertools import product
from math import isclose
from scipy.optimize import fsolve
from multiprocessing import Pool
import pylim.LIM as LIM
import pylim.Stats as ST
import data_utils as dutils
class LIMState(object):
"""
Create a state usable for LIM calibration
Parameters
-----... |
from sys import exit
from os import environ, system
environ['KERAS_BACKEND'] = 'tensorflow'
environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
environ["CUDA_VISIBLE_DEVICES"] = ""
import numpy as np
from subtlenet import config, utils
import akt_config
from subtlenet.backend import obj
from subtlenet.generators.gen import mak... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0023_auto_20170302_1634'),
]
operations = [
migrations.CreateModel(
name='Hardness',
fields=[
('id', ... |
import platform
import requests
from ansible.module_utils.basic import AnsibleModule
def get_system_ca_bundle():
dist_name = platform.linux_distribution()[0].lower()
if any(supported in dist_name for supported in ('centos', 'red hat', 'fedora')):
return '/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem... |
class JEXLAnalyzer(object):
def __init__(self, jexl_config):
self.config = jexl_config
def visit(self, expression):
method = getattr(self, 'visit_' + type(expression).__name__, self.generic_visit)
return method(expression)
def generic_visit(self, expression):
raise NotImpleme... |
from collections import defaultdict
import GeminiQuery
from GeminiQuery import select_formatter
from gemini_region import add_region_to_query
from gemini_subjects import (get_subjects, get_subjects_in_family,
get_family_dict)
import time
def all_samples_predicate(args):
""" returns a pr... |
import argparse
import multiprocessing
import sys
import matplotlib
matplotlib.use('agg')
import numpy as np
import h5py
import matplotlib.pyplot as plt
import matplotlib.animation as anim
import freestream
class RepeatingFreeStreamer:
def __init__(self, initial, grid_max, nframes, dt):
self.initial = initi... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'SummaryAttribute.full_description'
db.delete_column('h1ds_summary_summaryattribute', 'full_description')
# De... |
import numpy as np
from numpy.fft import fftn, ifftn, fftshift
from numpy import real
from itertools import product, repeat
from blocks import spanning_blocks
from sets import Set
def container_indicator_cube(array_shape):
"""Helper function for defining a cube container
"""
return np.ones(array_shape).asty... |
"""sysdescrparser.juniper_junos."""
import re
from juniper import Juniper
class JuniperJunos(Juniper):
"""Class JuniperJunos.
SNMP sysDescr for JuniperJUNOS.
"""
def __init__(self, raw):
"""Constructor."""
super(JuniperJunos, self).__init__(raw)
self.os = 'JUNOS'
self.mod... |
from __future__ import print_function
import codecs
import glob
import os
import re
import shutil
import subprocess
import sys
import tempfile
import uuid
from xml.dom import minidom
from metakernel import MetaKernel, ProcessMetaKernel, REPLWrapper, u
from metakernel.pexpect import which
from . import __version__
STDIN... |
import os
import base64
from os import makedirs
from configparser import ConfigParser
from waitlist.data import version
from typing import Any, Tuple, List
def set_if_not_exists(self, section, option, value):
if not self.has_option(section, option):
self.set(section, option, value)
ConfigParser.set_if_not_e... |
import _plotly_utils.basevalidators
class BordercolorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="bordercolorsrc", parent_name="scattergl.hoverlabel", **kwargs
):
super(BordercolorsrcValidator, self).__init__(
plotly_name=plotly_name,
... |
import sys
import numpy as np
from scipy.linalg import sqrtm
from scipy import stats
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import ssm
mpl.rcParams['figure.figsize'] = (16,10)
SILENT_OUTPUT = bool(sys.argv[1] if len(sys.argv)>1 else 0)
if SILENT_OUTPUT:
run_name = '_'+sys.argv[... |
from io import BytesIO
from tds.base import StreamSerializer
class ColumnInfoStream(StreamSerializer):
TOKEN_TYPE = 0xA5
def unmarshal(self, buf):
"""
:param BytesIO buf:
:rtype: bool
""" |
import os
def run():
print "Chips Demo keyboard example"
print "1. Connect to Serial Port at 115200 baud using terminal emulator (e.g. hyperterm, cutecom ...)"
print "2. Connect keyboard to development card"
print "3. Hit reset button"
os.system("sudo cutecom") |
'''
iOS Gyroscope
---------------------
'''
from plyer.facades import Gyroscope
from jnius import autoclass
Hardware = autoclass('org.renpy.Ios.Hardware')
class IosGyroscope(Gyroscope):
def __init__(self):
super(IosGyroscope, self).__init__()
self.bridge = autoclass('bridge').alloc().init()
... |
"""Temporary files and filenames."""
import os
__all__ = ["mktemp", "TemporaryFile", "tempdir", "gettempprefix"]
tempdir = None
template = None
def gettempdir():
"""Function to calculate the directory to use."""
global tempdir
if tempdir is not None:
return tempdir
try:
pwd = os.getcwd()... |
def fancy_dendrogram(*args, **kwargs):
'''
Source: https://joernhees.de/blog/2015/08/26/scipy-hierarchical-clustering-and-dendrogram-tutorial/
'''
from scipy.cluster import hierarchy
import matplotlib.pylab as plt
max_d = kwargs.pop('max_d', None)
if max_d and 'color_threshold' not in kwargs... |
HOST = "localhost"
USER = "database_user"
PASSWD = "database_password"
DB = "database"
SUGARDIR = "/var/www/sugarcrm/upload" |
import datetime
from necrobot.match.match import Match
from necrobot.match.matchinfo import MatchInfo
from necrobot.match import matchutil
from necrobot.user import userlib
async def get_match(
r1_name: str,
r2_name: str,
time: datetime.datetime or None,
cawmentator_name: str or None
) -... |
import logging
import re
from flask import current_app
from flask_sqlalchemy import SQLAlchemy
from flask_captcha.models import db, CaptchaStore, CaptchaSequence
VERSION = (0, 1, 8.1)
class Captcha(object):
ext_db = None
def __init__(self, app=None):
self.app = app
if app:
self.init_... |
'''
I was in the middle of implementing string-based binary long division,
then just tried it in the console. Feels like cheating, but the problem is
easy with the right tools, I guess.
'''
print sum(int(s) for s in "{}".format(2**1000)) |
from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from . import models
class ClientAdmin(admin.ModelAdmin):
pass
class InvoiceItemInline(admin.TabularInline):
model = models.InvoiceItem
class InvoiceCommentInline(admin.TabularInline):
model = models.InvoiceComment
class InvoiceAd... |
from xml.dom import minidom
from datetime import datetime
from braintree.util.datetime_parser import parse_datetime
import re
import sys
binary_type = bytes
class Parser(object):
def __init__(self, xml):
if isinstance(xml, binary_type):
xml = xml.decode('utf-8')
self.doc = minidom.parseS... |
import uuid
from .item import Slot
from .types import \
mc_vec3f, mc_float, mc_ubyte, \
mc_sshort, mc_bool, mc_int, \
mc_long, mc_double, mc_string, \
mc_comp, mc_field, mc_list_field, \
mc_uuid_field, mc_list_item_field, \
mc_split_pos_field
__author__ = 'thomas'
def _running_id():
i = 0
... |
import superimport
import distrax
import jax
import jax.numpy as jnp
class MixtureSameFamily(distrax.MixtureSameFamily):
def _per_mixture_component_log_prob(self, value):
'''Per mixture component log probability.
https://github.com/tensorflow/probability/blob/main/tensorflow_probability/python/distr... |
if __name__ == "__main__":
import argparse
import os
import numpy as np
# rom subprocess import PIPE
# OMP_NUM_THREADS=1 THEANO_FLAGS=mode=FAST_RUN
parser = argparse.ArgumentParser()
parser.add_argument('--command-line', dest="command_line", type=str)
parser.add_argument("--n-cpu", dest=... |
'''
Created on Jan 11, 2016
@author: Martin Koerner <info@mkoerner.de>
'''
from SPARQLWrapper import SPARQLWrapper, JSON
from SPARQLWrapper.SPARQLExceptions import QueryBadFormed
from urlparse import urlparse
import json
import argparse
from wikiwhere.utils import dbpedia_mapping, majority_voting
import urllib2
import ... |
import objc
from Foundation import *
from AppKit import NSColor, NSRectFill, NSCompositeSourceAtop
from ScreenSaver import ScreenSaverView
from PastelsPreferencesWindow import *
from brush3 import BouncingBrush
class PastelsView(ScreenSaverView):
def initWithFrame_isPreview_(self, frame, isPreview):
self = ... |
import os
from distutils.core import setup
packages = []
for root, dirs, files in os.walk("memento_damage"):
if '__init__.py' in files:
packages.append(root)
packages.reverse()
packages_non_package_dirs = {}
for root, dirs, files in os.walk("memento_damage"):
for package in packages:
if root == ... |
import os
import glob
import scipy.io as io
import numpy as np
import sklearn
import socket
import sklearn.svm
import sys
import matplotlib.pyplot as plt
import pylab
import mpl_toolkits.axes_grid1
project_root = os.path.expanduser('~/TimePrediction/src/public/')
AMOS_root = os.path.join(project_root, 'data', 'AMOS')
V... |
from werkzeug.datastructures import FileStorage
import time
import datetime
from flask_restful import fields, marshal_with, reqparse, Resource
import hashlib
import json
import os
import random
class SendSoundFile(Resource):
def __init__(self, db_session=None):
self.reqparse = reqparse.RequestParser()
... |
execfile('ttnmapper.py') |
"""
Component that automatically arms the selected track.
"""
from itertools import ifilter
from _Framework.SubjectSlot import subject_slot, subject_slot_group
from _Framework.CompoundComponent import CompoundComponent
from _Framework.ModesComponent import LatchingBehaviour
from _Framework.Util import forward_property,... |
from minstrel.version import __version__ |
from __future__ import unicode_literals
import copy
import requests
import webbrowser
from .exceptions import ResponseProcessException
class TapiocaInstantiator(object):
def __init__(self, adapter_class):
self.adapter_class = adapter_class
def __call__(self, *args, **kwargs):
return TapiocaClien... |
"""
Various utilities, mostly generic.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from six import text_type
import errno, io, os.path, re, sys
__all__ = ('die warn reraise_context squish_spaces mkdir_p').split()
def die(fmt, *args):
if not len(args):
raise SystemE... |
from .regional import (one, many)
__version__ = '1.1.2' |
from dokus.classes import TSFunction, TSClass
from dokus.util import warn, verify_identifier
def document_function(declare, filename=None):
header = None
args = [{'name': v, 'type': ''} for v in declare['args']]
function = TSFunction(declare['name'], args)
function.code = declare['code']
function.line = declare['l... |
from typing import TYPE_CHECKING, Iterable, List, Sequence
import logging
from ezdxf.lldxf.const import DXFStructureError, DXF12
from .table import (
Table,
ViewportTable,
TextstyleTable,
LayerTable,
LinetypeTable,
AppIDTable,
ViewTable,
BlockRecordTable,
DimStyleTable,
UCSTable,... |
""" create-databases
Create all databases for the bill taxonomy project if they do not already
exist.
Author: Joel Piper <joelmpiper [at] gmail.com>
Created: Saturday, September 19, 2016
"""
import sys
from src.ingest.setup_database import make_database
def main(*argv):
print(make_database())
if __name__ == '... |
from decimal import Decimal, getcontext
from fractions import Fraction
getcontext().prec = 60
def get_den(x):
fr = Fraction.from_decimal(Decimal(x).sqrt())
return fr.limit_denominator(1000000000000).denominator
print(sum(get_den(i) for i in range(2, 100001) if int(i ** 0.5) ** 2 != i)) |
import contextlib
import io
import json
import os
import sys
import textwrap
from peru.async_helpers import raises_gathered
import peru.cache
import peru.compat
import peru.error
import peru.main
from peru.parser import DEFAULT_PERU_FILE_NAME
import peru.rule
import peru.scope
import shared
from shared import run_peru_... |
import xml.sax
def trace(msg):
print(msg)
def error(msg):
print("ERROR:" + msg)
class TagParser:
def parse(self, inFileName):
#trace("parse:" + inFileName)
class EventHandler(xml.sax.ContentHandler):
def __init__(self, parent):
self.parent = parent
self.databuffer = None
def fl... |
class Greeter(object):
def __init__(self, message):
"""Creates a new :class:`Greeter` instance.
:param message: a suitable greeting message
:type message: str
"""
self.message = message
def speak(self):
"""Prints the message back to the user.
"""
p... |
__all__ = ['user', 'location', 'academic']
from .user import User
from .location import City, Country
from .academic import School, University
from .stats import Service |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.