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 |
|---|---|---|---|---|---|
../../../../../share/pyshared/twisted/test/test_stdio.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/twisted/test/test_stdio.py | Python | gpl-3.0 | 56 |
# Copyright 2014-2016 The Meson development team
# 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 agree... | becm/meson | mesonbuild/mintro.py | Python | apache-2.0 | 23,827 |
from django.core.exceptions import ImproperlyConfigured
from django.forms import ModelForm
from django.forms.models import model_to_dict
class Validation(object):
"""
A basic validation stub that does no validation.
"""
def __init__(self, **kwargs):
pass
def is_valid(self, bundle, request... | glencoates/django-tastypie | tastypie/validation.py | Python | bsd-3-clause | 3,641 |
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | tests/distance/test_distance_forbes_ii.py | Python | gpl-3.0 | 6,521 |
from arXivExtracter.createDictIDs import extractIds
from xml.dom import minidom
import unittest
xml = """<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www... | rago1/arXiv-text-extracter | test_createDictIDs.py | Python | gpl-3.0 | 4,886 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | mcldev/geonode | geonode/geoserver/helpers.py | Python | gpl-3.0 | 80,453 |
#!/usr/bin/env python
from setuptools import setup
# if __name__ == "__main__":
# setup(install_requires=INSTALL_REQUIRES)
setup()
| jchowk/pyND | setup.py | Python | gpl-3.0 | 135 |
#!/usr/bin/env python3
from diem.cli import DiemCLI
if __name__ == '__main__':
DiemCLI().run()
| chwnam/lifemotif-diem | run.py | Python | lgpl-2.1 | 100 |
from itertools import chain
from sqlalchemy import case, func, text, BigInteger, Boolean, Column, DateTime, Float, Integer, String, Table
from sqlalchemy.dialects.postgresql import ARRAY, INT8RANGE
from sqlalchemy.sql.expression import and_, or_, between, join, label
from geoalchemy2 import Geometry
from geoalchemy2.fu... | mchelen/piecewise | piecewise/piecewise/aggregate.py | Python | gpl-3.0 | 23,566 |
"""Tests for plugin.py."""
import ckanext.cdrc.plugin as plugin
def test_plugin():
pass | spacelis/ckan-ckanext-cdrc | ckanext/cdrc/tests/test_plugin.py | Python | agpl-3.0 | 92 |
import pytest
pytest.importorskip('numpy')
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
import dask.array as da
from dask.array.overlap import (fractional_slice, getitem, trim_internal,
overlap_internal, nearest, constant,
... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/dask/array/tests/test_overlap.py | Python | gpl-3.0 | 14,013 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... | luogangyi/bcec-nova | nova/virt/libvirt/driver.py | Python | apache-2.0 | 229,211 |
# -*- coding: utf-8 -*-
"""
Unit tests for character position finding module.
"""
# Copyright (c) 2017 Ben Zimmer. All rights reserved.
import unittest
from handwriting import findletters
class TestsFindLetters(unittest.TestCase):
"""Unit tets for character position finding module."""
def test_jaccard_... | bdzimmer/handwriting | handwriting/tests_findletters.py | Python | bsd-3-clause | 1,024 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class ReservationTestCase(Integ... | tysonholub/twilio-python | tests/integration/taskrouter/v1/workspace/worker/test_reservation.py | Python | mit | 9,315 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistrib... | chippey/gaffer | python/GafferUI/Divider.py | Python | bsd-3-clause | 2,580 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Adapted From Http://stackoverflow.com/questions/1466827/ --
from django.conf import settings
from django.db.models import signals
from django.contrib.sites.models import Site
from django.contrib.sites import models as site_app
from django.contrib.sites.management import ... | shaunsephton/django-snippetscream | snippetscream/_2536.py | Python | bsd-3-clause | 1,445 |
from models import *
def save_data():
with open('backup.csv', 'w') as f: # Open file 'backup.csv' for writing
for dessert in Dessert.query.all():
# Create a comma separated line
line = "{},{},{}\n".format(dessert.name, dessert.price,
de... | wpapper/Glasnost | web/backup.py | Python | mit | 689 |
from flask_wtf import FlaskForm
from . import app
from wtforms import StringField, PasswordField, SelectField, DateField, IntegerField
from wtforms.validators import DataRequired, Length, Email, EqualTo, Optional, NumberRange
from wtfrecaptcha.fields import RecaptchaField
from flask_wtf.file import FileField, FileAllow... | lfasmpao/safecore-api | dashboard/forms.py | Python | agpl-3.0 | 4,140 |
#!/usr/bin/env python
import sys
if sys.version_info <= (3, 2):
sys.stderr.write("Sonata requires Python 3.2+\n")
sys.exit(1)
from distutils.dep_util import newer
import glob
import os
from setuptools import setup, Extension
from sonata.version import version
def capture(cmd):
return os.popen(cmd).read(... | multani/my-sonata | setup.py | Python | gpl-3.0 | 2,503 |
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, connections
class Command(BaseCommand):
help = ("Runs the command-line client for specified database, or the "
"default database if none is provided.")
requires_system_checks = False
... | yephper/django | django/core/management/commands/dbshell.py | Python | bsd-3-clause | 1,214 |
#!/usr/bin/env python2
#
# Licensed to the Apache Software Foundation (ASF) 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
# ... | andrwng/kudu | build-support/run_dist_test.py | Python | apache-2.0 | 5,863 |
# Copyright 2015 CERN. This software is distributed under the
# terms of the GNU General Public Licence version 3 (GPL Version 3),
# copied verbatim in the file LICENCE.md.
# In applying this licence, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental O... | kiliakis/BLonD | beams/slices.py | Python | gpl-3.0 | 17,920 |
# -*- coding: utf-8 -*-
# Copyright 2019 El Nogal - Pedro Gómez <pegomez@elnogal.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import purchase
| Comunitea/CMNT_00040_2016_ELN_addons | eln_purchase/models/__init__.py | Python | agpl-3.0 | 168 |
"""Tests for tasks.py."""
import contextlib
import functools
import io
import os
import re
import sys
import types
import unittest
import weakref
from unittest import mock
import asyncio
from asyncio import coroutines
from asyncio import test_utils
try:
from test import support
except ImportError:
from asynci... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_asyncio/test_tasks.py | Python | gpl-3.0 | 71,817 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the shutdown Windows Registry event formatter."""
import unittest
from plaso.formatters import shutdown
from tests.formatters import test_lib
class ShutdownWindowsRegistryEventFormatterTest(
test_lib.EventFormatterTestCase):
"""Tests for the shutdown Win... | dc3-plaso/plaso | tests/formatters/shutdown.py | Python | apache-2.0 | 974 |
import numpy as np
import pybullet
from mushroom_rl.utils.viewer import ImageViewer
class PyBulletViewer(ImageViewer):
def __init__(self, client, dt, size=(500, 500), distance=4, origin=(0, 0, 1), angles=(0, -45, 60),
fov=60, aspect=1, near_val=0.01, far_val=100):
self._client = client
... | carloderamo/mushroom | mushroom_rl/utils/pybullet/viewer.py | Python | mit | 2,030 |
import collections
def flatten(l):
for e in l:
if isinstance(e, collections.Iterable) and not isinstance(e, basestring):
for ee in flatten(e):
yield ee
else:
yield e
def flatten_parameters_to_string(l):
return ",".join(map(str, flatten(l))... | craigem/MyAdventures | mcpi/util.py | Python | gpl-3.0 | 323 |
# -*- coding:utf-8 -*-
import requests
from rdflib import BNode, URIRef
from rdflib.graph import ConjunctiveGraph
from rdflib.plugins.stores.sparqlstore import _node_to_sparql
from uuid import uuid4
from whyis.datastore import create_id
# SPARQL_NS = Namespace('http://www.w3.org/2005/sparql-results#')
from .whyis_... | tetherless-world/graphene | whyis/database/database_utils.py | Python | apache-2.0 | 3,563 |
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
"""
Hold command line arguments for use in other modules
"""
from ... | mattclay/ansible | lib/ansible/utils/context_objects.py | Python | gpl-3.0 | 3,119 |
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import sys
sys.path.append("../glapi_parser")
import apiutil
keys = apiutil.GetDispatchedFunctions("../glapi_parser/APIspec.txt")
apiutil.CopyrightC()
print """
/* DO NOT ... | alown/chromium | opengl_stub/NULLfuncs.py | Python | bsd-3-clause | 1,510 |
# -*- coding: utf-8 -*-
from __future__ import division
# Copyright (C) 2012 Matthew Hampton
#
# 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 ... | imoore76/SpiffWorkflow | SpiffWorkflow/bpmn/BpmnScriptEngine.py | Python | lgpl-3.0 | 1,911 |
loadgame
| detorr/project-crystal | crystal/classes/loadgame.py | Python | gpl-3.0 | 9 |
import amo
from addons.models import Addon, CompatOverride, CompatOverrideRange
def run():
addons = (Addon.objects
.filter(type=amo.ADDON_EXTENSION, appsupport__app=amo.FIREFOX.id,
_current_version__files__jetpack_version__isnull=False)
.exclude(_current_version__files__jetpack_vers... | wagnerand/zamboni | migrations/626-override-outdated-jetpack-compat.py | Python | bsd-3-clause | 1,165 |
# Copyright 1999-2000 by Jeffrey Chang. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
# Patches by Mike Poidinger to support multiple databases.
# Updated by Peter Cock in 2007... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/Bio/Blast/NCBIStandalone.py | Python | apache-2.0 | 74,333 |
"""Remove rule_description from RuleSql table
Revision ID: d10d998b796b
Revises: 5f1470603fa0
Create Date: 2018-03-20 13:46:14.180715
"""
# revision identifiers, used by Alembic.
revision = 'd10d998b796b'
down_revision = '5f1470603fa0'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy ... | fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/d10d998b796b_remove_rule_description_from_rulesql_.py | Python | cc0-1.0 | 914 |
import json
import os
import random
import time
from contextlib import contextmanager
from datetime import datetime, timedelta
from decimal import Decimal
from functools import partial
from urlparse import SplitResult, urlsplit, urlunsplit
from django import forms, test
from django.db import connections, transaction, ... | elysium001/zamboni | mkt/site/tests/__init__.py | Python | bsd-3-clause | 34,507 |
# Copyright (C) 2013-2015 Valery Yundin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distribut... | tjanez/obnam | obnamlib/plugins/fuse_plugin.py | Python | gpl-3.0 | 22,088 |
# Copyright 2019 Scalyr 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, so... | imron/scalyr-agent-2 | tests/unit/builtin_monitors/mysql_monitor_test.py | Python | apache-2.0 | 2,104 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import pythonmid.apps.events.models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('event... | PythonMid/pymidweb | pythonmid/apps/events/migrations/0007_auto_20150624_2211.py | Python | gpl-2.0 | 5,226 |
# ***************************************************************************
# * Copyright (c) 2020 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... | sanguinariojoe/FreeCAD | src/Mod/Draft/draftguitools/gui_pathtwistedarray.py | Python | lgpl-2.1 | 5,753 |
"""
This test file tests the lib.resolvers.py
The lib.resolvers.py only depends on the database model.
"""
import json
from .base import MyTestCase
from privacyidea.lib.resolver import (save_resolver,
delete_resolver)
from privacyidea.lib.realm import (set_realm,
... | privacyidea/privacyidea | tests/test_lib_realm.py | Python | agpl-3.0 | 3,625 |
#! /usr/bin/python
#Copyright 2010, Meka Robotics
#All rights reserved.
#http://mekabot.com
#Redistribution and use in source and binary forms, with or without
#modification, are permitted.
#THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDIN... | CentralLabFacilities/m3meka | python/scripts/tools/m3qa_ut_h2r2_stretcher.py | Python | mit | 2,276 |
#!/usr/bin/python2
#coding:utf-8
import os
import sys
MEDIA_FILES = '.mp3'
LRC_FILES = '.lrc'
#得到一个目录所有的mp3文件
def getMediaFiles(mediaDir=os.getcwd()):
mediaFiles = []
if os.path.isdir(mediaDir):
for root,dirs,files in os.walk(mediaDir): #用os.walk函数遍历目录
for media in files:
... | chenlingyun/clympg | FileUtils.py | Python | gpl-3.0 | 1,296 |
#!/usr/bin/python
import csv
def csv_to_list(filename="app/static/data/vpr-lyme-disease-new-england.csv"):
"""Converts a very specific CSV file into a Python dictionary,
nor for general use"""
dont_include = ['State', 'Northern New England', 'New England']
with open(filename, mode='rU') as infile:
... | vprnet/lyme-disease | app/query.py | Python | apache-2.0 | 501 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import os
import os.path
import sys
import ast
import imp
# Functions & classes =========================================================
def filter_priv... | edeposit/uml_templater | src/uml_templater/inspector.py | Python | mit | 4,010 |
# Copyright 2015 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | smartbgp/yabgp | yabgp/__init__.py | Python | apache-2.0 | 730 |
#
# Copyright (c) SAS Institute 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 w... | sassoftware/amiconfig | amiconfig/plugins/hostname.py | Python | apache-2.0 | 1,083 |
import logging
class Rule:
'''
Class describing how to process dictinary item
'''
def __init__(self, condition, action):
self.condition = condition
self.action = action
self._last_result = False
def check(self, hero_state):
try:
result = self.condition(... | aserebryakov/godville-monitor-console | monitor/status_processing/rule.py | Python | gpl-2.0 | 934 |
# proxy module
from __future__ import absolute_import
from blockcanvas.numerical_modeling.units._port_.unit_corrector_adapter import *
| enthought/etsproxy | enthought/numerical_modeling/units/_port_/unit_corrector_adapter.py | Python | bsd-3-clause | 135 |
'''
ThunderGate - an open source toolkit for PCI bus exploration
Copyright (C) 2015-2016 Saul St. John
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the Lice... | sstjohn/thundergate | py/image.py | Python | gpl-3.0 | 14,346 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-11 23:33
from __future__ import unicode_literals
from django.db import migrations
def load_data(apps, schema_editor):
SightingFAQ = apps.get_model("api", "SightingFAQ")
SightingFAQ(title="¿Qué es la avispa asiática?",
body="""La avispa a... | CarlosTenorio/vespapp-web | api/migrations/0005_signthing_faq_initial_data.py | Python | gpl-3.0 | 3,424 |
# -*- coding: utf-8 -*-
import pytest
@pytest.fixture
def bar():
return 'bar'
def test_foo(bar):
assert 'foobar' == 'foo' + bar
| synnick/roboronya | tests/test_roboronya.py | Python | mit | 140 |
"""
kombu.transport.amqplib
=======================
amqplib transport.
"""
from __future__ import absolute_import
import errno
import socket
try:
from ssl import SSLError
except ImportError:
class SSLError(Exception): # noqa
pass
from struct import unpack
from amqplib import client_0_8 as amqp
fro... | alex/kombu | kombu/transport/amqplib.py | Python | bsd-3-clause | 12,820 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-02-07 17:05:11
import itertools
import json
import logging
import os
import time
from collections import deque
from six import iteritems, itervalues... | nicozhang/pyspider | pyspider/scheduler/scheduler.py | Python | apache-2.0 | 46,109 |
# -*- coding: ISO-8859-1 -*-
"""Resource sleeping_svg (from file sleeping.svg)"""
# written by resourcepackage: (1, 0, 1)
source = 'sleeping.svg'
package = 'olpcgames.data'
data = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\012<!-- \
Created with Inkscape (http://www.inkscape.org/) -->\012<svg\012 \
... | gmccreight/geoquiz | olpcgames/data/sleeping_svg.py | Python | gpl-3.0 | 31,334 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('latest_tweets', '0002_retweeted'),
]
operations = [
migrations.AddField(
model_name='tweet',
name='i... | blancltd/django-latest-tweets | latest_tweets/migrations/0003_tweet_is_reply.py | Python | bsd-3-clause | 451 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2004-2012 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | diogocs1/comps | web/openerp/addons/base/module/wizard/base_export_language.py | Python | apache-2.0 | 3,642 |
# Copyright 2018 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... | cshallue/models | research/object_detection/metrics/oid_od_challenge_evaluation_utils.py | Python | apache-2.0 | 4,148 |
# -*- coding: utf-8 -*-
__doc__ = """Create DWG link and orient it to Shared Site Point. As if this DWG had shared coordinates.
Useful for placing General Plan dwg files with absolute coordinates.
Shift+Click - enable/disable rotation manually
Создает DWG связь и размещает ее в Точке Съемки проекта. Как если бы dwg им... | apex-project/pyApex | pyApex.tab/Misc.panel/utils3.stack/LinkDWGsite.pushbutton/script.py | Python | gpl-3.0 | 4,911 |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# 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,... | kiniou/qtile | libqtile/layout/max.py | Python | mit | 4,054 |
"""
Accelerated Failure Time (AFT) Model with empirical likelihood inference.
AFT regression analysis is applicable when the researcher has access
to a randomly right censored dependent variable, a matrix of exogenous
variables and an indicatior variable (delta) that takes a value of 0 if the
observation is censored ... | hlin117/statsmodels | statsmodels/emplike/aft_el.py | Python | bsd-3-clause | 18,095 |
# -*- coding: utf-8 -*-
"""
pygments.lexers._phpbuiltins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This file loads the function names and their modules from the
php webpage and generates itself.
Do not alter the MODULES dict by hand!
WARNING: the generation transfers quite much data over your
... | markandrewj/pygments | pygments/lexers/_phpbuiltins.py | Python | bsd-2-clause | 122,045 |
# coding: utf-8
# ###########################################################################
#
# Author: Luis Felipe Mileo
# Fernando Marcato Rodrigues
# Daniel Sadamo Hirayama
# Copyright 2015 KMEE - www.kmee.com.br
#
# This program is free software: you can redistribute it and/or modif... | ATSTI/administra | open_myplace/l10n_br_account_payment_boleto_registered/wizard/__init__.py | Python | gpl-2.0 | 1,132 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Region.settlement_code'
db.delete_column('region', 'set... | SeedScientific/polio | datapoints/migrations/0020_auto__del_field_region_settlement_code__add_unique_region_region_code.py | Python | agpl-3.0 | 16,318 |
import random
import sys
import time
from enum import Enum
from shutil import rmtree
from tempfile import mkdtemp
class TemporaryDirectory(object):
def __init__(self, *args, **kwargs):
self.directory = mkdtemp(*args, **kwargs)
def __enter__(self):
return self.directory
def __exit__(self, *args):
r... | sigopt/sigopt-python | sigopt/orchestrate/common.py | Python | mit | 1,123 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2017 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | theochem/horton | horton/utils.py | Python | gpl-3.0 | 5,446 |
from twitter.checkstyle.common import Nit, PythonFile
from twitter.checkstyle.plugins.except_statements import ExceptStatements
EXCEPT_TEMPLATE = """
try: # 001
1 / 0
%s
pass
"""
def nits_from(clause):
return list(ExceptStatements(PythonFile.from_statement(EXCEPT_TEMPLATE % clause)).nits())
... | abel-von/commons | tests/python/twitter/checkstyle/plugins/test_except_statements.py | Python | apache-2.0 | 1,054 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-02-22 23:20:39
from app import app
from flask import abort, render_template, request, json
index_fields = ['name', 'group', 'status', 'comments', 'r... | 1900/pyspider | webui/index.py | Python | apache-2.0 | 2,128 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | mfherbst/spack | var/spack/repos/builtin/packages/uncrustify/package.py | Python | lgpl-2.1 | 2,061 |
"""
MtGoxHMAC v0.01
Copyright 2011 Brian Monkaba
This file is part of ga-bitbot.
ga-bitbot 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... | enikesha/ga-bitbot | MtGoxHMAC.py | Python | gpl-3.0 | 11,252 |
# -*- coding: utf-8 -*-
# This file is part of Cockpit.
#
# Copyright (C) 2016 Red Hat, Inc.
#
# Cockpit 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... | larsu/cockpit | test/verify/kubelib.py | Python | lgpl-2.1 | 39,245 |
"""
Configuration items for the shop.
Also contains shopping cart and related classes.
"""
import datetime
import logging
import operator
import notification
import signals
try:
from decimal import Decimal
except:
from django.utils._decimal import Decimal
from django.conf import settings
from django.contrib.s... | roadhead/satchmo | satchmo/shop/models.py | Python | bsd-3-clause | 44,646 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2010 OpenStack LLC.
#
# 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
#
# htt... | fajoy/nova | nova/virt/xenapi/driver.py | Python | apache-2.0 | 32,441 |
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | i5o/openshot-sugar | openshot/windows/TransitionProperties.py | Python | gpl-3.0 | 7,648 |
#!/usr/bin/env python
#-*- coding: ascii -*-
# call 'winegcc' directly in XCode build script may fail, since '/usr/local/bin' is not added to PATH when running.
import sys, subprocess, os
input = sys.argv[1]
output = sys.argv[2]
my_env = os.environ.copy()
my_env["PATH"] = "/usr/local/bin:opt/local/sbin:/us... | zhangf911/KlayGE | KlayGE/Tools/src/D3DCompilerWrapper/D3DCompilerWrapper.py | Python | gpl-2.0 | 509 |
"""
Simple subclasses of basic Qt input widgets that can be manipulated through a
single property.
"""
from PyQt4.QtGui import (QLineEdit, QSpinBox, QDoubleSpinBox, QCheckBox,
QComboBox)
class ValueLineEdit(QLineEdit):
@property
def value(self):
return self.text()
@value.setter
def ... | flupke/pyflu | pyflu/qt/duck_widgets.py | Python | bsd-3-clause | 1,475 |
# -*- coding: utf-8 -*-
"""High level integration / functional tests for the notifications."""
import logging
logger = logging.getLogger(__name__)
import json
import fysom
import transaction
import mock
import pyramid_basemodel as bm
from pyramid import config as pyramid_config
from pyramid_torque_engine import c... | thruflo/pyramid_torque_engine | src/pyramid_torque_engine/tests/ftests/test_notifications.py | Python | unlicense | 2,731 |
#
# Copyright (c) 2014, Scott Silver Labs, LLC.
#
# 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... | scottsilverlabs/raspberrystem | rstem/button.py | Python | apache-2.0 | 8,061 |
import _plotly_utils.basevalidators
class BordercolorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="bordercolorsrc",
parent_name="choroplethmapbox.hoverlabel",
**kwargs
):
super(BordercolorsrcValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/choroplethmapbox/hoverlabel/_bordercolorsrc.py | Python | mit | 472 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is ... | andrejb/bitmask_client | src/leap/bitmask/gui/app.py | Python | gpl-3.0 | 2,393 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for action in orm.Action.objects.all():
i = 0
for actiondevice in orm.ActionDevice.objects.filter(actio... | socialdevices/manager | core/migrations/0008_create_parameter_positions.py | Python | bsd-3-clause | 11,171 |
#Problem link: https://www.hackerrank.com/challenges/py-if-else
#!/bin/python
import sys
N = int(input().strip())
if (N % 2 > 0):
print("Weird")
elif (N >= 2 and N <=5):
print("Not Weird")
elif (N >= 6 and N <=20):
print("Weird")
else:
print("Not Weird") | phillipemoreira/HackerRank | Python/Introduction/3_IfElse.py | Python | mit | 275 |
from google.appengine.ext import db
from handlers.blog import BlogHandler
from helpers import *
class EditPostHandler(BlogHandler):
def get(self, post_id):
key = db.Key.from_path('Post', int(post_id), parent=blog_key())
post = db.get(key)
if not post:
return self.redirect('/log... | mr-karan/Udacity-FullStack-ND004 | Project3/udacityblog-159515/handlers/editpost.py | Python | mit | 1,635 |
import sys
import os
path = os.path
import random
from random import randrange
random.seed(2)
import myhdl
from myhdl import *
from myhdl.conversion import verify
ACTIVE_LOW, INACTIVE_HIGH = bool(0), bool(1)
@block
def incRef(count, enable, clock, reset, n):
""" Incrementer with enable.
count -- output... | josyb/myhdl | myhdl/test/conversion/general/test_inc.py | Python | lgpl-2.1 | 4,026 |
from ._costs import *
| csxeba/ReSkiv | brainforge/costs/__init__.py | Python | gpl-3.0 | 22 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | iModels/ffci | github/Hook.py | Python | mit | 8,154 |
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.variable import cleanHost
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
from xml.dom import minidom
import traceback
log = CPLog(... | Akylas/CouchPotatoServer | couchpotato/core/notifications/plex/main.py | Python | gpl-3.0 | 2,168 |
#! /usr/bin/env python
# @copyright
# Computer Science Circles
# http://cscircles.cemc.uwaterloo.ca/17-is/#pybox5
# @author Billy Wilson Arante
# @created 1/19/2016 PHT
old_list = [1, 2, 3]
new_list = old_list[:] # Creates 'deep' copy
old_list.append(4) # Modifies original
print(old_list, new_list)
| arantebillywilson/python-snippets | py3/cs-circle/deep_copy.py | Python | mit | 303 |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from djanban.apps.base.decorators import member_required
from djanban.apps.dev_environment.models import NoiseMeasurement, Interruption
@member_required
def index(request):
member = request.user.member
interruptions... | diegojromerolopez/djanban | src/djanban/apps/dev_environment/views/index.py | Python | mit | 855 |
"""
chaining module
"""
import sys, copy
def hspSort(hsps):
hsps.sort(key=lambda h: (h.subjectId, h.strand(), h.sStart))
return hsps
def findAllChains(hsps):
if len(hsps)==0:
return None
elif len(hsps)==1:
return [hsps]
else:
hsps = hspSort(hsps)
chains = [[hsps[... | PapenfussLab/Mungo | mungo/chaining.py | Python | artistic-2.0 | 1,069 |
# Copyright 2015 NEC Corporation. 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 ... | sebrandon1/tempest | tempest/tests/lib/services/compute/test_snapshots_client.py | Python | apache-2.0 | 3,939 |
from ScopeFoundry.data_browser import DataBrowserView
import numpy as np
import h5py
import pyqtgraph as pg
class WinSpecRemoteReadoutView(DataBrowserView):
name = 'winspec_remote_readout_h5'
def setup(self):
self.ui = self.graph_layout = pg.GraphicsLayoutWidget()
self.plot = sel... | ScopeFoundry/FoundryDataBrowser | viewers/winspec_remote_readout_h5.py | Python | bsd-3-clause | 1,840 |
# Copyright (C) 2011 Andrea Francia Trivolzio(PV) Italy
import unittest
import StringIO
from trashcli.list_mount_points import _mount_points_from_df_output
class MountPointFromDirTest(unittest.TestCase):
def test_should_skip_the_first_line(self):
mount_points = _mount_points_from_df_output(StringIO.StringIO(
'... | sein-tao/trash-cli | unit_tests/test_list_mount_points.py | Python | gpl-2.0 | 1,613 |
import os
from instances import xlog
import yaml
from distutils.version import LooseVersion
current_path = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.abspath( os.path.join(current_path, os.pardir))
data_path = os.path.join(root_path, 'data')
config_path = os.path.join(data_path, 'launcher', 'conf... | Suwmlee/XX-Net | launcher/config.py | Python | bsd-2-clause | 2,432 |
#!/usr/bin/env python
config = {
"default_vcs": "tc-vcs",
"default_actions": [
'checkout-sources',
'build',
'build-symbols',
'prep-upload'
],
"upload": {
"default": {
"upload_dep_target_exclusions": []
}
},
"env": {
"GAIA_OPTIMI... | lissyx/build-mozharness | configs/b2g/taskcluster-phone-blobfree.py | Python | mpl-2.0 | 1,091 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('crowdsourcing', '0028_module_is_micro'),
]
operations = [
migrations.AddField(
model_name='taskworker',
... | saiphcita/crowdsource-platform | crowdsourcing/migrations/0029_taskworker_task_status.py | Python | mit | 509 |
#! /usr/bin/env python
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
from urllib2 import urlopen
from urllib import urlencode
from urlparse import urlparse, urljoin
import os.path
from numpy import *
from astrometry.... | olebole/astrometry.net | util/usnob_get_region.py | Python | bsd-3-clause | 3,987 |
#Crypto Tools
#Aaron Guillen
import re
nums = [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25]
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
alphabetU = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', '... | aaronguillen/just-for-fun | Crypto.py | Python | gpl-3.0 | 7,105 |
# Copyright 2014 Donald Stufft
#
# 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, so... | xavfernandez/packaging | tests/test_structures.py | Python | apache-2.0 | 1,952 |
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test product releases and product release set."""
__metaclass__ = type
from zope.component import getUtility
from lp.app.enums import InformationType
from lp.registry.errors ... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/registry/tests/test_productrelease.py | Python | agpl-3.0 | 4,388 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.