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
# 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; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; wi... | ykhodorkovskiy/clip | packages/pungi/pungi-2.13/src/pypungi/util.py | Python | apache-2.0 | 4,027 |
from math import log
import time
import sys
import glob
from serial import Serial
from serial import SerialException
# -*- coding:utf-8 -*-
__author__ = 'Jerry'
connected = 0
serial_port = 0
frame_head = 0xffaa # frame header
def serial_ports():
""" Lists serial port names
:raises EnvironmentError:
... | jerrymomo10/Rfid_PCTest | parase.py | Python | gpl-2.0 | 2,439 |
import pytest
from pexpect import TIMEOUT
from tests.functional.utils import spawn, functional, bare
envs = ((u'bash', 'ubuntu-bash', u'''
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -yy bash
'''), (u'bash', 'generic-bash', u'''
FROM fedora:latest
RUN dnf install -yy python-devel sudo which gcc
'''))
@... | bigplus/thefuck | tests/functional/test_install.py | Python | mit | 819 |
# -*- coding: utf-8 -*-
from haproxy import filters
import pytest
@pytest.mark.parametrize(
'to_filter, to_check, result',
[
('1.2.3.4', '1.2.3.4', True),
('2.3.4.5', '5.3.5.4', False),
('2001:db8::8a2e:370:7334', '2001:db8::8a2e:370:7334', True),
('2001:db8::8a2e:370:7334', '... | gforcada/haproxy_log_analysis | haproxy/tests/test_filters.py | Python | gpl-3.0 | 6,733 |
from __future__ import unicode_literals
import datetime
import re
from decimal import Decimal
from django.core.exceptions import FieldError
from django.db import connection
from django.db.models import (
F, Aggregate, Avg, Count, DecimalField, FloatField, Func, IntegerField,
Max, Min, Sum, Value,
)
from djang... | RevelSystems/django | tests/aggregation/tests.py | Python | bsd-3-clause | 41,959 |
# Copyright 2015 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... | Kongsea/tensorflow | tensorflow/compiler/tests/cholesky_op_test.py | Python | apache-2.0 | 4,872 |
# -*- coding: utf-8 -*-
################################################################################
#
# WeatherLog: dialogs/calendar_dialog.py
# This dialog enters a date using calendars.
#
################################################################################
# Import GTK for the dialog.
from gi.rep... | achesak/weatherlog | resources/dialogs/calendar_dialog.py | Python | gpl-3.0 | 1,429 |
from pyomo.environ import *
def build_model(model):
####################################################################
# generator power output at t=0 (initial condition). units are MW. #
####################################################################
model.PowerGeneratedT0 = Var(model.Genera... | kdheepak/psst | psst/model/builder.py | Python | mit | 33,803 |
# Copyright 2013 Rackspace Hosting
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | OpenAcademy-OpenStack/nova-scheduler | nova/api/openstack/compute/contrib/shelve.py | Python | apache-2.0 | 4,154 |
#
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see th... | tmerrick1/spack | lib/spack/spack/fetch_strategy.py | Python | lgpl-2.1 | 36,243 |
# -*- coding: utf-8 -*-
#
# The internetarchive module is a Python/CLI interface to Archive.org.
#
# Copyright (C) 2012-2021 Internet Archive
#
# 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 Foundat... | jjjake/internetarchive | internetarchive/cli/ia_copy.py | Python | agpl-3.0 | 6,076 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pivoteer', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='indicatorrecord',
name... | gdit-cnd/RAPID | pivoteer/migrations/0002_addfield_indicator.py | Python | mit | 604 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
dslw -- Decent SpatiaLite Wrapper
Copyright (c) 2017 Garin Wally
MIT License; see LICENSE
Credits:
This project stands on the shoulders of giants. Notably:
* Another Python SQLite Wrapper (apsw; by Roger Binns)
* SQLite (by D. Richard Hipp et. al.)
* SpatiaLite (by Ale... | WindfallLabs/dslw | dslw/__init__.py | Python | mit | 1,366 |
from django.conf.urls import url
from . import views
app_name = 'gallery'
urlpatterns = [
url(r'^$', views.GalleryView.as_view(), name='gallery'),
url(r'^(?P<slug>[\w_-]+)/$', views.GalleryImageView.as_view(), name='images')
]
| VictorArnaud/sitepet | gallery/urls.py | Python | mpl-2.0 | 237 |
# Copyright 2019 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... | xzturn/tensorflow | tensorflow/python/ops/control_flow_v2_toggles.py | Python | apache-2.0 | 4,090 |
import os
import re
linkRegex = r"(?!_|\*).\[([^\[]+)\]\(([^\)]+)\)"
linkBoldRegex = r"\[([^\[]+)\]\(([^\)]+)\)\*\*"
fixBugs = r"line-numbers=off, "
for file in os.listdir("manuscript"):
if file.endswith(".txt"):
with open("manuscript/" + file) as f:
fileData = ""
fileContent = f.r... | UlisesGascon/javascript-inspirate | scripts/regex_fixer.py | Python | gpl-3.0 | 613 |
from colorama import init
from colorama import Fore
init()
def pytest_report_teststatus(report):
if report.when == 'call':
if hasattr(report, 'wasxfail'):
if report.skipped:
return "xfailed", Fore.YELLOW + "x" + Fore.RESET, "xfail"
elif report.passed:
... | svenstaro/pytest-colordots | pytest_colordots.py | Python | mit | 697 |
#!/usr/bin/env python
"""
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");... | radicalbit/ambari | contrib/management-packs/odpi-ambari-mpack/src/main/resources/stacks/ODPi/2.0/services/HIVE/package/scripts/hcat_client.py | Python | apache-2.0 | 2,941 |
import os
import io
import sys
import ssl
import urllib
from PIL import Image
import http.server
import moovoo
SIZE=(1200, 800)
class moovoo_server(http.server.HTTPServer):
def __init__(s, addr, handler):
http.server.HTTPServer.__init__(s, addr, handler)
s.ctxt = moovoo.Context()
s.modelBytes = open(... | andy-thomason/moovoo | examples/server.py | Python | mit | 1,994 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
demo template
Tested environment:
Mac OS X 10.6.8
"""
import sys
try:
from PySide import QtCore
from PySide import QtGui
except ImportError:
from PyQt4 import QtCore
from PyQt4 import QtGui
class SheetWin(QtGui.QWidget):
def __init__(self,... | alexlib/Qt-Python-Binding-Examples | windows/custom_win_flags.py | Python | bsd-3-clause | 1,096 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-26 09:42
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('exercises', '0004_exercise... | FlowFX/unkenmathe.de | src/um/exercises/migrations/0005_auto_20170826_0942.py | Python | agpl-3.0 | 578 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | timlinux/geonode | geonode/upload/tests/integration.py | Python | gpl-3.0 | 33,505 |
"""
Class which allows property and dict-like access to a fixed set of instance
attributes. Attributes are locked by __slots__, however accessor methods
may be created/removed on instances, or defined by the subclass. An
INITIALIZED attribute is provided to signel completion of __init__()
for use by accessor methods ... | spiceqa/virt-test | virttest/propcan.py | Python | gpl-2.0 | 10,270 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakmedia.com>
#
# Copyright (C) 2011 Domsense srl (... | incaser/account-payment | account_due_list/account_move_line.py | Python | agpl-3.0 | 4,024 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | kevinsung/OpenFermion | src/openfermion/circuits/primitives/optimal_givens_decomposition.py | Python | apache-2.0 | 5,885 |
# Copyright (c) 2007-2009 Pedro Matiello <pmatiello@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy,... | sebastienhupin/qxrad | qooxdoo/tool/pylib/graph/algorithms/accessibility.py | Python | lgpl-3.0 | 6,573 |
import sys
import os
import logging
import time
import argparse
import atexit
import signal
def check_directory():
if not os.path.exists(os.path.expanduser("~/.chatserver")):
os.makedirs(os.path.expanduser("~/.chatserver"))
sys.path.append(os.path.expanduser("~/.chatserver"))
sys.path.append(os.pat... | jos0003/Chat | server_app/__main__.py | Python | bsd-3-clause | 5,855 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... | ge0rgi/cinder | cinder/db/api.py | Python | apache-2.0 | 67,859 |
import lmfit
from calculations.equations import FitParam
def ppmsi_function(params, subsa, rate, subsb, *_):
"""
Ping pong mechanism equation for optimization
"""
v_max = params['v_max'].value
kdb = params['kdb'].value
kma = params['kma'].value
kmb = params['kmb'].value
rate_calc = v_... | miha-skalic/ITEKA | calculations/equations/PPM_eq.py | Python | gpl-3.0 | 2,624 |
"""
Definition of urls for knodj_test.
"""
from datetime import datetime
from django.conf.urls import patterns, url
from app.forms import BootstrapAuthenticationForm
# Uncomment the next lines to enable the admin:
# from django.conf.urls import include
# from django.contrib import admin
# admin.autodiscover()
urlpat... | mkennedy04/knodj | knodj_test/urls.py | Python | mit | 1,256 |
# Copyright (c) 2016-2019 The University of Manchester
#
# 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... | project-rig/spalloc | tests/__init__.py | Python | gpl-2.0 | 691 |
import os
import sys
from direct.showbase.ShowBase import ShowBase
import panda3d.core as p3d
import blenderpanda
import inputmapper
from nitrogen import gamestates
if hasattr(sys, 'frozen'):
APP_ROOT_DIR = os.path.dirname(sys.executable)
else:
APP_ROOT_DIR = os.path.dirname(__file__)
if not APP_ROOT_DIR:
... | Moguri/prototype-nitrogen | game/main.py | Python | apache-2.0 | 1,902 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2017 GEM Foundation
#
# OpenQuake 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 Licen... | gem/oq-hazardlib | openquake/hazardlib/tests/gsim/boore_atkinson_2011_test.py | Python | agpl-3.0 | 1,622 |
#!/usr/bin/python
# Copyright: (c) 2016, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | slohse/ansible | lib/ansible/modules/system/sefcontext.py | Python | gpl-3.0 | 9,116 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2015 Douglas Blank <doug.blank@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 2 of the License, o... | ennoborg/gramps | gramps/plugins/db/dbapi/dbapi.gpr.py | Python | gpl-2.0 | 1,381 |
"""distutils.util
Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
"""
__revision__ = "$Id$"
import sys, os, string, re
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import ... | microdee/IronHydra | src/IronHydra/Lib/distutils/util.py | Python | mit | 21,667 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('cerci_issue', '0003_auto_20151003_1529'),
]
operations = [
migrations.... | cercisanat/cercisanat.com | cerci_issue/migrations/0004_auto_20151011_1332.py | Python | gpl-3.0 | 786 |
from constants import *
def consonant_coda(word):
return coda(CONSONANTS_REGEX, word)
def obstruent_coda(word):
return coda(OBSTRUENT_REGEX, word)
def coda(regex, word):
if word[-1] in regex: return 1
else: return 0
| russmatney/unicode-classification-engine | features/coda.py | Python | mit | 228 |
# 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 ... | mistio/libcloud | libcloud/dns/base.py | Python | apache-2.0 | 18,129 |
from bs4 import BeautifulSoup
import asyncio
from aiohttp import ClientSession
import pandas as pd
import time
time.sleep(20)
def parse_and_get(data):
soup = BeautifulSoup(data, 'html.parser')
tabs = soup.find_all('table')
names = [ sp.text for sp in tabs[2].find_all('span', attrs={'class': 'comment-name... | apoorv-kumar/PyThugLife | RandomScripts/bharatiyamobile.py | Python | mit | 1,329 |
#
# This file is part of Mapnik (c++ mapping toolkit)
#
# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon
#
# Mapnik 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 2.1 of the Li... | mojodna/debian-mapnik | plugins/input/osm/build.py | Python | lgpl-2.1 | 1,631 |
#!/usr/bin/env python
#
# Copyright (c) 2018 The heketi Authors
#
# This file is licensed to you under your choice of the GNU Lesser
# General Public License, version 3 or any later version (LGPLv3 or
# later), or the GNU General Public License, version 2 (GPLv2), in all
# cases as published by the Free Software Founda... | enj/origin | vendor/github.com/heketi/heketi/extras/tools/comparison.py | Python | apache-2.0 | 5,562 |
from django import forms
from .models import Topic, Entry
class TopicForm(forms.ModelForm):
class Meta:
model = Topic
fields = ['text']
labels = {'text': ''}
class EntryForm(forms.ModelForm):
"""录入文章"""
class Meta:
model = Entry
fields = ['text']
labels = {... | lluxury/pcc_exercise | learning_logs/learning_logs/forms.py | Python | mit | 404 |
#!/bin/python
""" scenario_import
Usage:
scenario_import.py [options] NODE_DATA SEQ_DATA RESULTS_DATA
scenario_import.py -h | --help
Examples:
python scenario_import.py -p open_eGo -c 'Increased net transfer capacity NO'
path/to/scenario.csv path/to/scenario-seq.csv path/to/results.csv
Arguments:
NODE_... | openego/data_processing | preprocessing/python_scripts/renpass_gis/scenario_import/scenario_import.py | Python | agpl-3.0 | 8,426 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class QuestionItem(scrapy.Item):
# define the fields for your item here like:
qid = scrapy.Field() # 问题id
class_info = scrapy.Field() # 问题... | madre/xundao | zhidao_scrapy/zhidao/items.py | Python | apache-2.0 | 869 |
# Copyright 2015 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... | pavelchristof/gomoku-ai | tensorflow/contrib/keras/python/keras/layers/convolutional.py | Python | apache-2.0 | 73,211 |
import math, cv2
def distance(point1, point2):
"""
Euclidean distance.
"""
point1 = point1[0]
point2 = point2[0]
return math.sqrt(math.pow(point1[0] - point2[0], 2) + math.pow(point1[1] - point2[1], 2))
class Gesture:
"""
Represent the current state of the hand.
"""
def __in... | tgodzik/projects | mouse_hand_steering/utils/gesture.py | Python | apache-2.0 | 1,684 |
# Copyright (c) 2021, Manfred Moitzi
# License: MIT License
import math
import pytest
import ezdxf
from ezdxf.document import Drawing
from ezdxf.math import Vec2, arc_angle_span_deg
from ezdxf.render.dim_curved import detect_closer_defpoint, _CurvedDimensionLine
@pytest.fixture(scope="module")
def doc():
retur... | mozman/ezdxf | tests/test_07_render/test_712_render_curved_dimension.py | Python | mit | 6,399 |
# -*- coding: utf-8 -*-
from nose.tools import eq_
import bot_mock
from pyfibot.modules import module_urltitle
from utils import check_re
bot = bot_mock.BotMock()
lengh_str_regex = u'\d+(h|m|s)(\d+(m))?(\d+s)?'
views_str_regex = u'\d+(\.\d+)?(k|M|Billion|Trillion)?'
age_str_regex = u'(FRESH|(\d+(\.\d+)?(y|d) ago))'
... | huqa/pyfibot | tests/test_areena.py | Python | bsd-3-clause | 1,476 |
# -*- coding: utf-8 -*-
###############################################################################
# Information
###############################################################################
# Created by Linwood Creekmore
# Input by Vikram Mittal
# In partial fulfillment of the requirements for the Georgeto... | georgetown-analytics/skidmarks | bin/lin.py | Python | mit | 2,801 |
from django import template
from django.urls import reverse
from django.utils.safestring import mark_safe
from .. import markdown_extensions
import markdown
register = template.Library()
def create_markdown_filter(*extra_extensions):
def _wrapped(value):
extensions = ['markdown.extensions.{}'.format(e)... | AlexandreDecan/Lexpage | app/commons/templatetags/markup_markdown.py | Python | gpl-3.0 | 865 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 - Mirantis, 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 requir... | dzimine/mistral | mistral/api/controllers/v1/execution.py | Python | apache-2.0 | 4,285 |
#!/usr/bin/env python
# Copyright 2014 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.
"""Script to download sdk/extras packages on the bots from google storage.
The script expects arguments that specify zips file in the ... | Fireblend/chromium-crosswalk | build/download_sdk_extras.py | Python | bsd-3-clause | 2,798 |
"""Test class for Host Collection UI
:Requirement: Hostcollection
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: HostCollections
:Assignee: swadeley
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import time
import pytest
from broker import VMBroker
from nailgun import entitie... | jyejare/robottelo | tests/foreman/ui/test_hostcollection.py | Python | gpl-3.0 | 28,395 |
# Copyright (c) 2015 Intel 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 requ... | ekcs/congress | congress/datasources/ironic_driver.py | Python | apache-2.0 | 9,443 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
import frappe
import unittest
import json
from frappe.website.doctype.personal_data_download_request.personal_data_download_request import get_user_data
from frappe.contacts.doctype.contact.contact import get_contact_na... | mhbu50/frappe | frappe/website/doctype/personal_data_download_request/test_personal_data_download_request.py | Python | mit | 2,103 |
import flask
from pypi_vm.services import package_service
from pypi_vm.viewmodels.shared.viewmodel_base import ViewModelBase
class SiteMapViewModel(ViewModelBase):
def __init__(self, limit: int):
super().__init__()
self.packages = package_service.all_packages(limit)
self.last_updated_text... | Wintellect/WintellectWebinars | 2019-06-06-ten-tips-python-web-devs-kennedy/code/top_10_web_explore/ex07_viewmodels/pypi_vm/viewmodels/utils/sitemap_viewmodel.py | Python | apache-2.0 | 415 |
#!/usr/bin/env python2
# Copyright (C) 2016-2017(H)
# Max Planck Institute for Polymer Research
#
# This file is part of ESPResSo++.
#
# ESPResSo++ 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, eit... | kkreis/espressopp | examples/lennard_jones_em/lennard_jones.py | Python | gpl-3.0 | 9,827 |
#!/usr/bin/python
import os
import sys
sys.path.append(os.path.join(os.getcwd(), '../'))
import pytest
import blackjack.dealer as dealer
import blackjack.table as table
def test_dummy():
for i in range(5):
t = table.Table()
def test_string_representation():
name = 'Lob'
assert "Dealer %s" % name... | suhasgaddam/blackjack-python | blackjack/test/test_dealer.py | Python | mit | 358 |
import glob, os,csv
import sys
import numpy as np
import matplotlib.pyplot as plt
import plotly.plotly as py
import plotly.graph_objs as go
def read_files(folder):
runs = []
print("DIRECTORY")
print(folder)
os.chdir(folder)
for file in glob.glob("*.csv"):
with open(file) as csvfile:
... | kclauw/Dueling_Network_Architectures | results/average_runs.py | Python | mit | 1,498 |
#!/usr/bin/env python
import os
import sys
from optparse import HelpFormatter
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, ROOT)
import upload
class GCWikiHelpFormatter (HelpFormatter):
"""Format help with wiki markup for Google Code."""
def __init__(self,
ind... | nicko96/Chrome-Infra | appengine/chromium_rietveld/tools/uploadopts2wiki.py | Python | bsd-3-clause | 2,871 |
import pandas as pd
import numpy as np
import copy
import flat
#変更の適用
# 解を適用してfitをNoneにする
def _apply_sol(bee, sol):
bee["sol"] = sol
bee["fit"] = {key: None for key in bee["fit"].keys()}
return bee
#基本的な近傍探索
#upgrade: 使う強化剤を一段回引き上げる
# level["None", "+1"]のように、安いの順に
def upgrade(in_bee, type_... | curiburn/pso2_grind_optimizer | py/neighborsearch.py | Python | gpl-3.0 | 2,435 |
# Copyright (C) 2016-Today - KMEE (<http://kmee.com.br>).
# Luis Felipe Miléo - mileo@kmee.com.br
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api
from odoo.addons import decimal_precision as dp
from odoo.tools.float_utils import float_round as round
from .account_p... | akretion/l10n-brazil | l10n_br_account_payment_order/models/account_payment_line.py | Python | agpl-3.0 | 2,102 |
""":mod:`earthreader.web.exceptions` --- Exceptions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from flask import jsonify
from werkzeug.exceptions import HTTPException
class IteratorNotFound(ValueError):
"""Raised when the iterator does not exist"""
class JsonException(HTTPException):
"""Base e... | earthreader/web | earthreader/web/exceptions.py | Python | agpl-3.0 | 1,387 |
#/usr/bin/local/python
# *-* coding: utf-8 *-*
import matplotlib.pyplot as plt
import numpy as np
import math
from popkin.utility.kinematic import segment_ends_from_pose
class ArmEstimationVisualizer:
def __init__(self, mmc):
self.mmc=mmc
self.callbacks={}
self.callbacks_click={}
... | mbaumBielefeld/popkin | popkin/visualization/armestimationvisualizer.py | Python | gpl-2.0 | 4,973 |
# -*- coding: utf-8 -*-
import os
import os.path as op
import yaml
import logging.config
from .text_files import read
from ..config import LOG_LEVEL
MODULE_NAME = __name__.split('.')[0]
def setup_logging(log_config_file=op.join(op.dirname(__file__), 'logger.yml'),
log_default_level=LOG_LEVEL,
... | Neurita/luigi | galvani/utils/logger.py | Python | bsd-3-clause | 955 |
#!/usr/bin/env python3
import bottle
from . import errors
BACKEND_NAME_PATTERN='<name:re:.*>'
class PaltoServer(bottle.Bottle):
"""
"""
def __init__(self, **kargs):
bottle.Bottle.__init__(self, **kargs)
self.backends = kargs.pop('backends', {})
self.setup_routes()
def setup... | snlab/alto-server | palto/paltoserver.py | Python | apache-2.0 | 2,796 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2013 by
# Erwin Marsi and TST-Centrale
#
#
# This file is part of the Algraeph program.
#
# The Algraeph 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; ... | emsrc/algraeph | lib/graeph/graphview.py | Python | gpl-3.0 | 28,393 |
"""Routines to help recognizing sound files.
Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.
The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- nu... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/sndhdr.py | Python | gpl-2.0 | 5,973 |
import wx
from gooey.gui.util import wx_util
from gooey.gui.windows.advanced_config import ConfigPanel
from gooey.gui.windows.sidebar import Sidebar
basic_config = {
'widgets': [{
'type': 'CommandField',
'required': True,
'data': {
'display_name': 'Enter Commands',
'h... | ME-ICA/me-ica | gooey/gui/windows/layouts.py | Python | lgpl-2.1 | 1,332 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/__init__.py | Python | mit | 730 |
# -*- coding: utf-8 -*-
"""Bio2BEL HMDB is a package which allows the user to work with a local sqlite version of the Human Metabolome
Database (HMDB).
Next to creating the local database there are also functions provided, which will enrich given Biological Expression
Language (BEL) graphs with information about meta... | bio2bel/hmdb | src/bio2bel_hmdb/__init__.py | Python | mit | 1,832 |
# lists.py
# creation
>>> [] # empty list
[]
>>> list() # same as []
[]
>>> [1, 2, 3] # as with tuples, items are comma separated
[1, 2, 3]
>>> [x + 5 for x in [2, 3, 4]] # Python is magic
[7, 8, 9]
>>> list((1, 3, 5, 7, 9)) # list from a tuple
[1, 3, 5, 7, 9]
>>> list('hello') # list from a string
['h', 'e', '... | mkhuthir/learnPython | Book_learning-python-r1.1/ch2/lists.py | Python | mit | 2,386 |
# -*- coding: utf-8 -*-
import pytest
import random
import time
from cfme import test_requirements
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.gce import GCEProvider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.c... | jteehan/cfme_tests | cfme/tests/test_utilization_metrics.py | Python | gpl-2.0 | 9,996 |
"""Class that manages the Internet proxy configuration.
Copyright 2014 Dario B. darizotas at gmail dot com
This software is licensed under a new BSD License.
Unported License. http://opensource.org/licenses/BSD-3-Clause
"""
from wininet.winproxysettings import *
from lxml import etree
import sys, os
import argparse
... | darizotas/winproxy | WindowsProxyManager.py | Python | bsd-3-clause | 7,590 |
'''tzinfo timezone information for Africa/Harare.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Harare(DstTzInfo):
'''Africa/Harare timezone definition. See datetime.tzinfo for details'''
zone = 'Africa/Harare'
_ut... | newvem/pytz | pytz/zoneinfo/Africa/Harare.py | Python | mit | 482 |
from django import forms
from .models import Post, Comment
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ('title', 'text',)
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ('author', 'text',)
| maciek263/django2 | blog/forms.py | Python | mit | 253 |
import System
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
def CollectByView(bic, view):
collector = FilteredElementCollector(doc)
filter = ElementOwnerViewFilter(view.Id)
return ... | andydandy74/ClockworkForDynamo | nodes/2.x/python/All View-Dependent Family Instances Of Category.py | Python | mit | 779 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from multitest.models import Test, Question, Answer
class MultitestViewsTests(TestCase):
def setUp(self):
self.user = User.objects.create(username='user', is_active=True, is_s... | adiq/MultitestApp | multitest/tests.py | Python | mit | 3,600 |
from rest_framework import viewsets, filters
from rest_framework.decorators import list_route, detail_route
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticatedOrReadOnly, IsAdminUser
from django.utils import timezone
from django_filters.rest_framework import DjangoFilterB... | LCOGT/valhalla | valhalla/userrequests/viewsets.py | Python | gpl-3.0 | 10,206 |
# coding: utf-8
#
# drums-backend a simple interactive audio sampler that plays vorbis samples
# Copyright (C) 2009 C.D. Immanuel Albrecht
#
# 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 Fou... | immo/pyTOM | df/df_experimental.py | Python | gpl-3.0 | 7,868 |
"""OAuth 2.0 WSGI server middleware providing MyProxy certificates as access tokens
"""
__author__ = "R B Wilkinson"
__date__ = "12/12/11"
__copyright__ = "(C) 2011 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revisi... | TheLanguageArchive/ndg_oauth | ndg_oauth_server/ndg/oauth/server/wsgi/authorization_filter.py | Python | bsd-3-clause | 15,524 |
"""Consolation: Repuge-NG's display frontend library.
Includes the XML-RPC code for multiple interfaces.
This may be useful even if Ludicrous is not used.
"""
__copying__="""
Written by Thomas Hori
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was... | thomas-hori/Repuge-NG | consolation/__init__.py | Python | mpl-2.0 | 409 |
# $Id$
#
# Copyright (C) 2002-2006 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
"""unit testing code f... | jandom/rdkit | rdkit/Chem/Pharm2D/UnitTestGobbi.py | Python | bsd-3-clause | 5,595 |
# -*- coding: utf-8 -*-
@bot.message_handler(commands=['date', 'time', 'Date', 'Time'])
def time_message(message):
userlang = redisserver.get("settings:user:language:" + str(message.from_user.id))
userid = message.from_user.id
banlist = redisserver.sismember('zigzag_banlist', '{}'.format(userid))
if banlist:
... | WebShark025/TheZigZagProject | plugins/time.py | Python | mit | 1,429 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/polyplot/__init__.py | Python | apache-2.0 | 705 |
from flask_restful import Resource
from oeda.controller.experiment_results import get_all_stage_data
import matplotlib.pyplot as plt
import traceback
import json
import numpy as np
from io import BytesIO
import statsmodels.api as sm
import base64
from oeda.databases import db
# https://www.pythonanywhere.com/forums/t... | Starofall/OEDA | Backend/oeda/controller/plotting.py | Python | mit | 2,553 |
#!/usr/bin/python3
#
# Copyright (c) 2013 Mikkel Schubert <MikkelSch@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | MikkelSchubert/paleomix | paleomix/common/system.py | Python | mit | 1,350 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
result = []
if root == None:
return result
p... | jeremykid/FunAlgorithm | python_practice/leetCode/leetcode-102.py | Python | mit | 819 |
# Copyright 2011 VMware, 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 ... | cloudbase/neutron | neutron/conf/common.py | Python | apache-2.0 | 9,557 |
#
# 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
# distr... | dtroyer/python-openstackclient | openstackclient/tests/unit/volume/v2/test_type.py | Python | apache-2.0 | 31,954 |
# --- import --------------------------------------------------------------------------------------
from hardware.opas.TOPAS.TOPAS import Driver as BaseDriver
from hardware.opas.TOPAS.TOPAS import GUI as BaseGUI
# --- driver --------------------------------------------------------------------------------------
cl... | wright-group/PyCMDS | pycmds/hardware/opas/TOPAS/TOPAS-C.py | Python | mit | 886 |
from flask import Flask, url_for, redirect, render_template, request
try:
from mongoengine import *
except ImportError:
exit('You must have mongoengine installed. Install it with the command:\n\t$> easy_install mongoengine')
from flask.ext import superadmin, login, wtf
from flask.ext.superadmin.contrib import ... | syrusakbary/Flask-SuperAdmin | examples/auth/mongoauth.py | Python | bsd-3-clause | 3,951 |
# -*- coding: utf-8 -*-
import unittest
# noinspection PyUnresolvedReferences
from .._tins import IPv4Address
ip_string = "192.168.0.225"
class IPv4AddressTest(unittest.TestCase):
def test_constructor(self):
addr1 = IPv4Address(ip_string)
addr2 = IPv4Address(ip_string)
self.assertEquals(s... | stephane-martin/cycapture | cycapture/libtins/tests/test_ipv4_address.py | Python | lgpl-3.0 | 2,910 |
# BlackJack game - one player vs automated dealer
# The player can stand or hit and are able to pick betting amount
# Player's total amount of money should be tracked
# Alerts about losses, wins, busts, etc ...
import random
import sys
class Player(object):
def __init__(self, name, score,money=100):
self.name = n... | WaR1o/SimpleScripts | blackjack.py | Python | gpl-3.0 | 2,423 |
# -*- coding: utf-8 -*-
# Copyright (C) Aneesh Dogra <lionaneesh@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 later ver... | walterbender/infoslicer | infoslicer/widgets/Journal_Gallery_View.py | Python | gpl-2.0 | 7,706 |
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
##
## Invenio 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, ... | pombredanne/invenio | modules/websubmit/lib/functions/Send_Delete_Mail.py | Python | gpl-2.0 | 6,455 |
# This file is part of fedmsg.
# Copyright (C) 2012 Red Hat, Inc.
#
# fedmsg 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 2.1 of the License, or (at your option) any later version.
#... | msimacek/fedmsg_meta_fedora_infrastructure | fedmsg_meta_fedora_infrastructure/mailman3.py | Python | lgpl-2.1 | 4,694 |
import sys
import os
from mock import patch
import pytest
sys.path.insert(0, '..')
import fix_rpath_osx
amberhome = os.getenv("AMBERHOME")
@pytest.fixture
def amber_src():
return amberhome
@pytest.fixture
def libcpptraj():
return os.path.join(amberhome, 'lib', 'libcpptraj.dylib')
def effect(cmd):
pri... | Amber-MD/ambertools-conda-build | conda_tools/test/test_fix_rpath_osx.py | Python | mit | 3,587 |
# import_global_osm.py:
#
# This script is used to import boundaries from OpenStreetMap into
# MaPit.
#
# It takes KML data generated either by
# get-boundaries-by-admin-level.py, so you need to have run that
# script first.
#
# This script was originally based on import_norway_osm.py by Matthew
# Somerville.
#
# Copyr... | New-Bamboo/mapit | mapit/management/commands/mapit_global_import.py | Python | agpl-3.0 | 13,126 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.