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
#!/usr/bin/python import multiprocessing import os, re, errno import subprocess def purge(dir, pattern): for f in os.listdir(dir): if re.search(pattern, f): os.remove(os.path.join(dir, f)) def mkdir_p(path): try: os.makedirs(path) except OSError as exc: ...
OasisLMF/ktools
examples/pltcalc_example.py
Python
bsd-3-clause
2,488
""" Tests that duplicate columns are handled appropriately when parsed by the CSV engine. In general, the expected result is that they are either thoroughly de-duplicated (if mangling requested) or ignored otherwise. """ from io import StringIO import pytest from pandas import DataFrame import pandas._testing as tm ...
pandas-dev/pandas
pandas/tests/io/parser/test_mangle_dupes.py
Python
bsd-3-clause
4,824
from datetime import date, timedelta from django.test.client import Client from django.contrib.auth.models import User from django.db.models import Q from django.core.urlresolvers import reverse from django.core.cache import cache from model_mommy import mommy from django.test import TestCase from django.utils.safestri...
unicefuganda/uSurvey
survey/tests/template_tags/test_template_tags.py
Python
bsd-3-clause
20,720
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Steven Cummings' __email__ = 'estebistec@gmail.com' __version__ = '0.1.0'
estebistec/django-get-forms
django_get_forms/__init__.py
Python
bsd-3-clause
134
# 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. """Handles generating profiles and transferring them to/from mobile devices.""" import logging import optparse import os import shutil import sys import tem...
mogoweb/chromium-crosswalk
tools/telemetry/telemetry/page/profile_generator.py
Python
bsd-3-clause
3,960
def extractTeatimetranslateHomeBlog(item): ''' Parser for 'teatimetranslate.home.blog' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('Adore Trick of Beauty', 'Adore Trick of Beauty', ...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractTeatimetranslateHomeBlog.py
Python
bsd-3-clause
656
from __future__ import absolute_import, division, print_function from .core import istask, get from .context import set_options try: from .imperative import do, value except ImportError: pass __version__ = '0.6.1'
jayhetee/dask
dask/__init__.py
Python
bsd-3-clause
225
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PubMedVis.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
whitews/PubMedVis
manage.py
Python
bsd-3-clause
252
# Hierarchical Agglomerative Cluster Analysis # # Copyright (C) 2013 Folgert Karsdorp # Author: Folgert Karsdorp <fbkarsdorp@gmail.com> # URL: <https://github.com/fbkarsdorp/HAC-python> # For licence information, see LICENCE.TXT class AbstractClusterer(object): """ Abstract interface covering basic clustering...
mikekestemont/PyStyl
pystyl/clustering/api.py
Python
bsd-3-clause
2,483
# Generated by Django 2.2.17 on 2020-12-18 21:39 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("treenav", "0002_auto_20151001_1646"), ] operations = [ migrations.AlterField( model_name="menuitem", name="level", ...
caktus/django-treenav
treenav/migrations/0003_mptt_drop_indexes.py
Python
bsd-3-clause
729
#!/usr/bin/env python """ LICENCE ------- Copyright 2013 by Kitware, Inc. All Rights Reserved. Please refer to KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. """ def main(): import flask import mimetypes import os.path...
anguoyang/SMQTK
OLD_ROOT/run_static_server.py
Python
bsd-3-clause
1,381
#coding=utf-8 import datetime import time from django.test import TestCase from .models import * from pgindex.models import Index from pgindex.helpers import search LOREM = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' LOREM_SV = u'Femto...
aino/django-pgindex
tests/pgindex_tests/tests.py
Python
bsd-3-clause
3,716
import json from requests import HTTPError class DjrillError(Exception): """Base class for exceptions raised by Djrill Overrides __str__ to provide additional information about Mandrill API call and response. """ def __init__(self, *args, **kwargs): """ Optional kwargs: ...
brack3t/Djrill
djrill/exceptions.py
Python
bsd-3-clause
4,460
from setuptools import find_packages, setup setup( name='HX711', packages=['.'], version='1.0.0', description='HX711 chip interface library', author='gandalf15@github', license='BSD 3-Clause', )
gandalf15/HX711
HX711_Python3/setup.py
Python
bsd-3-clause
220
c = get_config() ## Generic nbgrader options (technically, the exchange directory is not used ## by the formgrader, but it is left in here for consistency with the rest of ## the user guide): c.NbGrader.course_id = "example_course" c.TransferApp.exchange_directory = "/tmp/exchange" ## Options that are specific to th...
minrk/nbgrader
docs/source/user_guide/jupyterhub/nbgrader_config.py
Python
bsd-3-clause
1,813
# -*- coding: utf-8 -*- import os # For different service SITE_NAME = 'Dentimonial' TRACKING_HASHTAG = '#dentimonial' TWEET_ACTION_NAME = 'Send' SERVICE_NAME = 'Identi.ca' SERVICE_URI = 'http://identi.ca/' FOLLOWERS_NAME = 'Subscribers' FOLLOWED_NAME = 'Subscribed' FOLLOW_NAME = 'Subscribe to' TWEET_NAME = 'Notice' ...
livibetter-backup/twimonial
dentsrc/config_base.py
Python
bsd-3-clause
1,453
from Chip import OpCodeDefinitions from Tests.OpCodeTests.OpCodeTestBase import OpCodeTestBase class TestEorOpCode(OpCodeTestBase): def test_eor_indirect_x_command_calls_eor_method(self): self.assert_opcode_execution(OpCodeDefinitions.eor_indirect_x_command, self.target.get_eor_command_executed) def...
jeroanan/Nes2
Tests/OpCodeTests/TestEorOpCode.py
Python
bsd-3-clause
1,700
# -*- coding: utf-8 -*- import os import urllib.parse as urlparse import warnings from unittest.mock import patch from oauthlib import common, signals from oauthlib.oauth2 import ( BackendApplicationClient, Client, LegacyApplicationClient, MobileApplicationClient, WebApplicationClient, ) from oauthlib.oauth2.r...
idan/oauthlib
tests/oauth2/rfc6749/clients/test_web_application.py
Python
bsd-3-clause
11,045
from . import numpy as np from . import FILE_1, reset_image_set import pytest from pdsspect.roi import Rectangle, Polygon from pdsspect.pan_view import PanViewController, PanView, PanViewWidget from pdsspect.pdsspect_image_set import PDSSpectImageSet, SubPDSSpectImageSet class TestPanViewController(object): ima...
planetarypy/pdsspect
tests/test_pan_view.py
Python
bsd-3-clause
12,114
from django.core.management import BaseCommand from corehq.apps.sms.tests.data_generator import create_fake_sms class Command(BaseCommand): help = """ Generates a few fake SMS message models for a domain, for testing. """ def add_arguments(self, parser): parser.add_argument('domain') ...
dimagi/commcare-hq
corehq/apps/sms/management/commands/generate_fake_sms_data.py
Python
bsd-3-clause
636
from PropertiesBlueZInterface import PropertiesBlueZInterface from ServiceInterface import ServiceInterface from errors import raise_dbus_error import dbus import xml.dom.minidom class Device(PropertiesBlueZInterface): @raise_dbus_error def __init__(self, obj_path=None): if self.__class__.get_interfac...
nmercier/linux-cross-gcc
linux/lib/python2.7/dist-packages/blueman/bluez/Device.py
Python
bsd-3-clause
1,722
import os import codecs from datetime import datetime from stat import ST_MTIME, ST_CTIME from re import search from django.conf import settings from django.contrib.auth.decorators import login_required, user_passes_test from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ObjectD...
buriy/django-templatesadmin
templatesadmin/views.py
Python
bsd-3-clause
8,863
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
goddardl/gaffer
python/GafferUI/ExpressionUI.py
Python
bsd-3-clause
5,817
from behave import * import nose.tools import json import numpy import os import subprocess import sys import tempfile import toyplot try: import toyplot.mp4 except: pass try: import toyplot.webm except: pass @given(u'an animated canvas') def step_impl(context): context.canvas = toyplot.Canvas(...
cmorgan/toyplot
features/steps/animation.py
Python
bsd-3-clause
2,424
""" This module implements the "new" binary OpenEphys format. In this format channels are interleaved in one file. See https://open-ephys.github.io/gui-docs/User-Manual/Recording-data/Binary-format.html Author: Julia Sprenger and Samuel Garcia """ import os import re import json from pathlib import Path import n...
apdavison/python-neo
neo/rawio/openephysbinaryrawio.py
Python
bsd-3-clause
16,829
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2022, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
qiime2/q2-feature-table
q2_feature_table/_summarize/_visualizer.py
Python
bsd-3-clause
11,912
from __future__ import annotations from scitbx.array_family import flex from dials.algorithms.image.filter import convolve from dials.algorithms.statistics import BinnedStatistics # Module-level definition imported by the image viewer phil_str = """ n_iqr = 6 .type = int .help = "IQR multiplier for determini...
dials/dials
extensions/radial_profile_spotfinder_threshold_ext.py
Python
bsd-3-clause
5,140
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import subprocess from flask.ext.script import Manager, Shell, Server from flask.ext.migrate import MigrateCommand from alexistheman.app import create_app from alexistheman.user.models import User from alexistheman.settings import DevConfig, ProdConfig...
gurkslask/alexistheman
manage.py
Python
bsd-3-clause
1,122
from django.test import TestCase class TemplateTagTestCases(TestCase): pass
designcc/django-ccpages
ccpages/tests/test_templatetags.py
Python
bsd-3-clause
81
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: Simplified BSD import os.path as op import warnings import numpy as np from nose.tools import assert_true, assert_raises from numpy.testing import assert_allclose from mne.viz.utils import (compare_fiff, _fake_click, _compute_scaling...
alexandrebarachant/mne-python
mne/viz/tests/test_utils.py
Python
bsd-3-clause
4,889
# Copyright 2015 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 unittest from telemetry.value import summarizable class SummarizableTest(unittest.TestCase): def testAsDictWithoutImprovementDirection(self): ...
SummerLW/Perf-Insight-Report
telemetry/telemetry/value/summarizable_unittest.py
Python
bsd-3-clause
1,168
import os import os.path as op import re import warnings import numpy as np from scipy import io as spio from mne import Epochs, write_evokeds from mne.defaults import DEFAULTS from mne.epochs import combine_event_ids from mne.externals.h5io import write_hdf5 from mne.io import read_raw_fif, concatenate_raws from mne....
ktavabi/mnefun
mnefun/_epoching.py
Python
bsd-3-clause
15,977
import os import sys import re import glob import copy import subprocess """ args: - parallel: max number of parallel sessions mobatch will use. default=10. - bin_path: path, if moshell/mobatch binaries are installed in a non-standard location. """ class Amos: def...
jeffleary00/amos
amoshell/amoshell.py
Python
bsd-3-clause
12,968
from minishift.font import font class Interface(object): """An ABC for Minishift interfaces.""" def send(self, data): """Sends data to the minishift.""" raise NotImplementedError class MCP2210Interface(Interface): """An interface implementation that communicates over the MCP2210 USB-SPI ...
arachnidlabs/minishift-python
minishift/draw.py
Python
bsd-3-clause
5,183
"""Performs a number of path mutation and monkey patching operations which are required for Olympia to start up correctly. This is imported into manage.py and wsgi.py. This is executed when celery starts up by way of `bin/celery --app=olympia` where `olympia` is this module. This docstring will probably be wrong by ...
jpetto/olympia
src/olympia/startup.py
Python
bsd-3-clause
2,705
#!/usr/bin/env python # Author Michele Mattioni # Fri Apr 9 11:35:29 BST 2010 """Main script to start Neuronvisio""" from neuronvisio.controls import Controls import sys if __name__ == '__main__': controls = Controls() if len(sys.argv) == 2: controls.load(sys.argv[1])
mattions/TimeScales
nrnvisio.py
Python
bsd-3-clause
309
import unittest import asyncio import pulsar class Context: def __enter__(self): return self def __exit__(self, type, value, traceback): self._result = value return True class TestApi(unittest.TestCase): @asyncio.coroutine def test_with_statement(self): with Conte...
dejlek/pulsar
tests/async/api.py
Python
bsd-3-clause
1,062
#!/usr/bin/env python import jip.utils as utils import pytest @pytest.mark.parametrize('data', [60, '1h', '60m', '3600s', "01:00:00"]) def test_parse_time_minutes(data): assert utils.parse_time(data) == 60 @pytest.mark.parametrize('data', [90, '1h30m', '90m', '30m3600s', '1:30']) def test_parse_time_timestamp(d...
thasso/pyjip
test/test_utils.py
Python
bsd-3-clause
564
from pulsar.utils.structures import inverse_mapping ASYNC_IO = 1 # run in the worker event loop THREAD_IO = 3 # run in the event loop executor CPUBOUND = 4 # run in a subprocess concurrency = {'asyncio': ASYNC_IO, 'thread': THREAD_IO, 'process': CPUBOUND} concurren...
quantmind/pulsar-queue
pq/utils/concurrency.py
Python
bsd-3-clause
365
# -*- coding: utf-8 -*- """Defines fixtures available to all tests.""" import pytest from webtest import TestApp from chamberlain.app import create_app from chamberlain.database import db as _db from chamberlain.settings import TestConfig from .factories import UserFactory @pytest.yield_fixture(scope='function') d...
sean-abbott/chamberlain
tests/conftest.py
Python
bsd-3-clause
938
import collections import six from ..compat \ import \ OrderedDict from ..bundled.traitlets \ import \ HasTraits, Dict, Instance from ..errors \ import \ DepSolverError from ..pool \ import \ Pool Decision = collections.namedtuple("Decision", ["literal", "reason"]) c...
enthought/depsolver
depsolver/solver/decisions.py
Python
bsd-3-clause
4,814
from mozdns.api.tests.basic import *
rtucker-mozilla/mozilla_inventory
mozdns/api/tests/all.py
Python
bsd-3-clause
37
#!/usr/bin/env python3 # # Tests the easy optimisation methods fmin and curve_fit. # # This file is part of PINTS (https://github.com/pints-team/pints/) which is # released under the BSD 3-clause license. See accompanying LICENSE.md for # copyright notice and full license details. # import pints import unittest import ...
martinjrobins/hobo
pints/tests/test_opt_easy_optimisation.py
Python
bsd-3-clause
3,247
import json import logging import os import re import requests import traceback from datetime import datetime from django.conf import settings from django.contrib.auth.models import Permission from django.http import HttpResponse from django.utils import timezone from django.utils.translation import trans_real from t...
yfdyh000/pontoon
pontoon/base/utils.py
Python
bsd-3-clause
12,890
"""Code for utility tools.""" # Author: Johann Faouzi <johann.faouzi@gmail.com> # License: BSD-3-Clause import numpy as np from numpy.lib.stride_tricks import as_strided from numba import njit from sklearn.utils import check_array def segmentation(ts_size, window_size, overlapping=False, n_segments=None): """Co...
johannfaouzi/pyts
pyts/utils/utils.py
Python
bsd-3-clause
5,388
# -*- coding: utf-8 -*- """Product models.""" from flask import url_for, current_app from fulfil_client.model import (MoneyType, IntType, ModelType, One2ManyType, StringType) from shop.fulfilio import Model, ShopQuery from shop.globals import current_channel from shop.utils import get_r...
joeirimpan/shop
shop/product/models.py
Python
bsd-3-clause
14,218
import datetime import uuid from functools import lru_cache from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import strip_quotes, truncate_name from django.db.models.expressions import Exists, ExpressionWrapper from django.db.models.qu...
georgemarshall/django
django/db/backends/oracle/operations.py
Python
bsd-3-clause
27,551
""" Module that uses CMAC 2.0 to remove and correct second trip returns, correct velocity and more. A new radar object is then created with all CMAC 2.0 products. """ import copy import json import sys import netCDF4 import numpy as np import pyart from .cmac_processing import ( do_my_fuzz, get_melt, get_texture...
EVS-ATMOS/cmac2.0
cmac/cmac_radar.py
Python
bsd-3-clause
18,889
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import codecs try: from setuptools import setup, Command except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, Command # noqa from distutils.command.install import INSTALL_SCHEMES # -*-...
planorama/django-celery
setup.py
Python
bsd-3-clause
5,472
# This is essentially a slimmed down mapreduce. There are some differences with the sharding logic # and the whole thing leverages defer and there's no reducing, just mapping. # If you're wondering why we're not using MR here... # 1. We don't want a hard dependency on it and migrations are core (unlike stuff in contri...
grzes/djangae
djangae/db/migrations/mapper_library.py
Python
bsd-3-clause
18,863
# -*- coding: utf-8 from __future__ import unicode_literals from django.contrib.auth.models import AnonymousUser from django.core.urlresolvers import reverse from django.template import RequestContext from django.utils import translation from pages.cache import cache from pages.models import PageSlugContent, PageMetaC...
dlancer/django-pages-cms-extensions
pagesext/tests/test_pages.py
Python
bsd-3-clause
8,065
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # django-kaio documentation build configuration file, created by # sphinx-quickstart on Tue Jun 13 12:57:40 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this ...
APSL/django-kaio
docs/conf.py
Python
bsd-3-clause
4,821
#!/usr/bin/env python3 # Copyright (c) 2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test message sending before handshake completion. A node should never send anything other than VERSION/VERA...
jmcorgan/bitcoin
test/functional/p2p_leak.py
Python
mit
6,730
from __future__ import print_function, division from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import crossentropy from lasagne.init import Uniform, Normal from lasagne.layers import LSTMLayer, Dens...
mmottahedi/neuralnilm_prototype
scripts/e87.py
Python
mit
5,219
import os import pytest import yaml from mock import patch, Mock from teuthology.task import install class TestInstall(object): def _get_default_package_list(self, project='ceph', debug=False): path = os.path.join( os.path.dirname(__file__), '..', '..', 'task', 'install', 'packa...
dmick/teuthology
teuthology/test/task/test_install.py
Python
mit
12,343
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-24 13:35 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('user_profile', '0001_initial'), ] operations = [ migrations.AddField( ...
mcallistersean/b2-issue-tracker
toucan/user_profile/migrations/0002_profile_user_mention_notification.py
Python
mit
604
# automatically generated by the FlatBuffers compiler, do not modify # namespace: proto import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SubscriberFeatures(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode...
crossbario/autobahn-python
autobahn/wamp/gen/wamp/proto/SubscriberFeatures.py
Python
mit
6,121
# mako/codegen.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides functionality for rendering a parsetree constructing into module source code.""" impo...
youngrok/mako
mako/codegen.py
Python
mit
43,222
from django.http import Http404 from wagtail.core.models import Page, Site from wagtailmenus.models.menuitems import MenuItem def get_site_from_request(request, fallback_to_default=True): site = getattr(request, 'site', None) if isinstance(site, Site): return request.site site = Site.find_for_req...
rkhleics/wagtailmenus
wagtailmenus/utils/misc.py
Python
mit
4,425
""" =========================== Formaldehyde mm-line fitter =========================== This is a formaldehyde 3_03-2_02 / 3_22-221 and 3_03-2_02/3_21-2_20 fitter. It is based entirely on RADEX models. """ import numpy as np import hyperfine from . import fitter,model#,modelgrid try: # for model grid reading imp...
bsipocz/pyspeckit
pyspeckit/spectrum/models/formaldehyde_mm.py
Python
mit
8,388
import IPython.core.display import matplotlib as mpl def clean(): # set mpl defaults for nice display mpl.rcParams['font.size'] = 12 mpl.rcParams['figure.figsize'] = (18, 6) mpl.rcParams['lines.linewidth'] = 1 return IPython.core.display.HTML(""" <style type="text/css"> div.input { wid...
boffi/boffi.github.io
dati_2015/01/style.py
Python
mit
998
''' This script can be used to generate large numbers of warnings with little effort. It generates a set of warnings for each line in each compilation unit, where the number per line is controlled by the variable WARNINGS_PER_LINE below. If supplied by Grammatech for Praqma for testing the Code Sonar plugin. There...
Praqma/codesonar-plugin
test/wgen.py
Python
mit
1,845
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns, include from django.views.generic import View from django.http import HttpResponse from djangular.views.mixins import JSONResponseMixin, allow_remote_invocation class RemoteMethodsView(JSONResponseMixin, View): @allow_remote_invocation def fo...
jinankjain/django-angular
examples/server/tests/urls.py
Python
mit
897
from pyramid.config import Configurator from .models.node import root_factory def main(global_config, **settings): config = Configurator( settings=settings, root_factory=root_factory ) config.include('pyramid_jinja2') config.include('.models') config.scan('.views') config.add_s...
pauleveritt/pyramid_sqltraversal
docs/traversal_crud/mysite/__init__.py
Python
mit
392
""" Based on gist From https://gist.github.com/kesor/1229681 """ from django.core.exceptions import MiddlewareNotUsed from django.conf import settings import cProfile import pstats import marshal from cStringIO import StringIO class ProfileMiddleware(object): def __init__(self): if not settings.DEBUG: ...
MadeInHaus/django-social
example/SocialExample/project/apps/utils/profile_middleware.py
Python
mit
2,245
""" Support for Nest devices. For more details about this component, please refer to the documentation at https://home-assistant.io/components/nest/ """ import logging import socket import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.const import (CONF_PASSWORD, CONF_USER...
hexxter/home-assistant
homeassistant/components/nest.py
Python
mit
2,384
#! /usr/bin/python3 # -*- coding:utf-8 -*- __author__ = 'TonyZhu' import mysql.connector import discount def saveToMySQL(discount_str): conn = mysql.connector.connect(user = 'root',password='password',database = 'Test') cursor = conn.cursor() cursor.execute('insert into discount values(%s)',[discount_str]) coun...
Show-Me-the-Code/python
bbos1994/0002/saveDiscountToDB.py
Python
mit
551
# -*- coding: utf-8 -*- # from django.db import models from django.utils.translation import ugettext_lazy as _ from ..exceptions import StopInterpretationException, BreakLoopException class StopInterpretation(models.Model): class Meta: verbose_name = _('Stop instruction') verbose_name_plural = ...
vlfedotov/django-business-logic
business_logic/models/stop.py
Python
mit
634
#!/usr/bin/env python3 from pag import GameWorld from pag import CommandLineInterface from pag import classes # This gives the Game the list of all locations that is updated every time a # new location is created. Since setting a variable to another variable with a # list points to the one list's memory address, the l...
allanburleson/python-adventure-game
example.py
Python
mit
1,136
from __future__ import absolute_import from struct import pack from vertica_python.vertica.messages.message import FrontendMessage class CopyStream(FrontendMessage): def __init__(self, stream, buffer_size=131072): self.stream = stream self.bufsize = buffer_size def read_bytes(self): ...
brokendata/vertica-python
vertica_python/vertica/messages/frontend_messages/copy_stream.py
Python
mit
483
# -*- coding: utf-8 -*- from __future__ import absolute_import import importlib import traceback import logging import json import re from six import iteritems from mattermost_bot.utils import WorkerPool from mattermost_bot import settings logger = logging.getLogger(__name__) MESSAGE_MATCHER = re.compile(r'^(@.*?...
LPgenerator/mattermost_bot
mattermost_bot/dispatcher.py
Python
mit
9,090
#!/usr/bin/env python # -*- coding: UTF-8 -*- import unittest import flask import browsepy import browsepy.file as browsepy_file import browsepy.widget as browsepy_widget import browsepy.manager as browsepy_manager from browsepy.tests.deprecated.plugin import player as player class ManagerMock(object): def __i...
ergoithz/browsepy
browsepy/tests/deprecated/test_plugins.py
Python
mit
10,826
"""Store zygosity instead of alleles in Observation model Revision ID: 1b7581fb6db9 Revises: 200de898ae9f Create Date: 2013-04-04 11:35:32.568953 """ # revision identifiers, used by Alembic. revision = '1b7581fb6db9' down_revision = '200de898ae9f' from alembic import op from sqlalchemy import sql import sqlalchemy ...
sndrtj/varda
alembic/versions/1b7581fb6db9_store_zygosity_inste.py
Python
mit
2,435
#!/usr/bin/python3 # python_name.py # A Python class that returns its name. # # Written by Billy Wilson Arante <arantebillywilson@gmail.com> # Last updated on 2017/08/21 PHT class Python(): def __init__(self, name): self.name = name bubba = Python("Bubba") print(bubba.name)
arantebillywilson/python-snippets
codewars/python_name.py
Python
mit
291
""" Flask-CacheOBJ provides some caching decorators """ from setuptools import setup setup( name='Flask-CacheOBJ', version='0.2.2', url='https://github.com/liwushuo/Flask-CacheOBJ', license='MIT', author='Ju Lin', author_email='soasme@gmail.com', description='Flask-CacheOBJ provides some c...
liwushuo/Flask-CacheOBJ
setup.py
Python
mit
1,078
import os import boto.swf import json import datetime import time import zipfile import shutil import re from ftplib import FTP import ftplib import activity import boto.s3 from boto.s3.connection import S3Connection import provider.s3lib as s3lib import provider.simpleDB as dblib from elifetools import parseJATS...
gnott/elife-bot
activity/activity_PMCDeposit.py
Python
mit
22,301
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
yugangw-msft/azure-cli
src/azure-cli/azure/cli/command_modules/iot/_constants.py
Python
mit
565
# -*- coding: utf-8 -*- """ Dice I """ def solve(dice, s): for x in s: if x == "E": temp = dice[1][3] dice[1][3] = dice[1][2] dice[1][2] = dice[1][1] dice[1][1] = dice[1][0] dice[1][0] = temp #print(dice) elif x == "W": ...
miyazaki-tm/aoj
Lesson/ITP1/ITP1_11_A.py
Python
mit
1,348
# Copyright (c) 2010-2011, Found IT A/S and Piped Project Contributors. # See LICENSE for details. from StringIO import StringIO import yaml from twisted.internet import defer from twisted.python import reflect from twisted.trial import unittest from piped_status_testing import statustest # Heh. :-) class StatusTes...
foundit/Piped
contrib/status_testing/piped_status_testing/test/test_statustest.py
Python
mit
6,759
""" Contains wrapper class for datasets. """ import json import os import math import random import logging import tempfile import time import shutil import multiprocessing from multiprocessing.dummy import Pool from ast import literal_eval as make_tuple from typing import Any, Dict, Iterable, Iterator, List, Optional,...
deepchem/deepchem
deepchem/data/datasets.py
Python
mit
101,597
from .RamlParseable import RamlParseable from .RamlDocumentation import RamlDocumentation from .RamlResource import RamlResource from .RamlURIParameter import RamlURIParameter from .decorators import (raml_required, raml_optional, raml_simple_parse, raml_tabbed) class RamlRoot(RamlParseable):...
freddrake/ramlizer
ramlizer/RamlRoot.py
Python
mit
2,052
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Python motu client # # Motu, a high efficient, robust and Standard compliant Web Server for Geographic # Data Dissemination. # # http://cls-motu.sourceforge.net/ # # (C) Copyright 2009-2010, by CLS (Collecte Localisation Satellites) - # http://www.cls.fr - and Co...
dipapaspyros/bdo_platform
aggregator/connectors/motu/util/stop_watch.py
Python
mit
3,413
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module implements a FloatWithUnit, which is a subclass of float. It also defines supported units for some commonly used units for energy, length, temperature, time and charge. FloatWithUnit also suppor...
gmatteo/pymatgen
pymatgen/core/units.py
Python
mit
27,212
# -*- coding: utf-8 -*- # # This class was auto-generated from the API references found at # https://epayments-api.developer-ingenico.com/s2sapi/v1/ # from ingenico.connect.sdk.domain.payment.definitions.create_payment_result import CreatePaymentResult class CreatePaymentResponse(CreatePaymentResult): def to_dic...
Ingenico-ePayments/connect-sdk-python2
ingenico/connect/sdk/domain/payment/create_payment_response.py
Python
mit
568
# Copyright (c) 2016 Red Hat, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
OpenSciViz/cloudstack
openstack/src/python/nova-libvirt/backup/migration.py
Python
mit
21,731
import os import subprocess import pytest from julia import install from .utils import only_in_ci @only_in_ci def test_noop(juliainfo): install(julia=juliainfo.julia) @only_in_ci def test_rebuild_broken_pycall(juliainfo): if juliainfo.version_info < (0, 7): pytest.skip("Julia >= 0.7 required") ...
JuliaLang/pyjulia
src/julia/tests/test_install.py
Python
mit
1,212
""" Custom specifications for the different types of stack options. The idea is that these understand the conditions around representation of the options. """ from bespin.option_spec.stack_objs import ( StaticVariable, DynamicVariable, EnvironmentVariable, Skipper, S3Address , UltraDNSSite, UltraDNSProvider...
realestate-com-au/bespin
bespin/option_spec/stack_specs.py
Python
mit
9,692
#!/usr/bin/env python import os, StringIO, tempfile from rtfng.utils import RTFTestCase from rtfng.Elements import Document from rtfng.document.section import Section class DocumentTestCase(RTFTestCase): def test_documentWrite(self): doc, section, styles = RTFTestCase.initializeDoc() ...
oubiwann-unsupported/pyrtf
test/document/test_document.py
Python
mit
611
from rtfng.Styles import TextStyle from rtfng.PropertySets import TextPropertySet, ShadingPropertySet class Text(object): def __init__(self, *params): self.Data = None self.Style = None self.Properties = None self.Shading = None for param in params: if isinstanc...
oubiwann-unsupported/pyrtf
rtfng/document/character.py
Python
mit
2,798
import numpy as np from pytest import approx from fastats import single_pass from fastats.maths import relu, softplus def test_relu_basic_sanity(): data = np.arange(-2, 3, dtype='float32') result = single_pass(data, value=relu) assert result[0] == 0. assert result[1] == 0. assert result[2] ==...
dwillmer/fastats
tests/maths/test_activations.py
Python
mit
1,285
import unittest import urllib from createsend import * class PeopleTestCase(object): def test_get(self): email = "person@example.com" self.person.stub_request("clients/%s/people.json?email=%s" % (self.client_id, urllib.quote(email)), "person_details.json") person = self.person.get(self.client_id, email...
guilhermetavares/createsend-python
test/test_people.py
Python
mit
2,391
#!/usr/bin/python # calcualtes supervised weighted knn baseline from sparse format # This code does not handle tie cases import sys import gzip import pprint import collections as col; def map_keyfile(fname, withtags=False): #returns: dd:index-> word array maps:?? keys: index->key from ptb formated file #<s> ...
ai-ku/upos_2014
src/scripts/knnsparse.py
Python
mit
1,926
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # nonphysical.py # Waqas Bhatti and Luke Bouma - Feb 2017 # (wbhatti@astro.princeton.edu and luke@astro.princeton.edu) '''Light curve fitting routines for 'non-physical' models: - :py:func:`astrobase.lcfit.nonphysical.spline_fit_magseries`: fit a univariate cubic splin...
lgbouma/astrobase
astrobase/lcfit/nonphysical.py
Python
mit
25,469
#!/usr/bin/env python3 import pickle class Apple(object): pass d = dict(a = 1, b = 2, c = 3, d = Apple()) p = pickle.dumps(d, 2) print(type(p), p) o = pickle.loads(p) print(type(o), o)
JShadowMan/package
python/pickle/pcikling.py
Python
mit
204
#!/usr/bin/env python """ Module for simulation. """ import copy import os import numpy as np import scipy.interpolate import astropy.io.fits as pyfits import healpy as hp import numpy.lib.recfunctions as recfuncs import fitsio import ugali.observation.catalog import ugali.observation.mask import ugali.observation.r...
kadrlica/ugali
ugali/simulation/simulator.py
Python
mit
36,482
from django.shortcuts import resolve_url from django.test import TestCase, override_settings class TestGet(TestCase): def setUp(self): self.resp = self.client.get(resolve_url('layers:home')) def test_status_code(self): self.assertEqual(200, self.resp.status_code) def test_template(self)...
marcusrehm/serenata-de-amor
jarbas/layers/tests/test_home_view.py
Python
mit
859
"""Pylons specific code to facilitate using AuthKit with Pylons There is a full Pylons manual in addition to the AuthKit manual which you should read if you plan to use AuthKit with Pylons .. Note :: In addition to the authorize methods described here, you can also use the default ``authkit.authorize.middle...
cedadev/AuthKit
authkit/authorize/pylons_adaptors.py
Python
mit
3,015
from os import path import sys import rtree import json from polyIntersect.micro_functions.poly_intersect import esri_server2ogr from polyIntersect.micro_functions.poly_intersect import cartodb2ogr from polyIntersect.micro_functions.poly_intersect import json2ogr from polyIntersect.micro_functions.poly_intersect impor...
blueraster/poly-intersect
tests/test_analysis_funcs.py
Python
mit
6,268
#!/usr/bin/env python from __future__ import unicode_literals '''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.''' nanopb_version = "nanopb-0.3.7" import sys import re from functools import reduce try: # Add some dummy imports to keep packaging tools happy. import google, distutils.util ...
ioants/pypi-packages
ioant/ioant/proto/messages/generators/nanopb/nanopb_generator.py
Python
mit
62,069
# Copyright (c) 2012-2015 Netforce Co. Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publ...
sidzan/netforce
netforce_sale/netforce_sale/models/stock_picking.py
Python
mit
2,179