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 |
|---|---|---|---|---|---|
# Copyright (c) 2013 Thomas Nicholson <tnnich@googlemail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, t... | coolhacks/docker-hacks | examples/dockpot/honssh/protocols/baseProtocol.py | Python | mit | 2,787 |
from __future__ import unicode_literals
import zipfile
from io import BytesIO
from xml.dom import minidom
from django.conf import settings
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.sites.models import Site
from django.test import (
TestCase, ignore_warnings, modify_settings, override_settin... | zhanghenry/stocks | tests/gis_tests/geoapp/test_sitemaps.py | Python | bsd-3-clause | 3,278 |
import emission.analysis.modelling.tour_model.data_preprocessing as preprocess
# to determine if the user is valid:
# valid user should have >= 10 trips for further analysis and the proportion of filter_trips is >=50%
def valid_user(filter_trips,trips):
valid = False
if len(filter_trips) >= 10 and len(filter_... | e-mission/e-mission-server | emission/analysis/modelling/tour_model/get_users.py | Python | bsd-3-clause | 1,172 |
#!/usr/bin/env python
"""
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 in the hope that it will... | megatron-uk/cyberknight-pce | tools/extractScript.py | Python | lgpl-3.0 | 22,961 |
import os
import numpy as np
from scipy.interpolate import RectBivariateSpline
from .adf11 import Adf11
datatype_abbrevs = {
'ionisation' : 'scd',
'recombination' : 'acd',
'continuum_power' : 'prb',
'line_power' : 'plt',
'cx_power' : 'prc',
'ionisation_potential' : 'ec... | cfe316/atomic | atomic/atomic_data.py | Python | mit | 11,657 |
from scapy.all import *
def add(n1, n2):
return n1+n2
"""
ip = ping = Ether()/IP(dst='8.8.8.8')/ICMP()
ip.show()
(r1, r2) = srp(ip)
r1.show()
"""
"""
dns = IP(dst='10.104.2.10')/UDP()/DNS(rd=1, qd=DNSQR(qname="www.perdu.com"))
#dns.show()
(r1, r2) = sr(dns)
r1.show()
r2.show()
"""
"""
def arpoison(targetIp, spoofI... | axtux/PyNetwork | test.py | Python | gpl-2.0 | 783 |
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from plone.app.layout.viewlets.common import ViewletBase
from uwosh.themebase.utils import getProperties
from zope.component import getMultiAdapter
from Products.CMFCore.utils import getToolByName
from AccessControl import getSecurityManager
from p... | uwosh/uwosh.themebase | uwosh/themebase/browser/viewlets/banner.py | Python | gpl-2.0 | 2,434 |
# Copyright (C) 2010-2012 Red Hat, Inc.
# This work is licensed under the GNU GPLv2 or later.
# list active storage pool testing with flag:
# libvirt.VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE
import libvirt
from libvirt import libvirtError
from libvirttestapi.src import sharedmod
required_params = ()
optional_params = {... | libvirt/libvirt-test-API | libvirttestapi/repos/storage/pool_list_active.py | Python | gpl-2.0 | 1,458 |
#! /usr/bin/env python
"""
Generate random MAC address
Inspired by http://www.linux-kvm.com/sites/default/files/macgen.py
"""
from sys import argv
import random
DEFAULT_OUI = '00-16-3e' # Xensource, Inc.
def random_mac(oui=None):
"""returns a random MAC address, with optional +oui+ override"""
mac_parts = ... | tardate/LittleCodingKata | python/random_mac_generation/random_mac.py | Python | mit | 558 |
#!/usr/bin/env python3
"""
Gets all race records from ql.leeto.fi with ranks recalculated/fixed.
"""
import json
import operator
import os
import requests
base_path = "oldtop"
os.makedirs(base_path, exist_ok=True)
data = requests.get("http://ql.leeto.fi/api/race").json()
maps = sorted([x["MAP"] for x in data["data"]... | cstewart90/QLRace-oldtop | get_all_old_times.py | Python | unlicense | 2,090 |
#!/usr/local/bin/python
from website import carts
import urllib2
import json
def load():
carts.remove_all()
request = 'http://data.cityofnewyork.us/resource/akqf-qv4n.json'
for i in range(0, 24000, 1000):
query = '?$offset=%d' % i
data = urllib2.urlopen(request + query)
results =... | stuycs-softdev-fall-2013/proj3-7-cartwheels | utils/load.py | Python | bsd-3-clause | 1,823 |
#!c:\users\lenovo\canopy\user\scripts\python.exe
import argparse
from copy import deepcopy
import itertools
import logging
import operator
import os
import random
import webbrowser
from safire.data.text_browser import TextBrowser
import safire.utils
from safire.data.image_browser import ImageBrowser
from safire.data.lo... | hajicj/safire | build/scripts-2.7/text_preprocessing_explorer.py | Python | gpl-3.0 | 5,788 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Import module for legacy KDE .po files.
This is an extension of standard gettext PO files.
You can read more about this file format from:
* http://l10n.kde.org/docs/translati... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/translations/utilities/kde_po_importer.py | Python | agpl-3.0 | 3,250 |
# coding: utf-8
# The Hazard Library
# Copyright (C) 2012 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later... | ROB-Seismology/oq-hazardlib | openquake/hazardlib/gsim/atkinson_wald_2007.py | Python | agpl-3.0 | 2,419 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/collada/library_geometries/geometry/mesh/_reference/_reference_color/_reference_color.py | Python | mit | 3,825 |
#!/usr/bin/env python
#
# Copyright 2015 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... | kevinli7/apitools | apitools/base/py/credentials_lib.py | Python | apache-2.0 | 30,033 |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# 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 appli... | a10networks/acos-client | acos_client/version.py | Python | apache-2.0 | 641 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010-2013 Código Sur Sociedad Civil
# All rights reserved.
#
# This file is part of Cyclope.
#
# Cyclope 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 Foundati... | MauHernandez/cyclope | setup.py | Python | gpl-3.0 | 3,385 |
#!/usr/bin/env python
#
# Copyright 2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your optio... | iohannez/gnuradio | gr-blocks/examples/tags/test_file_tags.py | Python | gpl-3.0 | 1,550 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_qc.configuration import Configuration
class... | Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/telestream_cloud_qc/models/header_byte_count_test.py | Python | mit | 4,912 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2013 IBM Corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you... | vmthunder/nova | nova/network/api.py | Python | apache-2.0 | 23,489 |
# -*- coding: utf-8 -*-
from mutagen._util import DictMixin, cdata, insert_bytes, delete_bytes
from mutagen._util import decode_terminated, dict_match, enum, get_size
from mutagen._util import BitReader, BitReaderError, resize_bytes
from mutagen._compat import text_type, itervalues, iterkeys, iteritems, PY2, \
cBy... | douglaskastle/mutagen | tests/test__util.py | Python | gpl-2.0 | 23,223 |
#
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from json import loads, dumps
from os.path import dirname, join
from requests import HTTPError
from requests_mock import ANY, mock as requests_mock
from unittest import TestCase
from octodns.record import Record
from octod... | vanbroup/octodns | tests/test_octodns_provider_powerdns.py | Python | mit | 10,481 |
#!/usr/bin/python
# System of three linear equations
# ax + by + cz = j
# dx + ey + fz = k
# gx + hy + iz = l
# System of three linear equations in matrix notation
# - - - - - -
# | a b c | | x | | j |
# | | | | | |
# | d e f | | y | = | k |
# | | | | |... | mikequentel/sarrus_cramer | sclinear.py | Python | mit | 4,841 |
# Copyright 2020 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... | davidzchen/tensorflow | tensorflow/python/keras/layers/preprocessing/category_encoding.py | Python | apache-2.0 | 19,939 |
"""Tests for the storage objects"""
import unittest
import serge.render
import serge.engine
import serge.actor
import serge.visual
import serge.world
import serge.events
import serge.blocks.utils
import serge.blocks.storage
from helper import *
class TestStorage(unittest.TestCase, VisualTester):
"""Tests for t... | gdos/serge | test/teststorage.py | Python | lgpl-3.0 | 5,463 |
# 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... | RobinQuetin/CAIRIS-web | cairis/cairis/NewRequirementNodeDialog.py | Python | apache-2.0 | 3,316 |
from __future__ import absolute_import, division, print_function
import numpy as np
from pandas import DataFrame
import numpy as np
from odo import resource, into
from datashape.predicates import isscalar, iscollection, isrecord
from blaze.expr import symbol, by
from blaze.interactive import Data
from blaze.compute im... | ChinaQuants/blaze | blaze/compute/tests/test_comprehensive.py | Python | bsd-3-clause | 4,570 |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 22 14:18:45 2016
@author: Alex Kerr
Define functions that draw molecule objects.
"""
import copy
from itertools import cycle
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from .molecule import ... | ajkerr0/kappa | kappa/plot.py | Python | mit | 16,060 |
#! /usr/bin/env python
# This file is part of Codeface. Codeface 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... | bockthom/codeface | codeface/dbmanager.py | Python | gpl-2.0 | 21,118 |
#!/usr/bin/env python
###################################################################################
# #
# This script should be executed as the last thing that happens during #
# the configuration phase of a server. It will perform the health check #
# defined in the load balanceri(s) co... | eljrax/autoscale_setup | load_balancing/add_self_to_lb.py | Python | apache-2.0 | 5,035 |
#!/bin/python3
"""
TODO:
1. Make a function for each feed
a. Physics - done
b. apnews or rtnews
1. rtnews - done
2. rtxxyy
3. rtyyxx
4. ap
c. local news
2. Save to text or save to DB?
3. Create html template for the news
4. PHP script to push
"""
from bs4 import Beautiful... | elakamarcus/python | get_news.py | Python | gpl-3.0 | 1,936 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the Li... | jhol/libsigrokdecode | decoders/rtc8564/pd.py | Python | gpl-3.0 | 7,600 |
default_app_config = 'gw_app.apps.GatewaysAppConfig'
| bashmak/djing | gw_app/__init__.py | Python | unlicense | 53 |
from django.shortcuts import get_object_or_404
from rest_framework import permissions
from account.models import User, Follow
class UserUpdatePermission(permissions.BasePermission):
"""
You don't have permission to update other users
"""
def has_permission(self, request, view):
forbidden_meth... | pombredanne/snippit | snippit/apps/account/permissions.py | Python | mit | 1,369 |
# -*- coding: utf-8 -*-
#
# Board.py
#
# Copyright (c) 2015 Elektro-potkan <git@elektro-potkan.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including witho... | elektro-potkan/AllcompTunerBoards-python-RPi | Board.py | Python | mit | 4,875 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-09 23:07
from __future__ import unicode_literals
from django.db import migrations, models
import jobs.models
class Migration(migrations.Migration):
dependencies = [
('jobs', '0025_invitationcode'),
]
operations = [
migration... | Santiago-vdk/jabbs | jobs/migrations/0026_auto_20160209_1707.py | Python | apache-2.0 | 509 |
import numpy
from matplotlib import pyplot as plt
class Model:
def __init__(self, train):
self._train = train
def fit(self, beta, grad=True):
return self(self._train, beta, grad=grad)
class MultiModel(Model):
def __init__(self, train, terms):
"""
Arguments:
train {*} - The training data ... | bauerca/BikeShareDemand_Carl | models.py | Python | gpl-2.0 | 4,087 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai et ts=4 sw=4 sts=4 fenc=UTF-8 ft=python
"""
dnszonetest.exceptions
-----------------------
All exceptions used in the Dnszonetest code base are defined here.
"""
class DnszonetestException(Exception):
"""
Base exception class. All Dnszonetest-specific e... | maartenq/dnszonetest | dnszonetest/exceptions.py | Python | isc | 619 |
##############################################################################
#
# 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_louvain | base/tests/business/learning_units/test_comparison.py | Python | agpl-3.0 | 10,546 |
from __future__ import absolute_import
from .Equilibrator import Equilibrator
from .Fixed import Fixed
from .VariablepH import VariablepH
equilibrators = {None: Equilibrator,
'fixed': Fixed,
'pH': VariablepH,
}
| lewisamarshall/emigrate | emigrate/equilibration_schemes/__init__.py | Python | gpl-2.0 | 264 |
import unittest, sys
sys.path.extend(['.','..','../..','py'])
import h2o2 as h2o
import h2o_cmd, h2o_import as h2i, h2o_browse as h2b
from h2o_test import find_file, dump_json, verboseprint
import time
def assertEqualMsg(a, b): assert a == b, "%s %s" % (a, b)
def parseKeyIndexedCheck(frames_result, multiplyExpected)... | YzPaul3/h2o-3 | py2/testdir_single_jvm/test_parse_covtype_2_maprfs.py | Python | apache-2.0 | 5,089 |
import operator
def person_lister(f):
def inner(people):
# complete the function
people = [f(i) for i in sorted(people, key=lambda x: int(x[2]))]
return people
return inner
@person_lister
def name_format(person):
return ("Mr. " if person[3] == "M" else "Ms. ") + person[0] + " " +... | avtomato/HackerRank | Python/_15_Closures_and_Decorators/_02_Decorators_2-Name_Directory/solution.py | Python | mit | 461 |
from xdist.dsession import DSession, get_default_max_worker_restart
from xdist.report import report_collection_diff
from xdist.scheduler import EachScheduling, LoadScheduling
import py
import pytest
import execnet
XSpec = execnet.XSpec
def run(item, node, excinfo=None):
runner = item.config.pluginmanager.getplu... | RonnyPfannschmidt/pytest-xdist | testing/test_dsession.py | Python | mit | 10,349 |
# Plugin by Infinity - <https://github.com/infinitylabs/UguuBot>
import requests
from sqlalchemy import Column, String, Table, select
from yarl import URL
from cloudbot import hook
from cloudbot.util import colors, database
from cloudbot.util.http import parse_soup
table = Table(
'horoscope',
database.metadat... | snoonetIRC/CloudBot | plugins/horoscope.py | Python | gpl-3.0 | 3,858 |
# 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 u... | NECCSiPortal/NECCSPortal-dashboard | nec_portal/nec_portal_index/panel.py | Python | apache-2.0 | 726 |
def NumberGameIII(S):
flag_max = True
min_number = min(S)
for elem in S:
quotient = float(elem)/float(min_number)
flag = quotient - int(quotient)
if flag != 0.0:
flag_max = False
if flag_max:
return min_number
else:
return -1
| TheSriram/codefightchallenges | numbergamesIII/numbergamesIII.py | Python | mit | 311 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2020-05-02 00:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("proposals", "0026_auto_20200323_2010"),
]
operations = [
migrations.AddField(
... | pythonindia/junction | junction/proposals/migrations/0027_auto_20200502_0540.py | Python | mit | 875 |
#!/usr/bin/python
# abstract class for processing episodes
import optparse
import configparser
import os,sys,subprocess,socket
import datetime,time
import fixunicode
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dj.settings")
sys.path.insert(0, '..' )
sys.path.insert(0, '../lib' )
from django.conf import settin... | yoe/veyepar | dj/scripts/process.py | Python | mit | 16,593 |
import unittest
import daemon
class DaemonTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_empy(self):
"""Don't test anything yet."""
pass
def main():
unittest.main()
if __name__ == '__main__':
main()
| canerdogan/sd-agent | tests/test_daemon.py | Python | bsd-3-clause | 294 |
# -*- coding: utf-8 -*-
from .utils import SummaryWriter
from .input import OpenCVInputLayer
from .input import ROSInputLayer
from .nodes import AutoEncoderNode
from .nodes import StackedAutoEncoderNode
from .architectures import *
| elggem/tensorflow_node | src/tensorflow_node/__init__.py | Python | unlicense | 232 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000291',
version=20140916,
description='BIOMD0000000291 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000291',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000291 | setup.py | Python | cc0-1.0 | 377 |
from pylab import *
import pSpectral;
ion()
Nx = 256
Ny = 256
lengthX = 2*pi
lengthY = 60
tx = linspace(-pi,pi-2*pi/Nx,Nx)
ty = linspace(0,pi,Ny)
xx = (lengthX/ (2*pi))*(tx)
yy = (lengthY/2.)*cos(ty)
[x,y] = meshgrid(xx,yy)
a = pSpectral.parSpectral(Nx,Ny, lengthX, lengthY, 'Fourier', 'Cosine')
#test = exp(-x*... | JoyMonteiro/parSpectral | pspec/testChebyshev.py | Python | bsd-3-clause | 1,003 |
import sys
import json
import random
import requests
class Rest(object):
@classmethod
def post(cls,resource, data, filter=None):
headers = {'Content-Type': 'application/json'}
if filter:
scode, datao = cls.get(resource, filter)
if len(datao) > 0:
return ... | karvenka/cloudmesh.docker | cloudmesh/api/Rest_client.py | Python | apache-2.0 | 3,442 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import sys
import pytest
from django.core.... | ta2-1/pootle | tests/pootle_fs/commands/init_fs_project.py | Python | gpl-3.0 | 4,254 |
#! /usr/bin/env python2
"""
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 applicabl... | DanKupiniak/mbed | tools/test.py | Python | apache-2.0 | 9,320 |
# Copyright (C) 2008 PreludeIDS Technologies. All Rights Reserved.
# Author: Sebastien Tricaud <toady@inl.fr>
#
# This file is part of the Prewikka program.
#
# 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... | chifflier/prelude-notify | PreludeNotify/x11idle.py | Python | gpl-2.0 | 2,786 |
import unittest
import os
import shutil
import hashlib
from nose.tools import assert_true
from nose.tools import assert_false
from nose.tools import assert_equal
from pyvault.backends.sptree import PyVaultShortenedPairtreeBackend
class VaultShortPairtree(unittest.TestCase):
"""
Testing the shortened pair... | drtoful/pyvault | tests/10_sptree_test.py | Python | bsd-3-clause | 1,503 |
from flask import Blueprint, current_app, jsonify, request
from itsdangerous import BadData, SignatureExpired
from notifications_utils.url_safe_token import check_token, generate_token
from app.config import QueueNames
from app.dao.invited_user_dao import (
get_invited_user_by_id,
get_invited_user_by_service_a... | alphagov/notifications-api | app/service_invite/rest.py | Python | mit | 5,059 |
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^', include('urls', namespace='cove-resourceprojects', app_name='cove')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
| OpenDataServices/resource-projects-etl | modules/urls_multi.py | Python | gpl-2.0 | 285 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | savi-dev/heat | heat/tests/test_neutron.py | Python | apache-2.0 | 46,371 |
import os
import sys
import datetime
manualAdv = (
('templateManual.html', 'manual_adv_features' , 'Features' ),
('templateManual.html', 'manual_adv_pyunit' , 'Unittest integration' ),
('templateManual.html', 'manual_adv_interact... | aptana/Pydev | bundles/com.python.pydev.docs/merged_homepage/scripts/build_merged.py | Python | epl-1.0 | 8,121 |
from django.conf.urls import include, url
import trees.views
import dashboard.views
urlpatterns = [
url(r'^$', dashboard.views.tree_map),
url(r'^geojson/', trees.views.return_geojson),
url(r'^embed/', dashboard.views.tree_map_widget),
url(r'^(?P<id>[^/]+)/json/', trees.views.return_tree_json),
url... | i-DAT-Qualia/Qualia-Urban | app/trees/urls.py | Python | gpl-3.0 | 747 |
from spreadsheetdb.backend.connection import connection
from spreadsheetdb.base import Model
from spreadsheetdb.field import DynamicField
class TestModel4(Model):
test1 = DynamicField(default="")
test5 = DynamicField(default="default")
test3 = DynamicField(default=1)
test2 = DynamicField(default="defa... | uptown/GoogleSpreadSheetDB | spreadsheetdb/test/model_test.py | Python | mit | 1,052 |
def select(table, user_id, constr='', fields="*"):
"""
fields = []
constr = [1,2,3] /id
"""
if fields!='*':
fields = ", ".join(fields)
select_query = 'SELECT '+fields+" FROM "
select_query += table
select_query += " WHERE user_id="+user_id
if constr!='':
sel... | rapkin/data-vis | helpers/sql.py | Python | mit | 1,752 |
from overrides import overrides
from allennlp.common.util import JsonDict
from allennlp.data import Instance
from allennlp.service.predictors.predictor import Predictor
@Predictor.register('machine-comprehension')
class BidafPredictor(Predictor):
"""
Wrapper for the :class:`~allennlp.models.bidaf.Bidirection... | nafitzgerald/allennlp | allennlp/service/predictors/bidaf.py | Python | apache-2.0 | 694 |
__author__ = 'dmorina'
from crowdsourcing import models
from datetime import datetime
from rest_framework import serializers
import json
class CategorySerializer(serializers.ModelSerializer):
deleted = serializers.BooleanField(read_only=True)
class Meta:
model = models.Category
fields = ('id'... | asmitagupta/crowdsource-platform | crowdsourcing/serializers/project.py | Python | mit | 2,360 |
"""add reports table
Revision ID: 8240039fd3
Revises: 1c9398290e4
Create Date: 2014-06-06 19:38:39.487416
"""
# revision identifiers, used by Alembic.
revision = '8240039fd3'
down_revision = '1c9398290e4'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
def ... | thomaserlang/stocksum | src/stocksum/web/alembic/versions/8240039fd3_add_reports_table.py | Python | mit | 2,751 |
import uuid
from copy import deepcopy
from objects.coordinates import Coordinates
from objects import GameObject
class ManMade(GameObject):
yaml_tag = "!ManMade"
| matthew-parlette/space-sim | game/objects/manmade/__init__.py | Python | gpl-2.0 | 167 |
#!/usr/bin/env python
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if os.path.exists('README.rst'):
long_description = open('README.rst').read()
else:
long_description = "Yandex Speech Cloud Tools"
setup(name='yandex-speech-cloud',
version='0.1... | go1dshtein/yandex-speech-cloud-python | setup.py | Python | gpl-2.0 | 1,023 |
#!/usr/bin/env python3
#
# Script to generate a violin plot of the distribution of flower marker points
# from a collection of runs of evobee
#
# Usage: plot-mp-distrib.py title mpcountmpfile [mpcountmpfile2 [mpcountmpfile3 ...]]
# where each mpcountmpfile is a CSV format with layout: marker point, count
#
# Outputs:... | tim-taylor/evobee | utils/plot-mp-distrib-violin.py | Python | gpl-3.0 | 2,936 |
"""
WSGI config for djangochat 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | scarescrow/LongPollChat | djangochat/wsgi.py | Python | mit | 398 |
# -*- coding: utf-8 -*-
import copy
import datetime
import mock
import pytest
import elastalert.alerts
import elastalert.ruletypes
from elastalert.config import get_file_paths
from elastalert.config import load_configuration
from elastalert.config import load_options
from elastalert.config import load_rules
from elas... | saltukalakus/elastalert | tests/config_test.py | Python | apache-2.0 | 6,673 |
from .sampler import standardize_design
from .sampler import standardize_cov
from .sampler import TraitSampler
from .sampler import BernoulliTraitSampler
from .sampler import BinomialTraitSampler
from .sampler import binary_effsiz_sampler
from .sampler import normal_effsiz_sampler
from .sampler import static_effsiz_sam... | PMBio/limix | limix/modules/sim/__init__.py | Python | apache-2.0 | 372 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackmanharris
import math
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import dftModel as DFT
import utilFunctions as UF
(fs, x) = UF... | acmaheri/sms-tools | lectures/6-Harmonic-model/plots-code/piano-spectrum.py | Python | agpl-3.0 | 1,030 |
# Copyright (C) 2015 Manuel Hirschauer (manuel@hirschauer.net)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version... | shouldmakemusic/yaas | helper/SongHelper.py | Python | gpl-2.0 | 4,457 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field tags on 'RssAtomFeed'
db.delete_table(db.s... | WillianPaiva/1flow | oneflow/core/migrations/0037_auto.py | Python | agpl-3.0 | 35,280 |
from django.apps import AppConfig
class RedditConfig(AppConfig):
name = 'reddit'
| hcosta/escueladevideojuegos.net-backend-django | edv/reddit/apps.py | Python | gpl-3.0 | 87 |
"""
Provide pre-made queries on top of the recorder component.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/history/
"""
import asyncio
from collections import defaultdict
from datetime import timedelta
from itertools import groupby
import logging
imp... | Duoxilian/home-assistant | homeassistant/components/history.py | Python | mit | 11,138 |
import os
import signal
from os.path import expanduser
from ioflo.base.consoling import Console
from plenum.cli.cli import Exit
from stp_core.common.log import Logger, getlogger
from sovrin_client.agent.run_agent import runBootstrap
from sovrin_client.test.agent.test_walleted_agent import TestWalletedAgent
from ple... | keenondrums/sovrin-node | sovrin_client/test/agent/base_agent.py | Python | apache-2.0 | 7,947 |
import pytest
from bson.objectid import ObjectId
from app import utils
object_id_scenarios = [
[ObjectId(), True],
[str(ObjectId()), True],
['invalid', False],
['11002299338844775566', False],
[1234567890, False],
[[], False]
]
@pytest.mark.parametrize('value, expected', object_id_scenarios)... | alexandre/flask-rest-template | tests/test_utils.py | Python | unlicense | 419 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('builder', '0002_auto_20150505_2035'),
]
operations = [
migrations.AddField(
model_name='problem',
na... | kopringo/Scarky2 | Scarky2/builder/migrations/0003_problem_saved.py | Python | mit | 403 |
import re
from rest_framework import serializers
from .models import Source, Video
class SourceSerializer(serializers.ModelSerializer):
class Meta:
model = Source
fields = ('id', 'url', 'title', 'typ')
read_only_fields = ('id', 'title', 'typ')
def validate_id(self, id):
if ... | zee93/yt_lab | yt_lab/content/serializers.py | Python | mit | 1,585 |
# Copyright 2011 Nicholas Bray
#
# 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... | ncbray/pystream | bin/analysis/ipa/constraints/calls.py | Python | apache-2.0 | 7,053 |
#!/usr/bin/env python3
PATH = './name.txt'
def main():
with open(PATH, 'r') as f:
full_name = f.readline().strip()
last_name = full_name.split(':')[1]
print(last_name)
if __name__ == "__main__":
main()
| jmdots/cicd-demo | get_name.py | Python | apache-2.0 | 229 |
"""
Util class
"""
from django.forms import ModelForm, CharField, URLField, BooleanField
from django.db import models
from models import Entry
def getForm(user):
""" If no form is passed in to new/edit views, use this one """
class _Form(ModelForm):
class Meta:
model = Entry
fields = ('title', 'body',)
de... | manfredmacx/django-convo | convo/Convo.py | Python | mit | 2,261 |
#!/usr/bin/env python
import sqlite3
import sys
def print_words(path):
conn = sqlite3.connect(path)
c = conn.cursor()
for row in c.execute('SELECT stem FROM words'):
print row[0].lower()
c.close()
conn.close()
if __name__ == '__main__':
file = sys.argv[1] if len(... | tcudok/KindleVocabExporter | export_words.py | Python | mit | 376 |
# Appendix C11 - base.py
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
| jackscotti/klassify | src/base.py | Python | mit | 108 |
# -*- coding: utf-8 -*-
import asyncio
import logging
from alamo_scheduler.conf import settings
from pip import get_installed_distributions
from aiohttp.client import ClientSession
from aiohttp.web import Application, Response, json_response
logger = logging.getLogger(__name__)
__all__ = ['ClientSession', 'json_res... | RulersOfAsgard/ALAMO-scheduler | alamo_scheduler/aioweb.py | Python | apache-2.0 | 3,647 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class AccountJournal(models.Model):
_inherit = 'account.journal'
invoice_reference_model = fields.Selection(selection_add=[
('fi', 'Finnish Standard Reference'),
('fi_rf', 'Finnish Cred... | ddico/odoo | addons/l10n_fi/models/account_journal.py | Python | agpl-3.0 | 517 |
#!/usr/bin/env python3
import fnmatch
import os
import re
import ntpath
import sys
import argparse
def validKeyWordAfterCode(content, index):
keyWords = ["for", "do", "count", "each", "forEach", "else", "and", "not", "isEqualTo", "in", "call", "spawn", "execVM", "catch", "param", "select", "apply"];
for word ... | IDI-Systems/acre2 | tools/sqf_validator.py | Python | gpl-3.0 | 8,507 |
"""
@file
@author Chrisitan Urich <christian.urich@gmail.com>
@version 1.0
@section LICENSE
This file is part of VIBe2
Copyright (C) 2011 Christian Urich
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 Founda... | christianurich/VIBe2Modules | scripts/__evaluation/totallengthoflines.py | Python | gpl-2.0 | 1,837 |
#! /usr/bin/env python2
"""
poller-service A service to wrap SNMP polling. It will poll up to $threads devices at a time, and will not re-poll
devices that have been polled within the last $poll_frequency seconds. It will prioritize devices based
on the last time polled. If resources a... | pheinrichs/librenms | poller-service.py | Python | gpl-3.0 | 14,369 |
# Copyright (c) 2014 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | beagles/neutron_hacking | neutron/tests/unit/vmware/nsxlib/test_l2gateway.py | Python | apache-2.0 | 13,213 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of Zeitgeist Borders (https://github.com/fabelier/Zeitgeist-Borders/)
# Developed by Antoine Mazières, Samuel Huron and Julien Palard.
# Contact : admin at fabelier dot org
#
# Zeitgeist Borders is free software: you can redistribute it and/or modify
#... | fabelier/Zeitgeist-Borders | http.py | Python | gpl-3.0 | 3,245 |
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.views import generic
from django.urls import reverse
from django.utils import timezone
from .models import Choice, Question
class IndexView(generic.ListView):
template_name = 'polls/index.html'
cont... | bfrick22/example-api | mysite/polls/views.py | Python | unlicense | 1,802 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import unicode_literals
from builtins import open
import os
from tempfile import mkstemp, mkdtemp
import warnings
from ...testing import (assert_equal, assert_true,... | carolFrohlich/nipype | nipype/utils/tests/test_filemanip.py | Python | bsd-3-clause | 12,556 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import fun... | Azure/azure-sdk-for-python | sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py | Python | mit | 52,076 |
from django.core.management import CommandError
from dju_common.management import LoggingBaseCommand
from . import profiles_validate
from ...maintenance import remake_images_variants
class Command(LoggingBaseCommand):
help = 'Remake variants for uploaded images.'
def add_arguments(self, parser):
supe... | liminspace/dju-image | dju_image/management/commands/dju_image_remake_variants.py | Python | mit | 1,242 |
# Copyright 2014-2016 Morgan Delahaye-Prat. All Rights Reserved.
#
# Licensed under the Simplified BSD License (the "License");
# you may not use this file except in compliance with the License.
import pytest
from hypr.helpers.mini_dsl import Range
@pytest.mark.populate(10)
class TestIntervalTypes:
models = 'S... | project-hypr/hypr2 | tests/models/test_range_filter.py | Python | bsd-2-clause | 4,895 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.