src stringlengths 721 1.04M |
|---|
# Copyright 2016 The Sensible Code Company
#
# 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 t... |
def scriptinfo():
'''
Returns a dictionary with information about the running top level Python
script:
---------------------------------------------------------------------------
dir: directory containing script or compiled executable
name: name of script or executable
source: name of s... |
# coding: utf-8
from __future__ import unicode_literals
import unittest
from axon import *
class ElementTestCase(unittest.TestCase):
def setUp(self):
pass
#
def test_empty_element(self):
v = element('aaa', {}, [])
self.assertEqual(v.name, 'aaa')
self.assertEqual(v.mapping,... |
#########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... |
""" Module for IPython event loop integration.
Two things are handled by this module .
1) Creating the QApplication instance (or getting the singleton if it already
exists). Also no difference between IPython and the regular Python.
2) Starting the event loop.
If IPython is not running, qApp.exec_() is ca... |
"""A functions module, includes all the standard functions.
Combinatorial - factorial, fibonacci, harmonic, bernoulli...
Elementary - hyperbolic, trigonometric, exponential, floor and ceiling, sqrt...
Special - gamma, zeta,spherical harmonics...
"""
from sympy.functions.combinatorial.factorials import (factorial, fac... |
# Copyright (c) Citrix Systems Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of condition... |
from setuptools import setup, find_packages
with open("README") as f:
long_description = f.read()
version = '1.18.0'
setup(name='twitter',
version=version,
description="An API and command-line toolset for Twitter (twitter.com)",
long_description=long_description,
long_description_content_... |
import logging
import serial
import math
import time
logger = logging.getLogger(__name__)
class CoherentDds:
ser = None;
lsbAmp = 1.0 / 16383 # 0x3fff is maximum amplitude
lsbPhase = 360.0 / 65536 # Degrees per LSB.
def __init__(self, addr, clockFreq, baudrate=115200, internal_clock=False,
... |
"""Postcode API module."""
import json
import requests
class EndpointsMixin(object):
"""EndpointsMixin - API endpoints for the API class.
each endpoint of the API has a representative method in EndpointsMixin
Parameters that apply to the API url just need to be passed
as a keyword argument.
"""
... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from inspect import isclass
from pybrain.utilities import Named
from pybrain.rl.environments.twoplayergames import GomokuGame
from pybrain.rl.environments.twoplayergames.gomokuplayers import RandomGomokuPlayer, ModuleDecidingPlayer
from pybrain.rl.environments.twoplayergames.g... |
# -*- coding: utf-8 -*-
# Copyright 2005 Eduardo Gonzalez
#
# 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 your option) any later version.
from quodli... |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - data_dir migration main script (new style)
You can use this script to migrate your wiki's data_dir to the format
expected by the current MoinMoin code. It will read data/meta to determine
what needs to be done and call other migration scripts as needed.
... |
"""
Django settings for in100gram 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/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... |
#
# Copyright (c) SAS Institute, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import hashlib
for _algo in hashlib.algorithms:
def _closure():
hash = hashlib.__dict__[_algo]
def file(p):
h = hash()
fd = open(p)
while True:
s = fd.read(4096)
if not s: break
h.update(s)
fd.close()
... |
"File-based cache backend"
import os
import time
import shutil
try:
import cPickle as pickle
except ImportError:
import pickle
from django.core.cache.backends.base import BaseCache
from django.utils.hashcompat import md5_constructor
class CacheClass(BaseCache):
def __init__(self, dir, params):
Ba... |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 your option) any la... |
# Generated by Django 2.1.7 on 2019-03-23 01:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('data_log', '0004_riftdungeonlog_clear_time'),
]
operations = [
migrations.RemoveField(
model_na... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple AES cipher implementation in pure Python following PEP-272 API
Based on: https://bitbucket.org/intgr/pyaes/ to compatible with PEP-8.
The goal of this module is to be as fast as reasonable in Python while still
being Pythonic and readable/understandable. It is ... |
import mock
import pytest
from dicebox.dice import Add, Best, Die, DiceFactory, Modifier, Pool, Sort, Worst
class TestDiceFactory(object):
@pytest.fixture
def sides(self):
return 20
def test_call(self, sides):
assert type(DiceFactory()(sides)) == Die
def test_bias(self, sides):
... |
"""LightDock simulation using the multiprocessing library for parallelization"""
import os
import importlib
import glob
from lightdock.util.logger import LoggingManager
from lightdock.util.parser import CommandLineParser
from lightdock.prep.simulation import get_setup_from_file, create_simulation_info_file, read_inpu... |
import os
import itertools
import threading
import subprocess
from ply import lex, yacc
from nltk.corpus import wordnet
from collections import namedtuple, deque
from ppp_datamodel import Resource, Triple, Missing
from .config import Config
class ParserException(Exception):
pass
FORMS_ETRE = frozenset(filter(bo... |
# Copyright 2017 DataCentred Ltd
#
# 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 ag... |
import datetime
import json
import os
import re
from unittest.mock import Mock
import pytest
from anchore_engine.common.models.policy_engine import ImageVulnerabilitiesReport
from anchore_engine.db import Image
from anchore_engine.db.entities.policy_engine import (
DistroMapping,
FeedGroupMetadata,
FeedMe... |
#! /usr/bin/env python
import sys
from zplot import *
bartypes = [('hline', 1, 1),
('vline', 1, 1),
('hvline', 1, 1),
('dline1', 1, 2),
('dline2', 1, 2),
('dline12', 0.5, 2),
('circle', 1, 2),
('square', 1, 1),
('triang... |
def to_arr(this):
"""Returns Python array from Js array"""
return [this.get(str(e)) for e in xrange(len(this))]
ARR_STACK = set({})
class ArrayPrototype:
def toString():
# this function is wrong but I will leave it here fore debugging purposes.
func = this.get('join')
if not func.... |
#!/usr/bin/env python
import logging
import traceback
import pykka
import mopidy
import sys
import re #todo: remove
import threading
from time import sleep
from mopidy import core
from .Adafruit_player import AdafruitPlayer
logger = logging.getLogger(__name__)
class AdafruitLCD(pykka.ThreadingActor, core.CoreListene... |
"""
To solve this problem we have used the software
The Full Whiskas Model example in the package PuLP for python.
I have no clue about linear optimization... so this package has been intinitely
helpful. The code do not require much explanation and there is no much time
remaining in the contest... so I wont comment a... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2016 Eugene Frolov <eugene@frolov.net.ru>
#
# 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
#
# ... |
# Copyright 2020 Google LLC.
#
# 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, ... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'VERSION')) as f:
__version__ = f.read().strip()
with open(os.path.join(here, 'requirements.txt')) as f:
required = f.read().splitlines()
with open(os.path.join(here, 'README.... |
# inigo.image
# Handles data dealing with images, particularly EXIF for JPEG
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Sun Jun 14 22:32:17 2015 -0400
#
# Copyright (C) 2015 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: image.py [] benjamin@bengfort.com $
"""
Handles data dea... |
from bungiesearch.aliases import SearchAlias
from core.models import Article, NoUpdatedField
class SearchTitle(SearchAlias):
def alias_for(self, title):
return self.search_instance.query('match', title=title)
class Meta:
models = (Article,)
alias_name = 'title_search'
class Title(Se... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2008 Jerome Rapinat
# Copyright (C) 2008 Benny Malengier
#
# 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 Fre... |
from datetime import datetime
from typing import List
from scitwi.places.location import Location
from scitwi.utils.strs import list_obj_string, obj_string
class Trend(object):
def __init__(self, trend_dict: dict, as_of: datetime, created_at: datetime, locations: List[Location]):
self.as_of = as_of
... |
import datetime
import logging
import re
import socket
import subprocess
import os
from django.conf import settings
from . import exceptions as dakku_exception
logger = logging.getLogger(__name__)
class BackupBase(object):
def deletefile(self, date_str):
"""Given a date in YYYYMMDD check if the file s... |
'''
Importing pandasTools enables several features that allow for using RDKit molecules as columns of a Pandas dataframe.
If the dataframe is containing a molecule format in a column (e.g. smiles), like in this example:
>>> from rdkit.Chem import PandasTools
>>> import pandas as pd
>>> import os
>>> from rdkit import R... |
import abjad
import collections
from abjad.tools import abctools
from abjad.tools import mathtools
from abjad.tools import schemetools
from abjad.tools import scoretools
from abjad.tools import selectiontools
class GraceHandler(abctools.AbjadValueObject):
r'''A grace maker.
::
>>> grace_handler = co... |
from contextlib import contextmanager
from django.contrib.auth.models import User
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.test import LiveServerTestCase
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.expected_c... |
from keras import models
import numpy
from steps.training.tensor2d import training_array
from keras.callbacks import Callback
from util import data_validation, file_structure, logger, callbacks, file_util, misc, progressbar, constants,\
process_pool
from steps.evaluation.shared import enrichment, roc_curve
from st... |
# Copright 2008 Divmod, Inc. See LICENSE file for details.
# -*- test-case-name: axiom.test.test_dependency -*-
"""
A dependency management system for items.
"""
import sys, itertools
from zope.interface.advice import addClassAdvisor
from epsilon.structlike import record
from axiom.item import Item
from axiom.attr... |
# choco/runtime.py
# Copyright (C) 2006-2016 the Choco authors and contributors <see AUTHORS file>
#
# This module is part of Choco and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""provides runtime services for templates, including Context,
Namespace, and various helper fu... |
"""
Other modules expect that all extraction functions' names start with
'extract_'.
"""
import re
import string
import logging
from collections import OrderedDict
import helper
LOGGER = logging.getLogger(__name__)
SIZE_PREFIXES = {x:1024**y for y, x in enumerate(" KMGTP")}
# source: https://www.khronos.org/regist... |
"""This script contains set of functions that test parallel optimization with
skopt, where constant liar parallelization strategy is used.
"""
from numpy.testing import assert_equal
from numpy.testing import assert_raises
from skopt.space import Real
from skopt import Optimizer
from skopt.benchmarks import branin
im... |
from django.test import TestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from post.models import Zone, Duree, Domaine, TypeContrat, Annonce
from .forms import SearchForm
class SearchForms(TestCase):
def setUp(self):
zone = Zone.objects.create(nom='île-de-fr... |
# Copyright 2019 - Nokia
#
# 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, sof... |
__author__ = "Martin Blais <blais@furius.ca>"
import unittest
import textwrap
from beancount import loader
from beancount.parser import cmptest
from beancount.plugins import book_conversions
from beancount.utils import test_utils
class TestBookConversions(cmptest.TestCase):
@loader.load_doc()
def test_book... |
# Copyright (c) 2011 OpenStack Foundation.
# 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... |
# 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 the... |
whspchars = "\t\n "
nonwhite = bytearray(set(range(0x00, 0x100)) - {9, 10, 32})
"""http://compsoc.dur.ac.uk/whitespace/tutorial.html
Whitespace tutorial
The only lexical tokens in the whitespace language are Space (ASCII 32), Tab (ASCII 9) and Line Feed (ASCII 10).
By only allowing line feed as a token, CR/LF problems... |
import ocl
import camvtk
import time
import vtk
import datetime
import math
def drawLoops(myscreen, loops, loopcolor):
nloop = 0
for lop in loops:
n = 0
N = len(lop)
first_point=ocl.Point(-1,-1,5)
previous=ocl.Point(-1,-1,5)
for p in lop:
if n==0: # don't dra... |
# Copyright 2004-2015 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutTuples(Koan):
def test_creating_a_tuple(self):
count_of_three = (1, 2, 5)
self.assertEqual(5, count_of_three[2])
def test_tuples_are_immutable_so_item_assignment_is_not_possible(self):
count_of_three =... |
from docassemble.base.util import DAGoogleAPI, DAFile
import apiclient
api = DAGoogleAPI()
__all__ = ['get_folder_names', 'get_files_in_folder', 'write_file_to_folder', 'download_file']
def get_folder_names():
service = api.drive_service()
items = list()
while True:
response = service.files().lis... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
import logging
import pytest
logger = logging.getLogger(__name__)
sublogger = logging.getLogger(__name__ + ".baz")
def test_fixture_help(testdir):
result = testdir.runpytest("--fixtures")
result.stdout.fnmatch_lines(["*caplog*"])
def test_change_level(caplog):
caplog.set_level(logging.INFO)
logger... |
"""
Bhairav Mehta - Alexa Hack the Dorm Competition
Decemeber 2016 / January 2017
Alexa Abstractions based off a library developed by Anjishu Kumar
"""
from ask import alexa
import quizlet
import json
from random import randint
###### HANDLERS ######
# Lambda Handler function
def lambda_handler(request_obj, contex... |
#!/usr/bin/env python3
# Version 1.0
# Author Alexis Blanchet-Cohen
# Date: 15/06/2014
import argparse
import glob
import os
import subprocess
import util
# Read the command line arguments.
parser = argparse.ArgumentParser(description='Generate scripts to convert bedgraph files from one-based start to zero-based sta... |
class Solution(object):
def deduceRemain(self, segment_tree, n):
for l in segment_tree:
if n < len(l):
l[n] -= 1
n >>= 1
def countRemainFirstN(self, segment_tree, n):
ans = 0
for l in segment_tree:
if n == 0:
break
... |
# -*- coding: utf-8 -*-
import csv
import os
import re
import pandas as pd
import requests
from bs4 import BeautifulSoup
def get_all_newspapers_to_country_dict(v2=True):
"""Get the country associated to each newspapers url in a dict following the format: {'Clean URL' : 'Country name'}
This fu... |
#!/usr/bin/python
import csv
import numpy as np
from sklearn import svm
from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
# 0: PassengerId, 1: Survived, 2: Pclass, 3: Name, 4: Sex (male,female), 5: Age, 6: SibSp, 7: ParCh, 8: Ticket, 9: Fare, 10: Cabin, 11: Embarked (S,C,Q)
# 1,0,3,"... |
import sys
import os
import csv
import urllib.request
from etl import ETL
# import each row of CSV file to index
# write CSV cols to database columns or facets
class enhance_csv(object):
def __init__(self, verbose=False):
self.verbose = verbose
self.config = {}
self.titles = False
... |
import six
from werkzeug.datastructures import MultiDict
from collections import OrderedDict
from wtforms.form import Form
from wtforms_alchemy import ModelForm
def serializer_factory(base=Form):
class BaseSerializer(base):
def __init__(self, data_dict=None, model_instance=None, **kwargs):
... |
import functools
from hercules.loop_interface import IteratorWrapperBase
class KeyClobberError(KeyError):
pass
class NoClobberDict(dict):
'''An otherwise ordinary dict that complains if you
try to overwrite any existing keys.
'''
KeyClobberError = KeyClobberError
def __setitem__(self, key, ... |
# -*- coding:utf-8 -*_
import ConfigParser
import os
class INIFILE:
"""
a class which can process *.ini file
with read and write function.
"""
def __init__(self, fileName):
self.fileName = fileName
self.initflag = False
self.cfg = None
self.readhandle = None
... |
import re
import os
import json
import requests
from contextlib import contextmanager
from pykafka import KafkaClient
client = KafkaClient(hosts='freedom.sugarlabs.org:9092')
topic = client.topics['org.sugarlabs.hook']
producer = topic.get_producer()
ACTIVITIES = os.environ.get('ASLO_ACTIVITIES_ROOT')
ACTIVITIES_GIT... |
#
# Copyright 2018 Analytics Zoo 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 or agreed to... |
% ------------------------------
% filename: Lax_Wendroff.m
%
% We recall that vsol:
% column 1: the volumic mass
% column 2: the momentum
% column 3: the total energy (per volum unit)
function [vsol, vflux]=Lax_Wendroff(gamm1,ifct,Delta_t,vsol,vpres,wx, conec, vcor_n, vcor_np1,number);
[nnt, ndln] = size(vsol);
[ne... |
#!/usr/bin/env python
"""
A pure python ping implementation using raw socket.
Note that ICMP messages can only be sent from processes running as root.
Derived from ping.c distributed in Linux's netkit. That code is
copyright (c) 1989 by The Regents of the University of California.
That cod... |
# misc.py
#
# Copyright (C) 2010 - Wei-Ning Huang (AZ) <aitjcize@gmail.com>
# All Rights reserved.
#
# 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 yo... |
def normalize_tokens(tokens):
# Remove empty texts
tokens = [kv for kv in tokens if kv[0] != "text" or kv[1]]
# Merge lines
i = 1
while i < len(tokens):
token_name, value = tokens[i]
if token_name == "newline" and tokens[i - 1][0] == "newline":
value2 = tokens[i - 1][1]... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# -*- coding: utf-8 -*-
import logging
import httplib as http
import math
from itertools import islice
from flask import request
from modularodm import Q
from modularodm.exceptions import ModularOdmException, ValidationValueError
from framework import status
from framework.utils import iso8601format
from framework.mo... |
from types import NoneType
from collections import OrderedDict as odict
import unittest
from pprint import pprint
from flask.ext.introspect import TreeView, Tree, DictViewMixin, ObjectViewMixin, NOTEXIST
class O(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
class O1(object):
de... |
#
# Copyright 2008,2009 Free Software Foundation, Inc.
#
# This application 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 3, or (at your option)
# any later version.
#
# This application is di... |
#!/usr/bin/env python
import sys
import multiprocessing
import gzip
import os
from subprocess import check_call as cc, CalledProcessError
from download_genomes import is_valid_gzip, xfirstline
argv = sys.argv
def getopts():
import argparse
a = argparse.ArgumentParser()
a.add_argument("paths", nargs="+", h... |
"""Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys(). Additional convenience functions are a... |
#!/usr/bin/env python3
import time
import openpyxl
import json
import os
import re
import sys
from urllib.request import urlopen
'''
prop65.py
This module contains a Python class, 'Prop65Data', that is used
to import data from the Proposition 65 website and translate the hazards from
their native representation to G... |
# Copyright (C) 2011, 2013, 2015, 2016 Francois Marier <francois@libravatar.org>
# Copyright (C) 2010 Francois Marier <francois@libravatar.org>
# Jonathan Harker <jon@jon.geek.nz>
# Brett Wilkins <bushido.katana@gmail.com>
#
# This file is part of Libravatar
#
# Libravatar is f... |
"""Checks isup.me to see if a website is up
@package ppbot
@syntax isup <word>
"""
import requests
import re
from piebot.modules import *
class Isup(Module):
def __init__(self, *args, **kwargs):
"""Constructor"""
Module.__init__(self, kwargs=kwargs)
self.url = "http://www.isup.me/%s"
... |
# Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Sharding Entity group utility function to improve performance.
This enforces artificial root entity grouping, which can be actually useful in
... |
import datetime
try:
import cPickle as pickle
except ImportError:
import pickle
from django.db import models
from django.db.models.query import QuerySet
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import send_mail
from django.core.urlresolvers... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-06-01 19:48
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depend... |
import numpy as np
from keras.layers import Embedding, Input, Flatten, Dense
from keras.layers.merge import Concatenate, Dot, Add
from keras.models import Model
from keras.regularizers import l2
from util.layers_custom import BiasLayer
from hybrid_model.models.abstract import AbstractModelCF, bias_init
class Sigmoid... |
# -*- coding: utf-8 -*-
#
# Senpy documentation build configuration file, created by
# sphinx-quickstart on Tue Feb 24 08:57:32 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... |
import esp8266uart
esp = esp8266uart.ESP8266(1, 115200)
print('Testing generic methods')
print('=======================')
print('AT startup...')
if esp.test():
print('Success!')
else:
print('Failed!')
#print('Soft-Reset...')
#if esp.reset():
# print('Success!')
#else:
# print('Failed!')
print('Anothe... |
"""
Django settings for magondeau project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pa... |
import logging
import re
try:
import dnf
except ImportError:
dnf = None
from pyp2rpm import settings
from pyp2rpm import utils
from pyp2rpm.logger import LoggerWriter
logger = logging.getLogger(__name__)
class NameConvertor(object):
def __init__(self, distro):
self.distro = distro
self... |
#Python 2.7.9 (default, Apr 5 2015, 22:21:35)
import sys
# file with raw classifications (csv)
# put this way up here so if there are no inputs we exit quickly before even trying to load everything else
try:
classfile_in = sys.argv[1]
except:
#classfile_in = 'data/2e3d12a2-56ca-4d1f-930a-9ecc7fd39885.csv'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tkinter
import urllib.request, urllib.error, urllib.parse
import ssl
import io
import PIL.Image
import PIL.ImageTk
import tkinter.messagebox
import time
import webbrowser
from selenium import webdriver
from Lib import Tools
class GUI :
def __init__ (self, master)... |
from tests.test_helper import *
from datetime import date
from braintree.us_bank_account import UsBankAccount
from braintree.us_bank_account_verification import UsBankAccountVerification
class TestUsBankAccount(unittest.TestCase):
def test_constructor(self):
attributes = {
"last_four": "1234",
... |
import json
import plotly.offline as opy
import plotly.graph_objs as go
from django.utils.safestring import mark_safe
from django.contrib import messages
from django.contrib.auth.decorators import permission_required, login_required
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
from django.sh... |
from command.public import SourceCommand
from remote_execution.public import RemoteHostExecutor
class DeviceModifyingCommand(SourceCommand):
"""
a command supplying utility methods for command which iterate over the devices of the source and target
"""
def _execute_on_every_device(self, executable_fo... |
"""
Import geometry from various formats ('import' is python keyword, hence the name 'ymport').
"""
from yade.wrapper import *
from yade import utils
try:
from minieigen import *
except ImportError:
from miniEigen import *
def textExt(fileName,format='x_y_z_r',shift=Vector3.Zero,scale=1.0,**kw):
"""Load sphere co... |
import sys,os,bpy
import urllib
from urllib import *
import urllib.request
from xml.etree import ElementTree
print("run start")
render_url = "http://192.168.3.78:8088/content/test/monkey"
x3d_url = "http://192.168.3.78:8088/content/test/monkey.x3d"
x3d_scene_name = "monkey"
def dowload_x3d(x3d_url):
print("st... |
# Copyright 2021 DeepMind Technologies Limited. 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 by ... |
import faulthandler
import time
import logging
import os
import sys
import getpass
from logging import handlers
from qgis.PyQt import uic
import gdal
logger = logging.getLogger("roam")
log = logger.debug
debug = logger.debug
info = logger.info
warning = logger.warning
error = logger.error
critical = logger.critical... |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from mptt.models import TreeForeignKey, TreeManyToManyField, MPTTModel
class Navigation(models.Model):
"""
Navigation menu
"""
key = models.CharField(_(u'key'), max_length=32, help_text=_(u'Thi... |
"""
Copyright 2011 Jeff Garzik
AuthServiceProxy has the following improvements over python-jsonrpc's
ServiceProxy class:
- HTTP connections persist for the life of the AuthServiceProxy object
(if server supports HTTP/1.1)
- sends protocol 'version', per JSON-RPC 1.1
- sends proper, incrementing 'id'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.