code stringlengths 1 199k |
|---|
import sys
import os
import shutil
class Logger(object):
data = ''
def __init__(self, queue):
self.queue = queue
def write(self, message):
self.data += message.replace('\r\n', '\n')
lines = self.data.split('\n')
self.data = lines[-1]
self.queue.put(('console', lines[:... |
import json
from django.http import Http404
from django.http import HttpResponse
from django.views.generic import View
from apps.core import models
class BaseAJAXQueryView(View):
query_arg = 'query'
required_query_args = []
model = None
def parse_query_args(self, request):
args = {}
args... |
import unittest
import numpy as np
from lpdec.codes import BinaryLinearBlockCode
from lpdec.channels import *
from lpdec.codes.classic import HammingCode
from lpdec.decoders.ip import CplexIPDecoder, GurobiIPDecoder
from lpdec.decoders.adaptivelp_glpk import AdaptiveLPDecoder
from lpdec.decoders.branchcut import Branch... |
class Disk:
def __init__(self, total_positions, start_position):
self._position = start_position
self._total = total_positions
def flip(self):
self._position += 1
if self._position == self._total:
self._position = 0
def get_position(self):
return self._pos... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.contrib import admin
class Command(BaseCommand):
help = 'Helps debug profile issues'
def handle(self, *args, **options):
users = User.objects.all()
for u in users:
... |
"""
Created on Thu Jan 30 12:12:48 2014
@author: Bertrand
"""
import os
basedir = 'path//' #path of the folder to process.
for root, dirs, files in os.walk(basedir, topdown=False): #topdown=False -> to process subfolders : mandatory
#Adding a .sbd extension to all folders and subfolders
for name in dirs:
... |
from alchemyapi import AlchemyAPI
from flask import Flask, request
import jinja2
import json
import random
import nltk
from nltk import tokenize
from unidecode import unidecode
nltk.download('punkt')
TOPIC_ENTITIES_THRESHOLD = 0.5
TOPIC_KEYWORDS_THRESHOLD = 0.75
TOPIC_CONCEPTS_THRESHOLD = 0.75
ENTITY_SENTIMENT_THRESHOL... |
''' Regression test for neubot/utils_path.py '''
import logging
import unittest
import os
import sys
if __name__ == '__main__':
sys.path.insert(0, '.')
from neubot_runtime.third_party import six
from neubot_runtime import utils_path
class TestDepthVisit(unittest.TestCase):
''' Make sure that depth_visit() works... |
import docopt
import json
import logging
import os
import random
import re
import requests
import signal
import subprocess
import sys
import termcolor
import time
version = '0.1'
__doc__ = """
cliradio.py {version} --- play internet radio streams on the commandline
Usage:
{filename} (-l | --list) [-c <channelfilename... |
"""
Module wide global variables
===============================================================================
Copyright 2017, Arthur Davis
Email: art.davis@gmail.com
This file is part of pyfred. See LICENSE and README.md for details.
----------
"""
import os
from builtins import str as text
RELPATHS = False
if RELPA... |
"""
Demonstrates very basic use of ImageItem to display image data
inside a ViewBox.
"""
import sys,getopt # trans the parameter
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
import pyqtgraph as pg
import pyqtgraph.ptime as ptime
import map
class maptest(QtGui.QDialog):
def __init__(self):
QtGui... |
from datetime import datetime
from dateutil.relativedelta import relativedelta
from rest_framework import generics, permissions
from rest_framework.response import Response
from rest_framework import status
from rest_framework.throttling import UserRateThrottle
from django.conf import settings
from core.models import C... |
from __future__ import absolute_import
import gtk
import gobject
import pango
from solfege.mpd import const
from solfege.mpd import elems
from solfege.mpd import engravers
from solfege.mpd import parser
from solfege.mpd.rat import Rat
class MusicDisplayer(gtk.ScrolledWindow):
def __init__(self):
gtk.Scrolle... |
import datetime
from django.db.models.aggregates import Sum
from django.shortcuts import get_object_or_404
from rest_framework.response import Response
from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_200_OK
from rest_framework.views import APIView
from harvest.models.price_product import PriceProduct
from ... |
__all__ = ('NumberInput', 'HTML5EmailInput', 'CepInput',
'BRPhoneNumberInput', 'MoneyWidget')
from django.forms.widgets import TextInput
class NumberInput(TextInput):
"""
Widget de entrada de número funciona em HTML5
"""
input_type = 'number'
class HTML5EmailInput(TextInput):
"""
Widg... |
import configparser
from Helpers import Download
from Helpers import Parser
from Helpers import helpers
class ClassName(object):
def __init__(self, domain, verbose=False):
self.apikey = False
self.name = "Searching GitHubUser Search"
self.description = "Search GitHubUser for emails the user ... |
def graph_to_dimacs(g, f):
"""
Persists the supplied graph in valid dimacs format into the file.
Parameters
----------
g : `~medpy.graphcut.graph.Graph`
A graph object to persist.
f : file
A file-like object.
"""
# write comments
f.write('c Created by medpy\n')
f.... |
from type_utils import cents_from_str
from sys import maxint
class Amount(object):
def __init__(self, amount, cents=None):
if isinstance(amount, int):
self.cents = amount*100
elif isinstance(amount, float):
self.cents = int(amount*100.0)
elif isinstance(amount, str):
... |
'''
Created on 23.05.2016
@author: micha
'''
import logging
import time
BMP280_I2C_ADDRESS1 = 0x76
BMP280_I2C_ADDRESS2 = 0x77
BMP280_SLEEP_MODE = 0x00
BMP280_FORCED_MODE = 0x01
BMP280_NORMAL_MODE = 0x03
BMP280_SOFT_RESET_CODE = 0xB6
BMP280_CHIP_ID_REG = 0xD0 # Chip ID Register
BMP280_RST_REG ... |
"""Default handling.
"""
import ConfigParser
parser = ConfigParser.SafeConfigParser()
parser.add_section('bug_tracker')
parser.set('bug_tracker', 'url', 'http://localhost:8080/bugs')
parser.set('bug_tracker', 'username', 'dhellmann')
parser.set('bug_tracker', 'password', 'secret')
for section in parser.sections():
... |
from util import get_host_instances
from util import get_flavor
from util import get_tenant
from util import get_nova_client, get_keystone_client
from util import output_report
from util import parser_with_common_args
def parse_args():
parser = parser_with_common_args()
parser.add_argument("--m1", action='store... |
"""
Django settings for djconfig 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/
"""
import os
BASE_... |
from ._version import __version__
from .terminal import Terminal, get_terminal
from .root import Root
from .container_elements import (
Stack, Box, Zebra, VerticalSplitContainer, HorizontalSplitContainer)
from .display_elements import Fill, Label, Text, ProgressBar
from .input_elements import Input, LineInput |
import as2dh
import os
import shutil
import sys
def install(asdoc_path, title, name, prefix, is_dry_run = False):
if not os.path.exists(asdoc_path):
sys.stderr.write('%s does not exist.\n' % asdoc_path)
return 1
# check the given prefix is valid
if not os.path.exists(prefix):
sys.std... |
"""
:copyright: Copyright 2013-2014 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
"""
from __future__ import unicode_literals
import logging
import mongoengine
from django.core import exceptions
from django.utils.translation import ugettext as _
from tastypie_mongoengine.resources import MongoEngineResource
f... |
from courselib.auth import requires_role
from django.shortcuts import get_object_or_404
from grad.models import ExternalDocument
from django.http import HttpResponse
@requires_role("GRAD", get_only=["GRPD"])
def download_file(request, grad_slug, d_id):
# we don't actually need the grad slug.
document = get_obje... |
import base64
import tempfile
import tornado.testing
from tornado.test.util import unittest
from tornado.options import options
from easy_phi import app
from easy_phi import auth
class AdminConsoleAccessTest(tornado.testing.AsyncHTTPTestCase):
url = None
def setUp(self):
super(AdminConsoleAccessTest, se... |
from bokeh.models import ColumnDataSource, LabelSet
from bokeh.plotting import figure
from bokehgui import bokeh_plot_config, utils
class time_sink_c(bokeh_plot_config):
"""
Python side implementation for time sink for complex values.
It creates a time series plot on the frontend. It gets data from
time... |
import sys, os, csv, pprint, math
from collections import OrderedDict
import numpy as np
import traceback
import re
import matplotlib
matplotlib.use('Qt4Agg')
import matplotlib.pyplot as plt
import seaborn.apionly as sns
import scipy.stats
import json
from matplotlib import colors
import matplotlib.cm as cm
import seab... |
from typing import List
def add(lst: List[int]) -> int:
"""Return the sum of the elements in the given list."""
temp = 0
for item in lst:
temp += item
return temp
temp += 1 # Error on this line |
"""
`swga init` is a special command that initializes a directory before being used
with SWGA. In short, this reads the foreground and background FASTA files to
get some basic stats (number of records, overall number of bases) and
populates the generated parameters.cfg file with reasonable defaults based on
these stats... |
import h5py
from models import cnn
from keras import models
from progressbar import ProgressBar
import math
def predict(test_file, model_file, predictions_file, batch_size):
print('Predicting')
test_hdf5 = h5py.File(test_file, 'r')
predictions_hdf5 = h5py.File(predictions_file, 'w')
model = models.load_... |
def test_bundle_creation_instantiation():
import libSpineML
from libSpineML import smlBundle
b = smlBundle.Bundle()
assert type(b) is smlBundle.Bundle
def test_bundle_creation_loaded_experiment_list_instantiation():
import libSpineML
from libSpineML import smlExperiment
from libSpineML impor... |
import sys
import json
import subprocess
import os
import os.path
vm = json.loads(sys.argv[1])
folder = '/var/lib/olvm/vms/kvm/' + vm['name']
disk = folder + '/disk.data'
if not os.path.isdir(folder):
os.makedirs(folder)
try:
out = ''
if 'image' in vm and len(vm['image']) > 0:
out = subprocess.check... |
"""
morris.tests
============
Test definitions for Morris
"""
from __future__ import print_function, absolute_import, unicode_literals
from unittest import TestCase
from doctest import DocTestSuite
from morris import Signal
from morris import SignalTestCase
from morris import boundmethod
from morris import remove_signa... |
"""Tests for the `beam on foundation` sub-package.""" |
import os
import sys
SOLR_URLS=[
'http://localhost:9983/solr/BumblebeeETL/update'
]
SQLALCHEMY_URL = 'postgres://user:password@localhost:15432/import_pipeline'
SQLALCHEMY_ECHO = False
CELERY_INCLUDE = ['aip.tasks']
CELERY_BROKER = 'pyamqp://user:password@localhost:6672/import_pipeline'
OUTPUT_CELERY_BROKER = 'pyamqp:... |
from mapqeditorq.game import gba_image
from mapqeditorq.game.structure_utils import StructureBase
from . import common
from PIL import Image
class PaletteHeader2(StructureBase):
FORMAT = (
('palette_table_index', 'u16'),
('palette_dest_index', 'u8'),
('amount_of_palettes', 'u8')
)
de... |
import sys
from math import pi, exp, sqrt, log
import numpy as np
from scipy.interpolate import interp1d
from scipy.optimize import fsolve
from scipy import __version__ as scipy_version
from ase.utils import prnt
from ase.units import Hartree, Bohr
from ase.data import atomic_numbers, chemical_symbols
from gpaw.utiliti... |
import os
def in_functional_testing_mode():
"""
Checks, if the current server runs in functional testing mode, otherwise false.
:return: true, if the server runs in functional testing mode, otherwise false.
"""
return 'FUNCTIONAL_TESTING' in os.environ and os.environ['FUNCTIONAL_TESTING'] == 'True' |
from string import split
from string import atoi
from string import atof
def read_ARCINFO_ASCII_grid(
filename,
FLAG="UNFILTERED",
INTflag=0,
Extent={"North": 0, "South": 0, "East": 0, "West": 0},
):
"""This routine reads a standard Arc/Info ASCII grid file and
returns the coordinates and values... |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.pr... |
import os, sys, re, struct, shutil, traceback, threading, decimal, pathlib, operator
import datetime, time, _strptime, base64, binascii, random, hashlib
import json, codecs, collections, uuid, queue
from kodi_six import xbmc, xbmcaddon, xbmcplugin, xbmcgui, xbmcvfs
from itertools import... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.load("RecoMET.Configuration.CaloTowersOptForMET_cff")
process.load("RecoMET.Configuration.RecoMET_cff")
process.load("RecoMET.Configuration.RecoHTMET_cff")
process.load("RecoMET.Configuration.RecoGenMET_cff")
process.load("RecoMET.Configurat... |
import robot
r = robot.rmap()
r.loadmap('task5-14')
def task():
pass
#------- пишите код здесь -----
# пока справа стена
while r.wallRight():
# оббежать стену
while r.wallRight():
r.up()
r.right()
r.down()
while r.wallLeft():
r.down()
... |
import logging
import sys
import unittest
import numpy
import numpy.testing as nptst
import math
import pickle
import sppy
from sppy import csarray
class csarrayTest(unittest.TestCase):
def setUp(self):
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
numpy.set_printoptions(suppress=True,... |
import sys
import os
import getopt
import collections
def main():
params = parseArgs()
if params.pops and params.pofz:
#get pop IDS
p = readList(params.pops)
#get OrderedDict of prob results
probs = readNewHybs(params.pofz)
#iterate over probs to make output
nan = 0
index = -1
pops = dict()
enumCoun... |
import bz2
import cPickle
import numpy as np
import cv2
from psycopg2.extras import RealDictCursor
import psycopg2 as ps
import skimage.filter as skfilter
DEC2FLOAT = ps.extensions.new_type(
ps.extensions.DECIMAL.values,
'DEC2FLOAT',
lambda value, curs: float(value) if value is not None else None
)
ps.extensions.reg... |
from django.db import models
from django.db import models
from datetime import datetime
from django.forms import ModelForm
from django.conf import settings
from django.contrib.auth.models import User
from email.parser import HeaderParser
from email.parser import Parser
from email import Header
from email.message import... |
"""
Dialog for adding region to interface.
"""
from gm_base.geometry_files.format_last import RegionDim
import PyQt5.QtWidgets as QtWidgets
import PyQt5.QtGui as QtGui
from gm_base.geomop_dialogs import GMErrorDialog
import gm_base.icon as icon
class AddRegionDlg(QtWidgets.QDialog):
BACKGROUND_COLORS = [
Qt... |
from django.template import Context, loader
from ervin.models import *
from ervin.views.generic import *
from django.http import HttpResponse
from django.core.paginator import Paginator
def detail(ed, request, *args,**kwargs):
t = None
if ed.expression.form == 'StillImage':
print ed.expression.form
... |
"""
Automated test to reproduce the results of Lee et al. (2005)
Lee et al. (2005) compares different models for semantic
similarity and verifies the results with similarity judgements from humans.
As a validation of the gensim implementation we reproduced the results
of Lee et al. (2005) in this test.
Many thanks to ... |
"""
Generate sample SIP-Spectra for 9 time steps, decreasing linearly tau
"""
import os
import numpy as np
import shutil
from sip_models.res.cc import cc as cc_res
frequencies = np.logspace(-2, 4, 20)
np.random.seed(6)
rho0 = 50
m_raw = np.linspace(0.10, 0.05, 30)
times = [0, 1, 2, 3, 6, 10, 11, 20, 22, 25, 29]
m = m_r... |
import os
import csv
from bs4 import BeautifulSoup
import requests
import numpy as np
import pandas as pd
def get_links(year, stat_index):
urls = []
base_url = "http://www.pgatour.com/stats/stat."
if year == 2017:
stryear = ""
else:
stryear = "."+str(year)
if len(stat_index) == 1:
... |
from PyQt5.QtWidgets import QMainWindow, QStackedWidget
from package.ui.widgets import GameWidget
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('Game name here')
#self.stacked_widget = QStackedWidget(GameWidget())
self.setCentralWidget(G... |
import unittest
from main import part2
class RoboSanta(unittest.TestCase):
def test_small(self):
self.assertEqual(part2("^v"), 3)
def test_med(self):
self.assertEqual(part2("^>v<"), 3)
def test_large(self):
self.assertEqual(part2("^v^v^v^v^v"), 11)
if __name__ == '__main__':
unit... |
from rest_framework import permissions
from rest_framework.generics import get_object_or_404
from zds.mp.models import PrivateTopic
class IsParticipant(permissions.BasePermission):
"""
Custom permission to know if a member is a participant in a private topic.
"""
def has_object_permission(self, request,... |
def app(rfam, response):
# Get the path and check its a valid request for a head...
path = response.getPath()
if len(path)!=2:
response.make404()
return
# Find the relevant project record...
proj = rfam.getProject(path[1])
if proj==None:
response.make404()
return
path = rfam.real(proj['ima... |
class Solution:
def canWinNim(self, n):
"""
:type n: int
:rtype: bool
"""
return n % 4 != 0 |
import sys
import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcl
cdict = {
'red': ((0.0, 0.0, 0.0), (0.5, 0.216, 0.216), (1.0, 1.0, 1.0)),
'green': ((0.0, 0.0, 0.0), (0.5, 0.494, 0.494), (1.0, 1.0, 1.0)),
'blue': ((0.0, 0.0, 0.0), (0.5, 0.722, 0.722), (1.... |
"""provides functionality for rendering a parsetree constructing into module
source code."""
import re
import time
from mako import ast
from mako import compat
from mako import exceptions
from mako import filters
from mako import parsetree
from mako import util
from mako.pygen import PythonPrinter
MAGIC_NUMBER = 10
TOP... |
'''
Author: Zhibo Zhang
MADlab, Mechanical Enineering, University at Buffalo
Time: 2017.8.30
Github: https://github.com/zibozzb
MADlab: http://madlab.eng.buffalo.edu
'''
import tensorflow as tf
import numpy as np
import os
def read_cifar10(data_dir, is_train, batch_size, shuffle):
img_wi... |
from datetime import datetime
from socket import AF_INET, SOCK_DGRAM, socket
from struct import pack, unpack
import time
import select
from . import const
from .attendance import Attendance
from .exception import ZKErrorResponse, ZKNetworkError
from .user import User
class ZK(object):
is_connect = False
__data_... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import json
from itertools import chain
from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.network.common.utils import to_list
from ansible.plugins.cliconf import CliconfBase
class Cliconf(C... |
from openerp import models, fields, api, _
import logging
_logger = logging.getLogger(__name__)
class hr_employee(models.Model):
_inherit = 'hr.employee'
rfid = fields.Char(string='RFID')
exclude_on_punchclock = fields.Boolean(string=None) |
import os
from gns3server.web.route import Route
from gns3server.schemas.node import NODE_CAPTURE_SCHEMA
from gns3server.schemas.nio import NIO_SCHEMA
from gns3server.compute.dynamips import Dynamips
from gns3server.schemas.atm_switch import (
ATM_SWITCH_CREATE_SCHEMA,
ATM_SWITCH_OBJECT_SCHEMA,
ATM_SWITCH_U... |
import logging
import os
import pickle
import learning
import tools.strings as pystr
from db.obj.Tweeted import Tweeted
from executor.ActionScheduler import ActionReservoirFullError, ActionAlreadyExists
from retweet.RetweetFinder import RetweetFinder
def find_retweets(config, model_file, action_scheduler, text_size=80,... |
'''
Basic per project and global geodjango imports to try to speed the
debugging of django projects when jumping into the interpreter.
'''
import atexit
import os
import readline
import rlcompleter
historyPath = os.path.expanduser("~/.pyhistory")
readline.parse_and_bind("tab: complete")
def save_history(historyPath=his... |
def hierarchy_permit(author, target):
top_author_role = author.top_role.position
top_target_role = target.top_role.position
return top_author_role > top_target_role |
from gnomepublisher.core.builder import *
class TestBuilder:
def test_get_xfc_brand_dir(self):
xfc_brand_dir_private = ''
xfc_brand_dir_business = ''
build_directory = ''
Builder.get_xfc_brand_dir(Builder, xfc_brand_dir_private, xfc_brand_dir_business, build_directory) |
""" MultiQC submodule to parse output from RSeQC inner_distance.py
http://rseqc.sourceforge.net/#inner-distance-py """
from collections import OrderedDict
import logging
from multiqc.plots import linegraph
log = logging.getLogger(__name__)
def parse_reports(self):
"""Find RSeQC inner_distance frequency reports and ... |
import datetime
import cifparser
from mandelbrot.model import StructuredMixin
class Check(StructuredMixin):
"""
"""
def __init__(self):
self.check_id = None
self.behavior_type = None
self.policy = {}
self.properties = {}
self.metadata = {}
def get_check_id(self):
... |
import logging
from flask import Blueprint
from flask import make_response
from flask_restx import Api
logger = logging.getLogger(__name__)
api_blueprint = Blueprint('api', __name__, url_prefix='/api')
authorizations = {
'apikey': {
'type': 'apiKey',
'in': 'header',
'name': 'X-API-KEY'
}... |
"""
The experiment with 10 Hz/5Hz, wisp, attention, 70, cA 2, delta, theta, alpha low, batch size = 5 and
multiclass data set (BALANCED) with signal only data
@author: yaric
"""
import experiment as ex
import config
from time import time
n_hidden = 2
batch_size = 5
max_cls_samples = 7
experiment_name = 'cA_%d_%d_dt-th-... |
import dbus
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
def callback_function(path, interfaces):
try:
obj = bus.get_object('org.freedesktop.UDisks2', path)
iface = dbus.Interface(obj, 'org.freedesktop.UDisks2.Filesystem')
path = ifac... |
"""Module containg CLAP command implementation.
"""
from . import shared
from . import errors
class RedCommand:
"""RedCLAP command implementation.
This class represents a ginle command of a commandline program's UI.
It may contain various options, and subcomand.
"""
def __init__(self):
self.... |
import json
def get_user():
'''Get stored username if available.'''
file = 'username.json'
try:
with open(file) as f_obj:
username = json.load(f_obj)
except FileNotFoundError:
return None
else:
return username
def add_user():
'''Prompt for a new user'''
fi... |
"""
"""
from __future__ import division, absolute_import, print_function
import re
from tttraders.hex import hex_dict, random_hex
from tttraders.map import Map
symbol = {
'g': 'Gold',
's': 'Water',
'd': 'Desert',
'p': 'Pasture',
'm': 'Mountain',
'f': 'Farmland',
'h': 'Hill',
't': 'Forest... |
from anubis import app
from anubis.model import student
from anubis.model import builtin
from anubis.handler import base
@app.route('/student/search', 'student_search')
class StudentSearchHandler(base.Handler):
@base.require_priv(builtin.PRIV_USER_PROFILE)
@base.limit_rate('student_search', 60, 60)
@base.ge... |
"""
It takes as input a PSL format file generated by BLAT and it outputs only the
lines which contains the contigs with the best aligment which must be unique.
Author: Daniel Nicorici, Daniel.Nicorici@gmail.com
Copyright (c) 2009-2021 Daniel Nicorici
This file is part of FusionCatcher.
FusionCatcher is free software: y... |
from __future__ import absolute_import, print_function, unicode_literals
from lib.rtorrent import RTorrent
import sickbeard
from sickbeard import ex, logger
from sickbeard.clients.generic import GenericClient
class Client(GenericClient):
def __init__(self, host=None, username=None, password=None):
super(Cli... |
import time
import colorama
colorama.init()
progress = 0
complete = 100
for i in range(complete + 1):
progress = i
time.sleep(0.05)
print("\r", end="")
if float(progress) / float(complete) < 0.5:
print(colorama.Fore.RED, end='')
else:
print(colorama.Fore.GREEN, end='')
print("Poo... |
import MySQLdb
import ConfigParser
config = ConfigParser.ConfigParser()
config.read(".carinaConfig.ini")
class DB(object):
db = None
def __init__(
self, username=config.get(
'database', 'username'), passwd=config.get(
'database', 'password'), database=config.get(
... |
from __future__ import absolute_import
from setuptools import find_packages
from setuptools import setup
with open('VERSION') as f:
version = f.read().strip()
def read_requirements(file_):
lines = []
with open(file_) as f:
for line in f.readlines():
line = line.strip()
if lin... |
from settings_local import SUBSCRIPTION_ID, STORAGE_ACCOUNT_NAME, STORAGE_ACCOUNT_KEY, EMAIL_USERNAME, EMAIL_PASSWORD
__author__ = 'Natalie Sanders'
from azure.servicemanagement import *
from azure.storage import *
from subprocess import call
from os import chdir
import os
import socket
import zipfile
import pickle
imp... |
from django.contrib import admin
import models
class MaterialAdmin(admin.ModelAdmin):
#class Media:
# js = [
# '/s/grappelli/tinymce/jscripts/tiny_mce/tiny_mce.js',
# '/s/grappelli/tinymce_setup/tinymce_setup.js',
# ]
pass
admin.site.register(models.Material)
admin.site.regis... |
import smtplib
import email.utils
from email.MIMEText import MIMEText
class EmailNotification(object):
def __init__(self, dest, server, sender, username, password, port=587):
self.mid = {} # id of msg by alarm
self.dest = dest
self.server = server
self.port = port
self.sender... |
import numpy as np
from nn_io import DEFAULT_SEED
from interfaces.iterable import Iterable
class UnifiedDataProvider(Iterable):
"""Generic data provider."""
DEFAULT_FIRST_EPOCH = 0
def __init__(self, datalist, batch_size,
max_num_batches=-1, shuffle_order=True, rng=None, initial_order=None)... |
{
'name': "Analytic Line Project",
'version': "10.0.1.0.1",
'author': "Rooms For (Hong Kong) Limited T/A OSCG",
'website': "https://www.odoo-asia.com/",
'category': "Accounting",
'license': "LGPL-3",
'depends': [
'project',
],
'data': [
'views/account_analytic_lin... |
{
'name': 'Donation Direct Debit',
'version': '0.1',
'category': 'Accounting & Finance',
'license': 'AGPL-3',
'summary': 'Auto-generate direct debit order on donation validation',
'author': 'Akretion, Odoo Community Association (OCA)',
'website': 'http://www.akretion.com',
'depends': ['a... |
"""
The :xfile:`models.py` module for :mod:`lino_voga.lib.cal`.
This module extends :mod:`lino_xl.lib.cal.models`
"""
import six
from django.utils.translation import gettext_lazy as _
from lino_xl.lib.cal.models import *
from lino.modlib.users.choicelists import UserTypes
from lino_xl.lib.courses.choicelists import Enr... |
import subprocess
import os
import select
import masterdirac.models.run as r_model
import masterdirac.utils.hddata_process as hdp
import logging
import boto
from boto.exception import S3ResponseError
from boto.s3.key import Key
import datadirac.data as dd
import os.path
import pandas
def _get_source_data( working_dir, ... |
"""
"""
from rdflib import RDF, RDFS
from rdflib import URIRef, BNode, Literal
from rdflib.exceptions import ParserError, Error
from rdflib.syntax.xml_names import is_ncname
from xml.sax.saxutils import handler, quoteattr, escape
from urlparse import urljoin, urldefrag
RDFNS = RDF.RDFNS
UNQUALIFIED = {"about" : RDF.abo... |
"""
Django admin page for gx_username_rule models
"""
from django.contrib import admin
from biz.djangoapps.gx_username_rule.models import OrgUsernameRule
class OrgUsernameRuleAdmin(admin.ModelAdmin):
pass
admin.site.register(OrgUsernameRule) |
from lxml import html
import urllib2
def main():
# Alustetaan http-avaaja cookie-käsittelijän kanssa;
# nyt opener toimii selaimen tavoin:
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
url = tee_url("rovaniemi", "oulu", 20, 00, "10.05.2013")
root = html.parse(opener.open(url))
# L... |
from django.conf.urls import url
from sellers import views
urlpatterns = [
url(r'^$', views.index),
url(r'^([0-9]+)/accept/([0-9]+)/edit/', views.accept_edit_book),
url(r'^([0-9]+)/accept/', views.accept_books),
url(r'^([0-9,]+)/remove/', views.remove_seller),
url(r'^bulk/(\w+)/$', views.bulk_action... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('basket', '0006_basket_site'),
('order', '0009_auto_20150709_1205'),
]
operations = [
... |
"""SQL function API, factories, and built-in functions.
"""
from . import annotation
from . import operators
from . import schema
from . import sqltypes
from . import util as sqlutil
from .base import ColumnCollection
from .base import Executable
from .elements import _clone
from .elements import _literal_as_binds
from... |
"""migrate data for folders overhaul
Revision ID: 334b33f18b4f
Revises: 23e204cd1d91
Create Date: 2015-07-09 00:23:04.918833
"""
revision = '334b33f18b4f'
down_revision = '23e204cd1d91'
from sqlalchemy import asc
from sqlalchemy.orm import joinedload, subqueryload, load_only
from inbox.log import configure_logging, get... |
from setuptools import setup
__version__ = '0.6.1'
CLASSIFIERS = map(str.strip,
"""Environment :: Console
License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Natural Language :: English
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2.7... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.