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 |
|---|---|---|---|---|---|
import sys
import glob
import serial
import json
from datetime import datetime
import random
import time
class OutOfRangeError(Exception):
def __init__(self, name="sensor reading", value=0):
self.name = name
self.value = value
def __repr__(self):
return (f"the reading of {self.name} is ... | mone27/deware | deware/core/utilis.py | Python | gpl-3.0 | 1,882 |
from os import environ
MY_NUMBER = environ['MY_NUMBER']
MY_NAME = environ['MY_NAME']
| hwayne/safehouse | contact/env.py | Python | apache-2.0 | 86 |
# Copyright 2016 OpenStack Foundation.
#
# 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 ... | openstack/murano | murano/db/migration/alembic_migrations/versions/014_increase_status_time_resolution.py | Python | apache-2.0 | 1,863 |
#/******************************************************************************
#* Portions Copyright (C) 2007 Novell, 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:
#*
#* - Redistributio... | ClodoCorp/debian-ganglia | gmond/python_modules/network/tcpconn.py | Python | bsd-3-clause | 12,782 |
from cerberus import Validator
def keys_and_values_are_strings(d):
"""
Checks to see if the keys and values of this dict are strings.
:param d: The Dictionary to check
:return: Boolean, True if all the keys and values are strings.
"""
schema = {
'a_dict': {
'keyschema': {'t... | chrisbrake/PythonSandbox | sanitiser/sanitiser.py | Python | bsd-3-clause | 453 |
"""Authentication testing resources."""
__copyright__ = "Copyright (C) 2014 Ivan D Vasin"
__docformat__ = "restructuredtext"
import bedframe as _bedframe
import bedframe.auth as _bedframe_auth
import bedframe.webtypes as _webtypes
class Welcome(_bedframe.WebResource):
@_bedframe.webmethod(auth_provisions=_webt... | nisavid/testbed | testbed/resources/_auth.py | Python | lgpl-3.0 | 736 |
#Exercise 21: Functions can Return Something
def add (a, b):
print "ADDING %d + %d" % (a, b)
return a + b
def subtract(a, b):
print "SUBTRACTING %d - %d" % (a, b)
return a - b
def multiply(a, b):
print "MULTIPLYING %d * %d" % (a, b)
return a * b
def divide(a, b):
print "DIVIDING %d / %d" % (a, b... | jessehagberg/python-playground | ex21.py | Python | cc0-1.0 | 977 |
from django.contrib.sitemaps import Sitemap
from merchandise.music.models import Album, Single, Track
from people.constants import STATUS
from people.models import Group, Idol
class BaseSitemap(Sitemap):
changefreq = 'daily'
def lastmod(self, obj):
return obj.modified
class AlbumSitemap(BaseSitema... | hello-base/web | apps/sitemaps.py | Python | apache-2.0 | 1,036 |
import decimal
from decimal import Decimal
from unittest import TestCase
from StringIO import StringIO
import simplejson as json
class TestDecimal(TestCase):
NUMS = "1.0", "10.00", "1.1", "1234567890.1234567890", "500"
def dumps(self, obj, **kw):
sio = StringIO()
json.dump(obj, sio, **kw)
... | sauloal/cufflinksviewer | venvwin/Lib/site-packages/simplejson-2.6.2-py2.7.egg/simplejson/tests/test_decimal.py | Python | mit | 2,357 |
__author__ = 'Conscience'
from django.conf.urls import url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^$', views.post_list, name='post_list'),
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail, name='post_detail'),
url(r'^post/$', views.post_list, name='post_list'),
url(r... | Rivares/MyBlog | blog/urls.py | Python | apache-2.0 | 446 |
# utf-8
import re
import requests
import configparser
from pathlib import Path
from twython import Twython, TwythonError
from wand.image import Image
class TweetProvider:
is_text_empty = True
photo = None
text = None
special = False
def __init__(self, twitter, tweet):
assert isinstance(tw... | kuboktaeder/mockbot | localclasses.py | Python | agpl-3.0 | 5,508 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/transfer_user_address_in_request.py | Python | mit | 7,478 |
"""
kombu.pidbox
===============
Generic process mailbox.
"""
from __future__ import absolute_import, unicode_literals
import socket
import warnings
from collections import defaultdict, deque
from contextlib import contextmanager
from copy import copy
from itertools import count
from threading import local
from tim... | Elastica/kombu | kombu/pidbox.py | Python | bsd-3-clause | 13,438 |
# 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... | zozo123/buildbot | master/buildbot/test/unit/test_scripts_start.py | Python | gpl-3.0 | 4,104 |
"""Setup file for the s3bp package."""
# This file is part of s3bp.
# https://github.com/shaypal5/s3bp
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2016, Shay Palachy <shaypal5@gmail.com>
from setuptools import setup, find_packages
import versioneer
setup(
n... | shaypal5/s3bp | setup.py | Python | mit | 920 |
import time
import hashlib
import isodate
import logging
from util import *
from twisted.internet import task
from twisted.internet.defer import inlineCallbacks, returnValue
from autobahn.websocket import WebSocketServerProtocol, WebSocketServerFactory
from autobahn.resource import WebSocketResource
SEND_REGISTRATION... | egbertbouman/billy | server/radio.py | Python | mit | 7,871 |
# ***************************************************************************
# * (c) 2020 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... | sanguinariojoe/FreeCAD | src/Mod/Draft/draftutils/messages.py | Python | lgpl-2.1 | 2,740 |
#!/usr/bin/env python
# encoding: utf-8
"""
Utility script to generate/modify Firebreath plug-in projects.
Original Author(s): Ben Loveridge, Richard Bateman
Created: 14 December 2009
License: Dual license model; choose one of two:
New BSD License
http://www.opensource.org/licenses/bsd-li... | eSDK/esdk_uc_control_js | open_src/firebreath/fbgen.py | Python | apache-2.0 | 7,056 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of c... | faribas/RMG-Py | rmgpy/data/rmg.py | Python | mit | 8,998 |
# 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/.
import re
def to_rust_ident(name):
name = name.replace("-", "_")
if name in ["static", "super", "box", "move"]... | sliz1/servo | components/style/properties/data.py | Python | mpl-2.0 | 7,031 |
import time
import os
import sys
try:
iterations = int(sys.argv[1])
except:
iterations = 10
try:
file = sys.argv[2]
testFile = open(file, "r")
testFile.close()
except:
file = "test.txt"
times = []
messages = []
messages.append("Selected test file: " + file)
messages.append("")
def display(i... | 0xGREG/MACparser | test.py | Python | gpl-3.0 | 1,317 |
''' Tests for netcdf '''
from __future__ import division, print_function, absolute_import
import os
from os.path import join as pjoin, dirname
import shutil
import tempfile
import warnings
from io import BytesIO
from glob import glob
from contextlib import contextmanager
import numpy as np
from numpy.testing import (... | jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/io/tests/test_netcdf.py | Python | mit | 10,833 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['MovingAverage'] , ['Seasonal_MonthOfYear'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_MovingAverage_Seasonal_MonthOfYear_MLP.py | Python | bsd-3-clause | 163 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
PredicatePanel.py
---------------------
Date : January 2015
Copyright : (C) 2015 by Arnaud Morvan
Email : arnaud dot morvan at camptocamp dot com
Con... | alexbruy/QGIS | python/plugins/processing/gui/GeometryPredicateSelectionPanel.py | Python | gpl-2.0 | 4,731 |
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All rights reserved.
#
# 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 withou... | lochiiconnectivity/boto | tests/integration/rds/test_cert_verification.py | Python | mit | 1,501 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import tendenci.apps.social_auth.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
... | alirizakeles/tendenci | tendenci/apps/social_auth/migrations/0001_initial.py | Python | gpl-3.0 | 2,008 |
# -*- coding: utf-8 -*-
from copy import deepcopy
from time import time
from django.conf import settings
from django.db.models import Q
from django.db.models.base import ModelBase
from django.utils import tree
from django.utils.encoding import force_unicode
from haystack.constants import DJANGO_CT, VALID_FILTERS, FILTE... | gregplaysguitar/django-haystack | haystack/backends/__init__.py | Python | bsd-3-clause | 26,733 |
from .models import MongoConnectionModel
from .fields import MongoField | kgritesh/django-mongo-connect-field | mongo_connect_field/__init__.py | Python | mit | 71 |
from sha3 import sha3_256
from ethereum.utils import big_endian_to_int
def sha3(seed):
return sha3_256(bytes(seed)).digest()
# colors
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def DEBUG(*args, **kargs):
print(FAIL + repr(args) + repr(kargs) + ENDC)
colors = ['\033[9%dm' % ... | HydraChain/hydrachain | hydrachain/consensus/utils.py | Python | mit | 750 |
class SuperClass(object):
def __init__(self):
pass
| caot/intellij-community | python/testData/refactoring/pullup/properties/SuperClass.py | Python | apache-2.0 | 63 |
#!/usr/bin/env python3
import numpy as np
import pandas as pd
import json
import treetaggerwrapper
import nltk
import string
import re
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
from sklearn import datasets
from sklearn.utils import shuffle
from skl... | drinky78/minosse | commenti.py | Python | mit | 7,376 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
import pyglet
class KeyDisplay(cocos.layer.Layer):
is_event_handler = True #: enable... | shadowmint/nwidget | lib/cocos2d-0.5.5/samples/handling_events.py | Python | apache-2.0 | 4,085 |
# --------------------------------------------------------
# Fully Convolutional Instance-aware Semantic Segmentation
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by Yi Li
# --------------------------------------------------------
from skimage.draw import p... | vincentlooi/FCIS | lib/utils/mask_voc2coco.py | Python | apache-2.0 | 1,803 |
"""
API's subpackage:
Tools for assist Django
"""
def open_Django_Proj(path_to_proj):
"""
To run methods related with django objects, we
need to make our python recognize the Django Project
"""
import os, sys
# This is so Django knows where to find stuff.
os.environ.setdefault(
... | JoaquimPatriarca/senpy-for-gis | gasp/djg/__init__.py | Python | gpl-3.0 | 1,455 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009-2011 Red Hat, 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
#
# Unle... | djw8605/htcondor | src/condor_contrib/mgmt/qmf/test/jobcontrol.py | Python | apache-2.0 | 1,434 |
pybabel extract -F babel.cfg -o messages.pot .
pybabel init -i messages.pot -d translations -l zh_Hans_CN
#pybabel update -i messages.pot -d translations
pybabel compile -d translations
| raysinensis/tcgaAPP | babelscript.py | Python | mit | 186 |
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
from utils import conv2d_flipkernel, adjecent_matrix, adjecent_sparse
def dot(x, y, sparse=False):
if sparse:
return tf.sparse_tensor_dense_matmul(x, y)
else:
return tf.matmul(x, y)
def kernel_net(coord, weight,... | sufengniu/GVIN | irregular/IL/model.py | Python | mit | 3,747 |
import time
import simplejson as json
import threading
import socket
from .request import Request, extended_decoder_hook
from .rpc_wrapper import RPCWrapper
from mfp.utils import QuittableThread
from mfp import log
from .worker_pool import WorkerPool
def blather(func):
from datetime import datetime
def inner(... | bgribble/mfp | mfp/rpc/rpc_host.py | Python | gpl-2.0 | 13,690 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("orgs", "0014_auto_20150722_1419")]
operations = [
migrations.CreateModel(
name="Bo... | rapidpro/ureport | ureport/locations/migrations/0001_initial.py | Python | agpl-3.0 | 2,060 |
# -*- coding: utf-8 -*-
from django.utils.translation import gettext as _
import plotly.offline as plotly
import plotly.graph_objs as go
from reports import utils
def diaperchange_lifetimes(changes):
"""
Create a graph showing how long diapers last (time between changes).
:param changes: a QuerySet of D... | cdubz/babybuddy | reports/graphs/diaperchange_lifetimes.py | Python | bsd-2-clause | 1,378 |
from datetime import date, timedelta
from django.contrib import admin
from django.test import TestCase
from .admin import CorporateMemberAdmin
from .models import CorporateMember
class CorporateMemberAdminTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.member = CorporateMember.objects.cre... | nanuxbe/django | members/test_admin.py | Python | bsd-3-clause | 1,432 |
import sys
import pymongo
import requests
import itertools
import genemania
from itertools import islice
from app.util import set_status, create_edges_index, cleanup_edges
from app.status import Status
import app
log = app.get_logger('humannet')
def parse(columns, metadata, lines):
status = Status('networks', lo... | ucsd-ccbb/Oncolist | src/restLayer/app/humannet.py | Python | mit | 6,211 |
import types
import croi
class AttrTest(object):
class_field0 = 'class_field'
class_field1 = 0
@classmethod
def class_method0(cls):
pass
@classmethod
def class_method1(cls):
pass
@property
def property0(self):
return 'property0'
@property
def propert... | dacjames/croi | croi/test/test_reflection.py | Python | mit | 1,617 |
"""an example a python console"""
import pygame
from pygame.locals import *
# the following line is not needed if pgu is installed
import sys; sys.path.insert(0, "..")
import traceback
from pgu import gui
from pgu import html
class StringStream:
def __init__(self):
self._data = ''
def write(self,da... | danstoner/python_experiments | pgu/examples/gui17.py | Python | gpl-2.0 | 1,557 |
__all__ = [
'AbstractBasicAuthHandler',
'AbstractDigestAuthHandler',
'BaseHandler',
'Browser',
'BrowserStateError',
'CacheFTPHandler',
'ContentTooShortError',
'Cookie',
'CookieJar',
'CookiePolicy',
'DefaultCookiePolicy',
'DefaultFactory',
'FTPHandler',
'Factory',
... | mzdaniel/oh-mainline | vendor/packages/mechanize/mechanize/__init__.py | Python | agpl-3.0 | 5,098 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2009 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of th... | apache/bloodhound | trac/trac/wiki/model.py | Python | apache-2.0 | 9,151 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# measurement.py
#
# Copyright 2014 Manu Varkey <manuvarkey@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 Software Foundation; either version 2 of ... | manuvarkey/GEstimator | estimator/data/measurement.py | Python | gpl-3.0 | 15,031 |
import bson.json_util
import json
from bson import ObjectId
import string
import tangelo
from os import listdir
from os.path import isfile, join
# start annotations as an empty dictionary, each type will have a key and its
# own dictionary indexed by name/identifier
annotations = dict()
annotations['entities'] = dic... | curtislisle/nanomaterial-dashboard | nanoUtilities/service/exportBratAnnotation.py | Python | apache-2.0 | 5,907 |
"""Tests for configuration provider linking."""
from dependency_injector import containers, providers
class Core(containers.DeclarativeContainer):
config = providers.Configuration("core")
value_getter = providers.Callable(lambda _: _, config.value)
class Services(containers.DeclarativeContainer):
conf... | rmk135/dependency_injector | tests/unit/providers/configuration/test_config_linking_py2_py3.py | Python | bsd-3-clause | 3,698 |
# imports
import pandas as pd
from sklearn import model_selection, preprocessing, metrics
import argparse
import torch
import torch.nn as nn
import numpy as np
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.data import DataLoader
# data, here we will us the movielens dataset of movie ranking
... | asengsta/DataScience | pytorch/train_model.py | Python | gpl-3.0 | 5,557 |
from __future__ import absolute_import
import inspect
import collections
import six
from six.moves import zip
TYPE_MAP = {
'complex64': 'complex', 'complex': 'complex',
'float32': 'float', 'float': 'float',
'int32': 'int', 'uint32': 'int',
'int16': 'short', 'uint16': 'short',
'int8': 'byte', 'u... | iohannez/gnuradio | grc/core/utils/epy_block_io.py | Python | gpl-3.0 | 3,687 |
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from aws import Action
service_name = 'AWS CloudFormation'
prefix = 'cloudformation'
class CloudformationAction(Action):
def __init__(self, action=None):
self.prefix = prefix
self.a... | craigbruce/awacs | awacs/cloudformation.py | Python | bsd-2-clause | 1,335 |
'''
Created on Dec 12, 2011
@author: sean
'''
from ..asttools import Visitor
import ast
#FIXME: add tests
class CopyVisitor(Visitor):
'''
Copy only ast nodes and lists
'''
def visitDefault(self, node):
Node = type(node)
new_node = Node()
for _field in Node._fields:
... | jasonyaw/SFrame | oss_src/unity/python/sframe/meta/asttools/visitors/copy_tree.py | Python | bsd-3-clause | 1,264 |
from stemming.porter2 import stem
from os import listdir
from os.path import isfile, join
from operator import itemgetter
import string
import sys
table = string.maketrans(string.punctuation+"0123456789", " ")
if len(sys.argv) != 2:
print "Usage: python main.py input_directory"... | TusharAgey/seventhsem | Info_Retrieval/main.py | Python | gpl-3.0 | 2,025 |
"""
Django settings for mosteit_django project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ... | mmosteit/django_forum | mosteit_django/settings.py | Python | gpl-3.0 | 2,027 |
#v+
#!/usr/bin/env python
import imaplib
import email
import imaplib
def checkMessages(incoming_server, user, password):
has_data = False
subject = ''
obj = imaplib.IMAP4_SSL(incoming_server, '993')
obj.login(user, password)
obj.select('Inbox')
typ ,data = obj.search(None,'UnSeen')
stri... | astronewts/Flight1 | misc/allaloft/groundstation/python/imap_stuff.py | Python | gpl-3.0 | 1,482 |
from unittest import TestCase
from sorting.merge import merge_list, merge_sort, merge_sort_recursive
class TestSortingMerge(TestCase):
def test_merge_list(self):
left = [1, 4, 6]
right = [2, 3, 5]
result = merge_list(left, right)
self.assertEquals(6, len(result))
for i in ... | narfman0/challenges | algorithms/tests/sorting/test_merge.py | Python | gpl-3.0 | 1,709 |
#!/usr/local/bin/python
import socket
import time
import exceptions as e
from config import *
def change_nick(irc)
irc.send("NICK " + cfg['botnick'] + "\r\n")
x = "_"
while("Nickname is already in use" in irc.recv(4096)):
irc.send("NICK " + nick + x + "\r\n")
x += "_"
time.sleep(1... | gerardduenas/geni | functions.py | Python | mit | 1,109 |
"""
Basic profiling code for working out where we're spending our time
Invoke with:
./manage.py shell -c 'from matrixstore.profile import profile; profile()'
Currently set up to profile the total spending code, but easy to adapt to
profile other functions (e.g. PPU savings - see commented out code)
"""
from cProfile ... | ebmdatalab/openprescribing | openprescribing/matrixstore/profile.py | Python | mit | 1,279 |
# -*- coding: utf-8 -*-
##############################################################################
#
# GNU Health: The Free Health and Hospital Information System
# Copyright (C) 2008-2013 Luis Falcon <falcon@gnu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under t... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/school/__init__.py | Python | gpl-3.0 | 1,280 |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class CycleTagTests(SimpleTestCase):
@setup({'cycle01': '{% cycle a %}'})
def test_cycle01(self):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle0... | Beauhurst/django | tests/template_tests/syntax_tests/test_cycle.py | Python | bsd-3-clause | 6,974 |
''' This script is prepared by Tyler Pubben and is licensed under the MIT license framework.
It is free to use and distribute however please reference http://www.tjscientific.com or my
GIT repository at https://github.com/tpubben/SequoiaStacking/'''
import numpy as np
import cv2
import os
def align_images(in... | tpubben/SequoiaStacking | parrotStacking.py | Python | mit | 3,776 |
import os
import logging
import shutil
import zipfile
import xmltodict
from osgeo import ogr, osr
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
from django.db import models, transaction
from django.utils.html import strip_tags
from django.template import T... | ResearchSoftwareInstitute/MyHPOM | hs_file_types/models/geofeature.py | Python | bsd-3-clause | 36,730 |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2015 by Jan-Hendrik Dolling.
:license: Apache 2.0, see LICENSE for more details.
"""
import abc
import six
import json
import logging
from six import string_types
from collections import namedtuple
from configvalidator.tools.exceptions import LoadException, ValidatorExceptio... | JanHendrikDolling/configvalidator | configvalidator/tools/basics.py | Python | apache-2.0 | 6,745 |
"""Builder for websites."""
import string
from regolith.dates import date_to_float
doc_date_key = lambda x: date_to_float(
x.get("year", 1970), x.get("month", "jan")
)
ene_date_key = lambda x: date_to_float(
x.get("end_year", 4242), x.get("end_month", "dec")
)
category_val = lambda x: x.get("category", "<unca... | scopatz/regolith | regolith/sorters.py | Python | cc0-1.0 | 2,389 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import os
import sys
import re
import optparse
import myLib
import time
CHECK_FILE = ['AndroidManifest.xml', 'res', 'src', 'src_lib']
FILE_SUBFIX = ['.java', '.xml']
MENIFEST_FILE = 'AndroidManifest.xml'
STRING_FILE = 'res/values/strings.xml'
BUILD_RES_DIR = 'build_res/'
ASSE... | xstd/quick_setting | build.py | Python | apache-2.0 | 5,506 |
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
func_code = 'as'
func_name = 'test_one_moving_one_stationary_along_path_no_intr'
def setup_fig01():
fig, ax, renderer = create_newfig('{}01'.format(func_code), ylim=(-1, 7))
create_moving_polygon(fig, ax, renderer, ((... | OmkarPathak/pygorithm | imgs/test_geometry/test_extrapolated_intersection/as_test_one_moving_one_stationary_along_path_no_intr.py | Python | mit | 1,807 |
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import
import os
from requests_oauthlib import OAuth1Session
def create_oauth_token(expiration=None, scope=None, key=None, secret=None, name=None, output=True):
"""
Script to obtain an OAuth token from Trello.
Must ha... | mehdy/py-trello | trello/util.py | Python | bsd-3-clause | 4,017 |
import os
import gi
import math
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject, Gdk
from sicc import GitAssistant
gtk_builder_file = os.path.splitext(__file__)[0] + '.ui'
COLOR_CYCLE = [
('#ffffff'), ('#d6e685'),
('#8cc665'), ('#44a340'),
('#1e... | jacobj10/GitSicc | sicc_window.py | Python | mit | 4,452 |
# MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from django.urls import reverse
from impact.middleware.method_override_middleware import METHOD_OVERRIDE_HEADER
from impact.tests.api_test_case import APITestCase
from impact.tests.contexts import UserContext
class TestMethodOverrideMiddleware(APITestCase):
... | masschallenge/impact-api | web/impact/impact/tests/test_method_override_middleware.py | Python | mit | 1,313 |
# Copyright 2015 Tesora 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 a... | cp16net/trove | trove/tests/unittests/guestagent/test_configuration.py | Python | apache-2.0 | 19,830 |
import os
from os.path import join
from numpy.distutils.system_info import get_info
def configuration(parent_package='', top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('utils', parent_package, top_path)
config.add_subpackage('sparsetools')
... | sgenoud/scikit-learn | sklearn/utils/setup.py | Python | bsd-3-clause | 2,025 |
#!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Rolls third_party/boringssl/src in DEPS and updates generated build files."""
import os
import os.path
import shutil
import subproc... | axinging/chromium-crosswalk | third_party/boringssl/roll_boringssl.py | Python | bsd-3-clause | 4,004 |
import json
import uuid
from collections import namedtuple
from functools import partial
import pytest
from flask import url_for
from freezegun import freeze_time
from tests import broadcast_message_json, sample_uuid, user_json
from tests.app.broadcast_areas.custom_polygons import BRISTOL, SKYE
from tests.conftest im... | alphagov/notifications-admin | tests/app/main/views/test_broadcast.py | Python | mit | 85,153 |
#!/user/bin/env python
"""
@package mi.dataset.param_dict
@file mi/dataset/param_dict.py
@author Emily Hahn
@brief Extend the protocol param dict to handle dataset encoding exceptions
"""
import re
from mi.core.instrument.protocol_param_dict import ProtocolParameterDict, ParameterDescription
from mi.core.instrument.p... | janeen666/mi-instrument | mi/dataset/param_dict.py | Python | bsd-2-clause | 7,444 |
#!/usr/bin/env python
# - coding: utf-8 -
# Copyright (C) 2014 Toms Baugis <toms.baugis@gmail.com>
"""Exploring symmetry. Feel free to add more handles!"""
import math
import random
from collections import defaultdict
from gi.repository import Gtk as gtk
from gi.repository import GObject as gobject
from gi.repository... | jean/apx | apx/splash.py | Python | mit | 10,146 |
from django.db import models
from django.contrib.auth.models import User
class Client(models.Model):
FEMALE = 'F'
MALE = 'M'
SEX_CHOICE = (
(FEMALE, 'F'),
(MALE, 'M'),
)
user = models.OneToOneField(User)
address = models.CharField(max_length=200, null=True)
preference = models.CharField(max_length=40)
... | avoajaugochukwu/suaveproject | suave/models.py | Python | mit | 3,133 |
from __future__ import unicode_literals
import base64
import datetime
import hashlib
import json
import netrc
import os
import re
import socket
import sys
import time
import math
from ..compat import (
compat_cookiejar,
compat_cookies,
compat_etree_fromstring,
compat_getpass,
compat_http_client,
... | mdmdmdmdmd/pyyt | youtube_dl/extractor/common.py | Python | gpl-2.0 | 84,820 |
"""
Existing users can request to change their email address by
PUTing to ``/-/email/``:
.. testsetup::
>>> _ = getfixture('db_session')
>>> Principal = getfixture('principals').Principal
>>> _ = Principal(email=u'alice@foo.com', password=u'alice',
... firstname=u'Alice', lastname=u'Kingsleigh... | pyfidelity/rest-seed | backend/backrest/views/change_email.py | Python | bsd-2-clause | 2,534 |
import sys
import os.path
import setuptools # Fix distutils issues
from cffi import FFI
ffi = FFI()
mod_name = 'instrumental.drivers.cameras._pixelfly.errortext'
if sys.platform.startswith('win'):
ffi.set_source(mod_name, """
#define PCO_ERR_H_CREATE_OBJECT
#define PCO_ERRT_H_CREATE_OBJECT
... | mabuchilab/Instrumental | instrumental/drivers/cameras/_pixelfly/_cffi_build/build_errortext.py | Python | gpl-3.0 | 586 |
"""External routes."""
from .auth import login, logout, get_public_key
from .changelog import (
get_changelog,
get_metric_changelog,
get_subject_changelog,
get_source_changelog,
get_report_changelog,
)
from .datamodel import get_data_model
from .documentation import get_api
from .logo import get_lo... | ICTU/quality-time | components/server/src/external/routes/__init__.py | Python | apache-2.0 | 1,403 |
#
# 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... | wileeam/airflow | airflow/www/blueprints.py | Python | apache-2.0 | 956 |
# Copyright 2016 IBM Corp.
#
# 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, s... | hanlind/nova | nova/tests/functional/regressions/test_bug_1548980.py | Python | apache-2.0 | 3,498 |
# This would need MEMEX VPN identification
#imagenet_mean_npy_urldlpath = "https://isi.memexproxy.com/datacuimgsearch/sentibank/imagenet_mean.npy"
#tfsentibank_npy_urldlpath = "https://isi.memexproxy.com/datacuimgsearch/sentibank/tfdeepsentibank.npy"
imagenet_mean_npy_urldlpath = "https://www.dropbox.com/s/s5oqp801tgik... | svebk/DeepSentiBank_memex | cu_image_search/feature_extractor/__init__.py | Python | bsd-2-clause | 445 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.factor
~~~~~~~~~~~~~~~~~~~~~~
Lexers for the Factor language.
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, bygroups, default, words
from ... | tmm1/pygments.rb | vendor/pygments-main/pygments/lexers/factor.py | Python | mit | 17,864 |
#! /usr/bin/env python
import figleaf
from figleaf import internals
from sets import Set as set
import sys
from cPickle import load
import os
from optparse import OptionParser
def main():
#### OPTIONS
parser = OptionParser()
parser.add_option('-c', '--coverage', nargs=1, action="store",
... | hornn/interviews | tools/bin/ext/figleaf/annotate_sections.py | Python | apache-2.0 | 1,955 |
"""
flask.ext.restless.search
~~~~~~~~~~~~~~~~~~~~~~~~~
Provides querying, searching, and function evaluation on SQLAlchemy models.
The most important functions in this module are the :func:`create_query`
and :func:`search` functions, which create a SQLAlchemy query object and
execute that que... | mahrz/kernkrieg | flask_restless/search.py | Python | mit | 19,666 |
from google.appengine.ext import ndb
from django.db import models
from django.test import TestCase
import mock
from potatopage.paginator import (
DjangoNonrelPaginator,
GaeNdbPaginator,
EmptyPage
)
class DjangoNonrelPaginationModel(models.Model):
field1 = models.IntegerField()
class DjangoNonrelP... | potatolondon/potatopage | tests.py | Python | mit | 7,589 |
""" Main ngi_reports module
"""
__version__="0.1.13"
| ewels/ngi_reports | ngi_reports/__init__.py | Python | mit | 53 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# OpenCenter(TM) is Copyright 2013 by Rackspace US, Inc.
##############################################################################
#
# OpenCenter is licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | rcbops/opencenter | tests/test_ast.py | Python | apache-2.0 | 13,977 |
import re
################################################################################
# Human Command Protocol
################################################################################
class HumanCommandProtocol:
def __init__(self):
self.commands = (('^help', self.help),)
def help(s... | michaeldove/abode | chat/protocol.py | Python | mit | 735 |
import pickle
import random
import os
import numpy as np
'''
Note to Lukas:
Wie in der Mail beschrieben, würde wir hier diese "old" if sache
weg lassen, weil sie im normalen Preprocessing gemacht worden wäre
'''
old = True
# get absolute path of this file
file_path = ('/'.join(os.path.realpath(__file__).split("/")[... | D3vvy/iannwtf_DCGAN | functions/celeba_input.py | Python | gpl-3.0 | 2,015 |
#!/usr/bin/python
import sys, rospy, tf, actionlib
from geometry_msgs.msg import *
from tf.transformations import quaternion_from_euler
if __name__ == '__main__':
rospy.init_node('initial_localization')
pub = rospy.Publisher('initialpose', PoseWithCovarianceStamped, queue_size=1)
p = PoseWithCovarianceStamped()
... | mkhuthir/catkin_ws | src/stockroom_bot/src/initial_localization.py | Python | gpl-3.0 | 688 |
from itertools import permutations
import pytest
import networkx as nx
from networkx.testing import almost_equal
class TestNeighborConnectivity(object):
def test_degree_p4(self):
G = nx.path_graph(4)
answer = {1: 2.0, 2: 1.5}
nd = nx.average_degree_connectivity(G)
assert nd == a... | sserrot/champion_relationships | venv/Lib/site-packages/networkx/algorithms/assortativity/tests/test_connectivity.py | Python | mit | 5,020 |
import DeepFried2 as df
import scipy.io
import numpy as np
def model_head(fully_conv=True):
if fully_conv:
return [
df.SpatialConvolutionCUDNN( 512, 4096, 7, 7, border='valid'), df.ReLU(),
df.Dropout(0.5),
df.SpatialConvolutionCUDNN(4096, 4096, 1, 1, border='valid'), d... | elPistolero/DeepFried2 | DeepFried2/zoo/vgg.py | Python | mit | 2,179 |
__author__ = 'Allison MacLeay'
"""
Issues
---------
GD
Linear - My MSE's are unbelievably good but predicte value
look good too
Logisitc - Either my classifier function is completely wrong
or W is wrong. I assume I could use the linear reg function
but results are mostly less than .1 rather than .5 as
... | alliemacleay/MachineLearning_CS6140 | Homeworks/hw2_new.py | Python | mit | 8,649 |
#
# Copyright 2014-2017 Red Hat, Inc.
#
# 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.
#
# This program is distributed ... | EdDev/vdsm | lib/vdsm/cmdutils.py | Python | gpl-2.0 | 7,970 |
from setuptools import setup
setup(
name = 'NFL_Draftkings',
packages = ['NFL_Draftkings'],
version = '2',
description = 'Python wrapper around NFL api that calculates Draftkings scores for players',
author = 'Kacper Adach',
author_email = 'kacperadach@gmail.com',
url = 'https://github.com/kacperadach/NF... | kacperadach/draftkings_points_scripts | setup.py | Python | mit | 526 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.signup, name='signup'),
]
| jnyborg/nospammail | backend/login/urls.py | Python | apache-2.0 | 118 |
from hachoir_parser.video.asf import AsfFile
from hachoir_parser.video.flv import FlvFile
from hachoir_parser.video.mov import MovFile
from hachoir_parser.video.mpeg_video import MPEGVideoFile
from hachoir_parser.video.mpeg_ts import MPEG_TS
from hachoir_parser.video.avchd import AVCHDINDX, AVCHDMOBJ, AVCHDMPLS, AVCHDC... | kreatorkodi/repository.torrentbr | plugin.video.yatp/site-packages/hachoir_parser/video/__init__.py | Python | gpl-2.0 | 324 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.