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
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | wubr2000/googleads-python-lib | examples/dfp/v201505/activity_service/get_all_activities.py | Python | apache-2.0 | 1,934 |
"""
Material Demo
This demonstrates the various materials the pipeline supports.
It is also a reference scene, for testing BRDF changes.
"""
from __future__ import print_function
import os
import sys
from panda3d.core import Vec3, load_prc_file_data
from direct.showbase.ShowBase import ShowBase
# Change to the cu... | tobspr/RenderPipeline-Samples | 01-Material-Demo/main.py | Python | mit | 2,313 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.boot import get_allowed_pages
@frappe.whitelist()
def get(module):
"""Returns data (sections, list of reports, counts) to render m... | mbauskar/tele-frappe | frappe/desk/moduleview.py | Python | mit | 6,132 |
# -*- coding: utf-8 -*-
""" S3 Query Construction
@copyright: 2009-2015 (c) Sahana Software Foundation
@license: MIT
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
... | ScottBuchanan/eden | modules/s3/s3query.py | Python | mit | 82,174 |
import copy
import unittest
from pyrake.utils.datatypes import CaselessDict
__doctests__ = ['pyrake.utils.datatypes']
class CaselessDictTest(unittest.TestCase):
def test_init(self):
seq = {'red': 1, 'black': 3}
d = CaselessDict(seq)
self.assertEqual(d['red'], 1)
self.assertEqual(... | elkingtowa/pyrake | tests/test_utils_datatypes.py | Python | mit | 3,592 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('mountains', '0001_initial'),
]
o... | tiradoe/fourteeners-updated | fourteeners/apps/mountains/migrations/0002_climb.py | Python | mit | 1,220 |
"""Proof of Possession Identifier Validation Challenge."""
import logging
import os
from cryptography import x509
from cryptography.hazmat.backends import default_backend
import zope.component
from acme import challenges
from acme import jose
from acme import other
from letsencrypt import interfaces
from letsencrypt... | vcavallo/letsencrypt | letsencrypt/proof_of_possession.py | Python | apache-2.0 | 3,641 |
from app import server
import asyncore
import os
server.basedir = os.path.dirname(os.path.realpath(__file__))
if __name__ == "__main__":
try:
server = server.Server()
server.settings['basedir'] = os.path.dirname(os.path.realpath(__file__))
server.serve_forever()
except:
raise
os.system("kill %... | barneygale/mcocr | app.py | Python | bsd-3-clause | 348 |
# Generated by Django 2.1.4 on 2018-12-21 14:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0016_auto_20181202_2205'),
('mainapp', '0016_auto_20181221_1432'),
]
operations = [
]
| meine-stadt-transparent/meine-stadt-transparent | mainapp/migrations/0017_merge_20181221_1508.py | Python | mit | 272 |
# Example of unwrapping a decorator
from functools import wraps
def decorator1(func):
@wraps(func)
def wrapper(*args, **kwargs):
print('Decorator 1')
return func(*args, **kwargs)
return wrapper
def decorator2(func):
@wraps(func)
def wrapper(*args, **kwargs):
print('Decorat... | tuanavu/python-cookbook-3rd | src/9/unwrapping_a_decorator/example.py | Python | mit | 541 |
# -*- coding: utf-8 -*-
# Copyright © 2016 Cask Data, 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 la... | caskdata/cdap | cdap-docs/_common/tabbed-parsed-literal.py | Python | apache-2.0 | 30,649 |
"""This is the Bokeh charts interface. It gives you a high level API to build
complex plot is a simple way.
This is the Histogram class which lets you build your histograms just passing
the arguments to the Chart class and calling the proper functions.
"""
#-------------------------------------------------------------... | srinathv/bokeh | bokeh/charts/builder/histogram_builder.py | Python | bsd-3-clause | 3,598 |
# Copyright 2018 The dm_control 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 i... | deepmind/dm_control | dm_control/mjcf/copier_test.py | Python | apache-2.0 | 3,393 |
# Copyright DataStax, 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 writing, softwa... | datastax/python-driver | cassandra/datastax/insights/reporter.py | Python | apache-2.0 | 9,149 |
class CacheManager(object):
"""
Handle storing the DMCache objects. We want the use the same
object for each cache_key.
Note: This original was just a module level dict
"""
def __init__(self, cache_cls=None):
if cache_cls is None:
cache_cls = DMCache
self.cache_cls ... | dalejung/datamodule | datamodule/cache.py | Python | mit | 1,452 |
# Copyright 2011 OpenStack Foundation
# Copyright 2011 Justin Santa Barbara
# 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/l... | Hybrid-Cloud/conveyor | conveyor/api/contrib/plan.py | Python | apache-2.0 | 4,393 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-22 21:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('examinations', '0004_auto_20170323_0258'),
]
operations = [
migrations.Alte... | dhavalmanjaria/dma-student-information-system | examinations/migrations/0005_auto_20170323_0258.py | Python | gpl-2.0 | 470 |
"""py_deps.tests package."""
| mkouhei/py-deps | py_deps/tests/__init__.py | Python | gpl-3.0 | 29 |
#!/usr/bin/python
from peewee import *
db = MySQLDatabase("ifc", host="127.0.0.1", port=3306, user="dario", passwd="SecurePassword08!")
class BaseModel(Model):
""" Base Model which is extended in each model """
class Meta:
database = db
class Author(BaseModel):
""" Author informati... | Darthone/bug-free-octo-parakeet | src/ifc/db.py | Python | mit | 3,037 |
# Copyright (c) Gary Strangman. All rights reserved
#
# Disclaimer
#
# This software is provided "as-is". There are no expressed or implied
# warranties of any kind, including, but not limited to, the warranties
# of merchantability and fittness for a given application. In no event
# shall Gary Strangman be liable ... | sniemi/SamPy | sandbox/src2/src/io.py | Python | bsd-2-clause | 34,524 |
# -*- coding: utf-8 -*-
"""
Dydacomp MOM SQL Server Client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013 by Mark A. Richman.
:license: GPL v2, see LICENSE for more details.
"""
__title__ = 'mom'
__version__ = '1.0.0'
__build__ = 0x010000
__author__ = 'Mark A. Richman'
__license__ = 'GPL v2'
__copyright__ = 'Co... | mrichman/mom | mom/__init__.py | Python | gpl-2.0 | 685 |
import sys
def add(core, actor, skillMod, divisor):
core.skillModService.addSkillMod(actor, 'electricity', skillMod)
return
def deduct(core, actor, skillMod, divisor):
core.skillModService.deductSkillMod(actor, 'electricity', skillMod)
return
| agry/NGECore2 | scripts/skillMods/expertise_innate_protection_electricity.py | Python | lgpl-3.0 | 250 |
# coding=utf-8
"""
Created on 28.8.2013
@author: purma
"""
from PyQt6 import QtGui, QtCore, QtWidgets
from kataja.singletons import ctrl
from kataja.uniqueness_generator import next_available_type_id
class GlowRing(QtWidgets.QGraphicsEllipseItem):
""" Decoration for radial menus """
__qt_type_id__ = next_av... | jpurma/Kataja | kataja/ui_support/GlowRing.py | Python | gpl-3.0 | 1,364 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +---------------------------------------------------------------------+
# | ___ _ ____ _____ |
# | |_ _|___ ___ ___ __ _ ___| |_|___ \ |___ / __ __ |
# | | |/ __/ _ \/ __/ _` / ... | alexolivan/check_mk_plugins | icecast2/agents/plugins/icecast2.py | Python | gpl-2.0 | 4,391 |
#!/usr/bin/python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*-
"""
Role
====
Defines the basic mechanisms to have a plugin manager filter the
available list of plugins after locating them and before loading them.
One use fo this would be to prevent untrusted plugins from entering
the ... | haiyamading/pyqt_tray | yapsy/FilteredPluginManager.py | Python | gpl-2.0 | 4,021 |
def Send_Certified_By_Automation():
import smtplib
from elan import ElanSettings
import os
from elan.ElanSettings import Script_Runner_Log
def send_email(subject,
body,
user='kennyshay123test@gmail.com',
pwd='corebrands123',
... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/elan/Certified_Build.py | Python | gpl-3.0 | 2,028 |
from django.db import models
from django.utils import timezone
from django.core.exceptions import ValidationError
from django.core.files.storage import FileSystemStorage
import hashlib
import os
import string
#custom storage pulled from phoibos on stackoverflow.com
class MediaFileSystemStorage(FileSystemStorage):
... | TheDr1ver/WIPSTER | wipster/sanalysis/models.py | Python | gpl-3.0 | 3,107 |
from setuptools import setup
from mpd_tag import VERSION
setup(
name = 'mpd-tag',
version = VERSION,
author = 'Anton Bobrov',
author_email = 'bobrov@vl.ru',
description = 'MPD tag manager',
#long_description = open('README.rst').read().replace('https', 'http'),
install_requires = ['... | baverman/mpd-tag | setup.py | Python | mit | 749 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Javier Martínez García August 2015
from PySide import QtCore
from math import sin, cos, radians
# retrieve the objects from the document
slider_x = FreeCAD.ActiveDocument.getObject("Pad003002")
slider_y = FreeCAD.ActiveDocument.getObject("Pad003001")
arm = FreeCAD.A... | JMG1/FreeCAD-Double-Slider-Mechanism | DoubleSliderAnimation.py | Python | gpl-2.0 | 1,893 |
"""Mock helpers for Z-Wave component."""
from pydispatch import dispatcher
from tests.async_mock import MagicMock
def value_changed(value):
"""Fire a value changed."""
dispatcher.send(
MockNetwork.SIGNAL_VALUE_CHANGED,
value=value,
node=value.node,
network=value.node._network,... | sdague/home-assistant | tests/mock/zwave.py | Python | apache-2.0 | 6,380 |
#!/usr/bin/env python
'''Seizure figures for the I-surround with the original E-surround
configuration.'''
from __future__ import absolute_import, print_function, division
from grid_cell_model.submitting import flagparse
import noisefigs
from noisefigs.env import NoiseEnvironment
import config_pastoll_pc_weight_3 as ... | MattNolanLab/ei-attractor | grid_cell_model/simulations/007_noise/figures/paper/i_surround/figure_seizures_pastoll_et_al_pc_weight_3.py | Python | gpl-3.0 | 1,431 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0018_menuitem_metin'),
]
operations = [
migrations.RemoveField(
model_name='menuitem',
name='... | neslihanturan/artge | app/migrations/0019_remove_menuitem_metin.py | Python | gpl-3.0 | 345 |
__author__ = 'amw'
from quicktest.Reporting import plot3d, plot2d, create_dataset, create_plot_matrix
# Initialise database config
db_config = {"hostname": "localhost", "port": "27017", "db_name": "simulations", "collection_name": "validation_050913"}
tag = "direct_detmerge_1m_040913-2"
x_param = "parameters.numSub... | ClockworkOrigins/m2etis | configurator/quicktest/reporting/direct_detmerge_1m_04-09-13.py | Python | apache-2.0 | 2,001 |
# Twisted, the Framework of Your Internet
# Copyright (C) 2001 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in ... | fxia22/ASM_xf | PythonD/site_python/twisted/python/observable.py | Python | gpl-2.0 | 13,623 |
# -*- coding: utf-8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2015 Pierre Vacher <prrvchr@gmail.com> *
#* ... | prrvchr/USBTerminal | USB/Gui/UsbPoolPanel.py | Python | gpl-2.0 | 4,080 |
# Name: Pre-Logic Script Code
# Created: April, 27, 2015
# Author: Sven Koberwitz
# Purpose: Find the number of occurrences of a value in a Field using Field Calculator.
## Pre-Logic Script Code
import arcpy
uniqueList = {}
## Set the name of the feature class here
fc = "feature_class"
rows = arcpy.SearchCursor(fc)... | skobz/Python | Find_Duplicates.py | Python | mit | 651 |
"""
Adapted code from "Contrast Limited Adaptive Histogram Equalization" by Karel
Zuiderveld <karel@cv.ruu.nl>, Graphics Gems IV, Academic Press, 1994.
http://tog.acm.org/resources/GraphicsGems/gems.html#gemsvi
The Graphics Gems code is copyright-protected. In other words, you cannot
claim the text of the code as yo... | jwiggins/scikit-image | skimage/exposure/_adapthist.py | Python | bsd-3-clause | 11,437 |
from .children_watcher import ChildrenWatcher
from .sequential import SequentialRecipe
class Party(SequentialRecipe):
sub_recipes = {
"watcher": ChildrenWatcher,
}
def __init__(self, base_path, name):
super().__init__(base_path)
self.name = name
self.members = []
... | tipsi/aiozk | aiozk/recipes/party.py | Python | mit | 1,306 |
from django.contrib import messages
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import redirect, render
from account.user_functions import can_create_character
from messaging.mode... | jardiacaj/finem_imperii | account/views.py | Python | agpl-3.0 | 3,269 |
import json
import re
import string
import random
from collections import Counter
from decimal import Decimal
from residue.models import ResidueGenericNumberEquivalent
from signprot.models import SignprotComplex
from protein.models import Protein, ProteinCouplings
from common.definitions import AMINO_ACID_GROUPS
fro... | protwis/protwis | signprot/interactions.py | Python | apache-2.0 | 14,959 |
#!/usr/bin/env python
# CREATED: 2013-10-06 22:31:29 by Dawen Liang <dl2771@columbia.edu>
# unit tests for librosa.decompose
import warnings
# Disable cache
import os
try:
os.environ.pop('LIBROSA_CACHE_DIR')
except:
pass
import numpy as np
import scipy.sparse
import librosa
import sklearn.decomposition
from... | ruohoruotsi/librosa | tests/test_decompose.py | Python | isc | 5,448 |
"""
This module has the basic decorators of IoTPy
"""
import numpy as np
import sys
sys.path.append("../../IoTPy/core")
sys.path.append("../../IoTPy/agent_types")
sys.path.append("../../IoTPy/helper_functions")
# agent and stream are in IoTPy/IoTPy/core
from stream import Stream, run
# recent_values is in IoTPy/IoTP... | AssembleSoftware/IoTPy | examples/merge/examples_merge.py | Python | bsd-3-clause | 12,608 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# kboard documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 16 16:12:25 2016.
#
# 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
# aut... | hyesun03/k-board | docs/source/conf.py | Python | mit | 9,947 |
"""
Preprocess Criteo dataset. This dataset was used for the Display Advertising
Challenge (https://www.kaggle.com/c/criteo-display-ad-challenge).
"""
import os
import sys
import click
import random
import collections
# There are 13 integer features and 26 categorical features
continous_features = range(1, 14)
categor... | kuke/models | legacy/deep_fm/preprocess.py | Python | apache-2.0 | 6,588 |
from .config import PrecisionConfig
import numpy as np
import random
Q = 293973345475167247070445277780365744413
class MPCNatural(object):
def __init__(self, id, repo):
self.id = id
self.repo = repo
def get(self):
return sum(self.get_shares()) % Q
def get_shares(self):
... | dipanshunagar/PySyft | syft/mpc/rss/scalar.py | Python | apache-2.0 | 3,827 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from collections import Counter
class Solution(object):
def findMode(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
if not ... | xiaonanln/myleetcode-python | src/501. Find Mode in Binary Search Tree.py | Python | apache-2.0 | 560 |
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | deepmind/xmanager | xmanager/xm_local/packaging/router.py | Python | apache-2.0 | 4,103 |
# Copyright 2013 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.
import distutils.version
import os
import sys
import textwrap
import unittest
ROOT_PATH = os.path.abspath(os.path.join(
os.path.dirname(os.path.dirname(... | withtone/depot_tools | testing_support/coverage_utils.py | Python | bsd-3-clause | 2,321 |
""" Non-negative matrix factorization
"""
# Author: Vlad Niculae
# Lars Buitinck
# Mathieu Blondel <mathieu@mblondel.org>
# Tom Dupre la Tour
# Author: Chih-Jen Lin, National Taiwan University (original projected gradient
# NMF implementation)
# ... | fabioticconi/scikit-learn | sklearn/decomposition/nmf.py | Python | bsd-3-clause | 46,993 |
from __future__ import division, absolute_import, print_function
import sys
try:
# Accessing collections abstract classes from collections
# has been deprecated since Python 3.3
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc
import textwrap
from os i... | shoyer/numpy | numpy/core/tests/test_records.py | Python | bsd-3-clause | 17,957 |
# Copyright (C) 2017-2020 Greenweaves Software Limited
# This 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 software is dist... | weka511/bioinformatics | fasta.py | Python | gpl-3.0 | 2,986 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings... | hanleybrand/mdid3-core-a-goof-around | mdid3/config/production.py | Python | bsd-3-clause | 4,733 |
import ngspyce
import numpy as np
from matplotlib import pyplot as plt
ngspyce.source('quad.net')
#trrandom(2 2m 0 10m 0)
ngspyce.cmd('tran 1m 20m')
print('\n'.join(ngspyce.vector_names()))
time, vsin, vcos = map(ngspyce.vector, ['time', 'Vsin', 'Vcos'])
#np.savetxt('vcos.txt', vcos)
#np.savetxt('vsin.txt', vsin)
#np.... | ignamv/ngspyce | examples/quadrature_oscillator/quadosc.py | Python | gpl-2.0 | 448 |
# -*- coding: utf-8 -*-
#
# Copyright 2010-2015 The pygit2 contributors
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2,
# as published by the Free Software Foundation.
#
# In addition to the permissions in the GNU General Public Li... | Sheeo/pygit2 | test/test_tree.py | Python | gpl-2.0 | 5,992 |
from PySide.QtCore import *
from PySide.QtGui import *
import unittest
class MyModel (QAbstractListModel):
stupidLine = QLine(0, 0, 10, 10)
def rowCount(self, parent):
return 1
def data(self, index, role):
return self.stupidLine
class TestBug693(unittest.TestCase):
def testIt(self)... | enthought/pyside | tests/QtGui/bug_693.py | Python | lgpl-2.1 | 670 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from models import Project
class ProjectsTest(TestCase):
fixtures = ['test_data.json']
def test_project_listing(self):
"""
Verify that the project listing page contains a... | mazelife/django-belleville | belleville/projects/tests.py | Python | apache-2.0 | 1,492 |
# -*- coding: UTF-8 -*-
#
"""ServerStore tester"""
class GnrCustomWebPage(object):
py_requires = "gnrcomponents/testhandler:TestHandlerFull,storetester:StoreTester"
dojo_theme = 'claro'
def test_1_current_page(self, pane):
"""On current page """
self.common_form(pane, datapath='test_1')
... | poppogbr/genropy | packages/test15/webpages/tools/server_store.py | Python | lgpl-2.1 | 1,125 |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | weolar/miniblink49 | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py | Python | apache-2.0 | 18,084 |
import numpy as np
from scipy import optimize
from numpy.testing import assert_allclose
from scipy.special import factorial, xlogy
from itertools import product
import pytest
from sklearn.utils._testing import assert_almost_equal
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import ... | manhhomienbienthuy/scikit-learn | sklearn/metrics/tests/test_regression.py | Python | bsd-3-clause | 23,340 |
from __init__ import *
path = os.environ["TDGU_PATH"] + '/'
fileoutp = open(path + 'pcatsubm.log', 'w')
cntr = 0
for name in os.listdir(path):
if name.endswith(".py"):
print name
fileobjt = open(path + name, 'r')
for line in fileobjt:
if line.startswith('def pcat_'):
... | tdaylan/tdgu | pcatsubm.py | Python | mit | 1,007 |
from django.http import HttpResponse
from webpos.models import Category
def check(request):
try:
qs = Category.objects.all()
list(qs)
return HttpResponse("OK")
except Exception:
return HttpResponse("NO")
| radome/OpenGenfri | pos/pos/views.py | Python | mit | 245 |
from random import seed as seventythree
from math import floor as se
ven = sum
from random import random as ty
three = ty
tythree = range
def checkio ( ) :
seventythree( 73737373737373737373737373 )
return se( ven( ty( ) + three( ) for seven in tythree( 73 ) ) )
print( checkio( ) )
| aureooms/checkio | home/the-best-number-ever.py | Python | agpl-3.0 | 296 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# base_addition - 2014-10-19 - ejb
from __future__ import print_function
import argparse
import sys
__version__ = '0.1'
'''
Revision history
0.1 Initial version
'''
DIGITS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
debug = False
def parse_args():
parser = argparse... | ebassett/base_addition | base_addition.py | Python | gpl-2.0 | 4,658 |
#!/usr/bin/env python
#
# Generate pnSeed[] from Pieter's DNS seeder
#
NSEEDS=600
import re
import sys
from subprocess import check_output
def main():
lines = sys.stdin.readlines()
ips = []
pattern = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):14433")
for line in lines:
m = patt... | bitmxittz/Bitmxittz | contrib/seeds/makeseeds.py | Python | mit | 709 |
"""
accounts
FILE: forms.py
Created: 6/21/15 8:31 PM
"""
__author__ = 'Mark Scrimshire:@ekivemark'
from django import forms
from django.utils.safestring import mark_safe
from registration.forms import (RegistrationFormUniqueEmail,
RegistrationFormTermsOfService)
from accounts.models ... | ekivemark/BlueButtonFHIR_API | accounts/forms/other.py | Python | apache-2.0 | 3,932 |
from itertools import chain
from bokeh.core.enums import NamedColor as Color, LineJoin, LineCap
# enums
FILL = ["fill_color", "fill_alpha"]
LINE = ["line_color", "line_width", "line_alpha", "line_join", "line_cap", "line_dash", "line_dash_offset"]
TEXT = ["text_font", "text_font_size", "text_font_style", "text_color"... | draperjames/bokeh | bokeh/models/tests/utils/property_utils.py | Python | bsd-3-clause | 2,396 |
# coding: latin-1
import quicksort2
# construction de l'arbre
racine = quicksort2.construit_arbre ()
# construction de l'image du graphe
racine.image ("graph.txt", "graph.png")
# construction du début du fichier tex
package = """a4 amsmath amssymb subfigure float latexsym amsfonts
epic eepic makeidx multido varindex ... | sdpython/ensae_teaching_cs | _todo/programme/quicksort4.py | Python | mit | 2,214 |
import sys
import traceback
from io import BytesIO
from unittest import TestCase
from wsgiref import simple_server
# If data is too large, socket will choke, so write chunks no larger than 32MB
# at a time. The rationale behind the 32MB can be found in #5596#comment:4.
MAX_SOCKET_CHUNK_SIZE = 32 * 1024 * 1024 # 32 MB... | twz915/django | tests/builtin_server/tests.py | Python | bsd-3-clause | 4,631 |
"""Define constants for the Sensor.Community integration."""
from datetime import timedelta
ATTR_SENSOR_ID = "sensor_id"
CONF_SENSOR_ID = "sensor_id"
DEFAULT_SCAN_INTERVAL = timedelta(minutes=10)
DOMAIN = "luftdaten"
| rohitranjan1991/home-assistant | homeassistant/components/luftdaten/const.py | Python | mit | 221 |
""" netentry -- Network entry widgets for the GUI.
This module provides GUI widgets used to represent wired and wireless
entries in the GUI's network list, as well as any settings dialogs
contained within them.
"""
#
# Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2008-2009 Dan O'Reilly
# Copyright (C)... | johnboiles/wicd | gtk/netentry.py | Python | gpl-2.0 | 53,597 |
from .core import ( # noqa
AssetID,
AssetIDPlusDay,
EPOCH,
ExplodingObject,
FakeDataPortal,
FetcherDataPortal,
MockDailyBarReader,
OpenPrice,
RecordBatchBlotter,
add_security_data,
all_pairs_matching_predicate,
all_subindices,
assert_single_position,
assert_times... | quantopian/zipline | zipline/testing/__init__.py | Python | apache-2.0 | 1,361 |
"Fits an example function"
from __future__ import division
from numpy import logspace, log, log10, random
from gpfit.fit import fit
# fixed initial guess for fitting
random.seed(33404)
u = logspace(0, log10(3), 101)
w = (u**2 + 3) / (u + 1)**2
x = log(u)
y = log(w)
K = 3
cMA, errorMA = fit(x, y, K, "MA")
cSMA, error... | convexopt/gpfit | docs/source/examples/hoburgabbeel_ex6_1.py | Python | mit | 507 |
"""
Generate CPU features tables from CCompilerOpt
"""
from os import sys, path
from numpy.distutils.ccompiler_opt import CCompilerOpt
class FakeCCompilerOpt(CCompilerOpt):
# disable caching no need for it
conf_nocache = True
def __init__(self, arch, cc, *args, **kwargs):
self.fake_info = (arch, c... | anntzer/numpy | doc/source/reference/simd/gen_features.py | Python | bsd-3-clause | 6,371 |
import sys
name = sys.argv[1]
handle = open(name, 'r')
text = handle.read()
print(name, 'is', len(text), 'bytes')
| crookedreyes/py4e-specialization | code3/argfile.py | Python | lgpl-2.1 | 115 |
# 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 PyTetoolkit(PythonPackage):
"""TEToolkit is a software package that utilizes both unambigu... | iulian787/spack | var/spack/repos/builtin/packages/py-tetoolkit/package.py | Python | lgpl-2.1 | 1,095 |
"""Support for Toon binary sensors."""
from datetime import timedelta
import logging
from typing import Any
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from . import (ToonEntity, ... | MartinHjelmare/home-assistant | homeassistant/components/toon/binary_sensor.py | Python | apache-2.0 | 4,548 |
#!/usr/bin/python
"""
Cartesian configuration format file parser.
Filter syntax:
* ``,`` means ``OR``
* ``..`` means ``AND``
* ``.`` means ``IMMEDIATELY-FOLLOWED-BY``
* ``(xx=yy)`` where ``xx=VARIANT_NAME`` and ``yy=VARIANT_VALUE``
Example:
::
qcow2..(guest_os=Fedora).14, RHEL.6..raw..boot, smp2..qcow2..migr... | balamuruhans/avocado-vt | virttest/cartesian_config.py | Python | gpl-2.0 | 78,979 |
# Copyright 2013: Mirantis 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 b... | afaheem88/rally | tests/unit/deployment/engines/test_devstack.py | Python | apache-2.0 | 4,402 |
#! /usr/bin/env python
""" Create files for jmod unit test """
import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p
d, a = pipe.read("time_complex.fid")
d, a = p.jmod(d, a, cos=True, j=10.0, lb=5.0, c=1.0)
pipe.write("jmod1.glue", d, a, overwrite=True)
d, a = pipe.read("time_complex.fid")
d, a = ... | atomman/nmrglue | tests/pipe_proc_tests/jmod.py | Python | bsd-3-clause | 458 |
import theano
import theano.tensor as T
import numpy as np
import copy
import os
import datetime
import cPickle as pickle
from Loss import nll_multiclass_3d,categorical_crossentropy
from Initializations import glorot_uniform,zero,alloc_zeros_matrix,norm_weight,glorot_normal
from Utils import Progbar,ndim_tensor,make_ba... | chuckgu/Alphabeta | theano/library/Model_ENC_DEC.py | Python | gpl-3.0 | 22,150 |
# Copyright 2019 The Magenta 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 ... | jesseengel/magenta | magenta/music/chords_lib_test.py | Python | apache-2.0 | 10,501 |
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.core.validators import RegexValidator
from rest_framework import serializers
from rest_framework.authtoken.models import Token
from rest_framework.validators import UniqueValidator
from betterself.users.mod... | jeffshek/betterself | apis/betterself/v1/users/serializers.py | Python | mit | 3,207 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ozmaxweb.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| ozmax/ozmaxweb | manage.py | Python | gpl-2.0 | 251 |
# -*- coding: utf-8 -*-
# mingus - Music theory Python package, tablature module.
# Copyright (C) 2009, Bart Spaans
#
# 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 versi... | bspaans/python-mingus | mingus/extra/tablature.py | Python | gpl-3.0 | 15,116 |
import os
import re
import json
from django.conf import settings
import sh
import mapnik
import time
import logging
from terrapyn.geocms.cache import CacheManager
from terrapyn.geocms import models
_log = logging.getLogger('terrapyn.driver_messages')
LAYER_CACHE_PATH = getattr(settings, 'LAYER_CACHE_PATH')
if not ... | JeffHeard/terrapyn | geocms/rendering.py | Python | apache-2.0 | 5,180 |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
]
| diegoguimaraes/django | tests/proxy_models/urls.py | Python | bsd-3-clause | 142 |
# -*- coding: utf-8 -*-
from flask import render_template, send_from_directory
from . import main_blueprint
@main_blueprint.route('/')
def index():
return render_template('index.html')
| NQysit/pybwap | pybwap/main/views.py | Python | mit | 195 |
# 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.
import unittest
from catapult_build import html_checks
class MockAffectedFile(object):
def __init__(self, path, lines):
self.path = path
self.l... | SummerLW/Perf-Insight-Report | catapult_build/html_checks_unittest.py | Python | bsd-3-clause | 2,443 |
# Gambit scripts
#
# Copyright (C) USC Information Sciences Institute
# Author: Nibir Bora <nbora@usc.edu>
# URL: <http://cbg.isi.edu/>
# For license information, see LICENSE
# Folders
#DATA_FOLDER = 'all-hoods/'
#DATA_FOLDER = 'regions/'
#DATA_FOLDER = 'hbk/'
#DATA_FOLDER = 'hbk_old/'
#DATA_FOLDER = '... | nbir/gambit-scripts | scripts/LAnhoodAnalysis/settings.py | Python | apache-2.0 | 1,709 |
from slack import Slack | iiegor/reaper | lib/ports/__init__.py | Python | mit | 23 |
########################################################
# core.py
# Author: Jamie Zhu <jimzhu@GitHub>
# Created: 2014/2/6
# Last updated: 2014/10/22
########################################################
import numpy as np
import sys
from utilities import *
########################################################... | wsdream/CARP | Baseline/src/core.py | Python | mit | 1,046 |
from users.models import Employee, EmployeeStatus
from django.contrib import admin
admin.site.register(Employee)
admin.site.register(EmployeeStatus)
| gdebure/cream | users/admin.py | Python | gpl-3.0 | 150 |
from big_cheese import BigCheese
from collections import defaultdict
from .exceptions import PNCounterException
class PNCounter(BigCheese):
def __init__(self):
self.p = defaultdict(int)
self.n = defaultdict(int)
def value(self):
return sum(self.p.itervalues()) - sum(self.n.itervalues()... | Sushant/cheeses | crdt/pn_counter.py | Python | mit | 1,526 |
alt_map = {'ins':'0'}
complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'}
def revComplement(seq):
for k,v in alt_map.items():
seq = seq.replace(k,v)
bases = list(seq)
bases = reversed([complement.get(base,base) for base in bases])
bases = ''.join(bases)
for k,v in alt_map.items():
... | sjspence/spenceOTU | epicBarcoder/pairedEnds.py | Python | mit | 1,858 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
#
from __future__ import absolute_import, unicode_literals, division
from datetime import date
from flask import (
Blueprint, render_template, url_for, request, redirect, abort,
jsonify, flash
)
from flask_login import current_user
from oclubs.utils.dates impor... | SHSIDers/oclubs | oclubs/blueprints/resblueprint.py | Python | mit | 16,327 |
'''
Defines constants for task class attributes.
@author: Peter Parente <parente@cs.unc.edu>
@copyright: Copyright (c) 2008 Peter Parente
@license: BSD License
All rights reserved. This program and the accompanying materials are made
available under the terms of The BSD License which accompanies this
distribution, an... | parente/clique | View/Task/Constants.py | Python | bsd-3-clause | 486 |
#/usr/bin/env python
# -#- coding: utf-8 -#-
#
# data_config/my_firmt.py
#
# Standard copyright message
#
#
#
# Initial version: 2012-04-12
# Author: Amnon Janiv
"""
.. module:: data_config/my_firm
:synopsis:equity file layout definition for 'us'
.. moduleauthor:: Amnon Janiv
"""
__revision__ = '$Id: ... | ajaniv/equitymaster | data_config/my_firm.py | Python | gpl-2.0 | 1,465 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 30 19:13:14 2016
@author: chavdar
"""
import csv
import requests
with open('url.csv', 'r') as f:
my_urls = []
reader = csv.reader(f)
for row in reader:
my_urls.append(row)
#
my_html = ""
my_html_list = []
#debug
#my_ur... | chavdim/amazon_comments | scrapper/getCommentsHtml.py | Python | mit | 1,344 |
#!/usr/bin/env python
"""
This scripts handles conversion of Markdown README into rst for inclusion
in Sphinx documentation.
"""
import os
from pypandoc import convert
DOC_DIR = os.path.dirname(os.path.abspath(__file__))
MD_README_PATH = os.path.join(os.path.dirname(DOC_DIR), 'README.md')
RST_README_PATH = os.path.j... | swistakm/graceful | docs/convert_readme.py | Python | bsd-3-clause | 512 |
"""
Auto-tuning a convolutional network for Mobile GPU
====================================================
**Author**: `Lianmin Zheng <https://https://github.com/merrymercy>`_
Auto-tuning for a specific device is critical for getting the best
performance. This is a tutorial about how to tune a whole convolutional
net... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/tutorials/autotvm/tune_nnvm_mobile_gpu.py | Python | apache-2.0 | 15,940 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.