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 -*-
#
# 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 configuration values are present in this
# autogenerated file.
#
# ... | arthanson/django-splitdate | docs/conf.py | Python | bsd-3-clause | 8,173 |
# -*- coding: utf-8 -*-
#
# Python-Starter documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 13 16:29:44 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file... | intel-ctrlsys/actsys | docs/conf.py | Python | apache-2.0 | 4,819 |
'''
The root topic of all topics is different based on messaging protocol.
:copyright: Copyright since 2006 by Oliver Schoenborn, all rights reserved.
:license: BSD, see LICENSE.txt for details.
'''
import policies
def getRootTopicSpec():
'''If using "arg1" messaging protocol, then root topic has one arg;
... | TaskEvolution/Task-Coach-Evolution | taskcoach/taskcoachlib/thirdparty/pubsub/core/arg1/topicmgrimpl.py | Python | gpl-3.0 | 545 |
"""
Train low-data attn models on MUV. Test last fold only.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import tempfile
import numpy as np
import deepchem as dc
import tensorflow as tf
from datasets import load_muv_convmol
# Number of folds for spl... | bowenliu16/deepchem | examples/low_data/muv_attn_one_fold.py | Python | gpl-3.0 | 2,476 |
# encoding: utf-8
print("resultado del clásico".upper())
cadena = input("Indique el resultado en formato Barcelona Goles Madrid Goles: ")
espacios = cadena.count(" ")
if espacios != 3:
print("El formato escrito erróneo!")
else:
posBarc = cadena.find("Barcelona")
posMadr = cadena.find("Madrid")
... | davidam/python-examples | games/clasico.py | Python | gpl-3.0 | 601 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-03-07 18:59
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('control', '0018_setting_types'),
]
operatio... | adminq80/Interactive_estimation | game/control/migrations/0019_auto_20170307_1859.py | Python | mit | 757 |
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | firebase/grpc-SwiftPM | setup.py | Python | apache-2.0 | 15,931 |
from __future__ import absolute_import, unicode_literals
from collections import namedtuple
from datetime import date
from unittest import TestCase
from django_dynamic_fixture import G, N
from mock import Mock
import pytest
from ..models import (
Activity,
Assumption,
AverageTargetPercentMixin,
Budge... | daniell/kashana | django/website/logframe/tests/test_models.py | Python | agpl-3.0 | 16,136 |
#!/usr/bin/env python
import unittest
from you_get.extractors import *
class YouGetTests(unittest.TestCase):
def test_imgur(self):
imgur.download("http://imgur.com/WVLk5nD", info_only=True)
imgur.download("http://imgur.com/gallery/WVLk5nD", info_only=True)
def test_magisto(self):
ma... | zmwangx/you-get | tests/test.py | Python | mit | 932 |
# MIT License
#
# Copyright (c) 2015-2021 Iakiv Kramarenko
#
# 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, modif... | yashaka/selene | tests/acceptance/helpers/todomvc.py | Python | mit | 2,587 |
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^ready/(?P<referendum_pk>[0-9]+)/$',
make_referendum_ready,
name='make_referendum_ready'),
url(r'^referendum/mylist/$', MyListView.as_view(),
name='my_referendums'),
url(r'^add/$', add, name='add'),
url(... | Flowneee/django-e-referendum | project/referendums/urls.py | Python | mit | 599 |
"""create and manipulate C data types in Python"""
import os as _os, sys as _sys
__version__ = "1.1.0"
from _ctypes import Union, Structure, Array
from _ctypes import _Pointer
from _ctypes import CFuncPtr as _CFuncPtr
from _ctypes import __version__ as _ctypes_version
from _ctypes import RTLD_LOCAL, RTLD_GLOBAL
from... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/ctypes/__init__.py | Python | gpl-3.0 | 16,848 |
import theano
from theano.gradient import DisconnectedType
from theano.gof import Op, Apply, TopoOptimizer
from theano import tensor
import theano.sandbox.cuda as cuda
def get_diagonal_subtensor_view(x, i0, i1):
"""Helper function for DiagonalSubtensor and
IncDiagonalSubtensor
:note: it return a partial ... | nke001/attention-lvcsr | libs/Theano/theano/tensor/nnet/conv3d2d.py | Python | mit | 11,552 |
#!/usr/bin/env python
""" Extracts RES-Europe data to examine forecasting issues.
"""
import numpy as np
import pandas as pd
import networkx as nx
import os
from load_network import load_network
from scipy.stats import norm
__copyright__ = "Copyright 2016, Tue Vissing Jensen"
__credits__ = ["Tue Vissing Jensen"]
__l... | TueVJ/RE-Europe_SimpleEnsembles | correlation_extracter.py | Python | mit | 2,394 |
#pylint: disable=W0703,R0915,R0912,R0914,R0904,W0223,W0105
""" Base class for package download and manifest create operations """
import pylons
import os
import time
from agent.lib.errors import Errors, AgentException
from agent.lib.utils import calcProgress, rchown, rchmod, isHigherPrivilegeService, \
chmod, getu... | cronuspaas/cronusagent | agent/agent/lib/agent_thread/download_helper.py | Python | apache-2.0 | 10,100 |
from __future__ import print_function
import time
import os
import fcntl
import errno
class SimpleFlock:
"""Provides the simplest possible interface to flock-based file locking. Intended for use with the `with` syntax. It will create/truncate/delete the lock file as necessary."""
def __init__(self, path, timeou... | daaugusto/ppi | script/simpleflock.py | Python | gpl-3.0 | 1,695 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.forms import widgets
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _, get_language_from_request
from cms.plugin_pool import plugin_pool
from cms.models.pagemodel import Page
from cmsplugin_casca... | Julien-Blanc/djangocms-cascade | cmsplugin_cascade/bootstrap3/secondary_menu.py | Python | mit | 1,921 |
S = set()
S.add(5)
S.add(3)
S.add(1)
# Prints out the numbers 5, 3, 1 in no particular order
for element in S:
print "{} is in the set".format(element)
S.remove(3)
S.remove(5)
s.remove(1) | krrg/python-tutorial | snippets/22.py | Python | mit | 195 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Team. 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... | huggingface/pytorch-transformers | examples/tensorflow/text-classification/run_tf_glue.py | Python | apache-2.0 | 8,751 |
import neet
import sys
import os
'''#print sys.argv
myEetFile = neet.EETFile()
myEetFile.importFile(sys.argv[1])
#myEetFile.readExtract(sys.argv[1])
myVal = myEetFile.readValue([("value", "theme")])
#myVal = myEetFile.readValue((("list", "modules"), ("item", "E_Config_Module", "name" , "gadman")))
#myVal = myEetFil... | JeffHoogland/neet | test_neet.py | Python | bsd-3-clause | 674 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# Copyright 2015-2018 Daniel Schadt
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... | t-wissmann/qutebrowser | tests/unit/mainwindow/test_tabwidget.py | Python | gpl-3.0 | 6,491 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 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... | luzheqi1987/nova-annotation | nova/tests/unit/integrated/v3/test_admin_actions.py | Python | apache-2.0 | 1,929 |
#!/usr/bin/env python
import urllib
def download_file(URL, filename):
urllib.urlretrieve(URL, filename)
| yadudoc/cloud_kotta | task_executor_utils.py | Python | apache-2.0 | 110 |
# -*- coding: utf-8 -*-
# Part of the masterfile package: https://github.com/uwmadison-chm/masterfile
# Copyright (c) 2020 Board of Regents of the University of Wisconsin System
# Written by Nate Vack <njvack@wisc.edu> at the Center for Healthy Minds
# at the University of Wisconsin-Madison.
# Released under MIT licen... | njvack/masterfile | masterfile/dictionary.py | Python | mit | 4,865 |
#
# Copyright 2010-2012 Fabric Engine Inc. All rights reserved.
#
# test that setting slice count to 'None' gives exception
# and not a crash
import fabric, sys
F = fabric.createClient()
node = F.DG.createNode("foo")
try:
node.resize(None)
F.flush()
except Exception as e:
print "Caught exception:", e
node.eval... | ghostx2013/FabricEngine_Backup | Native/Test/Python/issue-73.py | Python | agpl-3.0 | 337 |
# -*- coding: utf-8 -*-
from itertools import chain
from olympia import amo
from olympia.addons.indexers import AddonIndexer
from olympia.addons.models import (
Addon, Preview, attach_tags, attach_translations)
from olympia.amo.models import SearchMixin
from olympia.amo.tests import (
ESTestCase, TestCase, col... | psiinon/addons-server | src/olympia/addons/tests/test_indexers.py | Python | bsd-3-clause | 22,617 |
#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
#"License"); you may not use thi... | ZhangXFeng/hadoop | src/hadoop-mapreduce1-project/src/contrib/hod/hodlib/Common/nodepoolutil.py | Python | apache-2.0 | 1,113 |
import asyncio
import six
from six.moves import urllib
from . import packet
from . import server
from . import asyncio_socket
class AsyncServer(server.Server):
"""An Engine.IO server for asyncio.
This class implements a fully compliant Engine.IO web server with support
for websocket and long-polling tr... | quoclieu/codebrew17-starving | env/lib/python3.5/site-packages/engineio/asyncio_server.py | Python | mit | 10,761 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import struct
from math import asin, atan, cos, exp, log, pi, sin, sqrt, tan
from colorama import init
from networkx.algorithms.clique import find_cliques
import networkx as nx
import numpy as np
from datetime import datetime as dt, timedelta
init()
TI... | DBa2016/PokemonGo-Bot | pokemongo_bot/cell_workers/utils.py | Python | mit | 7,321 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
'''
Copyright 2014-2015 Teppo Perä
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
Un... | justanr/py3traits | src/pytraits/core/singleton.py | Python | apache-2.0 | 2,036 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pps.demos.demo_decimal as demo_decimal
import pytest
from decimal import Decimal
import logging
logger = logging.getLogger(__name__)
@pytest.mark.usefixtures("initloggers")
def test_module(confborg):
try:
res = demo_decimal.demo()
... | GustavePate/perfect_python_script | pps/demos/tests/test_decimal.py | Python | mit | 457 |
# -*- coding: utf-8 -*-
import asyncio
import functools
from thriftpy2.thrift import args_to_kwargs
from thriftpy2.thrift import TApplicationException, TMessageType
class TAsyncClient:
def __init__(self, service, iprot, oprot=None):
self._service = service
self._iprot = self._oprot = iprot
... | kawamon/hue | desktop/core/ext-py/thriftpy2-0.4.12/thriftpy2/contrib/aio/client.py | Python | apache-2.0 | 2,974 |
# Copyright (c) 2014 OpenStack Foundation.
#
# 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 ... | klmitch/glance | glance/opts.py | Python | apache-2.0 | 5,667 |
# Copyright (c) 2013 Mirantis 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 writ... | paramite/blazar | climate/manager/__init__.py | Python | apache-2.0 | 1,146 |
"""empty message
Revision ID: 92090c41312
Revises: None
Create Date: 2014-02-15 18:51:18.374244
"""
# revision identifiers, used by Alembic.
revision = '92090c41312'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
... | voltaire/minecraft-site | app/migrations/versions/92090c41312_.py | Python | bsd-3-clause | 2,090 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('setlist', '0013_show2'),
]
operations = [
migrations.RemoveField(
model_name='show2',
name='source',... | tylereaves/26md | setlist/migrations/0014_remove_show2_source.py | Python | bsd-3-clause | 338 |
from rx.disposable import CompositeDisposable, SingleAssignmentDisposable
from rx.observable import Producer
from rx.observer import Observer
import rx.linq.sink
from threading import RLock
from queue import Queue
class Merge(Producer):
def __init__(self, sources, maxConcurrency):
self.sources = sources
sel... | akuendig/RxPython | rx/linq/merge.py | Python | mit | 5,373 |
"""
Clone server Model Four
Author: Min RK <benjaminrk@gmail.com
"""
import zmq
from kvsimple import KVMsg
# simple struct for routing information for a key-value snapshot
class Route:
def __init__(self, socket, identity, subtree):
self.socket = socket # ROUTER socket to send to
self.iden... | krattai/noo-ebs | docs/zeroMQ-guide2/examples/Python/clonesrv4.py | Python | bsd-2-clause | 2,618 |
from obj_model import core
from wc_rules import utils,chem
from wc_rules.utils import ParseExpressionError
from wc_rules import pattern
import unittest
class A(chem.Molecule):pass
class X(chem.Site):
ph1 = core.BooleanAttribute(default=None)
ph2 = core.BooleanAttribute(default=None)
class Y(chem.Site):
ph ... | KarrLab/nucleopatterns | tests/test_pattern.py | Python | gpl-3.0 | 3,762 |
class ClientQueryStats(object):
def __init__(self,client_name):
self.client_name = client_name
self.query_stats = {'INSERT' : {'count' : 0, 'min_execution_time' : 0.0, 'max_execution_time' : 0.0, 'total_execution_time' : 0.0, 'operations per second' : 0, 'rows_affected' : 0},
'SELECT' : {'count... | DeepInfoSci/deep_data_bench | deep_data_bench/ClientQueryStats.py | Python | gpl-3.0 | 6,033 |
#
# This is a cosmology with steps in rho_DE(z).
#
import numpy
from numpy import linspace
#from scipy.interpolate import InterpolatedUnivariateSpline
from LCDMCosmology import *
import math as N
class StepCDMCosmology(LCDMCosmology):
def __init__(self):
self.NZ = int(step_nz_par.value)
self.Z =... | slosar/april | py/StepCDMCosmology.py | Python | gpl-2.0 | 2,782 |
#!/usr/bin/env python3
from docker_ipsec import DockerIPSecError
from docker_ipsec import ip_network_for_docker_network
from docker_ipsec import interface_name_for_index
from docker_ipsec import ipsec
from docker_ipsec import IPSecInfo
from docker_ipsec import IPSecInfoEntry
from docker_ipsec import install_iptables_... | cbrichford/docker-ipsec | docker_ipsec/docker-ipsec.py | Python | apache-2.0 | 9,336 |
# -*- coding: UTF-8 -*-
from datetime import date
import pytest
from pyopenmensa.feed import extractDate
class TestExtractDateFormats():
date = date(2013, 3, 7)
# datetime.date:
def test_passing_of_date_objects(self):
assert extractDate(self.date) is self.date
# german, year last:
def ... | mswart/pyopenmensa | tests/feed/test_date_formats.py | Python | lgpl-3.0 | 4,075 |
"""
Tests for student enrollment.
"""
from mock import patch, Mock
import ddt
from django.core.cache import cache
from nose.tools import raises
import unittest
from django.test import TestCase
from django.test.utils import override_settings
from django.conf import settings
from course_modes.models import CourseMode
f... | IndonesiaX/edx-platform | common/djangoapps/enrollment/tests/test_api.py | Python | agpl-3.0 | 10,040 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 TUBITAK/BILGEM
# Renan Çakırerk <renan at pardus.org.tr>
#
# 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 ... | bit2pixel/quickformat | src/code/quickformat.py | Python | gpl-2.0 | 14,607 |
'''Collection of alternative implementations for time series analysis
'''
'''
>>> signal.fftconvolve(x,x[::-1])[len(x)-1:len(x)+10]/x.shape[0]
array([ 2.12286549e+00, 1.27450889e+00, 7.86898619e-02,
-5.80017553e-01, -5.74814915e-01, -2.28006995e-01,
9.39554926e-02, 2.00610244e-01, 1.32239... | hlin117/statsmodels | statsmodels/sandbox/archive/tsa.py | Python | bsd-3-clause | 1,493 |
"""
HistogramItem
Inspired by HistogramItem.h and HistogramItem.cpp by T. Kroes
from Exposure Render (http://code.google.com/p/exposure-render/)
:Authors:
T. Kroes <t.kroes@tudelft.nl>
B. Klein Haneveld <b.a.kleinhaneveld@student.tudelft.nl>
"""
from PySide.QtGui import *
from PySide.QtCore import *
from Histogram ... | berendkleinhaneveld/Registrationshop | ui/widgets/histogram/HistogramItem.py | Python | mit | 3,480 |
#!/usr/bin/env python
""" This script retrieves the output of all the jobs of a given
test. <jobName> is the path of the directory created by submitMyJob
"""
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
import sys
from DIRAC.Interfaces.API.Dirac import Dirac
import os
if len(sys.arg... | andresailer/DIRAC | tests/Performance/DFCPerformance/retrieveResult.py | Python | gpl-3.0 | 1,100 |
# Copyright (c) 2009-2011, 2013-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2010 Daniel Harding <dharding@gmail.com>
# Copyright (c) 2013-2016, 2018-2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2013-2014 Google, Inc.
# Copyright (c) 2015-2016 Ceridwen <ceridwenv@gmail.com>
# Copy... | PyCQA/astroid | astroid/nodes/as_string.py | Python | lgpl-2.1 | 24,993 |
VERSION = '0.2a'
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from setuptools import setup, find_packages
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ""
# Provided as an attribu... | Tivix/Django-parsley | setup.py | Python | bsd-3-clause | 4,788 |
import os
import tempfile
def before_all(context):
context.tmp_dir = tempfile.TemporaryDirectory(dir=os.path.abspath(os.path.curdir))
context.old_injection_files = []
def after_all(context):
context.tmp_dir.cleanup()
def before_tag(context, tag):
pass
def after_tag(context, tag):
pass
def ... | whereskenneth/WhoIsMissing | tests/features/environment.py | Python | gpl-3.0 | 597 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Copyright 2012-2015 OpenBroadcaster, Inc.
This file is part of OpenBroadcaster Player.
OpenBroadcaster Player is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free... | openbroadcaster/obplayer | obplayer.py | Python | agpl-3.0 | 887 |
"to be %(comple<caret>)s" % dict(completed="smth") | asedunov/intellij-community | python/testData/completion/percentStringWithDictCallArg.py | Python | apache-2.0 | 50 |
from __future__ import print_function, division
import sys,os
qspin_path = os.path.join(os.getcwd(),"../")
sys.path.insert(0,qspin_path)
from quspin.basis import spin_basis_general, spinful_fermion_basis_general
from quspin.basis.transformations import square_lattice_trans
from quspin.operators import hamiltonian
imp... | weinbe58/QuSpin | tests/sq_lat_Heis_double_occupancy_test.py | Python | bsd-3-clause | 4,184 |
from abapy.postproc import FieldOutput
data = [1,2,3,5,6,0]
labels = range(1,len(data)+1)
fo = FieldOutput(data=data, labels = labels)
print fo.get_data(6)
print fo.get_data(10)
| lcharleux/abapy | doc/example_code/postproc/FieldOutput-get_data.py | Python | gpl-2.0 | 178 |
'''
Setup script for BatchY.
'''
import setuptools
from batchy import __project__, __version__, CLI
README = 'README.md'
setuptools.setup(name=__project__,
version=__version__,
description='Batch YAML Editing.',
url="https://github.com/jkloo/BatchY",
... | jkloo/BatchY | setup.py | Python | mit | 702 |
from matplotlib.colors import LinearSegmentedColormap
from numpy import nan, inf
cm_data = [[0.0980392, 0.00392157, 0.],
[0.105882, 0.00392157, 0.],
[0.109804, 0.00784314, 0.00392157],
[0.113725, 0.00784314, 0.00392157],
[0.117647, 0.0117647, 0.00784314],
[0.121569, 0.0156863, 0.0117647],
[0.12549, 0.0156863, 0.0156863... | planetarymike/IDL-Colorbars | IDL_py_test/076_MPL_rainbow.py | Python | gpl-2.0 | 8,625 |
import os
import re
import webapp2
import jinja2
import time
import hashlib
import hmac
from string import letters
from secret import *
from google.appengine.ext import db
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir)... | fenghuo/cs263 | blog.py | Python | apache-2.0 | 4,522 |
# 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 (t... | heiths/allura | scripts/trac_import.py | Python | apache-2.0 | 4,947 |
from __future__ import annotations
import runpy
import click
from flask.cli import with_appcontext
from abilian.core.extensions import db
from abilian.core.models.subjects import User
from abilian.services import get_service
@click.command()
@with_appcontext
def initdb():
db.create_all()
@click.command()
@wi... | abilian/abilian-core | src/abilian/cli/base.py | Python | lgpl-2.1 | 6,406 |
# -*- 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):
# Make the AssessmentPart.criterion field NOT nullable
db.alter_column('assessment_assessmentpart', 'criteri... | EDUlib/edx-ora2 | openassessment/assessment/migrations/0020_assessmentpart_criterion_not_null.py | Python | agpl-3.0 | 14,234 |
# -*- coding: utf-8 -*-
# Copyright 2017 Square, 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 ... | square/pylink | examples/swv.py | Python | apache-2.0 | 3,180 |
import numpy as np
# This function takes the prediction and label of a single image, returns intersection and union areas for each class
# To compute over many images do:
# for i in range(Nimages):
# (area_intersection[:,i], area_union[:,i]) = intersectionAndUnion(imPred[i], imLab[i])
# IoU = 1.0 * np.sum(area_inters... | CSAILVision/sceneparsing | evaluationCode/utils_eval.py | Python | bsd-3-clause | 1,826 |
# -*- coding: utf-8 -*-
#
# Dropbox for Python documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 24 13:42:45 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated ... | posita/dropbox-sdk-python | docs/conf.py | Python | mit | 8,592 |
from __future__ import absolute_import, print_function, division
import unittest
from pony.orm.core import *
db = Database('sqlite', ':memory:')
class Student(db.Entity):
name = Required(unicode)
scholarship = Optional(int)
group = Required("Group")
marks = Set("Mark")
class Group(db.En... | compiteing/flask-ponypermission | venv/lib/python2.7/site-packages/pony/orm/tests/test_declarative_object_flat_monad.py | Python | mit | 2,225 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google 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... | googleapis/python-automl | google/cloud/automl_v1/types/image.py | Python | apache-2.0 | 13,018 |
"""Calendar table
Revision ID: e4518d7d1af1
Revises: 3da004006210
Create Date: 2018-03-06 09:53:49.794389
"""
import datetime
from alembic import op
from sqlalchemy import Column, Date
# revision identifiers, used by Alembic.
revision = "e4518d7d1af1"
down_revision = "3da004006210"
branch_labels = None
depends_on =... | all-of-us/raw-data-repository | rdr_service/alembic/versions/e4518d7d1af1_calendar_table.py | Python | bsd-3-clause | 1,250 |
#!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | baconz/shaka-player | build/test.py | Python | apache-2.0 | 2,981 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore
class ScreenPosWindow(QtGui.QWidget):
def __init__(self, x, y, width, height, f_setPosition):
QtGui.QWidget.__init__(self)
self.x, self.y = x, y
self.width, self.height = width, height
self.f_setPosition = f_setPosition
#http... | Taifuru/smartpro | stream_pos.py | Python | gpl-3.0 | 2,637 |
"""
Eigenvector centrality.
"""
# 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.
import networkx as nx
__author__ = "\n".join(['Aric Hagberg (hagberg@lanl.gov)',
... | ChristianKniep/QNIB | serverfiles/usr/local/lib/networkx-1.6/networkx/algorithms/centrality/eigenvector.py | Python | gpl-2.0 | 5,085 |
# from django.core.management.base import BaseCommand, CommandError
# from django.db.models import get_model
#
# from edc_constants.constants import YES
#
#
# class Command(BaseCommand):
#
# args = 'label (from call list e.g. t1-prep)'
# help = 'manually update HIC flag on call list'
#
# def handle(sel... | botswana-harvard/bcpp-subject | bcpp_subject/management/commands/fix_hic_flag_on_call_list.py | Python | gpl-3.0 | 1,869 |
from gi.repository import Gtk, GObject
from buffer import BufferWindow
class MainWindowController():
def __init__(self, app):
self.app = app
self.ui = MainWindowView(app, app.bufferstore)
self.ui.connect_tree_selection(self.on_tree_selection_changed)
self.ui.connect_connswitch(se... | hrkfdn/weelay | mainwindow.py | Python | gpl-3.0 | 3,552 |
import click
from images_of import command, settings, Reddit
from images_of.discord_announcer import DiscordBot, DiscordBotSettings
@command
@click.option('-M', '--no-modlog', is_flag=True,
help='Do not process network modlog events')
@click.option('-O', '--no-oc', is_flag=True,
help='Do n... | amici-ursi/ImagesOfNetwork | images_of/entrypoints/discord_announce_bot.py | Python | mit | 1,564 |
# Copyright (c) 2016 RIPE NCC
#
# 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 distributed in the h... | danielquinn/ripe.atlas.sagan | ripe/atlas/sagan/version.py | Python | gpl-3.0 | 690 |
"""Test some builtin potentials against galpy"""
# Third-party
import numpy as np
from astropy.constants import G
import astropy.units as u
import pytest
from scipy.special import gamma
# This project
from ...._cconfig import GSL_ENABLED
from ....units import galactic
from ..builtin import (KeplerPotential, MiyamotoN... | adrn/gary | gala/potential/potential/tests/test_against_galpy.py | Python | mit | 5,029 |
from __future__ import print_function, division
from collections import defaultdict
import operator
from sympy.core.sympify import sympify
from sympy.core.basic import Basic, C
from sympy.core.singleton import S
from sympy.core.operations import AssocOp
from sympy.core.cache import cacheit
from sympy.core.logic impor... | lidavidm/sympy | sympy/core/mul.py | Python | bsd-3-clause | 53,169 |
from typing import Union, Mapping, Sequence, Tuple
import h5py
import numpy as np
import pandas as pd
from scipy import sparse
from scipy.sparse import issparse
from . import anndata
from .index import _normalize_index, _subset, unpack_index, get_vector
from .aligned_mapping import AxisArrays, AxisArraysView
from .sp... | theislab/anndata | anndata/_core/raw.py | Python | bsd-3-clause | 6,794 |
"""
GravMag: 2D forward modeling with polygons
"""
import numpy
from fatiando import utils, mesher
from fatiando.gravmag import talwani
from fatiando.vis import mpl
# Notice that the last two number are switched.
# This way, the z axis in the plots points down.
area = (-5000, 5000, 5000, 0)
axes = mpl.figure().gca()
m... | eusoubrasileiro/fatiando_seismic | cookbook/gravmag_2d_polygon_picker.py | Python | bsd-3-clause | 901 |
'''
:copyright: Copyright 2010 Luis Artola.
:license: BSD, see LICENSE.txt for details.
'''
| artolaluis/restblog | src/restblog/directives/__init__.py | Python | bsd-3-clause | 94 |
# This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
#
# This script filters the posts and keeps those posts that are or belong
# to a question that has bee... | kcompher/BuildingMachineLearningSystemsWithPython | ch05/so_xml_to_tsv.py | Python | mit | 4,632 |
# -*- coding: utf-8 -*-
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Unit tests for RequestsModel
"""
import sys
im... | hack4sec/ws-cli | tests/unit/test_RequestsModel.py | Python | mit | 1,714 |
from lumberjack.client.file_descriptor import FileDescriptorEndpoint
from lumberjack.client.message_receiver import MessageReceiverFactory
from lumberjack.client.message_forwarder import RetryingMessageForwarder
from lumberjack.client.protocol import LumberjackProtocolFactory
from lumberjack.util.object_pipe import Obj... | tuck182/syslog-ng-mod-lumberjack-py | src/lumberjack/client/process.py | Python | gpl-2.0 | 3,727 |
from functools import partial
from collections import defaultdict
from .models import UNTITLED_ARTIST, UNTITLED_ALBUM
FIELDS_ORDER = [
'id',
'source',
'source_id',
'title',
'number',
'mbid',
'artist_mbid',
'album_mbid'
]
def compress_tracks_to_json(tracks):
"""
Serialize tra... | jakubroztocil/cloudtunes | cloudtunes-server/cloudtunes/library/utils.py | Python | bsd-3-clause | 1,042 |
from events.models import Registration
from django.contrib.auth.decorators import login_required
def get_active_events(request):
if request.user.is_authenticated():
return {"user_events_active" : Registration.objects.filter(related_user=request.user)}
else:
return {}
| Requinard/OperationSquid | OperationSquid/preprocessors.py | Python | gpl-2.0 | 293 |
#Personal greeter program
name = input("Hi, what is your name? ")
print(name)
print("Hello, ",name)
input("\nPress the enter key to exit")
| Ry09/Python-projects | Programs & Challenges from Python for beginners book/Chapter 2/personalGreeter.py | Python | mit | 141 |
'''This is the Android implementatoin of NFC Scanning using the
built in NFC adapter of some android phones.
'''
from kivy.app import App
from kivy.clock import Clock
#Detect which platform we are on
from kivy.utils import platform
if platform != 'android':
raise ImportError
import threading
from electroncash_gui... | molecular/electrum | gui/kivy/nfc_scanner/scanner_android.py | Python | mit | 8,442 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""The 'gcloud test android devices' command group."""
from googlecloudsdk.calliope import base
class Devices(base.Group):
"""Explore Android testing device environments and characteristics."""
detailed_help = {
'DESCRIPTION': '{description}',
'EXAM... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/test/commands/android/devices/__init__.py | Python | apache-2.0 | 866 |
import unittest
from kagent_utils import CondaEnvsWatcherAction
from kagent_utils import KConfig
from kagent_utils import ConcurrentCircularLinkedList
class MockCondaEnvsWatcherAction(CondaEnvsWatcherAction):
def __init__(self, monitor_list):
config = KConfig("some_path")
config.conda_dir = "/some... | karamelchef/kagent-chef | files/default/kagent_utils/tests/test_conda_envs_watcher_action.py | Python | gpl-3.0 | 1,581 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contraparte', '0006_auto_20160128_2058'),
]
operations = [
migrations.AlterField(
model_name='actividad',
... | CARocha/plataforma_fadcanic | actividades/contraparte/migrations/0007_auto_20160809_1417.py | Python | mit | 795 |
import inspect
import os
import numpy as np
from functools import reduce
import jug.mapreduce
import jug.utils
from jug.backends.dict_store import dict_store
from jug.tests.utils import simple_execute
from jug.mapreduce import _break_up, _get_function
from jug import value, TaskGenerator
from .task_reset import task... | luispedro/jug | jug/tests/test_mapreduce.py | Python | mit | 2,835 |
from django.test import SimpleTestCase
from corehq.util.workbook_reading import SpreadsheetFileNotFound, SpreadsheetFileInvalidError, \
SpreadsheetFileExtError, open_any_workbook, SpreadsheetFileEncrypted
from corehq.util.workbook_reading.tests.utils import (
get_file,
run_on_all_adapters,
run_on_all_a... | dimagi/commcare-hq | corehq/util/workbook_reading/tests/test_errors.py | Python | bsd-3-clause | 2,103 |
"""Settings that need to be set in order to run the tests."""
import os
import tempfile
import logging
DEBUG = True
logging.getLogger("factory").setLevel(logging.WARN)
SITE_ID = 1
HEADLESS_TESTING = True
APP_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), ".."))
# DATABASES = {
# 'default... | benzkji/django-formfieldstash | formfieldstash/tests/settings.py | Python | mit | 2,935 |
# -*- coding: utf-8 -*-
import KBEngine
from KBEDebug import *
def onBaseAppReady(bootstrapIdx):
"""
KBEngine method.
baseapp已经准备好了
@param isBootstrap: 是否是第一个baseapp启动
@type isBootstrap: bool
"""
DEBUG_MSG('baseapp准备完毕! bootstrapIdx=%s' % bootstrapIdx)
if bootstrapIdx == 1:
# 创建spacemanager
K... | harmy/kbengine | demo/res/scripts/base/kbengine.py | Python | lgpl-3.0 | 1,402 |
# -*- coding: utf-8 -*-
"""
A VTK RenderWindowInteractor widget for wxPython.
Find wxPython info at http://wxPython.org
Created by Prabhu Ramachandran, April 2002
Based on wxVTKRenderWindow.py
Fixes and updates by Charl P. Botha 2003-2008
Updated to new wx namespace and some cleaning up by Andrea Gavana,
December 2... | florian-wagner/gimli | python/pygimli/gui/vtk/wxVTKRenderWindowInteractor.py | Python | gpl-3.0 | 24,830 |
from __future__ import unicode_literals
from django.apps import AppConfig
class CaffeAppConfig(AppConfig):
name = 'caffe_app'
| Cloud-CV/IDE | caffe_app/apps.py | Python | gpl-3.0 | 133 |
from __future__ import division
from scipy import spatial
import numpy as np
import numexpr as ne
def pairwise_numpy(X):
'''
Can be done faster with scipy cdist.
'''
return np.sqrt(((X[:, None, :] - X) ** 2).sum(-1))
def pairwise_scipy(X):
'''
May be faster than numpy pairwise.
'''
... | madscatt/zazzie | src_2.7/sassie/calculate/sascalc_pbc/debye.py | Python | gpl-3.0 | 4,159 |
import datetime
import pytz
def to_dt(dt):
"""
Convert a naive date or datetime to a tz-aware datetime.
"""
if type(dt) == 'datetime.date' or not hasattr(dt, 'hour'):
dt = datetime.datetime(dt.year, dt.month, dt.day, 0, 0, 0, 0)
else:
if dt.tzinfo == None:
return d... | detrout/pykolab | pykolab/xml/utils.py | Python | gpl-3.0 | 386 |
# monitors multiple files for modification
# can check for modification of one or all of them
#
# usage:
# monitor = Monitor()
# monitor.monitor('decider.py')
# if monitor.is_modified('decider.py'): # check one specific file
# if monitor.is_modified(): # check all monitored files
from builtins imp... | basepair/basepair-python | basepair/utils/monitor.py | Python | mit | 1,211 |
from django.utils.encoding import force_unicode
import html5lib
import jinja2
def truncate_text(text, limit, killwords=False, end='...'):
"""Return as many characters as possible without going over the limit.
Return the truncated text and the characters left before the limit, if any.
"""
text = tex... | andymckay/zamboni | mkt/translations/utils.py | Python | bsd-3-clause | 3,938 |
import logging
import re
import sys
import time
import warnings
from contextlib import contextmanager
from functools import wraps
from unittest import skipIf, skipUnless
from xml.dom.minidom import Node, parseString
from django.apps import apps
from django.conf import UserSettingsHolder, settings
from django.core impo... | ABaldwinHunter/django-clone-classic | django/test/utils.py | Python | bsd-3-clause | 20,961 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.