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 |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | rouge/tokenizers.py | Python | apache-2.0 | 1,661 |
import asyncio
import io
import pytest
import asynctest
import mitmproxy.io
from mitmproxy import exceptions
from mitmproxy.addons import readfile
from mitmproxy.test import taddons
from mitmproxy.test import tflow
@pytest.fixture
def data():
f = io.BytesIO()
w = mitmproxy.io.FlowWriter(f)
flows = [
... | vhaupert/mitmproxy | test/mitmproxy/addons/test_readfile.py | Python | mit | 3,747 |
"""Generic builder."""
from regolith.htmlbuilder import HtmlBuilder
BUILDERS = {
'html': HtmlBuilder,
}
def builder(btype, rc):
"""Returns builder of the approriate type."""
return BUILDERS[btype](rc)
| hodger/regolith | regolith/builder.py | Python | cc0-1.0 | 221 |
# -*- coding: utf-8 -*-
import json
import six.moves.xmlrpc_client
from functools import wraps
from celery import chain, group
from celery.result import AsyncResult
from dateutil import parser
from django.contrib import messages
from django.contrib.auth import views
from django.core.exceptions import ObjectDoesNotExis... | anurag03/integration_tests | sprout/appliances/views.py | Python | gpl-2.0 | 42,946 |
#!/usr/bin/python
# ReachView code is placed under the GPL license.
# Written by Egor Fedorov (egor.fedorov@emlid.com)
# Copyright (c) 2015, Emlid Limited
# All rights reserved.
# If you are interested in using ReachView code as a part of a
# closed source project, please contact Emlid Limited (info@emlid.com).
# Th... | emlid/ReachView | ReachLED.py | Python | gpl-3.0 | 5,937 |
# -*- coding: utf-8 -*-
"""
Tests for video outline API
"""
import ddt
import itertools
from uuid import uuid4
from collections import namedtuple
from edxval import api
from mobile_api.models import MobileApiConfig
from xmodule.modulestore.tests.factories import ItemFactory
from xmodule.video_module import transcript... | hamzehd/edx-platform | lms/djangoapps/mobile_api/video_outlines/tests.py | Python | agpl-3.0 | 33,407 |
# -*- coding: utf-8 -*-
{
'name': 'Product status at website shop',
'version': '1.0.1',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category': 'eCommerce',
'website': 'https://yelizariev.github.io',
'depends': ['website_sale', 'stock'],
'data': [
'website_s... | ilmir-k/website-addons | website_sale_stock_status/__openerp__.py | Python | lgpl-3.0 | 428 |
"""
This page is in the table of contents.
Craft is a script to access the plugins which craft a gcode file.
The plugin buttons which are commonly used are bolded and the ones which are rarely used have normal font weight.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code ... | AlexeyKruglov/Skeinforge-fabmetheus | skeinforge_application/skeinforge_plugins/craft.py | Python | agpl-3.0 | 4,781 |
import json
from abc import ABCMeta
from collections import defaultdict
from django.template.loader import render_to_string
from django.utils import six
from django.utils.encoding import force_text
from django.utils.functional import Promise
from cms.constants import RIGHT, LEFT, REFRESH_PAGE, URL_CHANGE
class Item... | Venturi/cms | env/lib/python2.7/site-packages/cms/toolbar/items.py | Python | gpl-2.0 | 14,513 |
#!/usr/bin/env python
from golbase import GameOfLifeBase, Cell
import random
import time
import logging
class GameOfLifeBlockSwitch(GameOfLifeBase):
def __init__(self, *args, **kwargs):
super(GameOfLifeBlockSwitch, self).__init__(*args, **kwargs)
self.toroidal = True
def run(self):
... | yanigisawa/coffee-scale | pubsub/animation/gol-block-switch.py | Python | mit | 1,163 |
from django.shortcuts import get_object_or_404, render
from .models import Student
def index(request):
latest_students = Student.objects.all()
context = {'latest_students': latest_students}
return render(request, 'students/index.html', context)
def detail(request, student_id):
latest_students = Stu... | mimoralea/gtosa | osa/students/views.py | Python | gpl-2.0 | 526 |
from ...language.visitor import Visitor
class ValidationRule(Visitor):
__slots__ = 'context',
def __init__(self, context):
self.context = context
| wandb/client | wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/base.py | Python | mit | 165 |
# Copyright (c) 2009 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, m... | jxta/cc | vendor/boto/boto/vpc/vpc.py | Python | apache-2.0 | 1,921 |
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import pyqtgraph as pg
import numpy as np
class SRGraph(QWidget):
def __init__(self):
super(SRGraph, self).__init__()
#self.setFixedSize(500,375)
#self.labelFont = QFont("Arial", 10)
# Initialize the RG... | WubbaDuck/OverwatchTracker | graph.py | Python | gpl-3.0 | 3,048 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 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.... | wallnerryan/quantum_migrate | quantum/rootwrap/__init__.py | Python | apache-2.0 | 685 |
def squart_sum( n ):
sum1 = 0
sum2 = 0
for i in range( 1, n + 1 ):
sum1 = sum1 + i * i
for i in range( 1, n + 1 ):
sum2 = sum2 + i
sum2 = sum2 * sum2
print sum2 - sum1
squart_sum(10)
squart_sum(100)
| ringsd/projecteuler | python/006.py | Python | mit | 254 |
from __future__ import absolute_import
import uncertainties as U
from .. import asrootpy
__all__ = [
'as_ufloat',
'correlated_values',
]
def as_ufloat(roorealvar):
"""
Cast a `RooRealVar` to an `uncertainties.ufloat`
"""
if isinstance(roorealvar, (U.AffineScalarFunc, U.Variable)):
r... | ndawe/rootpy | rootpy/stats/correlated_values.py | Python | bsd-3-clause | 2,219 |
#!/usr/bin/env python
from iris_sdk.models.maps.base_map import BaseMap
class LinksMap(BaseMap):
first = None
next = None | scottbarstow/iris-python | iris_sdk/models/maps/links.py | Python | mit | 132 |
from setuptools import setup
import gi
gi.require_version('Gtk', '3.0')
setup(name='nvim-pygtk3',
version='0.3.4',
description='PyGTK3 frontend to Neovim with some visual GUI elements.',
long_description=open('README.md').read(),
author='R. Liang',
author_email='ricardoliang@gmail.com',
... | rliang/nvim-pygtk3 | setup.py | Python | mit | 1,042 |
#!/usr/bin/python
# _*_ coding: utf-8 _*_
print ""
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
| louistin/fullstack | Python/io/public_module.py | Python | mit | 218 |
algorithm = "hagedorn"
potential = {}
potential["potential"] = [["1/4 * sigma * x**4", 0 ],
[0 , "1/4 * sigma * x**4"]]
potential["defaults"] = {"sigma":"0.05"}
T = 6
dt = 0.01
eps = 0.1
f = 3.0
ngn = 4096
basis_size = 64
P = 2.0j
Q = 0.5
S = 0.0
par... | WaveBlocks/WaveBlocks | testsuite/basic_diagonal/test_quartic_oscillator_two_packet.py | Python | bsd-3-clause | 455 |
#!/usr/bin/env python
import os
import re
from yunohost.settings import settings_get
from yunohost.diagnosis import Diagnoser
from yunohost.regenconf import _get_regenconf_infos, _calculate_hash
from moulinette.utils.filesystem import read_file
class RegenconfDiagnoser(Diagnoser):
id_ = os.path.splitext(os.pat... | YunoHost/moulinette-yunohost | data/hooks/diagnosis/70-regenconf.py | Python | agpl-3.0 | 2,610 |
from django.db import models
from jsonfield.fields import JSONField
from accounts.models import JournalWriter
class Diary(models.Model):
writer = models.ForeignKey(JournalWriter, related_name='diaries')
title = models.CharField(max_length=100, null=True)
content = models.TextField(null=True)
place = ... | subramaniank/journal | journal/journal/diaries/models.py | Python | mit | 491 |
from __future__ import print_function
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from pandas import DataFrame
from pandas.util.testing import set_trace
from pandas import compat
dirs = []
names = []
lengths = []
if len(sys.argv) > 1:
loc = sys.argv[1]
else:
loc = '.'
walked = os... | jmmease/pandas | scripts/file_sizes.py | Python | bsd-3-clause | 4,949 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class PrivagalConfig(AppConfig):
name = 'privagal.core'
verbose_name = "Privagal"
def ready(self):
import privagal.core.checks # noqa
import privagal.core.signals.handlers # noqa
| ychab/privagal | privagal/core/apps.py | Python | bsd-3-clause | 311 |
# -*- coding: utf8 -*-
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# 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... | ProgVal/Limnoria-test | plugins/Aka/test.py | Python | bsd-3-clause | 11,172 |
from tests.unit import unittest
from boto.exception import BotoServerError, S3CreateError, JSONResponseError
from httpretty import HTTPretty, httprettified
class TestBotoServerError(unittest.TestCase):
def test_botoservererror_basics(self):
bse = BotoServerError('400', 'Bad Request')
self.assert... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gsutil/third_party/boto/tests/unit/test_exception.py | Python | gpl-3.0 | 5,217 |
import os
import imp
import sys
import six
class DotImportHook:
def find_module(self, fullname, path=None):
bits = fullname.split('.')
if len(bits) <= 1:
return
for folder in sys.path:
if os.path.exists(os.path.join(folder, fullname)):
return self
for i in range(1, len(bits) - 1):
package, mod... | sciyoshi/dotmod | dotmod.py | Python | mit | 1,987 |
#!/usr/bin/env python
import sys
requires = ['requests', 'requests_oauthlib']
console_script = """[console_scripts]
trovebox = trovebox.main:main
"""
# from trovebox._version import __version__
exec(open("trovebox/_version.py").read())
# Check the Python version
(major, minor) = sys.version_info[:2]
if (major, mino... | photo/openphoto-python | setup.py | Python | apache-2.0 | 1,685 |
# -*- coding: utf-8 -*-
"""
Generators for random graphs.
"""
# Copyright (C) 2004-2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
__author__ = "\n".join(['Aric Hagberg (hagberg@lanl.gov)',
... | rainest/dance-partner-matching | networkx/generators/random_graphs.py | Python | bsd-2-clause | 29,117 |
import thread
import time
characters = '1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm_'
characters = list(characters)
# print list(string) allowed_chars= list(characters)
keyboard = 'qwertyuiopasdfghjklzxcvbnm'
combos = ['qwe', 'wer', 'ert']
# print keyboard.items()
# for i in string:
... | husky-prophet/personal-backup | functions.py | Python | mit | 1,741 |
#!/usr/bin/python
#
# Nag(ix)SC -- nagixsc_write_xml.py
#
# Copyright (C) 2009-2010 Sven Velt <sv@teamix.net>
#
# 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, o... | wAmpIre/nagixsc | nagixsc_write_xml.py | Python | gpl-2.0 | 2,807 |
import locale
import time
sample_locales = [
('USA', 'en_US'),
('France', 'fr_FR'),
('Spain', 'es_ES'),
('Portugal', 'pt_PT'),
('Poland', 'pl_PL'),
]
for name, loc in sample_locales:
locale.setlocale(locale.LC_ALL, loc)
format = locale.nl_langinfo(locale.D_T_FMT)
print('{:>10}: {}'.for... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_internationlization_and_localization/locale_date.py | Python | apache-2.0 | 355 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from functools import partial
from lxml import etree
from html5lib.constant... | ashang/calibre | src/calibre/ebooks/oeb/polish/tests/parsing.py | Python | gpl-3.0 | 9,879 |
from inspect import Signature, Parameter
class Descriptor:
def __init__(self, name):
self.name = name
def __set__(self, instance, value):
print("Setting %s to %s" % (self.name, value))
instance.__dict__[self.name] = value
def __delete__(self, instance):
print("Delete ", s... | kmad1729/python_notes | metaprogramming/typely.py | Python | unlicense | 2,708 |
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | DataONEorg/d1_python | client_cli/src/__init__.py | Python | apache-2.0 | 842 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Ciclista.facebook'
db.add_column(u'xbapp_ciclista', 'facebook',
self.g... | developingo/Bicitacora | xbapp/migrations/0002_auto__add_field_ciclista_facebook__add_field_ciclista_twitter__add_fie.py | Python | gpl-3.0 | 1,839 |
#!/usr/bin/env python
import os
from glob import glob
from subprocess import check_output, CalledProcessError
def get_usb_devices():
try:
sdb_devices = map(os.path.realpath, glob('/sys/block/sd*'))
usb_devices = (dev for dev in sdb_devices
if 'usb' in dev.split('/')[5])
return... | DrewMeyersCUboulder/UPOD_Bridge | Atheros/devices.py | Python | mit | 846 |
'relational table'
import collections
class Table(object):
def __init__(self, column_names):
self._column_names = column_names
def insert(self, values):
'values::namedtuple for now'
def select_where(selected_column, where_columns, filter):
'''return list with selected_column
... | rlowrance/re-avm | Table.py | Python | bsd-3-clause | 397 |
from distutils.core import setup, Extension
setup(name='gv_socket',
version='0.1',
description='Python GaVer Socket',
author='Emiliano A Billi',
author_email='emiliano.billi@gmail.com',
url='http://www.gaverprotocol.com',
py_modules=["gv_socket"],
ext_modules=[
Extension(... | emilianobilli/gv_socket | python/setup.py | Python | gpl-2.0 | 432 |
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
class Tag:
"""Represents a single Gherkin Tag"""
def __init__(self, name: str, path: str, line: int) -> None:
self.name = na... | radish-bdd/radish | src/radish/models/tag.py | Python | mit | 549 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
from scipy.constants import N_A
from pymatgen.core.periodic_table import Element
from pymatgen.core.units import Charge, Time
from pymatgen.analysis.reaction_... | Bismarrck/pymatgen | pymatgen/apps/battery/conversion_battery.py | Python | mit | 20,784 |
# Copyright 2008-2010, Red Hat, Inc
# Dan Radez <dradez@redhat.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 6... | oppianmatt/django-loki | src/loki/management/commands/__init__.py | Python | gpl-3.0 | 359 |
# GUI object/properties browser.
# Copyright (C) 2011 Matiychuk D.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later ve... | moden-py/SWAPY-deleting | swapy-ob.py | Python | lgpl-2.1 | 1,243 |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
'%s r... | google-code/ampatu | languages/fr-ca.py | Python | agpl-3.0 | 7,028 |
# Copyright (c) 2014 Dell 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 a... | Nexenta/cinder | cinder/tests/unit/volume/drivers/dell/test_dellfc.py | Python | apache-2.0 | 41,853 |
#!/usr/bin/env python3
import sys
import unittest
from puppyparachute.trace import trace
from puppyparachute.store import format_db
from puppyparachute.tools import diff_db
def main():
z = 1
def f(x):
y = x + z
return y
class C(object):
def __init__(self, a):
self.a =... | naure/PuppyParachute | tests/test_trace.py | Python | gpl-2.0 | 2,340 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.flatpages.forms import FlatpageForm
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.test import TestCase, modify_settings, override_settings
from django.utils impor... | jylaxp/django | tests/flatpages_tests/test_forms.py | Python | bsd-3-clause | 4,568 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .forms import (OpenSQliteForm, OpenPostgresForm,
NewForm, AddTableForm, MyModelForm,
AppUserForm, FormTableColumn)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.compiler import com... | opengeostat/SmartDHOLES | smart_drillholes_gui/mainapp/views.py | Python | lgpl-3.0 | 30,589 |
def brooke():
i01.enable()
gestureforlondon3()
sleep(8)
i01.disable()
sleep(8)
i01.head.enable()
lookrightside()
sleep(4)
lookleftside()
sleep(4)
lookrightside()
sleep(4)
lookleftside()
i01.disable()
sleep(8)
i01.enable()
gestureforlondon4()
i01.disable()
sleep(8)
| MyRobotLab/pyrobotlab | home/kwatters/harry/gestures/brooke.py | Python | apache-2.0 | 303 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) Vauxoo (<http://vauxoo.com>).
# All Rights Reserved
###############Credits#########################################... | 3dfxsoftware/cbss-addons | mrp_production_filter_product/__openerp__.py | Python | gpl-2.0 | 1,768 |
"""
URLConf for test suite.
We need only the docs urls for DocumentationRenderer tests.
"""
from django.conf.urls import url
from rest_framework.documentation import include_docs_urls
urlpatterns = [
url(r'^docs/', include_docs_urls(title='Test Suite API')),
]
| kgeorgy/django-rest-framework | tests/urls.py | Python | bsd-2-clause | 268 |
from Source import Source
from Components.Element import cached
from enigma import eServiceReference, pNavigation
class StreamService(Source):
def __init__(self, navcore):
Source.__init__(self)
self.ref = None
self.__service = None
self.navcore = navcore
def serviceEvent(self, event):
pass
@cached
def ... | openhdf/enigma2-wetek | lib/python/Components/Sources/StreamService.py | Python | gpl-2.0 | 1,425 |
import unittest
import testing_helper
import math
from softsailor.utils import *
class TestUtils(unittest.TestCase):
def testDegToRad(self):
self.assertEqual(math.pi, deg_to_rad(180))
degs =[90, -90]
rads = deg_to_rad(degs)
self.assertAlmostEqual(math.pi / 2, rads[0])
self.... | jrversteegh/softsailor | softsailor/tst/test_utils.py | Python | gpl-3.0 | 992 |
hiddenimports = ['BTrees.OOBTree', 'BTrees.fsBTree',
'pkg_resources']
# 'pkg_resources', 'pywintypes',
# 'simo', 'jsonlib2', 'celeryconfig']
| cropleyb/pentai | packaging/osx/hook-ZODB.py | Python | mit | 193 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-24 15:46
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('l8pr', '0013_auto_20160613_1552'),
]
operations = [
migrations.AlterModelOptions(
... | L8pR/L8pR | app/l8pr/migrations/0014_auto_20160624_1546.py | Python | lgpl-3.0 | 420 |
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QSplitter, QVBoxLayout, QGroupBox, QPushButton, QLineEdit, QTabWidget, QLabel, QComboBox, QFormLayout
from PyQt5.QtCore import pyqtSlot, Qt
from TableGUI import TableData
from PlotGraph import Plot_Graph
from GraphPlot import GraphPlot
from ToolsWidgets import *
from ... | Jaimedgp/J_Graphics_P | src/MainLayout.py | Python | gpl-3.0 | 8,216 |
import pygame, spritesheet
class CharSprite(pygame.sprite.Sprite):
# CONSTANTS
# TODO: Should these be alterable?
GRAVITY = 2
MAX_DOWN_SPEED = 100
RUN_SPEED = 10
JUMP_FORCE = -20
def __init__(self, image_loc, position):
pygame.sprite.Sprite.__init__(self)
self.sprites = spr... | Sanjurjo7/metroidVaniaJones | character.py | Python | mit | 3,230 |
import pytest
from v8py import Context, Script, JSException
def test_script():
c1 = Context()
c1.kappa = 'pride'
c2 = Context()
s = Script('kappa')
assert c1.eval(s) == 'pride'
with pytest.raises(JSException):
c2.eval(s)
def test_identical_scripts():
assert Script('kappa') is Scrip... | tbodt/v8py | tests/test_script.py | Python | lgpl-3.0 | 427 |
# Django settings for webvirtmgr project.
import os
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(os.path.dirname(__file__), '..', 'webvirt... | selboo/starl-mangle | webvirtmgr/webvirtmgr/settings.py | Python | apache-2.0 | 5,044 |
from __future__ import absolute_import
from django.contrib import admin
from .models import TaxRate
class TaxRateAdmin(admin.ModelAdmin):
list_display = ('id', 'country', 'state', 'zip_code', 'rate', 'updated_at')
admin.site.register(TaxRate, TaxRateAdmin)
| inabhi9/django-taxrates | taxrates/admin.py | Python | mit | 267 |
# 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 mozpack.packager.formats import (
FlatFormatter,
JarFormatter,
OmniJarFormatter,
)
from mozpack.package... | Yukarumya/Yukarum-Redfoxes | toolkit/mozapps/installer/packager.py | Python | mpl-2.0 | 15,683 |
# This file is part of CO𝘕CEPT, the cosmological 𝘕-body code in Python.
# Copyright © 2015–2022 Jeppe Mosgaard Dakin.
#
# CO𝘕CEPT 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 Lice... | jmd-dk/concept | src/interactions.py | Python | gpl-3.0 | 142,305 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/bin/2.78/scripts/addons/netrender/versioning.py | Python | gpl-3.0 | 4,317 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt4 (Qt v4.8.7)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x05\x5d\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x17\x00... | NuttamonW/Archaeological | ElectricalConductivity/resources_rc.py | Python | gpl-3.0 | 6,837 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists ... | nextview/medicticket | txomon/ticket/admin.py | Python | bsd-3-clause | 33,247 |
# Copyright (C) 2017 Martin Nilsson
# This file is part of the Memtran compiler.
#
# The Memtran compiler 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
# ... | LJMNilsson/memtran | src/tokens.py | Python | gpl-3.0 | 12,189 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('CORE', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='SavedCriteria',
fields=[
... | Lucterios2/core | lucterios/CORE/migrations/0002_savedcriteria.py | Python | gpl-3.0 | 904 |
from pylibftdi import USB_PID_LIST, SerialDevice
from ctypes import byref
USB_PID_LIST.append(0x6015)
BITMODE_CBUS = 0x20
dev = SerialDevice()
dev.baudrate = 46875
# programming voltage
dev.rts = 1
# reset
dev.ftdi_fn.ftdi_set_bitmode(0x40, BITMODE_CBUS)
dev.close() | Noah1989/pyl08 | pyl08.py | Python | mit | 273 |
# Copyright (c) 2011 Tencent Inc.
# All rights reserved.
#
# Author: Michaelpeng <michaelpeng@tencent.com>
# Date: October 20, 2011
"""
This is the test module for java_jar target.
"""
import blade_test
class TestJavaJar(blade_test.TargetTest):
"""Test java_jar """
def setUp(self):
"""setup me... | Lunewcome/typhoon-blade | src/test/java_jar_test.py | Python | bsd-3-clause | 5,167 |
"""
Copyright (C) 2014, Jaguar Land Rover
This program is licensed under the terms and conditions of the
Mozilla Public License, version 2.0. The full text of the
Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
Maintainer: Rudolf Streif (rstreif@jaguarlandrover.com)
"""
from .base import *
| dvthiriez/rvi_backend | config/settings/local.py | Python | mpl-2.0 | 310 |
#
# Copyright (C) 2011 EADS France, Fabrice Desclaux <fabrice.desclaux@eads.net>
#
# 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 late... | stephengroat/miasm | miasm2/expression/expression.py | Python | gpl-2.0 | 45,069 |
#
# Copyright 2009-2017 Red Hat, 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 ... | nirs/vdsm | lib/vdsm/storage/dispatcher.py | Python | gpl-2.0 | 4,009 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
default_app_config = 'kong_admin.apps.KongAdminConfig'
__version__ = '0.3.7'
| athento/django-kong-admin | kong_admin/__init__.py | Python | bsd-3-clause | 158 |
from net.wyun.mer.ink import scginkparser
import numpy as np
from net.wyun.mer.ink.stroke import Stroke
from net.wyun.mer.ink.stroke import get_bounding_box
from net.wyun.mer.ink.stroke import get_bounding_box_h1000
from net.wyun.mer.ink.sample import Sample
from scipy import misc
# Import `load_workbook` module from ... | michaelyin/im2markup-prep | net/wyun/mer/prep/xlsxhandler.py | Python | apache-2.0 | 2,067 |
# coding: utf-8
from pyDes import *
import base64
import hashlib
import binascii
from model import itsettings
reload(sys)
sys.setdefaultencoding('utf-8')
class MobileManage:
"""Mobile Http Client"""
def __init__(self):
pass
def encrpyt(self, key, data):
if len(key) != 8:
pri... | longmazhanfeng/interface_web | interface_platform/mobile_manage.py | Python | mit | 5,314 |
#!/usr/bin/env python
#
# $LicenseInfo:firstyear=2010&license=mit$
#
# Copyright (c) 2010, Linden Research, Inc.
#
# 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, includi... | lexelby/apiary | apiary/main.py | Python | mit | 2,842 |
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2013 Keita Kita
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights... | mikanbako/mount-raspberry-pi-image-rootfs | main/mount_raspberry_pi_image_rootfs.py | Python | mit | 5,391 |
balance=4842
annualInterestRate=.2
monthlyPaymentRate=.04
totalPaid=0.0
for month in range(1,13):
print 'Month: '+str(month)
minimumMonthlyPayment=round(balance*monthlyPaymentRate,2)
remainingBalance=balance-minimumMonthlyPayment
interest=round(annualInterestRate/12*remainingBalance,2)
b... | arielisidro/myprograms | python/6.00.1x Files/W02P0201.py | Python | gpl-2.0 | 595 |
# -*- extra stuff goes here -*-
def initialize(context):
"""Initializer called when used as a Zope 2 product."""
| UPCnet/transparencia.theme | transparencia/theme/__init__.py | Python | gpl-3.0 | 119 |
# PSTH experiments
#
# Copyright (C) 2010-2012 Huang Xin
#
# See LICENSE.TXT that came with this file.
from __future__ import division
import os
import sys
import time
import Pyro.core
import subprocess
from Experiment import ExperimentConfig,Experiment
class PSTHExperiment(Experiment):
PSTH_SERVER_PROCESS = None... | chrox/RealTimeElectrophy | Experimenter/Experiments/PSTHExperiment.py | Python | bsd-2-clause | 13,693 |
# Copyright 2014 IBM Corp.
#
# 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 t... | alex8866/cinder | cinder/tests/test_replication.py | Python | apache-2.0 | 4,970 |
# Authors:
# Jason Gerard DeRose <jderose@redhat.com>
#
# Copyright (C) 2008 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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, ei... | realsobek/freeipa | ipatests/test_ipalib/test_errors.py | Python | gpl-3.0 | 12,911 |
from django.db import models
class ApplicationActiveManager(models.Manager):
def get_query_set(self):
return (super(ApplicationActiveManager, self).get_query_set()
.filter(~models.Q(status=self.model.REMOVED)))
class ApplicationPublishedManager(models.Manager):
def get_query_set(se... | us-ignite/us_ignite | us_ignite/apps/managers.py | Python | bsd-3-clause | 1,843 |
#!/usr/bin/python2.4
#
# Copyright 2008 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... | Acidburn0zzz/graphy | examples/traffic.py | Python | apache-2.0 | 1,252 |
# encoding: utf-8
import datetime
__all__ = [
'info',
]
def info():
return {
'birthday': datetime.date(1995, 12, 3),
'class': 10,
'family_name_en': u'iriyama',
'family_name_kana': u'いりやま',
'first_name_en': u'anna',
'first_name_kana': ... | moriyoshi/pyakb48 | akb48/member/iriyama_anna.py | Python | mit | 650 |
# 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... | KaranToor/MA450 | google-cloud-sdk/lib/surface/logging/__init__.py | Python | apache-2.0 | 1,634 |
"""The test for the sql sensor platform."""
import unittest
import pytest
import voluptuous as vol
from homeassistant.components.sensor.sql import validate_sql_select
from homeassistant.setup import setup_component
from homeassistant.const import STATE_UNKNOWN
from tests.common import get_test_home_assistant
class ... | persandstrom/home-assistant | tests/components/sensor/test_sql.py | Python | apache-2.0 | 1,910 |
try:
from . import generic as g
except BaseException:
import generic as g
class RegistrationTest(g.unittest.TestCase):
def test_procrustes(self):
# create random points in space
points_a = (g.np.random.random((1000, 3)) - .5) * 1000
# create a random transform
matrix = g.t... | dajusc/trimesh | tests/test_registration.py | Python | mit | 3,980 |
# Given a set of distinct integers, nums, return all possible subsets.
# Note: The solution set must not contain duplicate subsets.
# For example,
# If nums = [1,2,3], a solution is:
# [
# [3],
# [1],
# [2],
# [1,2,3],
# [1,3],
# [2,3],
# [1,2],
# []
# ]
# O(2**n)
def subsets(nums):
res = []
backtrack(re... | marcosfede/algorithms | backtrack/subsets.py | Python | gpl-3.0 | 1,049 |
import random
def jogo(max_=1000):
numero = random.randint(0, max_)
print("Escolhi um número entre 0 e {}, tente adivinhar:".format(max_))
tentativas = 1
while True:
chute = input("Palpite: ")
chute = int(chute)
if chute == numero:
print("Parabéns, você acertou em ... | lhc/lhcpython | adivinha.py | Python | mit | 692 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: RSLP Stemmer
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Tiago Tresoldi <tresoldi@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
# This code is based on the algorithm presented in the paper "A Stemming
# Algorithm fo... | adazey/Muzez | libs/nltk/stem/rslp.py | Python | gpl-3.0 | 5,602 |
import numpy as np
import pandas.util.testing as tm
from pandas import (DataFrame, Series, DatetimeIndex, MultiIndex, Index,
date_range)
from .pandas_vb_common import setup, lib # noqa
class Reindex(object):
goal_time = 0.2
def setup(self):
rng = DatetimeIndex(start='1/1/1970', ... | zfrenchee/pandas | asv_bench/benchmarks/reindex.py | Python | bsd-3-clause | 5,590 |
import json
import sys
keys = ['id_beneficiaire', 'beneficiaire', 'descriptif', 'adresse', 'programme_budgetaire', 'id_acteur', 'civilite', 'nom', 'prenom', 'departement', 'groupe']
for key in keys:
sys.stdout.write(key+";");
print("")
for arg in sys.argv[1:]:
myfile = open(arg)
data = json.load(myfile)
for... | regardscitoyens/reserveparlementaire_parser | bin/json2csv.py | Python | gpl-3.0 | 563 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import logg... | mdhaman/superdesk-aap | server/aap/subscriber_transmit_references/resource.py | Python | agpl-3.0 | 1,044 |
class Pdb:
def __init__(self, file_name):
self.file_name = file_name
self.atoms = []
self.read_pdb_file(self.file_name)
def read_pdb_file(self, file_name):
with open(self.file_name, 'r') as f:
for line in f:
line = line.split()
if 'ATO... | Gimba/Occupancy | pdb.py | Python | gpl-3.0 | 2,535 |
import unittest
from unittest.mock import patch
from Javatar.core.dependency_manager import _DependencyManager
class TestDependencyManager(unittest.TestCase):
@patch("os.path.exists", return_value=True)
@patch(
"Javatar.core.settings._Settings.get_global",
return_value=["Alpha/Bravo/"]
)
... | spywhere/Javatar | tests/core/test_dependency_manager.py | Python | mit | 781 |
from __future__ import unicode_literals
import unittest
from .models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths
class MaxLengthArgumentsTests(unittest.TestCase):
def verify_max_length(self, model, field, length):
self.assertEqual(model._meta.get_field(field).max_length, length)
... | diegoguimaraes/django | tests/max_lengths/tests.py | Python | bsd-3-clause | 1,589 |
# 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... | gunan/tensorflow | tensorflow/python/keras/layers/recurrent_v2_test.py | Python | apache-2.0 | 4,779 |
import json
from typing import Union, List, Dict, Any
import torch
from torch.autograd import Variable
from torch.nn.modules import Dropout
import numpy
import h5py
from overrides import overrides
from allennlp.common.file_utils import cached_path
from allennlp.common.checks import ConfigurationError
from allennlp.c... | nafitzgerald/allennlp | allennlp/modules/elmo.py | Python | apache-2.0 | 18,830 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.