commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
6d67378d318e83e53f9ad6f16bd946c1ce103577 | update v0.7.6 | tony/libtmux | libtmux/__about__.py | libtmux/__about__.py | __title__ = 'libtmux'
__package_name__ = 'libtmux'
__version__ = '0.7.6'
__description__ = 'scripting library / orm for tmux'
__email__ = 'tony@git-pull.com'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016-2017 Tony Narlock'
| __title__ = 'libtmux'
__package_name__ = 'libtmux'
__version__ = '0.7.5'
__description__ = 'scripting library / orm for tmux'
__email__ = 'tony@git-pull.com'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016-2017 Tony Narlock'
| bsd-3-clause | Python |
e3a4621b733780887e237923acc5db37743b1835 | Revert "Disabled doc generation a bit" | GooTechnologies/goojs,GooTechnologies/goojs,GooTechnologies/goojs | tools/release.py | tools/release.py | #!/usr/bin/env python
import os
import sys
import shutil
import subprocess
if len(sys.argv) != 2:
print 'Usage: release.py version-number'
sys.exit(1)
version = sys.argv[1]
name = 'goo-' + version
print 'Creating release', name
if os.path.isdir('out'):
shutil.rmtree('out')
grunt_command = 'node_module... | #!/usr/bin/env python
import os
import sys
import shutil
import subprocess
if len(sys.argv) != 2:
print 'Usage: release.py version-number'
sys.exit(1)
version = sys.argv[1]
name = 'goo-' + version
print 'Creating release', name
if os.path.isdir('out'):
shutil.rmtree('out')
grunt_command = 'node_module... | mit | Python |
0a187c3fc58ef31584e20d6454571b267ae6128b | Bump version | iffy/norm,iffy/norm | norm/__init__.py | norm/__init__.py | # Copyright (c) Matt Haggard.
# See LICENSE for details.
__all__ = ['__version__', 'makePool', 'insert', 'ormHandle']
__version__ = '1.5.3'
from norm.porcelain import makePool, insert, ormHandle
| # Copyright (c) Matt Haggard.
# See LICENSE for details.
__all__ = ['__version__', 'makePool', 'insert', 'ormHandle']
__version__ = '1.5.2'
from norm.porcelain import makePool, insert, ormHandle
| mit | Python |
1408844877c5b4516182f2cefabd2988d361bd4f | add python-fedora to setup.py | FOSSRIT/charsheet,FOSSRIT/charsheet,FOSSRIT/charsheet | metrics/charsheet/setup.py | metrics/charsheet/setup.py | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'coderwall',
'elementtree',
'pyramid',
'py-stackexchange',
'SQLAlche... | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'coderwall',
'elementtree',
'pyramid',
'py-stackexchange',
'SQLAlche... | agpl-3.0 | Python |
99498264ed273cc8d8d0b79f17361a90b6256a97 | Fix endianness in the mempoke module | fmfi-svt-deadlock/hw-testing,fmfi-svt-deadlock/hw-testing | mempoke.py | mempoke.py | import gdb
import struct
class DeviceMemory:
def __init__(self):
self.inferior = gdb.selected_inferior()
def __del__(self):
del self.inferior
def read(self, address):
return struct.unpack('I', self.inferior.read_memory(address, 4))[0]
def write(self, address, value):
... | import gdb
import struct
class DeviceMemory:
def __init__(self):
self.inferior = gdb.selected_inferior()
def __del__(self):
del self.inferior
def read(self, address):
return struct.unpack('I', self.inferior.read_memory(address, 4))[0]
def write(self, address, value):
... | mit | Python |
5842f25fdf6a2431a7899e5830d45012e9b2b61f | Add removedups which returns a still-ordered list with duplicate entries removed. | ihuston/pyflation,ihuston/pyflation | helpers.py | helpers.py | """Helper functions by Ian Huston
$Id: helpers.py,v 1.6 2009/01/12 13:31:35 ith Exp $
Provides helper functions for use elsewhere"""
from __future__ import division # Get rid of integer division problems, i.e. 1/2=0
import numpy as N
def nanfillstart(a, l):
"""Return an array of length l by appending... | """Helper functions by Ian Huston
$Id: helpers.py,v 1.5 2008/11/14 17:28:03 ith Exp $
Provides helper functions for use elsewhere"""
from __future__ import division # Get rid of integer division problems, i.e. 1/2=0
import numpy as N
def nanfillstart(a, l):
"""Return an array of length l by appending... | bsd-3-clause | Python |
34f6bbcf67f44a1030a6ac00e2604fdf2bb95b17 | Implement Minimax.minimax | frila/agente-minimax | minimax.py | minimax.py | class Heuristic:
def __init__(self, color):
self.color = color
def heuristic(self, board, color):
raise NotImplementedError('Dont override this class')
def eval(self, vector):
raise NotImplementedError('Dont override this class')
class Minimax:
def __init__(self, me, challenger):
self.me, se... | class Heuristic:
def __init__(self, color):
self.color = color
def heuristic(self, board, color):
raise NotImplementedError('Dont override this class')
def eval(self, vector):
raise NotImplementedError('Dont override this class')
class Minimax:
def __init__(self, me, challenger):
self.me = m... | apache-2.0 | Python |
cd0de9348e71385d8f0cd8ef2bd03d0b3fd72735 | Make trunk 1.0b4.dev release | illume/numpy3k,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,efiring/numpy-work,Ademan/NumPy-GSoC,illume/numpy3k,chadnetzer/numpy-gaurdro,efiring/numpy-work,efiring/numpy-work,chadnetzer/numpy-gaurdro,chadnetzer/numpy-gaurdro,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,teoliphant/num... | numpy/version.py | numpy/version.py | version='1.0b4444'
release=False
if not release:
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_version__',
... | version='1.0b3'
release=False
if not release:
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_version__',
... | bsd-3-clause | Python |
2447f1cd70ede3add22851241b9a3afb54025f92 | Change shebang line and use python from env | HenryCook/es-tool | es-tool.py | es-tool.py | #!/usr/bin/env python
from elasticsearch import Elasticsearch
from elasticsearch import helpers
import argparse
import sys
def parse_args():
parser = argparse.ArgumentParser(description='Elasticsearch management')
parser.add_argument('-r', '--reindex', action='store', help='Reindex all documents in specified... | #!/usr/local/bin/python
from elasticsearch import Elasticsearch
from elasticsearch import helpers
import argparse
import sys
def parse_args():
parser = argparse.ArgumentParser(description='Elasticsearch management')
parser.add_argument('-r', '--reindex', action='store', help='Reindex all documents in specifi... | mit | Python |
8477e92abbcfb352e8fb88d6b4b84894e6dd4b75 | correct the location of model riff templates | django-djam/django-djam,django-djam/django-djam,django-djam/django-djam,django-djam/django-djam | djam/views/models.py | djam/views/models.py | from django.views.generic import ListView, DetailView
from djam.views.base import RiffView
class ModelRiffView(RiffView):
template_suffix = None
def get_template_names(self):
if self.template_name:
return [self.template_name]
applabel = self.model._meta.app_label
... | from django.views.generic import ListView, DetailView
from djam.views.base import RiffView
class ModelRiffView(RiffView):
template_suffix = None
def get_template_names(self):
if self.template_name:
return [self.template_name]
applabel = self.model._meta.app_label
... | bsd-2-clause | Python |
e621f41f524a07a253e50c5e13dc4f6935942e1b | Remove defunk imageops app | vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium | ocradmin/urls.py | ocradmin/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Static media
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': setting... | from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Static media
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': setting... | apache-2.0 | Python |
0691e1b91534b8eddbbb3297e3c4e3248c79c65b | Refactor MODE into STATE | xmonader/dmiparse | dmiparse/__init__.py | dmiparse/__init__.py | """dmiparse - Parse dmidecode into reasonable python"""
__version__ = '0.1.0'
__author__ = 'Ahmed Youssef <xmonader@gmail.com>'
__all__ = ['dmiparse']
import json
from itertools import takewhile
STATE_SECTION_NAME, STATE_READ_KV, STATE_LIST_PROPERTY = range(3)
class Section:
def __init__(self):
self.pr... | """dmiparse - Parse dmidecode into reasonable python"""
__version__ = '0.1.0'
__author__ = 'Ahmed Youssef <xmonader@gmail.com>'
__all__ = ['dmiparse']
import json
from itertools import takewhile
MODE_SECTION_START, MODE_SECTION_NAME, MODE_READ_KV, MODE_LIST_PROPERTY, MODE_SECTION_DONE = range(5)
class Section:
... | bsd-3-clause | Python |
d782de3b7503b116d63c69a4a6ce2812c40dc6f6 | complete exercise 15 | sdarji/lpthw,sdarji/lpthw,sdarji/lpthw,sdarji/lpthw | ex/ex15.py | ex/ex15.py | # LPTHW Exercise 15 -- Reading Files
from sys import argv
script, filename = argv
txt = open(filename)
print "Here's your file %r:" % filename
print txt.next()
print txt.next()
print txt.next()
#print txt.read()
txt.close()
print "Type the filename again:"
file_again = raw_input("> ")
txt_again = open(file_again)... | # LPTHW Exercise 15 -- Reading Files
from sys import argv
script, filename = argv
txt = open(filename)
print "Here's your file %r:" % filename
print txt.read()
print "Type the filename again:"
file_again = raw_input("> ")
txt_again = open(file_again)
print txt_again.read() | unlicense | Python |
fb98d0855272d756ff946d3ea3486e73e6af53da | Update joint.py | cmccomb/truss-me | trussme/joint.py | trussme/joint.py | import numpy
class Joint(object):
# Saving the number of joints
number_of_joints = 0
def __init__(self, coordinates):
# Save the joint id
self.idx = 0
self.number_of_joints += 1
# Coordinates of the joint
self.coordinates = coordinates
# Allowed tran... | import numpy
class Joint(object):
# Saving the number of joints
number_of_joints = 0
def __init__(self, coordinates):
# Save the joint id
self.idx = 0
number_of_joints += 1
# Coordinates of the joint
self.coordinates = coordinates
# Allowed translati... | mit | Python |
af57b507e7ec0b67ce66968287d1865a963422ee | Bump version for release | DocNow/twarc | twarc/version.py | twarc/version.py | import platform
version = "2.10.0"
user_agent = f"twarc/{version} ({platform.system()} {platform.machine()}) {platform.python_implementation()}/{platform.python_version()}"
| import platform
version = "2.9.5"
user_agent = f"twarc/{version} ({platform.system()} {platform.machine()}) {platform.python_implementation()}/{platform.python_version()}"
| mit | Python |
20b2f55e353d391dda7a5fe4042c1ea24eab74d5 | Rename MyTCPHandler to PCServer | iSevenDays/ESP8266_core | Sources/PC/PCServer.py | Sources/PC/PCServer.py | import socketserver
class PCServer(socketserver.BaseRequestHandler):
"""
The RequestHandler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client.
"""
def __init__(self, request, client_a... | import socketserver
class MyTCPHandler(socketserver.BaseRequestHandler):
"""
The RequestHandler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client.
"""
def __init__(self, request, clie... | apache-2.0 | Python |
d5e816a40588a34aa5a2e0e2a2b04ba0975142cb | Make the example in example.py much more extensive | Tehnix/cred-client | example.py | example.py | """
Basic example of a client using the cred.client library to perform actions on
the API server.
"""
import time
import random
import logging
from cred.client import ClientBase
# The interval at which to pull for updates from the thermostat (seconds)
pull_interval = 5
# Configure the client application
hostname = '... | """
Basic example of a client using the cred.client library to perform actions on
the API server.
"""
import time
import logging
from cred.client import ClientBase
class MyClient(ClientBase):
"""Subclass ClientBase, and implement the handle_event method."""
def handle_event(self, event):
"""Act on a... | bsd-3-clause | Python |
f70d239dd68235ec2919fd2e51a1a0d0e69325f7 | Update example | gsmafra/py-aasp-casa | example.py | example.py | import numpy as np
from librosa import stft
from sklearn.svm import SVC
from file_feats import file_feats
from train_folds import train_folds
def extract_m_lspectre(fs, sig, args):
# Extract a descriptor for one file of the database. This function will run
# only one time for each file in a simulation. You don't wa... | import numpy as np
from librosa import stft
from sklearn.svm import SVC
from file_feats import file_feats
from train_folds import train_folds
def extract_m_lspectre(fs, sig, args):
# Extract a descriptor for one file of the database. This function will run
# only one time for each file in a simulation. You don't wa... | mit | Python |
f214fdf4eb6e2f6966ff070112ba7142b24af691 | Change example UseTrial returns TA_OK even if trial is disabled | develersrl/python-turboactivate | example.py | example.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from turboactivate import TurboActivate, \
GenuineOptions, \
TA_SKIP_OFFLINE, \
TurboActivateConnectionDelayedError, \
TurboActivateConnectionError, \
TurboActivateError, \
TurboActivateTrialCorruptedError, \
TurboActivateTrialExpiredError, \
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from turboactivate import TurboActivate, \
GenuineOptions, \
TA_SKIP_OFFLINE, \
TurboActivateConnectionDelayedError, \
TurboActivateConnectionError, \
TurboActivateError, \
TurboActivateTrialCorruptedError, \
TurboActivateTrialExpiredError, \
... | mit | Python |
f9387a43e0fd934ca5dc960eb4f343d6a4090023 | Use shorter line | develersrl/python-turboactivate | example.py | example.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from turboactivate import (
TurboActivate,
GenuineOptions,
TA_SKIP_OFFLINE,
TurboActivateError,
TurboActivateTrialUsedError,
TurboActivateConnectionError,
TurboActivateTrialExpiredError,
TurboActivateTrialCorruptedError,
TurboActivateC... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from turboactivate import (
TurboActivate,
GenuineOptions,
TA_SKIP_OFFLINE,
TurboActivateError,
TurboActivateTrialUsedError,
TurboActivateConnectionError,
TurboActivateTrialExpiredError,
TurboActivateTrialCorruptedError,
TurboActivateC... | mit | Python |
77509b98b090c4d66ad05bb6006da77e87af4a1f | Remove example fiddling | onyxfish/journalism,onyxfish/agate,wireservice/agate,JoeGermuska/agate,flother/agate | example.py | example.py | #!/usr/bin/env python
import agate
tester = agate.TypeTester(force={
'fips': agate.Text()
})
table = agate.Table.from_csv('examples/realdata/ks_1033_data.csv', column_types=tester)
# Question 1: What was the total cost to Kansas City area counties?
# Filter to counties containing Kansas City
kansas_city = tabl... | #!/usr/bin/env python
import agate
tester = agate.TypeTester(force={
'fips': agate.Text()
})
table = agate.Table.from_csv('examples/realdata/ks_1033_data.csv', column_types=tester)
print sorted(table.columns['county'].values_distinct())
# Question 1: What was the total cost to Kansas City area counties?
#
# # ... | mit | Python |
2269dc5ad9ddd8fda939112c18056a27d3d416c5 | Add commute time to example | hfaran/ubc-timetabler | example.py | example.py | from datetime import datetime
from itertools import combinations
from timetabler.scheduler import Scheduler
from timetabler.ssc.course import Lecture, Discussion
from timetabler import sort, util
from timetabler.sort import earliest_start # Helper function (should probably be in util)
COMMUTE_HOURS = 1.75
def mai... | from datetime import datetime
from itertools import combinations
from timetabler.scheduler import Scheduler
from timetabler.ssc.course import Lecture, Discussion
from timetabler import sort, util
from timetabler.sort import earliest_start # Helper function (should probably be in util)
def main():
required = ("E... | mit | Python |
475a6031fcd33a4a71368ad7234585f261a8e3dc | add parameter | moyomot/text_classification | execute.py | execute.py | from data_helpers import AgNews, YahooAnswers
from classifiers.cnn_classifier import CNNClassifier
from classifiers.lstm_classifier import LSTMClassifier
from classifiers.character_level_cnn_classifier import CharacterLevelCNNClassifier
from classifiers.naive_bayes_classifier import NaiveBayesClassifier
from classifier... | from data_helpers import AgNews, YahooAnswers
from classifiers.cnn_classifier import CNNClassifier
from classifiers.lstm_classifier import LSTMClassifier
from classifiers.naive_bayes_classifier import NaiveBayesClassifier
from classifiers.svm_classifier import SVMClassifier
import argparse
datasets = {'ag_news': AgNew... | mit | Python |
4ec0dcebb8b7e3ac52ec1496a5bfcc90482fed5a | create read_json method to handle opening, reading and validating json files | theascone/dckrmgr,theascone/dckrmgr | dckrmgr.py | dckrmgr.py | import os
import sys
import json
import docker
import argparse
import importlib
import jsonschema
commands = {}
def read_json(pth, sch=None):
bsn = os.path.basename(pth)
try:
f_jsn = open(pth, 'r')
except FileNotFoundError:
print('Couldn\'t open ' + bsn + ': Not found')
exit(1)
... | import os
import sys
import json
import docker
import argparse
import importlib
import jsonschema
commands = {}
def main():
cli = docker.Client('unix://var/run/docker.sock')
p_src = os.path.dirname(os.path.abspath(__file__))
for file in os.listdir(os.path.join(p_src, 'commands')):
ext_file = os.... | mit | Python |
988f771c8de6c228773d0c3910c5e0488e8b9cf5 | Remove syncdb from deploy. | zsiciarz/variablestars.net,zsiciarz/variablestars.net,zsiciarz/variablestars.net | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
from contextlib import nested
from fabric.api import *
from fabric.contrib.project import rsync_project
def prepare_project():
u"""
Enters the directory and sources environment configuration.
I know ``nested`` is deprecated, but what a nice shortcut it is here ;)
"""
ret... | # -*- coding: utf-8 -*-
from contextlib import nested
from fabric.api import *
from fabric.contrib.project import rsync_project
def prepare_project():
u"""
Enters the directory and sources environment configuration.
I know ``nested`` is deprecated, but what a nice shortcut it is here ;)
"""
ret... | mit | Python |
c7870caa1c84c15a63f143de58e3da976e852ca8 | update production requirements | zhiwehu/zhiwehu,zhiwehu/zhiwehu,zhiwehu/zhiwehu,zhiwehu/zhiwehu,zhiwehu/zhiwehu | fabfile.py | fabfile.py | """
On local machine:
$ source env/bin/activate
$ fab deploy
"""
import time
from fabric.api import *
env.hosts = ['121.40.126.220']
env.user = 'ecs-user'
env.password = 'Bclt2014'
env.code_dir = '/home/ecs-user/zhiwehu'
env.project_div = '/home/ecs-user/zhiwehu'
env.virtualenv = '/home/ecs-user/env'
def pull():
... | """
On local machine:
$ source env/bin/activate
$ fab deploy
"""
import time
from fabric.api import *
env.hosts = ['121.40.126.220']
env.user = 'ecs-user'
env.password = 'Bclt2014'
env.code_dir = '/home/ecs-user/zhiwehu'
env.project_div = '/home/ecs-user/zhiwehu/zhiwehu'
env.virtualenv = '/home/ecs-user/env'
def p... | apache-2.0 | Python |
e520638bd1428db8fffa52a8530ea9201f4c4d3d | Exclude .git from rsync | microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb | fabfile.py | fabfile.py | import os
from fabric.api import env
from fabric.api import sudo
from fabric.api import prefix
from fabric.contrib.project import rsync_project
from fabric.context_managers import settings
from contextlib import contextmanager
env.hosts = []
env.serve_root = '/srv/www/django'
env.project_name = 'microweb'
env.virt... | import os
from fabric.api import env
from fabric.api import sudo
from fabric.api import prefix
from fabric.contrib.project import rsync_project
from fabric.context_managers import settings
from contextlib import contextmanager
env.hosts = []
env.serve_root = '/srv/www/django'
env.project_name = 'microweb'
env.virt... | agpl-3.0 | Python |
7a932bc6eb799dabe525e201fc0dc7b17f825e72 | add south to the installed apps | armstrong/armstrong.apps.related_content,texastribune/armstrong.apps.related_content,armstrong/armstrong.apps.related_content,texastribune/armstrong.apps.related_content | fabfile.py | fabfile.py | from armstrong.dev.tasks import *
import tempfile
settings = {
'DEBUG': True,
'INSTALLED_APPS': (
'django.contrib.contenttypes',
'armstrong.apps.related_content',
'armstrong.apps.related_content.tests.related_content_support',
'south',
),
'ROOT_URLCONF': 'armstrong.apps.... | from armstrong.dev.tasks import *
import tempfile
settings = {
'DEBUG': True,
'INSTALLED_APPS': (
'django.contrib.contenttypes',
'armstrong.apps.related_content',
'armstrong.apps.related_content.tests.related_content_support',
),
'ROOT_URLCONF': 'armstrong.apps.related_content.t... | apache-2.0 | Python |
3a84a8bb4a387003f5242b5d8c86d31d54781164 | fix hostname | clubadm/clubadm,clubadm/clubadm,clubadm/clubadm | fabfile.py | fabfile.py | from fabric.api import *
from fabric.contrib.project import rsync_project
env.user = 'root'
env.hosts = ['habra-adm.ru']
def pack():
local('python3 setup.py sdist --formats=gztar', capture=False)
def deploy():
dist = local('python3 setup.py --fullname', capture=True).strip()
put('dist/%s.tar.gz' % dis... | from fabric.api import *
from fabric.contrib.project import rsync_project
env.user = 'root'
env.hosts = ['dev3.habra-adm.ru']
def pack():
local('python3 setup.py sdist --formats=gztar', capture=False)
def deploy():
dist = local('python3 setup.py --fullname', capture=True).strip()
put('dist/%s.tar.gz' ... | mit | Python |
74b15428c0fdcac628776625477c8a57f62bac13 | update fabfile | alexpap/tpch-kit,alexpap/tpch-kit,alexpap/tpch-kit,alexpap/tpch-kit | fabfile.py | fabfile.py | from fabric.api import env, run, cd
tables_options = {
'lineitem' : 'L',
'customers' : 'c',
'nation' : 'n',
'orders' : 'O',
'parts' : 'P',
'region' : 'r',
'suppliers' : 's',
'partsupp' : 'S'
}
def dbgen(sf=1, table=" "):
if not table:
table = "-T {tbl_opt}".format(tbl_opt=ta... | from fabric.api import env, run, cd
tables_options = {
'lineitem' : 'L',
'customers' : 'c',
'nation' : 'n',
'orders' : 'O',
'parts' : 'P',
'region' : 'r',
'suppliers' : 's',
'partsupp' : 'S'
}
def dbgen(sf=1, table=" "):
if not table:
table = "-T {tbl_opt}".format(tbl_opt=ta... | mit | Python |
06d8a2bfe4e197db7aadd491a1f442e9a8405a70 | revise update_req command | zhy0216/pillar,zhy0216/pillar | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
import os
import logging
from fabric.api import local
from fabric.context_managers import lcd
_warn = logging.warn
CURRENT_PATH = os.path.join(os.getcwd(),os.path.dirname(__file__))
def cleaning():
"""Delete all pyc and *.orig files in project directories."""
local("find . -name '*.o... | # -*- coding: utf-8 -*-
import os
import logging
from fabric.api import local
from fabric.context_managers import lcd
_warn = logging.warn
CURRENT_PATH = os.path.join(os.getcwd(),os.path.dirname(__file__))
def cleaning():
"""Delete all pyc and *.orig files in project directories."""
local("find . -name '*.o... | mit | Python |
011d5d2c1455ffee3de55c320592a07260e6c414 | Remove __future__ imports | achabotl/pambox | general.py | general.py | import numpy as np
import scipy as sp
from scipy.signal import hilbert
def dbspl(x, ac=False):
"""RMS value of signal (in dB)
DBSPL(x) computes the SPL (sound pressure level) of the input signal
measured in dB, using the convention that a pure tone at 100 dB SPL has
an RMS value of 1.
DBSPL(x, a... | from __future__ import division
import numpy as np
import scipy as sp
from scipy.signal import hilbert
def dbspl(x, ac=False):
"""RMS value of signal (in dB)
DBSPL(x) computes the SPL (sound pressure level) of the input signal
measured in dB, using the convention that a pure tone at 100 dB SPL has
an... | bsd-3-clause | Python |
52260089a099d0fc7bce498001ef5d0a59d6e096 | Format proto files | tensorflow/hub,tensorflow/hub | tensorflow_hub/protos.bzl | tensorflow_hub/protos.bzl | # Copyright 2018 The TensorFlow Hub 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 app... | # Copyright 2018 The TensorFlow Hub 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 app... | apache-2.0 | Python |
557145b8e6991e45aa2b55cc5c6788cea996bce9 | Fix the ttp import. | chromakode/wake | filters.py | filters.py | from datetime import datetime
from ttp import Parser as TweetParser
def relative_time(timestamp):
delta = (datetime.now() - datetime.fromtimestamp(timestamp))
delta_s = delta.days * 86400 + delta.seconds
if delta_s < 60:
return "less than a minute ago"
elif delta_s < 120:
return "about... | from datetime import datetime
from ttp.ttp import Parser as TweetParser
def relative_time(timestamp):
delta = (datetime.now() - datetime.fromtimestamp(timestamp))
delta_s = delta.days * 86400 + delta.seconds
if delta_s < 60:
return "less than a minute ago"
elif delta_s < 120:
return "a... | bsd-3-clause | Python |
c243199c3d4c12f3be785084e8c2113c39258de9 | Format output, handle bz2 files in denylog.py. | rsmith-nl/scripts,rsmith-nl/scripts | denylog.py | denylog.py | # file: denylog.py
# vim:fileencoding=utf-8:ft=python
#
# Author: R.F. Smith <rsmith@xs4all.nl>
# Created: 2015-09-03 03:04:01 +0200
# Last modified: 2015-09-05 00:46:50 +0200
"""Summarize the deny log messages from ipfw in /var/log/security"""
import argparse
import bz2
import logging
import re
import sys
__version... | # file: denylog.py
# vim:fileencoding=utf-8:ft=python
#
# Author: R.F. Smith <rsmith@xs4all.nl>
# Created: 2015-09-03 03:04:01 +0200
# Last modified: 2015-09-03 08:47:08 +0200
"""Summarize the deny log messages from ipfw in /var/log/security"""
import argparse
import logging
import sys
import re
__version__ = '0.0.1... | mit | Python |
47438d247c8ba1c26e70c0209f3602d71333659e | CLEAN enconding | ograndedjogo/tab-translator,ograndedjogo/tab-translator | tabtranslator/model.py | tabtranslator/model.py | # coding: utf-8
class Sheet(object):
""" sheet: Top level object.
Models the entire music sheet """
def __init__(self, name):
super(sheet, self).__init__()
self.name = name
self.bars = list()
class Bar(object):
""" bar: Models a measure.
Compose the sheet as the temporal layer
=> Where the notes are d... | class Sheet(object):
""" sheet: Top level object.
Models the entire music sheet """
def __init__(self, name):
super(sheet, self).__init__()
self.name = name
self.bars = list()
class Bar(object):
""" bar: Models a measure.
Compose the sheet as the temporal layer
=> Where the notes are displayed on the s... | mit | Python |
4e0b5c4ff6f31e0ad2ac8de66f4019c4ac622305 | fix desktop script | mlcdf/dotfiles,mlcdf/dotfiles,mlcdf/dotfiles | desktop.py | desktop.py | #
# This script is indented to be run after every changes. Therefore below commands
# should be idempotent.
#
from __future__ import annotations
import os
import platform
import shutil
import sys
import winreg
from typing import Any, List
if platform.system().lower() != "windows":
print("Are you okay?")
sys.ex... | #
# This script is indented to be run after every changes. Therefore below commands
# should be idempotent.
#
import os
import platform
import shutil
import sys
import winreg
from typing import Any, List
if platform.system().lower() != "windows":
print("Are you okay?")
sys.exit(1)
class RegistryHKEY:
de... | mit | Python |
a440ea14d1dabb18aae7d8c7e0b6433dd57866f8 | Set default label color to black | gizmo-cda/g2x,thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x | overlay/Label.py | overlay/Label.py | from SVGGenerator import SVGGenerator
class Label(SVGGenerator):
def __init__(self, x, y, text):
SVGGenerator.__init__(self, './label.svg.mustache')
self.x = x
self.y = y
self.text = text
self.alignment = "start"
self.font_size = 14
self.color = "rgb(0,0,0)"... | from SVGGenerator import SVGGenerator
class Label(SVGGenerator):
def __init__(self, x, y, text):
SVGGenerator.__init__(self, './label.svg.mustache')
self.x = x
self.y = y
self.text = text
self.alignment = "start"
self.font_size = 12
self.color = "rgb(64,64,6... | mit | Python |
685eb37fb5d09a65a73a8a0aa3bca1cab3609e76 | Update brain.py | kankiri/pabiana | pabiana/brain.py | pabiana/brain.py | import importlib
import os
from os import path
import pip
from . import load_interfaces, repo
def main(module_name, area_name):
req_path = path.join(os.getcwd(), module_name, 'requirements.txt')
if path.isfile(req_path):
pip.main(['install', '--upgrade', '-r', req_path])
intf_path = path.join(os.... | import importlib
import os
from os import path
import pip
from . import load_interfaces, repo
def main(module_name, area_name):
req_path = path.join(os.getcwd(), module_name, 'requirements.txt')
if path.isfile(req_path):
pip.main(['install', '--upgrade', '-r', req_path])
intf_path = path.join(os.... | mit | Python |
8e8143b3e7f3e35f0fcb6b51936d8d73592d255a | Build mono 2.10.8.1 in bockbuild | bl8/bockbuild,bl8/bockbuild,bl8/bockbuild,mono/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild | packages/mono.py | packages/mono.py | class MonoPackage (Package):
def __init__ (self):
Package.__init__ (self, 'mono', '2.10.8.1',
sources = [
'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.gz',
'patches/mono-gtk-sharp-profiler.patch'
],
configure_flags = [
'--with-jit=yes',
'--with-ikvm=no',
'--wi... | class MonoPackage (Package):
def __init__ (self):
Package.__init__ (self, 'mono', '2.10.6',
sources = [
'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2',
'patches/mono-gtk-sharp-profiler.patch'
],
configure_flags = [
'--with-jit=yes',
'--with-ikvm=no',
'--wit... | mit | Python |
16a8b27c41b9b596b77c5827538783d336d3f6a5 | update redshift table creation | UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario | plenario/sensor_network/redshift_ops.py | plenario/sensor_network/redshift_ops.py | import os, sys
sys.path.insert(0, os.path.abspath('../..'))
from sqlalchemy import text
from sqlalchemy.exc import ProgrammingError
from plenario.database import redshift_engine
def create_foi_table(foi_name, properties):
"""Create a new foi table
:param foi_name: name of feature
:param propertie... | import os, sys
sys.path.insert(0, os.path.abspath('../..'))
from sqlalchemy import text
from sqlalchemy.exc import ProgrammingError
from plenario.database import redshift_engine
def create_foi_table(foi_name, properties):
"""Create a new foi table
:param foi_name: name of feature
:param propertie... | mit | Python |
f0137c3857ecc1dcc2c87df507e691828e2401b3 | Add request_patch schema | ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata | ckanext/requestdata/logic/schema.py | ckanext/requestdata/logic/schema.py | from ckan.plugins import toolkit
from ckanext.requestdata.logic import validators
not_missing = toolkit.get_validator('not_missing')
not_empty = toolkit.get_validator('not_empty')
package_id_exists = toolkit.get_validator('package_id_exists')
email_validator = validators.email_validator
state_validator = validators.... | from ckan.plugins import toolkit
from ckanext.requestdata.logic import validators
not_missing = toolkit.get_validator('not_missing')
not_empty = toolkit.get_validator('not_empty')
package_id_exists = toolkit.get_validator('package_id_exists')
email_validator = validators.email_validator
def request_create_schema()... | agpl-3.0 | Python |
5b2a7d2ee9ce2023beac1e5ca58b700ad1f9b803 | Use HTTPS instead of HTTP in submit-cert.py, add more CT logs | tomrittervg/ct-tools,tomrittervg/ct-tools | submit-cert.py | submit-cert.py | #!/usr/bin/env python
import json
import argparse
import requests
LOGS = {
'Google \'Pilot\' log' : 'https://ct.googleapis.com/pilot',
'Google \'Aviator\' log' : 'https://ct.googleapis.com/aviator',
'Google \'Rocketeer\' log' : 'https://ct.googleapis.com/rocketeer',
'Certly Log Server' : 'https://log.certly.io',... | #!/usr/bin/env python
import json
import argparse
import requests
LOGS = {
'aviator' : "http://ct.googleapis.com/aviator",
'pilot' : "http://ct.googleapis.com/pilot",
'rocketeer' : "http://ct.googleapis.com/rocketeer",
"digicert" : "http://ct1.digicert-ct.com/log",
"izenpen" :"http://ct.izenpe.com",
"certly" :... | bsd-3-clause | Python |
8bf0e5319e7821511807b555bb471aff2537da5b | check postgresql xmin on given database | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | nagios/check_pgsql_xmin.py | nagios/check_pgsql_xmin.py | """
Return the maximum xmin in the database, having too large of a value leads to
bad things and eventual database not accepting new writes. I had to lower
the default postgresql setting from 200 mil to 180 mil as the database does
lots of writes and autovac sometimes can not keep up.
"""
from __future__ impor... | """
Return the maximum xmin in the database, having too large of a value leads to
bad things and eventual database not accepting new writes. I had to lower
the default postgresql setting from 200 mil to 180 mil as the database does
lots of writes and autovac sometimes can not keep up.
"""
from __future__ impor... | mit | Python |
167707b36f848b99369164890de0a6fd932c31e6 | Use what we learnt from cali | holizz/hotpotato | hp.py | hp.py | #!/usr/bin/python
import ast
class HotPotato:
class Actions:
def __init__(self, hp):
self.hp = hp
def Module(self, a):
return '\n'.join([self.hp._php(b) for b in a.body])
def Assign(self, a):
return self.hp._php(a.targets[0]) + ' = ' + self.hp._php(a.v... | #!/usr/bin/python
import ast
class HotPotato:
def __init__(self, fn):
self.ast = compile(open(fn).read(),
fn,
'exec',
ast.PyCF_ONLY_AST)
def php(self):
return '<?php\n'+self._php(self.ast)
def _php(self, a):
c = a.__class__
... | isc | Python |
b9807a4428470f0a3c27078c408597c9298134a4 | add test_argparse_directory | nikken1/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor | test/test_parse_config.py | test/test_parse_config.py | #!/usr/bin/env python
import unittest
import os
import logging
import sys
# Setup test files and logs
dir = os.path.dirname(__file__)
log_file = os.path.join(dir, 'unittest/unit-test.log')
# Logging setup
logging.basicConfig(filename=log_file, level=logging.DEBUG)
class TestPatentConfig(unittest.TestCase):
# M... | #!/usr/bin/env python
import unittest
import os
import logging
import sys
# Setup test files and logs
dir = os.path.dirname(__file__)
log_file = os.path.join(dir, 'unittest/unit-test.log')
# Logging setup
logging.basicConfig(filename=log_file, level=logging.DEBUG)
class TestPatentConfig(unittest.TestCase):
# M... | bsd-2-clause | Python |
8626872740ec2912f872b38160daa8e740a2a2ff | Bump version to 2.1.1-dev for development. | wardi/urwid,inducer/urwid,inducer/urwid,urwid/urwid,wardi/urwid,wardi/urwid,inducer/urwid,urwid/urwid,urwid/urwid | urwid/version.py | urwid/version.py | from __future__ import division, print_function
VERSION = (2, 1, 1, 'dev')
__version__ = ''.join(['-.'[type(x) == int]+str(x) for x in VERSION])[1:]
| from __future__ import division, print_function
VERSION = (2, 1, 0)
__version__ = ''.join(['-.'[type(x) == int]+str(x) for x in VERSION])[1:]
| lgpl-2.1 | Python |
c89ffeb8b18016bcee399883408fa4d4a44c7ee4 | use kwargs | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/callcenter/tests/test_datasources.py | corehq/apps/callcenter/tests/test_datasources.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.test.testcases import SimpleTestCase
from mock import patch
from corehq.apps.callcenter.data_source import call_center_data_source_configuration_provider
from corehq.apps.callcenter.utils import DomainLite
from corehq.util.test... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.test.testcases import SimpleTestCase
from mock import patch
from corehq.apps.callcenter.data_source import call_center_data_source_configuration_provider
from corehq.apps.callcenter.utils import DomainLite
from corehq.util.test... | bsd-3-clause | Python |
b83f947c17952c6caf19ba4d8d14d6abe67588e0 | Fix doc for me.py | studyindenmark/newscontrol,studyindenmark/newscontrol,youtify/newscontrol,youtify/newscontrol | me.py | me.py | import webapp2
import json
from google.appengine.api import users
from google.appengine.ext.webapp import util
import utils
class MeHandler(webapp2.RequestHandler):
def get(self):
""" Return info about current logged in user
Automatically create internal user models for admin google user... | import webapp2
import json
from google.appengine.api import users
from google.appengine.ext.webapp import util
import utils
class MeHandler(webapp2.RequestHandler):
def get(self):
"""Redirect to a URL with a Google sign in form"""
user = utils.get_current_user()
if not user:
... | mit | Python |
1269219c13913bcabd0d01c87c704490394995ec | encrypt file numbers | henryfox/encryption | encrypt.py | encrypt.py | from __future__ import division
import sys
from rand import rand
import math
alphabet = ["a", "b", "c", "d","e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "... | from __future__ import division
import sys
from rand import rand
import math
alphabet = ["a", "b", "c", "d","e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "... | mit | Python |
582811074db86be964648dc9457855db3549a2b5 | Test for DSU on Python | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | data_structures/Disjoint_Set_Union/Python/dsu.py | data_structures/Disjoint_Set_Union/Python/dsu.py |
parent=[]
size=[]
def initialize(n):
for i in range(0,n+1):
parent.append(i)
size.append(1)
def find(x):
if parent[x] == x:
return x
else:
return find(parent[x])
def join(a,b):
p_a = find(a)
p_b = find(b)
if p_a != p_b:
if size[p_a] < size[p_b]:
parent[p_a] = p_b
size[p_b] += size[p_a]
els... |
parent=[]
size=[]
def initialize(n):
for i in range(0,n+1):
parent.append(i)
size.append(1)
def find(x):
if parent[x] == x:
return x
else:
return find(parent[x])
def join(a,b):
p_a = find(a)
p_b = find(b)
if p_a != p_b:
if size[p_a] < size[p_b]:
parent[p_a] = p_b
size[p_b] += size[p_a]
els... | cc0-1.0 | Python |
f0564654cfab603b042b03db5aa1bd48f358d847 | Move the logging handler hack after the last use of subprocess2 before options are parsed and logging is properly configured with basicConfig. This re-enables git try --verbose/--dry_run. | svn2github/chromium-depot-tools,svn2github/chromium-depot-tools,svn2github/chromium-depot-tools | git_try.py | git_try.py | #!/usr/bin/python
# Copyright (c) 2011 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.
"""Wrapper for trychange.py for git checkout."""
import logging
import sys
import breakpad # pylint: disable=W0611
from scm import G... | #!/usr/bin/python
# Copyright (c) 2011 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.
"""Wrapper for trychange.py for git checkout."""
import logging
import sys
import breakpad # pylint: disable=W0611
from scm import G... | bsd-3-clause | Python |
049a01d148c757a17e9804a2b1e42c918e29b094 | Add another test for break-from-for-loop. | neilh10/micropython,galenhz/micropython,heisewangluo/micropython,heisewangluo/micropython,ruffy91/micropython,mgyenik/micropython,ericsnowcurrently/micropython,cnoviello/micropython,lbattraw/micropython,lbattraw/micropython,hosaka/micropython,EcmaXp/micropython,alex-march/micropython,Timmenem/micropython,cwyark/micropy... | tests/basics/for_break.py | tests/basics/for_break.py | # Testcase for break in a for [within bunch of other code]
# https://github.com/micropython/micropython/issues/635
def foo():
seq = [1, 2, 3]
v = 100
i = 5
while i > 0:
print(i)
for a in seq:
if a == 2:
break
i -= 1
foo()
# break from within nested ... | # Testcase for break in a for [within bunch of other code]
# https://github.com/micropython/micropython/issues/635
def foo():
seq = [1, 2, 3]
v = 100
i = 5
while i > 0:
print(i)
for a in seq:
if a == 2:
break
i -= 1
foo()
| mit | Python |
7c1fdc8eed29569441be7cd21ae3a152f9364771 | add post form | thebitstick/Flask-Blog,thebitstick/Flask-Blog | app/forms.py | app/forms.py | from flask.ext.login import current_user
from flask.ext.wtf import Form, TextField, TextAreaField, validators, \
BooleanField, PasswordField, SubmitField
from app.helpers import is_name
from app.models import User
class PostForm(Form):
title = TextField('Title', [
validators.Required(),
valid... | from flask.ext.login import current_user
from flask.ext.wtf import Form, TextField, TextAreaField, validators, \
BooleanField, PasswordField, SubmitField
from app.helpers import is_name
from app.models import User
class LoginForm(Form):
username = TextField('Username', [
validators.Required(),
... | mit | Python |
643d599c9c6156d3c1ef1651880c9b3baa46391e | move some unused helper files to examples | nschloe/maelstrom,nschloe/maelstrom | maelstrom/helpers.py | maelstrom/helpers.py | # -*- coding: utf-8 -*-
#
from dolfin import DirichletBC, assemble, dx
def dbcs_to_productspace(W, bcs_list):
new_bcs = []
for k, bcs in enumerate(bcs_list):
for bc in bcs:
C = bc.function_space().component()
# pylint: disable=len-as-condition
if len(C) == 0:
... | # -*- coding: utf-8 -*-
#
from dolfin import (
as_backend_type, DirichletBC, assemble, dx
)
import matplotlib.pyplot as plt
import scipy.linalg
def show_matrix(A):
A = as_backend_type(A)
A_matrix = A.sparray()
# colormap
cmap = plt.cm.gray_r
A_dense = A_matrix.todense()
# A_r ... | mit | Python |
9cb9d156e3d45a4d73b9675d2367ffe23f31299b | Complete decoder/encoder of huffman code. | hane1818/Algorithm_HW3_huffman_code | huffman.py | huffman.py | import sys
from operator import attrgetter
class Node:
def __init__(self):
self.name = ''
self.weight = 0
self.code = ''
def initSet(self, name, weight):
self.name = name
self.weight = weight
def setRoot(self, root):
self.root = root
def setLeft(self... | import sys
from operator import attrgetter
class Node:
def __init__(self):
self.name = ''
self.weight = 0
self.code = ''
def initSet(self, name, weight):
self.name = name
self.weight = weight
def setRoot(self, root):
self.root = root
def setLeft(self... | mit | Python |
a35c432671143cff2a6d5d1006aa4d351fe6c200 | fix ident | frioux/offlineimap,frioux/offlineimap | offlineimap/utils/const.py | offlineimap/utils/const.py | # Copyright (C) 2013-2014 Eygene A. Ryabinkin and contributors
#
# Collection of classes that implement const-like behaviour
# for various objects.
import copy
class ConstProxy(object):
"""Implements read-only access to a given object
that can be attached to each instance only once."""
def __init__(self)... | # Copyright 2013 Eygene A. Ryabinkin.
#
# Collection of classes that implement const-like behaviour
# for various objects.
import copy
class ConstProxy (object):
"""
Implements read-only access to a given object
that can be attached to each instance only once.
"""
def __init__ (self):
self.__dict__['__source... | apache-2.0 | Python |
cfe78ea19592443833a802ca3923ce7634b6583e | Make sure libhoney.close() gets called in the event of a SIGINT/SIGTERM | honeycombio/libhoney-py,honeycombio/libhoney-py | example.py | example.py | '''This example shows how to use some of the features of libhoney in python'''
import libhoney
import signal
import threading
writekey = "abcabc123123defdef456456"
dataset = "factorial"
def factorial(n):
if n < 0:
return -1 * factorial(abs(n))
if n == 0:
return 1
return n * factorial(n -... | '''This example shows how to use some of the features of libhoney in python'''
import libhoney
import threading
writekey = "abcabc123123defdef456456"
dataset = "factorial"
def factorial(n):
if n < 0:
return -1 * factorial(abs(n))
if n == 0:
return 1
return n * factorial(n - 1)
def num_... | apache-2.0 | Python |
74b8471c9742cfe8506d8741ac9d2bfd4d3838cd | fix example | tagucci/pythonrouge,tagucci/pythonrouge | example.py | example.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from pythonrouge import pythonrouge
if __name__ == '__main__':
peer = " Tokyo is the one of the biggest city in the world."
model = "The capital of Japan, Tokyo, is the center of Japanese economy."
print("Peer summary: ", peer)
pr... | # -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from pythonrouge import pythonrouge
if __name__ == '__main__':
peer = " Tokyo is the one of the biggest city in the world."
model = "The capital of Japan, Tokyo, is the center of Japanese economy."
print("Peer summary: ", peer)
pr... | mit | Python |
a39845f614509a201a767e25696c4a6376fde478 | fix unit tests | lucianopuccio/golem,lucianopuccio/golem,lucianopuccio/golem | tests/helper_functions.py | tests/helper_functions.py | import random
import os
import string
from subprocess import call
import subprocess
def random_string(length, prefix=''):
random_str = ''.join(random.choice(string.ascii_lowercase) for _ in range(length))
return prefix + random_str
def create_project(workspace, name):
os.chdir(workspace)
call(['golem', 'c... | import random
import os
import string
from subprocess import call
import subprocess
def random_string(length, prefix=''):
random_str = ''.join(random.choice(string.ascii_lowercase) for _ in range(length))
return prefix + random_str
def create_project(workspace, name):
os.chdir(workspace)
call(['golem', 'c... | mit | Python |
46b2c7af08af5873269ced3bc21cd900bc4ec3c2 | Fix the Fabfile to use the shell configuration. | Gisleude/speakerfight,mauricioabreu/speakerfight,gustavopxavier/speakerfight,otaviomorcegao/speakerfight,wagnerjs/speakerfight,Thalesgm/speakerfight,estheraragaos/speakerfight,SaraMaria/speakerfight,Biramon/speakerfight,Biramon/speakerfight,luanfonceca/speakerfight,SaraMaria/speakerfight,wagnerluis1982/speakerfight,fel... | fabfile.py | fabfile.py | # coding: utf-8
from os import environ
from fabric.api import env, cd, local
from fabric.colors import yellow, green
REPOSITORY = 'git@github.com:luanfonceca/speakerfight.git'
REMOTE = 'origin'
BRANCH = 'master'
env.hosts = ['speakerfight.com']
env.user = 'root'
env.password = environ.get('PASSWORD')
env.shell = '/b... | # coding: utf-8
from os import environ
from fabric.api import env, cd, local
from fabric.colors import yellow, green
REPOSITORY = 'git@github.com:luanfonceca/speakerfight.git'
REMOTE = 'origin'
BRANCH = 'master'
env.hosts = ['speakerfight.com']
env.user = 'root'
env.password = environ.get('PASSWORD')
env.app_dir = '... | mit | Python |
bc966dbda012c3b83e7ddd3eccc953c53321d561 | update fabfile | sdutlinux/pahchina,sdutlinux/pahchina,sdutlinux/pahchina,sdutlinux/pahchina | fabfile.py | fabfile.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from fabric.colors import green, red
from fabric.contrib.console import confirm
from fabric.api import run, env, cd, put, sudo, abort
# configs
env.user = 'group'
env.hosts = ['210.44.176.241:2722',]
## project home path
PROJECT_HOME = '/home/group/pahchina'
## project na... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from fabric.api import run, env, cd, put, sudo, abort, roles
from fabric.colors import green, red, yellow
from fabric.contrib.console import confirm
env.user = 'group'
#env.hosts = ['210.44.176.241:2722',]
env.roledefs = {
'py-ubuntu': ['210.44.176.241:2722']
... | mit | Python |
bff1444b6649a28d7219ab26795b3d49e1ad2ab9 | Remove unnecessary apps | armstrong/armstrong.apps.images,armstrong/armstrong.apps.images,armstrong/armstrong.apps.images | fabfile.py | fabfile.py | import os.path
from armstrong.dev.tasks import *
settings = {
'DEBUG': True,
'INSTALLED_APPS': (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
... | import os.path
from armstrong.dev.tasks import *
settings = {
'DEBUG': True,
'INSTALLED_APPS': (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
... | apache-2.0 | Python |
bac554115a47872a2971b20e0010ff35c90d85b1 | Use lcd to change local CWD. | erochest/whatisdh,erochest/whatisdh | fabfile.py | fabfile.py |
from fabric.api import cd, env, lcd, local, prefix, run, task
env.hosts = ['haskell-build.dev']
env.user = 'vagrant'
env.password = 'vagrant'
# Main Tasks
@task
def vagrant_up():
with lcd('~/p/haskell-build/'):
local('vagrant up')
@task
def init():
with cd('~'):
run('git clone ssh://err... |
from fabric.api import cd, env, local, prefix, run, task
env.hosts = ['haskell-build.dev']
env.user = 'vagrant'
env.password = 'vagrant'
# Main Tasks
@task
def vagrant_up():
local('pushd ~/p/haskell-build/ ; vagrant up ; popd')
@task
def init():
with cd('~'):
run('git clone ssh://err8n@host.dev... | bsd-2-clause | Python |
4379236dc37db2d6c95e4f04ca13568eb6b34831 | Add index management commands to fabfile | konklone/oversight.io,konklone/oversight.io,konklone/oversight.io,konklone/oversight.io | fabfile.py | fabfile.py | import time
from fabric.api import run, execute, env
environment = "production"
env.use_ssh_config = True
env.hosts = ["unitedstates"]
branch = "master"
repo = "git@github.com:konklone/oversight.git"
username = "unitedstates"
home = "/home/unitedstates/oversight"
logs = "/home/unitedstates/oversight"
shared_path = ... | import time
from fabric.api import run, execute, env
environment = "production"
env.use_ssh_config = True
env.hosts = ["unitedstates"]
branch = "master"
repo = "git@github.com:konklone/oversight.git"
username = "unitedstates"
home = "/home/unitedstates/oversight"
logs = "/home/unitedstates/oversight"
shared_path = ... | cc0-1.0 | Python |
23f73efb30d0b859e599836eac93468aea8352fe | clean deve fazer reload no nginx | devincachu/devincachu-2013,devincachu/devincachu-2013,devincachu/devincachu-2014,devincachu/devincachu-2013,devincachu/devincachu-2013,devincachu/devincachu-2014,devincachu/devincachu-2014 | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
import os
from fabric.api import cd, env, run, settings
env.root = os.path.dirname(__file__)
env.app = os.path.join(env.root, 'devincachu')
env.base_dir = '/usr/home/devincachu'
env.project_root = os.path.join(env.base_dir, 'devincachu')
env.app_root = os.path.join(env.project_root, 'devincach... | # -*- coding: utf-8 -*-
import os
from fabric.api import cd, env, run, settings
env.root = os.path.dirname(__file__)
env.app = os.path.join(env.root, 'devincachu')
env.base_dir = '/usr/home/devincachu'
env.project_root = os.path.join(env.base_dir, 'devincachu')
env.app_root = os.path.join(env.project_root, 'devincach... | bsd-2-clause | Python |
76021b530cab0f5b48d596b7e422db552ad3a95d | Deploy to plot.prezi.com | prezi/plotserver,UIKit0/plotserver,UIKit0/plotserver,UIKit0/plotserver,prezi/plotserver | fabfile.py | fabfile.py | import os
from fabric.api import env, local, run, cd, put, path
from fabric.decorators import runs_once
APP_DIR = "/usr/local/plotserver"
env.forward_agent = True
env.user = "publisher"
env.roledefs = {"plot": ["plot.prezi.com"], "stage": [], "local": []}
env.abort_on_prompts = True
def _gitpull():
# runs on ... | import os
from fabric.api import env, local, run, cd, put, path
from fabric.decorators import runs_once
APP_DIR = "/opt/prezi/plotserver"
env.forward_agent = True
env.user = "publisher"
env.roledefs = {"oam3": ["oam3.us.prezi.private"], "stage": [], "local": []}
env.abort_on_prompts = True
def _gitpull():
# r... | mit | Python |
7a3bb185fc088bc6f4548b0564052e8876272767 | Fix version file output in fabfile | OAButton/OAButton_old,OAButton/OAButton_old,OAButton/OAButton_old | fabfile.py | fabfile.py | """
The easy button for deployment
Add your SSH key :
$ ssh-add ~/.ssh/oabutton.pem
Identity added: /Users/victorng/.ssh/oabutton.pem (/Users/victorng/.ssh/oabutton.pem)
# Run prepare_deploy:
$ fab prepare_deploy
# Run deploy:
$ fab -H ubuntu@staging.openaccessbutton.org deploy
"""
from fabric.ap... | """
The easy button for deployment
Add your SSH key :
$ ssh-add ~/.ssh/oabutton.pem
Identity added: /Users/victorng/.ssh/oabutton.pem (/Users/victorng/.ssh/oabutton.pem)
# Run prepare_deploy:
$ fab prepare_deploy
# Run deploy:
$ fab -H ubuntu@staging.openaccessbutton.org deploy
"""
from fabric.ap... | mit | Python |
9a8f27fb6b3cec373d841b0973ee59f2ddd0b875 | Use sudo() function for db migration call | RBE-Avionik/skylines,shadowoneau/skylines,RBE-Avionik/skylines,Harry-R/skylines,Turbo87/skylines,Harry-R/skylines,skylines-project/skylines,TobiasLohner/SkyLines,shadowoneau/skylines,RBE-Avionik/skylines,kerel-fs/skylines,kerel-fs/skylines,snip/skylines,skylines-project/skylines,shadowoneau/skylines,Harry-R/skylines,sh... | fabfile.py | fabfile.py | from fabric.api import env, local, cd, run, settings, sudo
env.use_ssh_config = True
env.hosts = ['root@skylines']
def deploy(branch='master', force=False):
push(branch, force)
restart()
def push(branch='master', force=False):
cmd = 'git push %s:/opt/skylines/src/ %s:master' % (env.host_string, branch)... | from fabric.api import env, local, cd, run
env.use_ssh_config = True
env.hosts = ['root@skylines']
def deploy(branch='master', force=False):
push(branch, force)
restart()
def push(branch='master', force=False):
cmd = 'git push %s:/opt/skylines/src/ %s:master' % (env.host_string, branch)
if force:
... | agpl-3.0 | Python |
ea29cd18d3ba87449be1bc559991236ae94b3bc7 | Add pillow, sklearn and tensorflow to requirements | tokee/juxta,tokee/juxta,tokee/juxta | gridify.py | gridify.py | # Prerequisites
#git clone git@github.com:ml4a/ml4a-ofx.git
#cd mla-ofx
#pip3 install pillow
#pip3 install sklearn
#pip3 install tensorflow
#pip3 install keras
#pip3 install numpy
#pip3 install prime
# https://github.com/Quasimondo/RasterFairy
#pip3 install rasterfairy
# Run instructions
# put 300+ images in the fold... | # Prerequisites
#git clone git@github.com:ml4a/ml4a-ofx.git
#cd mla-ofx
#pip3 install keras
#pip3 install numpy
#pip3 install prime
# https://github.com/Quasimondo/RasterFairy
#pip3 install rasterfairy
# Run instructions
# put 300+ images in the folder 'images'
#python3 .scripts/tSNE-images.py --images_path images --... | apache-2.0 | Python |
2eb21c6689843ada75f36da70fc9ea63aae113ed | Add load_image/save_image to nipy namespace. Cleanup namespace a little. | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | nipy/__init__.py | nipy/__init__.py | # -*- coding: utf-8 -*-
"""
Neuroimaging tools for Python (NIPY).
The aim of NIPY is to produce a platform-independent Python environment for
the analysis of brain imaging data using an open development model.
While
the project is still in its initial stages, packages for file I/O, script
support as well as single su... | # -*- coding: utf-8 -*-
"""
Neuroimaging tools for Python (NIPY).
The aim of NIPY is to produce a platform-independent Python environment for
the analysis of brain imaging data using an open development model.
While
the project is still in its initial stages, packages for file I/O, script
support as well as single su... | bsd-3-clause | Python |
f2660a5d6370885bd3fbd6e3330454df2cbe1d26 | Remove tests for unsupported features | mbr/simplekv,mbr/simplekv | tests/test_boto3_store.py | tests/test_boto3_store.py | #!/usr/bin/env python
import os
import pytest
boto3 = pytest.importorskip('boto3')
from simplekv.net.boto3store import Boto3Store
from basic_store import BasicStore
from bucket_manager import boto_credentials, boto3_bucket
from conftest import ExtendedKeyspaceTests
from simplekv.contrib import ExtendedKeyspaceMixin... | #!/usr/bin/env python
import os
import pytest
boto3 = pytest.importorskip('boto3')
from simplekv.net.boto3store import Boto3Store
from simplekv._compat import BytesIO
from basic_store import BasicStore
from url_store import UrlStore
from bucket_manager import boto_credentials, boto3_bucket
from conftest import Exte... | mit | Python |
5b27592eed1955ea37f0c928e1421cb2565246fc | Improve nova.rpc conf options documentation | Juniper/nova,alaski/nova,klmitch/nova,sebrandon1/nova,klmitch/nova,mahak/nova,jianghuaw/nova,mikalstill/nova,rahulunair/nova,mahak/nova,Juniper/nova,cloudbase/nova,vmturbo/nova,vmturbo/nova,hanlind/nova,klmitch/nova,Juniper/nova,hanlind/nova,mikalstill/nova,mikalstill/nova,cloudbase/nova,hanlind/nova,rahulunair/nova,ra... | nova/conf/rpc.py | nova/conf/rpc.py | # Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | # Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | apache-2.0 | Python |
3aee1fc7081b760271d01b03606f59daa26afea5 | Update test_mppcommands.py | jblance/mpp-solar | tests/test_mppcommands.py | tests/test_mppcommands.py | import unittest
import mppsolar
class test_mppcommands(unittest.TestCase):
def testOne(self):
mp = mppsolar.mpputils.mppUtils('/dev/ttyUSB0')
mp.getKnownCommands()
return True
| import unittest
from .mppsolar import mpputils
class test_mppcommands(unittest.TestCase):
def testOne(self):
mp = mpputils.mppUtils('/dev/ttyUSB0')
mp.getKnownCommands()
return True
| mit | Python |
2f505b14b30e49d569d65e7440ea791dab1c8439 | remove unneeded tests | dmr/Ldtools | tests/test_recrawl_url.py | tests/test_recrawl_url.py | from nose.plugins.attrib import attr
import unittest2
import ldtools
import rdflib
from rdflib import compare
import datetime
cnt = lambda: (len(ldtools.Origin.objects.all()),
len(ldtools.Resource.objects.all()))
class GraphHandlerTestCase(unittest2.TestCase):
def _setUpScenario(self):
ld... | from nose.plugins.attrib import attr
import unittest2
import ldtools
import rdflib
from rdflib import compare
import datetime
cnt = lambda: (len(ldtools.Origin.objects.all()),
len(ldtools.Resource.objects.all()))
class GraphHandlerTestCase(unittest2.TestCase):
def _setUpScenario(self):
ld... | bsd-2-clause | Python |
66d7e7dc0bb717d175394d8582392dca2fc969d3 | Add tests | wind-python/windpowerlib | tests/test_wake_losses.py | tests/test_wake_losses.py | import pandas as pd
import numpy as np
import pytest
from pandas.util.testing import assert_series_equal
from windpowerlib.wake_losses import (reduce_wind_speed,
get_wind_efficiency_curve)
class TestWakeLosses:
def test_reduce_wind_speed(self):
parameters = {'wind_... | import pandas as pd
import numpy as np
import pytest
from pandas.util.testing import assert_series_equal
from windpowerlib.wake_losses import reduce_wind_speed
import windpowerlib.wind_turbine as wt
class TestWakeLosses:
def test_reduce_wind_speed(self):
parameters = {'wind_speed': pd.Series(np.arange(0... | mit | Python |
63d250d89dca72d91ad4470ba2af22b326d15454 | Use repr() instead of str() for printing | kaichogami/sympy_gamma,kaichogami/sympy_gamma,iScienceLuvr/sympy_gamma,iScienceLuvr/sympy_gamma,debugger22/sympy_gamma,debugger22/sympy_gamma,bolshoibooze/sympy_gamma,github4ry/sympy_gamma,bolshoibooze/sympy_gamma,kaichogami/sympy_gamma,iScienceLuvr/sympy_gamma,github4ry/sympy_gamma,bolshoibooze/sympy_gamma,github4ry/s... | app/utils.py | app/utils.py | import traceback
import sys
import logging
# always print stuff on the screen:
logging.basicConfig(level=logging.INFO)
def log_exception(func):
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except:
logging.info("Exception raised")
etype, value,... | import traceback
import sys
import logging
# always print stuff on the screen:
logging.basicConfig(level=logging.INFO)
def log_exception(func):
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except:
logging.info("Exception raised")
etype, value,... | bsd-3-clause | Python |
9e6f445efc635fd0475a88e2709a083e305c6280 | add geocoder api caller | spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire | baidu_API.py | baidu_API.py | """
A simple script that uses Baidu Place API to search certain kinds of place
in a range of circular space.
This API can be called maximum 2000 times per day.
"""
import requests, json
# import psycopg2
mykey = "IniXfqhsWAyZQpkmh5FtEVv0" # my developer key
city = "韶关"
place = "公园"
coor1 = (39.915, 116.404)
coor2 = ... | """
A simple script that uses Baidu Place API to search certain kinds of place
in a range of circular space.
This API can be called maximum 2000 times per day.
"""
import requests, json
import psycopg2
mykey = "IniXfqhsWAyZQpkmh5FtEVv0" # my developer key
city = "韶关"
place = "公园"
coor1 = (39.915, 116.404)
coor2 = (3... | apache-2.0 | Python |
1933cb01f39e168f12cab331f64c2dce283c358e | Bump version; 0.10.0.dev0 [ci skip] | treasure-data/td-client-python | tdclient/version.py | tdclient/version.py | __version__ = "0.10.0.dev0"
| __version__ = "0.9.0"
| apache-2.0 | Python |
1f863b45e6e3fd5491a59d3d522ddd7ca5a5bfbd | Fix RDID reading code to ignore leading space | stevenmirabito/DrinkTouchClient-2.0,harlanhaskins/DrinkTouchClient-2.0 | ibutton.py | ibutton.py | import serial
class iButton(object):
def __init__(self, ibutton_address, rfid_address, debug=False):
# self.ibutton_serial = serial.Serial(ibutton_address)
self.rfid_serial = serial.Serial(rfid_address)
self.debug = debug
def read(self):
if self.debug:
with open("i... | import serial
class iButton(object):
def __init__(self, ibutton_address, rfid_address, debug=False):
# self.ibutton_serial = serial.Serial(ibutton_address)
self.rfid_serial = serial.Serial(rfid_address)
self.debug = debug
def read(self):
if self.debug:
with open("i... | mit | Python |
2960cc48d2d6c5533987d9fc6760b356ff07076d | Remove unused code | TechMantra/Run | Run.py | Run.py | import sublime, sublime_plugin
import subprocess
import os
import threading
class Runner(threading.Thread):
def __init__(self, command, shell, env, view):
self.stdout = None
self.stderr = None
self.command = command or ''
self.shell = shell or ''
self.env = env or ''
self.view =... | import sublime, sublime_plugin
import subprocess
import os
import threading
class Runner(threading.Thread):
def __init__(self, command, shell, env, view):
self.stdout = None
self.stderr = None
self.command = command or ''
self.shell = shell or ''
self.env = env or ''
self.view =... | mit | Python |
0306b4b435b41f31d0ab0b31c734d53739c87f0a | Update ao3 to books folder and newer Chapter Index description | palfrey/book-blog | ao3.py | ao3.py | from sys import argv
from urlgrab import Cache
from codecs import open
import re
from common import *
from urlparse import urljoin
cache = Cache()
url = argv[1]
id = re.search("/works/(\d+)", url)
id = id.groups()[0]
navigate = "http://archiveofourown.org/works/%s/navigate"%id
print navigate
data = cache.get(naviga... | from sys import argv
from urlgrab import Cache
from codecs import open
import re
from common import *
from urlparse import urljoin
cache = Cache()
url = argv[1]
id = re.search("/works/(\d+)", url)
id = id.groups()[0]
navigate = "http://archiveofourown.org/works/%s/navigate"%id
print navigate
data = cache.get(naviga... | agpl-3.0 | Python |
9014637892b81ecb0c10cbe0d83a30d44cb1c728 | Add response code | justinchuby/cmu-courseapi-flask | api.py | api.py | from flask import Flask
from flask_restful import Resource, Api
from werkzeug.routing import BaseConverter
from config import *
import search
app = Flask(__name__)
api = Api(app)
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
super(RegexConverter, self).__init__(url_map)
... | from flask import Flask
from flask_restful import Resource, Api
from werkzeug.routing import BaseConverter
from config import *
import search
app = Flask(__name__)
api = Api(app)
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
super(RegexConverter, self).__init__(url_map)
... | mit | Python |
43c559c3fb42987825a18320f24fd6f6a065699f | update and delete task | nipe0324/flask-todo-api | app.py | app.py | from flask import Flask, jsonify, abort, request, make_response
app = Flask(__name__)
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
},
{
'id': 2,
'title': u'Learn Python',
'descri... | from flask import Flask, jsonify, abort, request, make_response
app = Flask(__name__)
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
},
{
'id': 2,
'title': u'Learn Python',
'descri... | apache-2.0 | Python |
c3881c1146d5dbe77a332698ac7c292c68c5a420 | Remove the dumplicate top stories | lord63/zhihudaily,lord63/zhihudaily,lord63/zhihudaily | app.py | app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import requests
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
session = requests.Session()
session.headers.update({'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux \
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import requests
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
session = requests.Session()
session.headers.update({'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux \
... | mit | Python |
597cf326b8af675bcd7c9a4de6034f2769632f20 | break after unit | suclearnub/scubot | bot.py | bot.py | # TODO Put an enum matching unit pairs, will make code cleaner
import discord
import re
from unitconverter import *
client = discord.Client()
triggerString = '!convert'
historyLimit = 10
def construct_response(message_regex):
string = message_regex.group(0) + ' is '
current_value = int(message_regex.group(... | # TODO Put an enum matching unit pairs, will make code cleaner
import discord
import re
from unitconverter import *
client = discord.Client()
triggerString = '!convert'
historyLimit = 10
def construct_response(message_regex):
string = message_regex.group(0) + ' is '
current_value = int(message_regex.group(... | mit | Python |
0ae41f89a0a08816b01ae8d3ff08e93de1600349 | change greeting msg | mesenev/top_bot_lyceum | bot.py | bot.py | import locale
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import database
import methods
from config import *
database.db.connect()
database.db.create_tables(database.models, safe=True)
try:
locale.setlocale(locale.LC_TIME, "ru_RU")
except:
pass
updater = Updater(token=BOT_TOK... | import locale
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import database
import methods
from config import *
database.db.connect()
database.db.create_tables(database.models, safe=True)
try:
locale.setlocale(locale.LC_TIME, "ru_RU")
except:
pass
updater = Updater(token=BOT_TOK... | mit | Python |
bd35c497f98809fc2802876589c71b110bb29a4f | update format | Windfarer/bot | bot.py | bot.py | import random
import wxpy
import re
dice_pattern = re.compile(r'''([+-]{0,1}(\d+)[Dd](\d+))|([+-]{0,1}(\d+))''')
def roll(text, limit=1000):
groups = dice_pattern.findall(text)
result = []
for group in groups:
sub_result = []
if group[0]:
if group[0].startswith('-'):
... | import random
import wxpy
import re
dice_pattern = re.compile(r'''([+-]{0,1}(\d+)[Dd](\d+))|([+-]{0,1}(\d+))''')
def roll(text, limit=1000):
groups = dice_pattern.findall(text)
result = []
for group in groups:
if group[0]:
if group[0].startswith('-'):
sign = -1
... | mit | Python |
ca81a6456476f0195c6122da84e8a6d3e821425a | Add doc string comments | Bubblesphere/ay-discord-bot | bot.py | bot.py | ''' Discord Bot '''
import os
import praw
from discord.ext import commands
from dotenv import load_dotenv, find_dotenv
import helper
load_dotenv(find_dotenv())
REDDIT = praw.Reddit(
client_id=os.environ.get("REDDIT_CLIENT_ID"),
client_secret=os.environ.get("REDDIT_CLIENT_SECRET"),
user_agent="aySH Bot"... | """ Discord Bot """
import os
import praw
from discord.ext import commands
from dotenv import load_dotenv, find_dotenv
import helper
load_dotenv(find_dotenv())
REDDIT = praw.Reddit(
client_id=os.environ.get("REDDIT_CLIENT_ID"),
client_secret=os.environ.get("REDDIT_CLIENT_SECRET"),
user_agent="aySH Bot"... | mit | Python |
1a67d3ebc6d225250e839780a631b291980705f0 | Add command option to get dog version #65 | DataDog/dogapi,DataDog/dogapi | src/dogshell/__init__.py | src/dogshell/__init__.py | import argparse
import os
import pkg_resources as pkg
import logging
logging.getLogger('dd.dogapi').setLevel(logging.CRITICAL)
from dogshell.common import DogshellConfig
from dogshell.comment import CommentClient
from dogshell.search import SearchClient
from dogshell.metric import MetricClient
from dogshell.tag impo... | import argparse
import os
import sys
import logging
logging.getLogger('dd.dogapi').setLevel(logging.CRITICAL)
from dogshell.common import DogshellConfig
from dogshell.comment import CommentClient
from dogshell.search import SearchClient
from dogshell.metric import MetricClient
from dogshell.tag import TagClient
from... | bsd-3-clause | Python |
d22d242d42b38d560fe270f15d692b0d9a88115b | bump version | rainforestapp/destimator | destimator/__init__.py | destimator/__init__.py | from .described_estimator import DescribedEstimator
__version__ = '0.0.5'
__title__ = 'destimator'
__description__ = 'A metadata-saving proxy for scikit-learn etimators.'
__uri__ = 'https://github.com/rainforestapp/destimator'
__author__ = 'Maciej Gryka'
__email__ = 'maciej@rainforestqa.com'
__license__ = 'MIT'
__... | from .described_estimator import DescribedEstimator
__version__ = '0.0.5.dev0'
__title__ = 'destimator'
__description__ = 'A metadata-saving proxy for scikit-learn etimators.'
__uri__ = 'https://github.com/rainforestapp/destimator'
__author__ = 'Maciej Gryka'
__email__ = 'maciej@rainforestqa.com'
__license__ = 'MI... | mit | Python |
b3e04dfd49c1079b1a5378ff1cd9bed541206760 | Remove zlib from compressed type | AleksNeStu/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,prasannav7/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-... | src/ggrc/models/types.py | src/ggrc/models/types.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: vraj@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
import sqlalchemy.types as types
import json
from ggrc.utils import as_json
from... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: vraj@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
import sqlalchemy.types as types
import json
from ggrc.utils import as_json
from... | apache-2.0 | Python |
14877c8a42223be75680afbce77cf3dddca34f3e | Bump psutil from 5.5.0 to 5.6.6 in /src/main/python (#491) | drssoccer55/RLBot,drssoccer55/RLBot | src/main/python/setup.py | src/main/python/setup.py | import setuptools
__version__ = None # This will get replaced when reading version.py
exec(open('rlbot/version.py').read())
with open("README.md", "r") as readme_file:
long_description = readme_file.read()
setuptools.setup(
name='rlbot',
packages=setuptools.find_packages(),
install_requires=[
... | import setuptools
__version__ = None # This will get replaced when reading version.py
exec(open('rlbot/version.py').read())
with open("README.md", "r") as readme_file:
long_description = readme_file.read()
setuptools.setup(
name='rlbot',
packages=setuptools.find_packages(),
install_requires=[
... | mit | Python |
e3e02ee1c99d6cb841e0074f4a83c99de7f9ba14 | Increment version | kmike/psd-tools,kmike/psd-tools,psd-tools/psd-tools | src/psd_tools/version.py | src/psd_tools/version.py | __version__ = '1.7.16'
| __version__ = '1.7.15'
| mit | Python |
536fe2a0d68fa365a9d7a35cc30892636591c6a9 | support numpy arrays for relh computation | akrherz/pyIEM | src/pyiem/meteorology.py | src/pyiem/meteorology.py | """
We do meteorological things, when necessary
"""
import numpy as np
def uv(speed, direction):
"""
Compute the u and v components of the wind
@param wind speed in whatever units
@param dir wind direction with zero as north
@return u and v components
"""
dirr = direction * np.pi / 180.00... | """
We do meteorological things, when necessary
"""
import math
import numpy as np
def uv(speed, direction):
"""
Compute the u and v components of the wind
@param wind speed in whatever units
@param dir wind direction with zero as north
@return u and v components
"""
dirr = direction * np... | mit | Python |
2036e978a22cf980a6bc28a8e7276886fa8857e8 | Increment version to 0.1.2 to fix pip not updating to edge | asavoy/django-activeusers,arteria/django-activeusers | activeusers/__init__.py | activeusers/__init__.py |
VERSION = (0, 1, 2)
def get_version():
"Returns the version as a human-format string."
return '.'.join([str(i) for i in VERSION])
|
VERSION = (0, 1, 1)
def get_version():
"Returns the version as a human-format string."
return '.'.join([str(i) for i in VERSION])
| mit | Python |
989abdc718973551bbb3565859d75ea0408776d0 | Fix URLconf for example project. | zsiciarz/django-pgallery,zsiciarz/django-pgallery | example_project/example_project/urls.py | example_project/example_project/urls.py | from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.static import serve
urlpatterns = [
# Examples:
# url(r'^$', 'example_project.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r"^admin/", admin.site.urls)... | from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.static import serve
urlpatterns = [
# Examples:
# url(r'^$', 'example_project.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r"^admin/", include(admin.si... | mit | Python |
b55e98ee6360fed82264d70519eeb4248e7bc84e | improve speed test | dpellegr/sixtracklib,SixTrack/SixTrackLib,dpellegr/sixtracklib,SixTrack/SixTrackLib,SixTrack/SixTrackLib,dpellegr/sixtracklib,SixTrack/SixTrackLib | examples/lhc_sixtrack/speed_longtest.py | examples/lhc_sixtrack/speed_longtest.py | #!/usr/bin/env python
import numpy as np
import sixtracktools
import sixtracklib
six =sixtracktools.SixTrackInput('.')
line,rest,iconv=six.expand_struct()
names,types,args=zip(*line)
idx=dict( (nn,ii) for ii,nn in enumerate(six.struct) if not 'BLOC' in nn)
names2=np.array(names)[iconv]
sixtrackbeam=sixtracktools.S... | #!/usr/bin/env python
import numpy as np
import sixtracktools
import sixtracklib
six =sixtracktools.SixTrackInput('.')
line,rest,iconv=six.expand_struct()
names,types,args=zip(*line)
idx=dict( (nn,ii) for ii,nn in enumerate(six.struct) if not 'BLOC' in nn)
names2=np.array(names)[iconv]
sixtrackbeam=sixtracktools.S... | lgpl-2.1 | Python |
5f31e535ed4dcad9d850200311666abd0db9a538 | Add exception handling for database connection | ThePrez/-ibmi_netstat_py,ThePrez/python-for-IBM-i-examples,ThePrez/python-for-IBM-i-examples,Club-Seiden/python-for-IBM-i-examples,Club-Seiden/python-for-IBM-i-examples,Club-Seiden/-ibmi_netstat_py | netstat.py | netstat.py | #!/QOpenSys/usr/bin/python3
import argparse
import ibm_db # To install on the IBM i execute
# pip3 install /QOpenSys/QIBM/ProdData/OPS/Python-pkgs/ibm_db/ibm_db-*-cp34m-*.whl
# Make sure you have installed 5733OPS PTF SI59051 and SI60563 or subsequent PTF's!
# See https... | #!/QOpenSys/usr/bin/python3
import argparse
import ibm_db # To install on the IBM i execute
# pip3 install /QOpenSys/QIBM/ProdData/OPS/Python-pkgs/ibm_db/ibm_db-*-cp34m-*.whl
# Make sure you have installed 5733OPS PTF SI59051 and SI60563 or subsequent PTF's!
# See https... | mit | Python |
1cd6ef77bb744ab606460a8b396e99ea9eba2225 | bump version | affinitas/pgpm | pgpm/_version.py | pgpm/_version.py | __version__ = '0.0.4b1'
| __version__ = '0.0.4a10'
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.