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 |
|---|---|---|---|---|---|
"""adding territories or freely associated states flag to country code
Revision ID: 1fb19acc7d64
Revises: 0cf297fa927c
Create Date: 2019-04-16 14:32:40.284194
"""
# revision identifiers, used by Alembic.
revision = '1fb19acc7d64'
down_revision = '0cf297fa927c'
branch_labels = None
depends_on = None
from alembic imp... | fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/1fb19acc7d64_adding_territories_or_freely_associated_.py | Python | cc0-1.0 | 1,033 |
from waldur_core.core import WaldurExtension
class OpenStackTenantExtension(WaldurExtension):
class Settings:
# wiki: https://opennode.atlassian.net/wiki/display/WD/OpenStack+plugin+configuration
WALDUR_OPENSTACK_TENANT = {
'MAX_CONCURRENT_PROVISION': {
'OpenStackTenan... | opennode/nodeconductor-openstack | src/waldur_openstack/openstack_tenant/extension.py | Python | mit | 1,984 |
import decimal
try:
import thread
except ImportError:
import dummy_thread as thread
from threading import local
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import util
from django.db.transaction import TransactionManagementError
from django.utils import datet... | liqi328/rjrepaircompany | django/db/backends/__init__.py | Python | bsd-3-clause | 31,617 |
#!C:/Python26/python.exe
# -*- coding: utf-8 -*-
# enable debugging
import cgi
import os
import sys
import time
import re
import socket
import stat
import StringIO
import subprocess
import time
import itertools
from os import environ
form = cgi.FieldStorage()
# ===================== 程序配置 =====================
admin={... | xl7dev/WebShell | python/pyspy.py | Python | gpl-2.0 | 18,487 |
from wtypes.scope import WScope
from wtypes.string import WString
class WModule(WScope):
name = None
def __init__(self, builtins_module=None, name=None, filename=None):
super().__init__(builtins_module=builtins_module)
self['__module__'] = self
if name:
if isinstance(name,... | izrik/wodehouse | wtypes/module.py | Python | gpl-2.0 | 822 |
from collections import OrderedDict
from wazimap.data.utils import get_stat_data
MEAT_RECODES = OrderedDict([
('BUFF', 'Water Buffalo'),
('CHEVON', 'Goat'),
('CHICKEN', 'Chicken'),
('DUCK', 'Duck'),
('MUTTON', 'Mutton'),
('PORK', 'Pork')
])
LIVESTOCK_RECODES = OrderedDict([
('BUFFALOES', ... | cliftonmcintosh/nepalmap_app | wazimap_np/agriculture.py | Python | mit | 3,537 |
#!/usr/bin/env python
# Snippet from http://code.activestate.com/recipes/146306/
import httplib, mimetypes
def post_multipart(host, selector, fields, files):
"""
Post fields and files to an http host as multipart/form-data.
fields is a sequence of (name, value) elements for regular form fields.
files ... | kevthehermit/Maildb | core/vtpostfile.py | Python | gpl-3.0 | 1,896 |
# -*- coding: utf-8 -*-
#
# Copyright © 2013 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 distributed in t... | crobinso/pkgdb2 | tests/test_collection.py | Python | gpl-2.0 | 3,810 |
# Copyright 2014 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 ag... | flgiordano/netcash | +/google-cloud-sdk/lib/surface/compute/ssh.py | Python | bsd-3-clause | 8,389 |
"""
.. _ref_parametric_example:
Parametric Geometric Objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Creating parametric objects
"""
# sphinx_gallery_thumbnail_number = 12
import pyvista as pv
from math import pi
###############################################################################
# This example demonstrates how to... | akaszynski/vtkInterface | examples/00-load/create-parametric-geometric-objects.py | Python | mit | 5,082 |
# test_socket_wraper.py -- The tests for selftest socket wrapper routines
# Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
#
# 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; version 3
# of... | javierag/samba | selftest/tests/test_socket_wrapper.py | Python | gpl-3.0 | 1,327 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | alxgu/ansible | lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py | Python | gpl-3.0 | 6,130 |
import os
import unittest
import sys
from PyQt5 import QtGui
from PyQt5 import QtWidgets
"""
Unit tests for the QT GUI
=========================
In order to run the tests, first install SasView and sasmodels to site-packages
by running ``python setup.py install`` in both repositories.
The tests can be run with ``pyt... | SasView/sasview | src/sas/qtgui/GUITests.py | Python | bsd-3-clause | 11,242 |
"""
===========================
Plotting feature importance
===========================
A simple example showing how to compute and display
feature importances, it is also compared with the
feature importances obtained using random forests.
Feature importance is a measure of the effect of the features
on the outputs.... | mehdidc/py-earth | examples/plot_feature_importance.py | Python | bsd-3-clause | 2,142 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import os
from wiki import VERSION
from setuptools import setup, find_packages
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a t... | prabhanshu/django-wiki | setup.py | Python | gpl-3.0 | 3,295 |
from django.core.management.base import BaseCommand, CommandError
from analytics.models import ChannelDetails
from analytics.parser import ParseChannel
class Command(BaseCommand):
def handle(self, **options):
details = ChannelDetails.objects.all()
details.delete()
obj = ParseChannel()
... | shiminsh/youtube_analytics | youtube/analytics/management/commands/initializedb.py | Python | mit | 489 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 16:39:58 2016
用欧拉法计算自行车上下坡时的速度
@author: nightwing
"""
from math import atan,sin
import matplotlib.pyplot as plt
g = 9.8 #重力加速度(m/s2)
DENSITY = 1.29 #空气密度(kg/m3)
C = 0.5 #阻力系数
A = 0.33 #截面积(m2)
M = 70.0 #人车质量(kg)
v1 = 4.0 #(上坡)速度(m/s)
v2... | WuShichao/computational-physics | 2/2_4/2_4.py | Python | gpl-3.0 | 1,243 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ideascale', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Author',
fields=[
... | rebearteta/social-ideation | ideascale/migrations/0002_auto_20150424_1736.py | Python | mit | 4,257 |
import unittest
import utils
# O(nlog(n)) time. O(1) space. Greedy.
class Solution:
def smallestRangeII(self, a, k):
"""
:type a: List[int]
:type k: int
:rtype: int
"""
a.sort()
result = a[-1] - a[0]
for i in range(0, len(a) - 1):
result... | chrisxue815/leetcode_python | problems/test_0910.py | Python | unlicense | 768 |
'''OpenGL extension EXT.blend_equation_separate
This module customises the behaviour of the
OpenGL.raw.GL.EXT.blend_equation_separate to provide a more
Python-friendly API
Overview (from the spec)
EXT_blend_func_separate introduced separate RGB and alpha blend
factors. EXT_blend_minmax introduced a distinct bl... | D4wN/brickv | src/build_data/windows/OpenGL/GL/EXT/blend_equation_separate.py | Python | gpl-2.0 | 1,198 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | mcascallares/hand-luggage | main.py | Python | apache-2.0 | 4,034 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | ecerulm/python-heatclient | heatclient/tests/functional/base.py | Python | apache-2.0 | 1,527 |
from expy import shared
from expy.colors import *
from expy.io import sendTrigger
np = shared.np
math = shared.math
def getPos(x=shared.win_width // 2, y=shared.win_height // 2, w=0, h=0, anchor_x='center', anchor_y='center'):
'''
Caluate the screen position of object
Parameters
----------
x: flo... | ray306/expy | stim/draw.py | Python | gpl-3.0 | 19,988 |
"""
Faça agora o contrário, de Fahrenheit para Celsius.
Converta uma temperatura digitada em Celsius para Fahrenheit. F = 9*C/5 + 32
"""
import sys
a = input('Digite uma temperatura em Graus Fahrenheit\n')
try:
fahreinheit = int(a)
except ValueError:
try:
fahreinheit = float(a)
exce... | alexisbrabo/python_para_zumbis | lista_de_exercicios_1/8.py | Python | gpl-3.0 | 529 |
#! /usr/bin/env python
#
# Use the BMW ConnectedDrive API using credentials from credentials.json
# You can see what should be in there by looking at credentials.json.sample.
#
# 'auth_basic' is the base64-encoded version of API key:API secret
# You can capture it if you can intercept the traffic from the app at
# the ... | edent/BMW-i-Remote | python/bmw.py | Python | mit | 4,929 |
''' Download the Bokeh sample data sets to local disk.
To download the Bokeh sample data sets, execute
.. code-block:: sh
bokeh sampledata
on the command line.
Executing this command is equivalent to running the Python code
.. code-block:: python
import bokeh.sampledata
bokeh.sampledata.download()
... | Karel-van-de-Plassche/bokeh | bokeh/command/subcommands/sampledata.py | Python | bsd-3-clause | 736 |
#!/usr/bin/env python3
# written by sqall
# twitter: https://twitter.com/sqall01
# blog: https://h4des.org
# github: https://github.com/sqall01
#
# Licensed under the GNU Affero General Public License, version 3.
import RPi.GPIO as GPIO
import os
import time
from .core import _PollingSensor
from ..globalData import S... | sqall01/alertR | sensorClientRaspberryPi/lib/sensor/interrupt.py | Python | agpl-3.0 | 5,191 |
# Main script for orienting
# Modules in orienting_mods.py which could be moved to triangulation.py later
# Example:
# python orienting.py -in Dixon12_hESC-AllpathsLGcontigs.tab -out results -pos contigs_pos.tab -real_ori contig_orientations.tab
#########################################################################... | lpryszcz/HiCembler | .dna-triangulation/orienting.py | Python | gpl-3.0 | 9,214 |
#!/usr/bin/env python
from mvbb.box_db import MVBBLoader
import multiprocessing, subprocess
from multiprocessing import Pool
import sys
from plugins import soft_hand
def grasp_boxes(filename):
subprocess.call(['python', './grasp_boxes_batch.py', filename])
if __name__ == '__main__':
try:
import os.p... | lia2790/grasp_learning | python/simple_batch_splitter.py | Python | bsd-3-clause | 913 |
"""this is python equivalent of ./Wrapping/Tcl/vtktesting/backdrop.tcl
This script is used while running python tests translated from Tcl."""
import vtk
basePlane = None
baseMapper = None
base = None
backPlane = None
backMapper = None
back = None
leftPlane = None
leftMapper = None
left = None
def BuildBackdrop (mi... | cjh1/vtkmodular | Utilities/vtkTclTest2Py/backdrop.py | Python | bsd-3-clause | 1,927 |
class LookupConventions:
""" This class defines the constants used within the pyhamtools package """
# Mostly specific to Clublog XML File
CALLSIGN = u"callsign"
COUNTRY = u"country"
PREFIX = u"prefix"
ADIF = u"adif"
CQZ = u"cqz"
ITUZ = u"ituz"
CONTINENT = u"continent"
LATITUD... | dh1tw/pyhamtools | pyhamtools/consts.py | Python | mit | 2,368 |
from decimal import Decimal
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.forms.fields import Field
from django.forms.formsets import formset_factory, BaseFormSet
import commonware
import happyforms
from slumber.... | clouserw/zamboni | mkt/developers/forms_payments.py | Python | bsd-3-clause | 26,284 |
from __future__ import unicode_literals, print_function, absolute_import
from giles.utils import load_subcommands
for name in ('giles', 'jira', 'github'):
load_subcommands('giles.commands.' + name) | anthonyalmarza/giles | giles/commands/__init__.py | Python | mit | 203 |
# -*- coding: utf-8 -*-
from Crypto.Cipher import AES
from shaGeneration import *
from tools import *
import pickle
from os import remove
import pdb
#pdb.set_trace()
from twisted.internet import reactor, task
from twisted.python import log
from kademlia.network import Server
def grepChunks(result, i, j, server, spl... | pldubouilh/maidsafe | decrypt.py | Python | gpl-2.0 | 4,044 |
from __future__ import division
# -*- coding: utf-8 -*-
'''
Created on 18 Sep, 2014
PyMatrix implementation based on pure python oop charisma
Description:
@author : WANG LEI / YI, Research Associate @ NTU
@emial: L.WANG@ntu.edu.sg, Nanyang Technologcial University
@licence: licence
'''
__all__ = ["matrixArrayLists... | yiakwy/numpy | PyMatrix/v4/matrixArray.py | Python | bsd-3-clause | 56,236 |
#!/usr/bin/python3
import cgi
import os
import sys
import codecs
import binascii
import grpc
import rpc_pb2 as ln
import rpc_pb2_grpc as lnrpc
def connect():
# Due to updated ECDSA generated tls.cert we need to let gprc know that
# we need to use that cipher suite otherwise there will be a handshake
# err... | jhoenicke/mempool | web/lnd/invoice.py | Python | agpl-3.0 | 2,378 |
import unittest
import threading
import os
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
from mpfmonitor.core.mpfmon import *
"""class InitMPFMon(unittest.TestCase):
@classmethod
def setUpClass(self):
app = QApplication(sys.argv)
machine_path = os.path.join(os.getcwd(), "machine_f... | missionpinball/mpf-monitor | mpfmonitor/tests/test_mpfmon.py | Python | mit | 545 |
from django.db import models
from django.core.exceptions import EmptyResultSet
class SistemaManager(models.Manager):
""" Manager utilizado para interações com os Sistemas de Cultura """
def get_queryset(self):
queryset = super().get_queryset()
queryset = queryset.distinct('ente_federado__nome... | culturagovbr/sistema-nacional-cultura | adesao/managers.py | Python | agpl-3.0 | 768 |
from typing import NamedTuple, Optional
from django.contrib.auth import get_user_model
from problem.models import ProblemInstance
from .score import calculate_problem_score
User = get_user_model()
class UserProblemInfo(NamedTuple):
user: User
problem_instance: ProblemInstance
solved: bool
first_sol... | PLUS-POSTECH/study.plus.or.kr | src/problem/helpers/problem_info.py | Python | apache-2.0 | 2,919 |
#!/usr/bin/env python
from TweetGrabber import * | weilneb/twitter-utils | twutils/__init__.py | Python | mit | 48 |
from django.conf.urls import url, include
from check.core.views import *
urlpatterns = [
url(r'', include('django.contrib.auth.urls')),
url(r'^index/', IndexView.as_view(), name='index'),
url(r'^cliente/$', ListCliente.as_view(), name='list_cliente'),
url(r'^cliente/add$', CreateCliente.as_view(), n... | gabrielnaoto/man_check_control | check/core/urls.py | Python | mit | 2,444 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=redefined-builtin
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configura... | tryagainconcepts/debot | docs/conf.py | Python | mit | 8,437 |
# Copyright 2019 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... | sarvex/tensorflow | tensorflow/python/keras/premade/wide_deep.py | Python | apache-2.0 | 9,006 |
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#----------------------------------------------------... | mattvonrocketstein/smash | smashlib/ipy3x/utils/tests/test_localinterfaces.py | Python | mit | 607 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Tue Oct 28 21:10:10 2014 by generateDS.py version 2.12e.
#
# Command line options:
# ('-o', 'schema/vchs/ondemand/sc/sc/instanceType.py')
#
# Command line arguments:
# schema/vchs/ondemand/sc/sc/instance.xsd
#
# Command line:
# ./generateDS-2.12e/genera... | denismakogon/pyvcloud | pyvcloud/schema/vchs/ondemand/sc/sc/instanceType.py | Python | apache-2.0 | 66,418 |
# -*- mode: Python; coding: utf-8 -*-
# Copyright (c) 2002-2013 "Neo Technology,"
# Network Engine for Objects in Lund AB [http://neotechnology.com]
#
# This file is part of Neo4j.
#
# Neo4j is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... | neo4j-contrib/python-embedded | src/test/python/core.py | Python | gpl-3.0 | 15,319 |
from __future__ import absolute_import, unicode_literals
from basic_site import models as basic_site_models
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from wagtail.wagtailadmin.edit_handlers import (FieldPanel, M... | OpenCanada/lindinitiative | core/models.py | Python | mit | 3,564 |
# -*- coding: utf-8 -*-
from .api_server import API
app = API()
| business-factory/captain-hook | hooks/app.py | Python | mit | 66 |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | pronto/dotfiles | .vim/pylibs/logilab/common/shellutils.py | Python | bsd-2-clause | 14,284 |
#
#
# Copyright (C) 2007 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | dblia/nosql-ganeti | qa/qa_tags.py | Python | gpl-2.0 | 2,042 |
# -*- coding: utf-8 -*-
from openerp.tests import common
KARMA = {
'ask': 5, 'ans': 10,
'com_own': 5, 'com_all': 10,
'com_conv_all': 50,
'upv': 5, 'dwv': 10,
'edit_own': 10, 'edit_all': 20,
'close_own': 10, 'close_all': 20,
'unlink_own': 10, 'unlink_all': 20,
'gen_que_new': 1, 'gen_que... | mycodeday/crm-platform | website_forum/tests/common.py | Python | gpl-3.0 | 3,442 |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
unified_strdate,
compat_str,
)
class NocoIE(InfoExtractor):
_VALID_URL = r'http://(?:(?:www\.)?noco\.tv/emission/|player\.noco\.tv/\?idvideo=)(?P<id>\d+)'
... | huangciyin/youtube-dl | youtube_dl/extractor/noco.py | Python | unlicense | 3,451 |
#
# This plugin 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. You may not use, modify or
# distribute this program under any other version of the GNU General
# Public License.
#
# This plugin is ... | csababarta/volatility_plugins | usnjrnl.py | Python | gpl-2.0 | 12,715 |
import scipy
import pickle
import numpy
import sklearn.linear_model
import matplotlib #needed to avoid having to run an X-server just to output to a png
matplotlib.use('Agg') #needed to avoid having to run an X-server just to output to a png
import pylab
import re
def adjustR2(R2, numFeatures, numSamples):
#1/0
... | vansky/meg_playground | scripts/tileRegressionSeeRSquared_EpochsBack.py | Python | gpl-2.0 | 11,071 |
########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... | isaac-s/cloudify-plugins-common | cloudify/state.py | Python | apache-2.0 | 2,116 |
from random import random, randint
from PIL import Image, ImageDraw, ImageFont
import perlin
def draw_background(setup) :
canvas = setup['canvas']
image = Image.new('RGBA', canvas, tuple(setup['color']['back']))
background = Image.new('RGBA', canvas, (0,0,0,0))
draw = ImageDraw.Draw(background)
stars = [[ int(p... | vojtatom/planets | sun.py | Python | gpl-3.0 | 3,499 |
#
# Copyright 2009 Red Hat, Inc.
# Cole Robinson <crobinso@redhat.com>
#
# 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 versi... | cardoe/virt-manager | virtconv/parsers/ovf.py | Python | gpl-2.0 | 13,949 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from solution import Solution
board = [['o','a','a','n'],
['e','t','a','e'],
['i','h','k','r'],
['i','f','l','v']]
words = ["oath","pea","eat","rain"]
sol = Solution()
res = sol.findWords(board, words)
print(res)
| zhlinh/leetcode | 0212.Word Search II/test.py | Python | apache-2.0 | 288 |
import clutter
import mxpy as mx
def create_button(parent, text, x, y):
button = mx.Button(text)
parent.add(button)
button.set_size(150, 100)
button.set_position(x, y)
return button
if __name__ == '__main__':
stage = clutter.Stage()
stage.connect('destroy', clutter.main_quit)
style = ... | buztard/mxpy | examples/test-styles.py | Python | lgpl-2.1 | 1,030 |
SECONDS_IN_DAY = 86400
| miti0/mosquito | core/constants.py | Python | gpl-3.0 | 24 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012-2013, Timothy Appnel <tim@appnel.com>
#
# 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) an... | grimmjow8/ansible | lib/ansible/modules/files/synchronize.py | Python | gpl-3.0 | 18,198 |
from __future__ import unicode_literals
import boto
import boto3
from boto3.dynamodb.conditions import Key
import sure # noqa
from freezegun import freeze_time
from boto.exception import JSONResponseError
from moto import mock_dynamodb2
from tests.helpers import requires_boto_gte
try:
from boto.dynamodb2.fields i... | rouge8/moto | tests/test_dynamodb2/test_dynamodb_table_without_range_key.py | Python | apache-2.0 | 13,379 |
import ast
import os
import pytest
from flake8_import_order import pylama_linter
from tests.utils import extract_expected_errors
def load_test_cases():
base_path = os.path.dirname(__file__)
test_case_path = os.path.join(base_path, "test_cases")
test_case_files = os.listdir(test_case_path)
test_cas... | jhuttner/flake8-import-order | tests/test_pylama_linter.py | Python | lgpl-3.0 | 1,440 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListYourRepos
# Retrieves a list of repositories for the authenticated user.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
... | willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/GitHub/ReposAPI/Repos/ListYourRepos.py | Python | gpl-2.0 | 5,378 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.configuration import Configuration
from opus_core.session_configuration import SessionConfiguration
class Resources(Configuration):
... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_core/resources.py | Python | gpl-2.0 | 2,116 |
# -*- coding: utf-8 -*-
"""
pygments.formatters.terminal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for terminal output with ANSI sequences.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
from pygments.formatter import Format... | kirbyfan64/pygments-unofficial | pygments/formatters/terminal.py | Python | bsd-2-clause | 4,065 |
class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if len(s) < 2 or numRows == 1:
return s
sub_str = []
for i in range(1, numRows-1):
s1 = s[i:len(s):2*numRows-2]
... | taulk/oj | LeetCode/[6]zigzag-conversion/Solution.py | Python | unlicense | 585 |
# -*- coding: utf-'8' "-*-"
import base64
import json
from hashlib import sha1
import hmac
import logging
import urlparse
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_adyen.controllers.main import AdyenController
from openerp.osv import osv, fields
from opener... | minhphung171093/GreenERP | openerp/addons/payment_adyen/models/adyen.py | Python | gpl-3.0 | 7,511 |
import json
import datetime
from django.core.files.base import ContentFile
from django.core.exceptions import ValidationError
from django.utils.timezone import utc
from ..models import AgentProfile
from ..exceptions import IDNotFoundError, ParamError
from ..utils import etag
class AgentProfileManager():
def __... | adlnet/ADL_LRS | lrs/managers/AgentProfileManager.py | Python | apache-2.0 | 5,034 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import os
from setuptools import setup
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
setup(
name='dj... | akanouras/django-pudb | setup.py | Python | mit | 1,352 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from setuptools import setup, find_packages
PACKAGE_VERSION = '0.1'
deps = [
'marionette-client == 0.8.7',
]
setu... | chmanchester/firefox-ui-tests | setup.py | Python | mpl-2.0 | 1,414 |
""" Defines the base class for color maps
"""
from traits.api import Enum, HasTraits, Instance
from data_range_1d import DataRange1D
class AbstractColormap(HasTraits):
"""
Abstract class for color maps, which map from scalar values to color values.
"""
# The data-space bounds of the mapper.
range... | burnpanck/chaco | chaco/abstract_colormap.py | Python | bsd-3-clause | 2,253 |
#! /usr/bin/env python
from dolfin import *
from utilities import *
set_dolfin_optimisation()
from dolfin_fvm import *
import numpy
import argparse
parser = argparse.ArgumentParser(description = 'coupling demo')
parser.add_argument('--correct', action='store_true', default=False)
parser.add_argument('--limit', acti... | cwaluga/conservative_dolfin | src/cavity.py | Python | mit | 6,198 |
# coding: utf-8
# # Query `apiso:ServiceType` on data.gov
# In[26]:
from owslib.csw import CatalogueServiceWeb
from owslib import fes
import numpy as np
# In[27]:
endpoint = 'http://catalog.data.gov/csw-all' #granule level production catalog
#endpoint = 'http://data.ioos.us/csw'
csw = CatalogueServiceWeb(endpo... | rsignell-usgs/notebook | CSW/data.gov_pycsw.py | Python | mit | 1,865 |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
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... | RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/cli/silva.py | Python | apache-2.0 | 1,309 |
import httplib2
import urlparse
import urllib
import time
import hmac
import base64
try:
import xml.etree.ElementTree as ET
except ImportError:
import elementtree.ElementTree as ET
from UserDict import DictMixin
__all__ = ['SimpleDB', 'Domain', 'Item', 'AttributeEncoder', 'where', 'every', 'item_name', 'Simpl... | saymedia/python-simpledb | simpledb/simpledb.py | Python | bsd-3-clause | 33,851 |
#!/usr/bin/env python
from distutils.core import setup
setup(author='Jeffrey Scudder',
name='atom',
author_email='j.s@google.com',
license='Apache 2.0',
url='https://github.com/qmagico/google-atom',
packages=['atom'],
version='2.0.18',
package_dir = {'atom':'atom'},) | qmagico/google-atom | setup.py | Python | apache-2.0 | 311 |
'''
lcakegg2counts.py
==================
:Author: Nick Ilott
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
Count the number of alignments assigned to KEGG orthology groups. The alignments
can be counted at different levels of the KO hierarchy e.g. category A-D => high level
pathway - KO gene.
KO = Keg... | CGATOxford/proj029 | scripts/lcakegg2counts.py | Python | bsd-3-clause | 6,443 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.page ... | tysonholub/twilio-python | twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py | Python | mit | 20,610 |
#
# Transmission Line Simulator
#
# Author(s): Jiacong Xu
# Created: Jul-27-2017
#
from util.constants import *
from circuitelement import CircuitElement
import numpy as np
class Wire(CircuitElement):
"""
Represents a wire. This class allows an arbitrary signal speed and relays
voltage accordingly.
"... | flyingbanana1024102/transmission-line-simulator | src/models/wire.py | Python | mit | 1,615 |
__source__ = 'https://leetcode.com/problems/sort-list/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/sort-list.py
# Time: O(nlogn)
# Space: O(logn) for stack call
# Sort
#
# Description: Leetcode # 148. Sort List
#
# Sort a linked list in O(n log n) time using constant space complexity.
#
# Related Topics... | JulyKikuAkita/PythonPrac | cs15211/SortList.py | Python | apache-2.0 | 6,949 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tenacious.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| vzvenyach/tenacious | tenacious/manage.py | Python | mit | 252 |
from django import forms
from accounts.models import User, Review, Comment
from django.contrib.auth.forms import UserCreationForm
from django.forms import ModelForm
class UserCreationForm(UserCreationForm):
email = forms.EmailField(required=True)
avatar = forms.ImageField(required=False)
class Meta:
... | ch3ka/codingcontest2012 | bookz/accounts/forms.py | Python | gpl-3.0 | 1,001 |
# -*- coding: utf-8 -*-
import time
import pibooth
class LightsPlugin(object):
"""Plugin to manage the lights via GPIO.
"""
def __init__(self, plugin_manager):
self._pm = plugin_manager
@pibooth.hookimpl
def pibooth_startup(self, app):
app.led_startup.switch_on()
@pibooth.... | werdeil/pibooth | pibooth/plugins/lights_plugin.py | Python | mit | 2,503 |
# 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 unittest
from telemetry.core import browser_options
from telemetry.core.backends.chrome import desktop_browser_finder
from telemetry.unittest import s... | boundarydevices/android_external_chromium_org | tools/telemetry/telemetry/core/backends/chrome/desktop_browser_finder_unittest.py | Python | bsd-3-clause | 7,672 |
from __future__ import print_function
import numpy as np
#1) Run dev-tools/mem_counter inside EPW/src
#2) compile UtilXlib/mem_counter.f90 with -D__DEBUG flag
#3) Run EPW
#4) grep ' allocating' epw1.out > alloc.txt
#5) grep 'deallocating' epw1.out > dealloc.txt
#6) Run this script after having changed the correct all... | QEF/q-e_schrodinger | dev-tools/mem_analyse.py | Python | gpl-2.0 | 1,780 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
from odoo.tools.float_utils import float_split_str
from odoo.tools.misc import mod10r
l10n_ch_ISR_NUMBER_LENGTH = 27
l10n_c... | richard-willowit/odoo | addons/l10n_ch/models/account_invoice.py | Python | gpl-3.0 | 9,277 |
from mpf.tests.MpfTestCase import MpfTestCase
class TestConfigOldVersion(MpfTestCase):
def get_config_file(self):
return 'test_config_interface_missing_version.yaml'
def get_machine_path(self):
return 'tests/machine_files/config_interface/'
def setUp(self):
self.save_and_prepare_... | missionpinball/mpf | mpf/tests/test_ConfigOldVersion.py | Python | mit | 517 |
# -*- coding: utf-8 -*-
import pytest
import sys
import random
from .test_base_class import TestBaseClass
from aerospike import exception as e
aerospike = pytest.importorskip("aerospike")
try:
import aerospike
except:
print("Please install aerospike python client.")
sys.exit(1)
class TestListInsertItems(... | aerospike/aerospike-client-python | test/new_tests/test_list_insert_items.py | Python | apache-2.0 | 9,572 |
# Copyright (c) 2012 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.
'''Constant definitions for GRIT.
'''
from __future__ import print_function
# This is the Icelandic noun meaning "grit" and is used to check that our
#... | endlessm/chromium-browser | tools/grit/grit/constants.py | Python | bsd-3-clause | 862 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Copyright (c) 2018-2019 NVIDIA CORPORATION. All rights reserved.
import torch
import torch.nn.functional as F
from torch import nn
from maskrcnn_benchmark.layers import ROIAlign
from .utils import cat
class LevelMapper(object):
"""Determi... | mlperf/training_results_v0.6 | NVIDIA/benchmarks/maskrcnn/implementations/pytorch/maskrcnn_benchmark/modeling/poolers.py | Python | apache-2.0 | 4,272 |
#!/usr/bin/env python3
import sys
from pprint import pprint
import sys; print(sys.executable)
def show(obj):
'''Show the dump of the properties of the object.'''
pprint(vars(obj))
if sys.flags.interactive:
from app import *
print('Loading Flask App in console mode. Use show(<obj)> to introspect.')
e... | DamnedFacts/flask-boilerplate | runserver.py | Python | bsd-3-clause | 432 |
# Copyright 2010 Curtis McEnroe <programble@gmail.com>
# Licensed under the GNU GPLv3
class Scope:
def __init__(self, parent=None):
self.bindings = {}
self.parent = parent
def __getitem__(self, key):
# If bound in this scope, return that
if self.bindings.has_key(key):
... | magomsk/lispy | scope.py | Python | isc | 1,055 |
"""
Example: parse JSON.
"""
from peglet import Parser, hug, join, attempt
literals = dict(true=True,
false=False,
null=None)
mk_literal = literals.get
mk_object = lambda *pairs: dict(pairs)
escape = lambda s: s.decode('unicode-escape')
mk_number = float
# Following http://www.... | JaDogg/__py_playground | reference/peglet/examples/json.py | Python | mit | 2,243 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | dennybaa/st2 | st2common/tests/unit/test_operators.py | Python | apache-2.0 | 10,068 |
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.base import Base
from geocoder.keys import bing_key
import re
class Bing(Base):
"""
Bing Maps REST Services
=======================
The Bing™ Maps REST Services Application Programming Interface (API)
provides a... | akittas/geocoder | geocoder/bing.py | Python | mit | 3,453 |
__version__ = '1.2.0'
__author__ = 'Dormy Mo'
| DormyMo/SpiderKeeper | SpiderKeeper/__init__.py | Python | mit | 46 |
from __future__ import absolute_import
import unittest
from unittest import TestCase
import numpy as np
from pyemma.coordinates.api import cluster_mini_batch_kmeans
class TestMiniBatchKmeans(TestCase):
def test_3gaussian_1d_singletraj(self):
# generate 1D data from three gaussians
X = [np.random.r... | trendelkampschroer/PyEMMA | pyemma/coordinates/tests/test_mini_batch_kmeans.py | Python | bsd-2-clause | 1,309 |
"""
Imports all submodules
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from deepchem.dock.pose_generation import PoseGenerator
from deepchem.dock.pose_generation import VinaPoseGenerator
from deepchem.dock.pose_scoring import PoseScorer
from deepch... | bowenliu16/deepchem | deepchem/dock/__init__.py | Python | gpl-3.0 | 637 |
"""
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you
have already thought through this!
If the integer's last digit is 0, what should the out... | fantuanmianshi/Daily | LeetCode/reverse_integer.py | Python | mit | 970 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.