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 |
|---|---|---|---|---|---|
#!/usr/bin/python
from app import app
if __name__ == "__main__":
app.run(debug=True, port=5001, host='0.0.0.0')
| jelly/leetnews | run.py | Python | mit | 118 |
#!/usr/bin/env python
"""
=====
Atlas
=====
Atlas of all graphs of 6 nodes or less.
"""
# Author: Aric Hagberg (hagberg@lanl.gov)
# Copyright (C) 2004-2019 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
... | sserrot/champion_relationships | venv/share/doc/networkx-2.4/examples/drawing/plot_atlas.py | Python | mit | 2,796 |
# coding: utf-8
# Copyright 2017 video++ Project, SJTU MediaLab
#
# 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... | ArthurChiao/videoplusplus | vpp/storage/driver.py | Python | apache-2.0 | 1,521 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import os
f... | vied12/superdesk | server/superdesk/io/rfc822_parser_test.py | Python | agpl-3.0 | 3,444 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# mail_receiver.py
# Copyright (C) 2013 LEAP
#
# 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 opti... | meskio/leap_mx | src/leap/mx/mail_receiver.py | Python | agpl-3.0 | 16,282 |
"""
File: <Sin2_plus_cos2>
Copyright (c) 2016 <Lauren Graziani>
License: MIT
<debugging a program>
"""
"""
# a
from math import sin, cos #need to import pi from math
x = pi/4
1_val = math.sin^2(x) + math.cos^2(x) #can't start a variable with a number, powers are written by **
print 1_VAL
"""
# a debugged
from m... | chapman-cpsc-230/hw1-grazi102 | sin2_plus_cos2.py | Python | mit | 1,198 |
#!/usr/bin/env python
import os
import re
import sys
import codecs
from setuptools import setup, find_packages
# When creating the sdist, make sure the django.mo file also exists:
if 'sdist' in sys.argv or 'develop' in sys.argv:
os.chdir('seo')
try:
from django.core import management
managem... | bashu/django-easy-seo | setup.py | Python | gpl-3.0 | 2,428 |
import abc
class Defense(object):
@abc.abstractmethod
def name(self):
pass
@abc.abstractmethod
def description(self):
pass
@abc.abstractmethod
def attacker_message(self):
pass
@abc.abstractmethod
def observer_message(self):
pass
@abc.abstractmeth... | ChrisLR/Python-Roguelike-Template | combat/defenses/base.py | Python | mit | 451 |
#!/usr/bin/env python
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2001-2006 James Henstridge
#
# changecvsroot.py: script to alter the CVS root of a working copy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pub... | ahmeier/jhbuild | scripts/changecvsroot.py | Python | gpl-2.0 | 1,618 |
# Time: O(1.189), counted by statistics, limit would be O(log10/log7) = O(1.183)
# Space: O(1)
# Given a function rand7 which generates a uniform random integer in the range 1 to 7,
# write a function rand10 which generates a uniform random integer in the range 1 to 10.
#
# Do NOT use system's Math.random().
#
# Exam... | tudennis/LeetCode---kamyu104-11-24-2015 | Python/implement-rand10-using-rand7.py | Python | mit | 1,761 |
# -*- coding:utf-8 -*-
import unittest, sys, os, re, random, string, time, subprocess
sys.path[:0] = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
from datetime import datetime
from saklient.util import Util
from saklient.cloud.api import API
from saklient.cloud.resources.routerplan import RouterPlan
fro... | sakura-internet/saklient.python | tests/test_router.py | Python | mit | 6,717 |
#!/usr/bin/env python
from xml.dom import minidom
import sys
doc = minidom.parse(sys.argv[1])
filters = doc.getElementsByTagName('pattern')
print "char * stringlst = ["
for filter in filters:
id = filter.getAttribute('id')
stockid = filter.getAttribute('inkscape:stockid')
print "N_(\"" + stockid + "\"),"
prin... | Huluzai/DoonSketch | inkscape-0.48.5/share/patterns/i18n.py | Python | gpl-2.0 | 327 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | jakereps/q2cli | q2cli/tests/test_core.py | Python | bsd-3-clause | 6,485 |
#! ../env/bin/python
#
# Add all your necessary imports here. Typically, __init__.py should only contain imports and not code
#
# The package version
__version__ = '0.0.1'
# Defines the list of module names to be imported, when "from package import *" is encountered
__all__ = []
| kirang89/bootstrapy | mypackage/__init__.py | Python | bsd-2-clause | 283 |
"""Details about printers which are connected to CUPS."""
import importlib
import logging
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_PORT
from h... | joopert/home-assistant | homeassistant/components/cups/sensor.py | Python | apache-2.0 | 10,683 |
import os.path
from django.test import TestCase
from django.test.client import RequestFactory
from django.db import models
# from edc.testing.tests.factories import TestModelFactory
from ..classes import ModelLabel
from ..models import LabelPrinter
from .factories import LabelPrinterFactory, ClientFactory, ZplTempla... | botswana-harvard/getresults-label | getresults_label/tests/model_label_tests.py | Python | gpl-2.0 | 5,259 |
# -*- encoding: utf-8 -*-
# Copyright © 2012 New Dream Network, LLC (DreamHost)
# 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.... | hpproliant/ironic | ironic/api/app.py | Python | apache-2.0 | 3,477 |
#!/usr/bin/env python3
#
# This file is part of sarracenia.
# The sarracenia suite is Free and is proudly provided by the Government of Canada
# Copyright (C) Her Majesty The Queen in Right of Canada, Environment Canada, 2008-2015
#
# Questions or bugs report: dps-client@ec.gc.ca
# sarracenia repository: git://git.code... | petersilva/metpx-sarracenia | sarra/sr_sarra.py | Python | gpl-2.0 | 8,710 |
import LinkList
class Queue(LinkList.LinkList):
def showqueue(self):
self.showlist()
def enqueue(self,data):
self.addattail(data)
def dequeue(self):
print self.Head.get_data(),"is the dequeued data"
print "Rest of the Queue:"
self.delhead()
def main():
pass
... | ketand114/beginnerpyfuncoding | QueueLinkList.py | Python | gpl-2.0 | 523 |
import _plotly_utils.basevalidators
class OrientationValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="orientation",
parent_name="layout.coloraxis.colorbar",
**kwargs
):
super(OrientationValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/coloraxis/colorbar/_orientation.py | Python | mit | 526 |
#!/usr/bin/env python3
"Load data, scale, train a linear model, output predictions"
import pandas as pd
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures, MinMaxScaler
from sklearn.preprocessing import Normalizer, MaxAbsScaler, StandardScaler, RobustScaler
f... | altermarkive/Resurrecting-JimFleming-Numerai | src/ml-zygmuntz--numer.ai/march/predict_lr.py | Python | mit | 1,584 |
# ########################## Copyrights and License #############################
# #
# Copyright 2016 Yang Fang <yangfangscu@gmail.com> #
# ... | xiaofeiyangyang/physpetools | physpetool/phylotree/consensustree.py | Python | gpl-3.0 | 2,984 |
import unittest
from benchmarker.benchmarker import run
class MiscTests(unittest.TestCase):
def test_no_framework(self):
with self.assertRaises(Exception):
run([])
def test_no_problem(self):
with self.assertRaises(Exception):
run(["--framework=pytorch"])
def test... | undertherain/benchmarker | test/test_misc.py | Python | mpl-2.0 | 625 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='MediaCategory',
fields=[
... | ic-labs/django-icekit | icekit/migrations/0001_initial.py | Python | mit | 862 |
import math
import random
import copy
import pickle
"""
multilayer neural network.
This version is designed for effeciency so is less object oriented.
The bias input in implemented by adding an extra weight to each set of inputs.
The weights are stored as an 3 dimensional array [layers][neurons_in_layer][weight... | pauljohnleonard/pod-world | CI_2014/ATTIC/OLD_SIMULATION_CODE/CartWithIP/brain.py | Python | gpl-2.0 | 7,638 |
# Solfege - free ear training software
# Copyright (C) 2007, 2008, 2011 Tom Cato Amundsen
# License is GPL, see file COPYING
import os
import unittest
from solfege.soundcard.exporter import MidiExporter
from solfege.mpd.track import Track
from solfege.testlib import outdir
class TestMidiExporter(unittest.TestCase):
... | yuanyelele/solfege | solfege/soundcard/tests/test_exporter.py | Python | gpl-3.0 | 922 |
import datetime
from calendar import timegm
from jwt import MalformedJWT, JWT
from openid.consumer.consumer import Consumer, SUCCESS, CANCEL, FAILURE
from openid.consumer.discover import DiscoveryFailure
from openid.extensions import sreg, ax, pape
from social.utils import url_add_parameters
from social.backends.bas... | merutak/python-social-auth | social/backends/open_id.py | Python | bsd-3-clause | 14,789 |
"""
SNMPMixin for objects that can be accessed with SNMP
"""
import clusto
from clusto.drivers.resourcemanagers import IPManager
# Get rid of pesky errors about missing routes and tcpdump
import logging
runtime = logging.getLogger('scapy.runtime')
runtime.setLevel(logging.ERROR)
loading = logging.getLogger('scapy.loa... | rongoro/clusto | src/clusto/drivers/devices/common/snmpmixin.py | Python | bsd-3-clause | 2,220 |
import os
import shutil
import json
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from rest_framework import status
from hs_core import hydroshare
from hs_core.models import BaseResource, ResourceFile
from hs_core.views import create_resource
from hs_core.testing import Mo... | ResearchSoftwareInstitute/MyHPOM | hs_app_timeseries/tests/views/test_create_timeseries_resource.py | Python | bsd-3-clause | 6,012 |
# -*- coding: utf-8 -*-
from navmazing import NavigateToSibling
from widgetastic.widget import Checkbox, Text, View
from widgetastic_manageiq import Accordion, ManageIQTree
from widgetastic_patternfly import Button, Dropdown, Input
from cfme.base import Server
from cfme.base.login import BaseLoggedInPage
from cfme.bas... | jkandasa/integration_tests | cfme/automate/__init__.py | Python | gpl-2.0 | 3,556 |
import os, sys
from pdb import set_trace
import pandas as pd
import fnmatch
def recursive_glob(treeroot, pattern):
results = []
for base, dirs, files in os.walk(treeroot):
goodfiles = fnmatch.filter(files, pattern)
results.extend(os.path.join(base, f) for f in goodfiles)
return results
d... | bellwethers-in-se/defects | src/data/mccabe/renamehdr.py | Python | mit | 682 |
""" Views for the layout application """
from django.shortcuts import render, HttpResponseRedirect
import django
def home(request):
""" Default view for the root """
djangoversion = django.get_version()
return render(request, 'layout/home.html',{'djangoversion':djangoversion })
def profile(request):
... | allox/django-base-template | layout/views.py | Python | bsd-3-clause | 370 |
import time
from datetime import timedelta
from typing import List
from treeherder.config import settings
from treeherder.perf.sheriffing_criteria import (
EngineerTractionFormula,
FixRatioFormula,
CriteriaTracker,
TotalAlertsFormula,
)
from treeherder.perf.sheriffing_criteria import criteria_tracking... | jmaher/treeherder | treeherder/perf/management/commands/compute_criteria_formulas.py | Python | mpl-2.0 | 5,956 |
import RPi.GPIO as GPIO
class raspio:
def __init__(self, setup):
# 5v 5v GN 14 15 18 GN 23 24 GN 25 08 07 DC GN 12 GN 16 21 21
#-----------------------------------------------------------------#
# 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 #
# 1 3 5 7 ... | parnedo/rasp-home | temperature_node/raspio.py | Python | mit | 1,414 |
__author__ = 'bptripp'
from cnn_stimuli import get_image_file_list
import cPickle as pickle
import time
import numpy as np
import matplotlib.pyplot as plt
from alexnet import preprocess, load_net, load_vgg
def excess_kurtosis(columns):
m = np.mean(columns, axis=0)
sd = np.std(columns, axis=0)
result = np... | bptripp/it-cnn | tuning/selectivity.py | Python | mit | 13,980 |
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | pszemus/grpc | src/python/grpcio_testing/grpc_version.py | Python | apache-2.0 | 702 |
#!/usr/bin/env python
import sys
import string
import numpy
import scipy.io
from matplotlib.pylab import *
from fractionS import *
N_A = 6.0221367e23
E2 = 5
V = 1e-15
def plot_theory( K ):
N = 1000
minE1 = 0.1
maxE1 = 100.
e1array = numpy.mgrid[minE1:maxE1:(maxE1-minE1)/N]
farray = [ fracti... | gfrd/gfrd | samples/pushpull/plot.py | Python | gpl-2.0 | 2,295 |
import os
from subprocess import check_output
import imageio
import numpy as np
import PIL.Image
import utils.exif_helper as ehelp
from utils.exposure_helper import calculate_ev100_from_metadata
########## Slightly modified version of LLFF data loading code
########## see https://github.com/Fyusion/LLFF for origina... | cgtuebingen/Neural-PIL | dataflow/nerd/load_real_world.py | Python | mit | 13,336 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import os
DEBUG = True
TESTING = True
PRODUCTION = False
FLASK_DEBUGTOOLBAR = False
HOST = '0.0.0.0'
SQLALCHEMY_DATABASE_URI = os.environ.get(
'GGRC_DATABASE_URI',
'mysql+mysqldb://root:root@127.0.0... | j0gurt/ggrc-core | src/ggrc/settings/development.py | Python | apache-2.0 | 809 |
# This file is part of trc.me.
#
# trc.me 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.
#
# trc.me is distributed in the hope that it... | kaapstorm/trc_me | src/trc_me/web/views.py | Python | agpl-3.0 | 28,044 |
from random import random
from random import uniform
from datetime import datetime
from django.utils import timezone
from datetime import timedelta
from django.forms import model_to_dict
from seshdash.data.db.influx import Influx
from seshdash.models import BoM_Data_Point as Data_Point
from seshdash.utils.time_utils ... | GreatLakesEnergy/sesh-dash-beta | seshdash/tests/data_generation.py | Python | mit | 6,141 |
#!/usr/bin/env python
import ast
import re
from setuptools import setup, find_packages
INSTALL_REQUIRES = [
'boto3>=1.4.2',
'botocore>=1.4.85',
'virtualenv',
]
STYLE_REQUIRES = [
'flake8>=2.5.4',
'pylint>=1.5.5',
]
TEST_REQUIRES = [
'coverage>=4.0.3',
'pytest>=2.9.1',
'moto>=0.4.23'... | rackerlabs/lambda-uploader | setup.py | Python | apache-2.0 | 2,168 |
# -*- coding: utf-8 -*-
"""Tests for exceptions."""
#
# (C) Pywikibot team, 2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id: 9fa8041db90dd43d14dcaea36accce58c715edde $'
import pywikibot
from tests.aspects import unittest, DeprecationTestCase
cl... | hperala/kontuwikibot | tests/exceptions_tests.py | Python | mit | 2,321 |
import json
import os
import os.path
import shutil
from datetime import datetime
from subprocess import check_output
from pkgpanda.util import write_json, write_string
dcos_image_commit = os.getenv('DCOS_IMAGE_COMMIT', None)
if dcos_image_commit is None:
dcos_image_commit = check_output(['git', 'rev-parse', 'HEA... | BenWhitehead/dcos | gen/build_deploy/util.py | Python | apache-2.0 | 2,023 |
# flake8: noqa
import copy
from collections import OrderedDict, deque
import numpy as np
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
def describe_location(location, locations):
if location.can_describe:
final_location = locations.get(locatio... | c3nav/c3nav | src/c3nav/routing/route.py | Python | apache-2.0 | 9,539 |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | abhinavsingh/proxy.py | skeleton/app/app.py | Python | bsd-3-clause | 911 |
from PyQt4 import QtGui
import os
import overlayDialogBase
import ilastik.core.overlayMgr as overlayMgr
from ilastik.core import dataImpex
from ilastik.gui import stackloader
#*******************************************************************************
# S t a c k O v e r l a y D i a l o g ... | ilastik/ilastik-0.5 | ilastik/gui/overlayDialogs/stackOverlayDialog.py | Python | bsd-2-clause | 2,586 |
# coding=utf-8
__version__ = '1.2'
| interhui/py-text | text/__init__.py | Python | apache-2.0 | 36 |
import os
import redis
from rq import Worker, Queue, Connection
listen = ['high', 'default', 'low']
redis_url = os.getenv('REDIS_URL', 'redis://localhost:6379')
conn = redis.from_url(redis_url)
if __name__ == '__main__':
with Connection(conn):
worker = Worker(list(map(Queue, listen)))
worker.wo... | noisy/steemprojects.com | worker.py | Python | mit | 325 |
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is dis... | qrkourier/ansible | test/units/modules/network/nxos/test_nxos_feature.py | Python | gpl-3.0 | 2,591 |
__all__ = ['Mark', 'YAMLError', 'MarkedYAMLError']
class Mark(object):
def __init__(self, name, index, line, column, buffer, pointer):
self.name = name
self.index = index
self.line = line
self.column = column
self.buffer = buffer
self.pointer = pointer
def get... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/yaml/error.py | Python | mit | 2,559 |
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.spread import pb
from twisted.internet import reactor
import sys
class ErrorHandler:
def __init__(self,fileName):
self.fileName = fileName
self.handler = open(self.fileName, "a")
def wri... | DSerejo/python-webscraping | client.py | Python | gpl-2.0 | 1,638 |
import pytest
import salt.renderers.tomlmod
import salt.serializers.toml
@pytest.mark.skipif(
salt.serializers.toml.HAS_TOML is False, reason="The 'toml' library is missing"
)
def test_toml_render_string():
data = """[[user-sshkey."ssh_auth.present"]]
user = "username"
[[user-s... | saltstack/salt | tests/pytests/unit/renderers/test_toml.py | Python | apache-2.0 | 924 |
# Base classes for Hubs.
#
# Copyright (C) 2011-2012 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distribut... | cs2c-zhangchao/nkwin1.0-anaconda | pyanaconda/ui/gui/hubs/__init__.py | Python | gpl-2.0 | 21,352 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.template import Context, Template
from django.core.urlresolvers import resolve
from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest
from django.shortcuts import HttpResponse
from .models impo... | dhanababum/dj-wkhtmltopdf | djwkhtmltopdf/utils.py | Python | bsd-2-clause | 10,805 |
MAJOR = 0
MINOR = 0
PATCH = 8
VERSION = (MAJOR, MINOR, PATCH)
| openwsn-berkeley/coap | coap/coapVersion.py | Python | bsd-3-clause | 68 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-07 18:00
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("accounts", "0003_auto_20170607_1800"),
("studies", ... | CenterForOpenScience/lookit-api | studies/migrations/0002_auto_20170607_1800.py | Python | apache-2.0 | 757 |
# -*- coding: utf-8 -*-
#
# PyMC documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 29 09:34:37 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | LoLab-VU/pymc | docs/conf.py | Python | apache-2.0 | 9,265 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2017 Roberto Alsina and others.
# 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 without limitation
# the rights t... | xuhdev/nikola | nikola/plugin_categories.py | Python | mit | 32,244 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.db.models import Q
from django.conf import settings
from django.http import HttpResponse
from django.test import TestCase
from zerver.lib import bugdown
from zerver.decorator import JsonableError
from zerver.lib.test_runner import slow
from zile... | ahmadassaf/zulip | zerver/tests/test_messages.py | Python | apache-2.0 | 58,072 |
from matplotlib import pyplot as plt
import numpy as np
def plot_surface(clf, X, y,
xlim=(-10, 10), ylim=(-10, 10), n_steps=250,
subplot=None, show=True):
if subplot is None:
fig = plt.figure()
else:
plt.subplot(*subplot)
xx, yy = np.meshgrid(np.... | bcouturi/TestNotebooks | tutorial.py | Python | gpl-2.0 | 1,442 |
# encoding: utf-8
from __future__ import print_function
def hello():
print("Hello world!")
def myhelpfunc(obj, spec):
print("Custom help text.")
if __name__ == '__main__':
import sys
from marrow.script import Parser
sys.exit(Parser(hello, help=myhelpfunc)(sys.argv[1:]))
| marrow/script | example/simple/custom-help.py | Python | mit | 298 |
import logging
from typing import List
from . import SuperdeskMediaStorage
from .desk_media_storage import SuperdeskGridFSMediaStorage
from .amazon_media_storage import AmazonMediaStorage
logger = logging.getLogger(__name__)
def log_missing_media(id_or_filename, resource=None):
logger.error(
"Media it... | petrjasek/superdesk-core | superdesk/storage/proxy.py | Python | agpl-3.0 | 3,326 |
# -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
Huang Quanyong (wo1fSea)
quanyongh@foxmail.com
Date:
2016/10/19
Description:
GuillotinePacker.py
----------------------------------------------------------------------------"""
from ..MaxRect... | wo1fsea/PyTexturePacker | PyTexturePacker/GuillotinePacker/GuillotinePacker.py | Python | mit | 564 |
"""
Sampling from HMM
-----------------
This script shows how to sample points from a Hiden Markov Model (HMM):
we use a 4-components with specified mean and covariance.
The plot show the sequence of observations generated with the transitions
between them. We can see that, as specified by our transition matrix,
ther... | patrickjrock/c2finder | plot_hmm_sampling.py | Python | gpl-3.0 | 1,980 |
#############################################################################
# Tree modules -- used by tree.py
# Gregg Thomas
# August 2017
#############################################################################
import core, sys, os, subprocess, treeparse as tp, re
from collections import defaultdict
#########... | gwct/core | python/lib/treelib.py | Python | gpl-3.0 | 27,018 |
#!/usr/bin/env python
from horton import *
###############################################################################
## Set up molecule, define basis set ##########################################
###############################################################################
# get the XYZ file from HORTON's te... | eustislab/horton | data/examples/perturbation_theory/mp2_h2_4-31g.py | Python | gpl-3.0 | 2,933 |
from sympy import symbols, Symbol, sinh, nan, oo, zoo, pi, asinh, acosh, log, sqrt, \
coth, I, cot, E, tanh, tan, cosh, cos, S, sin, Rational, atanh, acoth, \
Integer, O, exp, sech, sec, csch
from sympy.utilities.pytest import raises
def test_sinh():
x, y = symbols('x,y')
k = Symbol('k', integer=Tru... | Mitchkoens/sympy | sympy/functions/elementary/tests/test_hyperbolic.py | Python | bsd-3-clause | 22,379 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | abhikeshav/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_mpls_lsd_cfg.py | Python | apache-2.0 | 6,582 |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from bliss.controllers.tango_attr_as_counter import TangoAttrCounter
class tango_fe(TangoAttrCounter):
def __init__(self, name, confi... | tiagocoutinho/bliss | bliss/controllers/tango_fe.py | Python | lgpl-3.0 | 379 |
# Copyright (C) 2017 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""action element for error (from Cuckoo 2.0-rc2 to 2.0.0)
Revision ID: 181be2111077
Revises: ef1ecf216392
Create Date: 2017-02-23 15:11:39.711902
"""
# ... | cuckoobox/cuckoo | cuckoo/private/db_migration/versions/from_20c2_to_200_error_action.py | Python | mit | 607 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-23 13:00
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('vital_records', '0001_initial'),
]
operations = [
... | cl0ne/vital-records-registry | registry/vital_records/migrations/0002_birthnote_applicant.py | Python | gpl-3.0 | 594 |
#!/usr/bin/python
# (c) James Laska
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | hryamzik/ansible | lib/ansible/modules/packaging/os/rhn_register.py | Python | gpl-3.0 | 14,356 |
#!/bin/env python3
import urllib.request
import json
URL = 'http://api.linux-statt-windows.org/infos.json'
def callback():
return '/lsw', get_forum
def get_forum(inp):
rqst = urllib.request.urlopen(URL)
data = json.loads(rqst.read().decode('utf-8'))
forum = data[0]['forum']
return forum['name']... | Linux-statt-Windows/BOLT | src/modules/forum.py | Python | gpl-3.0 | 645 |
from django.conf.urls import patterns, url
urlpatterns = patterns('robots.views',
url(r'^$', 'rules_list', name='robots_rule_list'),
)
| philippeowagner/django-robots | robots/urls.py | Python | bsd-3-clause | 140 |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
"""
Linux specific functions.
"""
from __future__ import with_statement
import sys,os,struct,socket,time
from select imp... | lthurlow/python-tcpsnoop | scapy/arch/linux.py | Python | mit | 16,814 |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangode.settings')
from django.core.wsgi import get_wsgi_application # noqa
application = get_wsgi_application()
| django-de/django-de-v4 | djangode/wsgi.py | Python | mit | 177 |
#***************************************************************************
#* *
#* Copyright (c) 2015 - Przemo Firszt <przemo@firszt.eu> *
#* *
#* This pr... | mickele77/FreeCAD | src/Mod/Fem/FemTools.py | Python | lgpl-2.1 | 23,147 |
#* pyx509 - Python library for parsing X.509
#* Copyright (C) 2009-2010 CZ.NIC, z.s.p.o. (http://www.nic.cz)
#*
#* This library is free software; you can redistribute it and/or
#* modify it under the terms of the GNU Library General Public
#* License as published by the Free Software Foundation; either... | plarivee/public_drown_scanner | pyx509/pkcs7/digest.py | Python | gpl-2.0 | 1,801 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
from pant... | Ervii/garage-time | garage/tests/python/pants_test/tasks/test_junit_tests_integration.py | Python | apache-2.0 | 4,225 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_categories(apps, schema_editor):
Category = apps.get_model('niqati', 'Category')
# We are going to add categories only if none already exists.
if not Category.objects.exists():
Category... | enjaz/enjaz | niqati/migrations/0002_add_categories.py | Python | agpl-3.0 | 1,163 |
#!/usr/bin/python
# Copyright 2014 Nervana Systems 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 requi... | nhynes/neon | neon/backends/convnet-benchmarks.py | Python | apache-2.0 | 27,193 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Read more about conftest.py under:
https://pytest.org/latest/plugins.html
"""
from __future__ import print_function, unicode_literals, division, absolute_import
from builtins import (bytes, dict, int, list, object, range, str, # noqa
ascii, chr, hex, input,... | totalgood/nlpia | tests/conftest.py | Python | mit | 492 |
# -*- coding: utf-8 -*-
r"""
.. _tut_background_filtering:
===================================
Background information on filtering
===================================
Here we give some background information on filtering in general,
and how it is done in MNE-Python in particular.
Recommended reading for practical app... | alexandrebarachant/mne-python | tutorials/plot_background_filtering.py | Python | bsd-3-clause | 42,317 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('quest_maker_app', '0001_initial'),
]
operations = [
migrations.AlterFi... | catherinev/quest_maker | quest_maker_app/migrations/0002_auto_20150605_2306.py | Python | mit | 509 |
from __future__ import division
from __future__ import print_function
def input(in_msg):
import inspect
in_msg.input_file = inspect.getfile(inspect.currentframe())
print("*** read input from ", in_msg.input_file)
# 8=MSG1, 9=MSG2, 10=MSG3
#in_msg.sat_nr=0
#in_msg.RSS=True
#in_msg.sat_n... | meteoswiss-mdr/monti-pytroll | scripts/input_test.py | Python | lgpl-3.0 | 9,570 |
from django.contrib import admin
from webservices.models import *
# Register your models here.
class MakeAdminObj(admin.ModelAdmin):
field = ['name']
class ModelAdminObj(admin.ModelAdmin):
field = ['make', 'name', 'year']
class UserAdminObj(admin.ModelAdmin):
field = ['email', 'name']
class VehicleAd... | Dorthu/FuelEconomizer | webservices/admin.py | Python | gpl-3.0 | 856 |
#! /usr/local/bin/python
# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
# intentionally NOT "/usr/bin/env python". On many systems
# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
# scripts, and /usr/local/bin is the default directory where Python is
# installed, so /usr/bin/env w... | wdv4758h/ZipPy | lib-python/3/cgi.py | Python | bsd-3-clause | 34,511 |
import os
import re
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
v = open(os.path.join(os.path.dirname(__file__), "alembic", "__init__.py"))
VERSION = (
re.compile(r""".*__version__ = ["'](.*?)["']""", re.S)
.match(v.read())
.group(1)
)
v.close()
class... | sqlalchemy/alembic | setup.py | Python | mit | 795 |
# -*- coding: utf-8 -*-
#
# Copyright © 2013 Kimmo Parviainen-Jalanko.
#
import os
import re
import logging
import binascii
from .conv import to_bytes
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.CRITICAL)
_PRIME_STRS = {
1: ''' FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80... | kimvais/ike | ike/util/dh.py | Python | mit | 10,139 |
from django.contrib import admin
from contact.models import Venue
class VenueAdmin(admin.ModelAdmin):
list_display = (
'__str__',
'is_active',
'sort',
)
admin.site.register(Venue, VenueAdmin)
| vandorjw/notes | vandorjw/contact/admin.py | Python | mit | 226 |
# -*- coding: utf-8 -*-
"""Beautiful Soup bonus library: Unicode, Dammit
This library converts a bytestream to Unicode through any means
necessary. It is heavily based on code from Mark Pilgrim's Universal
Feed Parser. It works best on XML and HTML, but it does not rewrite the
XML or HTML to reflect a new encoding; th... | varlog00/Sigil | src/Resource_Files/plugin_launchers/python/sigil_bs4/dammit.py | Python | gpl-3.0 | 30,930 |
#!/usr/bin/env python
#coding:utf-8
from toughlogger.console.handlers.base import BaseHandler
from toughlogger.common.permit import permit
class LogoutHandler(BaseHandler):
def get(self):
if not self.current_user:
self.clear_all_cookies()
self.redirect("/login")
return
... | talkincode/toughlogger | toughlogger/console/handlers/logout.py | Python | agpl-3.0 | 452 |
import shelve
with shelve.open('persondb') as db:
for key in db.keys():
print(key, ' ', db[key])
sue = db['Sue Jones']
sue.giveRaise(0.1)
db['Sue Jones'] = sue
db.close()
| skellykiernan/pylearn | VI/ch28/updatedb.py | Python | bsd-3-clause | 200 |
"""
Django settings for simcon 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, ...)
imp... | djorda9/Simulated-Conversations | vagrant/simcon/settings.py | Python | mit | 4,696 |
# Find the Lowest Common Ancestor (LCA) in a Binary Search Tree
# A Binary Search Tree node
class Node:
# Constructor to initialise node
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class BST:
def __init__(self):
self.root = None
def ... | anubhavshrimal/Data_Structures_Algorithms_In_Python | Tree/BinarySearchTree/Lowest_Common_Ancestor.py | Python | mit | 1,935 |
# Copyright 2008-2015 Nokia Solutions and 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 applicable l... | caio2k/RIDE | src/robotide/lib/robot/libdocpkg/writer.py | Python | apache-2.0 | 994 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_association_py3.py | Python | mit | 1,345 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import imp
import hmac
import hashlib
import six
from flask import Flask, abort, request
DEBUG = os.environ.get("DEBUG", False) == 'True'
HOST = os.environ.get("HOST", '0.0.0.0')
ROOT_DIR = os.path.dirname(os.p... | pyupio/octohook | hook/hook.py | Python | mit | 3,954 |
""" Utilities class providing useful functions and methods. """
import requests, os, subprocess, shutil, pip, sys, stat
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
from os.path import expanduser
from filecmp import dircmp
from drupdates.settings import Settings
from ... | jalama/drupdates | drupdates/utils.py | Python | mit | 12,467 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.