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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from . import test_stock_landed_costs_purchase
| chienlieu2017/it_management | odoo/addons/stock_landed_costs/tests/__init__.py | Python | gpl-3.0 | 72 |
try:
import serial # Python2
except ImportError:
from serial3 import * # Python3
from nupic.frameworks.opf.modelfactory import ModelFactory
import os,sys
ser = serial.Serial('/dev/ttyACM0', 9600)
def get_online(number_of_records=20):# 0 means forever
model = ModelFactory.loadFromCheckpoint(os.getcwd()... | lmaag182/nupic_physical | online.py | Python | agpl-3.0 | 994 |
"""
WSGI config for print_web_django project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJ... | aabmass/print-web | print_web_django/print_web_django/wsgi.py | Python | mit | 410 |
# 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... | rahulunair/nova | nova/tests/unit/policies/test_admin_actions.py | Python | apache-2.0 | 5,313 |
#!/usr/bin/env python
#
# Beautiful Capi generates beautiful C API wrappers for your C++ classes
# Copyright (C) 2015 Petr Petrovich Petrov
#
# This file is part of Beautiful Capi.
#
# Beautiful Capi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | PetrPPetrov/beautiful-capi | source/BuiltinTypeGenerator.py | Python | gpl-3.0 | 4,832 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('course_selection', '0018_auto_20150830_0319'),
]
operations = [
migrations.AlterUniqueTogether(
name='friend_rel... | maximz/recal | course_selection/migrations/0019_auto_20150903_0458.py | Python | mit | 809 |
"""
OpenWebRX csdr plugin: do the signal processing with csdr
This file is part of OpenWebRX,
an open-source SDR receiver software with a web UI.
Copyright (c) 2013-2015 by Andras Retzler <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of th... | simonyiszk/openwebrx | csdr.py | Python | agpl-3.0 | 19,253 |
"""
WSGI config for Practica_Ajax project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Practica_Ajax.settings")
from d... | Titulacion-Sistemas/PracticasDjango | Practica_Ajax/Practica_Ajax/wsgi.py | Python | gpl-2.0 | 401 |
import subprocess
import setup_util
import multiprocessing
import os
bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/pypy/bin')
NCPU = multiprocessing.cpu_count()
proc = None
def start(args, logfile, errfile):
global proc
setup_util.replace_text("flask/app.py", "DBHOSTNAME", args.database_host)... | seem-sky/FrameworkBenchmarks | flask/setup_pypy.py | Python | bsd-3-clause | 715 |
# Copyright nycz 2011-2020
# This file is part of Kalpana.
# Kalpana 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.
# Kalpana is di... | kalpana-org/kalpana | kalpana/settings.py | Python | gpl-3.0 | 9,169 |
#coding: utf-8
__author__ = 'bozyao'
from math import log
from numpy import array
def getEnt(dict):
'''
给入字典统计结果,给出此结果的熵
dict: 统计的数据结果
返回: 香农熵
'''
ent = 0.0
total = sum(dict.values())
#total = array(dict.values()).sum()
for key in dict:
proportion = dict[key] * 1.0 ... | bozyao/data_dig_tools | ent.py | Python | apache-2.0 | 856 |
# Copyright 2019 D-Wave Systems 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... | dwavesystems/dimod | tests/test_scalecomposite.py | Python | apache-2.0 | 5,604 |
import falcon
import requests
from falsy.jlog.jlog import JLog
log = JLog().bind()
def get_it(name):
log.debug('get it')
return {
'get': name
}
| pingf/falsy | demo/easy/ops/hello.py | Python | mit | 169 |
#!/usr/bin/python2.7
# -*- encoding: utf-8 -*-
__author__ = "Tomáš Beluský"
__date__ = "09.03. 2013"
import types
class VcfCreator:
"""
Creator of VCF output
"""
def __init__(self, filename, output):
"""
Initialize variables
"""
self.__filename = filename
self.__outputName = output
s... | tomasbelusky/gataca | src/resources/VcfCreator.py | Python | gpl-3.0 | 2,975 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/operations/usages_operations.py | Python | mit | 4,282 |
"""empty message
Revision ID: b74c132e4997
Revises:
Create Date: 2017-03-03 12:29:36.271400
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b74c132e4997'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | django-ch/olympus-project | src/migrations/versions/b74c132e4997_.py | Python | gpl-2.0 | 1,055 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RStringfish(RPackage):
"""Alt String Implementation
Provides an extendable, performan... | LLNL/spack | var/spack/repos/builtin/packages/r-stringfish/package.py | Python | lgpl-2.1 | 961 |
import subprocess
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from openwisp_utils.base import KeyField
from .. import settings as app_settings
from .base import BaseCo... | openwisp/django-netjsonconfig | django_netjsonconfig/base/vpn.py | Python | gpl-3.0 | 8,633 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: yyg
@Create: 2016MMDD
@LastUpdate: 2016-12-15 HH:MM:SS
@Version: 0.0
"""
from json import load
from logging import (Formatter, _defaultFormatter, exception,
getLogger, FileHandler, basicCon... | hipnusleo/laserjet | lib/core/loggers.py | Python | apache-2.0 | 1,506 |
HEADER_HUP = b"\x00"
HEADER_RESOLVE = b"\x11"
HEADER_NOTIFY = b"\x12"
HEADER_EVAL = b"\x13"
HEADER_REPLY = b"\x14"
HEADER_MESSAGE_ERROR = b"\x15"
HEADER_GENERAL_ERROR = b"\x16"
HEADER_TIME = b"\x17"
HEADER_FILTER_IN = b"\x18"
HEADER_FILTER_OUT = b"\x19"
HEADER_FIL... | disnesquick/ripley | scratch/py/backups/old/headers.py | Python | gpl-2.0 | 342 |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft Corporation
#
# 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
#
# U... | Azure/azure-linux-extensions | VMEncryption/main/oscrypto/ubuntu_1404/encryptstates/PatchBootSystemState.py | Python | apache-2.0 | 6,662 |
import unittest, os, sys
from blackjack.cmake.target.LibTarget_Imported import LibTarget_Imported
from blackjack.cmake.target.LibTypes import LibTypes
class Test_LibTarget_Imported(unittest.TestCase):
def test_render(self):
block1 = LibTarget_Imported("lib target1", LibTypes.STATIC, True)
result ... | grbd/GBD.Build.BlackJack | blackjack/test/cmake/target/LibTarget_Imported.py | Python | apache-2.0 | 574 |
import pytest
from flask import Flask, request
from skylines.api.middleware import HTTPMethodOverrideMiddleware
@pytest.fixture
def app():
test_app = Flask(__name__)
test_app.wsgi_app = HTTPMethodOverrideMiddleware(test_app.wsgi_app)
@test_app.route('/', methods=HTTPMethodOverrideMiddleware.allowed_meth... | kerel-fs/skylines | tests/api/middleware/method_override_test.py | Python | agpl-3.0 | 1,967 |
from lightbulb.api.api_native import LightBulb
import base64
lightbulbapp = LightBulb()
path = "/test/env/bin/lightbulb" #Path to binary
configuration_A = {'TESTS_FILE_TYPE': 'None', 'ALPHABET': '32-57,58-64,65-126', 'SEED_FILE_TYPE': 'FLEX', 'TESTS_FILE': 'None','DFA1_MINUS_DFA2': 'True', 'SAVE': 'False', 'HANDLER... | lightbulb-framework/lightbulb-framework | examples/test_custom_api_native_example_1.py | Python | mit | 1,286 |
import sys
MAX_VOL_X = int(sys.argv[1]) if len(sys.argv) >= 2 else 9
MAX_VOL_Y = int(sys.argv[2]) if len(sys.argv) >= 3 else 4
TARGET_VOLUME = int(sys.argv[3]) if len(sys.argv) >= 4 else 2
class CupState:
volume_x = 0
volume_y = 0
parent = False
def __init__(self , vol_x , vol_y , parent_state):
self.volume_x ... | fyquah95/fyquah95.github.io | projects/cups/cups.py | Python | mit | 2,458 |
try:
import hashlib as md5
except ImportError: # Python <2.5
import md5
import random
import types
import urllib.parse, urllib.error
import urllib.parse
from python_digest.utils import parse_parts, format_parts
_REQUIRED_DIGEST_RESPONSE_PARTS = ['username', 'realm', 'nonce', 'uri', 'response', 'algorithm... | webitup/python3-digest | python_digest/__init__.py | Python | bsd-3-clause | 10,127 |
BRANCH = "mozilla-aurora"
MOZ_UPDATE_CHANNEL = "aurora"
MOZILLA_DIR = BRANCH
JAVA_HOME = "/tools/jdk6"
JARSIGNER = "tools/release/signing/mozpass.py"
OBJDIR = "obj-l10n"
EN_US_BINARY_URL = "http://stage.mozilla.org/pub/mozilla.org/mobile/nightly/latest-%s-android/en-US" % (BRANCH)
#STAGE_SERVER = "dev-stage01.srv.relen... | ctalbert/mozharness | configs/single_locale/mozilla-aurora_android.py | Python | mpl-2.0 | 2,960 |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as SsnProvider
class Provider(SsnProvider):
ssn_formats = ("?#########",)
@classmethod
def ssn(cls):
return cls.bothify(cls.random_element(cls.ssn_formats)).upper()
| Nebucatnetzer/tamagotchi | pygame/lib/python3.4/site-packages/faker/providers/ssn/zh_TW/__init__.py | Python | gpl-2.0 | 267 |
"""
Django settings for cavelanguage project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import ... | Axilent/cave-language | cavelanguage/settings.py | Python | mit | 4,870 |
# -*- coding: utf-8 -*-
"""
release
~~~~~~~
Helper script that performs a release. Does pretty much everything
automatically for us.
:copyright: (c) 2014 by the J5.
:license: BSD, see LICENSE for more details.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for mor... | j-5/zask | bin/release.py | Python | bsd-3-clause | 3,872 |
# coding: utf-8
import numpy as np
from .cameraConfig import Camera_config
from .._global import OptionalModule
try:
from PIL import ImageTk, Image
except (ModuleNotFoundError, ImportError):
ImageTk = OptionalModule("pillow")
Image = OptionalModule("pillow")
try:
import cv2
except (ModuleNotFoundError, Impor... | LaboratoireMecaniqueLille/crappy | crappy/tool/cameraConfigBoxes.py | Python | gpl-2.0 | 1,822 |
import xbmcaddon
import xbmcgui
import xbmc
import os
import sys
import re
import json
__addon__ = xbmcaddon.Addon()
__plugin__ = __addon__.getAddonInfo('name')
__addonid__ = __addon__.getAddonInfo('id')
__addonversion__ = __addon__.getAddonInfo('version')
__language__ = __addon__.getLocalizedString
__icon__ = _... | arKtelix/plugin.program.1.search | 1search.py | Python | gpl-2.0 | 4,431 |
class Holder(object):
"""
A holder is used to encapsulate messages between Rockit and its plugins.
It creates a standard way of communication.
This object contains common functionality for all holders.
"""
def __init__(self):
self._content = dict()
def append(self, item, group='i... | acreations/rockit-server | rockit/core/holders/holder.py | Python | mit | 1,708 |
from django.conf.urls import patterns, url
urlpatterns = patterns('tendenci.apps.dashboard',
url(r'^$', 'views.new', name="dashboard"),
url(r'^new/$', 'views.new', name="dashboard-new"),
url(r'^old/$', 'views.index', name="dashboard-old"),
url(r'^customize/$', 'views.customize', name="dashboard_customi... | alirizakeles/tendenci | tendenci/apps/dashboard/urls.py | Python | gpl-3.0 | 328 |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | WCCCEDU/twitter-commons | src/python/twitter/common/http/__init__.py | Python | apache-2.0 | 950 |
# encoding=utf-8
__author__ = 'Q-Whai'
'''
DESC: 这个是测试程序的入口
Blog: http://blog.csdn.net/lemon_tree12138
Create Date: 2016/2/24
Last Modify: 2016/3/9
version: 0.0.1
'''
import sys
import config.config as conf
import cipher.image_cipher as cipher
from games.game_2048 import Game2048
import cipher.hash_cipher as hah
imp... | William-Hai/SimpleDemo-python | demo_main.py | Python | gpl-3.0 | 2,966 |
import logging
import logging.handlers
import time
import multiprocessing
from datetime import datetime
import enum
import flask
from flask import (
Flask, flash, redirect, render_template, request,
session, url_for
)
from flask.ext.sqlalchemy import SQLAlchemy
from flask_wtf import Form
import itertoo... | karlorg/drunken-octo-avenger | app/main.py | Python | cc0-1.0 | 32,063 |
from Wordclient import *
from Hypers import alpha
import operator
class Sentenceclient:
def __init__(self, sentence1, sentence2):
wordhash = Shelveopen('Hash#1.shelve')
self.sent1 = Purify(sentence1, wordhash) # Sending Hash from here as prevents opening and closing again n again
self.sent2 = Purify(sentence2, ... | anirudhagar13/SS_Graph | Sentenceclient.py | Python | apache-2.0 | 5,987 |
import warnings
from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
from django.views.generic.deta... | DrMeers/django | django/views/generic/edit.py | Python | bsd-3-clause | 8,675 |
#!/usr/bin/env python
"""
The fMRIPrep on Docker wrapper
This is a lightweight Python wrapper to run fMRIPrep.
Docker must be installed and running. This can be checked
running ::
docker info
Please report any feedback to our GitHub repository
(https://github.com/poldracklab/fmriprep) and do not
forget to credit ... | poldracklab/fmriprep | wrapper/fmriprep_docker.py | Python | bsd-3-clause | 18,834 |
# -*- coding: utf-8 -*-
#
# 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
#... | cfei18/incubator-airflow | setup.py | Python | apache-2.0 | 11,546 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import shutil
import pyauto_functional # Must be imported before pyauto
import pyauto
import test_utils
... | plxaye/chromium | src/chrome/test/functional/prefs.py | Python | apache-2.0 | 15,070 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import os
import gevent
import logging
import kazoo.client
import kazoo.exceptions
import kazoo.handlers.gevent
import kazoo.recipe.election
from kazoo.client import KazooState
from kazoo.retry import KazooRetry
from bitarray import bitarray
from cfg... | tcpcloud/contrail-controller | src/config/common/zkclient.py | Python | apache-2.0 | 14,983 |
#!/usr/bin/env python
"""conference_session.py
Models for the ConferenceSession ndb kind and protorpc messages.
"""
from protorpc import messages
from google.appengine.ext import ndb
class ConferenceSession(ndb.Model):
"""Session -- Session object"""
title = ndb.StringProperty(required=True)
highlight... | kevindoole/udacity_p4 | models/conference_session.py | Python | apache-2.0 | 1,949 |
#!/usr/bin/env python
# This is the Python3 implementation of the UEAlite stemmer
# DJS Oct 2015
# import modules used here
import sys
import re
import os
import codecs
# Gather our code in a main() function
def main():
#textin = open('COMMON.TXT', 'rU')
#outlist = open('stemmed_text.txt', 'w')
stem_doc(textin)
... | JoeDurrant/pysearch | UEAlite.py | Python | gpl-2.0 | 30,679 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def binaryTreePaths(self, root):
"""
:type root: TreeNode
:rtype: List[str]
"""
... | Jspsun/LEETCodePractice | Python/BinaryTreePaths.py | Python | mit | 849 |
# 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 use ... | airbnb/kafka | tests/kafkatest/services/monitor/jmx.py | Python | apache-2.0 | 5,768 |
# -*- coding: utf-8 -*-
from apps.registro.models.AnexoConexionInternet import AnexoConexionInternet
from apps.registro.models.TipoConexion import TipoConexion
from django.core.exceptions import ValidationError
from django import forms
class AnexoConexionInternetForm(forms.ModelForm):
tipo_conexion = forms.ModelCho... | MERegistro/meregistro | meregistro/apps/registro/forms/AnexoConexionInternetForm.py | Python | bsd-3-clause | 1,169 |
from configuration import main_configuration as config
from flask import Flask
from flask import abort, redirect, url_for
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.ext.declarative import declarative_base
import base64, random
import string
from datetime import datetime
app = Flask(__name__)
app.conf... | walachey/football-worldcup-simulator | web/database_models.py | Python | mit | 21,042 |
import os
import xmlrpc.client
from subprocess import Popen, PIPE
import shutil
pypi = xmlrpc.client.ServerProxy('https://pypi.org')
DIRECTORIES_TO_SEARCH_FORM = [
os.path.join('.'),
os.path.join('pyforms-web'),
os.path.join('pyforms-web', 'orquestra'),
os.path.join('pyforms-gui'),
os.path.join('... | UmSenhorQualquer/pyforms | utils/deploy-pypi.py | Python | mit | 2,402 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 Simone Campagna
#
# 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... | simone-campagna/daikon | zirkon/validator/str_validators.py | Python | apache-2.0 | 1,901 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-01-07 16:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("elections", "0013_election_group")]
operations = [
migr... | DemocracyClub/EveryElection | every_election/apps/elections/migrations/0014_auto_20170107_1605.py | Python | bsd-3-clause | 939 |
import json
from datetime import datetime, timedelta
from functools import lru_cache
from logging import getLogger
import boto3
from mypy_boto3_pricing import PricingClient
from sdcm.utils.cloud_monitor.common import InstanceLifecycle
LOGGER = getLogger(__name__)
# TODO: get all prices in __init__
class AWSPricing:... | scylladb/scylla-cluster-tests | sdcm/utils/pricing.py | Python | agpl-3.0 | 10,284 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com)
# All Rights Reserved.Jordi Esteve <[email protected]>
# AvanzOSC, Avanzed Open So... | MarcosCommunity/odoo | comunity_modules/account_payment_extension/__openerp__.py | Python | agpl-3.0 | 3,717 |
from flask import Flask, render_template, request
from flask_bootstrap import Bootstrap
# from flask_appconfig import AppConfig
from flask_wtf import Form, RecaptchaField
from wtforms import TextField, HiddenField, ValidationError, RadioField, BooleanField, SubmitField
from wtforms.validators import Required
import ge... | jcelliott/inquire | app.py | Python | mit | 1,788 |
#!/usr/bin/python
# coding=utf-8
import hashlib
import os
import re
import subprocess
import sys
import tempfile
from datetime import datetime
from gtts import gTTS
while 1:
line = sys.stdin.readline().strip()
if line == '':
break
key, data = line.split(':')
if key[:4] != 'agi_':
#skip input... | lucascudo/pytherisk | pytherisk.py | Python | gpl-3.0 | 4,654 |
# -*- coding: utf-8 -*-
from functools import update_wrapper
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
from django.utils.six.moves.urllib.parse import urljoin
from cms import constants
from cms import __ve... | czpython/django-cms | cms/utils/conf.py | Python | bsd-3-clause | 10,405 |
import sys
from antlr4 import *
from antlr4.InputStream import InputStream
from lib.MySQL.MySQLParser import MySQLParser
from lib.MySQL.MySQLListener import MySQLListener
class SQLLoader(MySQLListener):
def __init__(self):
self.sql = {}
self.alias = dict()
self.where = list()
sel... | RoryAndrews/Python-Parallel-DB | lib/SQLLoader.py | Python | mit | 4,415 |
import json
districts_for_2016 = {
11: ('Andrew Cohen', 'Bronx'),
22: ('Costa Constantinides', 'Queens'),
36: ('Robert Cornegy', 'Brooklyn'),
35: ('Laurie Cumbo', 'Brooklyn'),
30: ('Elizabeth Crowley', 'Queens'),
40: ('Mathieu Eugene', 'Brooklyn'),
21: ('Julissa Ferreras', 'Queens'),
44... | poepublic/shareabouts-pbnyc | data/modifydistricts1516.py | Python | gpl-3.0 | 1,764 |
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.helpers.rss import RSS
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.nzb.base import NZBProvider
from dateutil.parser... | jayme-github/CouchPotatoServer | couchpotato/core/providers/nzb/nzbclub/main.py | Python | gpl-3.0 | 2,892 |
# 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... | NeCTAR-RC/horizon | openstack_dashboard/api/_nova.py | Python | apache-2.0 | 5,498 |
'''
Created on May 31, 2014
@author: Fenriswolf
'''
import logging
import inspect
import re
from collections import OrderedDict
from tornado.web import Application, RequestHandler, HTTPError
app_routing_log = logging.getLogger("tornado.application.routing")
class RoutingApplication(Application):
def __init__(se... | whitepyro/debian_server_setup | tornado/routing.py | Python | gpl-3.0 | 2,844 |
import re
import ast
import subprocess
with open("CV.list","r",encoding="utf-8") as f:
CV = ast.literal_eval(f.read())
CV_header = open("CV_header.html",encoding='utf-8').read().format(
css=open("CV.css",encoding="utf-8").read(),
js=open("CV.js",encoding="utf-8").read(),
... | edouardklein/RelationalResume | CV.py | Python | gpl-3.0 | 9,728 |
from . import models
def update_votes(vote, obj, created=False):
obj.votes = obj.votes + (1 if vote == models.Vote.UP else -1)
obj.save()
| TheRedLady/codebook | codebook/posts/utils.py | Python | gpl-3.0 | 148 |
# Copyright 2016 Google 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 writing, ... | jtovar2/demo_app | backend/main.py | Python | mit | 4,621 |
import random
from population import Population
from individual import Individual
class Algorithm(object):
"""Algorithm class. Mostly contains static methods."""
def __init__(self, populationObject, mutationRate, tournamentSize, elitismFlag):
self.population = populationObject
self.mutation = m... | bluerama/string-evolve | stringevolve/algorithm.py | Python | mit | 1,984 |
# Copyright (c) 2011 NTT.
# 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 appl... | termie/pupa | nova/db/sqlalchemy/migrate_repo/versions/012_add_ipv6_flatmanager.py | Python | apache-2.0 | 6,625 |
# the maximum age of an event, in seconds, before it is published to the LRS
PUBLISH_MAX_WAIT_TIME = 60
# the number of statements to publish per batch
PUBLISH_MAX_PAYLOAD = 10
# lrs credentials
LRS_ENDPOINT = 'https://lrs.adlnet.gov/xAPI/'
LRS_USERNAME = 'fakeuser'
LRS_PASSWORD = 'fakepassword'
| daafgo/Edx_bridge | xapi-bridge/settings.py | Python | apache-2.0 | 300 |
from office365.entity import Entity
class OutlookCategory(Entity):
"""epresents a category by which a user can group Outlook items such as messages and events.
The user defines categories in a master list, and can apply one or more
of these user-defined categories to an item."""
pass
| vgrem/Office365-REST-Python-Client | office365/outlook/outlook_category.py | Python | mit | 303 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
lasboundary.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************... | innotechsoftware/Quantum-GIS | python/plugins/sextante/lidar/lastools/lasboundary.py | Python | gpl-2.0 | 3,125 |
import os
import logging
import logging.handlers
PATH = os.path.abspath(os.path.dirname(__file__))
def spawn_logger(cfg, logger_name):
"""
Get logger instance for config_name and logger name
:param cfg: Current config name
:param logger_name: Logger name, now error and info
:return:
"""
l... | mayflower/geordi | utils.py | Python | gpl-3.0 | 854 |
# Nimble Storage, Inc. (c) 2013-2014
# 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 requi... | mahak/cinder | cinder/tests/unit/volume/drivers/hpe/test_nimble.py | Python | apache-2.0 | 89,138 |
import subprocess
import sys
import os
from itertools import tee
def geojson_extent(FILE_NAME):
"""Get the geographic extent of a GeoJSON file in WGS84"""
# TODO: Make grep Python level for interop
assert os.path.isfile(FILE_NAME)
command = 'ogrinfo -ro -so -al {} | grep "Extent:"'.format(FILE_NAME)
... | joykuotw/tiler | tiler/tiler-scripts/geojson_extent.py | Python | mit | 1,110 |
#!/usr/bin/env python
from cookielib import CookieJar
from twisted.internet import reactor
from twisted.internet.endpoints import TCP4ClientEndpoint
from twisted.web.client import Agent, CookieAgent
from treq.client import HTTPClient
from txsocksx.http import SOCKS5Agent
class ClientFactory(object):
def __ne... | luceatnobis/chan_archiver | chan/client_factory.py | Python | gpl-3.0 | 1,625 |
#!/usr/bin/env python
import random
import sys
import django_includes
from qurkexp.estimation.runs import load_run
from qurkexp.estimation.models import *
from qurkexp.hitlayer.models import HitLayer
def initialize_run(run_name, dataset, estimate_vals, num_batches, batch_size, disp_style, assignments, price):
ds... | marcua/qurk_experiments | qurkexp/estimation/generate_run.py | Python | bsd-3-clause | 1,917 |
# -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License GPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
'name': 'Medical Physician',
'version': '10.0.1.0.0',
'author': "LasLabs, Odoo Community Association (OCA)",
'category': 'Medical',
'depends': [
'medical',
'medical_ce... | laslabs/vertical-medical | medical_physician/__manifest__.py | Python | agpl-3.0 | 845 |
#!/usr/bin/env python
from fundamentals.adv_python.context_management.cm_examples import time_print
"""
Problem:
A child is running up a staircase with n steps, and can hop either 1 step, 2 steps or 3 steps
at a time. Implement a method to count mow many possible ways the child can run up the stairs.
"""
class NWa... | davjohnst/fundamentals | fundamentals/dynamic_programming/num_ways_up_stairs.py | Python | apache-2.0 | 1,743 |
#! /usr/bin/env python3
"""Test script for the dbm.open function based on testdumbdbm.py"""
import os
import unittest
import glob
import test.support
# Skip tests if dbm module doesn't exist.
dbm = test.support.import_module('dbm')
_fname = test.support.TESTFN
#
# Iterates over every database module supported by db... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.2/Lib/test/test_dbm.py | Python | mit | 4,980 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import tempfile
import os
from pathlib import Path
import getpass
import shutil
import pytest
from warnings import warn
from testr.test_helper import on_head_network, has_sybase
from .. import report
user = getpass.getuser()
try:
import Ska.DBI
... | sot/mica | mica/report/tests/test_write_report.py | Python | bsd-3-clause | 1,557 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 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 the h... | sergiusens/snapcraft | tests/unit/project_loader/grammar/test_compound_statement.py | Python | gpl-3.0 | 8,322 |
# -*- coding: utf-8 -*-
from dp_tornado.engine.helper import Helper as dpHelper
import shutil
import os
import filecmp
class FileHelper(dpHelper):
def remove(self, files_or_dirs=None, files=None, dirs=None):
assert not files_or_dirs or not files or not dirs
files_or_dirs = files_or_dirs or []
... | why2pac/dp-tornado | dp_tornado/helper/io/file/__init__.py | Python | mit | 1,651 |
#!/usr/bin/python
# The list are enclosed in brackets ([]) and their element
# and size can be changed, while tuples are enclosed in parenthese
# ( () ) and cannot be updated. The Tuples can be thought of as
# read-only of list
aTuple = ( 'abcd', 786, 2.23, 'John', 70.2)
bTuple = ( 123, 'Vien')
print aTuple ... | HuuHoangNguyen/Python_learning | Tuples.py | Python | mit | 3,657 |
# Copyright 2012 NEC Corporation
#
# 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... | JioCloud/horizon | openstack_dashboard/dashboards/project/networks/tests.py | Python | apache-2.0 | 73,135 |
import urllib
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.test.client import Client, RequestFactory
from django.utils import simplejson
from django.utils.importlib import import_module
from mock import patch
from social_auth.views import complete
class DumbResponse... | krvss/django-social-auth | social_auth/tests/client.py | Python | bsd-3-clause | 5,005 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from pdc_client.test_helpers import CLITestCase
from pdc_client.runner import Runner
from copy import deepcopy
class ComposeTreeLocationsTestCase(CLITestCase):
def setUp(self):
... | product-definition-center/pdc-client | tests/compose_tree_locations/tests.py | Python | mit | 7,158 |
#!/usr/bin/env python
# coding=utf-8
#
# s3dir.py
# Extensions to `s3up.py` to recursively upload a directory to S3.
# Copyright (c) 2010-2012 Mike Tigas <[email protected]>
# http://mike.tig.as/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation f... | mtigas/logbot | s3dir.py | Python | gpl-2.0 | 2,810 |
from __future__ import print_function
import MySQLdb
import tweepy
import json
import AppConstants
class StreamListener(tweepy.StreamListener):
def on_connect(self):
print("You're connected to the streaming server.")
def on_error(self, status_code):
print('Error: ' + repr(status_code))
... | shiskr/nltk | twitterstream.py | Python | gpl-3.0 | 1,003 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, 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/L... | plumgrid/plumgrid-nova | nova/tests/virt/xenapi/test_xenapi.py | Python | apache-2.0 | 157,476 |
# coding: utf-8
###############################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
# All Rights Reserved
############# Credits ##################################################... | suhe/odoo | res-addons/hr_job_positions_extended/__init__.py | Python | gpl-3.0 | 1,365 |
import os
import urllib
import urllib.parse
import logging
import re
import asyncio
from bs4 import BeautifulSoup
from ..config import config
from ..toolbox import dateutils
from ..toolbox.net import download
from .base import SearcherBase, SearchResult, SearcherError
from .easynews_config import config as modconfig
... | jtackaberry/stagehand | stagehand/searchers/easynews.py | Python | mit | 4,873 |
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <[email protected]>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen
# http... | mmgen/mmgen | mmgen/wallet/incog_base.py | Python | gpl-3.0 | 5,589 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('visit', '0092_remove_visit_improvementissues'),
]
operations = [
migrations.AddField(
model_name='visit',
... | koebbe/homeworks | visit/migrations/0093_visit_improvementissues.py | Python | mit | 497 |
import xmlrpclib
import urlparse
from model import Builder, Build
class BuildBotSystem(object):
def __init__(self, url):
try:
scheme, loc, _, _, _ = urlparse.urlsplit(url, scheme='http')
url = '%s://%s/xmlrpc'%(scheme, loc)
self.server = xmlrpclib.ServerProxy(url)
except Exception, e:
raise ValueErro... | eunchong/build | third_party/buildbot_8_4p1/contrib/trac/bbwatcher/api.py | Python | bsd-3-clause | 804 |
# encoding: utf-8
from __future__ import print_function
import os
import shutil
import tempfile
from operator import itemgetter
import py
import pytest
from compose.config import config
from compose.config.errors import ConfigurationError
from compose.const import IS_WINDOWS_PLATFORM
from tests import mock
from test... | alexandrev/compose | tests/unit/config/config_test.py | Python | apache-2.0 | 52,302 |
# Problem:
# Write a program that reads n-number numbers entered by the user and calculates the amount, minimum and
# the maximum of the even and odd numbers (1 count). When there is no minimum / maximum item, print "No".
import math
num_of_loops = int(input())
odd_sum = 0
odd_min = math.inf
odd_max = math.inf * (-1... | YaniLozanov/Software-University | Python/PyCharm/05.Simple Loops/11.Even or Odd positions.py | Python | mit | 1,371 |
# encoding=utf-8
'''Item queue management and processing.'''
import abc
import contextlib
import gettext
import logging
import os
import itertools
from trollius import From, Return
import trollius
from wpull.backport.logging import BraceMessage as __
from wpull.database.base import NotFound
from wpull.hook import Hoo... | bright-sparks/wpull | wpull/engine.py | Python | gpl-3.0 | 13,002 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | hryamzik/ansible | lib/ansible/modules/network/nxos/nxos_file_copy.py | Python | gpl-3.0 | 14,439 |
# pylint: disable=no-self-use,invalid-name
import numpy
from keras.layers import Input
from keras import backend as K
from deep_qa.layers.time_distributed_embedding import TimeDistributedEmbedding
from ..common.test_case import DeepQaTestCase
class TestTimeDistributedEmbeddings(DeepQaTestCase):
def test_time_dis... | RTHMaK/RPGOne | deep_qa-master/tests/layers/time_distributed_embedding_test.py | Python | apache-2.0 | 899 |
#!/usr/bin/env python3
import pytablereader
import xlsxwriter
import simplesqlite
def main():
file_path = "sample_data.xlsx"
# create sample data file ---
workbook = xlsxwriter.Workbook(file_path)
worksheet = workbook.add_worksheet("samplesheet1")
table = [
["", "", "", ""],
["... | thombashi/SimpleSQLite | sample/create_table/sample_create_table_from_excel.py | Python | mit | 1,573 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.services.catalogs.catalog_item import CatalogItem
from cfme.automate.service_dialogs import ServiceDialog
from cfme.services.catalogs.catalog import Catalog
from cfme.services.catalogs.service_catalogs import ServiceCatalogs
from cfme.automate.explorer... | lehinevych/cfme_tests | cfme/tests/services/test_dynamicdd_dialogelement.py | Python | gpl-2.0 | 3,838 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.