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 |
|---|---|---|---|---|---|
# encoding: 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 'ProjectMember.is_superuser'
db.add_column(
'sentry_projectmember',
'is_sup... | looker/sentry | src/sentry/south_migrations/0016_auto__add_field_projectmember_is_superuser.py | Python | bsd-3-clause | 15,097 |
# -*- coding: utf-8 -*-
from test import test_support
import java.lang
import unittest
class WrappedStrCmpTest(unittest.TestCase):
def testWrappedWorksAsKey(self):
'''Test for http://jython.org/bugs/1816134
PyString's equal used to check for str explicitly, so Wrapper's __cmp__ wasn't used
... | EnviroCentre/jython-upgrade | jython/lib/test/test_str_jy.py | Python | mit | 6,408 |
# Copyright (c) 2013 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 to... | sebrandon1/neutron | neutron/extensions/agent.py | Python | apache-2.0 | 5,561 |
#!/usr/bin/env python
#
# Copyright 2011-2014 Splunk, 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... | kkirsche/splunk-sdk-python | examples/results.py | Python | apache-2.0 | 1,111 |
import uuid
import pytest
from mongoengine import *
from tests.utils import MongoDBTestCase, get_as_pymongo
class Person(Document):
api_key = UUIDField(binary=False)
class TestUUIDField(MongoDBTestCase):
def test_storage(self):
uid = uuid.uuid4()
person = Person(api_key=uid).save()
... | MongoEngine/mongoengine | tests/fields/test_uuid_field.py | Python | mit | 1,880 |
import os
from django.utils.translation import gettext_lazy as _
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'er7f9y^ruw3$0+*8_(h)2+(sx*vpdzr-zn==gs)i_vh7d+(hkm'
# SECURITY WARNING: don't run with debug turned on in production... | stalker314314/nasa_mala_kladionica | nmk/settings.py | Python | gpl-3.0 | 7,915 |
from cached_httpbl.tests.test_cached_httpbl import *
__test__ = {'cached_httpbl.tests.TestCachedHTTPBL': ['test_cached_httpbl']}
| dlancer/django-cached-httpbl | cached_httpbl/tests/__init__.py | Python | bsd-3-clause | 130 |
import os
import struct
import random
import msgs
import status
def storeaddrs(addrs):
for addr in addrs:
status.addrs[addr.address.ip.packed] = addr.tobinary()
| cradle/pycoin | storage.py | Python | unlicense | 175 |
from . import course, schedule, subject, news
| fsr/course-management | course/models/__init__.py | Python | bsd-3-clause | 46 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | pombredanne/PyGithub | github/GithubObject.py | Python | gpl-3.0 | 9,977 |
"""
WSGI configuration for the datatracker.
The following apache datatracker configuration has been used together with a
datatracker checkout of trunk@ under /srv/www/ietfdb/ to run this on a development
server using mod_wsgi under apache. For a production server, additional access
restrictions are needed for the sec... | wpjesus/codematch | ietf/wsgi.py | Python | bsd-3-clause | 1,679 |
from functools import partial
from django.db import models, router, transaction
from django.db.models import Max, Model, signals
from django.db.models.fields.related import ManyToManyField as _ManyToManyField
from django.db.models.fields.related import lazy_related_operation, resolve_relation
from django.db.models.fie... | gregmuellegger/django-sortedm2m | sortedm2m/fields.py | Python | bsd-3-clause | 14,861 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | briancurtin/python-openstacksdk | openstack/cluster/v1/policy_type.py | Python | apache-2.0 | 1,159 |
# Copyright (c) 2013 Charles University, Faculty of Arts,
# Institute of the Czech National Corpus
# Copyright (c) 2013 Tomas Machalek <tomas.machalek@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as publis... | czcorpus/kontext | lib/actions/wordlist.py | Python | gpl-2.0 | 14,834 |
import rospy
from std_msgs.msg import Bool
from Interpreter import Interpreter
class Interpreter_bool_toogle(Interpreter):
def __init__(self, interpreter_info):
super(Interpreter_bool_toogle, self).__init__(interpreter_info)
self.cmd.val = bool(self._config['init_val'])
self.pub = rospy.Pu... | simchanu29/ros_teleop | src/message_handler/Interpreter_bool_toogle.py | Python | apache-2.0 | 645 |
from .development import *
DATABASES['default']['NAME'] = '{{ app }}'
DATABASES['default']['USER'] = '{{ app }}'
DATABASES['default']['PASSWORD'] = '{{ app }}'
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
DATABASES['default']['OPTIONS'] = {
'autocommit': True,
}
STATICFILES_STORAGE = ... | radiosilence/django-kindling | kindling/templates/settings/local.py | Python | mit | 541 |
from box import client
c = client.BoxClient("Access Token")
user = c.user_info()
print user
args = {"limit":2, "offset":0}
folder = c.get_folders("id", **args)
print folder
args = {"name": "NewFolder123"}
folder = c.update_folder_info("id", **args)
print folder
folder = c.get_folders_items("id")
print folder
arg... | dipen30/boxapi | examples/getfilesAndFolderInfo.py | Python | mit | 502 |
import simplejson as json
import cherrypy, sys
from sourcelyzer.httpapi.utils.json import json_error_output
from sourcelyzer.httpapi.v1.resources.base import RESTResource
from cherrypy.test import helper
class RESTResourceClassTest(helper.CPWebCase):
interactive = False
def setup_server():
class RE... | sourcelyzer/sourcelyzer | tests/test_restresource.py | Python | mit | 1,665 |
#!/usr/bin/env python
# ........................................................................... #
#
# IzPack - 2007, 2008 Julien Ponge, All Rights Reserved.
#
# http://izpack.org/
# http://izpack.codehaus.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | elespuru/jpeekaboo | bin/izpack2app/izpack2app.py | Python | gpl-3.0 | 1,556 |
# Copyright (C) 2013 Codethink Limited.
#
# 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 distribute... | CodethinkLabs/python-consonant | consonant/register/__init__.py | Python | gpl-2.0 | 6,463 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from six.moves import range
import json, os
from semantic_version import Version
import frappe
import requests
import subprocess # nosec
from frappe.utils import cstr
from frappe ... | adityahase/frappe | frappe/utils/change_log.py | Python | mit | 8,148 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import os
import llnl.util.tty as tty
import spack.cmd
import spack.cmd.common.arguments as arguments
import ... | rspavel/spack | lib/spack/spack/cmd/unload.py | Python | lgpl-2.1 | 2,763 |
__author__ = 'Fabiana'
| faahbih/projetoolivarts | backend/appengine/routes/updown/__init__.py | Python | mit | 23 |
from _csv import QUOTE_MINIMAL
from unittest import TestCase
import pandas as pd
from fireant import CSV
from fireant.tests.dataset.mocks import (
CumSum,
ElectionOverElection,
dimx0_metricx1_df,
dimx0_metricx2_df,
dimx1_date_df,
dimx1_date_operation_df,
dimx1_num_df,
dimx1_str_df,
... | mikeengland/fireant | fireant/tests/widgets/test_csv.py | Python | apache-2.0 | 9,657 |
# -*- coding: utf-8 -*-
#
import uuid
from django.shortcuts import get_object_or_404
from rest_framework.views import APIView, Response
from rest_framework.generics import (
ListAPIView, get_object_or_404, RetrieveAPIView
)
from common.permissions import IsOrgAdminOrAppUser, IsOrgAdmin
from common.utils import ge... | zsjohny/jumpserver | apps/perms/api/user_permission/common.py | Python | gpl-2.0 | 4,225 |
# -*- coding: utf-8 -*-
##
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
# This file is part of openmano
# 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 ... | 312v/openmano | openmano/vimconn_openstack.py | Python | apache-2.0 | 49,500 |
# MockModem.py - Hologram Python SDK mock modem interface
#
# Author: Hologram <support@hologram.io>
#
# Copyright 2016 - Hologram (Konekt, Inc.)
#
#
# LICENSE: Distributed under the terms of the MIT License
#
from Hologram.Network.Modem import IModem
E303_DEVICE_NAME = '/dev/ttyUSB0'
DEFAULT_E303_TIMEOUT = 200
clas... | hologram-io/hologram-python | Hologram/Network/Modem/MockModem.py | Python | mit | 616 |
# Copyright 2015 Sean Vig
#
# 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, sof... | flacjacket/pywayland | pywayland/protocol_core/interface.py | Python | apache-2.0 | 4,448 |
from __future__ import print_function
from permuta import *
import permstruct
import permstruct.dag
from permstruct import *
from permstruct.dag import taylor_dag
import sys
is_classical = True
# STATUS ================================================ >
patts = map(Permutation, [[1,2,4,3], [1,3,2,4], [1,3,4,2], [1,4... | PermutaTriangle/PermStruct | examples/classical_7x4/1243_1324_1342_1423_1432_2143_2314_3124.py | Python | bsd-3-clause | 1,852 |
#!/usr/bin/env python
"""
================================================
ABElectronics IO Pi | Digital I/O Read and Write Demo
Requires python smbus to be installed
For Python 2 install with: sudo apt-get install python-smbus
For Python 3 install with: sudo apt-get install python3-smbus
run with: python demo_iopire... | abelectronicsuk/ABElectronics_Python_Libraries | IOPi/demos/demo_iopireadwrite.py | Python | gpl-2.0 | 2,479 |
import pytest
from hypothesis import given, settings, reproduce_failure, unlimited, HealthCheck, seed
from hypothesis.extra.pandas import data_frames, columns, range_indexes, column, indexes
from hypothesis.extra.numpy import arrays
import hypothesis.strategies as st
from itertools import product
import tempfile
imp... | pyranges/pyrle | tests/test_hypothesis_coverage.py | Python | mit | 2,711 |
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
def test_valid_degree_sequence1():
n = 100
p = .3
for i in range(10):
G = nx.erdos_renyi_graph(n,p)
deg = list(G.degree().values())
assert_true( nx.is_valid_degree_sequence(deg, method='eg') )
as... | azlanismail/prismgames | examples/games/car/networkx/algorithms/tests/test_graphical.py | Python | gpl-2.0 | 2,612 |
# (c) 2018 Red Hat Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from abc import abstractmethod
from ansible.plugins import AnsiblePlugin
class HttpApiBase(AnsiblePlugin):
... | fxfitz/ansible | lib/ansible/plugins/httpapi/__init__.py | Python | gpl-3.0 | 1,093 |
# -*- coding: utf-8 -*-
"""
github3.repos.tag
=================
This module contains the RepoTag object for GitHub's tag API.
"""
from __future__ import unicode_literals
from ..models import GitHubObject
class RepoTag(GitHubObject):
"""The :class:`RepoTag <RepoTag>` object. This stores the information
repr... | h4ck3rm1k3/github3.py | github3/repos/tag.py | Python | bsd-3-clause | 1,021 |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | xiaoxu193/PyTeaser | goose/configuration.py | Python | mit | 4,131 |
# -*- coding: utf-8 -*-
#############################################################################
#
# Copyright (c) 2007 Martin Reisenhofer <martin.reisenhofer@funkring.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | funkring/fdoo | addons-funkring/at_bmd/models/bmd_reconcile.py | Python | agpl-3.0 | 13,022 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_operations.py | Python | mit | 39,498 |
import xbmc
import xbmcgui
import xbmcaddon
import sys
import urllib
from stream_api import eresult
import status
import utils
from comm import Service
pluginhandle = int(sys.argv[1])
addon = xbmcaddon.Addon()
def launchGame(params):
app_id = int(params.get('id'))
username = urllib.unquote_plus(params.get('... | Drakulix/plugin.program.steam.streaming | launchGame.py | Python | mit | 2,456 |
"""
Additive number is a positive integer whose digits can form additive sequence.
A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent
number in the sequence must be the sum of the preceding two.
For example:
"112358" is an additive number because the dig... | algorhythms/LeetCode | 306 Additive Number.py | Python | mit | 1,605 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 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
#
# Unle... | dsiddharth/access-keys | keystone/tests/test_auth_plugin.py | Python | apache-2.0 | 4,267 |
# Copyright 2013 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | insequent/quark | quark/tests/functional/plugin_modules/test_subnets.py | Python | apache-2.0 | 12,282 |
"""
Module for parsing arguments from the command line.
Import parser from this module.
"""
import argparse
from usage import meta
description = (
'Python tool for aggregating a usage report by domain'
' and some user defined field.'
)
parser = argparse.ArgumentParser(description=description)
# Configuratio... | absalon-james/usage | usage/args/summary.py | Python | apache-2.0 | 1,374 |
"""
Created on 11.5.2014
@author: mhanus
"""
# TODO: try-except for dolfin imports
import os
from dolfin.cpp.common import Timer, Parameters,warning
from dolfin import assemble, Function, FacetNormal, split, project,parameters,FunctionSpace
from dolfin import solve as dolfin_solve
from dolfin.cpp.function import Func... | mhanus/GOAT | flux_modules/elliptic_sn_flux_module.py | Python | mit | 22,316 |
import json
import copy
import six
from django.apps import apps
from django.conf import settings
from ..sessions import session_for_reply_channel
from .base import Client
json_module = json # alias for using at functions with json kwarg
class HttpClient(Client):
"""
Channel http/ws client abstraction tha... | linuxlewis/channels | channels/tests/http.py | Python | bsd-3-clause | 4,306 |
# -*- coding: utf8 -*-
#!/usr/bin/python2
import sys
from PyQt4 import QtGui, QtCore
import boto.ec2
import os
import config
class SystemTrayIcon(QtGui.QSystemTrayIcon):
def __init__(self, parent):
icon = QtGui.QIcon(self.getPath() + "/aws.png")
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
self.p... | bechu/ec2_instance_handler | handler.py | Python | gpl-2.0 | 2,717 |
import matplotlib.pyplot as plt
import numpy as np
#draw: troba la bounding box de cada simbol i les representa
def drawS(symbols):
print 'Setting attributes..........'
for i in range(len(symbols)):
symbols[i].draw()
#Representa
for i in range(len(symbols)):
plt.plot(symbols[i].bBox[[0,1,1,0,0]],-symbols[i].... | MrLeylo/OptiCalRead | python/drawRegions.py | Python | gpl-3.0 | 419 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import shutil
import time
import py_utils
from py_utils import exc_util
from telemetry.core import exceptions
from telemetry import decorato... | endlessm/chromium-browser | third_party/catapult/telemetry/telemetry/internal/backends/chrome/cros_browser_backend.py | Python | bsd-3-clause | 9,566 |
#!/usr/bin/env python
def rec(node, graph, visited):
if len(graph[node]) == 0:
return
for child in graph[node]:
if child not in visited:
visited.add(child)
rec(child, graph, visited)
done = False
while not done:
try:
mx = input()
except:
break
... | aLagoG/kygerand | icpc2017/repechaje/J.py | Python | mit | 739 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2015 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... | eustislab/horton | horton/correlatedwfn/test/test_lagrange.py | Python | gpl-3.0 | 5,097 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import undebt
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ex... | Yelp/undebt | docs/source/conf.py | Python | apache-2.0 | 1,230 |
import random, sys, pygame, os
sys.path.insert(0, './../')
from helpers import join
from globals import G
path_to_textures = '../textures/cells/icons/'
def load_single_icon(path):
return pygame.image.load(path_to_textures + path).convert_alpha()
def load_forest_icons():
global forest_icons, forest_styles
... | ponyii/The-favorite-pocket-world-of-Nebuchadnezzar-III-The-Rhino-in-exile | game/world_map/forests.py | Python | gpl-3.0 | 3,528 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | valentin-krasontovitsch/ansible | lib/ansible/modules/cloud/openstack/_os_server_actions.py | Python | gpl-3.0 | 533 |
from p5 import *
from walker import Walker
w = Walker()
def setup():
size(800, 200)
frameRate(30)
def draw():
background(255);
w.walk()
w.display()
run()
| croach/natureofcode.py | introduction/noc_i_5_noise_walk/noc_i_5_noise_walk.py | Python | mit | 179 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import sys
import socket
try:
from urllib.parse import quote, urlparse
from socketserver import ThreadingMixIn
from http.server import HTTPServer
except ImportError:
from urllib import quote
from urlparse import urlparse
from... | Mushiyo/isso | isso/wsgi.py | Python | mit | 5,736 |
import stomp
from stomp.listener import *
from .testutils import *
@pytest.fixture
def server():
server = StubStompServer("127.0.0.1", 60000)
server.start()
yield server
server.stop()
class TestWithStompServer(object):
def test_alternate_hosts(self, server):
server.add_frame('''CONNECTE... | jasonrbriggs/stomp.py | tests/test_ss.py | Python | apache-2.0 | 6,189 |
#!/usr/bin/env python2
import sys, os
from stat import *
from distutils.core import setup
from distutils.command.install import install as _install
INSTALLED_FILES = '.installed_files'
#stolen from ccsm
class install (_install):
def run (self):
_install.run(self)
outputs = self.get_outputs()
data = '\n'.joi... | kozec/fusion-icon-gtk3 | setup.py | Python | gpl-2.0 | 2,607 |
import os
import shutil
class Ctags_Error(Exception):
pass
def make_tags(project_root, tagsfile):
# we want all file paths in tags file is relative to the root
# the only way to do it is to create tags file in the root directory
# and use --tag-relative option. After the tags file is created, we can
... | swiperthefox/python-source-browser | app/mktags.py | Python | mit | 785 |
# Generated by Django 2.1.1 on 2019-03-05 12:47
from django.db import migrations, models
import ip_pool.fields
class Migration(migrations.Migration):
replaces = [('ip_pool', '0001_initial'), ('ip_pool', '0002_change_unique'), ('ip_pool', '0003_auto_20181019_1230'), ('ip_pool', '0004_auto_20190305_1243')]
i... | nerosketch/djing | ip_pool/migrations/0001_squashed_0004_auto_20190305_1243.py | Python | unlicense | 1,674 |
#Fazer um programa que solicite 5 números
#e informe se o número é par ou impar
for x in range(1,6):
numero = int(input("Digite um número: "))
if numero%2==0 :
print(numero," é um número par")
else:
print(numero," é um número ímpar") | fkenjikamei/python-exercises | aula13-2.py | Python | gpl-3.0 | 250 |
__author__ = 'ariel'
"""
Python Population Simulator
Copyright (C) 2015 Ariel Young
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 yo... | DarthGeek01/PopulationSimulator | Organisms/__init__.py | Python | gpl-2.0 | 928 |
from django.core.exceptions import FieldError
from django.db.models.fields import FieldDoesNotExist
from django.db.models.sql.constants import LOOKUP_SEP
class SQLEvaluator(object):
def __init__(self, expression, query, allow_joins=True):
self.expression = expression
self.opts = query.get_meta()
... | nycholas/ask-undrgz | src/ask-undrgz/django/db/models/sql/expressions.py | Python | bsd-3-clause | 3,255 |
"""
Generator for packed circle cartograms
"""
import proj, gisutils
class Cartogram:
def loadCSV(self, url, key='id', value='val', lon='lon', lat='lat'):
import csv
doc = csv.reader(open(url))
head = None
circles = []
for row in doc:
if not head:
head = row
else:
circles.append(Circle(row[he... | kartograph/kartograph.py-old | lib/cartogram.py | Python | agpl-3.0 | 6,988 |
import uuid
import os
import shutil
import urlparse
import re
import hashlib
from lxml import html
from PIL import Image, ImageFile
from django.conf import settings
import views
ImageFile.MAXBLOCKS = 10000000
def match_or_none(string, rx):
"""
Tries to match a regular expression and returns an integer if it... | ZG-Tennis/django-ckeditor | ckeditor/utils.py | Python | bsd-3-clause | 8,404 |
#!/usr/bin/python
import re, sys
from useful import *
prologPattern = re.compile("\S.*?\.\n", re.DOTALL)
commentPattern = re.compile("/\*.*\*/\s*", re.DOTALL)
def sortprolog(f, out=sys.stdout):
if out == f:
raise Exception("Not a good idea to use same filename for input and outsink: %s"%(f))
clauses ... | AllanRamsay/dgParser | sortprolog.py | Python | mit | 965 |
# coding=utf-8
import numpy as np
from numpy import random
# a=np.array([[2,3,4,1,2],[1,3,4,5,4],[4,2,3,10,2],[3,5,6,7,9],[10,3,4,2,9]])
# # for i in xrange(5):
# # a[i,i]=1000
# #b=a.argmin(axis=1)
# print a
# a=random.randint(1,100,size=(8,8))
MAX = 1000
MIN = 0
CARSEATS = 6
distMat = np.array([[0, 1, 15, 1... | Octoberr/swmcdh | Schedul/unceshi.py | Python | apache-2.0 | 1,831 |
#!/usr/bin/env python
# coding: utf8
# get information on current setup
# print information in MSG box, in console and it should propose to save
# the report in a file
# this Script will serve as setup to detect/define CPYTHON in a config file
# There should be different tests functions, a report function and a setup... | jtrebosc/JTutils | TSpy/setup_JTutils.py | Python | bsd-3-clause | 29,893 |
import collections.abc
import re
from typing import (
Any,
Callable,
Dict,
List,
Mapping,
MutableMapping,
Optional,
Sequence,
Type,
Union,
IO,
)
import warnings
from io import BytesIO
from datetime import datetime
from base64 import b64encode, b64decode
from numbers import In... | google/material-design-icons | update/venv/lib/python3.9/site-packages/fontTools/misc/plistlib/__init__.py | Python | apache-2.0 | 21,093 |
##
# .test.test_dbapi20 - test .driver.dbapi20
##
import unittest
import time
from ..temporal import pg_tmp
##
# Various Adjustments for .driver.dbapi20
#
# Log: dbapi20.py
# Revision 1.10 2003/10/09 03:14:14 zenzen
# Add test for DB API 2.0 optional extension, where database exceptions
# are exposed as attributes o... | zappyk-github/zappyk-python | lib/lib_external/postgresql/test/test_dbapi20.py | Python | gpl-2.0 | 25,947 |
import functools
from flask import (Blueprint, url_for, redirect, session, flash, g,
request, render_template, current_app, abort)
from flask.ext.wtf import (Form, TextField, PasswordField, Required)
from cfmi.database.newsite import (User, Subject, Project, Session, Invoice)
from cfmi.database.di... | nocko/cfmi | cfmi/auth/__init__.py | Python | bsd-3-clause | 10,194 |
# -*- coding: utf-8 -*-
from Instance import Instance
from Instances import Instances
from Clasificador import Clasificador
import math # This will import math module
class NaiveBayes(Clasificador):
"""docstring for NaiveBayes"""
def __init__(self):
super(NaiveBayes, self).__init__()
self.diccionarioINFO = {}
... | garnachod/neuro1 | src/MachineLearning/Clasificadores/NaiveBayes.py | Python | apache-2.0 | 5,310 |
import mock
import pytest
from mock import Mock
from mock import MagicMock
from piper.build import Build
from piper.build import BuildAPI
from piper.build import BuildCLI
from piper.build import ExecCLI
from piper.config import AgentConfig
from piper.config import BuildConfig
from test.utils import BASE_CONFIG
@py... | thiderman/piper | test/test_build.py | Python | mit | 11,257 |
import json
from random import choice
import re
from redlib.api.web import HtmlParser
from redlib.api.misc import Retry
from six.moves.urllib.parse import urlencode, urlparse, parse_qs
from asq.initiators import query
from ..util import log
from ..util.printer import printer
from .base import SourceError, SourceParam... | amol9/wallp | wallp/source/interfacelift.py | Python | mit | 3,647 |
# key point is to find the half node
class Node:
def __init__(self, val):
self.val = val
self.next = None
class LinkList:
def __init__(self):
self.head = None
def push(self, val):
node = Node(val)
if self.head:
node.next = self.head
self.he... | sonymoon/algorithm | src/main/python/geeksforgeeks/list/mmerge-sort-for-linked-list.py | Python | apache-2.0 | 1,384 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2019 khalim19
#
# 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... | khalim19/gimp-plugin-export-layers | export_layers/pygimplib/setting/__init__.py | Python | gpl-3.0 | 1,014 |
__author__ = 'ronreiter'
__version__ = '0.1.11' | kradalby/webmux | webmux/__init__.py | Python | mit | 47 |
import sys, os
import pygame
from pygame.locals import *
try:
import pygame.freetype as freetype
except ImportError:
print ("No FreeType support compiled")
sys.exit ()
colors = {
"grey_light" : pygame.Color(200, 200, 200),
"grey_dark" : pygame.Color(100, 100, 100),
"green" :... | jingzhehu/udacity_mlnd | P4_Training_a_Smartcab_to_Drive/smartcab/pygame/examples/freetype_misc.py | Python | mit | 2,610 |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 25 09:42:22 2016
@author: bing
"""
import numpy as np
#import scipy
import numba
import sys
bohr_angstrom = 0.52917721092
hartree_wavenumber = 219474.63
#hartree_wavenumber = scipy.constants.value(u'hartree-inverse meter relationship') / 1e2
def M1mat(a, Nb):... | binghongcha08/pyQMD | GHQT/dat3/sys_bath.py | Python | gpl-3.0 | 9,831 |
import unittest
import pyalm.pyalm as pyalm
import pyalm.events as events
import datetime
import pprint
import json
from test_pyalm import TestOffline as TestOffline
class TestSourcesEvents(TestOffline):
def testTwitterEvents(self):
tweets = []
for tweet in self.mock_resp.sources['twitter'].events:... | lagotto/pyalm | test/test_events.py | Python | apache-2.0 | 6,508 |
#!/usr/bin/env python
from __future__ import print_function
import os
from posixpath import basename
from six.moves.urllib.parse import urlparse
from .common.spiders import BaseDocumentationSpider
from typing import Any, List, Set
def get_help_images_dir(help_images_path):
# type: (str) -> str
# Get index... | amyliu345/zulip | tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py | Python | apache-2.0 | 2,033 |
import datetime
import logging
from acc.entry import Entry
log = logging.getLogger()
class Event(object):
def __init__(self, event_type, occurred_at,
subject=None, adjusted_event=None):
assert subject or adjusted_event
# assert subject is None or issubclass(subject.__class__, Su... | knoguchi/acc | acc/event.py | Python | apache-2.0 | 4,783 |
#Remote imports
import pygame
from pygame.locals import *
import random
import operator
from copy import copy
from math import sqrt
#Local imports
#import config
import resources
from my_gui import BoardCreationDialog
from events import *
from matrix import Matrix
from textrect import render_textrect, TextRectExceptio... | JordanMagnuson/Country-Connect | game_components.py | Python | lgpl-2.1 | 55,432 |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program 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 ... | Micronaet/micronaet-bom | bom_type/__openerp__.py | Python | agpl-3.0 | 1,436 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, throw
import frappe.utils.user
from frappe.permissions import check_admin_or_system_manager
from frappe.model.db_schema import type_map
def ex... | ShashaQin/frappe | frappe/core/report/permitted_documents_for_user/permitted_documents_for_user.py | Python | mit | 2,363 |
# -*- coding: utf-8 -*-
"""
flask.wrappers
~~~~~~~~~~~~~~
Implements the WSGI wrappers (request and response).
:copyright: (c) 2016 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from werkzeug.exce... | Parkayun/flask | flask/wrappers.py | Python | bsd-3-clause | 7,532 |
#!env/bin/python
# Copyright (C) 2016 Baofeng Dong
# This program is released under the "MIT License".
# Please see the file COPYING in the source
# distribution of this software for license terms.
from dashboard import app
app.run(debug = True)
| miketung168/survey-dashboard | run.py | Python | mit | 248 |
from distutils.core import setup
setup(
name='MetCalcs',
version='0.1.1',
author='Peter D. Willetts',
author_email='peterwilletts24@gmail.com',
packages=['metcalcs',],
#scripts=[],
license='LICENSE.txt',
description='Some functions for calculating met parameters from sounding variab... | peterwilletts24/MetCalcs | setup.py | Python | gpl-3.0 | 459 |
# coding=utf-8
from .attrs import Attrs, AltScript, Dir, FileAs, Id, Scheme, Lang
from .dcmes import Base
class Property(Attrs):
@property
def property(self):
"""xml attribute: `property`"""
return self._attrs.setdefault('property')
@property.setter
def property(self, value):
... | meng89/epubuilder | epubaker/metas/epub3_meta.py | Python | mit | 570 |
FOO = 1
something_else = 2
| asedunov/intellij-community | python/testData/refactoring/move/qualifiedReferenceInDestinationModule/before/src/a.py | Python | apache-2.0 | 28 |
"""
Plugin support for rdf.
There are a number of plugin points for rdf: parser, serializer,
store, query processor, and query result. Plugins can be registered
either through setuptools entry_points or by calling
rdf.plugin.register directly.
If you have a package that uses a setuptools based setup.py you can add th... | gloaec/trifle | src/rdflib/plugin.py | Python | gpl-3.0 | 9,342 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='pynest',
version='1.0',
description='Python API for Nest Thermostat',
author='Scott Baker',
author_email='smbaker@gmail.com',
url='http://www.smbaker.com/',
scripts=['nest.py'],
)
| sschwartzman/New-Relic-of-Things | examples/pynest/setup.py | Python | mit | 290 |
import re
import random
import requests
import urllib.parse
from ralybot import hook
from ralybot.util import web
API_URL = 'http://api.wordnik.com/v4/'
WEB_URL = 'https://www.wordnik.com/words/{}'
ATTRIB_NAMES = {
'ahd-legacy': 'AHD/Wordnik',
'century': 'Century/Wordnik',
'wiktionary': 'Wiktionary/Wor... | Jakeable/Ralybot | plugins/wordnik.py | Python | gpl-3.0 | 6,530 |
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Calendar datamodel.
Calendars provide color to a chronology such as the Viewfinder search/
browse tool.
Calendars are parsed from the "resources/calendars/" subdirectory on
demand and cached.
TODO(spencer): this is a very rough beginning meant to capture
loca... | 0359xiaodong/viewfinder | backend/resources/calendar.py | Python | apache-2.0 | 7,188 |
# -*- Mode: Python; test-case-name: flumotion.test.test_manager_manager -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General... | ylatuya/Flumotion | flumotion/test/test_manager_manager.py | Python | gpl-2.0 | 27,542 |
from trionyx.api.routers import router
from app.testblog.api import TestApi
apiroutes = [
router('test', TestApi, 'test')
] | krukas/Trionyx | app/testblog/routes.py | Python | gpl-3.0 | 129 |
# Copyright (c) 2013, Resource Systems Group, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this... | ericstalbot/movespy | movespy/ratetable.py | Python | bsd-2-clause | 8,746 |
#!/usr/bin/env python2
"""Display multi-page text with interspersed thought probes.
Then ask the subject comprehension questions at the end."""
# SingingTask.py
#
# Created 3/17/17 by DJ based on ReadingTask.py.
from psychopy import core, gui, data, event, sound, logging #, visual # visual causes a bug in the guis, so... | djangraw/PsychoPyParadigms | BasicExperiments/SingingTask.py | Python | mit | 13,709 |
from tornado import web
from handlers.BaseHandler import BaseHandler, wrap_async_rpc, wrap_catch
from core import FM
class WebDavCreateConnectionHandler(BaseHandler):
@wrap_async_rpc
@wrap_catch
@web.authenticated
def post(self):
params = self.get_post('params')
if params is None:
... | f-andrey/sprutio | app/handlers/actions/webdav/WebDavCreateConnectionHandler.py | Python | gpl-3.0 | 643 |
""" This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... | rothnic/bokeh | bokeh/charts/builder/tests/test_boxplot_builder.py | Python | bsd-3-clause | 4,900 |
from pulp.client.extensions.decorator import priority
from pulp.client.admin import (
admin_auth, consumer, content, auth, binding, event, orphan, repo,
server_info, tasks)
@priority()
def initialize(context):
admin_auth.initialize(context)
consumer.initialize(context)
content.initialize(context)
... | beav/pulp | client_admin/pulp/client/admin/cli.py | Python | gpl-2.0 | 537 |
# -*- coding: utf-8 -*-
__author__ = 'Patrick Michl'
__email__ = 'frootlab@gmail.com'
__license__ = 'GPLv3'
from nemoa.dataset.builder import plain
def types(type = None):
"""Get supported dataset types of dataset builders."""
alltypes = {}
# get supported plain datasets
types = plain.types()
f... | fishroot/nemoa | nemoa/dataset/builder/__init__.py | Python | gpl-3.0 | 896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.