code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-01 02:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0008_product_branch'),
]
operations = [
migrations.RemoveField(
... | jojoriveraa/titulacion-NFCOW | NFCow/products/migrations/0009_remove_product_branch.py | Python | apache-2.0 | 388 |
import ftplib
import logging
from io import BytesIO
from os.path import join
from urllib.error import URLError
from urllib.parse import urlparse
from urllib.request import urlopen
import cachecontrol.caches
import numpy as np
import requests
from PIL import ImageFile
from PIL.Image import LANCZOS
from PIL.Image import... | biolab/orange3-imageanalytics | orangecontrib/imageanalytics/utils/embedder_utils.py | Python | gpl-3.0 | 3,000 |
#!/bin/python
import serial, sys, time
config = {
'serial' : {
'port' : {
'printer' : "/dev/ttyACM0",
'arduino' : "/dev/ttyACM1"
},
'speed' : 115200,
'timeout' : 2, # seconds
'eol' : "\n\r"
},
'printer' : {
'command_delay': 0.02, # seconds
'general_gcode': 'G91',
'ext... | tchapi/RepRapMC | reprap-mc.py | Python | mit | 4,419 |
"""Dominoes most basic computer player
This player just puts any available tile. You may use this file to create
your own player.
"""
from ai import *
class player1:
def __init__(self, dealed_tiles):
self.tiles = dealed_tiles
self.knowledge = []
self.knowledge.append(put_any_double())
... | 3oheme/dominous | player_basic.py | Python | gpl-3.0 | 1,026 |
# -*- coding: utf-8 -*-
from bpy.types import PropertyGroup
from bpy.props import StringProperty, IntProperty, BoolProperty, FloatProperty, FloatVectorProperty
from mmd_tools.core.bone import FnBone
def _updateMMDBoneAdditionalTransform(prop, context):
prop['is_additional_transform_dirty'] = True
p_bone = co... | lordscales91/blender_mmd_tools | mmd_tools/properties/bone.py | Python | mit | 4,418 |
# -*- coding: utf-8 -*-
# Copyright 2009-2015 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 l... | felixonmars/mongo-python-driver | test/test_collection.py | Python | apache-2.0 | 66,325 |
"""
Array to a Feature Class - OGR Compilant
"""
from osgeo import ogr
def ogr_btw_driver(inShp, outShp, supportForSpatialLite=None):
"""
Convert a vectorial file to another ogr driver
Set supportForSpatialLite to True if outShp is a sqlite db and if you
want SpatialLite support for that database... | JoaquimPatriarca/senpy-for-gis | gasp/toshp/gdal.py | Python | gpl-3.0 | 7,217 |
r"""OS routines for Mac, NT, or Posix depending on what system we're on.
This exports:
- all functions from posix, nt or ce, e.g. unlink, stat, etc.
- os.path is either posixpath or ntpath
- os.name is either 'posix', 'nt' or 'ce'.
- os.curdir is a string representing the current directory ('.' or ':')
... | seet61/one | v2/os.py | Python | bsd-2-clause | 34,596 |
from django.utils import timezone
from django.views import generic
from django.shortcuts import render
from events.models import Event
# home page
class IndexView(generic.ListView):
template_name = 'mysite/index.html'
def get_queryset(self):
return Event.objects.filter(
event_time__gte=... | cs98jrb/Trinity | mysite/accounts/views/index.py | Python | gpl-2.0 | 577 |
from django.contrib.auth.models import Group
from django.contrib import messages
from django.shortcuts import render, redirect
from django.db import transaction
from jsonview.decorators import json_view
from airmozilla.base import mozillians
from airmozilla.manage import forms
from .decorators import (
staff_req... | tannishk/airmozilla | airmozilla/manage/views/groups.py | Python | bsd-3-clause | 2,799 |
import re
import os.path
import sys
from netaddr import *
from pprint import pprint as pp
import mysql.connector
from datetime import datetime
import configparser as ConfigParser
"""
This script is pretty lazy, and will just add ips all day.
Uses mysql at the end to actually make sure each record is only
in the db on... | allmightyspiff/domainThing | subnetToSQL.py | Python | mit | 2,715 |
#coding=UTF-8
'''
Created on 2011-7-6
@author: Administrator
'''
from urlparse import urlparse
import cookielib
from pyquery.pyquery import PyQuery #@UnresolvedImport
import re
import datetime #@UnusedImport
import urllib2
from lxml import etree #@UnresolvedImport
from lxml.cssselect import CSSSelector #@Unresolv... | ptphp/PyLib | src/webpy1/src/spider/ganji.py | Python | apache-2.0 | 38,456 |
from __future__ import absolute_import
from six import text_type
from typing import Any, Union, Mapping, Optional
from django.conf import settings
from django.utils import timezone
from django.contrib.sessions.models import Session as djSession
import sockjs.tornado
from sockjs.tornado.session import ConnectionInfo
... | paxapy/zulip | zerver/lib/socket.py | Python | apache-2.0 | 13,348 |
import logging
import os.path
import sys
import time
dirname = os.path.dirname(os.path.abspath(__file__))
sys.path.append(dirname)
sys.path.append(os.path.join(dirname, '..'))
from cassandra.cluster import Cluster
from cassandra.io.asyncorereactor import AsyncoreConnection
from cassandra.query import SimpleStatement
... | aholmberg/python-driver | benchmarks/base.py | Python | apache-2.0 | 2,702 |
#!/usr/bin/env python
# Copyright 2014 RethinkDB, all rights reserved.
from __future__ import print_function
import os, pprint, sys, time, threading, traceback
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse
r = ut... | urandu/rethinkdb | test/interface/system_changefeeds.py | Python | agpl-3.0 | 5,839 |
import unittest
from test_initializer import TestInitializer
from page_objects import LoginPage, EditExercisePage, CourseName
class EditExercisePageTest(unittest.TestCase):
def setUp(self):
self.driver = TestInitializer().getDefaultDriver()
TestInitializer().recreateDatabase()
LoginPage(s... | Aalto-LeTech/a-plus | selenium_test/test/edit_exercise_page_test.py | Python | gpl-3.0 | 1,406 |
import os
import config.settings as settings
import config.paths as paths
import maya.standalone as std
import maya.cmds as cmds
import maya.mel as mel
from utils.maya_connector import MayaConnector
from utils.list_utils import ListUtils
from model_base import ModelBase
class TextureMap(ModelBase):
def __init__(self... | caedocha/sceneTasks | lib/models/texture_map.py | Python | gpl-2.0 | 2,346 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='mdotdevs',
version='0.1',
packages=['mdotdevs'],
inclu... | uw-it-aca/mdot-developers | setup.py | Python | apache-2.0 | 1,212 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register(r'picture', views.PictureViewSet)
urlpatterns = patterns(
'',
url(r'^', include(router.urls)),
)
| scailer/picarchive | apps/picture/urls.py | Python | mit | 289 |
T = int(raw_input())
for i in range(T):
N = int(raw_input())
dolls = {}
for j in range(N):
a = int(raw_input())
if dolls.get(a,0):
dolls[a] += 1
else:
dolls[a] = 1
for key in dolls:
if dolls[key] % 2:
print key
break
... | rohit91/codechef | codechef/MISSP.py | Python | gpl-2.0 | 324 |
import re
import sys
import traceback
import time
import fcntl
import random
import datetime
import uuid
import functools
from pandaserver.brokerage import ErrorCode
from pandaserver.taskbuffer import ProcessGroups
from pandaserver.dataservice import DataServiceUtils
from pandaserver.dataservice.DataServiceUtils import... | PanDAWMS/panda-server | pandaserver/brokerage/broker.py | Python | apache-2.0 | 93,553 |
from cmath import *
import os
import math
import sys
import time
import subprocess
import string
import getopt
from numpy import zeros, eye
import uuid
i = j = 1j
"""
File that prepares the input and reads the output from the .exe executable file.
The executable contains a Convex semidefinite programming code, that i... | DiCarloLab-Delft/PycQED_py3 | pycqed/analysis_v2/pytomo.py | Python | mit | 32,252 |
# -*- coding: 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):
db.create_index('sentry_groupbookmark', ['user_id', 'group_id'])
def backwards(self, orm):
db.delete_in... | NickPresta/sentry | src/sentry/migrations/0075_add_groupbookmark_index.py | Python | bsd-3-clause | 21,478 |
# 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):
# Adding field 'Thread.title'
db.add_column('askbot_thread', 'title', self.gf('django.db.models.fields.CharField')... | divio/askbot-devel | askbot/migrations/0081_transplant_title_1.py | Python | gpl-3.0 | 26,914 |
import should_be.all # noqa
import unittest
class TestContainerMixin(unittest.TestCase):
def setUp(self):
self.lst = [1, 2, 3]
def test_should_include_iter(self):
err_msg = (r'[a-zA-Z0-9.]+ should have included \[.+?\]'
r', but did not have items .+')
self.assertRa... | DirectXMan12/should_be | should_be/tests/test_container_mixin.py | Python | isc | 1,254 |
import json
import os
from flask import Flask, Response
from flask.ext.httpauth import HTTPBasicAuth
from flask.ext.login import current_user, LoginManager
from flask.ext.mongoengine import MongoEngine
from flask.ext.principal import Principal, identity_loaded,\
Permission, RoleNeed, UserNeed
from flask.ext.sqlalc... | jvazquez/organization | organization/__init__.py | Python | unlicense | 3,087 |
from .utils import PyKEArgumentHelpFormatter
from . import kepmsg, kepio, kepkey, kepplot
import re
import numpy as np
from astropy.io import fits as pyfits
from scipy import optimize as opt
from matplotlib import pyplot as plt
from tqdm import tqdm
import random
__all__ = ['keppca']
def keppca(infile, outfile=None... | gully/PyKE | pyke/keppca.py | Python | mit | 36,295 |
#!../bin/python
# -*- coding: utf-8 -*-
import nuka
from nuka.hosts import Cloud
from nuka.tasks import shell
nuka.config['gce'] = {
'driver': '~/.gce/nuka.json',
'user': 'gawel',
'create_node_args': {
'size': 'f1-micro',
'image': 'debian-8-jessie-v20161215',
'location': 'europe-wes... | bearstech/nuka | examples/gce.py | Python | gpl-3.0 | 1,359 |
"""The gene_features module generates a DB table for features
like gene length and misc. features from the MutSigCV paper (fig s5).
The MutSigCV paper can be found here:
http://www.nature.com/nature/journal/v499/n7457/full/nature12213.html
The MutSigCV paper suggested that the background mutation rate for genes i... | KarchinLab/2020plus | src/savedb/python/gene_features.py | Python | apache-2.0 | 4,824 |
from . import meta_selector # noqa
from .pg import PatternGenerator
from .selector import Selector
PatternGenerator('')
Selector('')
| stack-of-tasks/sot-pattern-generator | src/dynamic_graph/sot/pattern_generator/__init__.py | Python | isc | 136 |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
from django.conf import settings
from models import FilerLinkPlugin
class FilerLinkPlugin(CMSPluginBase):
module = 'Filer'
model = FilerLinkPlugin
name = _("Link")
text_... | pbs/cmsplugin-filer | cmsplugin_filer_link/cms_plugins.py | Python | bsd-3-clause | 1,138 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_outline05.py | Python | bsd-2-clause | 3,191 |
from r_support import *
from loda_support import *
from test_setups import *
from alad import *
def test_load_model_csv(opts):
opts.set_multi_run_options(1, 1)
modelmanager = ModelManager.get_model_manager("csv")
model = modelmanager.load_model(opts)
print "model loaded..."
def test_load_data(args):... | shubhomoydas/pyaad | pyalad/unit_tests.py | Python | mit | 6,173 |
# 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 t... | sebrandon1/nova | nova/tests/functional/wsgi/test_servers.py | Python | apache-2.0 | 7,356 |
def shell_sort(lst):
"""
shell sort
"""
n = len(lst)
gap = n // 2
while gap:
for i in range(gap, n):
for j in range(i - gap, -1, -gap):
if lst[j + gap] < lst[j]:
lst[j + gap], lst[j] = lst[j], lst[j + gap]
else:
... | luoshao23/ML_algorithm | Sorting/shell_sort.py | Python | mit | 787 |
"""Stdout module."""
from __future__ import print_function, absolute_import
import logging
import click
from swak.plugin import Output
from swak.formatter import Formatter, StdoutFormatter
from swak.buffer import Buffer
from swak.memorybuffer import MemoryBuffer, DEFAULT_CHUNK_MAX_RECORD,\
DEFAULT_CHUNK_MAX_SIZE... | haje01/swak | swak/stdplugins/stdout/o_stdout.py | Python | mit | 3,058 |
#!/usr/bin/python
# vim:set ts=4 sw=4 expandtab:
import os
import sys
import shutil
import optparse
import errno
import glob
import re
from distutils.sysconfig import get_python_lib
import napkin.version
parser = optparse.OptionParser(version=napkin.version.__version__)
parser.add_option("--prefix", action="store", ... | dhozac/napkin | setup.py | Python | gpl-3.0 | 5,021 |
# 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... | nikesh-mahalka/nova | nova/objects/instance_pci_requests.py | Python | apache-2.0 | 6,320 |
from setuptools import setup, find_packages
from os.path import join, dirname
setup(
name="fant_sizer",
version="0.7",
author="Rypiuk Oleksandr",
author_email="ripiuk96@gmail.com",
description="fant_sizer command-line file-information",
url="https://github.com/ripiuk/fan... | ripiuk/fant_sizer | setup.py | Python | mit | 1,096 |
# Sample script using YajlParser
# https://github.com/pykler/yajl-py/blob/master/examples/yajl_py_example.py
# Be aware it might take some time to parse large files.
import os
import sys
BASEPATH = os.path.dirname(os.path.realpath(__file__))
sys.path = [BASEPATH, '%s/..' %BASEPATH] + sys.path
from yajl import YajlCon... | algarecu/PlottingJSON | yajl_py_example.py | Python | gpl-2.0 | 1,979 |
# Authors: Simo Sorce <ssorce@redhat.com>
#
# Copyright (C) 2007 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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... | tbabej/freeipa | ipaserver/install/installutils.py | Python | gpl-3.0 | 48,113 |
"""
********************************************************************************
Learn Python the Hard Way Third Edition, by
Zed A. Shaw
ISBN: 978-0321884916
********************************************************************************
"""
# A mini-console game; to be completed
import time #modu... | msnorm/projects | zspy2/ex36/ex36.py | Python | mit | 8,354 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
blast2demPro.py
---------------------
Date : October 2014
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
**************... | AsgerPetersen/QGIS | python/plugins/processing/algs/lidar/lastools/blast2demPro.py | Python | gpl-2.0 | 4,005 |
#!/usr/bin/env python
from __future__ import division
import sys
import datetime
import time
import tarfile
start = time.time()
def log(output):
global start
now = datetime.datetime.utcfromtimestamp(time.time() - start)
sys.stderr.write("[%s] %s" % (now.strftime("%H:%M:%S"), output))
sys.stderr.flush()
def un... | ut-planteco/ssu-pipeline | console.py | Python | gpl-3.0 | 404 |
"""
This module contains celery task functions for handling the sending of bulk email
to a course.
"""
import re
import random
import json
from time import sleep
from dogapi import dog_stats_api
from smtplib import SMTPServerDisconnected, SMTPDataError, SMTPConnectError, SMTPException
from boto.ses.exceptions import (... | hkawasaki/kawasaki-aio8-1 | lms/djangoapps/bulk_email/tasks.py | Python | agpl-3.0 | 33,434 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Generic libs
import sys
# Framework modules
from bottle import app, run
# Application modules
from src.app.middleware import CustomApp
import src.app.routes
# Run application on port provided from cmd (heroku), use gunicorn server
run(app=CustomApp(app()), server='gu... | Xifax/suzu-web | suzu.py | Python | bsd-2-clause | 363 |
# Copyright 2022 Google.
#
# 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, soft... | google-research/prompt-tuning | prompt_tuning/train/__init__.py | Python | apache-2.0 | 572 |
# Copyright (C) 2013 Cisco Systems Inc.
# All rights reserved
#$Id: eor_utils.py,v 1.427 2013/06/24 23:56:03 venksrin Exp $
#ident $Source: /cvsroot/eor/systest/lib/eor_utils.py,v $ $Revision: 1.427 $
# Best Pratices for get() functions:
# 1. Use class rex as much as possible for standard regular expressions
# 2. Use... | fmichalo/n9k-programmability | Python nxapi scripts/utils/nxos_utils.py | Python | apache-2.0 | 27,716 |
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
def downsample_with_randomforest(rs_variables,target_variable,n_trees_in_forest = 100, min_samples_leaf = 50, n_cores = 1):
print "\t downsampling with random forest regression"
# first of... | DTMilodowski/SPA_tools | construct_drivers/downscale_rs_data_random_forests.py | Python | gpl-3.0 | 1,110 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | google/sample-sql-translator | sql_parser/expr_op.py | Python | apache-2.0 | 15,201 |
# -*- coding: utf-8 -*-
"""Implementations of feature tracking methods."""
from pysteps.tracking.interface import get_method
| pySTEPS/pysteps | pysteps/tracking/__init__.py | Python | bsd-3-clause | 126 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def lowestCommonAncestor(self, root, p, q):
"""
:type root: TreeNode
:type p: TreeNode
:t... | zqfan/leetcode | algorithms/235. Lowest Common Ancestor of a Binary Search Tree/solution.py | Python | gpl-3.0 | 517 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...styles import Styles
class TestWriteCellStyles(unittest.TestCase):
"""
Test... | liukaijv/XlsxWriter | xlsxwriter/test/styles/test_write_cell_styles.py | Python | bsd-2-clause | 804 |
from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase, APIClient
class SnippetTests(APITestCase):
def test_create_invalid_snippet(self):
self.client = APIClient()
self.client.login(username="rodrigo", password="hola123")
url = reverse('snippet-list')
... | rodrigorn/rest_demo | restapp/tests.py | Python | mit | 577 |
#!/bin/env python
# -*- coding: utf-8 -*-
from __init__ import app
app.run(debug = True)
| tieugene/uvedomlenie | run.py | Python | gpl-3.0 | 90 |
"""Classes that determine convergence of an algorithm run
based on population stagnation or max raw score reached"""
class Convergence(object):
"""
Base class for all convergence object to be based on.
It is necessary to supply the population instance, to be
able to obtain current and former populatio... | suttond/MODOI | ase/ga/convergence.py | Python | lgpl-3.0 | 3,442 |
#!/usr/bin/env python
import re
import string
from collections import Counter, OrderedDict
checksum_pattern = re.compile(r'(?P<name>[a-z\-]+)(?P<id>\d+)\[(?P<checksum>[a-z]+)\]')
def is_real_room(s):
match = checksum_pattern.match(s)
d = match.groupdict()
name = d['name']
name = name.replace('-', '')
... | lnunno/advent-of-code-2016 | day04/checksum.py | Python | mit | 1,697 |
from collections import namedtuple
from blocks.models import Toolbox
from practice.models import StudentModel
from practice.models import StudentTaskInfoModel
from practice.services.statistics_service import percentil as compute_percentil
def get_statistics_for_user(user):
student = StudentModel.objects.get_or_c... | MatheusArrudaLab/flocos | stats/services/student_statistics.py | Python | gpl-2.0 | 3,092 |
#!/usr/bin/env 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 ... | erock2112/python-adb | adb/fastboot_debug.py | Python | apache-2.0 | 1,825 |
import MDAnalysis
import matplotlib.pyplot as plt
import numpy as np
from MDAnalysis.analysis.align import *
from MDAnalysis.analysis.rms import rmsd
def ligRMSD(u,ref):
"""
This function produces RMSD data and plots for ligand.
:input
1) Universe of Trajectory
2) reference universe
:... | mktumbi/SimAnaRep | SimRepAnaligRMSD.py | Python | gpl-2.0 | 2,124 |
from django.conf import settings
from django.test import TestCase
from haystack import connections, connection_router
from haystack.query import SearchQuerySet
from haystack.utils.loading import UnifiedIndex
from discovery.models import Foo
from discovery.search_indexes import FooIndex, BarIndex
class ManualDiscovery... | gregplaysguitar/django-haystack | tests/discovery/tests.py | Python | bsd-3-clause | 2,353 |
"""Python script to measure temperature, humidity and CO2 concentration with a Raspberry Pi.
A SHT21 sensor and a MCP3424 analog digital converter are connected to gpio pins, i.e. to the I2C bus.
The BayEOSGatewayClient class is extended to transfer data to the BayEOSGateway.
The sender runs in a separate process. Orig... | kleebaum/bayeosraspberrypi | bayeosraspberrypi/bayeosraspberrypiclient.py | Python | gpl-2.0 | 3,774 |
__all__ = ('AuthenticationError', 'TwoFactorError', 'UnexpectedError')
class AuthenticationError(Exception):
pass
class TwoFactorError(AuthenticationError):
pass
class UnexpectedError(RuntimeError):
pass
| Tatsh/youtube-unofficial | youtube_unofficial/exceptions.py | Python | mit | 222 |
# Copyright 2014 Mark Chilenski
# This program is distributed under the terms of the GNU General Purpose License (GPL).
# Refer to http://www.gnu.org/licenses/gpl.txt
#
# 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 Fr... | markchil/gptools | gptools/error_handling.py | Python | gpl-3.0 | 1,176 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | adviti/melange | thirdparty/google_appengine/google/appengine/api/prospective_search/prospective_search_pb.py | Python | apache-2.0 | 60,260 |
#!/usr/bin/env python3
# python setup.py sdist --format=zip,gztar
import os
import sys
import platform
import importlib.util
import argparse
import subprocess
from setuptools import setup, find_packages
from setuptools.command.install import install
MIN_PYTHON_VERSION = "3.6.1"
_min_python_version_tuple = tuple(map... | fujicoin/electrum-fjc | setup.py | Python | mit | 3,023 |
from __future__ import print_function, division
import warnings
from itertools import permutations
import hmmlearn.hmm
import numpy as np
from msmbuilder.example_datasets import AlanineDipeptide
from msmbuilder.featurizer import SuperposeFeaturizer
from msmbuilder.hmm import GaussianHMM
rs = np.random.RandomState(4... | mpharrigan/mixtape | msmbuilder/tests/test_ghmm.py | Python | lgpl-2.1 | 5,095 |
import warnings
from django.conf import settings
from django.template import Context, Template
from django.template.loader import render_to_string
from django.utils import six
from django.utils.html import conditional_escape
from crispy_forms.utils import render_field, flatatt
TEMPLATE_PACK = getattr(settings, 'CRIS... | uranusjr/django-crispy-forms-ng | crispy_forms/layout.py | Python | mit | 15,616 |
# -*- coding: utf-8 -*-
# Copyright (C) 2016 KMEE (http://www.kmee.com.br)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
class AccountMove(models.Model):
_inherit = "account.move"
payslip_id = fields.Many2one(
comodel_name="hr.payslip",
... | kmee/odoo-brazil-hr | l10n_br_hr_payroll_account/models/account_move.py | Python | agpl-3.0 | 1,158 |
"""nose tests"""
from keypool import KeypoolDict, Keypool
from operator import delitem
import random
MAX_ITER = 10
def assert_unique(keys):
assert all([x == y for x,y in zip(sorted(set(keys)), sorted(keys))])
def test_init():
pool = Keypool(start=0)
dict = KeypoolDict()
assert dict == {}
de... | tyrannosaur/keypool | tests.py | Python | mit | 2,191 |
"""
General purpose XML library for CPython and IronPython
"""
#from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES
from setuptools import setup
for scheme in INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']
setup(name = "bridge",
version = '0.4.0',
... | Lawouach/bridge | setup.py | Python | bsd-3-clause | 792 |
#!/usr/bin/python
#
# DumbQ - A lightweight job scheduler - Metrics Library
# Copyright (C) 2014-2015 Ioannis Charalampidis, PH-SFT, CERN
# 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... | jvican/dumbq | client/utils/dumbq/metrics.py | Python | gpl-2.0 | 7,235 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | patrys/babel | babel/messages/tests/plurals.py | Python | bsd-3-clause | 742 |
# Copyright 2019 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... | renyi533/tensorflow | tensorflow/python/keras/layers/preprocessing/image_preprocessing_test.py | Python | apache-2.0 | 29,932 |
"""
WSGI config for Practice_Referral project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Practice_Referral.settings")... | Heteroskedastic/Dr-referral-tracker | Practice_Referral/wsgi.py | Python | mit | 409 |
"""
==============================================
The :mod:`mpi_array.globale_ufunc_test` Module
==============================================
Module defining :mod:`mpi_array.globale` unit-tests.
Execute as::
python -m mpi_array.globale_ufunc_test
and with parallelism::
mpirun -n 2 python -m mpi_array.glob... | mpi-array/mpi_array | mpi_array/globale_ufunc_test.py | Python | mit | 33,737 |
import atexit
from concurrent import futures
from dataclasses import dataclass
import grpc
import logging
from itertools import chain
import json
import psutil
import socket
import sys
from threading import Lock, Thread, RLock
import time
import traceback
from typing import Any, Callable, Dict, List, Optional, Tuple
i... | pcmoritz/ray-1 | python/ray/util/client/server/proxier.py | Python | apache-2.0 | 20,149 |
# 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
# "License"); you may not u... | Laurawly/tvm-1 | python/tvm/error.py | Python | apache-2.0 | 3,795 |
from ansiblelint import AnsibleLintRule
class ShellHasCreates(AnsibleLintRule):
id = 'E511'
shortdesc = 'Shell/command module must contain creates or removes'
description = ''
tags = ['shell']
def matchtask(self, file, task):
if task['action']['__ansible_module__'] not in ['shell', 'comman... | tsukinowasha/ansible-lint-rules | rules/ShellHasCreates.py | Python | mit | 522 |
# Copyright 2009 Google Inc. Released under the GPL v2
"""
This module defines the base classes for the Host hierarchy.
Implementation details:
You should import the "hosts" package instead of importing each type of host.
Host: a machine on which you can run programs
"""
__author__ = """
mbligh@google.com (... | wuzhy/autotest | client/common_lib/hosts/base_classes.py | Python | gpl-2.0 | 27,724 |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... | dstroppa/openstack-smartos-nova-grizzly | nova/compute/cells_api.py | Python | apache-2.0 | 28,581 |
# -*- coding: utf-8 -*-
import os
import httplib
import logging
import functools
from modularodm.exceptions import ValidationValueError
from framework.exceptions import HTTPError
from framework.analytics import update_counter
from website.addons.osfstorage import settings
logger = logging.getLogger(__name__)
LOCA... | ticklemepierce/osf.io | website/addons/osfstorage/utils.py | Python | apache-2.0 | 3,726 |
#!/usr/bin/python2.5
"""
MasterChess library - Mac OS X QuickLook generator
Copyright (C) 2013 Jake Hartz
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 ... | jhartz/masterchess | QuickLook.py | Python | gpl-3.0 | 4,057 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine (xbmcmegapack@gmail.com)
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 Softwar... | xbmcmegapack/plugin.video.megapack.dev | resources/lib/menus/home_languages_walloon.py | Python | gpl-3.0 | 1,111 |
from mediawords.db import connect_to_db
from webapp.auth.register import add_user
from webapp.auth.reset_password import send_password_reset_token
from webapp.auth.user import NewUser
from webapp.test.dummy_emails import TestDoNotSendEmails
class TestResetPassword(TestDoNotSendEmails):
def test_send_password_res... | berkmancenter/mediacloud | apps/webapp-api/tests/python/auth/reset_password/test_send_password_reset_token.py | Python | agpl-3.0 | 1,341 |
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Usage: python high_level_mnist_export.py {dest dir}
import os
import sys
import numpy.random as npr
from examples import datasets
fro... | google/iree-samples | iree-jax/examples/staged_mnist_export.py | Python | apache-2.0 | 4,638 |
#!/usr/bin/env python
from sys import exit
from os import environ
environ['KERAS_BACKEND'] = 'theano'
import numpy as np
from functools import partial
from tqdm import tqdm
from utils import *
from keras.layers import Input, Dense, Dropout, Activation, concatenate
from keras.models import Model
from keras.callb... | sidnarayanan/BAdNet | train/hlf/train_gan.py | Python | mit | 8,736 |
# 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... | tylertian/Openstack | openstack F/cinder/cinder/volume/iscsi.py | Python | apache-2.0 | 7,764 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# notic... | turon/openthread | tools/harness-automation/cases/sed_6_1_2.py | Python | bsd-3-clause | 1,872 |
import os
import argparse
import os.path as op
import shutil
from collections import namedtuple
import pysam
try:
from seqcluster import prepare_data as prepare
from seqcluster import make_clusters as main_cluster
from seqcluster.libs.inputs import parse_ma_file
from seqcluster.libs import parse
excep... | fw1121/bcbio-nextgen | bcbio/srna/group.py | Python | mit | 3,686 |
from django.db import models
from django import forms
class TemplateFormField(forms.CharField):
def clean(self, value):
"""
Validates that the input can be compiled as a template.
"""
value = super(TemplateFormField, self).clean(value)
from django.template import Template, ... | praekelt/django-form-designer | form_designer/template_field.py | Python | bsd-3-clause | 1,188 |
'''
Created on 14/05/2013
@author: diogo
'''
from model.cache import Cache
from model.file import File
from model.frequency import Frequency
from model.log import Log
from random import choice, uniform
from copy import deepcopy
class Main(object):
'''
Principal controller of the application
'''
def ... | dcc-ufrj/SimuCache | simucache/controller/main.py | Python | gpl-3.0 | 6,144 |
# Copyright 2016, 2017 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 la... | googlei18n/language-resources | utils/merge_lexicons.py | Python | apache-2.0 | 1,863 |
import datetime
from io import StringIO
from unittest import mock
from contexts.plugins.reporting import cli
class WhenPrintingFinalCountsForAnEmptyRun:
def context(self):
self.stringio = StringIO()
self.reporter = cli.FinalCountsReporter(self.stringio)
def because_a_test_run_ends(self):
... | benjamin-hodgson/Contexts | test/plugin_tests/reporting_tests/cli_tests.py | Python | mit | 4,698 |
from hyo2.soundspeedsettings import gui
gui.gui()
| hydroffice/hyo_soundspeed | hyo2/soundspeedsettings/__main__.py | Python | lgpl-2.1 | 51 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "labs_django.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| heldergg/labs | labs_django/manage.py | Python | gpl-3.0 | 254 |
#!/usr/bin/env python
#
# Copyright (c) 2008-2009 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You sho... | jessegonzalez/grinder | setup.py | Python | gpl-2.0 | 1,714 |
# -*- 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
#... | Fokko/incubator-airflow | airflow/operators/bigquery_to_bigquery.py | Python | apache-2.0 | 5,756 |
#!/usr/bin/env python
#
# backend for serial IO for POSIX compatible systems, like Linux, OSX
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C) 2001-2016 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
#
# parts based on code from Grant B. Edwards <grante@visi.... | gepd/uPiotMicroPythonTool | tools/pyserial/serialposix.py | Python | mit | 31,982 |
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.core.cache import cache
from django.test import TestCase
from django_browserid.auth import default_username_algo
from commons.urlresolvers import reverse
from projects.models import Project
from topics.models import Topi... | mozilla/betafarm | apps/users/tests/test_profiles.py | Python | bsd-3-clause | 7,511 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.