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 |
|---|---|---|---|---|---|
#Numbers from 1-9 and their corresponding factorial [1,2,6,24,120,720,5040,40320,362880]
#Array of digit length? [1,1,1,2,3,3,4,5,6]
#We can use this as min length of string (e.g., if 9 is in the string, the string cannot shorter than 6 digits)
#Test all 2 digit integers
#First pass print a list of numbers that pass th... | bryansim/Python | Exercises/DigitFactorials.py | Python | gpl-2.0 | 326 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Nicolas Duhamel
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of th... | laurentb/weboob | modules/bp/pages/accountlist.py | Python | lgpl-3.0 | 21,140 |
# coding: utf-8
"""Pacote `scielomanager.connectors`.
Um conector é apenas um link entre dois ou mais elementos conectáveis (e.g.,
portas, interfaces etc).
"""
# se apoia na definição da variável __all__ nos módulos.
from .storage import *
__all__ = (storage.__all__, )
| fabiobatalha/SciELO-Manager | scielomanager/scielomanager/connectors/__init__.py | Python | bsd-2-clause | 280 |
# (c) 2018 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import base64
import errno
import json
import os
import pkgutil
import random
import re
from distutils.versio... | HyperBaton/ansible | lib/ansible/executor/powershell/module_manifest.py | Python | gpl-3.0 | 15,884 |
# Django settings for tweetset project.
import os
PROJECT_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')
APP_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
PUBLIC_DIR = os.path.join(PROJECT_DIR, '..', 'public')
ADMINS = (
# ('Michele Colombo', '[email protected]... | mikexine/tweetset | tweetset/tweetset/settings/base.py | Python | mit | 6,535 |
#
# Copyright (c) 2013-2019 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 which... | spohnan/geowave | python/src/main/python/pygw/query/vector/vector_query_builder.py | Python | apache-2.0 | 1,462 |
import mock
from django import test
from request_signer.client.generic import Client
from request_signer.client.generic.django_client import DjangoClient
class DjangoClientTests(test.TestCase):
sut_class = DjangoClient
def setUp(self):
self.django_backend_patch = mock.patch(
'request_sig... | imtapps/django-request-signer | request_signer/tests/test_django_client.py | Python | bsd-2-clause | 976 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pic_locate.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| briansudo/Atlas | manage.py | Python | apache-2.0 | 253 |
# -*- coding: utf-8 -*-
# Copyright (c) 2009 - 2014 Detlev Offenbach <[email protected]>
#
"""
Module implementing a model for password management.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import Qt, QModelIndex, QAbstractTableModel
class PasswordModel(QAbstractTableModel):
"""
... | davy39/eric | Helpviewer/Passwords/PasswordModel.py | Python | gpl-3.0 | 4,502 |
import string
__version__ = string.split('$Revision: 1.6 $')[1]
__date__ = string.join(string.split('$Date: 2001/11/17 14:12:34 $')[1:3], ' ')
__author__ = 'Tarn Weisner Burton <[email protected]>'
__doc__ = 'http://oss.sgi.com/projects/ogl-sample/registry/SUN/convolution_border_modes.txt'
__api_versi... | fxia22/ASM_xf | PythonD/site_python/OpenGL/GL/SUN/convolution_border_modes.py | Python | gpl-2.0 | 585 |
import os
import sys
import subprocess
testP = {
"2005": [
{
"date": "2005-10-17",
"videos": [
"http://thecolbertreport.cc.com/videos/61f6xj/intro---10-17-05",
"http://thecolbertreport.cc.com/videos/w9dr6d/first-show",
"http://thecolbertreport.cc.com/videos/63ite2/the-word---t... | traltixx/pycolbert | pycolbert.py | Python | gpl-2.0 | 853,594 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: tkColorChooser.py
from tkCommonDialog import Dialog
class Chooser(Dialog):
"""Ask for a color"""
command = 'tk_chooseColor'
def _fixopt... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/lib-tk/tkColorChooser.py | Python | unlicense | 1,064 |
hex(ord("c"))
#'0x63'
format(ord("c"), "x")
#'63'
"c".encode("hex") # "hex" isn't an encoding
#'63' | TheShellLand/pies | v3/Libraries/builtin/encode/ascii to hex.py | Python | mit | 103 |
# -*- coding: utf-8 -*-
from openerp import models
class Volunteer(models.Model):
_name = 'res.users'
_inherit = [
'res.users',
'message_template.mixin'
]
def __init__(self, pool, cr):
super(Volunteer, self).__init__(pool, cr)
self._remove_permitted_fields(level='priv... | KamilWo/bestja | addons/bestja_ucw_permissions/models.py | Python | agpl-3.0 | 728 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update the modification times of the given files, and create them if
they do not yet exist.
"""
from __future__ import print_function
import argparse
import os
import sys
def main(args):
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("-c", "-... | ywangd/stash | bin/touch.py | Python | mit | 939 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-21 12:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openunipay', '0004_weixinqrpayentity_weixinqrpayrecord'),
]
operations = [
... | panweifeng/openunipay | openunipay/migrations/0005_product.py | Python | mit | 1,335 |
import os
import six
import sys
import shutil
import subprocess as spr
import tempfile
from unittest import TestCase
from get_ref_dir import get_ref_dir
import numpy as np
ref_dir = get_ref_dir()
test_dir = os.path.dirname(__file__)
remove_temp_files = True
# check if the seaborn version is smaller than 0.8 (withou... | Chilipp/psy-simple | tests/_base_testing.py | Python | gpl-2.0 | 3,925 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
from kubernetes_py.models.v1.ServicePort import ServicePort
from kubernetes_py.utils import *
class ServiceSpec(object):
"""
http://... | mnubo/kubernetes-py | kubernetes_py/models/v1/ServiceSpec.py | Python | apache-2.0 | 6,966 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import OrderedDict
from masters_project_config import *
from subprocess import Popen, PIPE, STDOUT
import re
lth_dir = DATA_PREFIX + '/lth_srl'
class Lth_srl:
def run(self, conllfile, tagged=True):
"""
@param conllfile conllfile
... | trondth/master | lth_srl.py | Python | mit | 902 |
# This file is part of MyPaint.
# Copyright (C) 2007-2008 by Martin Renold <[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 opt... | dvberkel/mypaint | lib/helpers.py | Python | gpl-2.0 | 12,524 |
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from back_end_scripts.cf_mod import cf
from dialogs.win_dialog import win_dialog
import sqlite3
class playback_dialog(QDialog):
def __init__(self, moves):
QDialog.__init__(self)
self.main_layout = QVBoxLayout(self)
... | michaelneuder/connect_four | app/bin/dialogs/playback_dialog.py | Python | mit | 7,904 |
import unittest
from slg.store import Store
class WordTestCase(unittest.TestCase):
def setUp(self):
self.store = Store()
self.store.read_dummy_data_and_setup()
def test_normalize_method_of_store(self):
self.store.normalize()
self.assertEqual(self.store.lists['list_1'][5].nor... | gree-gorey/listOfStimuli_creator | test/test_normalize.py | Python | gpl-2.0 | 401 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Andrew Resch <[email protected]>
#
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
import... | bendykst/deluge | deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py | Python | gpl-3.0 | 4,582 |
class TestTransport(object):
def __init__(self):
self.buffer = None
def write(self, data):
self.buffer = data
| rxtender/rxt-backend-base | test/python3/stream/test_utils.py | Python | mit | 135 |
# coding=UTF-8
from __future__ import print_function, absolute_import, division
import six
import logging
import os.path
import os
logger = logging.getLogger(__name__)
class TSLFWriter(object):
def __init__(self, tslfdir):
"""
Get ready for appends
:param tslfdir:
"""
... | smok-serwis/tslf-format | tslfformat/writing/__init__.py | Python | mit | 345 |
import numpy as np
from numpy import sqrt
from numpy.random import rand
y1 = 1
y2 = 3
def F(y):
n = 1000000
s = 0
for i in range(n):
s += rand()*y
return s/n
xy1 = F(y1)
xy2 = F(y2)
A = np.array([[1, xy1], [1, xy2]])
R = np.array([2, 5])
theta = np.linalg.solve(A, R)
print(theta)
| johnboyington/homework | me777/hw5/hw5_p2.py | Python | gpl-3.0 | 310 |
"""
kombu.utils
===========
Internal utilities.
"""
from __future__ import absolute_import, print_function
import importlib
import random
import sys
from contextlib import contextmanager
from itertools import count, repeat
from time import sleep
from uuid import UUID, uuid4 as _uuid4, _uuid_generate_random
from ko... | andresriancho/kombu | kombu/utils/__init__.py | Python | bsd-3-clause | 12,217 |
# coding: utf-8
import os
import tempfile
import pymorphy
from unittest import TestCase
from textgen.words import Noun, Adjective, Verb, NounGroup, Fake, Participle, ShortParticiple, Pronoun
from textgen.templates import Args, Template, Dictionary, Vocabulary
from textgen.conf import APP_DIR, textgen_settings
from t... | Rogaven/textgen | textgen/tests.py | Python | bsd-2-clause | 43,592 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# knit.__main__
from optparse import OptionParser
from wsgiref.simple_server import make_server
import os
import yaml
import logging
import sys
import signal
from mesh import (
MeshCache,
MeshServer
)
from proxy import (
HTTPProxyServer
)
class KnitMeshP... | crgwbr/knit | knit/__main__.py | Python | isc | 5,790 |
from logger import log
import os
import gconf
import urllib
class Configuration(object):
def __init__(self):
self._config = {}
self._file_path = os.path.join(os.path.dirname(__file__), 'config',
'config.ini')
# Read Files
self._read_file()
def get_value(self, key... | vbabiy/gedit-openfiles | gedit_openfiles/configuration.py | Python | gpl-2.0 | 1,698 |
"""Transformed histograms.
These histograms use a transformation from input values to bins
in a different coordinate system.
There are three basic classes:
* PolarHistogram
* CylindricalHistogram
* SphericalHistogram
Apart from these, there are their projections into lower dimensions.
And of course, it is possible... | janpipek/physt | physt/special_histograms.py | Python | mit | 23,381 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: Mcl_Cmd_DllLoad_Tasking.py
UPLOADS_DIR = 'Uploads'
MAX_CHUNK_SIZE = 1047552
def TaskingMain(namespace):
import mcl.imports
import mcl.target... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Tasking/Mcl_Cmd_DllLoad_Tasking.py | Python | unlicense | 4,516 |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | openstack/manila | manila/scheduler/evaluator/evaluator.py | Python | apache-2.0 | 7,851 |
#Copyright ReportLab Europe Ltd. 2000-2016
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/__init__.py
__version__='3.3.0'
__doc__='''Business charts'''
| EduPepperPDTesting/pepper2013-testing | lms/djangoapps/reportlab/graphics/charts/__init__.py | Python | agpl-3.0 | 252 |
import fnmatch
import os
import re
import py
import pytest
import execnet
import xdist.remote
from _pytest import runner # XXX load dynamically
class NodeManager(object):
EXIT_TIMEOUT = 10
DEFAULT_IGNORES = ['.*', '*.pyc', '*.pyo', '*~']
def __init__(self, config, specs=None, defaultchdir="pyexecnetca... | vicky2135/lucious | oscar/lib/python2.7/site-packages/xdist/slavemanage.py | Python | bsd-3-clause | 12,104 |
#! /usr/bin/python
from ovirtsdk.api import API
from ovirtsdk.xml import params
VERSION = params.Version(major='3', minor='5')
URL = 'https://rhevm.example.com/ovirt-engine/api'
CA = '/etc/pki/ovirt-engine/ca.pem'
USERNAME = 'admin@internal'
PASSWORD = 'paSSwoRD'
HOST_NAME = 'rhevh1'
try:
api = API(url=URL... | mtessun/ovirt-api-scriptlets | print_nic_names.py | Python | gpl-2.0 | 684 |
#!/usr/bin/env python
#
# This file is part of dnf.
#
# Copyright 2015 (C) Igor Gnatenko <[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 Li... | kudlav/dnf | dnf/cli/completion_helper.py | Python | gpl-2.0 | 6,785 |
import logging
import numpy as np
from .psd import ParametricSpectrum
__all__ = ["arcovar", "arcovar_marple", "pcovar", 'arcovar_marple']
def arcovar_marple(x, order):
r"""Estimate AR model parameters using covariance method
This implementation is based on [Marple]_. This code is far more
complicated ... | cokelaer/spectrum | src/spectrum/covar.py | Python | bsd-3-clause | 12,743 |
SIZE = 1000000
LEN = 3 * SIZE
dp = [-1 for i in xrange(LEN)]
def gao(v):
nn = v / 2 if v % 2 == 0 else 3 * v + 1
if v >= LEN or nn >= LEN:
u = gao(nn)
elif dp[nn] == -1:
u = gao(nn)
dp[v] = u + 1
else:
u = dp[nn]
dp[v] = u + 1
return u + 1
def main():
... | neutronest/eulerproject-douby | e14/14.py | Python | mit | 490 |
from synergy.db.model.queue_context_entry import queue_context_entry
from synergy.scheduler.scheduler_constants import PROCESS_GC, TOKEN_GC, PROCESS_MX, TOKEN_WERKZEUG, EXCHANGE_UTILS, \
PROCESS_SCHEDULER, TOKEN_SCHEDULER, QUEUE_UOW_STATUS, QUEUE_JOB_STATUS, PROCESS_LAUNCH_PY, TOKEN_LAUNCH_PY, \
ROUTING_IRRELEV... | mushkevych/scheduler | synergy/conf/global_context.py | Python | bsd-3-clause | 1,649 |
#!/usr/bin/env python
# pycodestyle.py - Check Python source code formatting, according to PEP 8
#
# Copyright (C) 2006-2009 Johann C. Rocholl <[email protected]>
# Copyright (C) 2009-2014 Florent Xicluna <[email protected]>
# Copyright (C) 2014-2016 Ian Lee <[email protected]>
#
# Permission is hereby gran... | Elizaveta239/PyDev.Debugger | third_party/pep8/pycodestyle.py | Python | epl-1.0 | 88,598 |
#!/usr/bin/python -u
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 ap... | mjzmjz/swift | test/probe/test_reconstructor_revert.py | Python | apache-2.0 | 13,517 |
import json
import BaseHTTPServer
from src import data
PORT = 8700
server_address = ('', PORT)
class request_handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
content_len = int(self.headers.getheader('content-length', 0))
self.post_data = json.loads(self.rfile.read(content_len))
s... | PandemicPIG/binStore | app/exec.py | Python | mit | 963 |
#
# Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/]
#
# This file is part of Outer Space.
#
# Outer Space 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
# (... | ospaceteam/outerspace | client/osci/dialog/BookingDlg.py | Python | gpl-2.0 | 13,911 |
from __future__ import absolute_import
from functools import partial
from pkg_resources import Requirement, resource_filename
import re
from mako.template import Template
from sqlalchemy import MetaData, select, create_engine, text
from sqlalchemy.exc import ArgumentError
from fixturegen.exc import (
NoSuchTable,... | anton44eg/fixturegen | fixturegen/generator.py | Python | mit | 2,782 |
default_app_config = "agir.events.apps.EventsConfig"
| lafranceinsoumise/api-django | agir/events/__init__.py | Python | agpl-3.0 | 53 |
from blur.Stone import *
from blur.Classes import *
from blur.Freezer import *
from PyQt4.QtCore import *
from PyQt4.QtSql import *
import traceback, os
import subprocess
class CobblerProfileViewerPlugin(HostViewerPlugin):
def __init__(self):
HostViewerPlugin.__init__(self)
def name(self):
re... | jacksonwilliams/arsenalsuite | cpp/apps/freezer/afplugins/cobbler_profile_plugin.py | Python | gpl-2.0 | 1,106 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sqlite3
# 连接到SQLite数据库
# 数据库文件是test.db
# 如果文件不存在,会自动在当前目录创建:
conn = sqlite3.connect('test.db')
# 创建一个Cursor:
cursor = conn.cursor()
# 执行一条SQL语句,创建user表:
cursor.execute('create table user (id varchar(20) primary key, name varchar(20))')
# 继续执行一条SQL语句,插入一条记录:
cursor... | dabin521/learn-python3 | samples/db/do_sqlite.py | Python | gpl-2.0 | 921 |
# Copyright 2016 - Twitter. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | streamlio/heron | heron/api/src/python/bolt/window_bolt.py | Python | apache-2.0 | 6,551 |
# file ddisearch/__init__.py
#
# Copyright 2014 Emory University
#
# 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 appli... | emory-libraries/ddi-search | ddisearch/__init__.py | Python | apache-2.0 | 1,053 |
from app import app, db, auto
from app.models import macros
from flask import abort, jsonify, request, Response
from flask_login import login_required, current_user
import json
@app.route('/ThreatKB/macros', methods=['GET'])
@auto.doc()
@login_required
def get_all_macros():
"""Return all macros
Return: list o... | InQuest/ThreatKB | app/routes/macros.py | Python | gpl-2.0 | 3,384 |
# This file is part of HamsiManager.
#
# Copyright (c) 2010 - 2015 Murat Demir <[email protected]>
#
# Hamsi Manager 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 yo... | supermurat/hamsi-manager | Databases/__init__.py | Python | gpl-3.0 | 6,584 |
import logging
import tarfile
import tempfile
import os
import fabric.api
import fabric.operations
import cloudenvy.envy
class Dotfiles(cloudenvy.envy.Command):
def _build_subparser(self, subparsers):
help_str = 'Upload dotfiles from your local machine to an Envy.'
subparser = subparsers.add_pa... | sysbot/cloudenvy | cloudenvy/commands/dotfiles.py | Python | apache-2.0 | 1,933 |
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['rqt_static_tf'],
package_dir={'': 'src'}
)
setup(**d)
| ethz-asl/tf-plugins | rqt_static_tf/setup.py | Python | lgpl-3.0 | 211 |
from DocFormat import DocFormat
class DocFormatInvalid(DocFormat):
ROBOT_LIBRARY_DOC_FORMAT = 'invalid'
DocFormatInvalid.__doc__ = DocFormat.__doc__
| yahman72/robotframework | atest/testdata/libdoc/DocFormatInvalid.py | Python | apache-2.0 | 157 |
from parsl.channels.local.local import LocalChannel
def test_local():
channel = LocalChannel(None, None)
ec, out, err = channel.execute_wait('echo "pwd: $PWD"', 2)
assert ec == 0, "Channel execute failed"
print("Stdout: ", out)
print("Stderr: ", err)
if __name__ == "__main__":
test_local... | swift-lang/swift-e-lab | parsl/tests/integration/test_channels/test_channels.py | Python | apache-2.0 | 323 |
from app import db
from app.models import User
from flask_script import Manager
user_command = Manager(usage='Add a new user')
@user_command.option('--admin', dest='admin', default=False, help='Admin flag')
def add(admin=False):
"""
This is the manager command to add a new user to database.
Use '--admin=... | Badzyo/tic-tac-toe | app/commands/add_user.py | Python | mit | 738 |
import json
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
if __name__ == "__main__":
store = pd.HDFStore("two_reservoir_moea.h5")
fig, ax = plt.subplots(figsize=(6, 6))
colors = sns.color_palette()
for color, key in zip(colors, store.keys()):... | pywr/pywr | examples/two_reservoir/two_reservoir_plot.py | Python | gpl-3.0 | 664 |
#!/usr/bin/env python
import unittest
import sys
if __name__ == '__main__':
suite = unittest.TestLoader().discover('./')
results = unittest.TextTestRunner(verbosity=3).run(suite)
if results.errors or results.failures:
sys.exit(1)
| adsabs/myads | vault_service/tests/run_tests.py | Python | gpl-2.0 | 241 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | hohoins/ml | cifar10/cifar10.py | Python | apache-2.0 | 13,819 |
from django.contrib.auth.models import User
from django.db import models
# Forward declared intermediate model
class Membership(models.Model):
person = models.ForeignKey('Person', models.CASCADE)
group = models.ForeignKey('Group', models.CASCADE)
price = models.IntegerField(default=100)
def __str__(s... | uranusjr/django | tests/m2m_through_regress/models.py | Python | bsd-3-clause | 3,268 |
from __future__ import absolute_import
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.lib.actions import send_referral_event
from zerver.models import get_user_profile_by_email
class Command(BaseCommand):
help = """Grants a user invites... | sonali0901/zulip | zilencer/management/commands/grant_invites.py | Python | apache-2.0 | 1,141 |
#!/usr/bin/env python
"""Register all available client actions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import platform
import sys
from grr_response_client import client_actions
from grr_response_client.client_actions import admin
from grr_resp... | dunkhong/grr | grr/client/grr_response_client/client_actions/registry_init.py | Python | apache-2.0 | 6,219 |
"""
Tests for L{pyflakes.scripts.pyflakes}.
"""
import sys
from io import StringIO
import tempfile
import os.path
import os
from unittest import TestCase
from pyflakes.scripts.pyflakes import checkPath
def withStderrTo(stderr, f):
"""
Call C{f} with C{sys.stderr} redirected to C{stderr}.
"""
(outer... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/spyderlib/utils/external/pyflakes/test/test_script.py | Python | gpl-3.0 | 5,280 |
import os
import warnings
from django.core.management.base import BaseCommand
from django.utils.deprecation import RemovedInDjango20Warning
class Command(BaseCommand):
help = "Runs a Python interactive interpreter. Tries to use IPython or bpython, if one of them is available."
requires_system_checks... | yephper/django | django/core/management/commands/shell.py | Python | bsd-3-clause | 4,868 |
from __future__ import division
from copy import deepcopy
import FreeCAD
from PySide import QtGui
from pivy import coin
import FreeCADGui as Gui
import FreeCAD as App
from openglider.jsonify import dump, load
from openglider.vector.spline import BernsteinBase, BSplineBase
from openglider.glider import ParametricGlide... | booya-at/freecad_glider | freecad/freecad_glider/tools/_tools.py | Python | lgpl-2.1 | 5,512 |
class protein ():
pass
def fastaParser(pFile, seq_format):
if seq_format != "fasta":
print "Cannot read non-fasta protein records without biopython."
exit()
yield -1
newProt = protein()
sequence = []
for line in pFile.readlines():
if line[0] == ";":
conti... | DeclanCrew/LC_MS_MS_Search | fastaParse.py | Python | gpl-3.0 | 729 |
from trifle.server.views.frontend import frontend
from trifle.server.views.api import api
from trifle.server.views.monitor import monitor
from trifle.server.views.configure import configure
| gloaec/trifle | src/trifle/server/views/__init__.py | Python | gpl-3.0 | 200 |
# -*- coding: utf-8 -*-
"""CLI features. We can expect functions that ask for user input,
have side effects and are heavily procedural here: it's OK.
"""
from __future__ import print_function
import click
import logging
import os
import os.path
import sys
from collections import defaultdict
from ptoolbox import lo... | vperron/picasa-toolbox | ptoolbox/cli.py | Python | mit | 5,178 |
# coding: utf-8
"""
find.py
~~~~~~~
查找用户名是否被占用
"""
from flask import request, jsonify
from . import api
from muxiwebsite.models import User
@api.route('/username/')
def find_username():
"""
查找用户名是否被占用
安卓提供用户名
"""
username = request.args.get('username')
register_username = []
... | Muxi-Studio/muxi_site | muxiwebsite/api/find.py | Python | mit | 990 |
# coding=utf-8
# Copyright 2021 HuggingFace 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 ag... | huggingface/transformers | tests/speech_to_text/test_feature_extraction_speech_to_text.py | Python | apache-2.0 | 10,984 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from wsgi import app
import json
# Flask imports
from flask import render_template, session, request, redirect, url_for, flash
# Users data for login
from module_login.forms import MyForm
from module_login.models import DatosUsuarios
# To use Google APIs Client Library
from... | fnbellomo/boneApp | wsgi/route.py | Python | mit | 6,584 |
from rdflib.term import URIRef, Literal
from rdflib.namespace import Namespace, RDF, RDFS
from rdflib import plugin
from rdflib.parser import StringInputSource
from rdflib.graph import Graph, ReadOnlyGraphAggregate, ConjunctiveGraph
import sys
from pprint import pprint
def testSPARQLNotEquals():
NS = u"http://exa... | alcides/rdflib | test/test_sparql/test_not_equals.py | Python | bsd-3-clause | 1,072 |
from django.core.management.base import BaseCommand, CommandError
from django.db import IntegrityError
import olympia.core.logger
from olympia.access.models import Group, GroupUser
from olympia.users.models import UserProfile
class Command(BaseCommand):
help = 'Add a new user to a group.'
log = olympia.core... | harikishen/addons-server | src/olympia/zadmin/management/commands/addusertogroup.py | Python | bsd-3-clause | 1,528 |
# -*- coding: utf-8 -*-
from openerp.osv import orm, fields
class ProductProduct(orm.Model):
_inherit = 'product.product'
_columns = {
'standard_service_time': fields.float(string="Standard Service Time")
}
_defaults = {
'standard_service_time': 1
}
| iw3hxn/LibrERP | sale_order_requirement_project/models/product_product.py | Python | agpl-3.0 | 291 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
class Enum(object):
_attributes_cache = None
_values_dict_cache = None
@classmethod
def _attributes(cls):
if cls._attributes_cache is None:
attrs = [name for name in dir(cls)
if na... | marynate/psd-tools | src/psd_tools/constants.py | Python | mit | 9,820 |
from functools import reduce
from tests.base_unittest import BaseUnitTest
from mock import patch
import pypokerengine.engine.hand_evaluator
from pypokerengine.engine.player import Player
from pypokerengine.engine.pay_info import PayInfo
from pypokerengine.engine.table import Table
from pypokerengine.engine.game_evalua... | ishikota/PyPokerEngine | tests/pypokerengine/engine/game_evaluator_test.py | Python | mit | 5,278 |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division, unicode_literals
from .users import UsersService, RolesService
users = UsersService()
roles = RolesService()
| derek-miller/flask-template | flask_template/services.py | Python | bsd-3-clause | 201 |
from settings import *
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['myapp.com']
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
DATABASES = {}
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.l... | netblue/dang | myapp/settings_local.prod.sample.py | Python | mit | 579 |
'''
Created on 22.07.2016
@author: Jonas
'''
from flask.globals import session
from flask_restplus import Namespace, Model, fields
from flask_restplus import Resource
from son_editor.impl import nsfslookupimpl
from son_editor.util.constants import WORKSPACES, PROJECTS, NSFS, SERVICES, VNFS
from son_editor.util.reques... | chrz89/upb-son-editor-backend | src/son_editor/apis/nsfslookup.py | Python | apache-2.0 | 2,694 |
# coding: utf-8
from flask import Flask, send_from_directory, request, redirect, render_template, session, make_response
import random
import math
import os
# init.py 為自行建立的起始物件
import init
import users.a.g1.ag1_40323105
#import users.a.g1.ag1_40323148
import users.a.g2.ag2_40323120
import users.a.g2.ag2_40323122
impor... | 2015fallhw/cdw11 | myflaskapp.py | Python | agpl-3.0 | 27,507 |
from . import Frequency
from enum import Enum
class CP500(Frequency):
RECEIVE_DELAY1 = 1
RECEIVE_DELAY2 = 2
JOIN_ACCEPT_DELAY1 = 5
JOIN_ACCEPT_DELAY2 = 6
MAX_FCNT_GAP = 16384
ADR_ACK_LIMIT = 64
ADR_ACK_DELAY = 32
ACK_TIMEOUT = 2 # 2 +/-1 s random delay between 1 and 3 seconds
R... | soybean217/lora-python | UServer/userver/frequency_plan/CP500.py | Python | mit | 2,792 |
# -*- coding: utf-8 -*-
# (c) 2012-2014, Michael DeHaan <[email protected]>
# (c) 2016 Toshio Kuratomi <[email protected]>
# (c) 2017-2018 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_func... | andmos/ansible | test/units/module_utils/common/test_sys_info.py | Python | gpl-3.0 | 3,576 |
#!/usr/bin/env python
import time
import serial
import http.client
ser = serial.Serial(
port='/dev/ttyAMA0',
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
counter=0
while 1:
... | rgonzaleztec/icsscREDES | Verano2016-17/WeatherStation/serial_read.py | Python | cc0-1.0 | 1,180 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2015, 2016 CERN.
#
# INSPIRE 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... | jacenkow/inspire-next | inspirehep/modules/migrator/models.py | Python | gpl-2.0 | 1,748 |
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");... | scripnichenko/nova | nova/cells/messaging.py | Python | apache-2.0 | 86,256 |
"""
En las competencias de clavados, cada salto es evaluado por un panel de siete jueces. Cada juez entrega una
puntuacion en una escala de 1 a 10, con incrementos de 0:5 . La puntuacion mas alta y la mas baja son
eliminadas. La suma de los cinco puntajes restantes es multiplicada por 0.6 , y el resultado es multipl... | xbash/LabUNAB | 03_condiciones/Ejercicio8_saltos.py | Python | gpl-3.0 | 1,849 |
# Unit that allows sharing a single Indexer object for the whole app.
#
# Copyright: (c) Daniel Duma 2014
# Author: Daniel Duma <[email protected]>
# For license information, see LICENSE.TXT
from __future__ import absolute_import
from base_index import BaseIndexer
global Indexer
Indexer=BaseIndexer()
def useLo... | danieldmm/minerva | evaluation/index.py | Python | gpl-3.0 | 574 |
# -*- coding: utf-8 -*-
from flask import g
from flask_restful import Resource, marshal_with
from flask_restful_swagger import swagger
from app.mod_shared.models.auth import auth
from app.mod_profiles.models import Analysis
from app.mod_profiles.common.fields.measurementFields import MeasurementFields
from app.mod_pr... | adamantike/salud-api | app/mod_profiles/resources/lists/analysisMeasurementList.py | Python | gpl-2.0 | 1,982 |
#!/usr/bin/env python
import roslib
import rospy
from visualization_msgs.msg import Marker
from geometry_msgs.msg import Point, Pose
#from tf.transformations import quaternion_from_euler
#from math import pi
def poseupdate():
#set up marker
marker_scale = 0.4
marker_lifetime = 0
marker_ns = 'waypo... | sunzuolei/rosss2015 | ros_workshop/robot_demos/nodes/pose_marker.py | Python | mit | 2,994 |
# -*- coding:utf-8 -*-
from django import forms
class SignupForm(forms.Form):
username = forms.CharField(required=True, min_length=6, label='用户名')
email = forms.EmailField(required=True, label='Email')
upwd = forms.CharField(required=True, min_length=6, label='密码')
repwd = forms.CharField(required=Tru... | kaysen820/Kblog | django/Kblog/forms.py | Python | bsd-3-clause | 813 |
''' @Summary: Contains all database table schema for access through python '''
import json, sqlalchemy, uuid
from api import db, app
from flask_security import RoleMixin
from flask_login import UserMixin
from passlib.apps import custom_app_context as pwd_context
from itsdangerous import (TimedJSONWebSignatureSerialize... | flyballlabs/threatdetectionservice | api/sql/models.py | Python | apache-2.0 | 8,000 |
from random import choice
from tota.utils import adjacent_positions
AUTHOR = 'fisa'
def create():
def noob_hero_logic(self, things, t):
actions = 'move', 'attack', 'fireball', 'heal', 'stun'
positions = adjacent_positions(self.position)
return 'stun', self.position
return choic... | matuu/tota | tota/heroes/noob.py | Python | mit | 378 |
# Copyright 2018 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 agre... | openstack/diskimage-builder | diskimage_builder/elements/package-installs/tests/test_package_squash.py | Python | apache-2.0 | 7,323 |
# 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 | generalization/utils/trainer_utils_test.py | Python | apache-2.0 | 6,847 |
#!/usr/bin/python
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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-... | open-switch/ops-cli | tests/test_vtysh_ct_show_version_detail.py | Python | gpl-2.0 | 3,544 |
#!/usr/bin/env python
from __future__ import division
import os
import sys
import argparse
import numpy as np
import pandas as pd
import healpy as hp
from sklearn.model_selection import train_test_split
import comptools as comp
import comptools.anisotropy.anisotropy as anisotropy
def get_random_times(store, n_rows,... | jrbourbeau/cr-composition | processing/legacy/anisotropy/ks_test/make_maps.py | Python | mit | 4,303 |
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | unitedstack/rock | rock/monitor.py | Python | apache-2.0 | 1,217 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import time
import uuid
import calendar
import datetime
import threading
import unidecode
import appier
import appier_extras
LOCKS_MAP = {}
""" Map with locks indexed by name """
class Base(appier_extras.admin.Base):
id = dict(
typ... | tsilva/appier_scaffold | src/models/base.py | Python | apache-2.0 | 6,730 |
# Copyright 2017-2018 Akretion (http://www.akretion.com)
# Sébastien BEAU <[email protected]>
# Raphaël Reverdy <[email protected]>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Base JSONify",
"summary": "Base module that provide the jsonify method on all ... | OCA/server-tools | base_jsonify/__manifest__.py | Python | agpl-3.0 | 851 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.