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 |
|---|---|---|---|---|---|
# Copyright 2016 F5 Networks 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 agreed to in writi... | F5Networks/f5-common-python | f5/bigip/tm/sys/test/functional/test_failover.py | Python | apache-2.0 | 4,792 |
import logging
from PyQt5.QtCore import (
QAbstractListModel,
Qt,
QModelIndex,
QPoint,
QSize,
QTimer,
QVariant,
)
from PyQt5.QtGui import QPainter, QFontMetrics
from PyQt5.QtWidgets import QListView, QStyledItemDelegate
logger = logging.getLogger(__name__)
class TextlistModel(QAbstractL... | cosven/FeelUOwn | feeluown/gui/widgets/textlist.py | Python | gpl-3.0 | 4,237 |
#!/usr/bin/env python
import os
import json
# From http://www.tornadoweb.org/documentation/overview.html, with a few mods.
import tornado.ioloop
import tornado.web
from tornado.options import define, options
define("port", type=int, default=8888, help="The port to listen on.")
class MainHandler(tornado.web.RequestH... | kaze/paasmaker | misc/samples/tornado-simple/app.py | Python | mpl-2.0 | 1,190 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 Dana Christen
#
# This file is part of XpenseMate, a tool for managing shared expenses and
# hosted at https://github.com/danac/xpensemate.
#
# XpenseMate is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Genera... | danac/xpensemate | xpensemate/db/proxy/postgres/psycopg2_proxy.py | Python | agpl-3.0 | 2,326 |
#!/usr/bin/python
import ldns
pkt = ldns.ldns_pkt.new_query_frm_str("www.google.com",ldns.LDNS_RR_TYPE_ANY, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_QR | ldns.LDNS_AA)
rra = ldns.ldns_rr.new_frm_str("www.google.com. IN A 192.168.1.1",300)
rrb = ldns.ldns_rr.new_frm_str("www.google.com. IN TXT Some\ Description",300)
list =... | fangdingjun/dnsproxy | third-part/ldns-1.6.17/contrib/python/examples/python3/ldns-newpkt.py | Python | gpl-3.0 | 476 |
import unicodedata
import operator
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponse, HttpResponseForbidden
from django.utils import simplejson
from django.utils.encoding import smart_str
from dj... | Perkville/django-autocomplete | autocomplete/views.py | Python | mit | 15,591 |
FORGOT_EMAIL_TEMPLATE = open("forgot.mail").read()
REGISTRATION_EMAIL_TEMPLATE = open("registration.mail").read()
USER_LEVELS = ["Administrator", "Student", "Observer", "Teacher"]
USER_REGULAR = 1
USER_OBSERVER = 2
USER_TEACHER = 3
SUPPORTED_LANGUAGES = {
"cxx": "C++",
"python2": "Python 2",
"python3": "P... | EasyCTF/OpenCTF | server-old/librectf/constants.py | Python | mit | 352 |
"""
metakit.py -- Utility code for the Python interface to Metakit
$Id: metakit.py 1669 2007-06-16 00:23:25Z jcw $
This is part of Metakit, see http://www.equi4.com/metakit.html
This wraps the raw Mk4py compiled extension interface.
To use Metakit through this interface, simply do:
import metakit
After that, things ... | electric-cloud/metakit | python/metakit.py | Python | mit | 2,471 |
#!/usr/bin/env python
# Copyright 2016 The TensorFlow Authors. 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
#
# Unle... | naturali/tensorflow | tensorflow/tools/git/gen_git_source.py | Python | apache-2.0 | 7,792 |
from .dynamic_class import *
from .links import *
from .traits import *
from .misc import *
| tkf/compapp | src/compapp/descriptors/__init__.py | Python | bsd-2-clause | 92 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | scripnichenko/nova | nova/tests/functional/api_sample_tests/test_extended_volumes.py | Python | apache-2.0 | 4,280 |
import sys
sys.path.append('../..')
import codestudio
z = codestudio.load('s1level90')
def draw_square(length):
for count in range(4):
z.move_forward(length)
z.turn_right(90)
def draw_triangle(length):
for count in range(3):
z.move_forward(length)
z.turn_right(120)
def draw_ho... | skilstak/code-dot-org-python | solutions/stage15-artist4/s1level90.py | Python | unlicense | 558 |
from ...thing import Thing
from ...spec import Spec
class ThingName(Thing):
"""[#Description]
Attributes
[#Attributes]"""
# Things that child class SHOULDNT need to redeclare
# Things that a few child classes will need to redeclare
# Things every child class will want to redeclare
spec = Spec.THINGNAME
... | Jerad-M/ubfs | classes/custom/thing/thing_template.py | Python | apache-2.0 | 342 |
# Copyright (C) 2015 The Android Open Source Project
#
# 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 ... | GerritCodeReview/git-repo | subcmds/gitc_init.py | Python | apache-2.0 | 2,704 |
"""Constants for RFXtrx integration."""
CONF_DATA_BITS = "data_bits"
CONF_AUTOMATIC_ADD = "automatic_add"
CONF_SIGNAL_REPETITIONS = "signal_repetitions"
CONF_OFF_DELAY = "off_delay"
CONF_VENETIAN_BLIND_MODE = "venetian_blind_mode"
CONF_PROTOCOLS = "protocols"
CONF_REPLACE_DEVICE = "replace_device"
CONST_VENETIAN_BLI... | rohitranjan1991/home-assistant | homeassistant/components/rfxtrx/const.py | Python | mit | 904 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2013 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... | pferreir/indico-backup | indico/modules/rb/models/utils.py | Python | gpl-3.0 | 2,012 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2022 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | psi4/psi4 | psi4/driver/procrouting/sapt/__init__.py | Python | lgpl-3.0 | 973 |
#!/usr/bin/python
print
print "checking for nltk"
try:
import nltk
except ImportError:
print "you should install nltk before continuing"
print "checking for numpy"
try:
import numpy
except ImportError:
print "you should install numpy before continuing"
print "checking for sklearn"
try:
import skl... | moosemaniam/learning | ud120-projects/tools/startup.py | Python | cc0-1.0 | 1,048 |
import argparse
from allennlp.commands import Subcommand
def do_nothing(_):
pass
@Subcommand.register("d")
class D(Subcommand):
def add_subparser(self, parser: argparse._SubParsersAction) -> argparse.ArgumentParser:
subparser = parser.add_parser(self.name, description="fake", help="fake help")
... | allenai/allennlp | test_fixtures/plugins/d/d.py | Python | apache-2.0 | 389 |
"""
Imitate the parser representation.
"""
import inspect
import re
import sys
import os
from functools import partial
from jedi._compatibility import builtins as _builtins, unicode
from jedi import debug
from jedi.cache import underscore_memoization, memoize_method
from jedi.evaluate.sys_path import get_sys_path
from... | tianzhihen/SublimeJEDI | jedi/evaluate/compiled/__init__.py | Python | mit | 16,727 |
#!/usr/bin/env python
import logging
logging.basicConfig(level=logging.DEBUG)
import unittest
import pylibmc
import memcache
import memcache_toolbar.panels.memcache
import memcache_toolbar.panels.pylibmc
class TestCase(unittest.TestCase):
def assertCall(self, call, expected_function, expected_args, base_messag... | ross/memcache-debug-panel | test/__init__.py | Python | bsd-3-clause | 11,825 |
from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
from django.utils.log import getLogger
import warnings
warnings.warn(
'Function-based generic views have been deprecated; use class-based views instead.',
... | kantai/passe-framework-prototype | django/views/generic/simple.py | Python | bsd-3-clause | 2,329 |
# ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008-2012 Daniel Moisset, Ricardo Quesada, Rayentray Tappa,
# Lucio Torre
# Copyright (c) 2009-2015 Richard Jones, Claudio Canepa
# All rights reserved.
#
# Redistribution and use in source and binary forms, with o... | dangillet/cocos | cocos/scenes/pause.py | Python | bsd-3-clause | 3,820 |
"""$ fiona ls"""
import json
import click
from cligj import indent_opt
import fiona
@click.command()
@click.argument('input', type=click.Path(exists=True))
@indent_opt
@click.pass_context
def ls(ctx, input, indent):
"""
List layers in a datasource.
"""
verbosity = (ctx.obj and ctx.obj['verbosity... | perrygeo/Fiona | fiona/fio/ls.py | Python | bsd-3-clause | 474 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2018 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
# Acknowledgements:
# Written by Jon Peirce
#
# Based on shader code for mono++ and color++ modes code in Psythtoolbox
# (Ma... | hoechenberger/psychopy | psychopy/hardware/crs/shaders.py | Python | gpl-3.0 | 1,833 |
#!/usr/bin/env python
import os
import logging
import test_sersic_highn_basic
# Start off with the basic config
config = test_sersic_highn_basic.config_basic
config['image']['gsparams']['shoot_abserr'] = 5.e-9
# Output filename
if not os.path.isdir("outputs"):
os.mkdir("outputs")
outfile = os.path.join(
"out... | mardom/GalSim | devel/external/test_sersic_highn/test_sersic_highn_shoot_abserr2.py | Python | gpl-3.0 | 714 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
CreateAttributeIndex.py
-----------------------
Date : November 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
*****... | nirvn/QGIS | python/plugins/processing/algs/qgis/CreateAttributeIndex.py | Python | gpl-2.0 | 3,300 |
# Copyright (c) 2014 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 impl... | kgiusti/gofer | test/unit/messaging/adapter/qpid/test_model.py | Python | lgpl-2.1 | 12,427 |
# -*- coding: utf-8 -*-
"""
celery.worker.heartbeat
~~~~~~~~~~~~~~~~~~~~~~~
This is the internal thread that sends heartbeat events
at regular intervals.
"""
from __future__ import absolute_import
from celery.five import values
from celery.utils.sysinfo import load_average
from .state import SOFTWAR... | sivaprakashniet/push_pull | p2p/lib/python2.7/site-packages/celery/worker/heartbeat.py | Python | bsd-3-clause | 1,771 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - migration from base rev 1060400
Nothing to do, we just return the new data dir revision.
@copyright: 2008 by Thomas Waldmann
@license: GNU GPL, see COPYING for details.
"""
def execute(script, data_dir, rev):
return 1060500
| RealTimeWeb/wikisite | MoinMoin/script/migration/1060400.py | Python | apache-2.0 | 292 |
# -*- coding: utf-8 -*-
import pytest
import sys
import cPickle as pickle
import time
from test_base_class import TestBaseClass
aerospike = pytest.importorskip("aerospike")
from aerospike import predicates as p
try:
from aerospike.exception import *
except:
print "Please install aerospike python client."
... | arthurprs/aerospike-client-python | test/test_query.py | Python | apache-2.0 | 25,284 |
# generated by 'xml2py'
# flags '-c -d -v -k defst -lrregadmin -m rregadmin.util.glib_wrapper -m rregadmin.util.icu_wrapper -m rregadmin.util.path_wrapper -m rregadmin.util.icu_wrapper -m rregadmin.util.path_info_wrapper -m rregadmin.util.ustring_wrapper -m rregadmin.util.offset_wrapper -m rregadmin.util.value_wrapper ... | racemidev/RegAdminForLinux | python/rregadmin/registry/types_wrapper.py | Python | gpl-2.0 | 1,286 |
import numpy as np
def f(x):
return ((x-5.)**2.).sum(axis=1)
x = np.arange(10)
def ngrad(x,h):
return (f(x[:,None]+h)-f(x[:,None]-h))/(2.*h)
def agrad(x):
return 2.*(x-5.)
print ngrad(x,1e-6), agrad(x)
| mjvakili/supermean | code/dumbass.py | Python | mit | 220 |
# -*- coding: utf-8 -*-
from models import Pages
# Plantillas:
from django.template.loader import get_template
from django.template import Context
# Nuevo
from datetime import datetime
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from models import Usuario
from models import... | enavarromo/X-Serv-Practica-Hoteles | alojamientos/views.py | Python | gpl-3.0 | 39,457 |
from setuptools import setup, find_packages
# dependencies
with open('requirements.txt') as f:
deps = f.read().splitlines()
setup(name='treestatus_stats',
version=0.1,
description="A tool for getting information on the health of the tree that also produces",
classifiers=[], # Get strings from h... | AutomatedTester/treestatus-stats | setup.py | Python | mpl-2.0 | 816 |
# Copyright 2009 Paul J. Davis <[email protected]>
#
# This file is part of the python-spidermonkey package released
# under the MIT license.
import t
touched = 0
class Foo(object):
def __init__(self):
self.bar = 2
def __del__(self):
global touched
touched = 1
@t.glbl("Foo", ... | davisp/python-spidermonkey | tests/test-python-ctor.py | Python | mit | 736 |
#/bin/python3
inf=open('chains.22Feb.txt','r')
lines=inf.readlines()
nl=[]
for i in range(0,len(lines)):
if lines[i]=='\n':
nl.append(i)
blocks=[]
for i in range(0,len(nl)-1):
blocks.append(lines[nl[i]+1:nl[i+1]])
ACB=[]
for i in blocks:
if any('I' in j for j in i) and not any('F' in j for j in i... | ntbrewer/pixie_ldf_she | scripts/chainsParse2.py | Python | gpl-3.0 | 1,870 |
# -*- coding: utf-8 -*-
#
# Natural Language Toolkit: Snowball Stemmer
#
# Copyright (C) 2001-2010 NLTK Project
# Author: Peter Michael Stahl <[email protected]>
# Algorithms: Dr Martin Porter <[email protected]>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
u"""
Snowball stemmers and ap... | skarllot/open-tran | lib/stem/snowball.py | Python | gpl-2.0 | 136,128 |
import socket, string, sys
import os
import re, signal
import select, tempfile, time
from datetime import datetime
from optparse import OptionParser
from communication import send,receive
from others import *
class Server(object):
# self.all = 'Global'
def __init__(self, portNo=6530, ... | iyanu-obidele/Internetworking-Protocols | s.py | Python | gpl-3.0 | 6,010 |
from collections import defaultdict, Sequence, Sized, Iterable, Callable
import inspect
import wrapt
from cytoolz import curry
from numpy import ndarray
from six import integer_types
from .exceptions import UndefinedOperatorError, DifferentLengthError
from .exceptions import ExpectedTypeError, ShapeMismatchError
from ... | ryfeus/lambda-packs | Spacy/source2.7/thinc/check.py | Python | mit | 5,880 |
import argparse
import os
from charitybot2 import paths
# from charitybot2.botconfig.event_config import EventConfigurationFromFile
# from charitybot2.botconfig.twitch_config import TwitchAccountConfiguration
# from charitybot2.events.event import Event
# from charitybot2.events.event_loop import TwitchEventLoop, Even... | purrcat259/charitybot2 | charitybot2/charitybot2.py | Python | gpl-3.0 | 3,693 |
distributable = FastLmmSet(
phenofile = 'datasets/phenSynthFrom22.23.bin.N30.txt',
alt_snpreader = 'datasets/all_chr.maf0.001.N30',
altset_list = 'datasets/set_input.23_17_11.txt',
covarfile = None,
filenull = 'datasets/all_chr.maf0.001.chr22.23.N30.bed',
autoselect = False,
mindist... | zhonghualiu/FaST-LMM | tests/inputs/buggy/lrt_two_kernel_mixed_effect_laplace_logistic_qqfit.N30.py | Python | apache-2.0 | 959 |
__author__ = 'Dani'
class KeyDicts(object):
#INDICATOR KEYS
TOTAL_DEALS = "N1"
HECTARES_TOTAL_DEALS = "HA1"
CONCLUDED_DEALS = "N2"
HECTARES_CONTRACT_DEALS = "HA2"
INTENDED_DEALS = "N3"
HECTARES_INTENDED_DEALS = "HA3"
FAILED_DEALS = "N4"
HECTARES_FAILED_DEALS = "HA4"
IN_PRO... | landportal/landbook-importers | LandMatrix_Importer/es/weso/landmatrix/translator/keys_dicts.py | Python | mit | 1,835 |
"""
Created on 3/05/2013
@author: thom
"""
import unittest
from rdkit.Chem import AllChem as Chem
from chemistry_model.reaction import Reaction
class Test(unittest.TestCase):
def testInit(self):
result = Reaction(Chem.MolFromSmiles('O=C=O'), 40)
self.assertEqual(40, result.get_energy_delta())
... | th0mmeke/toyworld | tests/test_reaction.py | Python | gpl-3.0 | 368 |
### DREAM Olfaction Prediction Challenge
### Created by: Bence Szalai and Gabor Turu
### Contact: [email protected] & [email protected]
import os
import numpy as np
import pandas as pd
### Change these variables to give input data/path
DIRECTORY='/media/szalaib/D60C49380C491541/Data/Dry/DREAM/2015_olfactor... | dream-olfaction/olfaction-prediction | opc_python/hulab/prediction_files/hulab_preprocessing.py | Python | mit | 5,274 |
def great():
number = [13, 31, 34, 11, 12]
for i in numbers:
temp = number[i]
if temp > number[i + 1]:
large = temp
print large
great()
| mrniranjan/python-scripts | reboot/mymistakes/math59.py | Python | gpl-2.0 | 149 |
# Copyright (C) 2011-2012 Patrick Totzke <[email protected]>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import os
import email
import tempfile
import re
from email.header import Header
import email.charset as charset
charset.add_charset('u... | TomasTomecek/alot | alot/db/utils.py | Python | gpl-3.0 | 15,206 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | lib/spack/docs/tutorial/examples/1.package.py | Python | lgpl-2.1 | 1,759 |
#!/usr/bin/env python3
#
# Copyright (c) 2016 Roberto Riggio
#
# 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 applicabl... | Panagiotis-Kon/empower-runtime | empower/apps/events/events.py | Python | apache-2.0 | 4,101 |
# Copyright 2021, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google-research/federated | periodic_distribution_shift/fedavg_temporal_kmeans_test.py | Python | apache-2.0 | 3,860 |
from numpy import absolute, full, linspace, meshgrid, nan, product, rot90
from ._plot_2d import _plot_2d
from .estimate_kernel_density import estimate_kernel_density
from .infer import infer
from .plot_points import plot_points
def infer_assuming_independence(
variables,
variable_types=None,
bandwidths="... | UCSD-CCAL/ccal | ccal/infer_assuming_independence.py | Python | mit | 2,947 |
#!/usr/bin/env python
# encoding: utf8
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import unittest
from plucky import plucks
class TestPlucks(unittest.TestCase):
def setUp(self):
self.simple = {
"a": 1,
"b": range(10),
"c": ... | randomir/plucky | tests/test_plucks.py | Python | mit | 3,379 |
111010101100
100001001100
000111101100
100100000000
001001001110
100110101011
001001100101
010000010110
011011001001
001001000101
001000101011
000111101111
011000000001
111111010100
101101010010
100111100111
101000110100
011101101101
010101110010
001011101010
010001001100
011001001100
000110011100
011001011100
00010111... | catalystcf/freezing-archer | aoc2021/inputs/DATA_3.py | Python | mit | 13,000 |
#!/usr/bin/env python
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that ... | kenorb-contrib/BitTorrent | BitTorrent/launchmanycore.py | Python | gpl-3.0 | 16,512 |
# Client view on data model
import urllib2
import json
import pprint
import re
import os
import sys
import xml.etree.ElementTree as ET
class Experiment() :
def __init__(self) :
self.name = None
self.version = None
self.codes = []
self.files = []
self.workflow = [] # list ... | MICCoM/CLI | lib/MICCOM/model.py | Python | apache-2.0 | 3,922 |
#!/usr/bin/env python
# coding=utf-8
import socket
def check_tcp_status(ip , port):
sock = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server_address = (ip , port)
# print "connection to %s,%s" % server_address
sock.connect(server_address)
message = "TCP INFO FROM CLIENT"
# print "sending the... | ElvisLouis/code | work/python/client_tcp.py | Python | gpl-2.0 | 493 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Redirect',
fields=[
('id', models.AutoField(ver... | alirizakeles/tendenci | tendenci/apps/redirects/migrations/0001_initial.py | Python | gpl-3.0 | 1,486 |
"""Test for new experiment identifier features"""
from __future__ import annotations
from dxtbx.model import Experiment, ExperimentList
from dials.array_family import flex
def test_selection_identifier_propagation():
"""
If experiment idenfitiers are set, then when selecting on a reflection
table, copy ... | dials/dials | tests/array_family/test_identifiers_handling.py | Python | bsd-3-clause | 3,922 |
"""telephony_created_at
Revision ID: 13b2e84fd798
Revises: 1cb4253a8bc6
Create Date: 2014-04-27 19:21:15.493456
"""
# revision identifiers, used by Alembic.
revision = '13b2e84fd798'
down_revision = '1cb4253a8bc6'
from alembic import op
import sqlalchemy as sa
import datetime
def upgrade():
table_names = [ 't... | mehulsbhatt/rootio_web | alembic/versions/13b2e84fd798_telephony_created_at.py | Python | agpl-3.0 | 1,943 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# 将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。
import uuid
# pymysql的用法与MySQLdb完全相同, MySQQLdb 不支持 python3.5 用 pymysql 代替
import pymysql
pymysql.install_as_MySQLdb()
def gene_code(count, length):
result = []
while True:
uuid_id = uuid.uuid1()
temp ... | Code-In-Action/python-in-action | 2/mysql.py | Python | mit | 1,171 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from rbnics.eim.utils.decorators.define_symbolic_parameters import DefineSymbolicParameters
from rbnics.eim.utils.decorators.store_map_from_basis_functions_to_reduced_problem import (
add... | mathLab/RBniCS | rbnics/eim/utils/decorators/__init__.py | Python | lgpl-3.0 | 3,514 |
#!/usr/bin/env python
# Python examples script that uses the R calculator filter to find the
# maxiumum spanning tree of a random input graph by inverting the edge
# weights of the graph in R. The MST algorithm then finds the maximum
# spanning tree instead of the minimum spanning tree.
# VTK must be built wi... | hlzz/dotfiles | graphics/VTK-7.0.0/Examples/Infovis/Python/Rcalculator_mst.py | Python | bsd-3-clause | 2,594 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Utility functions"""
import numpy as np
import scipy.ndimage
import scipy.sparse
import six
from numpy.lib.stride_tricks import as_strided
from .. import cache
from . import decorators
from .exceptions import ParameterError
# Constrain STFT block sizes to 256 KB
MAX_... | yunque/librosa | librosa/util/utils.py | Python | isc | 40,335 |
import os
from autotest.client.shared import error
from virttest import virsh, utils_libvirtd
def run(test, params, env):
"""
Test command: virsh domjobinfo.
The command returns information about jobs running on a domain.
1.Prepare test environment.
2.When the libvirtd == "off", stop the libvirtd... | will-Do/tp-libvirt_v2v | libvirt/tests/src/virsh_cmd/domain/virsh_domjobinfo.py | Python | gpl-2.0 | 2,048 |
# coding=utf-8
from __future__ import absolute_import, division, print_function
__author__ = "Gina Häußge <[email protected]>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import logging
import os
import threading
import time
import fnmatch
import datetime
import sys
import shut... | JackGavin13/octoprint-test-not-finished | src/octoprint/timelapse.py | Python | agpl-3.0 | 29,717 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2022 RERO.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio module that implements OAuth 2 server."""
impo... | inveniosoftware/invenio-oauth2server | setup.py | Python | mit | 4,640 |
'''
Copyright 2017 Roy E. Lowrance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | rlowrance/python_lib | applied_data_science3/trace_unless.py | Python | apache-2.0 | 875 |
"""
Copyright (C) 2017 Roberto Bruttomesso <[email protected]>
This file is distributed under the terms of the 3-clause BSD License.
A copy of the license can be found in the root directory or at
https://opensource.org/licenses/BSD-3-Clause.
Author: Roberto Bruttomesso <[email protected]>
Da... | formalmethods/intrepyd | tests/test_simulator.py | Python | bsd-3-clause | 1,648 |
from ..requester import Requester
class WatsonRequester(Requester):
def __init__(self, requester):
self.requester = requester
def send(self, data):
self.requester.send(data)
def getResponse(self):
self.requester.send('{"action": "stop"}')
print ("Wait for response.... | lowdev/alfred | robot/stt/watson/wip/watsonRequester.py | Python | gpl-3.0 | 362 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2015 Giulio Collura
#
# 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.
| gcollura/saucybacon | app/tests/autopilot/saucybacon/__init__.py | Python | gpl-3.0 | 294 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006 Ali Sabil <[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
# (at your option) any later... | billiob/papyon | papyon/gnet/message/SOAP.py | Python | gpl-2.0 | 5,704 |
'''
* Problem013.py
*
* Project Euler: Problem 13
*
* Problem: Find the first ten digits of the sum of the given one-hundred 50-digit numbers.
*
*
'''
import time
start_time = time.time()
f = open("p13.txt", "r")
print str(sum([int(line) for line in f]))[:10]
f.close()
print("--- %s seconds ---" % (... | leeorb321/Euler | 013/Problem013.py | Python | mit | 346 |
# import unittest
# from mock import patch
# from Simulated_BPMDevice import *
# import RFSignalGenerators
#
# # Needs to be redesigned to take into account the gate source object....
#
# class ExpectedDataTest(unittest.TestCase):
#
# @classmethod
# def setUpClass(cls):
# # Stuff you only run once
# ... | dharryman/BPM_Test_Framework | BPMDevice/Simulated_BPMDevice_test.py | Python | apache-2.0 | 1,248 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# vim: fenc=utf-8
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
#
"""
File name: create_file.py
Author: dhilipsiva <[email protected]>
Date created: 2016-11-22
"""
import re
import os
from datetime import datetime
today = datetime.today().strftime('%Y-%m... | dhilipsiva/talks | scripts/create_file.py | Python | mit | 1,172 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado #
# ([email protected]) #
# ... | pacoqueen/bbinn | formularios/consulta_beneficio.py | Python | gpl-2.0 | 10,213 |
from datetime import datetime
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=64)
def __str__(self):
return "%s" % (self.name)
class Competition(models.Model):
name = models.CharField(max_length=64)
def __str__(self):
return "%s" % (self... | syslo/matboj2015 | matboj/models.py | Python | mit | 923 |
import re
from sqlalchemy import *
from sqlalchemy.orm import relationship, validates
from sqlalchemy.ext.declarative import declarative_base
from config import *
def _strip_clean(text):
"""Strips slashes & html from text. """
text = text.replace(r'\"', '"') \
.replace(r"\'", "'") \
... | akavlie/goops | model.py | Python | bsd-3-clause | 1,924 |
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
max=0
for i in xrange(len(height)):
for j in xrange(i+1,len(height)):
maxarea = (j-i)*(height[i]+height[j])/2
if maxarea >max:
... | Tanych/CodeTracking | 11-Container-With-Most-Water/solution_tle.py | Python | mit | 370 |
'''
Some helpers
'''
import os
import pwd
import time
import requests
import subprocess
def get_uid(username):
return int(pwd.getpwnam(username).pw_uid)
def file_rights(filepath, mode=None, uid=None, gid=None):
'''
Change file rights
'''
file_handle = os.open(filepath, os.O_RDONLY)
... | cozy/python_cozy_management | cozy_management/helpers.py | Python | lgpl-3.0 | 2,238 |
# orm/state.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Defines instrumentation of instances.
This module is usually not directly visible t... | davidjb/sqlalchemy | lib/sqlalchemy/orm/state.py | Python | mit | 23,021 |
DEBUG = True
ALLOWED_HOSTS = ['*']
SECRET_KEY = "kereviz"
| baturay/ne-istiyoruz | local_settings.py | Python | bsd-2-clause | 59 |
import requests
from ltk.api_uri import API_URI
from ltk.utils import restart
import ltk.utils
from ltk.exceptions import RequestFailedError,ConnectionFailed
from ltk.logger import logger
import sys, os
# Python 2
import urlparse as parse
# End Python 2
# Python 3
# import urllib.parse as parse
# End Python 3
class Ap... | Lingotek/translation-utility | python2/ltk/apicalls.py | Python | mit | 20,586 |
'''
/******************************************************************
*
* Copyright 2018 Samsung Electronics 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
*
* htt... | iotivity/iotivity | test/test_manager/ite/util.py | Python | apache-2.0 | 2,352 |
#!/usr/bin/env python
import rospy
import numpy as np
from geometry_msgs.msg import Pose2D
class filter:
def __init__(self):
#Initialize ROS
rospy.init_node('create_pose', anonymous=True)
#Robot state
self.x = np.array([0,0,0]).T
self.dx = np.array([0,0,0]).T
#Listen to camera data and input
ro... | zang3t5u/DCSC_Robots | dcsc_create/localization/src/filter.py | Python | gpl-2.0 | 534 |
"""Utilities to evaluate the clustering performance of models
Functions named as *_score return a scalar value to maximize: the higher the
better.
"""
# Authors: Olivier Grisel <[email protected]>
# Wei LI <[email protected]>
# Diego Molla <[email protected]>
# License: BSD 3 clause
fr... | mblondel/scikit-learn | sklearn/metrics/cluster/supervised.py | Python | bsd-3-clause | 26,876 |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... | UniversityRadioYork/xymon-monitors | setup.py | Python | mit | 2,267 |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import, division)
# import unittest
# import xml.etree.ElementTree as ET
# import subprocess
# import xbmc
# from lib import constants as const
# from lib.utils import os_join
# from lib import playback
# from lib impor... | eirki/script.service.koalanrk | tests/test_playback.py | Python | mit | 3,361 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | yongshengwang/builthue | desktop/libs/libopenid/src/libopenid/urls.py | Python | apache-2.0 | 1,026 |
from django.db import models
from django.contrib import admin
from softdelete.models import *
from softdelete.admin import *
class TestModelOne(SoftDeleteObject):
extra_bool = models.BooleanField(default=False)
class TestModelTwo(SoftDeleteObject):
extra_int = models.IntegerField()
tmo = models.Foreig... | AltSchool/django-softdelete | softdelete/test_softdelete_app/models.py | Python | bsd-2-clause | 960 |
import numpy as np
import os
from matplotlib import pyplot as plt
def random_pick(probs, num_options=8):
'''
Randomly pick a number weighted by array probs (len 8)
Return the index of the selected weight in array probs
'''
if np.max(probs) == 0:
probs = list([1/num_options for i in range... | mperignon/bmi-delta | deltaRCM/deltaRCM_tools.py | Python | mit | 1,612 |
"""ShutIt module. See http://shutit.tk
"""
from shutit_module import ShutItModule
class icu(ShutItModule):
def is_installed(self, shutit):
return shutit.file_exists('/root/shutit_build/module_record/' + self.module_id + '/built')
def build(self, shutit):
shutit.send('mkdir -p /tmp/build/icu')
shutit.send(... | ianmiell/OLD-shutitdist | icu/icu.py | Python | gpl-2.0 | 1,189 |
"""
===========================================================================
Normal, Ledoit-Wolf and OAS Linear Discriminant Analysis for classification
===========================================================================
This example illustrates how the Ledoit-Wolf and Oracle Shrinkage
Approximating (OAS) e... | manhhomienbienthuy/scikit-learn | examples/classification/plot_lda.py | Python | bsd-3-clause | 3,078 |
from django.conf.urls import patterns, include, url
from core.views import index
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^$', index),
)
| njncalub/Elsie | elsie/urls.py | Python | gpl-3.0 | 236 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""gcloud dns record-sets changes command group."""
from googlecloudsdk.calliope import base
class Changes(base.Group):
"""View details about changes to your Cloud DNS record-sets."""
detailed_help = {
'DESCRIPTION': '{description}',
'EXAMPLES': """... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/dns/commands/record_sets/changes/__init__.py | Python | apache-2.0 | 555 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2013 Canonical Corp.
# 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
#
# htt... | viggates/nova | nova/tests/virt/vmwareapi/test_vm_util.py | Python | apache-2.0 | 42,212 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="streamtube.hoverlabel.font", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_na... | plotly/python-api | packages/python/plotly/plotly/validators/streamtube/hoverlabel/font/_color.py | Python | mit | 519 |
#! /usr/local/bin/python
"""Script for producing a RASPP curve: the average disruption (energy)
and average mutation of libraries that have the lowest average energy
given constraints on fragment length.
******************************************************************
Copyright (C) 2005 Allan Drummond, Cali... | mattasmith/SCHEMA-RASPP | rasppcurve.py | Python | gpl-3.0 | 7,335 |
#
# This file is part of Python-AD. Python-AD is free software that is made
# available under the MIT license. Consult the file "LICENSE" that is
# distributed together with this file for the exact licensing terms.
#
# Python-AD is copyright (c) 2007-2009 by the Python-AD authors. See the
# file "AUTHORS" for a complet... | geertj/python-ad | lib/ad/util/compat.py | Python | mit | 684 |
#!/usr/bin/env python
from subprocess import call
call(["bickle", "builds", "stpettersens/Packager", "-n", "5"])
| stpettersens/Packager | travis.py | Python | mit | 114 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file."""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... | Telecominfraproject/Physical_Simulation_Environment | travis_pypi_setup.py | Python | bsd-3-clause | 4,067 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.