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 |
|---|---|---|---|---|---|
from rapidsms.contrib.locations.models import Location
from survey.models import Household
class BatchCompletionRates:
def __init__(self, batch):
self.batch = batch
def calculate_percent(self, numerator, denominator):
try:
return numerator * 100 / denominator
except ZeroDi... | antsmc2/mics | survey/services/completion_rates_calculator.py | Python | bsd-3-clause | 3,385 |
# Enable the use of cinje templates.
__import__('cinje') # Doing it this way prevents an "imported but unused" warning.
# Get a reference to the Application class.
from web.core import Application
# Get references to web framework extensions.
from web.ext.annotation import AnnotationExtension # Built-in to WebCore.... | amcgregor/WebCore-Tutorial | web/app/wiki/__main__.py | Python | mit | 1,417 |
import traceback
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.encoding import simplifyString, toUnicode, ss
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.media.movie.providers.base import MovieProvider
import tmdb3
log... | koomik/CouchPotatoServer | couchpotato/core/media/movie/providers/info/themoviedb.py | Python | gpl-3.0 | 6,809 |
#!/usr/bin/env python
# Copyright (C) 2012 Tianyang Li
# tmy1018@gmail.com
#
# 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 lat... | tianyang-li/de-novo-metatranscriptome-analysis--the-uniform-model | misc/add_to_read_name.py | Python | gpl-3.0 | 1,385 |
'''
Created on 02.05.2012
:author: tobiasweigel
Copyright (c) 2012, Tobias Weigel, Deutsches Klimarechenzentrum GmbH
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code ... | TobiasWeigel/lapis | lapis/model/doset.py | Python | bsd-2-clause | 5,798 |
import sys, time
sys.path.insert(0, sys.argv[1])
from cffi import FFI
def _run_callback_in_thread():
ffi = FFI()
ffi.cdef("""
typedef int (*mycallback_func_t)(int, int);
int threaded_ballback_test(mycallback_func_t mycb);
""")
lib = ffi.verify("""
#include <pthread.h>
ty... | chevah/python-cffi | testing/cffi0/callback_in_thread.py | Python | mit | 1,211 |
from setuptools import setup, find_packages
VERSION = (1, 0, 8)
# Dynamically calculate the version based on VERSION tuple
if len(VERSION)>2 and VERSION[2] is not None:
str_version = "%d.%d_%s" % VERSION[:3]
else:
str_version = "%d.%d" % VERSION[:2]
version= str_version + '_lieryan1'
setup(
name = 'djan... | iron-io/django-chargify | setup.py | Python | gpl-2.0 | 1,136 |
import hashlib
import json
import os
import posixpath
import re
import unicodedata
import uuid
from urllib.parse import urljoin
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.db import models
from django.dispatch import receiver
from django.template.defau... | psiinon/addons-server | src/olympia/files/models.py | Python | bsd-3-clause | 24,526 |
from __future__ import print_function, division
class ExistingTableException(Exception):
def __init__(self):
pass
def __str__(self):
return "Table already exists - use overwrite to replace existing table"
class TableException(Exception):
def __init__(self, tables, arg):
self.ta... | atpy/atpy | atpy/exceptions.py | Python | mit | 1,471 |
#!/usr/bin/env python3
# coding: utf-8
#
# Copyright 2020 Project U-Ray Authors
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file.
#
# SPDX-License-Identifier: ISC
import re
import sys
import json
def main():
line_re = re.compile(r'F(0x[0-9A-Fa-f]+)W(\d+)B(\d+... | SymbiFlow/prjuray-tools | tools/oddtiles.py | Python | isc | 1,689 |
# 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-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_scale_set_vm_instance_required_ids.py | Python | mit | 1,086 |
#!/usr/bin/env python
from __future__ import print_function
from collections import defaultdict
from os import listdir
from os.path import abspath, basename, dirname, isdir, isfile, join, realpath, relpath, splitext
import re
from subprocess import Popen, PIPE
import sys
# Runs the tests.
WREN_DIR = dirname(dirname(... | robotii/Wren.NET | script/test.py | Python | mit | 7,862 |
import specs
from twisted.internet.protocol import ClientCreator
from twisted.internet import reactor
from txamqp.client import TwistedDelegate
from txamqp.protocol import AMQClient
import txamqp.spec
def createClient(amqp_host, amqp_vhost, amqp_port=5672):
amqp_spec = txamqp.spec.loadString(specs.v0_8)
amqp_d... | wehriam/awspider | awspider/amqp/amqp.py | Python | mit | 559 |
"""Add EmailAddress.
Revision ID: 9333436765cd
Revises: 79719ee38228
Create Date: 2020-06-11 07:31:23.089071
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9333436765cd'
down_revision = '79719ee38228'
branch_labels = None
depends_on = None
def upgrade():
... | hasgeek/funnel | migrations/versions/9333436765cd_add_emailaddress.py | Python | agpl-3.0 | 2,193 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# $Id$
"""
VirtualBox Python Shell.
This program is a simple interactive shell for VirtualBox. You can query
information and issue commands from a simple command line.
It also provides you with examples on how to use VirtualBox's Python API.
This shell is even somewhat do... | Chilledheart/vbox | src/VBox/Frontends/VBoxShell/vboxshell.py | Python | gpl-2.0 | 120,927 |
# -*- coding: utf-8 -*-
u"""
Created on 2015-7-15
@author: cheng.li
"""
import unittest
import copy
import tempfile
import pickle
import os
from PyFin.DateUtilities import Date
from PyFin.DateUtilities import Schedule
from PyFin.DateUtilities import Period
from PyFin.DateUtilities import Calendar
from PyFin.Enums imp... | wegamekinglc/Finance-Python | PyFin/tests/DateUtilities/testSchedule.py | Python | mit | 3,611 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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 progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f2f.py | Python | mit | 4,051 |
# Copyright 2019 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Account Invoice Line Lot",
"version": "12.0.1.0.0",
"category": "Invoices & Payments",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "http://www.avanzosc.es"... | oihane/odoo-addons | account_invoice_line_lot/__manifest__.py | Python | agpl-3.0 | 487 |
import string
from configparser import SafeConfigParser
import parser
import glob, os
import mysql.connector
config = SafeConfigParser()
config.read('config.ini')
xsl_config = config['dev.xsl']
db_config = config['dev.db']
os.chdir(xsl_config['files'])
sectors={}
sector_id = 0
companies = []
indicators_index = []
i... | cayman/decision | loader/load.py | Python | mit | 3,955 |
from six.moves import range
try:
import carah.string as _string
except ImportError:
_string = None
if _string:
to_hex = _string.to_hex
else:
def to_hex(s):
return ''.join((hex(ord(c))[2:].zfill(2) for c in s))
def from_hex(s):
return ''.join((chr(int(s[2 * i:2 * (i + 1)], 16))
... | bwesterb/sarah | src/string.py | Python | agpl-3.0 | 385 |
#!/usr/bin/env python
from distutils.core import setup
import os,sys
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
snopt7_lib_path = os.getenv('SNOPT7LIB')
if ( snopt7_lib_path == None ):
snopt7_lib_path=os.getcwd()+'/../lib'
config =... | snopt/snopt-python | solvers/setup.py | Python | mit | 1,045 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'MS16-135.ps1',
# list of one or mo... | Hackplayers/Empire-mod-Hpys-tests | lib/modules/powershell/privesc/ms16-135.py | Python | bsd-3-clause | 3,311 |
from lino.api import dd
class Companies(dd.Table):
model = 'Company'
column_names = 'name address_column *'
detail_layout = dd.DetailLayout("""
id name
addr1
street_prefix street street_no street_box
addr2""", window_size=(50, 'auto'))
| lino-framework/book | lino_book/projects/addrloc/ui.py | Python | bsd-2-clause | 266 |
# coding: utf-8
from __future__ import unicode_literals, division, print_function
"""
Error handlers for errors originating from the Submission systems.
"""
__author__ = "Michiel van Setten"
__copyright__ = " "
__version__ = "0.9"
__maintainer__ = "Michiel van Setten"
__email__ = "mjvansetten@gmail.com"
__date__ = "... | Dioptas/pymatgen | pymatgen/io/abinitio/scheduler_error_parsers.py | Python | mit | 12,992 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | valentin-krasontovitsch/ansible | lib/ansible/modules/cloud/google/gcp_container_cluster.py | Python | gpl-3.0 | 37,708 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickGear.
#
# SickGear 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,... | jetskijoe/SickGear | sickbeard/notifiers/plex.py | Python | gpl-3.0 | 13,857 |
# -*- coding: utf-8 -*-
import os
try:
from PIL import Image as PILImage
except ImportError:
try:
import Image as PILImage
except ImportError:
raise ImportError("The Python Imaging Library was not found.")
import logging
logger = logging.getLogger(__name__)
from django.db import models
fr... | mkoistinen/django-filer | filer/models/abstract.py | Python | bsd-3-clause | 6,117 |
# -*- coding: utf-8 -*-
from sklearn.preprocessing import StandardScaler
from sklearn_pandas import DataFrameMapper
from ..base import FactorTransformer
from ..enums import FactorType
class FactorStandardizer(FactorTransformer):
def __init__(self, copy=True, out_container=False, with_mean=True, with_std=True):
... | iLampard/alphaware | alphaware/preprocess/standardizer.py | Python | apache-2.0 | 996 |
import sys
#--------------------------------------------------
def print_multiplication_table():
for x in range(1, 13):
print
for y in range(1, 13):
print '{:>4}'.format(x * y),
print
print
print_multiplication_table()
print
print
#------------------------------------... | wenduowang/git_home | python/MSBA/Bootcamp/problem_set_02_solution.py | Python | gpl-3.0 | 4,928 |
# -*- coding: utf-8 -*-
"""
tossi.__about__
~~~~~~~~~~~~~~~
"""
__version__ = '0.3.1'
__license__ = 'BSD'
__author__ = 'What! Studio'
__maintainer__ = 'Heungsub Lee'
__maintainer_email__ = 'sub@nexon.co.kr'
| what-studio/tossi | tossi/__about__.py | Python | bsd-3-clause | 213 |
#!/usr/bin/env python
# Copyright 2015 The Kubernetes Authors.
#
# 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... | mdshuai/service-catalog | vendor/github.com/kubernetes/repo-infra/verify/boilerplate/boilerplate.py | Python | apache-2.0 | 6,302 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-02-12 19:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0026_auto_20170211_2027'),
]
operations = [
migrations.AddField(
... | skylifewww/pangolin-fog | product/migrations/0027_category_published_in_products.py | Python | mit | 507 |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | chenbaihu/grpc | tools/run_tests/jobset.py | Python | bsd-3-clause | 9,808 |
# -*- coding: utf-8 -*-
#
# Based on initial version of DualMetaFix. Copyright (C) 2013 Kevin Hendricks
# Changes for KindleButler Copyright (C) 2014 Pawel Jastrzebski <pawelj@vulturis.eu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | knigophil/KindleWisper | KindleButler/DualMetaFix.py | Python | gpl-3.0 | 6,909 |
from setuptools import setup
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='snmp2canopsis',
version='0.4',
... | tito/snmp2canopsis | setup.py | Python | mit | 1,083 |
"""Tests for dumping."""
from attr import asdict, astuple
from hypothesis import given
from hypothesis.strategies import data, lists, sampled_from
from cattr.converters import Converter, UnstructureStrategy
from . import (
dicts_of_primitives,
enums_of_primitives,
nested_classes,
seqs_of_primitives,
... | Tinche/cattrs | tests/test_unstructure.py | Python | mit | 3,880 |
# 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, s... | firebase/firebase-unity-sdk | scripts/gha/integration_testing/unity_version.py | Python | apache-2.0 | 9,179 |
import unicodedata
def clean(var):
"""Removes tabs, newlines and trailing whitespace"""
if var is None:
return ''
return var.replace("\t", "").replace("\n", "").strip()
def slugify(var):
remove = ["(", ")", ";", "?", '’', "'", ".", ",", ':', "‘",]
replace = [
(" - ", '_'), (" ", "_... | SimonGreenhill/ABVDGet | abvdget/tools.py | Python | bsd-3-clause | 839 |
"""File to contain functions for controlling parts of Norc."""
from datetime import datetime
from norc.core.constants import Status
def handle(obj):
if not obj.is_alive():
obj.status = Status.HANDLED
if hasattr(obj, "ended") and obj.ended == None:
obj.ended = datetime.utcnow()
... | darrellsilver/norc | core/controls.py | Python | bsd-3-clause | 384 |
#
# 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... | mrkm4ntr/incubator-airflow | airflow/providers/qubole/example_dags/example_qubole.py | Python | apache-2.0 | 9,126 |
# -*- coding: utf-8 -*-
from flask import Flask,render_template,send_file,Response,flash,request,redirect,session
from werkzeug.utils import secure_filename
import json
import os.path
import os
import gzip
import urllib
from db import DbGetListOfDates,DbGet,DbGetComments,DbGetMulitple,DbGetNearbyPoints,DbPut,DbPutWith... | fparrel/regepe | vps/regepe_flask_server.py | Python | gpl-3.0 | 30,280 |
[{'assessment_number': '1',
'due_string': 'Multiple Weeks',
'is_group': 'No',
'name': 'Participation in practical programming tasks',
'weight': '10.00'},
{'assessment_number': '2',
'due_string': 'Multiple Weeks',
'is_group': 'No',
'name': 'Quiz',
'weight': '20.00'},
{'assessment_number': '3',
'due_s... | lyneca/rainbow-table | examples/example.py | Python | mit | 537 |
import time
from jaeger_client import Config
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
def get_config(service_name):
return Config(
config={
'sampler': {
'type': 'const',
'param': 1,
},
'local_agent': {
# 'reporting_host': '192.... | dhilipsiva/talks | assets/2019-11-30/utils.py | Python | mit | 655 |
import pdb
class Config(pdb.DefaultConfig):
sticky_by_default = True
| mphe/dotfiles | homedir/.pdbrc.py | Python | mit | 75 |
# Copyright (c) 2001-2018, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | xlqian/navitia | source/jormungandr/jormungandr/scenarios/ridesharing/instant_system.py | Python | agpl-3.0 | 11,739 |
from delegates.base import SystemCalcDelegate
from datetime import datetime
from time import time
ts_to_str = lambda x: datetime.fromtimestamp(x).strftime('%Y-%m-%d %H:%M:%S')
PREFIX = '/Ac/Genset'
class GensetStartStop(SystemCalcDelegate):
""" Relay a unified view of what generator start/stop is doing. This
... | victronenergy/dbus-systemcalc-py | delegates/genset.py | Python | mit | 1,870 |
"""Unit test for netutils.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import os
import sys
import unittest
import mock
import pkg_resources
from treadmill import netutils
def _test_data(name):
... | Morgan-Stanley/treadmill | lib/python/treadmill/tests/netutils_test.py | Python | apache-2.0 | 1,737 |
POLYMODEL_CLASS_ATTRIBUTE = "class"
| Ali-aqrabawi/ezclinic | lib/djangae/db/backends/appengine/__init__.py | Python | mit | 37 |
import datetime
import time as t
import json
import os
from analyzer import check_cross_against_schedule, check_training_or_testing_against_schedule
def add_param(param, program, ard_val, schedule_a):
if param == "program":
return program
if param == "datetime":
return datetime.datetime.now()
... | npalermo10/auto_choice_assay_train-test | tagger.py | Python | gpl-3.0 | 1,883 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import NumericProperty
from kivy.properties import ObjectProperty
from kivy.uix.boxlayout import BoxLayout
interface = Builder.load_string('''
#:import facade plyer.compas... | kivy/plyer | examples/compass/main.py | Python | mit | 3,527 |
"""
Classes to cache and read specific items from github issues in a uniform way
"""
from functools import partial as Partial
import datetime
import time
import shelve
# Requires PyGithub version >= 1.13 for access to raw_data attribute
import github
# Needed to not confuse cached 'None' objects
class Nothing(objec... | CongLi/avocado-vt | scripts/github/github_issues.py | Python | gpl-2.0 | 29,593 |
"""
webhooks module URLs config
"""
from django.conf.urls import url
from webhooks import views
urlpatterns = [
url(
r'^github/$',
views.GitHubWebhookReceiverView.as_view(),
name='github',
),
url(
r'^zenhub/$',
views.ZenHubWebhookReceiverView.as_view(),
nam... | pawelad/zenboard | src/webhooks/urls.py | Python | apache-2.0 | 341 |
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
import ctypes
import os
import re
import subprocess
import time
try:
import pywintypes # pylint: disable=F0401
import win32api #... | mogoweb/chromium-crosswalk | tools/telemetry/telemetry/core/platform/win_platform_backend.py | Python | bsd-3-clause | 6,574 |
__author__ = 'eponsko'
from setuptools import setup, find_packages
setup(name='doubledecker',
version='0.4',
description='DoubleDecker client module and examples',
url='http://acreo.github.io/DoubleDecker/',
author='ponsko',
author_email='ponsko@acreo.se',
license='LGPLv2.1',
s... | Acreo/DoubleDecker-py | setup.py | Python | lgpl-2.1 | 453 |
import invoke
from minchin.releaser import make_release
| MinchinWeb/colourettu | tasks.py | Python | mit | 57 |
"""Nearest Neighbor Regression"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ulg.ac... | alexsavio/scikit-learn | sklearn/neighbors/regression.py | Python | bsd-3-clause | 10,998 |
import operator as op
from parsimonious.grammar import Grammar
class Mini(object):
def __init__(self, env={}):
env.update({'sum': lambda *args: sum(args)})
self.env = env
def parse(self,source):
grammar = '\n'.join(v.__doc__ for k, v in vars(self.__class__).items()
if not k.startswith('__') and hasatt... | saru95/Mini-Interpreter | src/regex/mini.py | Python | mit | 1,942 |
import os
from PyQt5.QtCore import QObject
from ethereum.utils import denoms
from mock import patch, MagicMock, ANY, Mock
from PIL import Image
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
from golem.testutils import TempDirFixture, TestGui
from apps.core.task.coretaskstate import TaskDesc
from apps.re... | scorpilix/Golemtest | tests/gui/controller/test_mainwindowcustomizer.py | Python | gpl-3.0 | 10,209 |
#!/usr/bin/python
# encoding: UTF-8
"""
This file is part of PenTestKit
Copyright (C) 2017-2018 @maldevel
https://github.com/maldevel/PenTestKit
PenTestKit - Useful tools for Penetration Testing.
This program is free software: you can redistribute it and/or modify
it under the term... | maldevel/PenTestKit | web/compare-post-data.py | Python | gpl-3.0 | 2,917 |
d = {
'00': 'A',
'01': 'C',
'10': 'G',
'11': 'T'
}
a = input()
#res = ''
for i in range(len(a) // 2):
print(d[a[2*i:2*(i + 1)]], end='')
#res += d[a[2*i:2*(i + 1)]]
#print(res)
| nizhikebinesi/code_problems_python | stepik/data_structures/7/7.1/task_3.py | Python | gpl-2.0 | 203 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2018-08-13
git sha ... | lcoandrade/DsgTools | core/DSGToolsProcessingAlgs/Algs/ValidationAlgs/identifySmallPolygonsAlgorithm.py | Python | gpl-2.0 | 5,841 |
# vim:fileencoding=utf-8:noet
'''Dynamic configuration files tests.'''
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import os
import json
import logging
import tests.vim as vim_module
from tests.lib import Args, urllib_read, replace_attr
from tests import TestCase... | EricSB/powerline | tests/test_provided_config_files.py | Python | mit | 7,107 |
import logging
logger = logging.getLogger('rh-nexttask')
class Renderer(object):
"""Different way to render the advised bzs.
"""
def __init__(self, bzs):
self.bzs = bzs
def list(self):
raw_names = [f for f in dir(self) if f.startswith('r_')]
return [f[2:] for f in raw_names]... | sathlan/python-rh-nexttaks | src/rh_nexttask/renderer.py | Python | bsd-2-clause | 3,745 |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
import matplotlib.pyplot as plt
from dataset.mnist import load_mnist
from common.util import smooth_curve
from common.multi_layer_net import MultiLayerNet
from common.optimizer import ... | kgsn1763/deep-learning-from-scratch | ch06/weight_init_compare.py | Python | mit | 1,963 |
# This file is part of the Simulation Manager project for VecNet.
# For copyright and licensing information about this project, see the
# NOTICE.txt and LICENSE.md files in its top-level directory; they are
# available at https://github.com/vecnet/simulation-manager
#
# This Source Code Form is subject to the terms of ... | vecnet/simulation-manager | sim_manager/tests/test_submit_group.py | Python | mpl-2.0 | 7,814 |
am = imp.load_source( 'am', 'artifact-manager' )
| paulovn/artifact-manager | test/__init__.py | Python | gpl-2.0 | 50 |
import pytest
from selenium import webdriver
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
print(wd)
request.addfinalizer(wd.quit)
return wd
def test_example(driver):
driver.get("http://ivanka/admin/login.php")
driver.find_element_by_name("username").send_keys("admin")
drive... | IvankaK/Testing | test_tag.py | Python | apache-2.0 | 527 |
#!/usr/bin/env python
# encoding: utf-8
from base_task import BaseTask, Node
task_definitions = [
{
'name': 'first_test_runs_task',
'start': Node('A', 0, 0),
'finish': Node('Z', 500, 500),
'mid_nodes': [
Node('B', 50, 500),
Node('C', 50, 100),
No... | Cosiek/KombiVojager | tasks.py | Python | mit | 2,187 |
#!/usr/bin/python
"""
Read the bulk converted file (not trifiltered)
and the triplicate file to identify technical replicates
and collect VAF for each mutation common in the replicates
"""
import sys
triplicates = dict()
trifile = open(sys.argv[1])
for i in trifile:
fields = i.rstrip().split()
repname = f... | TravisCG/SI_scripts | trivaf.py | Python | gpl-3.0 | 1,154 |
import os
import unittest
from datetime import datetime
from esdl import CubeConfig
from esdl.providers.country_mask import CountryMaskProvider
from esdl.util import Config
SOURCE_DIR = Config.instance().get_cube_source_path('CountryCodes')
class CountryMaskProviderTest(unittest.TestCase):
@unittest.skipIf(not o... | CAB-LAB/cablab-core | test/providers/test_country_mask.py | Python | gpl-3.0 | 2,384 |
#!/usr/bin/env python3
#
# Copyright 2008-2014 Jose Fonseca
#
# This program 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 the License, or
# (at your option) any later version.
#
#... | afg984/afgprof | afgprof2dot.py | Python | mit | 46,545 |
"""
WSGI config for gameonwebapp 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | Nishanthnishu/GameON-VirtualCricketBetting | GameON/gameonwebapp/gameonwebapp/wsgi.py | Python | mit | 402 |
from djpcms import sites
from djpcms.http import get_http
from djpcms.template import RequestContext, loader
from djpcms.views.baseview import djpcmsview
class badview(djpcmsview):
def __init__(self, template, httphandler):
self.template = template
self.httphandler = httphandler
super... | strogo/djpcms | djpcms/views/specials.py | Python | bsd-3-clause | 963 |
# Locking debugging code -- temporary
# Copyright (C) 2003 John Goerzen
# <jgoerzen@complete.org>
#
# 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
#... | dimpase/offlineimap | offlineimap/ui/debuglock.py | Python | gpl-2.0 | 1,752 |
__author__ = 'stanley'
import json
import webapp2
from google.appengine.api import users
from domain.user import *
from util.sanity_check import*
from domain.doc_index import *
class FollowHandler(webapp2.RequestHandler):
def post(self):
usr = user_key(users.get_current_user().email()).get()
if no... | nimadini/Teammate | handlers/follow.py | Python | apache-2.0 | 1,114 |
"""
=========================================
Visualize channel over epochs as an image
=========================================
This will produce what is sometimes called an event related
potential / field (ERP/ERF) image.
Two images are produced, one with a good channel and one with a channel
that does not show an... | olafhauk/mne-python | examples/visualization/plot_channel_epochs_image.py | Python | bsd-3-clause | 2,881 |
import hashlib
import os
import sys
import urllib
def check(path, sha):
d = hashlib.sha1()
with open(path, 'rb') as f:
while 1:
buf = f.read(1024 * 1024)
if not len(buf):
break
d.update(buf)
return d.hexdigest() == sha
def run(*args, **kwargs):... | ployground/bsdploy | bsdploy/download.py | Python | bsd-3-clause | 775 |
# -*- coding: utf8 -*-
from .ids import ID as ItemID
from .factory import new_item
from .recipe import furnace_recipe
__all__ = [
'ItemID',
'new_item',
'furnace_recipe',
] | nosix/PyCraft | src/pycraft/service/part/item/__init__.py | Python | lgpl-3.0 | 190 |
# Copyright (c) 2018, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/djaodjin-survey | survey/urls/manager.py | Python | bsd-2-clause | 3,316 |
#!/usr/bin/env python
""" Package install script. """
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
f = open(os.path.join(os.path.dirname(__file__), "README.rst"))
readme = f.read()
f.close()
setup(
name="pdfjinja",
version="1.1.0",
author="Ram... | rammie/pdfjinja | setup.py | Python | mit | 799 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-06 05:22
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db impo... | django-school-management/ssms | ssms/common/common/migrations/0001_initial.py | Python | lgpl-3.0 | 12,307 |
# Copyright (c) 2013 Rackspace Hosting
# 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... | jumpstarter-io/nova | nova/tests/cells/test_cells_state_manager.py | Python | apache-2.0 | 9,385 |
"""
Module containing class `OutsideClassifier`.
An `OutsideClassifier` assigns the `'Outside'` classification to a clip
if the clip's start time is outside of the interval from one hour after
sunset to one half hour before sunrise, and does nothing otherwise.
"""
import datetime
from vesper.command.annotator impor... | HaroldMills/Vesper | vesper/mpg_ranch/outside_classifier.py | Python | mit | 1,908 |
from jsonrpclib import Server
"""
Specify settings
"""
username = ''
password = ''
server = Server('https://' + username + ':' + password + '@www.factweb.nl/jsonrpc/call/jsonrpc')
def creditor_group():
"""
Get creditor_group data
"""
json_data = server.get('creditor_group', 5)
print "Rec... | corebyte/factweb-jsonrpc-client | python/samples/creditor_group.py | Python | lgpl-3.0 | 1,170 |
import numpy as np
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
from ..base import BaseEstimator, RegressorMixin
from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \
LinearModel
from ..feature_selection.from_model import _LearntSelectorMixin
from ..utils import check_X_y
class Linea... | ashhher3/scikit-learn | sklearn/svm/classes.py | Python | bsd-3-clause | 35,052 |
# Copyright (c) 2014 Rackspace, 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 wr... | obulpathi/cdn1 | cdn/transport/pecan/controllers/__init__.py | Python | apache-2.0 | 879 |
# -*- coding: utf-8 -*-
"""
Scripts to manage categories.
Syntax: python g13_nudge_bot.py [-from:UNDERSCORED_CATEGORY]
"""
#
# (C) Rob W.W. Hooft, 2004
# (C) Daniel Herding, 2004
# (C) Wikipedian, 2004-2008
# (C) leogregianin, 2004-2008
# (C) Cyde, 2006-2010
# (C) Anreas J Schwab, 2007
# (C) xqt, 2009-2012
# (C) Pyw... | hasteur/g13bot_tools_new | scripts/g13_nudge_bot.py | Python | mit | 8,119 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser 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 it will b... | sfriesel/suds | suds/transport/http.py | Python | lgpl-3.0 | 6,560 |
from Gui import *
g = Gui()
g.title('Gui Title')
# 1ST kind of TEXT
entry = g.en(text='Default text.')
# 2ND kind of TEXT
text = g.te(width=100, height=5)
text.insert(END, 'abc')
text.insert(1.1, 'xyz') # row.column
# Get function:
# text.get(0.0, END)
# text.delete(1.2, END)
g.mainloop() | flake123p/ProjectH | Python/GUI_Tkinter/03_Text/test.py | Python | gpl-3.0 | 296 |
import mdp.nodes
from mdp import numx
import scipy.signal
import numpy as np
class FeedbackNode(mdp.Node):
"""FeedbackNode creates the ability to feed back a certain part of a flow as
input to the flow. It both implements the Node API and the generator API and
can thus be used as input for a flow.
... | npinto/Oger | Oger/nodes/utility_nodes.py | Python | gpl-3.0 | 15,581 |
from gge.GameObject import GameObject
from gge.DisplayTypes import Resolution, Fullscreen, DisplayRep
from gge.Types import Position
import pygame
from collections import defaultdict, namedtuple
PosRep = namedtuple("PosRep", "pos rep")
class PygameDisplayObject(GameObject):
"""Assumes pygame is ini... | Bredgren/GenericGameEngine | python/gge/PygameDisplayObject.py | Python | gpl-3.0 | 3,684 |
#!/usr/bin/python2.4
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://w... | marcellodesales/svnedge-console | ext/windows/pkg-toolkit/pkg/vendor-packages/pkg/actions/directory.py | Python | agpl-3.0 | 6,191 |
import math
import Tkinter
NODE_FILL = 'blue' # color of idle nodes
NODE_FILL_ACTIVE = 'purple' # color of active node
EDGE_FILL = 'black' # color of edges
EDGE_LEN = 30
RAD = 3 # radius of node drawing
class Tree:
def __init__(self, cv):
self.ids = [] # tkinter id
self.pos = [0] # position ... | mntalateyya/Shapes_Studio | Tree_Repr.py | Python | apache-2.0 | 4,054 |
from pandac.PandaModules import *
from otp.otpbase.OTPGlobals import *
from direct.gui.DirectGui import *
from MultiPageTextFrame import *
from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPLocalizer
from otp.otpgui import OTPDialog
class PrivacyPolicyTextPanel(getGlobalDialogClass()):
n... | ksmit799/Toontown-Source | otp/login/PrivacyPolicyPanel.py | Python | mit | 5,598 |
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
#!/usr/bin/env python
command = oslinfo("-v test")
| imageworks/OpenShadingLanguage | testsuite/oslinfo-noparams/run.py | Python | bsd-3-clause | 223 |
import collections
class Solution:
def subdomainVisits(self, cpdomains: List[str]) -> List[str]:
table = collections.Counter()
for cpdomain in cpdomains:
wi = cpdomain.index(' ')
count = int(cpdomain[:wi])
names = cpdomain[wi+1:].split('.')
for i in ra... | jiadaizhao/LeetCode | 0801-0900/0811-Subdomain Visit Count/0811-Subdomain Visit Count.py | Python | mit | 453 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para cinemax_rs
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
from core ... | Zanzibar82/pelisalacarta | python/main-classic/channels/cinemax_rs.py | Python | gpl-3.0 | 2,975 |
from blaze.datashape import *
w = TypeVar('w')
x = TypeVar('x')
y = TypeVar('y')
z = TypeVar('z')
n = TypeVar('n')
Quaternion = complex64*(z*y*x*w)
RGBA = Record(R=int16, G=int16, B=int16, A=int8)
File = string*n
def setUp():
Type.register('Quaternion', Quaternion)
Type.register('RGBA', RGBA)
Type.regis... | davidcoallier/blaze | blaze/datashape/tests/test_custom.py | Python | bsd-2-clause | 767 |
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... | mikesun/xen-cow-checkpointing | tools/python/xen/xend/server/irqif.py | Python | gpl-2.0 | 2,481 |
__author__ = 'mworden'
# A regex used to match any characters
ANY_CHARS_REGEX = r'.*'
# A regex used to match any characters
ANY_NON_SPACE_CHARS_REGEX = r'([^\s]*)'
# A regex used to match a single space
SPACE_REGEX = ' '
# A regex used to match the end of a line
END_OF_LINE_REGEX = r'(?:\r\n|\n)'
# A regex used ... | danmergens/mi-instrument | mi/dataset/parser/common_regexes.py | Python | bsd-2-clause | 1,902 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.