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 |
|---|---|---|---|---|---|
import os
def windows_steam_location():
import _winreg as registry
key = registry.CreateKey(registry.HKEY_CURRENT_USER,"Software\Valve\Steam")
return registry.QueryValueEx(key,"SteamPath")[0]
def windows_userdata_location():
# On Windows, the userdata directory is the steamshortcut installation direct... | ron975/Battlelogium | Battlelogium.ThirdParty.SteamShortcutManager/steam_location_manager.py | Python | gpl-3.0 | 1,776 |
"""Show how to write a custom split action."""
from phy import IPlugin, connect
def k_means(x):
"""Cluster an array into two subclusters, using the K-means algorithm."""
from sklearn.cluster import KMeans
return KMeans(n_clusters=2).fit_predict(x)
class ExampleCustomSplitPlugin(IPlugin):
def attach... | kwikteam/phy | plugins/custom_split.py | Python | bsd-3-clause | 1,793 |
#!/usr/bin/env python
# coding: -utf8
if __name__ == '__main__':
height = input("Enter your height(inch): ")
height = float(height)
weight = input("Enter your weight(pound): ")
weight = float(weight)
bmi = (weight / (height * height)) * 703
bmi = ((bmi * 10) + 0.5) / 10.0
print("Yor BMI... | yamanobori-old/LanguageExercises | 19_if-elseif/python/a.py | Python | mit | 582 |
a = {1:2, 2:3, 3:4}
a.pop(2)
print a
if 3 in a:
print "###" | pikeszfish/littlePython | LeetCode/test.py | Python | mit | 63 |
# coding=UTF-8
# Author: Dennis Lutter <lad1337@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 vers... | bbbenja/SickRage | tests/test_lib.py | Python | gpl-3.0 | 8,207 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-22 15:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('points', '0006_auto_20170304_1157'),
]
operations = [
migrations.RemoveField(
... | KlubJagiellonski/poznaj-app-backend | poznaj/points/migrations/0007_remove_point_images.py | Python | apache-2.0 | 391 |
from docx import docx
import logging
class docxwrapper:
def __init__(self, template, imagepath=None):
self.template = template
self.pictures = []
self.picturemap = {}
self.references = {}
if imagepath is None:
self.imagepath = ""
else:
self.imagepath = imagepath
self.doc, self.relationship... | stlemme/python-dokuwiki-export | docxwrapper.py | Python | mit | 3,335 |
#
# Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
#
# 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 ... | scavarda/mysql-dbcompare | mysql-utilities-1.6.0/mysql/fabric/services/health.py | Python | apache-2.0 | 4,003 |
from text import *
| jasminka/goska | deltalife/__init__.py | Python | bsd-3-clause | 20 |
from w1thermsensor import W1ThermSensor
import RPi.GPIO as GPIO
from datetime import datetime
import time
import sqlite3
GPIO.setmode(GPIO.BCM)
blue_led = 16
orange_led = 20
red_led = 21
GPIO.setup(blue_led,GPIO.OUT)
GPIO.setup(orange_led,GPIO.OUT)
GPIO.setup(red_led,GPIO.OUT)
def light_reset():
GPIO.output(blue_... | kilbyjmichael/pi_temp | led_temp.py | Python | mit | 2,625 |
from django.test import TestCase
from mozdns.txt.models import TXT
from mozdns.domain.models import Domain
class TXTTests(TestCase):
def setUp(self):
self.o = Domain(name="org")
self.o.save()
self.o_e = Domain(name="oregonstate.org")
self.o_e.save()
def do_generic_add(self, d... | rtucker-mozilla/mozilla_inventory | mozdns/txt/tests.py | Python | bsd-3-clause | 1,480 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import config
import speech_recognition as sr
r = sr.Recognizer()
m = sr.Microphone()
try:
print("A moment of silence, please...")
with m as source: r.adjust_for_ambient_noi... | foremap/IoT_demo | examples/example_2.py | Python | apache-2.0 | 1,456 |
from .features import Dictionary, RegexMatches, Stopwords
name = "greek"
try:
import enchant
dictionary = enchant.Dict("el")
except enchant.errors.DictNotFoundError:
raise ImportError("No enchant-compatible dictionary found for 'el'. " +
"Consider installing 'aspell-el'.")
dictiona... | wiki-ai/revscoring | revscoring/languages/greek.py | Python | mit | 4,717 |
# TestInputSocket.py
#
# A test case that checks that providing commands to JSBSim via an input socket
# is working.
#
# Copyright (c) 2015 Bertrand Coconnier
#
# 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... | csbrandt/JSBSim.js | JSBSim/tests/TestInputSocket.py | Python | lgpl-2.1 | 7,822 |
# Copyright 2015 Matthew Rogge
#
# This file is part of Retr3d.
#
# Retr3d 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.
#
# Retr3... | Maaphoo/Retr3d | yRodR.py | Python | gpl-3.0 | 3,374 |
import itertools
import sys
import ast
import glob
import os
import re
import sublime
import sublime_plugin
import threading
import rope
import ropemate
from utils import get_setting
from rope.base.ast import parse
from rope.base.exceptions import ModuleSyntaxError
from rope.base.pycore import ModuleNotFoundError
fro... | JulianEberius/SublimeRope | sublime_rope.py | Python | gpl-2.0 | 35,905 |
"""This file sets up a command line manager.
Use "python manage.py" for a list of available commands.
Use "python manage.py runserver" to start the development web server on localhost:5000.
Use "python manage.py runserver --help" for additional runserver options.
"""
from flask_migrate import MigrateCommand
from flas... | jennywoites/MUSSA | MUSSA_Flask/manage.py | Python | gpl-3.0 | 879 |
# -*- coding: utf-8 -*-
from decimal import *
class BaseAQI(object):
"""A generic AQI class"""
def iaqi(self, elem, cc):
"""Calculate an intermediate AQI for a given pollutant. This is
the heart of the algo. Return the IAQI for the given pollutant.
.. warning:: the concentration is ... | hrbonz/python-aqi | aqi/algos/base.py | Python | bsd-3-clause | 3,945 |
# -*- coding: utf-8 -*-
import wx
from wx.lib.newevent import NewCommandEvent
from ...common.i18n import N_
from ...common.path import default_root_folder
from ..base_view import BaseView
from ..form import BaseForm
from ..validator import BaseValidator
from ..validator import ConfirmPasswordValidator, MinLengthValid... | Bajoo/client-pc | bajoo/gui/screen/setup_config_screen.py | Python | gpl-3.0 | 8,305 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'LocationType'
db.create_table(u'contact_locationtype', (
(u'id', self.gf('django... | LimpidTech/django-contact | contact/migrations/0001_initial.py | Python | mit | 13,184 |
"""Tests for the homewizard component."""
from asyncio import TimeoutError
from unittest.mock import patch
from aiohwenergy import AiohwenergyException, DisabledError
from homeassistant import config_entries
from homeassistant.components.homewizard.const import DOMAIN
from homeassistant.config_entries import ConfigEn... | rohitranjan1991/home-assistant | tests/components/homewizard/test_init.py | Python | mit | 8,060 |
AR = '/usr/bin/ar'
ARFLAGS = 'rcs'
CCFLAGS = ['-g']
CCFLAGS_MACBUNDLE = ['-fPIC']
CCFLAGS_NODE = ['-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64']
CC_VERSION = ('4', '6', '3')
COMPILER_CXX = 'g++'
CPP = '/usr/bin/cpp'
CPPFLAGS_NODE = ['-D_GNU_SOURCE']
CPPPATH_NODE = '/usr/include/nodejs'
CPPPATH_ST = '-I%s'
CXX = ['/us... | messyfresh/multinode_control | server/node_modules/bonescript/build/c4che/Release.cache.py | Python | mit | 1,411 |
import equadratures.distributions.template
import equadratures.distributions.gaussian
import equadratures.distributions.truncated_gaussian
import equadratures.distributions.chebyshev
import equadratures.distributions.cauchy
import equadratures.distributions.chisquared
import equadratures.distributions.beta
import equad... | psesh/Effective-Quadratures | equadratures/distributions/__init__.py | Python | mit | 682 |
# coding: utf-8
from flask import render_template
from flask import redirect, request, url_for, flash
from flask.ext.login import login_user, login_required, logout_user
from flask.ext.login import UserMixin, current_user
from . import auth
from .. import db
from ..models import User
from ..email import send_email
fr... | flow-J/Toy | python/flasky/app/auth/views.py | Python | gpl-2.0 | 6,507 |
# This file is part of PARPG.
# PARPG 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.
# PARPG is distributed in the hope ... | parpg/parpg | parpg/gui/slot.py | Python | gpl-3.0 | 889 |
import pytest
from linked_list import l_list
@pytest.fixture(scope='function')
def create_list():
test_list = l_list()
test_list.insert(1)
test_list.insert(2)
return test_list
def test_init():
test_list = None
test_list = l_list()
assert test_list is not None
assert test_list.size() ... | sazlin/data-structures | test_linked_list.py | Python | mit | 1,649 |
#!/usr/bin/env python
# #45! The second number which is triangular, pentagonal, and hexagonal!
# Luckily, all triangular numbers are all hexagonal!
# For some reason, (N^2 + N)/2 == (2M^2 - M)
# Option 1: Just check all hexagonal numbers for pentagonalness...
# Option 2: Find some relation between hexagonal and p... | nayrbnayrb/projecteuler | 0045/0045.py | Python | gpl-3.0 | 1,397 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | googleapis/python-logging | samples/snippets/handler_test.py | Python | apache-2.0 | 735 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/core/launch/analyser.py | Python | mit | 7,177 |
'''
Created on 4 Jan 2016
@author: ggiscan
'''
from flask import url_for
def format_user_info(users, forproduct=None):
if forproduct is None:
l = [(u.id, len(u.products), u.active, url_for('get_user', userid=u.id))
for u in users]
else:
l = [(u.id, len(u.products), u.a... | ggiscan/Interactor | core/WebInteractor/utils.py | Python | gpl-2.0 | 778 |
from nose import SkipTest
from kombu import Consumer, Producer, Exchange, Queue
from kombu.utils import nested
from funtests import transport
class test_mongodb(transport.TransportCase):
transport = 'mongodb'
prefix = 'mongodb'
event_loop_max = 100
def before_connect(self):
try:
... | romank0/kombu | funtests/tests/test_mongodb.py | Python | bsd-3-clause | 2,443 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#req:
#end req
# TODO: this should have a finalized queue that takes into account the waiting ellements for this instance only
import os
import uuid
from datetime import datetime
import json
import hashlib
from time import time
import poliglo
def check_if_waiting_is_do... | dperezrada/poliglo | workers/base/wait_jobs.py | Python | mit | 14,945 |
#!/usr/bin/env python
"""This file imports the Python std lib so it can be used by components."""
# pylint: disable=g-import-not-at-top, unused-import, using-constant-test
if False:
import BaseHTTPServer
import CGIHTTPServer
import ConfigParser
import Cookie
import DocXMLRPCServer
import HTMLParser
impo... | destijl/grr | grr/client/stdlib.py | Python | apache-2.0 | 8,367 |
from __future__ import unicode_literals
import boto3
from freezegun import freeze_time
import sure # noqa
import re
from moto import mock_opsworks
@freeze_time("2015-01-01")
@mock_opsworks
def test_create_app_response():
client = boto3.client('opsworks', region_name='us-east-1')
stack_id = client.create_sta... | botify-labs/moto | tests/test_opsworks/test_apps.py | Python | apache-2.0 | 2,562 |
# -*- coding: utf-8 -*-
"""Setup the bbb application"""
import logging
import transaction
from tg import config
def setup_schema(command, conf, vars):
"""Place any commands to setup rpac here"""
# Load the models
# <websetup.websetup.schema.before.model.import>
from rpac import model
# <websetup.... | LamCiuLoeng/bbb | rpac/websetup/schema.py | Python | mit | 609 |
import sys
from PyQt4 import QtGui
from pytank.Core import Settings
from PyQt4 import QtCore, QtGui, Qsci
from pytank.Core import Settings,SystemFunctions
from pytank.GUI.Classes import ImageMapper
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.ImageMapp... | kenshay/ImageScript | ProgramData/Interface/ImageMapperApplication.py | Python | gpl-3.0 | 1,223 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Accounting and Finance',
'version': '1.1',
'category': 'Accounting',
'sequence': 35,
'summary': 'Financial and Analytic Accounting',
'description': """
Accounting Access Rights
=========... | chienlieu2017/it_management | odoo/addons/account_accountant/__manifest__.py | Python | gpl-3.0 | 1,041 |
from django.db import models
from django.urls import reverse
import datetime
from django.contrib.auth.models import User
# Create your models here.
class Expense(models.Model):
id = models.AutoField(primary_key = True)
expense_date = models.DateField()
expense_detail = models.CharField(null=True, max_length = 200, ... | PrasannaBarate/ExpenseTracker-Django | DailyExpenses/models.py | Python | apache-2.0 | 606 |
# -*- coding: utf-8 -*-
from cms.models import CMSPlugin, Placeholder
from cms.models.aliaspluginmodel import AliasPluginModel
from cms.models.placeholderpluginmodel import PlaceholderReference
from cms.plugin_base import CMSPluginBase, PluginMenuItem
from cms.plugin_pool import plugin_pool
from cms.plugin_rendering im... | jrclaramunt/django-cms | cms/cms_plugins.py | Python | bsd-3-clause | 4,399 |
#
# DHCP Client
#
# Author : iver Liu
#
import socket
import struct
from random import randint
from dhcp_base import *
class DHCPClient:
def __init__(self):
self.transactionID = b''
self.mac = randomMacInBytes()
self.packet = b''
def discover(self):
for i in range(4): ... | solvery/lang-features | python/network/dhcp_1/dhcp_client.py | Python | gpl-2.0 | 6,061 |
#-----------------------------------------------------------------------------
# Name: gaugesplash.py
# Purpose: splash screen with gauge to show progress
#
# Author: Rob McMullen
#
# Created: 2007
# RCS-ID: $Id: $
# Copyright: (c) 2007 Rob McMullen
# License: wxWidgets
#-----------------... | robmcmullen/peppy | peppy/lib/gaugesplash.py | Python | gpl-2.0 | 3,507 |
import logging
import re
from streamlink.plugin import Plugin, PluginArgument, PluginArguments
from streamlink.plugin.api import useragents, validate
from streamlink.stream import HLSStream
log = logging.getLogger(__name__)
class TVPlayer(Plugin):
api_url = "https://v1-streams-elb.tvplayer-cdn.com/api/live/stre... | beardypig/streamlink | src/streamlink/plugins/tvplayer.py | Python | bsd-2-clause | 5,297 |
'''
Calculates mean temperature differences between two following days.
Name
====
Daily temperature change
Theme information
=================
The map shows the change in average daily temperature (in C) during previous 24-hour period at 7 a.m. (8 a.m. in summer time) for given date.
Maps for ... | kmunve/pysenorge | pysenorge/themes/temperature_gradient_daily.py | Python | gpl-3.0 | 6,709 |
# Generated from asparagram.g4 by ANTLR 4.5.1
from antlr4 import *
if __name__ is not None and "." in __name__:
from .asparagramParser import asparagramParser
else:
from asparagramParser import asparagramParser
# This class defines a complete listener for a parse tree produced by asparagramParser.
class aspara... | Caian/Asparagus | asparagramListener.py | Python | gpl-2.0 | 5,628 |
"""
Q&A website settings - title, desctiption, basic urls
keywords
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import CONTENT_AND_UI
from askbot.deps import livesettings
from django.utils.translation import ugettext as _
QA_SITE_SETTINGS = livesettings.ConfigurationGroup(
... | afdelgado/askbot | askbot/conf/site_settings.py | Python | gpl-3.0 | 2,782 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | badock/nova | nova/tests/compute/test_compute.py | Python | apache-2.0 | 502,411 |
# Copyright 2015 Chelsio Communications 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
#
# Unle... | phenoxim/cinder | cinder/tests/unit/targets/test_cxt_driver.py | Python | apache-2.0 | 8,161 |
# -*- coding: utf-8 -*-
"""
pygments.lexers
~~~~~~~~~~~~~~~
Pygments lexers.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
import types
import fnmatch
import re
from os.path import basename
from pygments.lexers._mapping ... | emineKoc/WiseWit | wisewit_front_end/node_modules/pygmentize-bundled/vendor/pygments/pygments/lexers/__init__.py | Python | gpl-3.0 | 8,329 |
from django.test import TestCase
from guardian.shortcuts import assign_perm
#from organizations.models import OrganizationUser
from publicweb.tests.factories import (OrganizationUserFactory,
OrganizationOwnerFactory)
GUARDIAN_PERMISSION = 'edit_decisions_feedback'
class Organ... | daniell/econsensus | django/econsensus/publicweb/tests/custom_organizations/models_test.py | Python | gpl-3.0 | 1,810 |
import datetime
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.conf import settings
from model_mommy import mommy
from apps.learn.models import Area, Project, Announcement, Enrollment
cla... | gileno/sofia | sofia/apps/learn/tests/test_views.py | Python | mit | 8,739 |
#!/usr/bin/python
# coding: utf-8
# Copyright (C) 2010 Lucas Alvares Gomes <lucasagomes@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, or
# (at you... | umago/carbono | carbono/ui/cli.py | Python | gpl-2.0 | 11,565 |
#!/usr/bin/env python3
import itertools
import networkx as nx
class UndirectedGraph(nx.Graph):
"""
Base class for all the Undirected Graphical models.
Each node in the graph can represent either a random variable, `Factor`,
or a cluster of random variables. Edges in the graph are interactions
b... | pgmpy/pgmpy | pgmpy/base/UndirectedGraph.py | Python | mit | 9,237 |
#!/usr/bin/python
from data import constants
from jsutils import *
import re
import os
from images import Images
LOCALIZED_DIR_REGEX = re.compile(r"((.*?)([\w]{2}[.]lproj)(.*))")
IMAGE_FILE_REGEX = re.compile(r"(([\d\w]+ /\* )([\w\d-]{0,}(@[2-9]x){0,1}(-landscape){0,1}.png)(.)+)")
def regexMatch(match):
return ma... | mallarke/JSKit | scripts/parsers/xcodeParser.py | Python | apache-2.0 | 1,005 |
#from .base import FunctionalTest
#class PreviewChart_test(FunctionalTest):
# pass
'''
def test_xunits(self):
self.browser.get(self.live_server_url)
self.assertIn('benchmarklib', self.browser.title)
inputbox = self.browser.find_element_by_id('xunits')
self.assertEqual(
... | frRoy/Benchmarklib | benchmarklib/tests_functional/test_preview_chart.py | Python | bsd-3-clause | 615 |
from distutils.errors import DistutilsOptionError
from setuptools.extern.six.moves import map
from setuptools.command.setopt import edit_config, option_base, config_file
def shquote(arg):
"""Quote an argument for later parsing by shlex.split()"""
for c in '"', "'", "\\", "#":
if c in arg:
... | zwChan/VATEC | ~/eb-virt/Lib/site-packages/setuptools/command/alias.py | Python | apache-2.0 | 2,426 |
# Name: node.py
# Purpose: Rapidly assemble XML using minimal coding.
# Authors: Bruce Eckel, (c)2006 MindView Inc. www.MindView.net
# Contributors: Asuka Yamakawa, Anton Korosov, Knut-Frode Dagestad,
# Morten W. Hansen, Alexander Myasoyedov,
# Dmitry Petrenko, Evgeny Morozov
# Creat... | nansencenter/nansat | nansat/node.py | Python | gpl-3.0 | 11,570 |
import pytest
import responses
import re
from flask import json
from unittest.mock import MagicMock
from backend.util.response.error import ErrorSchema
def test_delete_controller(mocker, login_disabled_app, willorders_ws):
mocker.patch("flask_login.utils._get_user", return_value=MagicMock(uuid_slug="test"))
... | willrp/willbuyer | backend/tests/unit/controller/api/order/test_delete_controller.py | Python | mit | 1,849 |
# -*- test-case-name: twisted.test.test_stringtransport -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Assorted functionality which is commonly useful when writing unit tests.
"""
from __future__ import division, absolute_import
from socket import AF_INET, AF_INET6
from io import Byt... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/test/proto_helpers.py | Python | gpl-2.0 | 20,230 |
import os
# from anytask.settings_common import INSTALLED_APPS
DEBUG = os.environ.setdefault('DJANGO_DEBUG', 'False')
TEMPLATE_DEBUG = DEBUG
INSTALLED_APPS = list(INSTALLED_APPS) + ['jupyter']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ.setde... | znick/anytask | configs/docker/settings_local.py | Python | mit | 793 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | nervous-laughter/q2-demux | q2_demux/_summarize/__init__.py | Python | bsd-3-clause | 498 |
import abc
import os
import shutil
import sys
import time
import typing
import attr
class Progress:
def __init__(self) -> None:
self.total_done = 0
self.total_size = 0
self.total_elapsed = 0.0
self.index = 0
self.count = 0
self.src = ""
self.dest = ""
... | yannicklm/pycp | pycp/progress.py | Python | mit | 14,221 |
import os
import json
import log
class NullRequiredDataException(Exception):
pass
def get_starter_identity(name):
return "starter_" + name + "." + str(os.getpid())
def get_starter_logger(set_level, identity, log_file="starter.log"):
return log.logger(log_file, set_level, identity)
def set_work... | jhroot/elife-bot | starter/starter_helper.py | Python | mit | 1,066 |
# coding: UTF-8
# 문제: 모스 부호 해석해서 한 문장으로 출력하기
# 모스부호
morse = {
'.-':'A','-...':'B','-.-.':'C','-..':'D','.':'E','..-.':'F',
'--.':'G','....':'H','..':'I','.---':'J','-.-':'K','.-..':'L',
'--':'M','-.':'N','---':'O','.--.':'P','--.-':'Q','.-.':'R',
'...':'S','-':'T','..-':'U','...-':'V','.--':'W','-..-':... | inhwane/kookmin | source/problem/morse.py | Python | mit | 649 |
# This script generates the Makefiles for building PyQt5.
#
# Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
#
# This file is part of PyQt5.
#
# This file may be used under the terms of the GNU General Public License
# version 3.0 as published by the Free Software Foundation and appearin... | baoboa/pyqt5 | configure.py | Python | gpl-3.0 | 109,623 |
# coding=utf-8
#
# Example 5 - How to retrieve your payments history.
#
import sys, os
#
# Add Mollie library to module path so we can import it.
# This is not necessary if you use pip or easy_install.
#
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/../'))
import Mollie
def main():
try:
... | ronaldevers/mollie-api-python | examples/5-payments-history.py | Python | bsd-2-clause | 1,075 |
#! /usr/bin/python
# Copyright 2015 Kevin Lynch
#
# 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... | criteo-forks/collectd-marathon | marathon.py | Python | apache-2.0 | 3,668 |
#
# MLDB-1104-input-data-spec.py
# mldb.ai inc, 2015
# This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved.
#
import unittest
import datetime
import random
from mldb import mldb, ResponseException
class InputDataSpecTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls... | mldbai/mldb | testing/MLDB-1104-input-data-spec.py | Python | apache-2.0 | 5,830 |
# 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... | EvenStrangest/tensorflow | tensorflow/python/ops/array_ops.py | Python | apache-2.0 | 71,046 |
import pygame
from pygame.locals import*
class basicText():
def __init__(self, screen, text, font, color, position, fade_speed, centerx=True, centery=True):
self.screen = screen
self.text = font.render(text, 1, color)
self.position = position
self.size = font.size(text)
if ce... | lumidify/BobGUI | BasicText2.py | Python | lgpl-3.0 | 1,621 |
# encoding: utf-8
# module atk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/atk.so
# by generator 1.135
# no doc
# imports
import gobject as __gobject
import gobject._gobject as __gobject__gobject
import __main__ as ____main__
class TextAttribute(__gobject.GEnum):
# no doc
def __init__(self, *args, **kwar... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/atk/TextAttribute.py | Python | gpl-2.0 | 1,092 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
from sphinx_explorer import package_main
if __name__ == "__main__":
package_main()
| pashango2/sphinx-explorer | sphinx-explorer_debug.py | Python | mit | 217 |
"""Devstack settings"""
from os import environ
import yaml
from ecommerce.settings.base import *
from ecommerce.settings.logger import get_logger_config
LOGGING = get_logger_config(debug=True, dev_env=True, local_loglevel='DEBUG')
# Pull in base setting overrides from configuration file.
CONFIG_FILE = environ.get('... | mferenca/HMS-ecommerce | ecommerce/settings/devstack.py | Python | agpl-3.0 | 1,744 |
# Natural Language Toolkit: Logic
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2011 NLTK Project
# URL: <http://www.nltk.org>
# For license information, see LICENSE.TXT
"""
A version of first order predicate logic, built on
top of the typed lambda calculus.
"""
import re
import operator
fr... | tadgh/ArgoRevisit | third_party/nltk/sem/logic.py | Python | apache-2.0 | 63,927 |
# -*- coding: utf-8 -*-
def ack(m, n):
u"""perform the Ackermann's function.
Args:
m(int)
n(int)
Returns:
int: Value of Ackermann's function given inputs m, n.
Raises:
ValueError: If m, n is negative.
"""
if m < 0 or n < 0:
raise ValueError(u'input must be a nonnegative integer.')
if m == 0:... | AmandaMoen/AmandaMoen | students/ElizabethRives/ack.py | Python | gpl-2.0 | 846 |
"""
Test basic outgoing and incoming call handling
"""
import dbus
from dbus.exceptions import DBusException
from twisted.words.xish import xpath
from gabbletest import exec_test
from servicetest import (
make_channel_proxy, wrap_channel,
EventPattern, call_async,
assertEquals, assertDoesNotContain, asse... | jku/telepathy-gabble | tests/twisted/jingle/call-basics.py | Python | lgpl-2.1 | 18,030 |
from __future__ import print_function
import sys
import optparse
import cProfile
import inspect
import pkg_resources
import scrapy
from scrapy.crawler import CrawlerProcess
from scrapy.xlib import lsprofcalltree
from scrapy.commands import ScrapyCommand
from scrapy.exceptions import UsageError
from scrapy.utils.misc i... | bdh1011/wau | venv/lib/python2.7/site-packages/scrapy/cmdline.py | Python | mit | 5,789 |
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | opencord/xos | lib/xos-config/xosconfig/__init__.py | Python | apache-2.0 | 683 |
import os
import re
import logging
import scrapy
from scrapy import signals
from scrapy import Spider
from sqlalchemy import *
from sqlalchemy.orm import *
class CountryData(object):
def __init__(self, year, pos, name, gender, count):
self.year = year
self.pos = pos
self.name = name
... | jotaelesalinas/ml-ssa-birthnames | src/SsaSpider.py | Python | mit | 7,946 |
from utils.strings import quote
from plugins.languages import javascript
from utils.loggers import log
from utils import rand
import base64
import re
class Dot(javascript.Javascript):
def init(self):
self.update_actions({
'render' : {
'render': '{{=%(code)s}}',
... | epinna/tplmap | plugins/engines/dot.py | Python | gpl-3.0 | 2,139 |
# -*- coding: utf-8 -*-
# 3章 ニューラルネットワーク
import numpy as np
class NeuralTrain:
def step_function(self, x):
return np.array(x > 0, dtype=np.int)
def sigmoid_function(self, x):
return 1 / (1 + np.exp(-x))
def relu_function(self, x):
return np.maximum(0, x) | Arahabica/NNTrain | train/neural/NeuralTrain.py | Python | mit | 318 |
"""
VariationalBayes for Vanilla LDA
@author: Ke Zhai (zhaike@cs.umd.edu)
code for update_alpha come from piskvorky's gensim models
https://github.com/piskvorky/gensim/blob/develop/gensim/models/ldamodel.py
"""
from collections import defaultdict
import time
from numpy import log, exp, ones
import numpy
import sci... | bdmckean/MachineLearning | fall_2017/hw5/lda.py | Python | mit | 10,691 |
import os
from numpy import array,dot,pi
from numpy.linalg import inv,norm
from generic import obj
from periodic_table import periodic_table
from physical_system import PhysicalSystem
from simulation import Simulation
from qmcpack_input import QmcpackInput,generate_qmcpack_input
from qmcpack_input import BundledQmcpac... | habanero-rice/hclib | test/performance-regression/full-apps/qmcpack/nexus/library/qmcpack.py | Python | bsd-3-clause | 19,534 |
#!/usr/bin/env python
# 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 program is distributed in the hope that ... | santazhang/BitTorrent-4.0.0-GPL | btshowmetainfo.py | Python | gpl-3.0 | 2,416 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TerminalRoastDB, released under GPLv3
# Roaster Set Time
import Pyro4
import sys
new_roaster_time = sys.argv[1]
roast_control = Pyro4.Proxy("PYRONAME:roaster.sr700")
if int(new_roaster_time) > 0 and int(new_roaster_time) <1200:
roast_control.set_time(new_roaster_ti... | infinigrove/TerminalRoastDB | cmds/Roaster_Set_Time.py | Python | gpl-3.0 | 324 |
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-... | creasyw/IMTAphy | framework/library/PyConfig/openwns/probebus.py | Python | gpl-2.0 | 9,523 |
#!/usr/bin/python
# getIdfSeries.py
import os
import csv
def toStr(num):
if(num >= 10):
return str(num)
else:
return '0'+str(num)
def main():
# ----- these need to be set to target the correct day
fileYear = 2014
fileMonth = 12
fileDay = 4
MIN_HOURS = 0
MAX_HOURS = 23
# -----
dayStr_FileStem = toSt... | cy94/twitter-events | detection/getIdfSeries.py | Python | gpl-2.0 | 1,189 |
from copy import copy
from django import forms
from django.conf import settings
from olympia.amo.fields import ReCaptchaField
from olympia.lib import happyforms
from olympia.translations.fields import TranslatedField
class AbuseForm(happyforms.Form):
recaptcha = ReCaptchaField(label='')
text = forms.CharFie... | harikishen/addons-server | src/olympia/amo/forms.py | Python | bsd-3-clause | 2,070 |
# pymkcmd | dale@pbdr.info | http://pbdr.info
# CLI: sub_numbers
from pymkcmd import mkcmd, mkant
def sub_numbers(int0, float0=0.0):
'''Subtract two numbers.'''
return int0 - float0
if __name__ == '__main__':
mkcmd(
mkant(
sub_numbers,
param_types={
'int0... | pbdr/pymkcmd | tests/sub_numbers.py | Python | mit | 579 |
import sys
import numpy as np
import cv2
def main():
w, h = map(int, (sys.argv[1] if len(sys.argv) > 1 else '2048x1944').split('x'))
imgfile = sys.argv[2] if len(sys.argv) > 2 else r'D:\Downloads\example-navcam-imgs\navcamTests0619\rubbleML-def-14062019-25.raw'
imgout = sys.argv[3] if len(sys.ar... | oknuutti/visnav-py | visnav/iotools/read-raw-img.py | Python | mit | 811 |
from typing import Optional
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.components.bend_euler import bend_euler
from gdsfactory.components.coupler90 import coupler90 as coupler90function
from gdsfactory.components.coupler_straight import (
coupler_straight as coupler_straight... | gdsfactory/gdsfactory | gdsfactory/components/coupler_ring.py | Python | mit | 2,846 |
# coding: utf-8
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.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 o... | sonaht/ansible | test/units/parsing/yaml/test_loader.py | Python | gpl-3.0 | 16,840 |
from __future__ import unicode_literals
from django.db import models
class SavedUser(models.Model):
source = models.CharField(max_length=16)
handle = models.CharField(max_length=100, unique=True)
name = models.CharField(max_length=100)
location = models.CharField(max_length=100)
influencer = model... | cdconrad/shiftkey-py | week3/mysite/profileGrabber/models.py | Python | mit | 538 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
import webnotes, json
from webnotes.utils import flt
import unittest
test_dependencies = ["Sales BOM"]
class TestQuotation(unittest.TestCase):
def test_make_sales_order(self):
from selling.doctype.quot... | Yellowen/Owrang | selling/doctype/quotation/test_quotation.py | Python | agpl-3.0 | 1,931 |
import sys
import os
import pytest
main_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
sys.path.insert(0, main_dir)
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
return True
clang_installed ... | cislaa/prophy | prophyc/tests/conftest.py | Python | mit | 829 |
from openmesh import TriMesh
import projectconfig
import unittest
from graphicfile import Graphic_File
import customstructures
import time
class AbstractTest(unittest.TestCase):
def test_get_elements(self):
start_time = time.time()
elements = customstructures.get_elements(self.mesh)
stop_ti... | bajorekp/modelowanie_w_grafice | test/abstract_test.py | Python | mit | 1,338 |
A, B = map(int, input().split())
if A + B == 15:
print('+')
elif A * B == 15:
print('*')
else:
print("x")
| knuu/competitive-programming | atcoder/corp/soundhound_master_2018_qa.py | Python | mit | 118 |
# -*- coding: utf-8 -*-
#
# Pyplis is a Python library for the analysis of UV SO2 camera data
# Copyright (C) 2017 Jonas Gliss (jonasgliss@gmail.com)
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License a
# published by the Free Software Foundat... | jgliss/pyplis | scripts/RUN_INTRO_SCRIPTS.py | Python | gpl-3.0 | 3,103 |
# $Id: isql.py 6639 2009-08-10 17:06:51Z fwierzbicki $
import dbexts, cmd, sys, os
"""
Isql works in conjunction with dbexts to provide an interactive environment
for database work.
"""
__version__ = "$Revision: 6639 $"[11:-2]
class IsqlExit(Exception): pass
class Prompt:
"""
This class fixes a problem wit... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/isql.py | Python | epl-1.0 | 7,153 |
import statsd
import decimal
class Gauge(statsd.Client):
'''Class to implement a statsd gauge
'''
def send(self, subname, value):
'''Send the data to statsd via self.connection
:keyword subname: The subname to report the data to (appended to the
client name)
:keyword... | Ppanos40/liquid-galaxy.lg-root-fs | home/lg/bin/statsd/gauge.py | Python | apache-2.0 | 598 |
# -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
import unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class add_pozov(unittest.TestCase):
def setUp(self):
self.wd = WebDriver()
... | DanilMarchyshyn/python_traning | test/test_add_pozov.py | Python | apache-2.0 | 2,732 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.