code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
from django.contrib import admin from video.models import Season, Video, VideoLiked admin.site.register((Season, Video, VideoLiked))
pobear/restless
examples/statmap/video/admin.py
Python
bsd-3-clause
134
from __future__ import division import re import glob import os import sys import unittest from unittest import TestCase as BaseTestCase suites = [] add = suites.append class TestCase(BaseTestCase): def failUnlessRaisesRegexp(self, exc, re_, fun, *args, **kwargs): def wrapped(*args, **kwargs): ...
hanvo/MusicCloud
Crawler/Install Files/mutagen-1.22/tests/__init__.py
Python
bsd-3-clause
4,882
import pandas as pd import redcap as rc """ ## FIXME - There's multiple functions doing mostly the same thing, but not quite. I need to go through it. """ def get_items_matching_regex(regex, haystack): import re return list(filter(lambda x: re.search(regex, x), haystack)) def get_notnull_entries(row, igno...
sibis-platform/ncanda-data-integration
scripts/qc/qa_utils.py
Python
bsd-3-clause
5,817
import tests.periodicities.period_test as per per.buildModel((120 , 'BH' , 200));
antoinecarme/pyaf
tests/periodicities/Business_Hour/Cycle_Business_Hour_200_BH_120.py
Python
bsd-3-clause
84
#!/usr/bin/env python from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter from ATK.Adaptive import DoubleLMSFilter from nose.tools import raises def filter(input, reference): import numpy as np output = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) inf...
mbrucher/AudioTK
tests/Python/Adaptive/PyATKAdaptive_lms_test.py
Python
bsd-3-clause
1,784
from __future__ import absolute_import import os import fcntl import pwd import re import shutil import sys import time import random import smtplib import traceback import time from collections import defaultdict from subprocess import check_output from datetime import datetime, time as dtime from metatlas.mzml_load...
biorack/metatlas
metatlas/io/directory_watcher.py
Python
bsd-3-clause
8,146
import random import string import factory from models import Position class PositionFactory(factory.Factory): class Meta: model = Position title = factory.Sequence(lambda n: 'Position Title %d' % n) short_title = factory.Sequence(lambda n: 'Position Short Title %d' % n) enabled = random.rand...
publica-io/django-publica-positions
positions/factories.py
Python
bsd-3-clause
329
from base64 import b64decode from .packet import construct_packet from .utils import PgpdumpException, crc24 class BinaryData(object): '''The base object used for extracting PGP data packets. This expects fully binary data as input; such as that read from a .sig or .gpg file.''' binary_tag_flag = 0x80 ...
toofishes/python-pgpdump
pgpdump/data.py
Python
bsd-3-clause
3,846
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # --------------------------------------------...
gregcaporaso/scikit-bio
skbio/tree/_tree.py
Python
bsd-3-clause
100,088
import os import shutil import zipfile from django.conf import settings from django.contrib.sites.models import Site from django.core.files.base import ContentFile from django.core.files.storage import default_storage from django.core.signals import request_finished from django.db import models from uploadtemplate.u...
pculture/django-uploadtemplate
uploadtemplate/models.py
Python
bsd-3-clause
5,865
# NOTE: parts of this file were taken from scipy's doc/source/conf.py. See # scikit-bio/licenses/scipy.txt for scipy's license. import glob import sys import os import types import re if sys.version_info.major != 3: raise RuntimeError("scikit-bio can only be used with Python 3. You are " "c...
gregcaporaso/scikit-bio
doc/source/conf.py
Python
bsd-3-clause
16,829
#!/usr/bin/env python import commands import os import popen2 import quopri import base64 import re import shutil import string import sys import time # Fix for older versions of Python try: True except NameError: True,False = 1,0 # Singleton-like design pattern # See: http://aspn.activestate.com/ASPN/...
lorin/umdinst
umdinst/wrap.py
Python
bsd-3-clause
25,968
# -*- coding: utf-8 -*- # # BSD licence # # Copyright (c) <2008-2011> Pierre Quentel (pierre.quentel@gmail.com) # Copyright (c) <2014-2015> Bendik Rønning Opstad <bro.devel@gmail.com>. # """ Main differences from :mod:`pydblite.pydblite`: - pass the connection to the :class:`SQLite db <pydblite.sqlite.Database>` as a...
PierreQuentel/PyDbLite
pydblite/sqlite.py
Python
bsd-3-clause
20,162
#!/usr/bin/env python from io import open import os import subprocess import sys from setuptools import setup, Command, find_packages import pkgdist class PyTest(pkgdist.PyTest): default_test_dir = os.path.join(pkgdist.TOPDIR, 'test') class PyLint(Command): user_options = [('errorsonly', 'E', 'Check onl...
radhermit/pychroot
setup.py
Python
bsd-3-clause
2,384
# Copyright (c) 2016-2020, The Bifrost Authors. 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 list of conditi...
ledatelescope/bifrost
python/bifrost/blocks/serialize.py
Python
bsd-3-clause
11,503
from django.test import TestCase from django.db.models import F from django.core.exceptions import FieldError from models import Employee, Company class ExpressionsTestCase(TestCase): fixtures = ['f_expression_testdata.json'] def test_basic_f_expression(self): company_query = Company.objects.values(...
sam-tsai/django-old
tests/modeltests/expressions/tests.py
Python
bsd-3-clause
6,079
import sys import cProfile from cStringIO import StringIO import pstats from django.conf import settings class ProfilerMiddleware(object): def process_view(self, request, callback, callback_args, callback_kwargs): if settings.DEBUG and 'prof' in request.GET: self.profiler = cProfile.Profile() ...
vegarang/devilry-django
devilry/utils/profile.py
Python
bsd-3-clause
945
# -*- coding: 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): # I do not use orm['...'] # because in this way it is not possible to call models's methods # such as `po...
feedzilla/feedzilla
feedzilla/migrations/0011_setup_taggit_data.py
Python
bsd-3-clause
7,349
import pytest import socket import types from collections import defaultdict from itertools import count from queue import Empty, Queue as _Queue from unittest.mock import ANY, Mock, call, patch from case import ContextMock, mock from kombu import Connection, Exchange, Queue, Consumer, Producer from kombu.exceptions...
ZoranPavlovic/kombu
t/unit/transport/test_redis.py
Python
bsd-3-clause
49,876
#!/usr/bin/env python # Written by Oliver Beckstein, 2014 # Placed into the Public Domain from __future__ import print_function import sys import subprocess import socket DEFAULTS = {'queuename': ["workstations.q"], 'machine': socket.getfqdn(), 'deltatime': 4, } class GEqueue(obje...
Becksteinlab/queuetools
bin/qsuspend.py
Python
bsd-3-clause
3,709
def extractFujiboytlWordpressCom(item): ''' Parser for 'fujiboytl.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', 'translated'), ('Loite...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractFujiboytlWordpressCom.py
Python
bsd-3-clause
558
""" ---------------------------------------------------------------------- Authors: Jan-Justin van Tonder ---------------------------------------------------------------------- Unit tests for the Verify Text module. ---------------------------------------------------------------------- """ import pytest from hutts_ver...
javaTheHutts/Java-the-Hutts
src/unittest/python/test_text_verify.py
Python
bsd-3-clause
12,383
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Compare orientation matrices Uses the mat3 and vec3 classes from Python Computer Graphics Kit v1.2.0 module by Matthias Baas (see http://cgkit.sourceforge.net). License: http://www.opensource.org/licenses/bsd-license.php """ __author__ = "Pierre Legra...
jsburg/xdsme
XOconv/XOintegrate_drift.py
Python
bsd-3-clause
10,074
from django.test import TestCase from django.urls import reverse from django.contrib.auth import get_user_model from petition.models import Organization, Petition, PytitionUser, Permission from .utils import add_default_data class EditPetitionViewTest(TestCase): """Test index view""" @classmethod def set...
fallen/Pytition
pytition/petition/tests/tests_EditPetitionView.py
Python
bsd-3-clause
16,750
from django.conf import settings from django.core.urlresolvers import reverse from django.test import TestCase from registration.compat import User from registration.forms import RegistrationForm class SimpleBackendViewTests(TestCase): urls = 'registration.backends.simple.urls' def test_allow(self): ...
mattdeboard/django-registration
registration/tests/simple_backend.py
Python
bsd-3-clause
3,463
from django.contrib import admin from .models import Organization, OrganizationProfile, Category, Person from django.utils.translation import ugettext_lazy as _ @admin.register(Organization) class OrganizationAdmin(admin.ModelAdmin): list_display = ['short_name', 'krs', 'register_at', 'tag_list', 'category_list',...
rafal-jaworski/bazaNGObackend
src/bazango/contrib/organization/admin.py
Python
bsd-3-clause
1,802
from django.utils.translation import ugettext_lazy as _ import itertools class DefaultRoles(object): VIEWER = 'viewer' OBSERVER = 'observer' PARTICIPANT = 'participant' PROPOSER = 'proposer' CONTRIBUTOR = 'contributor' EDITOR = 'editor' OPERATOR = 'operator' DECIDER = 'decider' MA...
hasadna/OpenCommunity
src/users/default_roles.py
Python
bsd-3-clause
4,312
import contextlib import errno import gc import os import random import socket import sys import traceback import unittest try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import greenhouse port = lambda: 8000 + os.getpid() # because i want to run multiprocess nose TESTI...
teepark/greenhouse
tests/test_base.py
Python
bsd-3-clause
1,699
#!/usr/bin/env python import locale import sys import six # Below causes issues in some locales and noone knows why it was included so commenting out for now # locale.setlocale(locale.LC_NUMERIC, "") class Table: def format_num(self, num): """Format a number according to given places. Adds comm...
rigdenlab/ample
ample/util/printTable.py
Python
bsd-3-clause
1,850
# -*- coding: utf-8 -*- """ celery.task ~~~~~~~~~~~ This is the old task module, it should not be used anymore, import from the main 'celery' module instead. If you're looking for the decorator implementation then that's in ``celery.app.base.Celery.task``. """ from __future__ import absolute_i...
mozilla/firefox-flicks
vendor-local/lib/python/celery/task/__init__.py
Python
bsd-3-clause
1,731
# -*- coding: utf-8 -*- import datetime import hashlib import itertools import json import os import re import time import urlparse import uuid from django.conf import settings from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist from django.core.files.storage import default_storag...
ngokevin/zamboni
mkt/webapps/models.py
Python
bsd-3-clause
103,635
from django.conf.urls import include, url from django.contrib import admin admin.autodiscover() urlpatterns = [ url(r'', include('zendesk_auth.urls')), url(r'^admin/', include(admin.site.urls)), ]
madisona/zendesk_django_auth
example/urls.py
Python
bsd-3-clause
208
############################################################################### ## ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary forms, with or without ## modification, ...
CMUSV-VisTrails/WorkflowRecommendation
vistrails/db/versions/v0_5_0/translate/v0_3_1.py
Python
bsd-3-clause
30,874
#!/usr/bin/env python # Copyright (c) 2014, Warren Weckesser # All rights reserved. # See the LICENSE file for license information. from os import path from setuptools import setup def get_odeintw_version(): """ Find the value assigned to __version__ in odeintw/__init__.py. This function assumes that t...
WarrenWeckesser/odeintw
setup.py
Python
bsd-3-clause
1,957
from __future__ import absolute_import, division, print_function import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "..", "functions")) import time as time import numpy as np import scipy as sp import matplotlib.pyplot as plt from sklearn.feature_extraction.image import grid_to_graph from skl...
berkeley-stat159/project-alpha
code/utils/scripts/cluster.py
Python
bsd-3-clause
1,770
import math from .sum import sum def root_mean_square(x): """ Root mean square (RMS) is the square root of the sum of the squares of values in a list divided by the length of the list. It is a mean function that measures the magnitude of values in the list regardless of their sign. Args: x...
jhowardanderson/simplestatistics
simplestatistics/statistics/root_mean_square.py
Python
bsd-3-clause
1,006
from django import VERSION from django.core.management.commands.loaddata import Command as LoadDataCommand # Because this command is used (instead of default loaddata), then settings have been imported # and we can safely import MT modules from wagtail_modeltranslation import settings as mt_settings from wagtail_model...
tomdyson/wagtail-modeltranslation
wagtail_modeltranslation/management/commands/loaddata.py
Python
bsd-3-clause
2,588
# -*- coding: utf-8 -*- from __future__ import unicode_literals from decimal import Decimal from django.utils.translation import ugettext_lazy as _ from shop import messages from shop.exceptions import ProductNotAvailable from shop.money import AbstractMoney, Money from shop.modifiers.base import BaseCartModifier cl...
divio/django-shop
shop/modifiers/defaults.py
Python
bsd-3-clause
3,413
# Authors: Veeresh Taranalli <veeresht@gmail.com> # License: BSD 3 clause from numpy import array, ones_like, arange from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_, assert_equal from commpy.channelcoding.gfields import GF class TestGaloisFields(object): def test_closure(self):...
tarunlnmiit/CommPy
commpy/channelcoding/tests/test_gfields.py
Python
bsd-3-clause
2,375
from __future__ import division from builtins import object import numpy as np from sporco.admm import cmod class TestSet01(object): def setup_method(self, method): pass def test_01(self): N = 16 M = 4 K = 8 X = np.random.randn(M, K) S = np.random.randn(N,...
bwohlberg/sporco
tests/admm/test_cmod.py
Python
bsd-3-clause
2,763
from __future__ import absolute_import, print_function, division import unittest from nose.plugins.skip import SkipTest import numpy import theano import theano.gof.op as op from six import string_types from theano.gof.type import Type, Generic from theano.gof.graph import Apply, Variable import theano.tensor as T fr...
JazzeYoung/VeryDeepAutoEncoder
theano/gof/tests/test_op.py
Python
bsd-3-clause
11,243
from django.contrib import admin from django.contrib.admin import helpers from django import http from django.template import loader from django.utils.safestring import mark_safe from django.contrib.admin.util import unquote from django.forms.models import modelform_factory from django.utils import simplejson as...
lsbardel/flow
flow/db/instdata/admin.py
Python
bsd-3-clause
7,082
#------------------------------------------------------------------------------ # Copyright (c) 2013, Enthought, Inc. # All rights reserved. #------------------------------------------------------------------------------ from kiwisolver import Variable from .linear_symbolic import LinearSymbolic class ConstraintsN...
tommy-u/enable
enable/layout/constraints_namespace.py
Python
bsd-3-clause
2,304
# Copyright (c) 2017 pandas-gbq Authors All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """Nox test automation configuration. See: https://nox.readthedocs.io/en/latest/ """ import os import os.path import shutil import nox supported_python...
pydata/pandas-gbq
noxfile.py
Python
bsd-3-clause
3,146
""" This is the Django template system. How it works: The Lexer.tokenize() method converts a template string (i.e., a string containing markup with custom template tags) to tokens, which can be either plain text (TokenType.TEXT), variables (TokenType.VAR), or block statements (TokenType.BLOCK). The Parser() class ta...
atul-bhouraskar/django
django/template/base.py
Python
bsd-3-clause
41,520
# # Depends # Copyright (C) 2014 by Andrew Gardner & Jonas Unger. All rights reserved. # BSD license (LICENSE.txt for details). # from PySide import QtCore, QtGui import node import data_packet """ A QT graphics widget that displays the state of a given scenegraph. The user can also mouseover a given item, which ...
mottosso/deplish
deplish/scenegraph_widget.py
Python
bsd-3-clause
5,727
from scipy.special import erfinv import glob, os, logging, sys logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg import cPickle as pickle import json, ...
demorest/rtpipe
rtpipe/parsecands.py
Python
bsd-3-clause
25,631
#!/usr/bin/env python import string import struct import sys import mtbl def merge_func(key, val0, val1): i0 = mtbl.varint_decode(val0) i1 = mtbl.varint_decode(val1) return mtbl.varint_encode(i0 + i1) def main(input_fnames, output_fname): merger = mtbl.merger(merge_func) writer = mtbl.writer(out...
edmonds/pymtbl
examples/wf/pymtbl_wf_merge.py
Python
isc
721
import lintreview.github as github from . import load_fixture from mock import call from mock import patch from mock import Mock from nose.tools import eq_ from pygithub3 import Github from requests.models import Response config = { 'GITHUB_URL': 'https://api.github.com/', 'GITHUB_USER': 'octocat', 'GITH...
alexBaizeau/lint-review
tests/test_github.py
Python
mit
2,712
from datetime import datetime import numpy as np from netcdf import netcdf as nc from multiprocessing import Process, Pipe from itertools import izip from cache import memoize import multiprocessing as mp import os import logging class ProcessingStrategy(object): def __init__(self, algorithm, loader, cache): ...
ahMarrone/solar_radiation_model
models/core.py
Python
mit
2,493
from setuptools import setup, find_packages setup( name = "QuickBooks", version = '0.2.2', packages = find_packages(), install_requires = ['requests', 'requests-oauthlib', 'python-keyczar==0.71c', 'django-extensions'], include_package_data = True, # metadata for upload to PyPI author ...
hiidef/django-quickbooks
setup.py
Python
mit
624
import flask import pymysql.cursors from donut.auth_utils import is_admin from donut.modules.core import helpers as core def get_group_list_data(fields=None, attrs={}): """ Queries the database and returns list of group data constrained by the specified attributes. Arguments: fields: The fiel...
ASCIT/donut-python
donut/modules/groups/helpers.py
Python
mit
12,968
from __future__ import print_function letters = [ ('b', 'int8'), ('w', 'int16'), ('i', 'int32'), ('l', 'int64'), ('d', 'float64'), ('f', 'float32'), ('c', 'complex64'), ('z', 'complex128') ] shapes = [ ('scalar', ()), ('vector', (False,)), ('row', (True, False))...
rizar/attention-lvcsr
libs/Theano/doc/generate_dtype_tensor_table.py
Python
mit
978
#!/usr/bin/env python #https://bitbucket.org/fotosyn/fotosynlabs/src/9819edca892700e459b828517bba82b0984c82e4/RaspiLapseCam/raspiLapseCam.py?at=master #http://www.instructables.com/id/Simple-timelapse-camera-using-Raspberry-Pi-and-a-c/#step1 every_minutes=10 HOME_FOLDER="/home/pi/" sender='bin/send_file.sh' sender_end...
sauloalrpi/pifollowjs
pi/raspiLapseCam.py
Python
mit
5,751
# checks whether the filename and the flag "unlink_date" match CONFIGFILE = "cordex_eur_ALL.cfg" DATABASE = "../../db/cordex_eur_ALL.db" import sys sys.path.insert(0, "..") import os # import cPickle ############### import ConfigParser # reload(ConfigParser) import esget_logger # reload(esget_logger) import esget_db ...
hvwaldow/esget
code/misc/check_unlink.py
Python
mit
1,005
import argparse from line_profiler import LineProfiler import ruler class Morning(ruler.Grammar): """ Implementation of the following grammar:: grammar = who, ' likes to drink ', what; who = 'John' | 'Peter' | 'Ann'; what = tea | juice; juice = 'juice'; tea = 'tea', ...
yanivmo/rulre
performance/profile.py
Python
mit
1,877
from typing import Dict, Generic, List, Optional, Union, Sequence, Type, TypeVar import datetime import itertools import re import attr import cattr from google.oauth2 import service_account # type: ignore import googleapiclient.errors # type: ignore import googleapiclient.discovery # type: ignore NIL = "\x00" DA...
looker-open-source/sdk-examples
python/hackathon_app/sheets.py
Python
mit
10,498
class Random: def __init__(self, seed = 2): self.a = 10000007 self.b = 31 self.salt = 0xdeadbeef self.x = seed def Rand(self): self.x = self.x*self.a + self.b self.x ^= self.salt; self.x %= 10000000000 return self.x
mudream4869/crpg
testdata/test1/scripts/Tool.py
Python
mit
289
""" The search library of ORB provides basic search functionality to all ORB models. It will also provide a base class for more advanced searching capabilities such as AWS or Elasticsearch to be applied to particular models during development. """ import orb import logging import re import pyparsing from collections...
orb-framework/orb
orb/core/search.py
Python
mit
4,949
#Interface Import from model.base.basequeue import basequeue #Support Data-Structures Imports from model.linkedlist import SimpleLinkedList as LinkedList from collections import deque class QueueLinkedList(LinkedList, basequeue): def enqueue(self, element): """ Enqueues the element at ...
gmarciani/ipath
model/queue.py
Python
mit
3,466
from BaseScouting.views.base_views import BaseAddTeamCommentsView from Scouting2011.model.reusable_models import Team, TeamComments class AddTeamCommentsView2011(BaseAddTeamCommentsView): def __init__(self): BaseAddTeamCommentsView.__init__(self, Team, TeamComments, 'Scouting2011:view_team')
ArcticWarriors/scouting-app
ScoutingWebsite/Scouting2011/view/submission/add_team_comments.py
Python
mit
307
# # # # *********************************************************************** # *** not used by scseq. Needed for compatibility with CGATPipelines. *** # *********************************************************************** # # # # -*- coding: utf-8 -*- # # test documentation build configuration file, created by # ...
snsansom/xcell
pipelines/configuration/conf.py
Python
mit
13,376
""" Examples: To smear an already smeared spectrum with a light yield of 200 to a a light yield of 190 then the following lines are required:: >>> smearer = smear.SmearEnergySmearLY() >>> ly = smearer.calc_smear_ly(190., cur_ly=200.) >>> smearer.set_resolution(ly) >>> smeared_spec = smearer.weighte...
jwaterfield/echidna
echidna/core/smear.py
Python
mit
32,311
__author__ = 'tfg'
ShakMR/suibash
String/__init__.py
Python
mit
19
# encoding: utf-8 from .compat import py2, py26, py3, py33, itervalues, iteritems, iterkeys, odict, range, str, unicode, total_seconds, zip from .dictconfig import dictConfig
deKross/task
marrow/task/compat/__init__.py
Python
mit
175
# trello_webhooks package
yunojuno/django-test
trello_webhooks/__init__.py
Python
mit
26
# -*- coding: utf-8 -*- """ pygments.lexers.dalvik ~~~~~~~~~~~~~~~~~~~~~~ Pygments lexers for Dalvik VM-related languages. :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from ..lexer import RegexLexer, include, bygroups fr...
facelessuser/sublime-markdown-popups
st3/mdpopups/pygments/lexers/dalvik.py
Python
mit
4,406
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/lair/merek/shared_lair_merek_swamp.iff" result.attribute_template_i...
obi-two/Rebelion
data/scripts/templates/object/tangible/lair/merek/shared_lair_merek_swamp.py
Python
mit
449
from math import cos, sin, pi def distance(p1, p2): dx = p1[0] - p2[0] dy = p1[1] - p2[1] return (dx * dx + dy * dy)**0.5 def equals(p1, p2, epsilon=0.001): return distance(p1, p2) <= epsilon def add(p1, p2): return p1[0] + p2[0], p1[1] + p2[1] def subtract(p1, p2): return p1[0] - p2[0], p1[1] - p2[1] def sc...
tylerburnham42/ProgrammingTeam
2016/slides/ComputationalGeometry/arc.py
Python
mit
2,650
# 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. import csv, os from sqlalchemy import func, desc, distinct, cast, Integer from flask import current_app, jsonify from dashboard import S...
miketung168/survey-dashboard
dashboard/helper.py
Python
mit
35,348
from typing import List, Any import urllib3 from CommonServerPython import * from math import ceil # Disable insecure warnings urllib3.disable_warnings() ''' CONSTANTS ''' DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ' ''' CLIENT CLASS ''' class Client(BaseClient): def get_domain_data(self, domain: str) -> Dict[str, ...
demisto/content
Packs/HostIo/Integrations/HostIo/HostIo.py
Python
mit
6,099
import unittest from test.asserting.policy import PolicyAssertion, get_fixture_path from vint.linting.level import Level from vint.linting.policy.prohibit_implicit_scope_builtin_variable import ( ProhibitImplicitScopeBuiltinVariable, ) PATH_VALID_VIM_SCRIPT = get_fixture_path( 'prohibit_implicit_scope_builtin...
Kuniwak/vint
test/integration/vint/linting/policy/test_prohibit_implicit_scope_builtin_variable.py
Python
mit
1,496
# -*- coding: utf8 -*- """In the Spotlight analysis module.""" import time import datetime import itertools import enki from libcrowds_analyst.analysis import helpers from libcrowds_analyst import object_loader MERGE_RATIO = 0.5 def get_overlap_ratio(r1, r2): """Return the overlap ratio of two rectangles.""" ...
LibCrowds/libcrowds-analyst
libcrowds_analyst/analysis/playbills.py
Python
mit
4,184
import ftplib import os.path as op import logging import os log = logging.getLogger(__name__) def download_coding_sequences(patric_id, seqtype, outdir='', outfile='', force_rerun=False): """Download the entire set of DNA or protein sequences from protein-encoding genes in a genome from NCBI. Saves a FASTA fi...
SBRG/ssbio
ssbio/databases/patric.py
Python
mit
1,919
#!/usr/bin/env python3 # vim: set fileencoding=utf8 : import string import random import loremipsum import hashlib import json import sqlite3 import socket import tornado.web import tornado.ioloop import webtest from tornado import gen import tornado.testing from tornado import netutil from tornado.testing import Asyn...
lockie/tornado_jsonapi
test/__init__.py
Python
mit
9,383
#!/usr/bin/env python3 import socket import selectors baseSelector = selectors.DefaultSelector() if __name__ == '__main__': with open('../poll.py', 'r') as f: baseSelector.register(f, selectors.EVENT_READ) for k, v in baseSelector.select(0): print(k, v) ''' https://do...
JShadowMan/package
python/IOMultiplexing/_selector/base.py
Python
mit
428
import pickle as p class sysfile: def __init__(self,name="program.log",ftype="r+"): self.f=open(name,ftype) try: #self.rr=self.f.read() self.prop={"name":name,"opentype":ftype,"data":self.f.readlines(),"datastr":self.f.read()} except: print("erro...
javaarchive/PIDLE
systools.py
Python
mit
1,768
"""Add not null constraints everywhere Revision ID: ba6fefa33e22 Revises: 2cb2db7089f4 Create Date: 2016-09-12 23:50:53.526022 """ # revision identifiers, used by Alembic. revision = 'ba6fefa33e22' down_revision = '2cb2db7089f4' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgres...
usgo/online-ratings
web/migrations/versions/ba6fefa33e22_add_not_null_constraints_everywhere.py
Python
mit
6,577
import json from django.test import TestCase from django.contrib.auth.models import User def setUp(): User.objects.create_user( first_name='brett', email='theiviaxx@gmail.com', password='top_secret') class FrogTestCase(TestCase): fixtures = ['test_data.json'] def test_filter(self): res =...
theiviaxx/Frog
frog/tests.py
Python
mit
1,158
import os, sys, re, codecs from setuptools import setup, find_packages def read(*parts): # intentionally *not* adding an encoding option to open # see here: https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690 return codecs.open(os.path.join(os.path.abspath(os.path.dirname(__file__)), *parts)...
crdoconnor/op
setup.py
Python
mit
1,473
from __future__ import unicode_literals from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ValidationError as DjangoValidationError from django.core.validators import RegexValidator from django.forms import ImageField as DjangoImageField from django...
paulormart/gae-project-skeleton-100
gae/lib/rest_framework/fields.py
Python
mit
47,325
"""autogenerated by genpy from aidu_gui/Solenoid.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct class Solenoid(genpy.Message): _md5sum = "cb57accc540fd18e2aa6911a9b7363e5" _type = "aidu_gui/Solenoid" _has_header = False #flag to mark the prese...
MartienLagerweij/aidu
aidu_gui/src/aidu_gui/msg/_Solenoid.py
Python
mit
3,338
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Creature() result.template = "object/creature/npc/base/shared_bothan_base_female.iff" result.attribute_template_i...
anhstudios/swganh
data/scripts/templates/object/creature/npc/base/shared_bothan_base_female.py
Python
mit
457
from .delete_nth import * from .flatten import * from .garage import * from .josephus import * from .longest_non_repeat import * from .max_ones_index import * from .merge_intervals import * from .missing_ranges import * from .move_zeros import * from .plus_one import * from .rotate import * from .summarize_ranges impor...
keon/algorithms
algorithms/arrays/__init__.py
Python
mit
459
import demistomock as demisto from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import from CommonServerUserPython import * # noqa """MatchIPinCIDRIndicators """ from typing import Dict, Any import ipaddress import traceback ''' STANDALONE FUNCTION ''' ''' COMMAND FUNCTION ''' def matc...
demisto/content
Packs/ExpanseV2/Scripts/MatchIPinCIDRIndicators/MatchIPinCIDRIndicators.py
Python
mit
2,632
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/deed/event_perk/shared_yavin_flag_deed.iff" result.attribute_templa...
anhstudios/swganh
data/scripts/templates/object/tangible/deed/event_perk/shared_yavin_flag_deed.py
Python
mit
465
import requests from allauth.socialaccount.providers.oauth2.views import ( OAuth2Adapter, OAuth2CallbackView, OAuth2LoginView, ) from .provider import AmazonProvider class AmazonOAuth2Adapter(OAuth2Adapter): provider_id = AmazonProvider.id access_token_url = "https://api.amazon.com/auth/o2/token...
pennersr/django-allauth
allauth/socialaccount/providers/amazon/views.py
Python
mit
1,152
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Intangible() result.template = "object/draft_schematic/clothing/shared_clothing_pants_formal_38.iff" result.attri...
anhstudios/swganh
data/scripts/templates/object/draft_schematic/clothing/shared_clothing_pants_formal_38.py
Python
mit
462
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Intangible() result.template = "object/intangible/pet/shared_swirl_prong_hue.iff" result.attribute_template_id = ...
anhstudios/swganh
data/scripts/templates/object/intangible/pet/shared_swirl_prong_hue.py
Python
mit
428
""" A place to Get Stuff Out Of Views. As this fills up, move into different places...this is just a handy bucket for now, until we understand better what organization we need. """ import requests import re def remove_script_tags(str): inside = re.match("<script[^>]+>(.+)</script>", str) if inside: r...
total-impact/total-impact-webapp
totalimpactwebapp/views_helpers.py
Python
mit
624
# -*- coding: utf-8 -*- # Copyright (C) 2019 Philipp Wolfer # # 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. """Pure ...
lucienimmink/scanner.py
mutagen/ac3.py
Python
mit
10,451
#!/usr/bin/env python """ If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def run_calc(): num = 1000 results = [] for x in range(1, num): if x % 3 == 0:...
marshallhumble/Euler_Groovy
Project-Euler/python/1.py
Python
mit
535
################################################################################ # # This program is part of the HPMon Zenpack for Zenoss. # Copyright (C) 2008, 2009, 2010 Egor Puzanov. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss.co...
anksp21/Community-Zenpacks
ZenPacks.community.HPMon/ZenPacks/community/HPMon/cpqScsiCntlr.py
Python
gpl-2.0
2,211
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
pmisik/buildbot
master/buildbot/secrets/providers/vault.py
Python
gpl-2.0
3,801
# -*- coding: utf-8 -*- """ *************************************************************************** EditScriptDialog.py --------------------- Date : December 2012 Copyright : (C) 2012 by Alexander Bruy Email : alexander dot bruy at gmail dot com *******...
raymondnijssen/QGIS
python/plugins/processing/script/ScriptEditorDialog.py
Python
gpl-2.0
11,181
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Storage testcase using xfstests. """ __copyright__ = \ """ Copyright (C) 2012-2015 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; you can redistribute it and/or mo...
sobomax/virtualbox_64bit_edd
src/VBox/ValidationKit/tests/storage/tdStorageStress1.py
Python
gpl-2.0
23,926
#!/usr/bin/env python import os import re from repositoryhandler.backends import create_repository,\ create_repository_from_path, RepositoryUnknownError from repositoryhandler.backends.watchers import * from tests import Test, register_test, remove_directory class SVNTest(Test): def checkout(self): ...
pombredanne/RepositoryHandler
tests/svn.py
Python
gpl-2.0
7,720
nums = [11,22,33,44,55] #while循环的遍历方式 #nums_lenght = len(nums) #i = 0 #while i<nums_lenght: # print(nums[i]) # i+=1 #for循环的遍历方式(因为不用控制元素的个数,以及下标,所以使用起来会更简单) for num in nums: print(num)
jameswatt2008/jameswatt2008.github.io
python/Python基础/截图和代码/元组、函数-上/01-遍历列表的方式.py
Python
gpl-2.0
280
""" Kodi urlresolver plugin Copyright (C) 2016 script.module.urlresolver 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) a...
kreatorkodi/repository.torrentbr
script.module.urlresolver/lib/urlresolver/plugins/videocloud.py
Python
gpl-2.0
1,197
""" This page is in the table of contents. Gcode_small is an export plugin to remove the comments and the redundant z and feed rate parameters from a gcode file. An export plugin is a script in the export_plugins folder which has the getOutput function, the globalIsReplaceable variable and if it's output is not replac...
natetrue/ReplicatorG
skein_engines/skeinforge-31/skeinforge_application/skeinforge_plugins/craft_plugins/export_plugins/static_plugins/gcode_small.py
Python
gpl-2.0
4,295