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 |
|---|---|---|---|---|---|
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.utils import six
from djblets.webapi.errors import PERMISSION_DENIED
from reviewboard.reviews.models import Comment
from reviewboard.webapi.resources import resources
from reviewboard.webapi.tests.base import BaseWebAPITes... | 1tush/reviewboard | reviewboard/webapi/tests/test_review_comment.py | Python | mit | 19,814 |
from scapy.layers.l2 import Dot1Q
import abc
import six
from vpp_pg_interface import VppPGInterface
from vpp_interface import VppInterface
from vpp_papi import VppEnum
class L2_VTR_OP:
L2_DISABLED = 0
L2_PUSH_1 = 1
L2_PUSH_2 = 2
L2_POP_1 = 3
L2_POP_2 = 4
L2_TRANSLATE_1_1 = 5
L2_TRANSLATE_1... | vpp-dev/vpp | test/vpp_sub_interface.py | Python | apache-2.0 | 7,153 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
from core import barf
plugin_dir = os.path.abspath(os.path.dirname(__file__ )) + "/"
sys.path.append(plugin_dir)
for module in os.listdir(os.path.dirname(plugin_dir)):
if os.path.isfile( plugin_dir + "/" + module ) and module != 'Plugin.py' and m... | RobertTheMagnificent/scrib | plugins/__init__.py | Python | gpl-2.0 | 941 |
# -*- coding: utf-8 -*-
""" This module returns stats about the DynamoDB table """
import math
from datetime import datetime, timedelta
from boto.exception import JSONResponseError, BotoServerError
from retrying import retry
from dynamic_dynamodb.aws import dynamodb
from dynamic_dynamodb.log_handler import LOGGER as ... | tellybug/dynamic-dynamodb | dynamic_dynamodb/statistics/gsi.py | Python | apache-2.0 | 6,518 |
from django.conf.urls import url
from .views import dashboard
urlpatterns = [
url(r'^$', dashboard, name='dashboard'),
] | Darkduke68/MatchMaker | dashboards/urls.py | Python | mit | 125 |
# -*- coding: utf-8 -*-
"""
flask.ext.admin._compat
~~~~~~~~~~~~~~~~~~~~~~~
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
:copyright: (c) 2013 by Armin Ronacher.
:license: BSD, see LICENSE for more details... | Jumpscale/web | pythonlib/flask_admin/_compat.py | Python | apache-2.0 | 2,865 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Lukas Kemmer
#
# 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 require... | lukas-ke/faint-graphics-editor | py/faint/formatsvgz.py | Python | apache-2.0 | 1,026 |
from setuptools import setup, find_packages
setup(
name='temproject',
version='0.1.0',
packages=find_packages(),
package_data={
'': ['*.html'],
},
install_requires=['tornado'],
)
| WebWorkshopers/TemperaturaProject | setup.py | Python | mit | 215 |
import _plotly_utils.basevalidators
class MetasrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="metasrc", parent_name="splom", **kwargs):
super(MetasrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edi... | plotly/python-api | packages/python/plotly/plotly/validators/splom/_metasrc.py | Python | mit | 436 |
#! /usr/bin/python2.7
"""RFC 3548: Base16, Base32, Base64 Data Encodings"""
# Modified 04-Oct-1995 by Jack Jansen to use binascii module
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 3548 support
import re
import struct
import binascii
__all__ = [
# Legacy interface exports traditional RFC 1521 Base64... | ruibarreira/linuxtrail | usr/lib/python2.7/base64.py | Python | gpl-3.0 | 11,356 |
from __future__ import unicode_literals
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
from django.contrib.auth import get_user_model
from . impo... | arocks/edge | src/profiles/forms.py | Python | mit | 1,105 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | XeCycle/indico | indico/MaKaC/webinterface/pages/tracks.py | Python | gpl-3.0 | 58,388 |
import sys
import argparse
import logging
from datetime import datetime
import numpy
def findStartOfLUMO(mo):
moFile = open(mo, "r")
for line in moFile:
if "alpha electrons" in line:
return int(line.split(None, 1)[0])
def findLUMOEnergy(MO):
with open(MO, 'r') as file:
for line in file:
# E... | NikTRSK/Electron-Charge-Transfer-Calculations | calcJ.py | Python | gpl-3.0 | 2,288 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tensorflow/transform | tensorflow_transform/test_case_test.py | Python | apache-2.0 | 3,131 |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | mitya57/debian-buildbot | buildbot/clients/text.py | Python | gpl-2.0 | 3,451 |
#!/usr/bin/env python
from setuptools import setup, find_packages
VERSION = __import__('cache_panel').__version__
try:
long_description = open('README.rst', 'rt').read()
except IOError:
long_description = ''
setup(
name='django-cache-panel',
version=VERSION,
description='A more detailed cache pa... | lincolnloop/django-cache-panel | setup.py | Python | bsd-3-clause | 682 |
"""
Copyright (c) 2017, Battelle Memorial Institute
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, this
list of conditions a... | rlutes/volttron-applications | pnnl/AirsideRCxAgent/airside/diagnostics/stcpr_aircx.py | Python | bsd-3-clause | 13,674 |
from six import text_type as unicode
import unittest
import os
from robot.utils.argumentparser import ArgumentParser
from robot.utils.asserts import (assert_equals, assert_raises,
assert_raises_with_msg, assert_true)
from robot.errors import Information, DataError, FrameworkError
from... | userzimmermann/robotframework | utest/utils/test_argumentparser.py | Python | apache-2.0 | 17,703 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import purchase
from . import stock
from . import purchase_requisition
| ddico/odoo | addons/purchase_requisition_stock/models/__init__.py | Python | agpl-3.0 | 154 |
"""cleff URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-based... | lancekrogers/music-network | cleff/cleff/urls.py | Python | apache-2.0 | 1,797 |
#
# A class that handles all HTTP communication with Thingdom.
#
import urllib2
import json
class HttpHelper:
#
# Constructor method. Initialize local data.
#
def __init__(self):
self._uri = 'https://api.thingdom.io/1.1'
self._request_counter = 0
#
# Perform a HTTP Get reques... | thingdomio/thingdom-python | thingdom/httpHelper.py | Python | mit | 2,023 |
bold = '\033[1m'
end = '\033[0m'
black = '\033[0;30m'
red = '\033[0;31m'
green = '\033[0;32m'
yellow = '\033[0;33m'
blue = '\033[0;34m'
purple = '\033[0;35m'
cyan = '\033[0;36m'
grey = '\033[0;37m'
# Bold
bblack = '\033[1;30m'
bred = '\033[1;31m'
bgreen = '\033[1;32m'
byellow = '\033[1... | humm/toolbox | toolbox/color.py | Python | mit | 3,152 |
# Copyright (c) 2019-2021 hippo91 <guillaume.peillex@gmail.com>
# Copyright (c) 2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2021 Pierre Sassoulas <pierre.sassoulas@gmail.com>
# Copyright (c) 2021 Marc Mueller <30130371+cdce8p@users.noreply.github.com>
# Licensed under the LGPL: https://www.gnu.org/licens... | PyCQA/astroid | astroid/brain/brain_numpy_core_numeric.py | Python | lgpl-2.1 | 1,785 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-03-01 09:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0018_project_properties'),
]
operations = [
migrations.AlterModelOption... | GETLIMS/LIMS-Backend | lims/projects/migrations/0019_auto_20180301_0958.py | Python | mit | 1,025 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru>
# 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 = {... | SergeyCherepanov/ansible | ansible/ansible/modules/database/postgresql/postgresql_ping.py | Python | mit | 6,115 |
"""biome table
Revision ID: 5c6a141c3642
Revises: e6287e300888
Create Date: 2017-02-14 03:01:29.736374
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5c6a141c3642'
down_revision = 'e6287e300888'
branch_labels = None
depends_on = None
def upgrade():
op.c... | d2emon/gurps-helper | migrations/versions/5c6a141c3642_biome_table.py | Python | gpl-3.0 | 754 |
""" XVM (c) www.modxvm.com 2013-2015 """
__all__ = ['startConfigWatchdog', 'stopConfigWatchdog']
# PUBLIC
def startConfigWatchdog():
# debug('startConfigWatchdog')
_g_configWatchdog.stopConfigWatchdog()
_g_configWatchdog.configWatchdog()
def stopConfigWatchdog():
# debug('stopConfigWatchdog')
_... | Satariall/xvm-test | src/xpm/xvm_main/configwatchdog.py | Python | gpl-3.0 | 1,794 |
from django.apps import AppConfig
from django.conf import settings
from django.core.checks import register
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _
from kuma.celery import app
class CoreConfig(AppConfig):
"""
The Django App Config class to sto... | Elchi3/kuma | kuma/core/apps.py | Python | mpl-2.0 | 1,180 |
from django.conf.urls import patterns, include, url
# import .views
urlpatterns = patterns('',
url(r"^$", "blog.views.index", name="index"),
url(r"^post/(?P<pk>\d+)/$", "blog.views.post", name="post"),
url(r"^category/(?P<pk>\d+)/$", "blog.views.cate... | wwq0327/djwebapp-blog | djblog/blog/urls.py | Python | mit | 370 |
from PyQt5.QtWidgets import QWidget
from functionalities import Functionalities
from pop_up_ui import pop_up_External_Neuron_Array
class PopUpExternalNeuronArray(Functionalities):
def __init__(self, parent):
self.main_win = QWidget()
self.ui = pop_up_External_Neuron_Array.Ui_centralwidget()
... | andreashorn/lead_dbs | ext_libs/OSS-DBS/OSS_platform/GUI_tree_files/pop_up_control/external_neuron_arrray.py | Python | gpl-3.0 | 5,535 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Oxcoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
inFi... | Skytells/Oxcoin | share/qt/clean_mac_info_plist.py | Python | mit | 893 |
# The Hazard Library
# Copyright (C) 2012-2016 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 version.
#... | rcgee/oq-hazardlib | openquake/hazardlib/source/area.py | Python | agpl-3.0 | 7,581 |
# Both players play optimally. Hence there is always a way for the first player to start the game such that he/she always wins.
t = int(raw_input())
for tc in xrange(t):
n, p = map(int, raw_input().split())
print "Airborne wins." if p == 0 else "Pagfloyd wins." | babhishek21/oj-sols | spoj/HUBULLU.py | Python | mit | 265 |
from django.conf.urls import url
from django.contrib import admin
from shortener.views import HomeView, URLRedirectView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', HomeView.as_view()),
url(r'^(?P<shortcode>[\w-]+)/$', URLRedirectView.as_view(), name='scode'),
]
| wederribas/TryDjango1.10 | kirr/kirr/urls.py | Python | mit | 294 |
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly 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 3 of the L... | Versatilus/dragonfly | dragonfly/windows/win32_window.py | Python | lgpl-3.0 | 9,120 |
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... | DarkFenX/Pyfa | gui/builtinStatsViews/priceViewMinimal.py | Python | gpl-3.0 | 5,462 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Gilles-Alexandre Quenot
#
# This file is part of weboob.
#
# weboob 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... | eirmag/weboob | modules/fortuneo/test.py | Python | agpl-3.0 | 1,032 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | WSCU/crazyflie_ros | src/cfclient/ui/tabs/FlightTab.py | Python | gpl-2.0 | 21,361 |
"""
# Majic
# Copyright (C) 2014 CEH
#
# 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 pr... | NERC-CEH/jules-jasmin | majic/joj/model/output_variable.py | Python | gpl-2.0 | 1,339 |
import os
import sys
import json
__location__ = os.path.dirname(os.path.realpath(__file__))
jsonData = []
if len(sys.argv) < 3:
print ("Error: invalid arguments")
else:
if os.path.isfile(sys.argv[1]):
inputFile = sys.argv[1]
else:
inputFile = os.path.join(__location__, sys.argv[1])
if not os.path.isfile(inp... | gwiedeman/ResearchingNY2016 | graphEntities.py | Python | unlicense | 1,481 |
from importlib import import_module
DEFAULT_ELEMENT_TYPES = set(['form', 'input', 'radio', 'checkbox', 'button', 'table'])
BOOTSTRAP3_ELEMENT_TYPES = DEFAULT_ELEMENT_TYPES | set(['panel', 'modal'])
SUPPORTED_ELEMENT_TYPES = {
'default': DEFAULT_ELEMENT_TYPES,
'bootstrap3': BOOTSTRAP3_ELEMENT_TYPES,
... | rfancn/y2h | y2h/parser/factory.py | Python | mit | 2,247 |
"""
@package mi.dataset.driver.optaa_dj.dcl.driver
@file marine-integrations/mi/dataset/driver/optaa_dj/dcl/driver.py
@author Steve Myerson (Raytheon)
@brief Driver for the optaa_dj_dcl
Release notes:
Initial release
"""
__author__ = 'Steve Myerson (Raytheon)'
__license__ = 'Apache 2.0'
from mi.core.common import Ba... | ooici/marine-integrations | mi/dataset/driver/optaa_dj/dcl/driver.py | Python | bsd-2-clause | 5,920 |
import os
import sys
from gooey.gui.windows import layouts
from gooey.python_bindings import argparse_to_json
from gooey.gui.util.quoting import quote
def create_from_parser(parser, source_path, **kwargs):
auto_start = kwargs.get('auto_start', False)
if hasattr(sys, 'frozen'):
run_cmd = quote(sour... | ME-ICA/me-ica | gooey/python_bindings/config_generator.py | Python | lgpl-2.1 | 1,912 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Copyright (c) 2011 Tyler Kenendy <tk@tkte.ch>
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... | deathcap/Burger | burger/roundedfloats.py | Python | mit | 1,486 |
from __future__ import division
from builtins import range
import numpy as np
np.seterr(divide='ignore') # these warnings are usually harmless for this code
np.random.seed(0)
from matplotlib import pyplot as plt
import matplotlib
import os
matplotlib.rcParams['font.size'] = 8
import pyhsmm
from pyhsmm.util.text impor... | mattjj/pyhsmm | examples/hmm.py | Python | mit | 3,066 |
"""
Autopsy Forensic Browser
Copyright 2016 Basis Technology Corp.
Contact: carrier <at> sleuthkit <dot> org
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/LICE... | dgrove727/autopsy | InternalPythonModules/android/googlemaplocation.py | Python | apache-2.0 | 7,132 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | eliasdesousa/indico | indico/modules/bootstrap/controllers.py | Python | gpl-3.0 | 4,874 |
##
# Copyright 2021 Jessica Tallon, Matt Molyneaux
#
# This file is part of Inboxen.
#
# Inboxen 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
# (... | Inboxen/Inboxen | inboxen/router/apps.py | Python | agpl-3.0 | 1,046 |
import npc
import pytest
from util import fixture_dir, load_json
import json
@pytest.fixture
def list_json_output(tmp_path, prefs):
def make_list(*search_parts, outformat='json', metadata=None, prefs=prefs, title=None):
tmpdir = tmp_path / 'list'
tmpdir.mkdir()
outfile = tmpdir / 'output.js... | aurule/npc | tests/commands/listing/conftest.py | Python | mit | 587 |
"""
Django settings for openshift 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, ...)
... | coursemdetw/2014django | wsgi/openshift/settings.py | Python | gpl-2.0 | 2,745 |
# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
# Settings for production environment
from django.conf import settings
# DEBUG Options: Select "True" for development use, "False" for production use
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Hosts/domain names that are valid for this site; required if DEBUG is Fals... | dastergon/identity.gentoo.org | okupy/settings/production.py | Python | agpl-3.0 | 3,231 |
"""System engine"""
__author__ = "Zacharias El Banna"
__version__ = "5.6"
__build__ = 214
__all__ = ['Context','WorkerPool']
from os import path as ospath, getpid, walk
from json import loads, load, dumps
from importlib import import_module, reload as reload_module
from threading import Thread, Event, BoundedSemaphore... | zelbanna/sdcp | core/engine.py | Python | gpl-3.0 | 30,590 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redist... | archetipo/server-tools | document_export_from_db/tests/__init__.py | Python | agpl-3.0 | 1,147 |
"""
Reading and Plotting data with DC.IO class
==========================================
The DC.IO class is a convenient way to handle DC data and
carry inversions within a same class. It also has several plotting utils
such as pseudosections. We show here an example of plotting DC data based
on a demonstration datas... | simpeg/simpeg | examples/04-dcip/plot_read_DC_data_with_IO_class.py | Python | mit | 2,790 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RBbmisc(RPackage):
"""Miscellaneous helper functions for and from B. Bischl and some other... | rspavel/spack | var/spack/repos/builtin/packages/r-bbmisc/package.py | Python | lgpl-2.1 | 730 |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 24 00:44:05 2015
@author: winpython
"""
import os
import sys, getopt
import time
import numpy as np
from cnn_training_computation import fit
import pickle, cPickle, gzip
def run():
print '... loading data'
# Load the dataset
f = gzip.open("training_data_2... | artmusic0/theano-learning.part03 | Myfile_run-py_release_turble-training/run_training.py | Python | gpl-3.0 | 1,340 |
#!/usr/bin/python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Gets information about one commit from gitiles.
Example usage:
./fetch_revision_info.py 343b531d31 chromium
./fetch_revision_info.p... | eunchong/build | scripts/slave/recipe_modules/auto_bisect/resources/fetch_revision_info.py | Python | bsd-3-clause | 1,529 |
from .config import *
DAHUA_FILES = OrderedDict([
("Install.lua", {
"required": True,
"type": DAHUA_TYPE.Plain
}),
("u-boot.bin.img", {
"required": True,
"type": DAHUA_TYPE.Plain,
"size": 0x00300000
}),
("uImage.img", {
"required": True,
"type": DAHUA_TYPE.Plain,
"size": 0x00a00000
}),
("romfs-x... | BotoX/Dahua-Firmware-Mod-Kit | configs/NVR4XXX-4KS2.py | Python | gpl-3.0 | 808 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns('profile.views',
url(r'^(?P<username>[a-zA-Z_][a-zA-Z0-9_]*)/$',
'profile_view', name='profile_home'),
)
| liweitianux/97dev | 97suifangqa/apps/profile/urls.py | Python | bsd-2-clause | 211 |
# -*- encoding: utf-8 -*-
from .cursebox import Cursebox
from .colors import colors
from .constants import EVENT_SKIP
from .utils import hex_to_rgb
logo = [u" █ ",
u"█▀█ █ █ █▀█ █▀▀ █▀█ █▀▄ █▀█ █▄█",
u"█ █ █ █ ▀▀█ █▄█ █ █ █ █ ▄█▄",
u"█▄█ █▄█ █ ▄▄█ █▄▄ █▄█ █▄█... | Tenchi2xh/cursebox | cursebox/__main__.py | Python | mit | 1,969 |
import unittest
import unittest.mock
import functools
from g1.asyncs import kernels
from g1.operations.databases.bases import interfaces
from g1.operations.databases.servers import connections
# I am not sure why pylint cannot lint contextlib.asynccontextmanager
# correctly; let us disable this check for now.
#
# py... | clchiou/garage | py/g1/operations/databases/servers/tests/test_connections.py | Python | mit | 8,015 |
"""
Support for Xiaomi Smart WiFi Socket and Smart Power Strip.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/switch.xiaomi_miio/
"""
import asyncio
from functools import partial
import logging
import voluptuous as vol
import homeassistant.helpers.config... | stefan-jonasson/home-assistant | homeassistant/components/switch/xiaomi_miio.py | Python | mit | 9,438 |
import pdb
from copy import deepcopy
class Board:
board=None
def __init__(self, input_board=None, size=3):
if not input_board:
self.board = [[0]*size for i in range(size)]
else:
self.board = deepcopy(input_board.board)
def size(self):
if not self.board: ret... | loafdog/loaf-src | prog-probs/eight-queens/EightQueens.py | Python | apache-2.0 | 5,123 |
#!/usr/bin/python
import hashlib
import os
import subprocess
import ecdsa
from binascii import hexlify, unhexlify
print 'master secret:',
h = raw_input()
if h:
h = unhexlify(h)
else:
h = hashlib.sha256(os.urandom(1024)).digest()
print
print 'master secret:', hexlify(h)
print
for i in range(1, 6):
se = h... | aussiehash/trezor-mcu | bootloader/firmware_sign_split.py | Python | lgpl-3.0 | 784 |
# -*- coding: utf-8 -*-
#
# S3AAA Unit Tests
#
# To run this script use:
# python web2py.py -S eden -M -R applications/eden/tests/unit_tests/modules/s3/s3aaa.py
#
import unittest
from gluon import *
from gluon.storage import Storage
from s3.s3aaa import S3EntityRoleManager, S3Permission
# ============================... | flavour/tldrmp | modules/unit_tests/s3/s3aaa.py | Python | mit | 165,150 |
import requests
import json
import bs4
from bs4 import BeautifulSoup
import urllib2
import lxml
import os
####I will try to get a list of the relevant URLs, then 'for loop' through them so I don't have to write a different script for each debate.####
##Saving home page as text file.##
res = requests.get('http://www.p... | pplatzman/RedBlue-Classifier | WritingFiles/dem/demparse.py | Python | mit | 2,139 |
#!/usr/bin/python
import matplotlib
matplotlib.use('Agg')
import pylab
import tensorflow as tf
import numpy as np
import scipy.fftpack
import numpy.fft
import random
import json
import itertools
# Returns one sequence of n_steps.
def getNextTrainingBatch(data, n_steps, iter):
# A random displacement to take the... | keskival/wavenet_synth | manage_data.py | Python | mit | 771 |
"""engine.SCons.Options.BoolOption
This file defines the option type for SCons implementing true/false values.
Usage example:
opts = Options()
opts.Add(BoolOption('embedded', 'build for an embedded system', 0))
...
if env['embedded'] == 1:
...
"""
#
# Copyright (c) 2001, 2002, 2003, 2004 The SCons Found... | bilke/OpenSG-1.8 | SConsLocal/scons-local-0.96.1/SCons/Options/BoolOption.py | Python | lgpl-2.1 | 3,057 |
#!/usr/bin/env python3
import cv2
import numpy as np
from vision import camera_message_framework
import itertools
import time
shape = (500, 500, 3)
size = 1
for dim in shape:
size *= dim
def image_of(axes):
im = np.zeros(shape, dtype=np.uint8)
im[:, :, axes] = 255
return im
black = image_of([]), 'bl... | cuauv/software | vision/utils/image_ordering_test.py | Python | bsd-3-clause | 877 |
def excise(conn, qrelname, tid):
with conn.cursor() as cur:
# Assume 'id' column exists and print that for bookkeeping.
#
# TODO: Instead should find unique constraints and print
# those, or try to print all attributes that are not corrupt.
sql = 'DELETE FROM {0} WHERE ctid =... | fdr/pg_corrupt | pg_corrupt/excise.py | Python | bsd-2-clause | 506 |
import numpy as np
from matplotlib import pyplot as plt
from pylab import rcParams
def plot_buoyancy(cwd=''):
"""
Plotting routine for the cross section of the buoyancy
Args:
cwd (string): current working directory
"""
xx = np.load(cwd + 'data/xaxis.npy')
uend = np.load(cwd + 'data/s... | Parallel-in-Time/pySDC | pySDC/projects/FastWaveSlowWave/plotgmrescounter_boussinesq.py | Python | bsd-2-clause | 2,298 |
# coding: utf-8
# In[1]:
from __future__ import print_function
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.recurrent import LSTM
from keras.datasets.data_utils import get_file
import numpy as np
import random, sys
'''
Example script to generate ... | napsternxg/haiku_rnn | Keras LSTM RNN Text Gen.py | Python | gpl-2.0 | 3,463 |
import datetime
# Remove seconds from epoch to get a epoch ending by 0 second
def floor_second_epoch(epoch):
date = datetime.datetime.fromtimestamp(epoch / 1000)
return epoch - (date.second * 1000)
# Convert an epoch to a string
def epoch_to_string(epoch):
date = datetime.datetime.fromtimestamp(epoch / ... | Leelow/upper-body-clustering | lib/date.py | Python | mit | 1,235 |
import deep_architect.contrib.misc.search_spaces.tensorflow.dnn as css_dnn
import deep_architect.contrib.misc.search_spaces.tensorflow.cnn2d as css_cnn2d
from deep_architect.contrib.misc.search_spaces.tensorflow.common import D
import deep_architect.modules as mo
def get_dnn_search_space_fn(num_classes):
return m... | negrinho/deep_architect | examples/benchmarks/search_spaces.py | Python | mit | 910 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | 0x0all/nupic | py/nupic/encoders/delta.py | Python | gpl-3.0 | 4,460 |
# Copyright 2010-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... | CMSS-BCRDB/RDS | trove/tests/fakes/keystone.py | Python | apache-2.0 | 2,659 |
# coding: utf-8
import os
from difflib import SequenceMatcher
from unicodedata import normalize
def remove_diacritics(s):
try:
s = normalize('NFKD', s)
except TypeError:
s = normalize('NFKD', unicode(s, "utf-8"))
finally:
return s.encode('ASCII', 'ignore').decode('ASCII')
def rem... | scieloorg/xylose | xylose/aff_validator.py | Python | bsd-2-clause | 3,052 |
"""
Perceptron
w = w + N * (d(k) - y) * x(k)
Using perceptron network for oil analysis, with Measuring of 3 parameters
that represent chemical characteristics we can classify the oil, in p1 or p2
p1 = -1
p2 = 1
"""
import random
class Perceptron:
def __init__(
self,
sample... | TheAlgorithms/Python | neural_network/perceptron.py | Python | mit | 6,890 |
##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsabili... | xxjcaxx/openerp-learning-module | marsans/marsans.py | Python | gpl-2.0 | 7,847 |
"""
======================================================
Out-of-core classification of text documents
======================================================
This is an example showing how scikit-learn can be used for classification
using an out-of-core approach: learning from data that doesn't fit into main
memory. ... | glemaitre/scikit-learn | examples/applications/plot_out_of_core_classification.py | Python | bsd-3-clause | 13,417 |
suite = {
"name" : "mx",
"libraries" : {
# ------------- Libraries -------------
"JACOCOAGENT" : {
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/jacoco/jacocoagent-0.7.1-1.jar"],
"sha1" : "2f73a645b02e39290e577ce555f00b02004650b0",
},
"JACOCOREPORT" : {
"urls" : ["https://lafo.... | smarr/mxtool | mx.mx/suite.py | Python | gpl-2.0 | 4,144 |
# coding: utf-8
from __future__ import unicode_literals
import progressbar
import sys
import pprint
import os
import django
import pprint
sys.path.append("..")
sys.path.append(".")
# Configuración inicial de django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "suite.settings")
django.setup()
from escuelas import mo... | Dte-ba/suite-backend | scripts/reiniciar_contraseñas.py | Python | gpl-3.0 | 565 |
"""
The module series exports functions to compute power series solutions with
Newton's method in double, double double, or quad double precision.
"""
def replace_symbol(pol, idx):
"""
In the polynomial pol,
replaces the first symbol by the symbol at place idx.
"""
from phcpy.phcpy2c2 import py2c_... | janverschelde/PHCpack | src/Python/PHCpy2/phcpy/series.py | Python | gpl-3.0 | 26,702 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Avanzosc - Avanced Open Source Consulting
# Copyright (C) 2011 - 2012 Avanzosc <http://www.avanzosc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | avanzosc/avanzosc6.1 | avanzosc_foreign_vat/__openerp__.py | Python | agpl-3.0 | 1,571 |
import numpy as np
def force1(x,y,z,p,t=0):
''' force on place x,y,z under velocity p at time t '''
# no force if the speed is more than 5
if np.max(np.abs(p))>5:
return [0,0,0]
return [0,0,0.5]
def force2(x,y,z,p,t=0):
# test force
if t>70:
return (0,0,0)
if z>200 and x<y:
return (4,2,-14)
if z... | microelly2/Animation | flowlib.py | Python | gpl-2.0 | 1,625 |
from setuptools import setup
setup(
name = 'convis',
packages = ['convis','convis.filters'],
version = '0.6.4',
install_requires = ["matplotlib", "litus", "numpy", "future"],
description = 'Convolutional Vision Model',
author = 'Jacob Huth',
author_email = 'jahuth@uos.de',
url = 'https://github.com/jahu... | jahuth/convis | setup.py | Python | gpl-3.0 | 468 |
#!/usr/bin/env python
import sys
import argparse
from get_alleles import get_nth_allele
def find_var_info(sequences):
'''
Finds the length of the flanking sequences left and right of a variant.
Also returns the length of the minor allele
Input
- sequences: dictionary of sequences
Output
- var_info: dictionary o... | NCBI-Hackathons/PSST | src/find_var_info.py | Python | mit | 2,932 |
"""
This file opens two files, received_data.dat and original_data.dat, and
compare the bits on them. It prints the number of different bits, and
the BER obtained.
"""
import matplotlib.pyplot as plt
import numpy as np
def get_different_bits(byte1, byte2):
xor = byte1 ^ byte2
result = 0
while xor != 0:
... | auburus/GNURadio-guide | utils/calculate_BER.py | Python | gpl-3.0 | 1,636 |
# Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | bdang2012/taiga-back-casting | taiga/feedback/routers.py | Python | agpl-3.0 | 1,013 |
import json
import uuid
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.core.urlresolvers import reverse
register = template.Library()
@register.simple_tag(takes_context=True)
def lazy_tag(context, tag, *args, **kwargs):
"""
Lazily... | janusnic/django-lazy-tags | lazy_tags/templatetags/lazy_tags.py | Python | mit | 1,966 |
# -*- coding: utf-8 -*-
# © 2015 Elico corp (www.elico-corp.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import controllers
| Elico-Corp/odoo-addons | website_redirect_to_shop/__init__.py | Python | agpl-3.0 | 162 |
# Copyright 2017 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... | rabipanda/tensorflow | tensorflow/contrib/py2tf/pyct/static_analysis/type_info_test.py | Python | apache-2.0 | 5,773 |
### Copyright (C) 2002-2005 Stephen Kennedy <stevek@gnome.org>
### 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, this list o... | babycaseny/meld | vc/_vc.py | Python | gpl-2.0 | 6,611 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test HTTP support.
"""
import random, cgi, base64
try:
from urlparse import (
ParseResult as ParseResultBytes, urlparse, urlunsplit, clear_cache)
except ImportError:
from urllib.parse import (
ParseResultBytes, urlpar... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/web/test/test_http.py | Python | gpl-2.0 | 74,776 |
import unittest
import os
from test.aiml_tests.client import TestClient
from programy.config.file.factory import ConfigurationFactory
from programy.config.client.client import ClientConfiguration
class NowAskMeTrainTestClient(TestClient):
def __init__(self):
TestClient.__init__(self)
def load_configu... | dkamotsky/program-y | src/test/aiml_tests/train_tests/test_now_ask_me.py | Python | mit | 966 |
"""
WSGI config for project_manager 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("DJA... | maboily/project_manager | project_manager/wsgi.py | Python | apache-2.0 | 408 |
#This is obtained from the examples of the hangups application.
import asyncio
import hangups
import messaging.authentication as authentication
from config import ConfigurationReader
def connect_to_hangouts(self):
try:
cookies = hangups.auth.get_auth_stdin(ConfigurationReader._refresh_token)
except hangups.Googl... | jorgehortelano/RedOwl | BlackGecko/messaging/alert_client.py | Python | gpl-3.0 | 1,929 |
from __future__ import absolute_import
import os
import shutil
import tempfile
import numpy as np
from numpy.testing import assert_array_equal
from pandas import Series
from shapely.geometry import (Polygon, Point, LineString,
MultiPoint, MultiLineString, MultiPolygon)
from shapely.geomet... | scw/geopandas | tests/test_geoseries.py | Python | bsd-3-clause | 6,170 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("filer", "0001_initial"),
)
def forwards(self, orm):
# Adding field 'Post.key_visual'
db.add_column(... | aldryn/aldryn-blog | aldryn_blog/migrations/0002_auto__add_field_post_key_visual__add_field_post_lead_in.py | Python | bsd-3-clause | 13,055 |
# Quick plot on when I gathered the data
from tweetloader import TweetLoader
import matplotlib.pyplot as plt
import matplotlib.dates as dates
import pandas as pd
import matplotlib.patches as mpatches
def count_and_plot(raw, ax, start='2016-1-1', end='2016-6-24', freq='D', color='blue'):
df = raw.copy()
df.ind... | dr-rodriguez/The-Divided-States-of-America | scripts/twitter_sampling.py | Python | mit | 2,187 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.