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 |
|---|---|---|---|---|---|
#!/usr/bin/python -tt
# vm-mgmt connects to a vCenter/ESX Server to execute tasks
# and generate reports
# Copyright: (c) 2014 Jonar M.
# License: BSD, see LICENSE for more details.
import sys
import os
import re
import inspect
import getpass
import time
import pysphere
from pysphere import VIServer, VIProperty, MORT... | jonarm/vm-mgmt | vm-mgmt.py | Python | bsd-2-clause | 2,632 |
"""
Copyright (c) 2015 Michael Bright and Bamboo HR 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... | BambooHR/rapid | rapid/client/parsers/abstract_parser.py | Python | apache-2.0 | 1,564 |
# -*- coding: utf-8 -*-
"""
Dynamic factor model.
Author: Chad Fulton
License: BSD-3
"""
from collections import OrderedDict
from warnings import warn
import numpy as np
import pandas as pd
from scipy.linalg import cho_factor, cho_solve, LinAlgError
from statsmodels.tools.data import _is_using_pandas
from statsmodel... | jseabold/statsmodels | statsmodels/tsa/statespace/dynamic_factor_mq.py | Python | bsd-3-clause | 186,145 |
# Copyright 2000 by Jeffrey Chang. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""
This module is OBSOLETE.
Most of the functionality in this module has moved to Bio.ExPASy.... | BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/Prosite/Prodoc.py | Python | gpl-2.0 | 10,822 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... | amazinger2013/OpenSesame | libqtopensesame/items/qtitem.py | Python | gpl-3.0 | 21,218 |
from __future__ import print_function
import nose.tools as nt
import numpy as np
import numpy.testing.decorators as dec
from ..gaussian import truncated_gaussian, truncated_gaussian_old
from ...tests.decorators import set_sampling_params_iftrue, set_seed_iftrue
from ...tests.flags import SMALL_SAMPLES, SET_SEED
inter... | selective-inference/selective-inference | selectinf/truncated/tests/test_truncated.py | Python | bsd-3-clause | 2,115 |
# -*- coding: utf-8 -*-
import gc
import inspect
import json
import logging
from django.contrib.auth.models import User as AuthUser
from django.db import models
from django.utils.importlib import import_module
from django.utils.translation import ugettext_lazy as _
from ficuspumila.settings import (
get as settin... | nk113/django-ficuspumila | ficuspumila/core/models.py | Python | bsd-3-clause | 7,951 |
"""The tests for the MQTT component."""
import asyncio
from datetime import datetime, timedelta
import json
import ssl
import pytest
import voluptuous as vol
from homeassistant.components import mqtt, websocket_api
from homeassistant.components.mqtt import debug_info
from homeassistant.const import (
ATTR_DOMAIN,... | tboyce021/home-assistant | tests/components/mqtt/test_init.py | Python | apache-2.0 | 52,384 |
import string
from nltk.corpus import stopwords as sw
from nltk.corpus import wordnet as wn
from nltk import wordpunct_tokenize
from nltk import WordNetLemmatizer
from nltk import sent_tokenize
from nltk import pos_tag
from sklearn.base import BaseEstimator, TransformerMixin
class NLTKPreprocessor(BaseEstimator, T... | JFriel/honours_project | app/parser/NLTKPreprocessor.py | Python | gpl-3.0 | 2,120 |
#!/usr/bin/python
import pylab
import glob
import time
import os
import numpy as np
from scipy.interpolate import interp1d
from scipy.integrate import trapz
from scipy.optimize import minimize_scalar
from csv import DictReader, QUOTE_NONNUMERIC
from collections import defaultdict
from matplotlib import pyplot
from dat... | ReservoirWebs/GrowChinook | Bioenergetics_advsens_new.py | Python | gpl-3.0 | 33,775 |
import sys, os
import cog
def write_kernel( var_name, kernel_filename ):
cog.outl( 'string kernelFilename = "' + kernel_filename + '";' )
f = open( kernel_filename, 'r')
line = f.readline()
cog.outl( 'const char * ' + var_name + ' = ' )
while( line != '' ):
cog.outl( '"' + line.strip().r... | hughperkins/Jinja2CppLight | cog-batteries/stringify.py | Python | mpl-2.0 | 2,124 |
from django.shortcuts import redirect
from django.core.urlresolvers import reverse_lazy
from django.views.generic import TemplateView, FormView
from .forms import ContactForm
class HomeView(TemplateView):
template_name = 'pages/home.html'
def dispatch(self, request, *args, **kwargs):
if request.user... | Uran198/med | med/pages/views.py | Python | bsd-3-clause | 864 |
# -*- coding: utf-8 -*-
###############################################################################
#
# FriendshipsShow
# Returns detailed information about the relationship between two users.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the ... | jordanemedlock/psychtruths | temboo/core/Library/Twitter/FriendsAndFollowers/FriendshipsShow.py | Python | apache-2.0 | 5,218 |
#coding=utf-8
__author__ = 'rocky'
import time
from selenium import webdriver
# using chrome driver to start chrome and do price_crawl
CHROME_DRIVER_PATH = 'XXX/google/chromedriver.exe'
# using phantomjs driver to do price_crawl(does not need any explorer to be opened)
PHANTOMJS_DRIVER_PATH = 'XXX/phantomjs-2.0.0/bin... | rocky1001/UrlCrawler | price_crawler/selenium_price_crawler.py | Python | gpl-2.0 | 2,385 |
# Copyright 2014 Open Source Robotics Foundation, 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 ... | viccro/diarc | diarc/parser.py | Python | apache-2.0 | 4,865 |
import _plotly_utils.basevalidators
class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="sizesrc", parent_name="streamtube.hoverlabel.font", **kwargs
):
super(SizesrcValidator, self).__init__(
plotly_name=plotly_name,
paren... | plotly/python-api | packages/python/plotly/plotly/validators/streamtube/hoverlabel/font/_sizesrc.py | Python | mit | 471 |
import os
from django import VERSION as DJANGO_VERSION
BASE_DIR = os.path.dirname(__file__)
DATABASES = {
'default': {
'NAME': ':memory:',
'ENGINE': 'django.db.backends.sqlite3',
}
}
SECRET_KEY = 'fake-key'
INSTALLED_APPS = (
'linaro_django_pagination',
)
if DJANGO_VERSION >= (1, 8):
... | atugushev/django-pagination | linaro_django_pagination/tests/settings.py | Python | bsd-3-clause | 636 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectio... | JackKelly/neuralnilm_prototype | scripts/e374.py | Python | mit | 7,070 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 lat... | JensRantil/ansible | lib/ansible/utils/__init__.py | Python | gpl-3.0 | 35,532 |
"""
Helper functions for creating Form classes from Django models
and database field objects.
"""
from django.db import connections
from django.utils.encoding import smart_unicode, force_unicode
from django.utils.datastructures import SortedDict
from django.utils.text import get_text_list, capfirst
from django.utils.t... | tjsavage/sfcsdatabase | sfcs/django/forms/models.py | Python | bsd-3-clause | 44,249 |
# Copyright 2015 NEC Corporation. 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 l... | kevin-zhaoshuai/zun | zun/conf/database.py | Python | apache-2.0 | 1,765 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.engine.addressable import Addresses
from pants.engine.console import Console
from pants.engine.goal import Goal, GoalSubsystem
from pants.engine.rules import goal_rule
class L... | wisechengyi/pants | pants-plugins/src/python/internal_backend/rules_for_testing/register.py | Python | apache-2.0 | 858 |
def print_double_num(x):
""" (number) -> NoneType
Double x.
>>> double_num(3)
"""
print(x * 2) | simontakite/sysadmin | pythonscripts/practicalprogramming/functions/double_print.py | Python | gpl-2.0 | 121 |
# -*- coding: utf-8 -*-
"""ciscosparkapi exception classes."""
# Use future for Python v2 and v3 compatibility
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
from builtins import *
from past.builtins import basestring
import json
import requests
from collect... | jbogarin/ciscosparkapi | ciscosparkapi/exceptions.py | Python | mit | 3,729 |
"""
An IRC parser.
This is by no means complete.
"""
from nodeforge.PluginUtils import *
from twisted.internet.task import LoopingCall
import time, random
class Main(Plugin):
priority = Priority.parser
def send(self, string):
if isinstance(string, unicode):
... | impredicative/nodeforge | src/plugins/irc/IRC Parser/main.py | Python | bsd-3-clause | 2,784 |
# coding: utf-8
#
# Copyright 2013 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 ... | sunu/oppia-test | models/statistics_test.py | Python | apache-2.0 | 1,295 |
"""Event loop implementation that uses pyuv(libuv-python bindings)."""
import sys
from collections import deque
import pyuv
from .base import BaseEventLoop
class UvEventLoop(BaseEventLoop):
"""`BaseEventLoop` subclass that uses `pvuv` as a backend."""
def _init(self):
self._loop = pyuv.Loop()
... | bfredl/python-client | neovim/msgpack_rpc/event_loop/uv.py | Python | apache-2.0 | 4,058 |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2000-2014 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later versi... | terryyin/linkchecker | linkcheck/robotparser2.py | Python | gpl-2.0 | 12,956 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jwlawson/tensorflow | tensorflow/contrib/py2tf/pyct/parser.py | Python | apache-2.0 | 1,152 |
from binascii import b2a_base64, a2b_base64
POSTFIX = {
'ns': 1e-9,
'us': 1e-6,
'ms': 1e-3,
'secs': 1,
'mins': 60,
'hrs': 60 * 60,
'days': 24 * 60 * 60,
'weeks': 7 * 24 * 60 * 60
}
def parse_duration(s):
s = s.strip()
unit = None
postfix = None
for n, u in POSTFIX.item... | yuyang0/pymesos | pymesos/utils.py | Python | bsd-3-clause | 757 |
# -*- coding: utf-8 -*-
#
# This file is a part of Pluggable Output Processor
#
# Copyright (c) 2013-2017 Alex Turbov <i.zaufi@gmail.com>
#
# Pluggable Output Processor 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 Foun... | zaufi/pluggable-output-processor | test/test_term.py | Python | gpl-3.0 | 4,169 |
# Animal is-a object
class Animal(object):
@staticmethod
def latin_name():
return "Animal"
# Dog is-a Animal
class Dog(Animal):
# Dog has-a name
def __init__(self, name):
self.name = name
def eater(self):
return "Carnivore", Animal.latin_name(), self.name
# Cat is-a Ani... | aurelo/lphw | source/ex42.py | Python | mit | 1,389 |
import simplejson
import werkzeug
import requests
import random
from datetime import datetime, timedelta
from odoo import api, exceptions, fields, models
from odoo.tools import scan_languages
from odoo.tools.translate import _
from odoo.addons.base.res.res_partner import _tz_get
from odoo.tools import DEFAULT_SERVER_D... | it-projects-llc/odoo-saas-tools | saas_portal/models/saas_portal.py | Python | lgpl-3.0 | 36,190 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the L... | odoomrp/odoomrp-wip | mrp_production_add_middle_stuff/models/__init__.py | Python | agpl-3.0 | 885 |
# array_editor.py -- Example of using array editors
import numpy as np
from traits.api import HasPrivateTraits, Array
from traitsui.api \
import View, ArrayEditor, Item
from traitsui.menu import NoButtons
class ArrayEditorTest ( HasPrivateTraits ):
three = Array(np.int, (3,3))
four = Array(np.float,
... | QuantumQuadrate/CsPyController | python/examples/array_editor.py | Python | lgpl-3.0 | 949 |
# -*- coding: utf-8 -*-
import json
from mock import Mock
from urlparse import ParseResult
from searx import webapp
from searx.testing import SearxTestCase
class ViewsTestCase(SearxTestCase):
def setUp(self):
webapp.app.config['TESTING'] = True # to get better error messages
self.app = webapp.a... | pointhi/searx | tests/unit/test_webapp.py | Python | agpl-3.0 | 5,703 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('afiliados', '0002_auto_20160121_1745'),
]
operations = [
migrations.AlterField(
model_name='adherente',
... | montenegroariel/sigos | apps/afiliados/migrations/0003_auto_20160122_0259.py | Python | gpl-3.0 | 627 |
#!/usr/bin/env python
# Copyright 2016 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... | maisem/test-infra | gubernator/regex_test.py | Python | apache-2.0 | 4,032 |
import time
from antstar.Ant import Ant
from antstar.GlueWallAntBrain import GlueWallAntBrain
from antstar.Grid import Grid
from antstar.StickWallAntBrain import StickWallAntBrain
brains = [StickWallAntBrain]#GlueWallAntBrain]#, DirectionByPassAntBrain]
grids = {
'Map A': """
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | buxx/AntStar | test.py | Python | gpl-2.0 | 8,653 |
from django.contrib import admin
from .models import Blog
class BlogAdmin(admin.ModelAdmin):
list_display = ('title', 'date')
search_fields = ('title',)
prepopulated_fields = {"slug": ("title",)}
admin.site.register(Blog, BlogAdmin)
| chhantyal/taggit-selectize | example_app/blog/admin.py | Python | bsd-3-clause | 250 |
#!/usr/bin/python
'''
Progbot.py
- A progressive IRC Bot written in Python
Copyright (c) Ruel Pagayon <http://ruel.me>
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... | ruel/Progbot | progbot/progbot.py | Python | gpl-3.0 | 6,039 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# flake8: noqa
from wdom.tag import NewTagClass as NewTag
from wdom.themes import *
name = 'Bijou'
project_url = 'http://andhart.github.io/bijou/'
project_repository = 'https://github.com/andhart/bijou'
license = 'MIT License'
license_url = 'https://github.com/andhart/bi... | miyakogi/wdom | wdom/themes/bijou.py | Python | mit | 2,359 |
# Copyright 2017 SrMouraSilva
#
# 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,... | PedalPi/PluginsManager | test/util/pairs_list_test.py | Python | apache-2.0 | 1,371 |
'''
.. Created 2015
.. codeauthor:: Hstau Y Liao <hstau.y.liao@gmail.com>
'''
import numpy as np
def mcol(u):
# u is an array
u = np.reshape(u,(u.shape[0],1))
return u
| hstau/manifold-cryo | manifold/gui/utilities.py | Python | gpl-2.0 | 182 |
#!/usr/bin/python
# Copyright 2013 Google Inc.
#
# 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 vers... | mschurenko/ansible-modules-core | cloud/google/gce.py | Python | gpl-3.0 | 17,261 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: metagriffin <mg.github@uberdev.org>
# date: 2011/06/02
# copy: (C) Copyright 2011-EOT metagriffin -- see LICENSE.txt
#-----------------------------------------------------------------------------... | metagriffin/svnpublish | svnpublish/util/test_config.py | Python | gpl-3.0 | 2,329 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2016 Factor Libre S.L. (http://factorlibre.com)
# Kiko Peiro <francisco.peiro@factorlibre.com>
#
#
# This program is free sof... | algiopensource/l10n-spain | l10n_es_aeat_mod340_cash_basis/wizard/calculate_mod340_records.py | Python | agpl-3.0 | 3,973 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend limecoinxs received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a limecoinxd or... | LIMX-SUPPORT/LimecoinX | contrib/spendfrom/spendfrom.py | Python | mit | 10,120 |
#!/usr/bin/python2.5
#
# Copyright 2008 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... | google-code-export/cocoslive | cocoslive/configuration.py | Python | gpl-3.0 | 1,082 |
# Lint as: python3
# Copyright 2020 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 a... | google/tensorflow-recorder | tfrecorder/__init__.py | Python | apache-2.0 | 816 |
from gi.repository import Gtk
machines = {}
store = Gtk.ListStore(str, str, int, str, int)
cluster_ip = ""
cluster_port = ""
machine_json = ""
username = ""
password = ""
global connection
| davidsf/ganetiadmin | params.py | Python | gpl-3.0 | 189 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | qiskit/transpiler/passes/decompose.py | Python | apache-2.0 | 2,194 |
from django.apps import AppConfig
class UploadsConfig(AppConfig):
name = "hav.apps.sources.uploads"
| whav/hav | src/hav/apps/sources/uploads/apps.py | Python | gpl-3.0 | 106 |
# Generated by Django 3.2.6 on 2021-09-23 13:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("peeringdb", "0018_auto_20210523_1204")]
operations = [
migrations.AddField(
model_name="facility",
name="available_voltage_service... | respawner/peering-manager | peeringdb/migrations/0019_auto_20210923_1544.py | Python | apache-2.0 | 1,338 |
# -*- coding: utf-8 -*-
"""Parser for Extensible Storage Engine (ESE) database files (EDB)."""
import pyesedb
from plaso.lib import specification
from plaso.parsers import interface
from plaso.parsers import manager
from plaso.parsers import plugins
class ESEDatabase(object):
"""Extensible Storage Engine (ESE) da... | Onager/plaso | plaso/parsers/esedb.py | Python | apache-2.0 | 3,948 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'window.ui'
#
# Created: Mon Jun 8 18:47:51 2015
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self... | bitterfly/tamagotchi | tamagotchi/snake/ui_window.py | Python | gpl-2.0 | 1,398 |
from changes.api.serializer import Crumbler, register
from changes.models.node import Cluster
@register(Cluster)
class ClusterCrumbler(Crumbler):
def crumble(self, instance, attrs):
return {
'id': instance.id.hex,
'name': instance.label,
'dateCreated': instance.date_cre... | dropbox/changes | changes/api/serializer/models/cluster.py | Python | apache-2.0 | 336 |
from functools import partial
from urllib.parse import urlencode
from geopy.exc import (
GeocoderAuthenticationFailure,
GeocoderInsufficientPrivileges,
GeocoderQueryError,
GeocoderQuotaExceeded,
GeocoderServiceError,
)
from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder
from geopy.location ... | geopy/geopy | geopy/geocoders/geonames.py | Python | mit | 12,560 |
#!/usr/bin/python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import ntpath
import posixpath
import os
import re
import subprocess
import sys
import gyp.MSVSNew as MSVSNew
import gyp.MSVSProject as MSVSPro... | nawawi/wkhtmltopdf | webkit/Source/ThirdParty/gyp/pylib/gyp/generator/msvs.py | Python | lgpl-3.0 | 58,002 |
#!/usr/bin/python
# Written for Python 3.4
#
# The Coding Dead
# /r/dailyprogrammer Challege #186 Intermediate The Coding Dead
# https://www.reddit.com/r/dailyprogrammer/comments/2kwfqr/10312014_challenge_186_special_code_or_treat/
# Simulates a map randomly populated with Zombies, Hunters, Victims
# Load modules
imp... | ghevcoul/Programming-Challenges | Reddit DailyProgrammer/186i_theCodingDead.py | Python | bsd-2-clause | 9,787 |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import unittest
from iptest.type_util import *
from iptest import run_test
class ComplexTest(unittest.TestCase... | slozier/ironpython2 | Tests/test_complex.py | Python | apache-2.0 | 2,104 |
import pickle
import pickletools
from test import support
from test.pickletester import AbstractPickleTests
from test.pickletester import AbstractPickleModuleTests
class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
def dumps(self, arg, proto=None):
return pickletools.opti... | Orav/kbengine | kbe/src/lib/python/Lib/test/test_pickletools.py | Python | lgpl-3.0 | 668 |
#!/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 pyauto_functional
import pyauto
class IndexedDBTest(pyauto.PyUITest):
"""Test of IndexedDB."""
def _CrashBrowser(self... | gavinp/chromium | chrome/test/functional/indexeddb.py | Python | bsd-3-clause | 3,343 |
from setuptools import setup, find_packages
setup(name='ELA',
version='0.1',
description='Energy by Location in America',
long_description='Class project for UW DIRECT',
url='https://github.com/DIRECT-Energy-Storage/ELA',
author='UW DIRECT students',
license='MIT',
packages=f... | DIRECT-Energy-Storage/ELA | setup.py | Python | mit | 428 |
"""
Proxies for the libgeos_c shared lib, GEOS-specific exceptions, and utilities
"""
import atexit
import logging
import os
import sys
import threading
import ctypes
from ctypes import cdll, CDLL, CFUNCTYPE, c_char_p, c_void_p, string_at
from ctypes.util import find_library
import ftools
from ctypes_declarations imp... | aaronr/shapely | shapely/geos.py | Python | bsd-3-clause | 13,128 |
import chainer
from chainer import function_node
from chainer.utils import type_check
def reshape(x, channels):
"""Referenced from https://github.com/takedarts/resnetfamily"""
if x.shape[1] < channels:
xp = chainer.cuda.get_array_module(x)
p = xp.zeros(
(x.shape[0], channels - x.sh... | corochann/chainerex | chainerex/functions/residual_add.py | Python | mit | 2,746 |
import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from pyramid.scripts.common import parse_vars
from pony.db import (
Base,
DBSession,
)
from pony.models import Group, Kind
def usage(argv):
cmd = ... | v0y/traversal_pony | pony/pony/scripts/initializedb.py | Python | mit | 1,161 |
#python
import k3d
import testing
setup = testing.setup_mesh_modifier_test("PolyGrid", "ScalePoints")
setup.source.rows = 1
setup.source.columns = 1
mesh_selection = k3d.geometry.selection.create(1.0)
setup.modifier.mesh_selection = mesh_selection
setup.modifier.x = 2
testing.require_valid_mesh(setup.document, set... | barche/k3d | tests/mesh/mesh.selection.all.py | Python | gpl-2.0 | 476 |
from unittest import TestCase
from even_fibonacci import *
class TestEvenFibonacciSum(TestCase):
def test_no_numbers(self):
self.assertEqual(even_fibonacci(1), 0)
def test_one_even_number(self):
self.assertEqual(even_fibonacci(2), 2)
def test_one_even_one_odd_number(self):
self.... | plilja/project-euler | problem_2/test_even_fibonacci.py | Python | apache-2.0 | 1,197 |
# 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 PyScs(PythonPackage):
"""SCS: splitting conic solver"""
homepage = "https://github.c... | LLNL/spack | var/spack/repos/builtin/packages/py-scs/package.py | Python | lgpl-2.1 | 1,662 |
#!/usr/bin/python
########################################################################
# 1 August 2014
# Patrick Lombard, Centre for Stem Stem Research
# Core Bioinformatics Group
# University of Cambridge
# All right reserved.
########################################################################
import os, sy... | pdl30/pychiptools | pychiptools/utilities/diffreps.py | Python | gpl-2.0 | 2,016 |
"""
Lightweight Birdseye backend server
"""
from flask import Flask, jsonify, request
from bird import client
from config import settings
#
# Setup and initialization
#
app = Flask(__name__)
#
# Helpers
#
def _bird_api_base(pk):
bird_servers = settings.BIRD_SERVERS
return bird_servers[int(pk)][1]
#
# Bi... | ecix/birdseye | backend/server.py | Python | bsd-3-clause | 3,125 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 lat... | prakritish/ansible | lib/ansible/cli/adhoc.py | Python | gpl-3.0 | 8,021 |
import os
import fnmatch
import mimetypes
from src.thumbnailer import Thumbnailer
class Movie:
def __init__(self, path, name, thumbnailer):
self.path = path
self.name = name
self.thumbnailer = thumbnailer
def full_path(self):
return os.path.join(self.path, self.name)
def p... | sdemircan/mediapielayer | src/movie.py | Python | mit | 1,616 |
from .unitary import Unitary
from .unitary_kron import UnitaryKron
__all__ = [Unitary, UnitaryKron] | Nehoroshiy/urnn | manifolds/__init__.py | Python | mit | 100 |
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.checks import Error
from django.core.exceptions import FieldDoesNotExist, FieldError
from django.db import models
from django.test import TestCase
from d... | edmorley/django | tests/model_inheritance/test_abstract_inheritance.py | Python | bsd-3-clause | 12,105 |
# Tests:
# assign ::= expr store
pass
| rocky/python-uncompyle6 | test/simple_source/stmts/00_pass.py | Python | gpl-3.0 | 38 |
#!/usr/bin/env python
# Copyright 2015 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.
'''Copies the liblouis braille translation tables to a destination.'''
import liblouis_list_tables
import optparse
import os
import sh... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/third_party/liblouis/copy_tables.py | Python | mit | 2,327 |
import zipfile
from sqlalchemy.exc import ProgrammingError
from plenario.database import postgres_engine, postgres_session
from plenario.etl.common import ETLFile, add_unique_hash
from plenario.utils.shapefile import import_shapefile
class ShapeETL:
def __init__(self, meta, source_path=None):
self.sourc... | UrbanCCD-UChicago/plenario | plenario/etl/shape.py | Python | mit | 1,291 |
import os, sys, json
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import util
def main(request, response):
policyDeliveries = json.loads(request.GET.first('policyDeliveries', '[]'))
worker_type = request.GET.first('type', 'classic')
commonjs_url = '%s://%s:%s/common/security-features/resource... | paulrouget/servo | tests/wpt/web-platform-tests/common/security-features/scope/worker.py | Python | mpl-2.0 | 1,379 |
"""
Migrate management command.
"""
import os.path, re, sys
from optparse import make_option
from django.core.management.base import BaseCommand
from django.conf import settings
from south import migration
from south.migration import Migrations
from south.exceptions import NoMigrations
from south.db import DEFAULT_D... | mozilla/make.mozilla.org | vendor-local/lib/python/south/management/commands/migrate.py | Python | bsd-3-clause | 12,083 |
#!/bin/env python
import csv
import sys
import re
import string
import argparse
def get_import_value(value_dict, regexp):
matching_keys = [re.search(regexp, key, re.IGNORECASE).groups()[0] for key in value_dict.keys() if re.search(regexp, key, re.IGNORECASE) is not None]
#print value_dict
#print regexp
#... | AgResearch/DECONVQC | database/sanitiseSampleSheet.py | Python | gpl-3.0 | 4,396 |
from django import forms
from django.contrib.postgres.forms import SimpleArrayField
import django_filters
from .models import (Plan, Goal, Theme, Sector, Target, Indicator, Component,
Progress, Area, AreaType)
class SimpleIntegerArrayField(SimpleArrayField):
def __init__(self, base_field=for... | tehamalab/dgs | goals/filters.py | Python | unlicense | 4,056 |
#!/usr/bin/env python
from oerp_rest import oerp_rest
oerp_rest.run(debug = True)
| bdunnette/oerp-rest | server.py | Python | agpl-3.0 | 83 |
# Android Device Testing Framework ("dtf")
# Copyright 2013-2016 Jake Valletta (@jake_valletta)
#
# 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
... | jakev/dtf | python-dtf/tests/integration/pm/test_pm_export.py | Python | apache-2.0 | 1,737 |
"""
==============
Blob Detection
==============
Blobs are bright on dark or dark on bright regions in an image. In
this example, blobs are detected using 3 algorithms. The image used
in this case is the Hubble eXtreme Deep Field. Each bright dot in the
image is a star or a galaxy.
Laplacian of Gaussian (LoG)
-------... | paalge/scikit-image | doc/examples/features_detection/plot_blob.py | Python | bsd-3-clause | 2,997 |
import sublime
import sublime_plugin
try: # Python 3
from ...HaxeHelper import runcmd, show_quick_panel
except (ValueError): # Python 2
from HaxeHelper import runcmd, show_quick_panel
print("HAXE : haxelib list ")
class HaxelibListInstalled( sublime_plugin.WindowCommand ):
def run(self, paths = [] , t... | joa/haxe-sublime2-bundle | features/haxelib/haxelib_list_installed.py | Python | apache-2.0 | 3,355 |
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
api.downgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, v-1)
print 'Current database version: ' + str(a... | VagrantApe/flaskMicroblog | db_downgrade.py | Python | bsd-3-clause | 385 |
from nameparser.parser import HumanName
def impute_names(name):
human = HumanName(name)
return {
'given': human.first,
'middle': human.middle,
'family': human.last,
'suffix': human.suffix,
}
def impute_names_model(name):
human = HumanName(name)
return {
'g... | GaryKriebel/osf.io | framework/auth/utils.py | Python | apache-2.0 | 842 |
import requests
import re
import json
import ast
import os
import ui
import threading
import tarfile
import math
import time
import plistlib
import console
import shutil
import sqlite3
import base64
import clipboard
import os
import Image
import io
import copy
import yaml
from Managers import DBManager, TypeManager
fro... | shaun-h/PyDoc | Managers/UserContributedManager.py | Python | mit | 21,125 |
from voluptuous import Match
from datatypes.core import SingleValueValidator
ogc_urn_schema = Match(pattern='urn:ogc:def:crs:EPSG::\d{4,5}')
class OgcUrn(SingleValueValidator):
def define_schema(self):
return ogc_urn_schema
def define_error_message(self):
return "Value must be a correctly fo... | LandRegistry/datatypes-alpha | datatypes/validators/ogc_urn_validator.py | Python | mit | 337 |
import numpy as np
from metaworld.policies.action import Action
from metaworld.policies.policy import Policy, assert_fully_parsed, move
class SawyerHandlePressV2Policy(Policy):
@staticmethod
@assert_fully_parsed
def _parse_obs(obs):
return {
'hand_pos': obs[:3],
'gripper'... | rlworkgroup/metaworld | metaworld/policies/sawyer_handle_press_v2_policy.py | Python | mit | 1,079 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | lahwaacz/qutebrowser | qutebrowser/utils/docutils.py | Python | gpl-3.0 | 6,161 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville. Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publis... | DarkoNikolovski/account-financial-tools | account_tax_analysis/__openerp__.py | Python | agpl-3.0 | 1,258 |
# encoding: utf-8
from yast import import_module
import_module('UI')
from yast import *
class MultiSelectionBox4Client:
def main(self):
items = [
Item(Id("a"), "a"),
Item(Id("x"), "x"),
Item(Id("y"), "y"),
Item(Id("z"), "z")
]
contents = HBox(
VSpacing(20... | yast/yast-python-bindings | examples/MultiSelectionBox4.py | Python | gpl-2.0 | 1,852 |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2015 by Jan-Hendrik Dolling.
:license: Apache 2.0, see LICENSE for more details.
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
from configvalidator import LoadException
class MyTestCase(unittest.TestCase):
def test_something(self):
... | JanHendrikDolling/configvalidator | test/test_metaclass.py | Python | apache-2.0 | 3,964 |
"""Analyze a game using gp learn"""
import argparse
import json
import sys
from gameanalysis import gameio
from gameanalysis import nash
from gameanalysis import regret
from gameanalysis import gpgame
def add_parser(subparsers):
parser = subparsers.add_parser(
'learning', help="""Analyze game using learn... | yackj/GameAnalysis | gameanalysis/script/learning.py | Python | apache-2.0 | 4,827 |
# -*- 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
#... | Fokko/incubator-airflow | airflow/contrib/hooks/gcp_tasks_hook.py | Python | apache-2.0 | 1,119 |
# 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 u... | szha/mxnet | docs/python_docs/python/scripts/md2ipynb.py | Python | apache-2.0 | 2,321 |
#!python
# Collect for each region the list of players by league
# Strategy: we go through the list of all the known players and check their games
# As a starting list, we can take master/challenger players
import os
import multiprocessing
import time
import pickle
import sys
from pickle import PickleError
from Inte... | vingtfranc/LoLAnalyzer | PlayersListing.py | Python | mit | 14,631 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.