src stringlengths 721 1.04M |
|---|
# Copyright (c) 2014 Stefan C. Mueller
# 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, merge, publish, di... |
# -*- coding: utf-8 -*-
from flask import render_template, url_for, request, make_response
from project import app, config
from project.controllers.form import RecaptchaForm
@app.route('/')
def index():
return render_template('index.html', modes=config.modes, title='Home')
@app.route('/print', methods=['GET',... |
#!/usr/bin/python3
# vim: set fileencoding=utf-8 :
# Copyright (C) 2006-2011 Guido Günther <agx@sigxcpu.org>
#
# 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 Li... |
#! /usr/bin/env python
import time, random, threading, monome, sched
import rtmidi
import loop16
from seq16 import Seq16
from monome import Monome
from midiout import *
# try to find a monome (you can skip this if you already know the host/port)
print "looking for a monome..."
host, port = monome.find_any_monome()
pr... |
# imports start
import os
import jinja2
import webapp2
import re
import bb_blogdb as bdb
import logging
# end imports
# create jinja2 environment
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'templates')
JINJA_ENV = jinja2.Environment(loader=jinja2.FileSystemLoader(TEMPLATE_DIR),
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# actions.py - the actual actions that you type in.
#
# Copyright © 2013 Jonathan Blandford
#
# 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 v... |
#!/usr/bin/python
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import fnmatch
import optparse
import os
import sys
import scons_to_gn
TOOLS_DIR = os.pat... |
#####################################################################
#
# hummingloop_algorithm.py
#
# Copyright (c) 2015, Nick Benson
# Modifications by benchan
#
# Released under the MIT License (http://opensource.org/licenses/MIT)
#
#####################################################################
import random... |
from django.conf import settings
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.core.exceptions import PermissionDenied
from django.contrib.auth.views import login
from core.views import *
class RequireLoginMiddleware(object):
def __init__( self ):
... |
#!/usr/bin/python3
"""
Copyright (c) 2014, Maxim Abrosimov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of c... |
from __future__ import unicode_literals, print_function
try:
import builtins
except:
import __builtin__
builtins = __builtin__
import functools
if hasattr(builtins,'unicode'):
# python2 variant
hxunicode = builtins.unicode
hxunichr = builtins.unichr
hxrange = xrange
def hxnext(x):
... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007 Johan Gonqvist <johan.gronqvist@gmail.com>
# Copyright (C) 2007-2009 Gary Burton <gary.burton@zen.co.uk>
# Copyright (C) 2007-2009 Stephane Charet... |
import configparser
import os
import sys
import gamepedia_client
class GamepediaPagesRW:
gc = None
'''
Create new instance of GamepediaClient (required for name attribution)
'''
def create_gamepedia_client(self, username=None, password=None):
global cfg_file
if username is None:
... |
# coding: utf-8
# This file is part of Supysonic.
#
# Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2013 Alban 'spl0k' Féron
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the F... |
"""
@ Set-up instructions
In order to run this tool, the following steps are required:
1. Set the working directory to the project's root.
2. Build the project into a "bin" directory under the project's root.
3. JRE must be installed and available globally through OS shell.
The above may be altered by reconfiguring t... |
# -*- coding: utf-8 -*-
# based on: http://code.activestate.com/recipes/146306/
import httplib
import mimetypes
import os
from kobo.shortcuts import random_string
class POSTTransport(object):
"""
POST transport.
USAGE:
>>> import kobo.http
t = kobo.http.POSTTransport()
t.add_vari... |
# -*- coding: utf-8 -*-
"""
psub.providers.napisy24
~~~~~~~~~~~~~~~~~~~~~
This module implements the psub napisy24.pl provider methods.
"""
import re
# import requests
from bs4 import BeautifulSoup
# from random import random
from io import BytesIO
from zipfile import ZipFile
from . import BaseProvider
from ..exce... |
import datetime
import json
import urllib
import urllib2
import uuid
from django.template import loader, Context
class Endpoint:
def __init__(self, configuration):
self.configuration = configuration
def _get_url_payload(self):
url = self.configuration['endpoint']
payload = {}
... |
#!/usr/bin/env python
import os
import pam
import web
import ovsdb
import ofctrl
import simplejson as json
urls = (
'/', 'Index',
'/login', 'Login',
'/logout', 'Logout',
'/availableports', 'SwitchPorts',
'/swconf', 'SwitchConf',
'/switchinfo', 'SwitchInfo',
'/helptext', 'HelpText',
# All B... |
"""SCons.Tool.Packaging.targz
The targz SRC packager.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# 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 Soft... |
# Copyright (c) 2010 Cloud.com, Inc
# Copyright (c) 2012 Cloudbase Solutions Srl
#
# 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.... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# 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 file.
#
# All configurati... |
import yaml
import os
import sys
import re
import library
import csv
from collections import defaultdict
import netaddr
from multiprocessing.pool import ThreadPool
print("Post Deployment - South San Francisco")
# Checks for site yaml file
if not os.path.isfile('yamls\\SSFUSD.yml'):
sys.exit('Site not setup, run ... |
"""
This module implements the TextResponse class which adds encoding handling and
discovering (through HTTP headers) to base Response class.
See documentation in docs/topics/request-response.rst
"""
from contextlib import suppress
from typing import Generator
from urllib.parse import urljoin
import parsel
from w3li... |
from __future__ import absolute_import
from django.db import IntegrityError, transaction
from rest_framework.response import Response
from sentry import features
from sentry.api.bases import GroupEndpoint
from sentry.api.serializers import serialize
from sentry.api.serializers.models.integration import IntegrationIs... |
#!/usr/bin/python
from Adafruit_CharLCD import Adafruit_CharLCD
from subprocess import *
from time import sleep, strftime
from datetime import datetime
import transmissionrpc
lcd = Adafruit_CharLCD()
cmd = "ip addr show wlan0 | grep inet | awk '{print $2}' | cut -d/ -f1"
lcd.begin(16, 2)
def run_cmd(cmd):
p =... |
# This file is part of Pimlico
# Copyright (C) 2020 Mark Granroth-Wilding
# Licensed under the GNU LGPL v3.0 - https://www.gnu.org/licenses/lgpl-3.0.en.html
import numpy
from scipy.sparse.dok import dok_matrix
from pimlico.core.modules.base import BaseModuleExecutor
from pimlico.old_datatypes.arrays import ScipySpars... |
# A FSM sequencing sample
# D.S. Blank
# This Pyrobot example will go (roughly) in a square
# This example has two states, "edge" that goes straight, and "turn"
# that turns 90 degrees to the left. It bounces back and forth between
# these two states.
# Note how it uses onActivate() to remember where it was when it
... |
#!python3
"""
Extract mutant and wildtype peptide sequences for missense variants in a VCF file
Usage:
generate_fasta.py --input=FILE_IN --output=FILE_OUT --peptide_sequence_length=INT
generate_fasta.py -h | --help
Arguments:
--input=FILE_IN VEP-annotated input VCF file
--output=... |
#!/usr/bin/env python
# Copyright 2020 Calico 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agr... |
import os
import json
from CPAC.pipeline import nipype_pipeline_engine as pe
import nipype.interfaces.utility as util
from CPAC.utils.test_resources import setup_test_wf
from CPAC.utils.datasource import match_epi_fmaps
def test_match_epi_fmaps():
# good data to use
s3_prefix = "s3://fcp-indi/data/Projects... |
"""Support for Notion."""
import asyncio
import logging
from aionotion import async_get_client
from aionotion.errors import InvalidCredentialsError, NotionError
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAM... |
# -*- encoding: UTF-8 -*-
#
# Copyright 2014-2015
#
# STIC-Investigación - Universidad de La Laguna (ULL) <gesinv@ull.edu.es>
#
# This file is part of CVN.
#
# CVN is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by
# ... |
"""Setup for an IBC experiment.
Contains all configs from the application scheme.
Experiments should differ by this setup only.
Can create HDF5-based or fast online experiments.
"""
__author__ = "Anton Akusok"
__license__ = "PSFL"
__version__ = "0.0.1"
class IBCConfig(object):
"""Global parameters for WIC system... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
'''
Given an array of integers, find two non-overlapping subarrays which have the largest sum.
The number in each subarray should be contiguous.
Return the largest sum.
Have you met this question in a real interview? Yes
Example
For given [1, 3, -1, 2, -1, 2], the two subarrays are [1, 3] and [2, -1, 2] or [1, 3, -1... |
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of so... |
"""
Tests dtype specification during parsing
for all of the parsers defined in parsers.py
"""
from io import StringIO
import os
import numpy as np
import pytest
from pandas.errors import ParserWarning
from pandas.core.dtypes.dtypes import CategoricalDtype
import pandas as pd
from pandas import (
Categorical, Da... |
"""
Usage:
python scripts/upload.py SITE TARGET USERNAME
SITE: enwiki or testwiki
TARGET: the page on SITE where the script will be uploaded
USERNAME: the account to make the edit under
"""
import datetime
import getpass
import os.path
import re
import sys
from clint.textui import colored
from clint.textui import pro... |
# Copyright 2019 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, ... |
"""Utility widgets, not really specific to the game."""
import sys
import urwid
class LogWidget(urwid.ListBox):
# Can't receive focus on its own; assumed that some parent widget will
# worry about scrolling us
_selectable = False
def __init__(self):
super().__init__(urwid.SimpleListWalker([]... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
from __future__ import absolute_import
import os
import tct
import sys
params = tct.readjson(sys.argv[1])
binabspath = sys.argv[2]
facts = tct.readjson(params['factsfile'])
milestones = tct.readjson(params['milestonesfile'])
reason = ''
resul... |
from sfepy.base.base import *
##
# c: 22.07.2008
def youngpoisson_to_lame( young, poisson, plane = 'stress' ):
if plane == 'stress':
lam = young*poisson/(1.0 - poisson*poisson)
mu = young/(2.0*(1.0 + poisson))
elif plane == 'strain':
lam = young*poisson/((1.0 + poisson)*(1.0 - 2.0*pois... |
"""Views for courses"""
from django.db import transaction
from rest_framework import (
viewsets,
mixins,
status,
)
from rest_framework.views import APIView
from rest_framework.authentication import SessionAuthentication, TokenAuthentication
from rest_framework.exceptions import (
APIException,
NotFo... |
# -*- coding: utf-8 -*-
'''
Created on 16 Ιαν 2013
@author: tedlaz
'''
from utils import dec as d
def f13(poso):
poso = d(poso)
ekp = d(0)
if poso < d(21500):
ekp = d(2100)
elif poso < d(22500):
ekp = d(2000)
elif poso < d(23500):
ekp = d(1900)
el... |
"""Highest hourly values"""
from collections import OrderedDict
import datetime
import pandas as pd
from pandas.io.sql import read_sql
from matplotlib.font_manager import FontProperties
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.plot.use_agg import plt
from pyiem.exceptions import NoDataFound
... |
u'''
Created on Dec 14, 2010
Use this module to start Arelle in command line non-interactive mode
(This module can be a pattern for custom use of Arelle in an application.)
In this example a versioning report production file is read and used to generate
versioning reports, per Roland Hommes 2010-12-10
@au... |
#!/usr/bin/env python3
# encoding: utf-8
# Copyright (C) 2016 Space Science and Engineering Center (SSEC),
# University of Wisconsin-Madison.
#
# 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 F... |
from distutils.core import setup
from distutils.command.install_data import install_data
from distutils.command.install import INSTALL_SCHEMES
import os
import sys
BASE_PACKAGE = 'forkit'
class osx_install_data(install_data):
# On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../
... |
from __future__ import absolute_import
from collections import namedtuple
from contextlib import closing
from cStringIO import StringIO
from datetime import datetime
from edtf import parse_edtf
from operator import attrgetter
from psycopg2.extras import register_hstore
from shapely import geos
from tilequeue.tile impor... |
# --------------------------------------------------------------------------------- #
# CUSTOMTREECTRL wxPython IMPLEMENTATION
# Inspired By And Heavily Based On wxGenericTreeCtrl.
#
# Andrea Gavana, @ 17 May 2006
# Latest Revision: 27 Aug 2012, 21.00 GMT
#
#
# TODO List
#
# Almost All The Features Of wx.Tree... |
# -*- coding: utf-8 -*-
import unittest
import simplestruct as structs
class StructTestCase(unittest.TestCase):
def test_class(self):
class Type(structs.Struct):
pass
self.assertIsNotNone(Type)
self.assertIsNotNone(Type())
def test_instantiation_correct_value_type(self):... |
import os
import unittest
from vsg.rules import generate
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_007_test_input.vhd'))
dIndentMap = utils.read_indent_file()
lExpected = []
lExpected.append('')... |
import os
import sys
from vulpo.utils import ShellCommand, get_ts
import vulpo
import vulpo.utils
class ScriptBase(object):
def __init__(self, config_file=None):
self.instance_id = vulpo.config.get('Instance', 'instance-id', 'default')
self.name = self.__class__.__name__
self.ts = get_ts()... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import scrapy
from HTMLParser import HTMLParser
import MySQLdb
from database_access import *
import re
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data... |
# -*- coding: utf-8 -*-
"""
Human Resource Management
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
s3db.hrm_vars()
# =============================================================================
def ... |
# encoding: utf-8
# module pwd
# from (built-in)
# by generator 1.135
"""
This module provides access to the Unix password database.
It is available on all Unix versions.
Password database entries are reported as 7-tuples containing the following
items from the password database (see `<pwd.h>'), in order:
pw_name, pw_... |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python2.7/dist-packages/PyKDE4/kdeui.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
class KAbstractWidgetJobTrack... |
from setuptools import setup
import os, shutil, sys
srcPath = os.path.abspath(os.path.join("source"))
sys.path.append(srcPath)
# Remove the build folder
shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("dist", ignore_errors=True)
APP = ['run.py']
DATA_FILES = [os.path.join("source", "domanager", "resources"... |
from django import forms
from django.core.exceptions import ObjectDoesNotExist
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.utils.translation import ugettext as _
from django.conf import settings
from django.contrib.auth.models import User
from userprofile.models impo... |
from tzwhere import tzwhere
import datetime
import unittest
class LocationTestCase(unittest.TestCase):
TEST_LOCATIONS = (
( 35.295953, -89.662186, 'Arlington, TN', 'America/Chicago'),
( 33.58, -85.85, 'Memphis, TN', 'America/Chicago'),
( 61.17, ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
HelpEditionDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************... |
[{
"name": "crossdomain_youku",
"find": "https?:\/\/static\.youku\.com(\/v[\d\.]*)?\/v\/swf\/.*(\/)?(player|loader).*\.swf",
"monitor": "https?:\/\/v\.youku\.com\/crossdomain\.xml",
"extra": "crossdomain"
}, {
"name": "crossdomain_tudou",
"find": "http:\/\/static\.youku\.com(\/v[\d\.]*)?\/v\/custom\/.*\/player.*\... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'SurveyQuestion.for_display'
db.delete_column(u'survey_s... |
from __future__ import print_function, division
try:
import tkinter as tk
import configparser as configparser
from tkinter.filedialog import askdirectory
except ImportError:
# I guess we're running Python2
import Tkinter as tk
import ConfigParser as configparser
from tkFileDialog import ask... |
import os
import sys
import logging
import threading
import unittest
from pykka.actor import ThreadingActor
from pykka.registry import ActorRegistry
from tests import TestLogHandler
class LoggingNullHandlerTest(unittest.TestCase):
def test_null_handler_is_added_to_avoid_warnings(self):
logger = logging.... |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
from lavendeux import Types, Errors
def call(args):
# Check number of arguments
if len(args) != 1:
return (Types.ERROR, Errors.INVALID_ARGS)
if isinstance(args[0], basestring) and str(args[0].capitalize()) in pokedex.values():
return (Types.INT, pokedex.keys()[pokedex.values().index(str(args[0].capitalize()))]... |
# -*- coding: utf-8 -*-
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class ZeveraCom(MultiHoster):
__name__ = "ZeveraCom"
__type__ = "hoster"
__version__ = "0.25"
__pattern__ = r'http://(?:www\.)?zevera\.com/.+'
__description__ = """Zevera.com hoster plugin"... |
#!/usr/bin/env python
import argparse
import datetime
import os
import os.path as osp
os.environ['MPLBACKEND'] = 'Agg' # NOQA
import chainer
import fcn
from train_fcn32s import get_data
from train_fcn32s import get_trainer
here = osp.dirname(osp.abspath(__file__))
def main():
parser = argparse.ArgumentPars... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2020-present MagicStack Inc. and the EdgeDB 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... |
#!/usr/bin/env python
"""
Tests for testing a UGrid file read.
We really need a **lot** more sample data files...
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
import os
from gridded import Dataset
from gridded.variable import Variable
from gridded.tests.utilities impor... |
import os
import requests
import requests_cache
import config
from templates.generic import *
from templates.text import TextTemplate
from utils.YouTube import YouTubeUtil
YOUTUBE_DATA_API_KEY = os.environ.get('YOUTUBE_DATA_API_KEY', config.YOUTUBE_DATA_API_KEY)
def process(input, entities):
output = {}
tr... |
"""
Module for visualizing Python code profiles using the Chrome developer tools.
Example usage:
>>> profiler = Profiler()
>>> profiler.start()
>>> my_expensive_code()
>>> profiler.stop()
>>> with open('my.cpuprofile', 'w') as f:
... f.write(profiler.output())
In a gevented environnment, context switches can make t... |
# coding=utf-8
"""
分形与混沌绘图
"""
import numpy as np
import pylab as pl
import time
from matplotlib import cm, collections
from math import log2, sin, cos
"""
Mandelbrot 集合 f_c(z) = z^2 + c, c \in \doubleZ
Mandelbrot 集合就是使以上序列不发散的所有c点的集合。
用程序绘制 Mandelbrot 集合时不能进行无限次迭代,最简单的方法是使用逃逸时间 (迭代次数) 进行绘制,具体算法如下:
判断每次调用函数 f_ c(z) ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import gc
import logging
import mock
from multiprocessing import Process, Queue
import os
import sys
from shellbot import Context, Engine, Shell
from shellbot.events import Message
from shellbot.updaters import FileUpdater
my_engine = Engine()
my_path = o... |
#!/usr/bin/env python
from __future__ import print_function, absolute_import
import flask_restless
from argparse import ArgumentParser
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from .db... |
"""
A Jupyter nbconvert exporter to convert notebooks and their widgets to publicly
runnable HTML files.
"""
# Always prefer setuptools over distutils
from setuptools import setup
from setuptools.command.test import test as TestCommand
# To use a consistent encoding
from codecs import open
from os import path
import s... |
#!/usr/bin/python
# Plots the user logins for the past 30 days
import numpy as np
import matplotlib.pyplot as plt
import subprocess
import datetime
from collections import Counter
wtmp_loc = './'
# number of days since today
history = 31
ignorenames = '[root,(unknown,system,reboot,wtmp]'
MonthMapping = {'Jan':1, 'F... |
import os
import time
from Tkinter import Tk
from tkFileDialog import askopenfilename
def change_settings(first_time):
if first_time==0:
customizations=read_settings()
tone=customizations[0]
snooze=customizations[1]
settings=open("settings.txt","w")
settings.write("Please change only if you know what you are ... |
from numpy import *
class DataLoader(object):
def __init__(self, file_name):
self._data = None
self._file_name = file_name
self._load_data()
self._data_descs =[]
self._generate_data_descs()
def _load_data(self):
f = open(self._file_name)
data = f.readlines()
f.close()
j = 0
data_list = []... |
import os
from com.googlecode.fascinator.api.indexer import SearchRequest
from com.googlecode.fascinator.api.storage import StorageException
from com.googlecode.fascinator.common.solr import SolrDoc, SolrResult
from java.io import ByteArrayInputStream, ByteArrayOutputStream
from java.lang import Boolean
from java.net... |
import json
import pprint
class Config:
def __init__(self):
# Defaults for values
# main
self.webPort = 80
self.songcacheDir = "cache"
self.logLength = 30
# player
self.defaultVol = 100
# playlist
self.skippingEnable = True
self.vote... |
# -*- coding:utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from django.core import checks
from django.db.models import CharField, IntegerField, Lookup, TextField
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from django_mysq... |
# Copyright 2015 Jarrod N. Bakker
#
# 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 writ... |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 1.4.41
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import io
import json
import ssl
import certifi
import logging
import re
# python 2 and... |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# Copyright (c) 2008-2021 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... |
from django.core.files.storage import FileSystemStorage
from django.core.files.move import file_move_safe
from django.contrib.auth.models import User
from django.apps import apps
from fnmatch import fnmatch
from whatisit.settings import (
MEDIA_ROOT,
MEDIA_URL
)
import errno
import itertools
import os
import... |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import requests
import json
import time
import re
from xml.dom.minidom import Node, Document, parseString
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
USERNAME = demisto.params()['credential... |
# -*- coding: utf-8 -*-
"""
Tests for the djagno management command `create_enterprise_course_enrollments`.
"""
import mock
from pytest import mark, raises
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase
from test_utils.factories i... |
#!/usr/bin/python2.7
import argparse
import urllib
from bs4 import BeautifulSoup
#TODO Parse arguments
URL="http://legislature.vermont.gov/bill/status/2016/H.159"
def fetch_url(url):
opener = urllib.FancyURLopener({})
f = opener.open(url)
return f.read()
def fetch_example():
fd = open("Example.html")
return f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import mosql
with open('README.rst', 'rb') as f:
README = f.read()
# We want README to be a str, no matter it is byte or text. 'rb' reads bytes,
# so we need extra conversion on Python 3. On Python 2 bytes is synonym to s... |
#!/usr/bin/env python
# Upstart libvirtd testing
#
# NOTES: Libvirtd will be restarted during test, better run this
# case alone.
import os
import re
import sys
import time
from utils import utils
from shutil import copy
required_params = ()
optional_params = {}
VIRSH_LIST = "virsh list --all"
UPSTART_CONF = "rpm -... |
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from matplotlib.lines import Line2D
import matplotlib.colors as colors
from matplotlib.animation import writers
import os
import itertools
import pf_dynamic_cart as... |
# Definition for an interval.
class Interval:
def __init__(self, s=0, e=0):
self.start = s
self.end = e
def __str__(self):
return "[{},{}]".format(self.start, self.end)
class Solution:
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: ... |
# -*- coding: utf-8 -*-
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Andrés Aguirre Dorelo
# MINA/INCO/UDELAR
#
# Execution of individuals resulted from the Baliero and Pias work
#
# 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 Softwa... |
# Copyright 2015 Isotoma Limited
#
# 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... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2021, Nigel Small
#
# 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
#
# Unle... |
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.