src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 26 17:32:58 2020
@author: dukel
"""
#%% 00. Initialize
import matplotlib.pyplot as plt
ls_x = [1,2,3,4]
ls_y = [1,4,9,16]
ls_z = [2,3,4,5]
#%% I. Basic Plotting
plt.plot(ls_x, # x
ls_y, # y
color='green',
linestyle='dashed',
label=... |
#!/usr/bin/python
#
# 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 b... |
#!/usr/bin/env python
"""
setup.py
========
This is a generic as possible setup.py template. The goal is to retrieve almost
all of the information from the main module file, rather than relying on values
explicitly entered here.
## Usage
This setup.py script needs to modified in the following ways:
- `MAIN_FILE` n... |
# -*- coding: UTF-8 -*-
"""
``trinity_statistics``
-----------------------------------------------------------------
:Authors: Menachem Sklarz
:Affiliation: Bioinformatics core facility
:Organization: National Institute of Biotechnology in the Negev, Ben Gurion University.
A class that defines a module for running ``... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os;
import sys;
import datetime;
import string;
import shutil;
EPSILON = 1e-10;
Product_volume_dict = {};
START_TIME='20:55:00';
END_TIME='02:45:00';
if len(sys.argv) != 3:
print 'Usage: ./cmd src_md_dir dest_dir';
quit();
src_md_path = sys.argv[1];
dest_dir =... |
# coding: utf-8
"""Wrapper for C API of LightGBM."""
import ctypes
import json
import os
import warnings
from collections import OrderedDict
from copy import deepcopy
from functools import wraps
from logging import Logger
from tempfile import NamedTemporaryFile
from typing import Any, Dict, List, Set, Union
import num... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014 Etherios, Inc. All rights reserved.
# Etherios, Inc. is a Division of Digi International.
from ep... |
#!/usr/bin/env python
# __author__ = 'helton'
import sip
sip.setapi('QVariant', 2)
from math import cos, pi, sin
from PyQt4 import QtCore, QtGui
class RenderArea(QtGui.QWidget):
def __init__(self, path, parent=None):
super(RenderArea, self).__init__(parent)
self.path = path
self.pen... |
# -*- coding: utf-8 -*-
"""Storage selection (SAS) functions: example with multiple fluxes out at steady state
Runs the rSAS model for a synthetic dataset with one flux in and
multiple fluxes out and steady state flow
Theory is presented in:
Harman, C. J. (2014), Time-variable transit time distributions and transport... |
import autobahn.twisted.websocket as ws
import pytest
import urlparse
from twisted.internet import reactor
from twisted.internet.ssl import ClientContextFactory
from twisted.web import client
from .protocols import ProtocolFactory
class _UnsecureClientContextFactory(ClientContextFactory):
"""An SSL context facto... |
import json
import re
from flask import Flask, flash, make_response
from flask.globals import request
from flask.templating import render_template
import requests
from twilio.rest import TwilioRestClient
PHONE_NUMBER_PATTERN = re.compile("^\\+?\\d{10,14}$")
PULL_REQUEST_OPENED = 'prOpened'
PULL_REQUEST_CLOSED = 'prCl... |
"""
flickr.py
Copyright 2004-2006 James Clarke <james@jamesclarke.info>
Portions Copyright 2007-2008 Joshua Henderson <joshhendo@gmail.com>
THIS SOFTWARE IS SUPPLIED WITHOUT WARRANTY OF ANY KIND, AND MAY BE
COPIED, MODIFIED OR DISTRIBUTED IN ANY WAY, AS LONG AS THIS NOTICE
AND ACKNOWLEDGEMENT OF AUTHORSHIP... |
"""
A quiver plot for flow defined an unstructured grid.
Each arrow follows the local streamlines, and the spacing
between arrows is maintained to avoid overlap.
It's slow.
"""
import matplotlib.pyplot as plt
from matplotlib import collections
import numpy as np
from shapely import geometry
from .. import utils
from... |
import glob
from PIL import Image
import numpy as np
import os
import tqdm
import multiprocessing
import threading
# used instead of proprocess_data.ipynb -> adjust dirs and path separator, here \\ for windows, replace by / for linux
# multithreading dies not work -> replaced by for loop
dest_dir = 'C:\git\python\glo... |
from datetime import datetime
from mongoengine import (connect, ValidationError)
from nose.tools import (assert_true, assert_false, assert_equal,
assert_almost_equal, assert_raises)
from qirest_client.helpers import database
from qirest_client.model.subject import (Project, ImagingCollection, Su... |
import os
import re
import typing
from OpenSSL import crypto
from mitmproxy import certs
from mitmproxy import exceptions
from mitmproxy import options as moptions
from mitmproxy.net import server_spec
class HostMatcher:
def __init__(self, handle, patterns=tuple()):
self.handle = handle
self.pat... |
"""
mbed SDK
Copyright (c) 2014 ARM 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... |
"""
Project Name: Twitter Tagcloud
Author: Alexandru Buliga
Email: bugaaa92@gmail.com
"""
import sys
import re
import logging
import json
import redis
from threading import currentThread, enumerate, Lock, Thread
from collections import Counter, OrderedDict
from datetime import datetime
... |
# Wrapper module for _socket, providing some additional facilities
# implemented in Python.
"""\
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available a... |
# 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
# d... |
import praw
import urllib.request
import json
import requests
import requests.auth
import os.path
import re
from imgurpython import ImgurClient
from bs4 import BeautifulSoup
imgur_gif_regex = re.compile("https?:\/\/i\.imgur\.com\/[a-z0-9]+.gif")
def gyazo_link_parser(link):
"""
Parses Gyazo links into their ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#
# Copyright 2013 Quantopian, 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 wr... |
#! -*-coding=gbk-*-
import os
import subprocess
import sys
import commands
import time
def walk_in_dir(root_path):
assd=""
try:
for root, dirs, files in os.walk(root_path, True):
for name in files:
if len(name)>0:
if name[0]!="$":
... |
# encoding: utf-8
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 'Fix.error'
db.delete_column('lint_fix', 'error')
# Adding field 'Fix.solution'
... |
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, NoUpdateMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
"Hook",
"HookManager",
"ProjectHook",
"ProjectHookManager",
"GroupHook",
"GroupHookManager",
]
class Hook(ObjectDeleteMixin, RESTObjec... |
#!/usr/bin/env python
"""
Initialization of the project global variables
"""
import cv2
import os
from var import variables
def init():
initvariables()
def initvariables():
variables.app_path = os.path.dirname(os.path.realpath(__file__))
variables.datasets_path = variables.app_path + '/data'
"... |
##Author: https://github.com/alexwchan
#!/usr/bin/python
# -*- encoding: utf8 -*-
"""imessage_export.py - this script takes the chat.db or sms.db SQL database
used to store messages on OS X or iOS and spits out a set of JSON files, one
for each thread.
The script is fairly rudimentary, and doesn't do anything to catch... |
##########################################################################
#
# Copyright (c) 2011-2012, Image Engine Design 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:
#
# * Redis... |
"""
Tests for the conditional_logit.py file. These tests do not include tests of
the functions that perform the mathematical calculations necessary to estimate
the MNL model.
"""
import warnings
import unittest
from collections import OrderedDict
import numpy as np
import numpy.testing as npt
import pandas as pd
impo... |
import tensorflow as tf
import tensorblock as tb
import numpy as np
class recipe_input:
####### Add Input
def addInput( self , **args ):
pars = { **self.defs_input , **args }
pars['name'] = self.add_label(
self.inputs , 'Input' , pars['name'] , add_order = True )
pars = s... |
from PyQt5.QtCore import QStandardPaths
import os
import json
import urllib.request
import gzip
import collections
class ReferenceCatalogues:
def __init__(self, database):
self.database = database
c = database.cursor()
cats = c.execute('SELECT id, "table", "name", spectra_url, gzipped, file... |
from contextlib import contextmanager
import logging
from ..image import Image
from ..png import FormatError
from . import Rect
logger = logging.getLogger(__name__)
class SpriteNode(Rect):
def __init__(self, im, width, height, fname=None, pad=(0, 0)):
Rect.__init__(self, (0, 0, width, height))
s... |
'''Game main module.
Contains the entry point used by the run_game.py script.
Feel free to put all your game code here, or in other modules in this "gamelib"
package.
'''
import json
import pygame
import data
import engine
class Game(object):
'''A class that delegates its engine functionalities to a hot-swappab... |
import argparse
import os
import codecs
import sys
import StringIO
import second_layer
from tree import read_conll
import tree
from features import convert_toNumbers
import json
import time
def train(args):
"""
main() to launch everything
"""
if not args.no_ccprop:
if not os.path.exists(os.pa... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Aladom SAS & Hosting Dvpt SAS
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import (
CampaignMailHeader, MailHeader, Subscription, SubscriptionType,
CampaignStaticAttachment, MailStaticAttachment,
)
__all__ = [
'C... |
from Cantera import exceptions
from Cantera.num import array
from Cantera.elements import elementMoles
def det3(A):
"""Determinant of a 3x3 matrix."""
return (A[0,0]*(A[1,1]*A[2,2] - A[1,2]*A[2,1])
- A[0,1]*(A[1,0]*A[2,2] - A[1,2]*A[2,0])
+ A[0,2]*(A[1,0]*A[2,1] - A[2,0]*A[1,1]))
def s... |
from __future__ import unicode_literals
import datetime
import requests
from requests_oauthlib import OAuth1
from oauthlib.oauth1 import (SIGNATURE_RSA, SIGNATURE_TYPE_AUTH_HEADER,
SIGNATURE_HMAC)
from six.moves.urllib.parse import urlencode, parse_qs
from .constants import (XERO_BASE_URL,... |
"""
Tests for the game class
"""
import unittest
import warnings
import numpy as np
from hypothesis import given
from hypothesis.extra.numpy import arrays
from hypothesis.strategies import integers
import pytest
import nashpy as nash
import nashpy.learning
class TestGame(unittest.TestCase):
"""
Tests for t... |
import sys
from optparse import OptionParser
import ROOT
from ROOT import *
ROOT.gROOT.SetBatch(ROOT.kTRUE)
from Plotting_Header import *
import numpy as np
import timeit
parser = OptionParser()
parser.add_option("-d", "--dir", action="store", dest="pwd", default="/home/storage/andrzejnovak/80Trees/", help="directory ... |
"""
Test and verify the memory-mapped command bridge (memmap_command_bridge).
Unlike the actual designs this test does not use a generic peripheral
but instead a specific peripheral / slave is used for each bus type,
other tests verify the generic ability.
"""
from __future__ import print_function, division
from ra... |
# -*- coding: utf-8 -*-
"""
Text normalization
"""
import re
import warnings
from pythainlp import thai_above_vowels as above_v
from pythainlp import thai_below_vowels as below_v
from pythainlp import thai_follow_vowels as follow_v
from pythainlp import thai_lead_vowels as lead_v
from pythainlp import thai_tonemarks ... |
#import all of the things we will be using
from django.db import models
from tagging.fields import TagField
# to help with translation of field names
from django.utils.translation import ugettext_lazy as _
# to have a generic foreign key for any model
from django.cont... |
# Copyright 2006 Lukas Lalinsky
#
# 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.
import ctypes
from quodlibet.util im... |
from unittest import TestCase
import unittest
import ezyrb.vtkhandler as vh
import numpy as np
import filecmp
import os
class TestVtkHandler(TestCase):
def test_vtk_instantiation(self):
vtk_handler = vh.VtkHandler()
def test_vtk_default_infile_member(self):
vtk_handler = vh.VtkHandler()
assert vtk_handl... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-11-10 00:02
from __future__ import unicode_literals
from django.db import migrations
import django.db.models.deletion
import sentry.db.models.fields.foreignkey
from sentry.models.platformexternalissue import PlatformExternalIssue
from sentry.utils.query imp... |
# -*- coding: latin-1 -*-
from south.db import db
from django.db import models
from pykeg.core.models import *
class Migration:
def forwards(self, orm):
# Adding model 'ThermoSummaryLog'
db.create_table('core_thermosummarylog', (
('id', orm['core.thermosummarylog:id']),
... |
'''
In this lab, you will learn how to:
Package up TensorFlow model
Run training locally
Run training on cloud
Deploy model to cloud
Invoke model to carry out predictions
'''
'''
Scaling up ML using Cloud ML Engine
In this notebook, we take a previously developed TensorFlow model to predict taxi... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"""Replace existing User FKs with their PootleProfile counterparts.
This will... |
#
# 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
# ... |
from __future__ import unicode_literals
import json
from copy import deepcopy
import pytest
import sure # noqa
import moto.server as server
from moto import mock_eks
from moto.core import ACCOUNT_ID
from moto.eks.exceptions import ResourceInUseException, ResourceNotFoundException
from moto.eks.models import (
C... |
# Logger bot configuration.
{
# These messages will dissapear after the bot has been run
# Most of these settings can be changed from within the bot
# itself. See the help command.
'active_servers': set(),
'admin_commands': {'help', 'ignore_server', 'listen_on', 'leave', 'join'},
'admin_roles':... |
import numpy as np
from .stats import Pdf, pdf_from_samples, multiply_pdfs, divide_pdfs
"""
Scaling relationships and related equations for earthquake magnitude
calculations.
"""
"""
Normalized slip distribution from Biasi and Weldon, 2006
"""
Dn_x = np.array(
[ 0. , 0.03852144, 0.07704287, 0.11556431... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def get_options(option_type):
"""
option_type: string
'training' or 'diplay' or 'visualize'
"""
# name
tf.app.flags.DEFINE_string("training_na... |
# -*- coding: utf-8 -*-
'''
Random Forest classifier
'''
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.preprocessing import StandardScaler
from ...core.routes import register
from .base import BaseMl, BaseMlSk
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import AdaBoo... |
# coding: utf-8
# The Hazard Library
# Copyright (C) 2012-2014, GEM Foundation
#
# 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 Free Software Foundation, either version 3 of the
# License, or (at your option) any... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... |
# -*- encoding: UTF-8 -*-
from controle import UC
from lib.memoria import Mem_instrucoes, Mem_dados
from lib.registradores import Banco
from lib.operacoes import ULA
from lib.instrucoes import Instrucao_R_I
class Sistema (object):
def __init__(self):
self.__PC = 0
self.__UC = UC()
self.__U... |
import tempfile
import docker
from django.template import loader, Context
def get_docker_client():
"""
Get configured docker client.
:param params: Settings module with Docker client configuration
:type params: :mod:`abdallah.settings`
:returns: Configured Docker client
:rtype: :class:`docke... |
#-*- coding: utf-8 -*-
import ujson
from django.http import HttpResponse, Http404
from django.core.cache import cache
from django.core.management import call_command
from django.db import connection
RACES_PER_VIEW = 25
def last_races(request):
cursor = connection.cursor()
query = "SELECT id, info, category,... |
#!/usr/bin/env python
from sonyAPI2 import API2
import cv2
import urllib2
import numpy as np
import time
import struct
api = API2()
api.update_api_list()
try:
result = api.do('getAvailableCameraFunction')
current = result['result'][0]
availavle = result['result'][1]
if current != "Remote Shooting":
... |
# -*- coding: utf-8 -*-
import traceback
import os
import random
# import json
import subprocess
import zipfile
import zlib
from datetime import datetime as dt
from tg import request, config
from rpac.model import *
__all__ = [
'gen_pdf',
'null_string_sizes',
'format_fibers',
'format_cares',
'f... |
#!/usr/bin/python
"""Test to verify table message presentation."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(PauseAction(3000))
sequence.append(TypeAction("Line 1"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("<Control>F12"))
sequence.appe... |
from multiprocessing import set_start_method, cpu_count
set_start_method('forkserver')
import os
os.environ["OMP_NUM_THREADS"] = str(cpu_count()) # or to whatever you want
from argparse import ArgumentParser
from datetime import datetime
time_now = datetime.utcnow().strftime("%Y%m%d%H%M%S")
ap = ArgumentParser()
a... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="py-trello",
version="0.3.1",
description='Python wrapper around the Trello API',
long_description=open('README.rst').read(),
author='Richard Kolkovich',
author_email='richard@sigil.org',
url='https://trello.com... |
# System built-in modules
import time
from datetime import datetime
import sys
import os
from multiprocessing import Pool
# Project dependency modules
import pandas as pd
pd.set_option('mode.chained_assignment', None) # block warnings due to DataFrame value assignment
import lasagne
# Project modules
sys.path.append('... |
'''
Python classes for Leopard Imaging LI-USB30-M021 on Linux
Copyright (C) 2016 Simon D. Levy
This file is part of M021_V4L2.
M021_V4L2 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 of the L... |
# This file was created automatically by SWIG.
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
import _servomotor
def _swig_setattr(self,class_type,name,value):
if (name == "this"):
if isinstance(value, class_type):
... |
#!/usr/bin/python
'''
Creates text file of Cocoa superclasses in given filename or in
./cocoa_indexes/classes.txt by default.
'''
import os, re
from cocoa_definitions import write_file, find
from commands import getoutput
def find_headers(frameworks):
'''Returns a dictionary of the headers for each given framework... |
"""
Django settings for testproject project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impor... |
#!/usr/bin/env python3
# Copyright 2016 Donour Sizemore
#
# This file is part of RacePi
#
# RacePi 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, version 2.
#
# RacePi is distributed in the hope that it will ... |
# 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
# d... |
# Copyright 2017 The TensorFlow Authors. 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 applica... |
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... |
# -*- coding: utf-8 -*-
#
# Hermes 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
# autogenerated file.
#
# All configuration values have a default; values that are commente... |
from common import *
import re
def editableColourStr(array):
return '#%02X%02X%02X (%d)' % tuple(array)
NICE_STR_RE = re.compile('^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})\s*(?:\((\d+)\))?$')
def colourFromNiceStr(thing):
match = NICE_STR_RE.match(thing)
try:
if match:
r,g,b,a = match.groups()
ret... |
# Copyright 2018-present MongoDB, 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 w... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from datetime import date
# disable caching when changing settings
LOAD_CONTENT_CACHE = False
AUTHOR = u'Dragos Stanciu'
SITENAME = u'Dragos Stanciu'
SITEURL = ''
##########################
### Flex theme options ###
############... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2016-2017 Teo Mrnjavac <teo@kde.org>
# SPDX-FileCopyrightText: 2017 Alf Gaida <agaida@siduction.org>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Calamares is Free So... |
# Copyright (C) 2014 Statoil ASA, Norway.
#
# The file 'load_results_tool.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 of t... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
# -*- coding: utf-8 -*-
import json
import re
from datetime import timedelta
import pycurl
from pyload.core.network.http.exceptions import BadHeader
from pyload.core.utils import seconds
from ..anticaptchas.ReCaptcha import ReCaptcha
from ..anticaptchas.SolveMedia import SolveMedia
from ..base.simple_downloader impor... |
import copy
from nose import with_setup
from pybbn.graph.variable import Variable
def setup():
"""
Setup.
:return: None.
"""
pass
def teardown():
"""
Teardown.
:return: None.
"""
pass
@with_setup(setup, teardown)
def test_copy():
"""
Tests variable copy.
:retu... |
import fnmatch
import os
import re
import shutil
import time
import traceback
from couchpotato import get_db
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent, fireEvent, fireEventAsync
from couchpotato.core.helpers.encoding import toUnicode, ss, sp
from couchpotato.core.helpers.variab... |
# [SublimeLinter flake8-max-line-length:120]
from datetime import datetime, timedelta
import random
import os
from os.path import join, isdir
import secrets
from matplotlib import pyplot as plt
from flask_security.utils import encrypt_password
import lipsum
from .talky import app, mail
from .login import user_datasto... |
import os
import subprocess
from typing import Sequence
from valohai_cli.exceptions import NoCommit, NoGitRepo
def check_git_output(args: Sequence[str], directory: str) -> bytes:
try:
return subprocess.check_output(
args=args,
cwd=directory,
shell=False,
st... |
from django.http import (
HttpResponse, Http404, HttpResponseForbidden,
HttpResponseRedirect)
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.template.loader import rende... |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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 3 of the License, or
(at your option) any later version.
T... |
#!flask/bin/python
from flask import Flask, jsonify, abort, make_response, request
from resources import posts, todos, comments, albums, photos, users
app = Flask(__name__)
@app.errorhandler(404)
def not_found(error):
return make_response(jsonify({'error': 'Not found'}), 404)
@app.errorhandler(400)
def bad_requ... |
import unittest
import pytest
from geographiclib.geodesic import Geodesic
from geographiclib_cython import Geodesic as CythonGeodesic
from geopy.distance import great_circle
# Run with: python -m pytest tests.py
class TestGeodesic(unittest.TestCase):
def test_inverse(self):
actual = CythonGeodesic.WGS84.I... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def parse_requirements(filename):
return [line.strip()
for line in read(filename).strip().split('\n')
... |
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK server.
#
# REDHAWK server is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the F... |
"""
Tests for the BSE main API
"""
import pytest
import basis_set_exchange as bse
from .common_testvars import *
@pytest.mark.slow
@pytest.mark.parametrize('basis_name', bs_names)
@pytest.mark.parametrize('fmt', bs_write_formats)
@pytest.mark.parametrize('unc_gen', true_false)
@pytest.mark.parametrize('unc_seg', t... |
from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import (
Float64Index,
Index,
Int64Index,
NaT,
Timedelta,
TimedeltaIndex,
timedelta_range,
)
import pandas._testing as tm
class TestTimedeltaIndex:
def test_astype_object(self):
id... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
from __future__ import unicode_literals
from .subtitles import SubtitlesInfoExtractor
from .common import InfoExtractor
from ..utils import (
fix_xml_ampersands,
parse_duration,
qualities,
strip_jsonp,
unified_strdate,
url_basename,
)
class NPOBaseIE(SubtitlesInfoExtractor):
def _get_toke... |
"""
Copyright 2020 Kat Holt
Copyright 2020 Ryan Wick (rrwick@gmail.com)
https://github.com/katholt/Kleborate/
This file is part of Kleborate. Kleborate 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 versi... |
from django.conf import settings
from django.contrib import messages
from auth.forms.settings.avatar import AvatarForm
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_... |
__all__ = ('Queue', 'PriorityQueue', 'LifoQueue', 'QueueFull', 'QueueEmpty')
import collections
import heapq
from . import events
from . import locks
class QueueEmpty(Exception):
"""Raised when Queue.get_nowait() is called on an empty Queue."""
pass
class QueueFull(Exception):
"""Raised... |
# Copyright 2018 AT&T Intellectual Property. All other 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.