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 -*-
from openprocurement.api.models import get_now, timedelta
from openprocurement.api.utils import (
apply_patch,
save_tender,
opresource,
json_view,
context_unpack,
)
from openprocurement.api.validation import (
validate_contract_data,
validate_patch_contract_data,
)
fr... | VolVoz/openprocurement.tender.limited | openprocurement/tender/limited/views/contract.py | Python | apache-2.0 | 9,176 |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2022 BigML
#
# 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 ... | bigmlcom/python | bigml/tests/test_38_organization.py | Python | apache-2.0 | 5,005 |
#! /usr/bin/env python
import bluetooth
import subprocess
import re
import time
import string
import pywapi
import httplib
import ast
import socket
import ConfigParser
import io
from datetime import datetime, date
from time import mktime
from urllib import urlencode
from urllib2 import Request, urlopen, URLError, HTTPE... | 040medien/furnaceathome | furnace_client.py | Python | gpl-2.0 | 15,051 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2020, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Gaussian Editor
#######################
Base class on top of exatomic.Editor for NBO Editors
"""
from exatomic import Editor as AtomicEditor
class Editor(AtomicEditor):
def... | exa-analytics/atomic | exatomic/nbo/editor.py | Python | apache-2.0 | 548 |
#!/usr/bin/env python
import datetime
import logging
log = logging.getLogger('activecalls.scrapecalls')
import time
from dateutil import parser
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.serializers.json import DjangoJSONEncoder
import lxml.etree
import lxml... | hacktyler/hacktyler_crime | activecalls/management/commands/scrapecalls.py | Python | mit | 6,091 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012 CERN.
##
## Invenio 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) a... | Panos512/invenio | modules/miscutil/lib/upgrades/invenio_2012_11_04_circulation_and_linkback_updates.py | Python | gpl-2.0 | 4,682 |
"""Test functionality of mldata fetching utilities."""
import os
import scipy as sp
import shutil
from sklearn import datasets
from sklearn.datasets import mldata_filename, fetch_mldata
from sklearn.utils.testing import assert_in
from sklearn.utils.testing import assert_not_in
from sklearn.utils.testing import mock_... | vortex-ape/scikit-learn | sklearn/datasets/tests/test_mldata.py | Python | bsd-3-clause | 5,422 |
from flask import Flask
from flask_restful import Resource, Api, reqparse
from resources.users import Users, User
app = Flask(__name__)
api = Api(app)
api.add_resource(Users, '/users')
api.add_resource(User, '/user/<string:name>')
if __name__ == '__main__':
app.run(debug=True)
| garmann/playground | python/restful-hardware-manager/app.py | Python | mit | 285 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import APITester.models
class Migration(migrations.Migration):
dependencies = [
('APITester', '0003_auto_20160219_1158'),
]
operations = [
migrations.AlterField(
model_na... | chubbymaggie/Mobile-Security-Framework-MobSF | APITester/migrations/0004_auto_20160219_1750.py | Python | gpl-3.0 | 604 |
# Copyright 2015, Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | greasypizza/grpc | src/python/grpcio/grpc_core_dependencies.py | Python | bsd-3-clause | 28,918 |
#!/usr/bin/env python
# Get dataId hash
# This file is part of https://github.com/hh-italian-group/hh-bbtautau.
import ROOT
import pandas
import re
def LoadIdFrames(file_name, id_collections):
"""Load pandas DataFrame from root file."""
file = ROOT.TFile(file_name, "READ")
aux = file.Get('aux')
id_val... | hh-italian-group/hh-bbtautau | Instruments/python/getDataIdHash.py | Python | gpl-2.0 | 2,507 |
import lariat_utils
import tspl_utils
def flatten(x):
result = []
for el in x:
if hasattr(el, "__iter__") and not isinstance(el, basestring):
result.extend(flatten(el))
else:
result.append(el)
return result
def summary_text(ld,ts,maxwidth=55,max_ibrun_lines=45):
text=''
cnt = 0
try:
... | dimm0/tacc_stats | tacc_stats/analysis/gen/my_utils.py | Python | lgpl-2.1 | 1,684 |
import unittest
import kestrelpy
SERVERS = ["localhost:22133"]
class TestFlush(unittest.TestCase):
def test(self):
c = kestrelpy.Client(SERVERS)
c.add("queue", "test")
c.flush("queue")
self.assertEqual(c.get("queue"), None)
class TestAdd(unittest.TestCase):
def test(self):... | ericmoritz/python-kestrel | test_kestrelpy.py | Python | bsd-2-clause | 1,356 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | attribution/tests/views/charge_repartition/common.py | Python | agpl-3.0 | 4,964 |
import getopt
import os, glob, shutil, logging
import pexpect as p
import time
from pyraf import iraf
from pyraf import iraffunctions
import astropy.io.fits
from nifsUtils import datefmt, writeList, listit
def start(obsDirList, use_pq_offsets, im3dtran, over=""):
"""MERGE
This module contains all the functio... | mrlb05/Nifty | docs/build/lib/nifty/pipeline/nifsMerge.py | Python | mit | 15,005 |
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of Resistencia Cadiz 1812. #
# #
# This program is free software: you can redistribute it... | pablorecio/resistencia-1812 | resistencia/gui/quick_game_dialog.py | Python | gpl-3.0 | 7,704 |
# conf.py
import os
import json
import yaml
def merge_conf(to_hash, other_hash, path=[]):
"merges other_hash into to_hash"
for key in other_hash:
if (key in to_hash and isinstance(to_hash[key], dict)
and isinstance(other_hash[key], dict)):
merge_conf(to_hash[key], other_has... | fotonauts/fwissr-python | fwissr/conf.py | Python | mit | 748 |
import pytest
from functools import partial
import datetime
from lollipop.compat import OrderedDict
from lollipop.types import MISSING, ValidationError, Type, Any, String, \
Number, Integer, Float, Boolean, DateTime, Date, Time, OneOf, List, Tuple, \
Dict, Field, AttributeField, IndexField, MethodField, Functio... | maximkulkin/lollipop | tests/test_types.py | Python | mit | 108,126 |
import json, datetime, os
from collections import OrderedDict
from s3ts.utils import datetimeFromIso
from s3ts import package
class MetaPackage(object):
"""
A metapackage specified how multiple packages can be
arranged into a single directory tree.
"""
def __init__( self, name, description, creat... | helix-collective/s3ts | src/s3ts/metapackage.py | Python | bsd-3-clause | 6,320 |
from test_support import verify, TestFailed, check_syntax
import warnings
warnings.filterwarnings("ignore", r"import \*", SyntaxWarning, "<string>")
print "1. simple nesting"
def make_adder(x):
def adder(y):
return x + y
return adder
inc = make_adder(1)
plus10 = make_adder(10)
verify(inc(1) == 2)
v... | mancoast/CPythonPyc_test | cpython/223_test_scope.py | Python | gpl-3.0 | 9,168 |
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import json
import os
import pprint
import sys
import warnings
try:
from jsonschema import ValidationError
from jsonschema import Draft4Validator as Validator
except Impor... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/nbformat/validator.py | Python | bsd-2-clause | 7,863 |
# -*- coding: utf-8 -*-
import nose
from py2ch import BBS2ch
from py2ch import conf
def test___init__():
b = BBS2ch(conf.bbsmenu)
if __name__ == '__main__':
nose.run()
| ymotongpoo/restroom | python/py2ch/test/test_bbs2ch.py | Python | apache-2.0 | 181 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsRasterFileWriter.
.. note:: 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.
"... | t-hey/QGIS-Original | tests/src/python/test_qgsrasterfilewriter.py | Python | gpl-2.0 | 5,755 |
import mock
from django.core.management.base import CommandError
from django.core.management import call_command
from requests.models import Response
from tests.base import BaseTest
def exec_cmd(**kwargs):
call_command('hawkrequest', **kwargs)
class TestManagementCommand(BaseTest):
@mock.patch('hawkrest.... | kumar303/hawkrest | tests/test_command.py | Python | bsd-3-clause | 1,952 |
"""
Django settings for django_tut 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/
"""
import... | rijkstofberg/django_tut | django_tut/settings.py | Python | bsd-2-clause | 3,166 |
# -*- coding: utf-8 -*-
{
'name': "Check Printing in Expenses",
'summary': """Print amount in words on checks issued for expenses""",
'category': 'Accounting',
'description': """
Print amount in words on checks issued for expenses
""",
'version': '1.0',
'depends': ['account_check_pri... | t3dev/odoo | addons/hr_expense_check/__manifest__.py | Python | gpl-3.0 | 421 |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
"""@pylatest test01
Hello World Test Case
*********************
:author: foo@example.com
:date: 2015-11-06
:comment: This is here just to test metadata processing.
"""
"""@pylatest test01
Description
===========
This is just demonstration of usage of pylatest rst direct... | marbu/pylatest | tests/pysource/pysource-multiplecasesperfile/testcase.splitted-nested-default.py | Python | gpl-3.0 | 4,738 |
from venv import _venv
from fabric.api import task
@task
def migrate():
"""
Run Django's migrate command
"""
_venv("python manage.py migrate")
@task
def syncdb():
"""
Run Django's syncdb command
"""
_venv("python manage.py syncdb")
| pastpages/wordpress-memento-plugin | fabfile/migrate.py | Python | mit | 268 |
# coding=utf-8
import os
from django.test import TestCase
from django.db import models
from django.core import exceptions
from ckeditor.models import XHTMLField
from ckeditor.models import XMLField
from ckeditor.models import HTML5Field
from ckeditor.models import HTML5FragmentField
from ckeditor.widgets import CKEd... | mivanov/editkit | editkit/ckeditor/tests/tests.py | Python | gpl-2.0 | 6,356 |
"""
genie.jobs.hive
This module implements creating Hive jobs.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
from ..utils import unicodify
from .core import GenieJob
from .utils import (add_to_repr,
arg_list,
... | ajoymajumdar/genie | genie-client/src/main/python/pygenie/jobs/hive.py | Python | apache-2.0 | 5,914 |
# Generated by Django 2.1.11 on 2019-08-15 18:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("channels", "0022_add_channel_invitation")]
operations = [
migrations.AlterField(
... | mitodl/open-discussions | channels/migrations/0023_add_subscriptions_related_name.py | Python | bsd-3-clause | 607 |
from django import template
from django.utils.safestring import mark_safe
from mezzanine.conf import settings
from mezzanine_developer_extension.utils import refactor_html
register = template.Library()
# Checking settings.TEMPLATE_STYLE.
# Possible values are:
# - mezzanine_developer_extension.styles.macos
# -... | educalleja/mezzanine-developer-extension | mezzanine_developer_extension/templatetags/devfilters.py | Python | bsd-3-clause | 1,349 |
#
# Copyright 2014 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 in th... | EdDev/vdsm | lib/vdsm/schedule.py | Python | gpl-2.0 | 7,080 |
import numpy as np
import pickle
import logging
import argparse
import csv
import matplotlib as mpl
mpl.use('agg')
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.metrics import silhouette_score
from cluster_utils import create_cl... | exepulveda/swfc | python/clustering_pca_2d.py | Python | gpl-3.0 | 3,175 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
pipe2py.modules.pipeloop
~~~~~~~~~~~~~~~~~~~~~~~~
Provides methods for creating submodules from existing pipes
http://pipes.yahoo.com/pipes/docs?doc=operators#Loop
"""
from copy import copy
from functools import partial
from itertools import chain... | ganugapav/pipe | pipe2py/modules/pipeloop.py | Python | gpl-2.0 | 5,402 |
#runas run_extrema(10,[1.2,3.4,5.6,7.8,9.0,2.1,4.3,5.4,6.5,7.8])
#bench import random; n=3000000; a = [random.random() for i in xrange(n)]; run_extrema(n, a)
#pythran export run_extrema(int, float list)
def extrema_op(a, b):
a_min_idx, a_min_val, a_max_idx, a_max_val = a
b_min_idx, b_min_val, b_max_idx, b_max_v... | artas360/pythran | pythran/tests/cases/extrema.py | Python | bsd-3-clause | 954 |
"""A pytest plugin which helps testing Django applications
This plugin handles creating and destroying the test environment and
test database and provides some useful text fixtures.
"""
import contextlib
import inspect
from functools import reduce
import os
import sys
import types
import py
import pytest
from .djan... | vicky2135/lucious | oscar/lib/python2.7/site-packages/pytest_django/plugin.py | Python | bsd-3-clause | 21,452 |
# -*- coding: utf-8 -*-
"""AR-specific Form helpers."""
from __future__ import unicode_literals
from django.forms import ValidationError
from django.forms.fields import CharField, RegexField, Select
from django.utils.translation import ugettext_lazy as _
from localflavor.compat import EmptyValueCompatMixin
from .ar... | jieter/django-localflavor | localflavor/ar/forms.py | Python | bsd-3-clause | 7,124 |
"""
Search Tweets application file.
Search for tweets in the Twitter API based on a query string and return the
tweepy tweet objects, which have an author attribute.
See the search docs in this project for details on search syntax and links to
the Twitter developer docs.
"""
import datetime
import logging
import twe... | MichaelCurrin/twitterverse | app/lib/twitter_api/search.py | Python | mit | 6,361 |
#!/usr/bin/python2.6
import os
import sys
import Queue
import threading
from subprocess import Popen, PIPE, STDOUT
import copy
import time
import re
import logging
class ExecutionError(Exception): pass
class Shell:
@classmethod
def sh(cls, cmd, host=None, username=None):
'''Execute a command locally or remot... | wenshao/oceanbase | script/data_dispatcher/copy_sstable.py | Python | gpl-2.0 | 7,762 |
#!/usr/bin/env python
# encoding: utf-8
"""
Tests for the permissions system
"""
import os
os.environ['FLASK_CONF'] = 'TEST'
import unittest
from test_permissions import PermissionsUnitTest
from ddt import ddt, data
PTest = PermissionsUnitTest.PTest
PERMISSION_TESTS = [
PTest("student_get_own",
"student... | jordonwii/ok | server/tests/permissions/test_message.py | Python | apache-2.0 | 2,239 |
"""Test case implementation"""
import sys
import functools
import difflib
import logging
import pprint
import re
import warnings
import collections
import contextlib
import traceback
from . import result
from .util import (strclass, safe_repr, _count_diff_all_purpose,
_count_diff_hashable, _common_... | michalliu/OpenWrt-Firefly-Libraries | staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python3.4/unittest/case.py | Python | gpl-2.0 | 55,456 |
from setuptools import setup, find_packages
setup(
name="rally-ci",
version="0.1.1a1",
data_files=[
("etc/rally-ci/", ["etc/sample-config.yaml",
"etc/noop.yaml",
"etc/nginx.conf"]),
],
packages=find_packages(),
include_package_data=T... | redixin/rally-ci | setup.py | Python | apache-2.0 | 455 |
import os
import pprint
import sys
from multiprocessing.pool import ThreadPool
from twisted.internet.defer import inlineCallbacks
from twisted.logger import Logger
from autobahn.twisted.util import sleep
from autobahn.twisted.wamp import ApplicationSession
from autobahn.wamp.exception import ApplicationError
sys.pat... | floryst/jukebox | jukebox.py | Python | mit | 5,181 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
from flask import url_for
import flask_fs as fs
import pytest
def test_by_name(app, mock_backend):
storage = fs.Storage('test_storage')
app.configure(storage)
assert fs.by_name('test_storage') == storage
def test_exists(app, ... | noirbizarre/flask-fs | tests/test_storage.py | Python | mit | 11,623 |
name = input("Give me your name: ")
name = name[0].upper() + name[1:len(name)]
age = int(input("Give me your age: "))
date_to100 = 2016-age+100
print ("{}, you will be 100 years old in {}".format(name,(date_to100)))
| QuirinoC/Python | 01_character_input.py | Python | apache-2.0 | 216 |
# Copyright (c) Ralph Meijer.
# See LICENSE for details.
"""
Tests for L{wokkel.client}.
"""
from twisted.internet import defer
from twisted.trial import unittest
from twisted.words.protocols.jabber import xmlstream
from twisted.words.protocols.jabber.client import XMPPAuthenticator
from twisted.words.protocols.jabbe... | thepaul/wokkel | wokkel/test/test_client.py | Python | mit | 4,900 |
"""
Views for managing Ring & Storage Policies.
"""
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse_lazy
from django.core.urlresolvers import reverse
import json
from horizon import forms
from horizon import workflows
from horizon import tables
from horizon import e... | Crystal-SDS/dashboard | crystal_dashboard/dashboards/crystal/rings/storage_policies/views.py | Python | gpl-3.0 | 5,579 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import slugify
from contextlib import contextmanager
from datetime import datetime
from urlparse import urlparse, parse_qs
import httpretty
from flask import url_for, session, current_app
from udata.auth import current_user
from udata.mode... | etalab/udata-youckan | tests.py | Python | agpl-3.0 | 11,920 |
# Author: Ovidiu Predescu
# Date: July 2011
#
# 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 ... | mountainpenguin/BySH | server/lib/tornado/platform/twisted.py | Python | gpl-3.0 | 20,192 |
from .menu import menu_handlers
from .main import main_handlers
from .toolbar import toolbar_handlers
handlers = {}
handlers.update(menu_handlers)
handlers.update(main_handlers)
handlers.update(toolbar_handlers)
__all__ = ['handlers']
| uvNikita/fsm_builder | fsm_builder/handlers/__init__.py | Python | mit | 239 |
from sympy import (
Abs, And, binomial, Catalan, cos, Derivative, E, Eq, exp, EulerGamma,
factorial, Function, harmonic, I, Integral, KroneckerDelta, log,
nan, Ne, Or, oo, pi, Piecewise, Product, product, Rational, S, simplify,
sin, sqrt, Sum, summation, Symbol, symbols, sympify, zeta, gamma, Le,
In... | ChristinaZografou/sympy | sympy/concrete/tests/test_sums_products.py | Python | bsd-3-clause | 36,233 |
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.contenttypes.models import ContentType
# Import kernel module
from kernel.middleware import CrequestMiddleware
from kern... | pycodi/django-kernel | kernel/models/base/__init__.py | Python | mit | 6,319 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | sachinpro/sachinpro.github.io | tensorflow/examples/tutorials/mnist/mnist_with_summaries.py | Python | apache-2.0 | 7,479 |
"""
Support for MQTT message handling.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/mqtt/
"""
import asyncio
import logging
import os
import socket
import time
import voluptuous as vol
from homeassistant.core import JobPriority
from homeassistant.bo... | leoc/home-assistant | homeassistant/components/mqtt/__init__.py | Python | mit | 16,159 |
#!/usr/bin/env python
# encoding: utf-8
"""
palindrome_number.py
Created by Shengwei on 2014-07-10.
"""
# https://oj.leetcode.com/problems/palindrome-number/
"""
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (i... | CodingVault/LeetCodeInPython | palindrome_number.py | Python | apache-2.0 | 1,287 |
# -*- coding: utf-8 -*-
"""
exceptions
~~~~~~~~~~
Implements exceptions
:author: Feei <feei@feei.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
class CobraException(Exceptio... | braveghz/cobra | cobra/exceptions.py | Python | mit | 736 |
from textwrap import dedent
from temper.tags import ALL_TAGS
from temper.tags import Tag
from temper.utils import Param
from temper.utils import escape
class Temper:
def __init__(self, settings=None):
self.tree = ''
self.stack = []
self.depth = 0
# defaults
self.settings ... | drtchops/temper | temper/__init__.py | Python | mit | 2,260 |
import warnings
import numbers
from abc import ABCMeta, abstractmethod
import numpy as np
import scipy.sparse as sp
# mypy error: error: Module 'sklearn.svm' has no attribute '_libsvm'
# (and same for other imports)
from . import _libsvm as libsvm # type: ignore
from . import _liblinear as liblinear # type: ignore
... | sergeyf/scikit-learn | sklearn/svm/_base.py | Python | bsd-3-clause | 41,525 |
# Copyright 2015 The Shaderc 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 applicable... | dneto0/shaderc | glslc/test/parameter_tests.py | Python | apache-2.0 | 13,688 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | bigswitch/tempest | tempest/api/compute/admin/test_flavors.py | Python | apache-2.0 | 13,789 |
# coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
import flask
#import wtforms
import auth
import config
import model
import control
import util
import os
from main import app
from .init import *
import cloudstorage as gcs
from google.appengine.api import images
from go... | wodore/wodore-ng | main/control/admin.py | Python | mit | 4,186 |
import numpy as np
from faps import make_offspring
def make_sibships(parents, dam, sires, family_size, family_name='offs'):
"""
Mate parents in a base population to create half- or full-sibling families.
This relies on the indices for the desired parents within the genotype object
'parents'. These can... | ellisztamas/faps | faps/make_sibships.py | Python | mit | 2,328 |
#!/usr/bin/env python
from tools.load import LoadMatrix
from numpy import random
lm=LoadMatrix()
N = 100
random.seed(17)
ground_truth = random.randn(N)
predicted = random.randn(N)
parameter_list = [[ground_truth,predicted]]
def evaluation_meansquarederror_modular (ground_truth, predicted):
from modshogun import Re... | AzamYahya/shogun | examples/undocumented/python_modular/evaluation_meansquarederror_modular.py | Python | gpl-3.0 | 700 |
"""Device tracker platform that adds support for OwnTracks over MQTT."""
from homeassistant.components.device_tracker import (
ATTR_BATTERY,
ATTR_GPS,
ATTR_GPS_ACCURACY,
ATTR_LOCATION_NAME,
)
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.components.dev... | aronsky/home-assistant | homeassistant/components/mobile_app/device_tracker.py | Python | apache-2.0 | 4,346 |
import os
from argparse import ArgumentParser
from faice.helpers import print_user_text
from faice.tools.cli_funcs import read_file, validate, parse, vagrant
DESCRIPTION = 'generate configuration files to set up an execution engine in a Vagrant virtual machine'
def main():
parser = ArgumentParser(
desc... | curious-containers/faice | faice/tools/vagrant/__main__.py | Python | gpl-3.0 | 2,284 |
# import the Flask class from the flask module
from flask import Flask, render_template, request
from wtforms import Form, BooleanField, TextField, PasswordField, validators
import search
import send_messages
from transfer import *
from pickle import dump, load
# create the application object
app = Flask(__name__)
c... | Shashank-Ojha/MakeBank | app.py | Python | mit | 3,953 |
from random import randint
import os.path
from flask import Flask, g
import pytest
import dataactcore.config
from dataactcore.models import baseModel
from dataactcore.scripts import (setup_job_tracker_db, setup_user_db, setup_validation_db, setup_error_db,
setup_static_data)
from data... | fedspendingtransparency/data-act-broker-backend | tests/unit/conftest.py | Python | cc0-1.0 | 3,407 |
# 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.
# --------------------------------------------------------------------... | SUSE/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/subscriptions/models.py | Python | mit | 362 |
# -*- coding: utf-8 -*-
##--------------------------------------#######
# Proprietes de la feuille #
##--------------------------------------#######
# WxGeometrie
# Dynamic geometry, graph plotter, and more for french mathematic teachers.
# Copyright (C) 2005-2013 Nicolas Pourcelot
#
# ... | wxgeo/geophar | wxgeometrie/GUI/proprietes_feuille.py | Python | gpl-2.0 | 5,338 |
import types
import re
import weakref
from walky.constants import *
from walky.acl import *
from walky.utils import *
def object_id(obj):
""" Returns the id of the underlying object if wrapped.
If not wrapped, returns the object's id.
"""
if isinstance(obj,ObjectWrapper):
return obj.id()
... | amimoto/walky | walky/objects/common.py | Python | mit | 6,331 |
# -*- 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):
# Changing field 'Building.energy_score'
db.alter_column(u'building_building', 'energy_score', self.gf('dja... | City-of-Bloomington/green-rental | building/migrations/0015_auto__chg_field_building_energy_score.py | Python | agpl-3.0 | 24,390 |
# Copyright 2018 Nokia Networks. 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... | openstack/mistral | mistral/tests/unit/api/test_resource_list.py | Python | apache-2.0 | 1,260 |
#
# Copyright (C) 2012 Niek Linnenbank
#
# 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.
#
# This program is distributed... | nieklinnenbank/bouwer | source/bouwer/core.py | Python | gpl-3.0 | 3,306 |
"""Config flow for ozw integration."""
import logging
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import hassio
from homeassistant.components.hassio import HassioServiceInfo
from homeassistant.core import callback
from homeassistant.data_entry_flow import AbortFlow,... | rohitranjan1991/home-assistant | homeassistant/components/ozw/config_flow.py | Python | mit | 8,504 |
"""
Title: Visualize the hyperparameter tuning process
Author: Haifeng Jin
Date created: 2021/06/25
Last modified: 2021/06/05
Description: Using TensorBoard to visualize the hyperparameter tuning process in KerasTuner.
"""
"""shell
pip install keras-tuner -q
"""
"""
## Introduction
KerasTuner prints the logs to scre... | keras-team/keras-io | guides/keras_tuner/visualize_tuning.py | Python | apache-2.0 | 6,511 |
#!/usr/bin/python3
"""
Given an array with n integers, your task is to check if it could become
non-decreasing by modifying at most 1 element.
We define an array is non-decreasing if array[i] <= array[i + 1] holds for every
i (1 <= i < n).
Example 1:
Input: [4,2,3]
Output: True
Explanation: You could modify the first... | algorhythms/LeetCode | 665 Non-decreasing Array.py | Python | mit | 1,781 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
def ext(name, numpy=False, GL=False, GLU=False, OpenMP=False):
kwargs = {
'name': name,
'sources': [name + '.pyx'],
'include_dirs': [],
'libraries': ... | BertrandBordage/pyqt-opengl-experiments | setup.py | Python | gpl-2.0 | 1,049 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
#from variable_functions import my_attribute_label
from numpy import where, ones
class density_converter(Variable):
"""
return constants to co... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim_parcel/development_template/density_converter.py | Python | gpl-2.0 | 2,455 |
import json
import pendulum
import re
import requests
from typing import List, Dict, NamedTuple
from googleapiclient import discovery
from oauth2client.service_account import ServiceAccountCredentials
from oauth2client.client import GoogleCredentials
import pykube.objects
import structlog
from k8s_snapshots.context imp... | EQTPartners/k8s-snapshots | k8s_snapshots/backends/google.py | Python | bsd-2-clause | 11,093 |
# -*- coding: utf-8 -*-
from django.db import models
class Document(models.Model):
docfile = models.FileField(upload_to='uploads/%Y/%m/%d')
| Justasic/StackSmash | StackSmash/apps/uploader/models.py | Python | bsd-2-clause | 146 |
# -*- 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):
# Adding field 'Wallet.last_balance'
db.add_column('django_bitcoin_wallet', 'last_balance',
... | FuzzyHobbit/django-bitcoin | django_bitcoin/migrations/0007_auto__add_field_wallet_last_balance.py | Python | mit | 5,522 |
# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""FTPMaster base classes.
PackageLocation and SoyuzScript.
"""
__metaclass__ = type
__all__ = [
'SoyuzScriptError',
'SoyuzScript',
]
from lp.services.scripts.... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/soyuz/scripts/ftpmasterbase.py | Python | agpl-3.0 | 7,124 |
from django.dispatch import receiver
from django.db.models.signals import post_save, pre_save, pre_delete, post_delete
# from django.db.models.signals import m2m_changed
from django.contrib.auth.models import User, Group
from .models import UserProfile, GroupProfile
from guardian.shortcuts import assign_perm, remove... | BUPT-OJ-V4/BOJ-V4 | ojuser/signals.py | Python | mit | 2,684 |
"""
mbed SDK
Copyright (c) 2011-2013 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 wr... | FranklyDev/mbed | workspace_tools/export/uvision4.py | Python | apache-2.0 | 4,053 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
#
# Created on Fri Mar 31 15:57:14 2017
# @author: NealChenZhang
# This program is personal trading platform designed when employed in
# Aihui Asset Management as a quantitative analyst.
#
#... | nealchenzhang/Py4Invst | Market_Analysis/Market_Analysis_Tools/TS_Analysis.py | Python | mit | 14,362 |
import unittest
from lib.diskdetector import *
class DiskEventListenerTests(unittest.TestCase):
def setUp(self):
self.dl = DiskEventListener()
# Clear up any drives or disks that may be detected
self.drives = []
self.disks = []
self.test_device = 'test_device_1'
def te... | jrmhaig/Bakery | tests/diskdetector_tests.py | Python | apache-2.0 | 2,887 |
from unittest import TestCase
from itertools import cycle
from datetime import datetime
from wsgiref.util import setup_testing_defaults
from sqlalchemy.engine.reflection import Inspector
from cleaver import SplitMiddleware
from cleaver.backend.db import SQLAlchemyBackend
from cleaver.compat import next
class TestFu... | ryanpetrello/cleaver | cleaver/tests/test_stack.py | Python | bsd-3-clause | 4,380 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic functionality
of sblim_sfcb
@author Wang Tao <wang... | rajashreer7/autotest-client-tests | linux-tools/sblim_sfcb/sblim_sfcb.py | Python | gpl-2.0 | 1,610 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
集合学习
不会有重复元素
集合是无序的
是可变的,可以添加数据
'''
name = {'zhang','pan','liu','guan'}
print name
name.add('zhang') #添加元素,当列表中是有对应的元素中,添加时无效的
print name
name.add('li') #添加集合中不存在的元素是可以正常添加的
print name
#两个集合x\y
x = {1,2,3,4}
y = {3,4,5,6}
print x & y #交集
print x | y ... | zhangyage/Python-oldboy | day02/jihe_study.py | Python | apache-2.0 | 730 |
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | CSUChico-CINS465/CINS465-Fall2017-Lecture-Examples | mysitedocker/mysite/urls.py | Python | mit | 1,235 |
#! /usr/bin/python
from slides import Lecture, NumSlide, Slide, Bullet, SubBullet, PRE, URL
class Raw:
def __init__(self, title, html):
self.title = title
self.html = html
def toHTML(self):
return self.html
class HTML(Raw):
def __init__(self, html):
self.html = html
lectur... | kzys/buildbot | docs/PyCon-2003/bb-slides.py | Python | gpl-2.0 | 7,901 |
BBBB BBBBBBBBBB BBBB
BBBBBBBBB
XXX XXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX
BBB BBBB BB BBBBBBBBBBB
BB BBB BBBBBBBB BBB BBBBBBBBBBBBBBB BBB BBBBBBBBBBBBB
XXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXBB BBBBBBB XXXXXXBBBBBXX
XX XXXXXXBBB BBBBBBXX gettext('Home') XXXX
XXXXX
BBBBB
BB BBBBBBBBBB... | amigcamel/taipei.py | templates/pages/menus/primary.html.py | Python | mit | 548 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | gochist/horizon | openstack_dashboard/dashboards/admin/projects/tests.py | Python | apache-2.0 | 76,922 |
import sys
# http://www.python.org/dev/peps/pep-0396/
__version__ = '0.2.4'
if sys.version_info[:2] < (2, 4):
raise RuntimeError('PyASN1 requires Python 2.4 or later')
| mishfit/ZeroNet | src/lib/pyasn1/__init__.py | Python | gpl-2.0 | 175 |
# Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | dhermes/google-cloud-python | logging/tests/unit/test__helpers.py | Python | apache-2.0 | 4,188 |
# -*- 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):
# Adding model 'FacebookLikePlugin'
db.create_table('cmsplugin_facebooklikeplugin', (
('cmsplugi... | febsn/aldryn-facebook | aldryn_facebook/south_migrations/0001_initial.py | Python | bsd-3-clause | 19,543 |
from __future__ import with_statement
import pytest
from phase_2.make_it_pass.calculator import Calculator
from entry_error import EntryError
class TestCalculator(object):
def SetUp(self):
self.nb1 = 1
self.nb2 = 2
self.calculator = Calculator(self.nb1, self.nb2)
def Teardown(self):
... | damienpuig/tdd | phase_2/make_it_pass/test_calculator.py | Python | mit | 1,011 |
"""This submodule contains objects for handling different representations of models and model functions.
:synopsis: This submodule contains objects for handling different representations of models and model functions.
.. moduleauthor:: Johannes Gaessler <johannes.gaessler@student.kit.edu>
"""
from ._base impo... | dsavoiu/kafe2 | kafe2/fit/representation/model/__init__.py | Python | gpl-3.0 | 353 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='MapRenderingJob',
fields=[
('id', models.AutoFi... | hholzgra/maposmatic | www/maposmatic/migrations/0001_initial.py | Python | agpl-3.0 | 2,030 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.