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
''' Almost exact same problem as leetcode 54 (except much easier) ''' def v1(n): matrix = [[0]*n for _ in range(n)] left, right = (0, n-1) up, down = (0, n-1) vert, horiz = (0, 1) row, col = (0, 0) for i in range(1, (n**2)+1): matrix[row][col] = i row += vert ...
myriasofo/CLRS_exercises
algos/leetcode/59_spiralMatrixV2.py
Python
mit
1,028
#!/usr/bin/env python3 from PIL import Image, ImageTk import tkinter from tkinter import ttk from tkinter import Button, Label, Menu from tkinter.filedialog import askopenfilename as file_selector from tkinter.filedialog import asksaveasfilename as file_saver from tkinter.filedialog import askdirectory from tkinter.me...
chichaj/PyFont
PyFont/tkmenu.py
Python
mit
4,510
from django.db import models from django_extensions.db.fields import AutoSlugField from core.models import Country class Constituency(models.Model): constituency_id = models.CharField(max_length=10, primary_key=True) name = models.CharField(max_length=765) country_name = models.CharField(max_length=255) ...
electionleaflets/electionleaflets
electionleaflets/apps/constituencies/models.py
Python
mit
971
# https://en.wikipedia.org/wiki/Exponentiation_by_squaring def pow(a, b, mod): res = 1 while b > 0: if b & 1 != 0: res = res * a % mod a = a * a % mod b >>= 1 return res def test(): print(1024 == pow(2, 10, 1000000007)) test()
indy256/codelibrary
python/binary_exponentiation.py
Python
unlicense
283
from bottle import route, run, static_file, request, post,response,template,hook import bottle bottle.TEMPLATE_PATH = ['osmquadtreeutils/static'] import rendertiles, rendersplit import sys,os import urllib,json import postds as ps import argparse smalls=[] def find_small(v): for i,s in enumerate(smalls): ...
jharris2268/osmquadtreeutils
osmquadtreeutils/__main__.py
Python
gpl-3.0
8,064
#!/usr/bin/python """ BACpypes Test ------------- """ import os import sys from bacpypes.debugging import bacpypes_debugging, ModuleLogger, xtob from bacpypes.consolelogging import ArgumentParser from bacpypes.pdu import Address from bacpypes.comm import bind from bacpypes.apdu import APDU, IAmRequest from bacpyp...
JoelBender/bacpypes
sandbox/i_am_reject_test_x.py
Python
mit
3,401
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import fileinput import glob import os import platform import psutil import shutil import signal import sys import telne...
Yukarumya/Yukarum-Redfoxes
testing/mozbase/mozrunner/mozrunner/devices/android_device.py
Python
mpl-2.0
30,367
from pytos.securechange.xml_objects.restapi.step.initialize import * logger = logging.getLogger(XML_LOGGER_NAME) class AbsNetwork(XML_Object_Base, metaclass=SubclassWithIdentifierRegistry): """Base class for parsing all network object""" @classmethod def from_xml_node(cls, xml_node): try: ...
Tufin/pytos
pytos/securechange/xml_objects/restapi/step/step.py
Python
apache-2.0
37,444
"""Unit tests for the Robot Framework Jenkins plugin source up-to-dateness collector.""" from ..jenkins_plugin_test_case import JenkinsPluginSourceUpToDatenessMixin from .base import RobotFrameworkJenkinsPluginTestCase class RobotFrameworkJenkinsPluginSourceUpToDatenessTest( # skipcq: PTC-W0046 JenkinsPluginSo...
ICTU/quality-time
components/collector/tests/source_collectors/robot_framework_jenkins_plugin/test_source_up_to_dateness.py
Python
apache-2.0
475
#!/usr/bin/env python3 # See [1] https://pubs.acs.org/doi/pdf/10.1021/j100247a015 # Banerjee, 1985 # [2] https://aip.scitation.org/doi/abs/10.1063/1.2104507 # Heyden, 2005 # [3] https://onlinelibrary.wiley.com/doi/abs/10.1002/jcc.540070402 # Baker, 1985 # [4] 10.1007/s002140050387 #...
eljost/pysisyphus
deprecated/optimizers/RSRFOptimizer.py
Python
gpl-3.0
5,961
def make_album(name, album='L.P', number=''): album_list = {} polling_active = True album_list = {'name':name,'album':album,'number':number} #while polling_active = True: while polling_active: name=input("\nWhat's the name?") album=input('\nPlease input the album') album_list...
lluxury/pcc_exercise
08/user_album.py
Python
mit
1,146
import _plotly_utils.basevalidators class TicklabelpositionValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__( self, plotly_name="ticklabelposition", parent_name="contour.colorbar", **kwargs ): super(TicklabelpositionValidator, self).__init__( plotly_name=plo...
plotly/plotly.py
packages/python/plotly/plotly/validators/contour/colorbar/_ticklabelposition.py
Python
mit
916
from scipy.linalg import norm import numpy as np from menpo.lucaskanade.appearance.base import AppearanceLucasKanade class AdaptiveForwardAdditive(AppearanceLucasKanade): type = 'AdaFA' def _align(self, lk_fitting, max_iters=20, project=True): # Initial error > eps error = self.eps + 1 ...
ikassi/menpo
menpo/lucaskanade/appearance/adaptive.py
Python
bsd-3-clause
8,415
import unittest import mock import github from github import Requester from prboard import utils, filters, settings, hub class TestGithub(unittest.TestCase): def setUp(self): pass def test_github_init(self): """ Test if Github gets instantiated with addditional methods """ g = hub....
kumarvaradarajulu/prboard
prboard/tests/unit/test_hub.py
Python
gpl-3.0
2,446
""" csv.py - read/write/investigate CSV files """ import re from _csv import Error, __version__, writer, reader, register_dialect, \ unregister_dialect, get_dialect, list_dialects, \ field_size_limit, \ QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, \ ...
lfcnassif/MultiContentViewer
release/modules/ext/libreoffice/program/python-core-3.3.0/lib/csv.py
Python
lgpl-3.0
16,123
from typing import Any from flask import g from psycopg2 import connect, extras def open_connection(config: dict[str, Any]) -> None: g.db = connect( database=config['DATABASE_NAME'], user=config['DATABASE_USER'], password=config['DATABASE_PASS'], port=config['DATABASE_PORT'], ...
craws/OpenAtlas
openatlas/database/connect.py
Python
gpl-2.0
785
import Pyro4 class Server(object): def welcomeMessage(self, name): return ("Hi welcome " + str (name)) def startServer(): server = Server() # make a Pyro daemon daemon = Pyro4.Daemon() # locate the name server running ns = Pyro4.locateNS() # register the se...
IdiosyncraticDragon/Reading-Notes
Python Parallel Programming Cookbook_Code/Chapter 5/Pyro4/First Example/server.py
Python
apache-2.0
726
from pycipher import PolybiusSquare import unittest class TestPolybius(unittest.TestCase): def test_encipher(self): keys = (('phqgiumeaylnofdxkrcvstzwb',5,'ABCDE'), ('uqfigkydlvmznxephrswaotcb',5,'BCDEF')) plaintext = ('abcdefghiiklmnopqrstuvwxyzabcdefghiiklmnopqrstuvwxyz', ...
jameslyons/pycipher
tests/test_polybius.py
Python
mit
1,597
# -*- coding: utf-8 -*- import os import sys import shutil import optparse import unittest TESTDIR = os.path.dirname(os.path.abspath(__file__)) SRCDIR = os.path.abspath(os.path.join(TESTDIR, os.path.pardir)) sys.path.insert(0, SRCDIR) from arachne.error import EmptyQueue from arachne.result import CrawlResult, Resul...
yasserglez/arachne
tests/testresultqueue.py
Python
gpl-3.0
6,369
#!/usr/local/bin/python3 # Python 3 class Country: index = {'cname':0,'population':1,'capital':2,'citypop':3,'continent':4, 'ind_date':5,'currency':6,'religion':7,'language':8} def __init__(self, row): self.__attr = row.split(',') # Added to support + and - se...
rbprogrammer/advanced_python_topics
course-material/py3/solutions/07 XML Processing/country.py
Python
apache-2.0
2,626
""" Solves a MMS problem with smooth control """ from firedrake import * from firedrake_adjoint import * import pytest try: from petsc4py import PETSc except ImportError: pass def solve_pde(u, V, m): v = TestFunction(V) F = (inner(grad(u), grad(v)) - m*v)*dx bc = DirichletBC(V, 0.0, "on_boundary"...
live-clones/dolfin-adjoint
tests_firedrake/optimization_tao/test_optimization_tao.py
Python
lgpl-3.0
2,124
from django.core.exceptions import ValidationError as DjangoValidationError from django.shortcuts import get_object_or_404 from rest_framework import fields, status from rest_framework.exceptions import ValidationError from rest_framework.response import Response from rest_framework.serializers import Serializer from ...
wagtail/wagtail
wagtail/admin/api/actions/move.py
Python
bsd-3-clause
1,612
from django.conf.urls import patterns, url from chatting.views import mainPage, addUser, userHome, joinChat, quitChat, getChat urlpatterns = patterns('', url(r'^main/$', mainPage.as_view(), name='home'), url(r'^add_user/$', addUser.as_view(), name='add_user'), url(r'^logged_user/$', userHome.as_view(), nam...
botchat/sampleGroupChat
chatting/urls.py
Python
gpl-2.0
518
# Hello, django! Please, load my template tags.
kmike/django-mootools-behavior
mootools_behavior/models.py
Python
mit
48
# coding: utf-8 # # drums-backend a simple interactive audio sampler that plays vorbis samples # Copyright (C) 2009 C.D. Immanuel Albrecht # # 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 Fou...
immo/pyTOM
df/df_ui_channels.py
Python
gpl-3.0
11,639
from dotmailer.templates import Template def test_get_all(connection): """ :param connection: :return: """ templates = Template.get_all() for template in templates: assert template.id is not None
Mr-F/dotmailer
tests/templates/test_get_all.py
Python
mit
231
# -*- coding: utf-8 -*- # Copyright(C) 2010-2011 Jocelyn Jaubert # # This file is part of weboob. # # weboob 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 Software Foundation, either version 3 of the License, or # (at yo...
sputnick-dev/weboob
modules/societegenerale/captcha.py
Python
agpl-3.0
4,384
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ownmusicweb.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure that ...
Lightshadow244/OwnMusicWeb
ownmusicweb/manage.py
Python
apache-2.0
809
__author__ = 'kaef' import uinput import time from pymouse import PyMouse class Clicker: def __init__(self): # self.device = uinput.Device([ # uinput.ABS_X + (0, 1920, 0, 0), # uinput.ABS_Y + (0, 1080, 0, 0), # # uinput.REL_X, # # uinput.REL_Y, # ...
bkolada/ibuk_scraper
Tool/Clicker.py
Python
gpl-3.0
1,699
from copy import copy from decimal import Decimal from typing import TYPE_CHECKING, Any, List, Optional, Union from django.db.models import QuerySet from django_countries.fields import Country from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange from . import ConfigurationTypeField from .models import Pl...
maferelo/saleor
saleor/extensions/base_plugin.py
Python
bsd-3-clause
14,742
# import asyncio # import pytest # from ai.backend.agent.server import ( # AgentRPCServer, # ) # TODO: rewrite ''' @pytest.fixture async def agent(request, tmpdir, event_loop): config = argparse.Namespace() config.namespace = os.environ.get('BACKEND_NAMESPACE', 'testing') config.agent_host = '127.0....
lablup/sorna-agent
tests/test_server.py
Python
lgpl-3.0
11,911
# Author: Jose G Perez # Version 1.0 # Last Modified: January 31, 2018 import pylab as plt import numpy as np def imshow(im, title=''): figure = plt.figure() plt.axis('off') plt.tick_params(axis='both', left='off', top='off', right='off', bottom='off', labelleft='off'...
DeveloperJose/Vision-Rat-Brain
feature_matching_v3/util_im.py
Python
mit
950
""" Account-related URLs. """ from django.conf.urls import patterns, url from django.views.generic import TemplateView from session_csrf import anonymous_csrf from . import views urlpatterns = patterns( "moztrap.view.users.views", # auth ------------------------------------------------------------------- ...
mozilla/moztrap
moztrap/view/users/urls.py
Python
bsd-2-clause
1,655
import ctypes import configparser import os import sys from PyQt5 import QtCore from PyQt5 import QtGui from PyQt5 import QtWidgets from PyQt5.QtPrintSupport import QPrintPreviewDialog from PyQt5.QtPrintSupport import QPrinter CONFIG_FILE_PATH = "notepad.ini" ctypes.windll.shell32.SetCurrentProcessExplicitAppUserMo...
golovatyi/1Term_Project
notepad.py
Python
mit
21,004
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>). # # This program is free software: you ca...
pato-kun/SSPP
Calificacion/__init__.py
Python
agpl-3.0
1,179
""" @created_at 2014-07-15 @author Exequiel Fuentes <efulet@gmail.com> @author Brian Keith <briankeithn@gmail.com> """ # Se recomienda seguir los siguientes estandares: # 1. Para codificacion: PEP 8 - Style Guide for Python Code (http://legacy.python.org/dev/peps/pep-0008/) # 2. Para documentacion: PEP 257 - Docst...
efulet/pca
pca/main.py
Python
mit
3,043
config = { "interfaces": { "google.spanner.admin.database.v1.DatabaseAdmin": { "retry_codes": { "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], "non_idempotent": [], }, "retry_params": { "default": { ...
tseaver/google-cloud-python
spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client_config.py
Python
apache-2.0
2,633
import json from collections import ( Counter, defaultdict as deft ) from copy import deepcopy as cp # from cPickle import ( # dump as to_pickle, # load as from_pickle # ) from StringIO import StringIO from TfIdfMatrix import TfIdfMatrix from Tools import from_csv class CategoryTree: de...
JordiCarreraVentura/spellchecker
lib/CategoryTree.py
Python
gpl-3.0
7,145
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from config.template_middleware import TemplateResponse from gaecookie.decorator import no_csrf from gaepermission.decorator import login_not_required __author__ = 'Rodrigo' @login_not_required @no_csrf def index(): return TemplateR...
rmmariano/ProjScriptsTekton
backend/appengine/routes/meuperfil/caixaesquerda/meusitens.py
Python
mit
397
#!/usr/bin/env python """Provides the interface to define and manage policy and a repository to store and retrieve policy and templates for policy definitions, aka attribute authority. @see https://confluence.oceanobservatories.org/display/syseng/CIAD+COI+OV+Policy+Management+Service """ __author__ = 'Stephen P. Hen...
ooici/coi-services
ion/services/coi/policy_management_service.py
Python
bsd-2-clause
29,836
# Copyright (c) 2011 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 ...
dstroppa/openstack-smartos-nova-grizzly
nova/tests/api/openstack/compute/contrib/test_hosts.py
Python
apache-2.0
15,292
import uuid from django.core.management.base import BaseCommand from ...models import VirtualMachine from ...helpers import call_api class Command(BaseCommand): help = "Migrates VMs over from the old Conductor system" def handle(self, *args, **options): containers = call_api("container.list") ...
tjcsl/director
web3/apps/vms/management/commands/migrate_vms.py
Python
mit
618
import time _config_ = { 'timeout': 3, 'noparallel': True } def test(): for i in range(0, 6): time.sleep(1)
zstackorg/zstack-woodpecker
zstackwoodpecker/test/cases/test2.py
Python
apache-2.0
146
import itertools import numpy as np import matplotlib.pyplot as plt import ad3 grid_size = 20 num_states = 5 factor_graph = ad3.PFactorGraph() multi_variables = [] random_grid = np.random.uniform(size=(grid_size, grid_size, num_states)) for i in xrange(grid_size): multi_variables.append([]) for j in xrange(...
pystruct/AD3
python/example_grid.py
Python
lgpl-3.0
1,480
# -*- coding: utf-8 -*- import matplotlib import matplotlib.pyplot as plt import numpy as np import pytest from peakdet import operations from peakdet.physio import Physio from peakdet.tests import utils as testutils data = np.loadtxt(testutils.get_test_data_path('ECG.csv')) WITHFS = Physio(data, fs=1000.) NOFS = Phy...
rmarkello/peakdet
peakdet/tests/test_operations.py
Python
gpl-3.0
3,484
# # This file is part of Chadwick # Copyright (c) 2002-2022, Dr T L Turocy (ted.turocy@gmail.com) # Chadwick Baseball Bureau (http://www.chadwick-bureau.com) # # FILE: src/python/chadwick/__init__.py # Top-level module file for Chadwick Python library # # This program is free software; you can ...
chadwickbureau/chadwick
src/python/chadwick/__init__.py
Python
gpl-2.0
1,210
from anki import Collection from .json_serializable import JsonSerializableAnkiDict from ..utils.uuid import UuidFetcher class DeckConfig(JsonSerializableAnkiDict): def __init__(self, anki_deck_config=None): super(DeckConfig, self).__init__(anki_deck_config) @classmethod def from_collection(cls, ...
Stvad/CrowdAnki
crowd_anki/representation/deck_config.py
Python
mit
1,224
from __future__ import division import warnings from sympy import Abs, Rational, Float, S, Symbol, cos, pi, sqrt, oo from sympy.functions.elementary.trigonometric import tan from sympy.geometry import (Circle, Ellipse, GeometryError, Point, Polygon, Ray, RegularPolygon, Segment, Triangle, are_similar, ...
kaichogami/sympy
sympy/geometry/tests/test_polygon.py
Python
bsd-3-clause
13,890
#!/usr/bin/python3 """Install a 'blob' file from an extract shell archive. This script installs the 3rd party blob contained in a previously downloaded extract-*.sh file. This avoids the need to have to page through and accept the user agreement (which is what you have to do if you execute the archive directly). """ ...
thanm/devel-scripts
blobinstall.py
Python
apache-2.0
1,391
import json from django import forms from django.contrib.admin import helpers from django.contrib.admin.views.decorators import staff_member_required from django.core.urlresolvers import reverse from django.forms.utils import ErrorDict, ErrorList, flatatt from django.utils.decorators import method_decorator from djang...
ninapavlich/django-batch-uploader
django_batch_uploader/views.py
Python
mit
3,562
from bedrock.redirects.util import redirect redirectpatterns = ( # Bug 608370, 957664 redirect(r'^press/kit(?:.*\.html|s/?)$', 'https://blog.mozilla.org/press/kits/'), # bug 877198 redirect(r'^press/news\.html$', 'http://blog.mozilla.org/press/'), redirect(r'^press/mozilla-2003-10-15\.html$', ...
l-hedgehog/bedrock
bedrock/press/redirects.py
Python
mpl-2.0
13,621
#!/usr/bin/env python """ Your task is to process the supplied file and use the csv module to extract data from it. The data comes from NREL (National Renewable Energy Laboratory) website. Each file contains information from one meteorological station, in particular - about amount of solar and wind energy for each hour...
tuanvu216/udacity-course
data_wrangling_with_mongodb/Lesson_1_Problem_Set/01-Using_CSV_Module/parsecsv.py
Python
mit
1,477
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import re import string import glob import sys if sys.version_info[0] == 2: def CmdArgsGetParser(usage): reload(sys) sys.setdefaultencoding('utf-8') from optparse import OptionParser return OptionParser('usage: %prog ' + usa...
xresloader/xresloader
tools/print_pb_bin.py
Python
mit
5,217
from base import * ## TEST CONFIGURATION TEST_RUNNER = 'discover_runner.DiscoverRunner' TEST_DISCOVER_TOP_LEVEL = SITE_ROOT TEST_DISCOVER_ROOT = SITE_ROOT TEST_DISCOVER_PATTERN = "test_*.py" ## END TEST CONFIGURATION ## DATABASE CONFIGURATION DATABASES = { "default": { "ENGINE": "django.db.backends.sqli...
megaprojectske/megaprojects.co.ke
megaprojects/megaprojects/settings/test.py
Python
apache-2.0
477
__author__ = 'ch'
scrumthing/pytm1
pytm1/__init__.py
Python
apache-2.0
18
#!/usr/bin/env python3 import asyncio import os import re import subprocess import sys import time import tornado.httpserver import tornado.ioloop import tornado.template import tornado.web def log(fmt, *args): if not args: sys.stderr.write(str(fmt) + '\n') else: sys.stderr.write((str(fmt) % a...
apenwarr/gitbuilder
viewer/run.py
Python
gpl-2.0
2,875
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Post.user' db.add_column(u'posts_post', 'user', ...
erkarl/browl-api
apps/posts/migrations/0002_auto__add_field_post_user.py
Python
mit
4,225
# -*- coding: utf-8 -*- """ celery.registry ~~~~~~~~~~~~~~~ Registry of available tasks. :copyright: (c) 2009 - 2011 by Ask Solem. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import inspect from .exceptions import NotRegistered class TaskRegistry(di...
mzdaniel/oh-mainline
vendor/packages/celery/celery/registry.py
Python
agpl-3.0
1,926
"""Config flow to configure the MJPEG IP Camera integration.""" from __future__ import annotations from http import HTTPStatus from types import MappingProxyType from typing import Any import requests from requests.auth import HTTPBasicAuth, HTTPDigestAuth from requests.exceptions import HTTPError, Timeout import vol...
rohitranjan1991/home-assistant
homeassistant/components/mjpeg/config_flow.py
Python
mit
8,269
from django.db import connection from calaccess_campaign_browser import models from calaccess_campaign_browser.management.commands import CalAccessCommand class Command(CalAccessCommand): help = "Drops all CAL-ACCESS campaign browser database tables" def handle(self, *args, **options): self.header("D...
myersjustinc/django-calaccess-campaign-browser
calaccess_campaign_browser/management/commands/dropcalaccesscampaignbrowser.py
Python
mit
1,320
import os from setuptools import setup import re # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(os.path.join(...
autosportlabs/ASL_F4_bootloader
setup.py
Python
gpl-2.0
1,836
#!/usr/bin/env python # Copyright 2014 the V8 project 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 argparse import json import os import sys import urllib from common_includes import * import chromium_roll class CheckActiv...
mxOBS/deb-pkg_trusty_chromium-browser
v8/tools/push-to-trunk/auto_roll.py
Python
bsd-3-clause
4,392
#!/usr/bin/python # -*- coding: utf-8 -*- """ This script fixes links that contain common spelling mistakes. This is only possible on wikis that have a template for these misspellings. Command line options: -always:XY instead of asking the user what to do, always perform the same action. For exam...
icyflame/batman
scripts/misspelling.py
Python
mit
7,040
""" Tests topology manipulation tools """ import collections import pytest import moldesign as mdt from moldesign import units as u registered_types = {} def typedfixture(*types, **kwargs): """This is a decorator that lets us associate fixtures with one or more arbitrary types. We'll later use this type t...
tkzeng/molecular-design-toolkit
moldesign/_tests/test_tools.py
Python
apache-2.0
2,517
""" Represent either BED12 or genePred transcripts as objects. Allows for conversion of coordinates between chromosome, mRNA and CDS coordinate spaces. Can slice objects into subsets. """ import collections from itertools import izip from bx.intervals.cluster import ClusterTree from mathOps import find_closest, find_in...
ucsc-mus-strain-cactus/Comparative-Annotation-Toolkit
tools/transcripts.py
Python
apache-2.0
35,144
import scipy import sqlite3 import os import sys sys.path.append('../') import CIAO_DatabaseTools connection = sqlite3.connect(os.environ.get('GRAVITY_SQL')+'GravityObs.db') cursor = connection.cursor() cursor.execute("""DROP TABLE GRAVITY_OBS;""") #""" #sqlCommand = """ #CREATE TABLE GRAVITY_OBS ( #TIMESTAMP FL...
soylentdeen/Graffity
src/SQLTools/buildGRAVITYDatabase.py
Python
mit
613
from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_oauthlib.client import OAuth from config import config db = SQLAlchemy() oa = OAuth() lm = LoginManager() lm.login_view = 'main.login' from app.models import User @lm.user_loader def load_user(id): r...
Encrylize/MyDictionary
app/__init__.py
Python
mit
790
import pypsa #NB: this test doesn't work for other cases because transformer tap #ratio and phase angle not supported for lpf from pypower.api import ppoption, runpf, case30 as case from pypower.ppver import ppver from distutils.version import StrictVersion pypower_version = StrictVersion(ppver()['Version']) import...
PyPSA/PyPSA
test/test_lpf_against_pypower.py
Python
mit
2,335
import sys test_cases = open(sys.argv[1], 'r') for test in test_cases: striptest = test.replace(" ",'') # print striptest acc = 0 for x in range(0, 16, 2): acc += 2 * int(striptest[x]) for x in range(1, 16, 2): acc += int(striptest[x]) # print acc if acc % 10 == 0: print "Real" else: print "...
lavahot/codeeval_python
fakecc/fakecc.py
Python
gpl-3.0
346
from django.contrib import admin from simulation.models import SimulationStage, SimulationStageMatch, SimulationStageMatchResult class SimulationStageAdmin(admin.ModelAdmin): list_display = ["number", "created_at"] list_filter = ["created_at"] class SimulationStageMatchAdmin(admin.ModelAdmin): list_disp...
bilbeyt/ituro
ituro/simulation/admin.py
Python
mit
972
import urllib2, HTMLParser import re text_file = open("shakespeare.txt", 'w') class HTMLShakespeareParser(HTMLParser.HTMLParser): def handle_starttag(self, tag, attrs): if tag == "a": link = dict(attrs)["href"] if "/index.html" in link: works.append(link[:-11]) works = [] html_index_file = urllib2.urlop...
amiller27/First-Experiences-in-Research
writer/shakespeare_get.py
Python
gpl-2.0
722
# -*- coding: utf-8 -*- # code for console Encoding difference. Dont' mind on it import sys import imp imp.reload(sys) try: sys.setdefaultencoding('UTF8') except Exception as E: pass import testValue from popbill import MessageService, MessageReceiver, PopbillException messageService = MessageService(testVa...
linkhub-sdk/popbill.message.example.py
sendMMS_multi.py
Python
mit
2,932
from datetime import datetime, timedelta, timezone import dateutil.parser import dateutil.tz as tz class TestReport: def test_report(self, helper): user = helper.admin_user() # Create devices device0 = helper.given_new_device(self) device0.location = [20.00025, 20.00025] d...
TheCacophonyProject/Full_Noise
test/test_report.py
Python
agpl-3.0
5,424
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
polyaxon/polyaxon
core/polyaxon/proxies/generators/api.py
Python
apache-2.0
924
from rest_framework import permissions class IsUserOwner(permissions.BasePermission): def has_object_permission(self, request, view, user): if request.user: return request.user == user return False
weichen2046/IntellijPluginDevDemo
enterprise-repo/enterprepo/apiv1/permissions.py
Python
apache-2.0
230
"""empty message Revision ID: 75ad68311ea9 Revises: a578b9de5d89 Create Date: 2016-12-13 23:01:43.813979 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '75ad68311ea9' down_revision = 'a578b9de5d89' branch_labels = None depends_on = None def upgrade(): # ...
Lifeistrange/flaskweb
migrations/versions/75ad68311ea9_.py
Python
mit
795
MODULE_INFO = { 'animation': {'path': 'animation/animation-min.js', 'requires': ['dom', 'event'], 'type': 'js'}, 'autocomplete': {'optional': ['connection', 'animation'], 'path': 'autocomplete/autocomplete-min.js', 'requires': ['dom', 'ev...
akaihola/django-yui-loader
yui_loader/module_info_2_7_0.py
Python
bsd-3-clause
9,269
#!/usr/bin/python # # Created on Aug 25, 2016 # @author: Gaurav Rastogi (grastogi@avinetworks.com) # Eric Anderson (eanderson@avinetworks.com) # module_check: supported # Avi Version: 16.3.8 # # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the te...
0x46616c6b/ansible
lib/ansible/modules/network/avi/avi_role.py
Python
gpl-3.0
3,591
""" Video player in the courseware. """ import time import requests from selenium.webdriver.common.action_chains import ActionChains from bok_choy.page_object import PageObject from bok_choy.promise import EmptyPromise, Promise from bok_choy.javascript import wait_for_js, js_defined import logging log = logging.getLo...
rue89-tech/edx-platform
common/test/acceptance/pages/lms/video/video.py
Python
agpl-3.0
25,834
""" WSGI config for minitwitter project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATIO...
slok/minitwitter
minitwitter/minitwitter/wsgi.py
Python
bsd-3-clause
1,440
#!/usr/bin/env python import os import sys os.path.dirname(__file__) if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
micfan/dinner
src/manage.py
Python
mit
277
import math from probe import functions from probe import statchar import pygal import os """ 1. empirical_cdf 2. empirical_cdf-graph 3. compare 4. compare_cdf_with_theoretical 1. Kolmogorov distribution 2. Normal distribution 3. Fisher distribution 4. t-distribution 5. chi-squared distribution 6. Poisson distributi...
Mystfinder/probe-2
probe/distributions.py
Python
gpl-2.0
22,738
# -*- coding: utf-8 -*- """ Copyright 2013-2014 Olivier Cortès <oc@1flow.io> This file is part of the 1flow project. 1flow 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 Software Foundation, either versio...
EliotBerriot/1flow
oneflow/core/forms/preferences.py
Python
agpl-3.0
1,443
""" This package provides support for writing plugins for Spyke Viewer. It belongs to `spykeutils` so that plugins can be executed in an evironment where the `spykeviewer` package and its dependencies are not installed (e.g. servers). `spykeutils` installs a script named "spykeplugin" that can be used to start plugins...
rproepp/spykeutils
spykeutils/plugin/__init__.py
Python
bsd-3-clause
1,020
# -*- coding: utf-8 -*- from copy import deepcopy from django.contrib import admin from django.contrib.admin import site from django.contrib.auth import get_user_model from django.contrib.auth.admin import UserAdmin from django.contrib.sites.models import Site from django.db import OperationalError from django.utils.t...
benzkji/django-cms
cms/admin/permissionadmin.py
Python
bsd-3-clause
6,844
#!/usr/bin/python2 # check_memcache.py # # Copyright 2012 Silvio Knizek <silvio.knizek@gmx.de> # # 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 y...
killermoehre/nagios-plugins
check_memcache.py
Python
gpl-2.0
3,173
# encoding: utf-8 from south.v2 import DataMigration from sanetime import time class Migration(DataMigration): def forwards(self, orm): now = time() orm.AccountType.objects.create( name='Webex Meeting Center', username_label='??', extra_username_label='???', ...
prior/webinars
webinars_web/webinars/migrations/0059_webex_meeting_center.py
Python
apache-2.0
32,605
from intent.igt.metadata import set_meta_attr, find_meta, find_meta_attr, set_meta_text from yggdrasil.consts import USER_META_ATTR, RATING_META_TYPE, QUALITY_META_ATTR, RATINGS, RATINGS_REV, \ EDITOR_METADATA_TYPE, COMMENT_META_TYPE, REASON_META_ATTR def set_rating(inst, user, rating, reason): set_meta_attr(...
xigt/yggdrasil
yggdrasil/metadata.py
Python
mit
1,348
# -*- coding: utf-8 -*- # 2012 L. Amber Wilcox-O'Hearn # test_real_word_vocab_extractor.py from malaprop.error_insertion import real_word_vocabulary_extractor import unittest, StringIO class RealWordVocabExtractorTest(unittest.TestCase): def test_real_word_vocab_extactor(self): vocab_file_obj = open...
ambimorph/malaprop
malaprop/test/test_real_word_vocabulary_extractor.py
Python
agpl-3.0
1,645
from PyPDF2 import PdfFileWriter, PdfFileReader from reportlab.pdfgen import canvas c = canvas.Canvas('watermark.pdf') c.drawImage('testplot.png', 350, 550, width=150, height=150) # , mask=None, preserveAspectRatio=False) # c.drawString(15, 720, "Hello World") c.save() c = canvas.Canvas('watermark2.pdf') c.drawIm...
KatiRG/flyingpigeon
scripts/pngintopdftemplate.py
Python
apache-2.0
1,118
'''An example of using :class:`AreaDetector`''' import time import config from ophyd import SimDetector from ophyd import (ImagePlugin, TIFFPlugin, ProcessPlugin, OverlayPlugin, Component as Cpt) logger = config.logger class MyDetector(SimDetector): image1 = Cpt(ImagePlugin, 'image1:') ...
dchabot/ophyd
examples/areadetector.py
Python
bsd-3-clause
1,836
""" KBase narrative service and method API. The main classes defined here are :class:`Service` and :class:`ServiceMethod`. See :func:`example` for an example of usage. """ __author__ = ["Dan Gunter <dkgunter@lbl.gov>", "William Riehl <wjriehl@lbl.gov>"] __version__ = "0.0.1" ## Imports # Stdlib from collections impo...
msneddon/narrative
src/biokbase/narrative/common/service.py
Python
mit
37,656
# -*- coding: utf-8 -*- # # # OpenERP, Open Source Management Solution # This module copyright (C) 2016 Sucros Clear Information Technologies PLC. # This module copyright (C) 2014 Therp BV (<http://therp.nl>). # # This program is free software: you can redistribute it and/or modify # it under the terms o...
Clear-ICT/odoo-addons
content_cleanup/__openerp__.py
Python
agpl-3.0
1,294
import json import os from django import forms from django.core.urlresolvers import reverse_lazy from django.template import Context from django.template.loader import render_to_string from django.utils.safestring import mark_safe from django.forms.util import flatatt from django_summernote.settings import summernote_c...
gquirozbogner/contentbox-master
third_party/django_summernote/widgets.py
Python
apache-2.0
3,743
# ---------------------------------------------------------------------- # # Brad T. Aagaard, U.S. Geological Survey # # This code was developed as part of the Computational Infrastructure # for Geodynamics (http://geodynamics.org). # # Copyright (c) 2010-2017 University of California, Davis # # See COPYING for license...
geodynamics/spatialdata
spatialdata/spatialdb/SimpleDB.py
Python
mit
2,610
# Doc target. # # Copyright (C) 2015 Denis BOURGE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any la...
Srynetix/hx3d-framework
builds/doc.py
Python
lgpl-3.0
1,246
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from udata.models import Reuse, Dataset from .models import Discussion def discussions_for(user, only_open=True): ''' Build a queryset to query discussions related to a given user's assets. It includes discussions coming f...
jphnoel/udata
udata/core/discussions/actions.py
Python
agpl-3.0
871
# -*- coding: utf-8 -*- # # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2004-2006 Donald N. Allingham # # 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 t...
jralls/gramps
gramps/gen/datehandler/_date_pt.py
Python
gpl-2.0
6,889
#This submodule includes routines to manipulate image arrays import numpy as np from scipy.interpolate import griddata from utilities.imaging.fitting import legendre2d import pdb def unpackimage(data,xlim=[-1,1],ylim=[-1,1],remove=True): """Convert a 2D image into x,y,z coordinates. x will relate to 2nd index...
rallured/utilities
imaging/man.py
Python
mit
8,204
import functools import hashlib import os import time from collections import namedtuple from azure.mgmt.servicebus import ServiceBusManagementClient from azure.mgmt.servicebus.models import SBQueue, SBSubscription, AccessRights from azure_devtools.scenario_tests.exceptions import AzureTestError from devtools_testut...
Azure/azure-sdk-for-python
sdk/servicebus/azure-servicebus/tests/servicebus_preparer.py
Python
mit
25,718