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 |
|---|---|---|---|---|---|
import re
import os
import six
class Compiler(object):
RE_INTERPOLATE = re.compile(r'(\\)?([#!]){(.*?)}')
doctypes = {
'5': '<!DOCTYPE html>'
, 'xml': '<?xml version="1.0" encoding="utf-8" ?>'
, 'default': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR... | jjz/pyjade | pyjade/compiler.py | Python | mit | 14,182 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division, print_function
import logging
import warnings
import zlib
from psd_tools.utils import (read_fmt, read_pascal_string,
read_be_array, trimmed_repr, pad, synchronize)
from psd_tools.exceptions import E... | a-e-m/psd-tools | src/psd_tools/reader/layers.py | Python | mit | 11,085 |
# coding: latin-1
"""
@brief test log(time=1s)
"""
import unittest
from pysqllike.generic.iter_rows import IterRow, IterException
class TestSelect (unittest.TestCase):
def test_iter_simple(self):
lr = [("nom", 10), ("jean", 40)]
schema = [("nom", str), ("age", int)]
tbl = IterRow(sch... | sdpython/pysqllike | _unittests/ut_sql/test_select.py | Python | mit | 7,475 |
# Copyright (C) 2010-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... | psci2195/espresso-ffans | testsuite/python/dawaanr-and-dds-gpu.py | Python | gpl-3.0 | 5,580 |
# -*- coding: utf-8 -*-
u"""\
FlexiNS/MME Cause code mapping Checking
- NS/MME软件版本为NS15或者更高版本
- 已开启功能开关PRFILE002:2244-MME_CC_MAPPING_ENABLED
- 有新建CAUSE CODE SETS,如:EPCEMM和EPCESM(各项目名称可能不相同).
- EPCEMM,TYPE=EMM,PROC=ATTREJ,INTCAUSE=142 To EXTERNAL CAUSE=15
- EPCEMM,TYPE=EMM,PROC=ATTREJ,INTCAUSE=9... | maxli99/SmartChecker | modules/flexins/TN_CN_20151013_ns_mme_cause_code_mapping.py | Python | mit | 8,823 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mentorlol.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| amaunder21/c4tkmentors | manage.py | Python | mit | 252 |
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
import wallaby.FXUI as FXUI
from wallaby.qt_combat import *
from wallaby.frontends.qt.widgets.labels.webView import WebView
#============================================================================#
# The group name in designer widg... | FreshXOpenSource/wallaby-frontend-qt | wallaby/frontends/qt/plugins/webviewplugin.py | Python | bsd-2-clause | 1,640 |
# Copyright: (c) 2012-2014, Michael DeHaan <[email protected]>
# Copyright: (c) 2016, Toshio Kuratomi <[email protected]>
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import ... | t794104/ansible | lib/ansible/cli/__init__.py | Python | gpl-3.0 | 19,256 |
#!/usr/bin/env python
"""Tests for the directory module"""
import os
from translate.storage import directory
class TestDirectory(object):
"""a test class to run tests on a test Pootle Server"""
def setup_method(self, method):
"""sets up a test directory"""
print("setup_method called on", s... | claudep/translate | translate/storage/test_directory.py | Python | gpl-2.0 | 2,805 |
# This file is part of OtfBot.
#
# OtfBot 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.
#
# OtfBot is distributed in the hope that it... | Farthen/OTFBot | otfbot/plugins/ircClient/autorejoin.py | Python | gpl-2.0 | 1,120 |
from distutils.core import setup
setup(
name='LSJuicer',
version='0.1dev',
author='Ardo Illaste',
author_email='[email protected]',
packages=['lsjuicer',
'lsjuicer.data',
'lsjuicer.data.analysis',
'lsjuicer.data.models',
'lsjuicer.data.pipes',
... | ardoi/datajuicer | setup.py | Python | gpl-3.0 | 1,212 |
#!/usr/bin/env python
"""
BeginDate:20050824
CurrentRevisionDate:20091021
Development Version : xayastats 001
Release Version: pre-release
Filename: xayastats.py
Filedescription: xayastats.py contains basic statistics and exploratory data analysis
primitives.
Author(s): Mishtu Banerjee
Contact: mishtu_bane... | MishtuBanerjee/xaya | xaya/xayastats.py | Python | mit | 45,688 |
"""
Support for Speedtest.net.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.speedtest/
"""
import asyncio
import logging
import re
import sys
from subprocess import check_output, CalledProcessError
import voluptuous as vol
import homeassistant... | MungoRae/home-assistant | homeassistant/components/sensor/speedtest.py | Python | apache-2.0 | 5,442 |
import unittest
import numpy as np
from bltest import attr
import vg
from lace.cache import sc, vc
from lace.mesh import Mesh
class TestGeometryMixin(unittest.TestCase):
debug = False
@attr('missing_assets')
def test_cut_across_axis(self):
original_mesh = Mesh(filename=sc('s3://bodylabs-assets/exa... | bodylabs/lace | lace/test_geometry.py | Python | bsd-2-clause | 8,485 |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.db.models import Q
from django.test import TestCase
class PhonenumerFieldAppTest(TestCase):
def test_save_field_to_dat... | hovel/django-phonenumber-field | testproject/testapp/tests.py | Python | mit | 5,964 |
# GNU Mailutils -- a suite of utilities for electronic mail
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
#
# 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
# versi... | Distrotech/mailutils | python/mailutils/body.py | Python | gpl-3.0 | 1,736 |
class DfaError(Exception):
pass
tokens = []
spaces = 0
def token(tok, lexeme):
tokens.append((tok,lexeme))
def space():
global spaces
spaces += 1
def error(c):
raise DfaError("unknown char \'%s\'" % c)
actions = {
-1: error,
0: lambda _: space(),
3: lambda lexeme: token("FOR", lexeme),
6: lambda lexeme:... | dxhj/stuff-about-parsing | lexical_analysis/examples/simulate2_example.py | Python | gpl-2.0 | 729 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-13 17:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('passwordless', '0003_apppassword_name'),
]
operations = [
migrations.AlterM... | Kromey/fbxnano | passwordless/migrations/0004_auto_20161013_0915.py | Python | mit | 594 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | alec-heif/MIT-Thesis | spark-bin/python/pyspark/daemon.py | Python | mit | 6,127 |
import unittest
from exporters.readers.base_reader import BaseReader
from exporters.readers.random_reader import RandomReader
from .utils import meta
class BaseReaderTest(unittest.TestCase):
def setUp(self):
self.reader = BaseReader({}, meta())
def test_get_next_batch_not_implemented(self):
... | scrapinghub/exporters | tests/test_readers.py | Python | bsd-3-clause | 2,129 |
from django.conf.urls import patterns, url
from links import views
urlpatterns = patterns('links.views',
url(r'^link/settings/$', views.settings, name = 'settings'),
url(r'^link/stats/$', views.stats, name = 'stats'),
)
| ethanperez/t4k-rms | templates/dashboard/urls.py | Python | mit | 229 |
"""
matrixoff.py
Script is to drive the 16 pin 8x8 led matrix using WiringPi and Python.
by Evan Thompson
January 3, 2017
https://github.com/ethom7/ledmatrix
WiringPi Rpi PIN LED PIN
0 BCM 17 11 1
1 BCM 18 12 2
2 BCM 27 13 3
3 BCM 22 15 4
4 BCM 23 16 5
5 BCM 24 18 6
6 BCM 2... | ethom7/ledmatrix | matrixoff.py | Python | mit | 2,439 |
# mode: run
# tag: generators, lambda
try:
from builtins import next # Py3k
except ImportError:
def next(it):
return it.next()
def test_inside_lambda():
"""
>>> obj = test_inside_lambda()()
>>> next(obj)
1
>>> next(obj)
2
>>> next(obj)
Traceback (most recent call last):... | larsmans/cython | tests/run/yield_inside_lambda.py | Python | apache-2.0 | 388 |
from datetime import datetime, timedelta
from django import http
from django.conf import settings
from django.core.exceptions import PermissionDenied
import mock
import pytest
from olympia.amo.tests import BaseTestCase, TestCase
from olympia.amo import decorators, get_user, set_user
from olympia.amo.urlresolvers imp... | andymckay/addons-server | src/olympia/amo/tests/test_decorators.py | Python | bsd-3-clause | 5,822 |
from __future__ import absolute_import
import numpy as np
from autograd.core import (Node, FloatNode, primitive, cast,
differentiable_ops, nondifferentiable_ops, getval)
from . import numpy_wrapper as anp
from .use_gpu_numpy import use_gpu_numpy
@primitive
def take(A, idx):
return A[idx... | kcarnold/autograd | autograd/numpy/numpy_extra.py | Python | mit | 5,915 |
from rest_framework import serializers
from .models import Athlete_Finance
class FinanceSerializer(serializers.ModelSerializer):
class Meta:
model = Athlete_Finance
fields = ("__all__") | asmltd/gosports | webapp/athlete/finance/serializers.py | Python | gpl-3.0 | 208 |
import numpy as np
class PointBrowser:
"""
Click on a point to select and highlight it -- the data that
generated the point will be shown in the lower axes. Use the 'n'
and 'p' keys to browse through the next and previous points
"""
def __init__(self):
self.lastind = 0
self.t... | cactusbin/nyt | matplotlib/examples/event_handling/data_browser.py | Python | unlicense | 2,233 |
import decimal
import sys
import steel
from steel import chunks
COMPRESSION_CHOICES = (
(0, 'zlib/deflate'),
)
RENDERING_INTENT_CHOICES = (
(0, 'Perceptual'),
(1, 'Relative Colorimetric'),
(2, 'Saturation'),
(3, 'Absolute Colorimetric'),
)
PHYSICAL_UNIT_CHOICES = (
(0, '<Unknow... | gulopine/steel | examples/images/png.py | Python | bsd-3-clause | 6,898 |
#!/usr/bin/env python
''' file: custom/optical.py '''
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import Intf, Link
from mininet.node import RemoteController
class NullIntf( Intf ):
"A dummy interface with a... | mengmoya/onos | tools/test/topos/optical2.py | Python | apache-2.0 | 2,477 |
#!/usr/bin/env python
"""
--------------------------------------------------------------------------------
Created: Jackson Lee 11/4/14
This script reads in a tab delimited file of annotations and queries
asynchronously the MGRAST REST API to parse back the original ncbi tax_id entry.
This script then uses the ncb... | leejz/meta-omics-scripts | query_ncbi_lineage_from_mgrast_md5.py | Python | mit | 8,172 |
#!/usr/bin/env python3
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
#
# 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 requir... | dhs-shine/litmus | litmus/device/devicexu3.py | Python | apache-2.0 | 728 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions... | blueburningcoder/nupic | examples/bindings/sparse_matrix_how_to.py | Python | agpl-3.0 | 12,347 |
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
if not strs:
return ""
length = len(strs[0])
for each in strs[1:]:
compare_len = min(length, len(each)
for index in range(compare_len)):
if strs[0][index] != each[index]... | BedivereZero/LeeCode | algorithms/0014-longest-common-prefix.py | Python | gpl-3.0 | 470 |
# -*- coding: utf-8 -*-
# Author: Steven J. Bethard <[email protected]>.
# flake8: noqa
"""Command-line parsing library
This module is an optparse-inspired command-line parsing library that:
- handles both optional and positional arguments
- produces highly informative usage messages
- supports par... | joelthelion/autojump | bin/autojump_argparse.py | Python | gpl-3.0 | 87,584 |
from argparse import Namespace
import unittest
from distance import Level
from distance.filter import RemoveFilter
def mkargs(maxrecurse=-1, type=[], numbers=[], section=[],
print_=False, invert=False):
return Namespace(**locals())
class RemoveTest(unittest.TestCase):
def test_by_type(self):
... | ferreum/distanceutils | tests/filter/test_remove.py | Python | mit | 1,853 |
"""
Exception types for txacme.
"""
import attr
@attr.s
class NotInZone(ValueError):
"""
The given domain name is not in the configured zone.
"""
server_name = attr.ib()
zone_name = attr.ib()
def __str__(self):
return repr(self)
@attr.s
class ZoneNotFound(ValueError):
"""
Th... | mithrandi/txacme | src/txacme/errors.py | Python | mit | 519 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, publish,
... | datalogics/scons | test/Script-import.py | Python | mit | 2,675 |
#!usr/bin/env Python
'''This program demonstrate the use of A* Algorithm'''
import heapq
def astar(graph,current,end):
openset = set()
openheap = []
closeset = set()
def retracepath(c):
path = [c]
while c.parent is not None:
c = c.parent
path.append(c)
path.reverse()
return path
openset.add(current... | triump0870/hackerearth | astar.py | Python | gpl-2.0 | 754 |
"""
sentry.nodestore.django.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.db import models
from django.utils import timezone
from sentry.db.models i... | jokey2k/sentry | src/sentry/nodestore/django/models.py | Python | bsd-3-clause | 648 |
"""Export command
"""
__copyright__ = """
Copyright (C) 2005, Catalin Marinas <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in th... | terinjokes/stgit | stgit/commands/export.py | Python | gpl-2.0 | 6,312 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 NXEZ.COM.
# http://www.nxez.com
#
# Licensed under the GNU General Public 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.gnu.org/licen... | maxis1314/raspberry | SDK/sakshat/entities/tact.py | Python | apache-2.0 | 4,814 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2021-11-10 19:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0238_abstractprovider_allow_updates'),
]
operations = [
migrations.... | Johnetordoff/osf.io | osf/migrations/0239_auto_20211110_1921.py | Python | apache-2.0 | 497 |
from __future__ import (absolute_import, division, print_function)
from mantid.api import (PythonAlgorithm, AlgorithmFactory,
MatrixWorkspaceProperty, Progress, InstrumentValidator,
ITableWorkspaceProperty)
from mantid.kernel import Direction, FloatBoundedValidator, Prop... | wdzhou/mantid | Framework/PythonInterface/plugins/algorithms/ComputeCalibrationCoefVan.py | Python | gpl-3.0 | 8,715 |
#!/usr/bin/env python
#
# ThugAPI.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; w... | morallo/thug | src/ThugAPI/ThugAPI.py | Python | gpl-2.0 | 7,585 |
#!/usr/bin/env python
'''Test that audio playback works.
You should hear white noise (static) for 0.5 seconds. The test will exit
immediately after.
You may want to turn down the volume of your speakers.
'''
import unittest
from pyglet import media
from pyglet.media import procedural
class TEST_CASE(unittest.T... | shrimpboyho/herblore | pyglet-1.1.4/tests/media/PLAYER_QUEUE_PLAY.py | Python | gpl-2.0 | 599 |
"""
QUESTION:
Problem Description:
Given a binary search tree and a node in it, find the in-order successor of that node in the BST.
Note: If the given node has no in-order successor in the tree, return null.
ANSWER:
"""
class Solution(object):
def inorderSuccessor(self, root, node):
if node.right:
... | tktrungna/leetcode | Python/inorder-successor-in-bst.py | Python | mit | 720 |
from django import forms
from django.forms import ModelForm
from models import *
from django.forms import Textarea
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import Group
class OgretimElemaniFormu(ModelForm):
parolasi=forms.CharField(label="Parolasi",
help_text='Paro... | dogancankilment/Django-obs | yonetim/forms.py | Python | gpl-2.0 | 1,672 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-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 the License, or
# (at you... | arunkgupta/gramps | gramps/gen/filters/rules/_regexpidbase.py | Python | gpl-2.0 | 2,042 |
"""
XX. Model inheritance
Model inheritance exists in two varieties:
- abstract base classes which are a way of specifying common
information inherited by the subclasses. They don't exist as a separate
model.
- non-abstract base classes (the default), which are models in their own
right with ... | grangier/django-11599 | tests/modeltests/model_inheritance/models.py | Python | bsd-3-clause | 10,437 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.thermal_zones_and_surfaces import WallAdiabatic
log = logging.getLogger(__name__)
class TestWallAdiabatic(unittest.TestCase):
def setUp(self):
self.fd, self.path = ... | rbuffat/pyidf | tests/test_walladiabatic.py | Python | apache-2.0 | 2,600 |
from django.test import TestCase
from makam import models
class ComposerTest(TestCase):
def setUp(self):
self.c1 = models.Composer.objects.create(name="c1")
self.c2 = models.Composer.objects.create(name="c2")
self.w1 = models.Work.objects.create(title="w1")
self.w1.lyricists.add(s... | MTG/dunya | makam/test/test_composer.py | Python | agpl-3.0 | 654 |
def pentagonal(x):
return x * (3 * x - 1) // 2
SIZE = 10000
cache = {pentagonal(i) for i in range(1, SIZE + 1)}
def p44():
for i in range(1, SIZE):
pi = pentagonal(i)
for j in range(i + 1, SIZE + 1):
pj = pentagonal(j)
pd = pj - pi
ps = pj + pi
... | pillowsham/studies | projecteuler/p44.py | Python | gpl-3.0 | 394 |
# browsershots.org - Test your web design in different browsers
# Copyright (C) 2007 Johann C. Rocholl <[email protected]>
#
# Browsershots 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 ... | hugs/shotfactory | shotfactory04/gui/linux/kazehakase.py | Python | gpl-3.0 | 1,852 |
"""Represent SGF games.
This is intended for use with SGF FF[4]; see http://www.red-bean.com/sgf/
"""
import datetime
from gomill import sgf_grammar
from gomill import sgf_properties
class Node(object):
"""An SGF node.
Instantiate with a raw property map (see sgf_grammar) and an
sgf_properties.Presen... | inclement/noGo | noGo/ext/gomill/sgf.py | Python | gpl-3.0 | 25,680 |
#!/usr/bin/env python
import subprocess
import datetime
import praw
import pyperclip
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
from base64 import b64decode
from ConfigParser import ConfigParser
impor... | foobarbazblarg/stayclean | stayclean-2019/serve-challenge-with-flask.py | Python | mit | 12,349 |
#
# Copyright (c) 2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the im... | Katello/grinder | src/grinder/Grinder.py | Python | gpl-2.0 | 23,793 |
import sys
# where RobotControl.py, etc lives
sys.path.append('/home/pi/Desktop/ADL/YeastRobot/PythonLibrary')
from RobotControl import *
#################################
### Define Deck Layout
#################################
deck="""\
DW96W DW96W BLANK BLANK BLANK BLANK BLANK
DW96W DW96W BLANK BLANK BLANK ... | tdlong/YeastRobot | UserPrograms/Rob_Sexual_DiploidSelection_1.py | Python | gpl-3.0 | 1,204 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
from __future__ import unicode_literals, division, absolute_import, print_function
# __path__ = ["lib", ".", "kindleunpack"]
import sys
import codecs
import traceback
from .compatibility_utils import PY2, binary_type, utf... | robwebset/script.ebooks | resources/lib/kindleunpack/kindleunpack.py | Python | gpl-2.0 | 43,757 |
"""
File: ULAI03.py
Library Call Demonstrated: mcculw.ul.a_in_scan() in Background mode with scan
option mcculw.enums.ScanOptions.BACKGROUND
Purpose: Scans a range of A/D Input Channels and stores
the sample data in an a... | mccdaq/mcculw | examples/ui/ULAI03.py | Python | mit | 13,607 |
__author__ = 'Guanhua, Joms'
from numpy import exp, dot, array, shape, sum
from scipy.io import loadmat
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('train_path', help='Path to training database')
arguments = parser.parse_args()
roaddata = loadmat(arguments.train_path)
class ProbNeuralNetwor... | archonren/project | algorithms/pnn.py | Python | mit | 2,871 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from ..lib.decorators import json
from . import api
@api.route("/test", methods=["GET"])
@json
def test():
return {}
@api.route("/auth/register", ... | ee-book/api | api/v1/users.py | Python | apache-2.0 | 416 |
import argparse
import sys
import tempestmail.cmd
from tempestmail.tempest_mail import TempestMail
class TempestMailCmd(tempestmail.cmd.TempestMailApp):
def parse_arguments(self):
parser = argparse.ArgumentParser(description='tempest-mail')
parser.add_argument('-c', dest='config',
... | arxcruz/tempest-tool | tempestmail/cmd/tempestmailcmd.py | Python | gpl-3.0 | 1,740 |
#! /usr/bin/env python
import glob
import os
import re
__author__ = 'Peipei YI'
dataset = '~/working/dataset/snap/'
dataset = os.path.expanduser(dataset)
tflabel = '~/working/TF_label_release/'
tflabel = os.path.expanduser(tflabel)
output = '/tmp/csppyi/'
re_k = re.compile('const int K = [\d]+;')
def gen_cmd(k... | yipeipei/peppy | _exp/reach/gen_tflabel_cmd.py | Python | mit | 1,561 |
"""
Contains utilities used during testing
"""
import os
import stat
import shutil
def remove_tree(tree):
"""
reset the permission of a file and directory tree and remove it
"""
os.chmod(tree, 0o777)
shutil.rmtree(tree)
def remove_file(file_name):
"""
reset the permission of a file and ... | arecarn/dploy | tests/utils.py | Python | mit | 2,296 |
class my_song(object):
def __init__(self, lyrics):
self.lyrics = lyrics
def awesome_song(self):
for line in self.lyrics:
print line
euphoria = my_song(["Why, why can't this moment last forevermore?",
"Tonight, tonight eternity's an open door",
"No, don't ever stop doing the things you do",
"D... | CodeCatz/litterbox | Pija/LearnPythontheHardWay/ex40_1.py | Python | mit | 682 |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code... | Shedino/RoverHighLevel | corrector_pkg/scripts/talker (backup).py | Python | cc0-1.0 | 2,693 |
'''
Created on Aug 14, 2015
@author: vkmguy
'''
from utility import DBConnectivity
from classes.hotel_detail import Hotel
def arrange_hotel(list_of_hotels):
try:
con=DBConnectivity.create_connection()
cur=DBConnectivity.create_cursor(con)
hotel_list={}
final_list=[]
for i in... | VIkramx89/Flights-and-Hotels | database/priortize.py | Python | epl-1.0 | 1,519 |
from . import interfaces
import dbus.service
import dbus.mainloop.glib
import dbus.exceptions
import threading
import signal
import tuned.logs
import tuned.consts as consts
from inspect import ismethod
from tuned.utils.polkit import polkit
from gi.repository import GLib
from types import FunctionType
try:
# Python3 v... | redhat-performance/tuned | tuned/exports/dbus_exporter.py | Python | gpl-2.0 | 6,086 |
"""
Authentication module that uses Spacewalk's auth system.
Any org_admin or kickstart_admin can get in.
Copyright 2007-2008, Red Hat, Inc
Michael DeHaan <[email protected]>
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 ... | javiplx/cobbler-old_jobs | cobbler/modules/authn_spacewalk.py | Python | gpl-2.0 | 1,635 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Doug Blank <[email protected]>
#
# 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
# ... | sam-m888/addons-source | USWebConnectPack/USWebPack.py | Python | gpl-2.0 | 4,295 |
#coding=utf-8
import random
class StatisRouter(object):
"""
A router to control all database operations on models in the
auth application.
"""
def db_for_read(self, model, **hints):
"""
Attempts to read auth models go to auth_db.
"""
if model._meta.app_label == 'stat... | edisonlz/fruit | web_project/web/dbrouter/router.py | Python | apache-2.0 | 1,986 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('instance', '0002_auto_20150530_1255'),
]
operations = [
migr... | brousch/opencraft | instance/migrations/0003_auto_20150531_1100.py | Python | agpl-3.0 | 2,499 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-airflow | tests/providers/microsoft/azure/sensors/test_wasb.py | Python | apache-2.0 | 3,763 |
#!/usr/bin/env python
"""
It is used to test the tornado web framework. This can be used:
-change of an underlying library such as ThreadPool
-change of the Tornado configuration (running more Tornado processes)
-Tornado scalability of a certain machine
"""
from __future__ import print_function
from __future__ import ... | ic-hep/DIRAC | tests/Performance/webserver/test_scripts/web.py | Python | gpl-3.0 | 1,103 |
"""
Specific overrides to the base prod settings to make development easier.
"""
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
# Don't use S3 in devstack, fall back to filesystem
del DEFAULT_FILE_STORAGE
MEDIA_ROOT = "/edx/var/edxapp/uploads"
DEBUG = True
USE_I18N = True
TEMPLATE_DEB... | nagyistoce/edx-platform | lms/envs/devstack.py | Python | agpl-3.0 | 7,127 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from catmaid.views import *
import catmaid
import vncbrowser
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from adminplus.sites import AdminSitePlus
admin.site = AdminSitePlus()
admin.autodisco... | htem/CATMAID | django/projects/mysite/urls.py | Python | agpl-3.0 | 929 |
import matplotlib.pyplot as plt
import numpy as np
execfile('ex5.py')
geo = geo_f.polarExtrude()
t = np.linspace(0.,1.,15+2)[1:-1]
geo.refine(list_t=[t,None])
geo.plotMesh()
plt.show()
| ratnania/pigasus | doc/manual/include/approximation/ex6.py | Python | mit | 206 |
"""update_index_on_discount_policy_discount_code_base.
Revision ID: 36f458047cfd
Revises: 3a585b8d5f8d
Create Date: 2017-03-16 17:04:54.849590
"""
# revision identifiers, used by Alembic.
revision = '36f458047cfd'
down_revision = '3a585b8d5f8d'
from alembic import op
def upgrade():
op.drop_constraint(
... | hasgeek/boxoffice | migrations/versions/36f458047cfd_update_index_on_discount_title.py | Python | agpl-3.0 | 900 |
#!/usr/bin/env python2.5
import sys, struct, commands, getopt, sys, os.path
from pylab import *
from decoder import *
startRule = 20
split = 50
binDir = '../../bin'
resultsDir=''
iniTest = False
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], "hpi",
['resultsDir=',
'dbDir=',
'trainD... | jurcicek/tbed-parser | src/graph.py | Python | gpl-2.0 | 4,675 |
import collections
import importlib
import inspect
import numpy as np
import pandas as pd
import string
from . import poly
from .tree import Node, Operator
Context = collections.namedtuple('Context', 'context index')
def to_list(l):
return '[' + ', '.join(map(str, l)) + ']'
def to_rexpr(root):
if isinstance(ro... | ricardog/raster-project | projections/r2py/reval.py | Python | apache-2.0 | 15,063 |
# ctx.py
# Copyright (c) 2013-2020 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0111,E1129,R0205,R0903,W0105,W1113
# Standard library imports
from __future__ import print_function
import os
import platform
import shutil
import tempfile
import time
import types
# PyPI imports
import decorator
if... | pmacosta/pmisc | pmisc/ctx.py | Python | mit | 10,205 |
from collections import OrderedDict
import csv
import logging
from tempfile import NamedTemporaryFile
import MySQLdb
from airflow.hooks import HiveCliHook, MySqlHook
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
class MySqlToHiveTransfer(BaseOperator):
"""
Moves data from M... | smarden1/airflow | airflow/operators/mysql_to_hive.py | Python | apache-2.0 | 4,095 |
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages = ["pyglet", "polytanks", "codecs", "encodings", "selectors"],
excludes = ["tkinter", "PyQt5", "PIL", "setuptools"]
, include_files="assets")
import sys
base = 'Win3... | dotoscat/Polytank-ASIR | client_setup.py | Python | agpl-3.0 | 626 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... | petrjasek/superdesk-core | superdesk/publish/formatters/__init__.py | Python | agpl-3.0 | 5,788 |
#!/usr/bin/env python
# ************** <auto-copyright.pl BEGIN do not edit this line> **************
#
# TweekQt is (C) Copyright 2003-2011 by Patrick Hartling
#
# This application 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... | godbyk/vrjuggler-upstream-old | modules/tweek/python/tweek-qt.py | Python | lgpl-2.1 | 2,014 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | josepht/snapcraft | integration_tests/test_library_precedence.py | Python | gpl-3.0 | 1,749 |
import os
from os.path import abspath, dirname, join
from setuptools import setup
__version__ = None
exec(open("ripe/atlas/tools/version.py").read())
# Allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
# Get proper long description for package
curre... | robert-kisteleki/ripe-atlas-tools | setup.py | Python | gpl-3.0 | 2,443 |
"""Exercises for eager loading.
Derived from mailing list-reported problems and trac tickets.
These are generally very old 0.1-era tests and at some point should
be cleaned up and modernized.
"""
import datetime
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy import Integer, String, ForeignKe... | rclmenezes/sqlalchemy | test/orm/test_assorted_eager.py | Python | mit | 33,140 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2011 Nick Hall
# Copyright (C) 2011 Rob G. Healey <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... | pmghalvorsen/gramps_branch | gramps/plugins/lib/libmetadata.py | Python | gpl-2.0 | 9,740 |
import random, presto, math, Numeric
def copyorb(old, new):
"""
copyorb(old, new):
Copy an orbitparams variable from 'old' to 'new'.
"""
new.p = old.p
new.e = old.e
new.x = old.x
new.w = old.w
new.t = old.t
new.wd = old.wd
new.pd = old.pd
return new
def fake_mspsr(c... | pscholz/presto | python/orbitstuff.py | Python | gpl-2.0 | 3,069 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Initiative'
db.create_table(u'multilingual_initiatives_initiative', (
(u'id', se... | bitmazk/django-multilingual-initiatives | multilingual_initiatives/migrations/0001_initial.py | Python | mit | 13,860 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Assorted functions for working with ISBNs.
"""
# TODO: error-handling logic is correct?
__docformat__ = 'restructuredtext en'
### IMPORTS ###
### CONSTANTS & DEFINES ###
### IMPLEMENTATION ###
### TEST & DEBUG ###
def _doctest ():
import doctest
doctest.test... | agapow/biblio.idscheme | biblio/idscheme/isbnutils.py | Python | bsd-3-clause | 462 |
# -*- coding: utf-8 -*-
#
# MITprof documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 16 00:38:59 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | gaelforget/MITprof | docs/conf.py | Python | mit | 5,065 |
# -*- coding: UTF-8 -*-
#! python3 # noqa E265
"""Usage from the repo root folder:
:Example:
.. code-block:: python
# for whole test
python -m unittest tests.test_translator
# for specific
python -m unittest tests.test_translator.TestIsogeoTranslator.test_translation_fr
"""
# ###########... | Guts/isogeo-api-py-minsdk | tests/test_translator.py | Python | gpl-3.0 | 4,673 |
from gloss import models, exceptions, utils
from gloss.conf import settings
from gloss.external_api import post_message_for_identifier
from gloss import message_type
"""
the information source is a data api, that by default gets
from the database if possible, otherwise it queries an external
service
"""
... | openhealthcare/gloss | gloss/information_source.py | Python | gpl-3.0 | 2,638 |
import socket
import nntplib
import time
import unittest
try:
import threading
except ImportError:
threading = None
from unittest import TestCase
from test import test_support
HOST = test_support.HOST
def server(evt, serv, evil=False):
serv.listen(5)
try:
conn, addr = s... | j5shi/Thruster | pylibs/test/test_nntplib.py | Python | gpl-2.0 | 1,725 |
#coding=utf-8
import subprocess
# 执行 shell command,一次只能执行一个命令
def executeCommand(command):
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
output = process.communicate()[0].strip()
print output
# Test
executeCommand("echo 1 && echo 2")
# Open startup floder
executeCommand("explore... | Ju2ender/Python-E | x/ShellUtil.py | Python | mit | 430 |
from django.shortcuts import render
import adlt.helppages.services as helppages_services
def index(request):
parts = helppages_services.render('index')
return render(request, 'helppages/help_page.html', dict(
parts,
active_topmenu_item='help-index',
))
def help_page(request, path):
... | sirex/atviriduomenys.lt | adlt/helppages/views.py | Python | agpl-3.0 | 485 |
# Author: Mr_Orange <[email protected]>
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versi... | bckwltn/SickRage | sickbeard/providers/torrentday.py | Python | gpl-3.0 | 10,497 |
try:
import urllib.parse as urlparse
except ImportError:
# py2
import urlparse
import tornado.httpclient
import tornado.web
# headers to remove as of HTTP 1.1 RFC2616
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
hop_by_hop_headers = set([
'connection',
'keep-alive',
'proxy-authenti... | olt/corsa | corsa/proxy.py | Python | mit | 4,393 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.