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 |
|---|---|---|---|---|---|---|---|---|
c670ca417a55dba661e359e509a3dac1e354341c | insert missing space | CanonicalLtd/subiquity,CanonicalLtd/subiquity | subiquity/ui/views/mirror.py | subiquity/ui/views/mirror.py | # Copyright 2018 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | # Copyright 2018 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | agpl-3.0 | Python |
ed04c7183fd5a53f14eade295b8fdc8c77f650ba | fix tests | pydanny/djangopackages,pydanny/djangopackages,QLGu/djangopackages,nanuxbe/djangopackages,QLGu/djangopackages,QLGu/djangopackages,pydanny/djangopackages,nanuxbe/djangopackages,nanuxbe/djangopackages | settings/test.py | settings/test.py | # -*- coding: utf-8 -*-
"""Local test settings and globals which allows us to run our test suite
locally.
"""
from settings.base import *
########## DEBUG
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SERVE_MEDIA = DEBUG
########## TEST
TEST_RUNNER = 'testrunner.OurCoverageRunner'
COVERAGE_MODULE_EXCLUDES = [
'tests$'... | # -*- coding: utf-8 -*-
"""Local test settings and globals which allows us to run our test suite
locally.
"""
from settings.base import *
########## DEBUG
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SERVE_MEDIA = DEBUG
########## TEST
TEST_RUNNER = 'testrunner.OurCoverageRunner'
COVERAGE_MODULE_EXCLUDES = [
'tests$'... | mit | Python |
315d5606e0f7ea72586eff498cd21eb13e5a1d3f | fix can_reach declaration | jcdouet/pyDatalog,pcarbonn/pyDatalog | pyDatalog/examples/graph.py | pyDatalog/examples/graph.py | """
This file illustrates algorithms that can be used with graphs, trees, hierarchies, ...
* which nodes can be reached from another node
* what are the possible paths between 2 nodes
* give me one path between 2 nodes (more efficient)
* what is the shortest path between 2 nodes, given a cost fun... | """
This file illustrates algorithms that can be used with graphs, trees, hierarchies, ...
* which nodes can be reached from another node
* what are the possible paths between 2 nodes
* give me one path between 2 nodes (more efficient)
* what is the shortest path between 2 nodes, given a cost fun... | lgpl-2.1 | Python |
3c404438774f238a2e9e0e699396d907d63d56d8 | Remove unsed import. | pwwang/pyppl | pyppl/runners/runner_dry.py | pyppl/runners/runner_dry.py | """
# Dry runner
"""
from os import path, utime, remove
from .runner import Runner
from .helpers import LocalHelper
class RunnerDry (Runner):
"""
The dry runner
"""
def __init__ (self, job):
"""
Constructor
@params:
`job`: The job object
"""
super(RunnerDry, self).__init__(job)
# construct an ... | """
# Dry runner
"""
from os import path, utime, remove
from .runner import Runner
from .helpers import LocalHelper
from .. import utils
class RunnerDry (Runner):
"""
The dry runner
"""
def __init__ (self, job):
"""
Constructor
@params:
`job`: The job object
"""
super(RunnerDry, self).__init__(jo... | apache-2.0 | Python |
7009c791786831151063c88b386ecd289402ab6f | Fix problems with key files for ssh runners | pwwang/pyppl | pyppl/runners/runner_ssh.py | pyppl/runners/runner_ssh.py | import os
from getpass import getuser
from subprocess import check_output, list2cmdline
from .runner import runner
from ..helpers import utils
class runner_ssh (runner):
"""
The ssh runner
@static variables:
`serverid`: The incremental number used to calculate which server should be used.
- Don't touch unles... | import os
from getpass import getuser
from subprocess import check_output, list2cmdline
from .runner import runner
from ..helpers import utils
class runner_ssh (runner):
"""
The ssh runner
@static variables:
`serverid`: The incremental number used to calculate which server should be used.
- Don't touch unles... | apache-2.0 | Python |
c9acd0cb55d8656dd167141b3f6f44fc60051b24 | update the version to 2.0.2. | jtaghiyar/kronos | kronos/kronos_version.py | kronos/kronos_version.py | '''
Created on Nov 25, 2014
@author: jtaghiyar
'''
kronos_version = "2.0.2"
| '''
Created on Nov 25, 2014
@author: jtaghiyar
'''
kronos_version = "2.0.1"
| mit | Python |
c15fd9cb8d6deba8cd00305956807e3bcd9dc589 | Fix prnt() to force string | shikigit/python-phonenumbers,agentr13/python-phonenumbers,daviddrysdale/python-phonenumbers,daviddrysdale/python-phonenumbers,roubert/python-phonenumbers,daodaoliang/python-phonenumbers,titansgroup/python-phonenumbers,dongguangming/python-phonenumbers,gencer/python-phonenumbers,SergiuMir/python-phonenumbers,daviddrysda... | python/phonenumbers/util.py | python/phonenumbers/util.py | #!/usr/bin/env python
"""Python 2.x/3.x compatibility utilities.
>>> from util import prnt, u, unichr
>>> prnt("hello")
hello
>>> prnt("hello", "world")
hello world
>>> prnt("hello", "world", sep=":")
hello:world
>>> prnt("hello", "world", sep=":", end='!\\n')
hello:world!
>>> u('\u0101') == unichr(0x0101)
True
>>> u(... | #!/usr/bin/env python
"""Python 2.x/3.x compatibility utilities.
>>> from util import prnt, u, unichr
>>> prnt("hello")
hello
>>> prnt("hello", "world")
hello world
>>> prnt("hello", "world", sep=":")
hello:world
>>> prnt("hello", "world", sep=":", end='!\\n')
hello:world!
>>> u('\u0101') == unichr(0x0101)
True
>>> u(... | apache-2.0 | Python |
0dc19939db1569bcaa1989e566bce732f60e3000 | add analyze_channel_network_and_plot to plot's __init__.py | amandersillinois/landlab,landlab/landlab,cmshobe/landlab,cmshobe/landlab,cmshobe/landlab,landlab/landlab,landlab/landlab,amandersillinois/landlab | landlab/plot/__init__.py | landlab/plot/__init__.py | from landlab.plot.imshow import (imshow_grid, imshow_node_grid,
imshow_cell_grid, imshow_grid_at_node)
from landlab.plot.channel_profile import analyze_channel_network_and_plot
| from landlab.plot.imshow import (imshow_grid, imshow_node_grid,
imshow_cell_grid, imshow_grid_at_node)
| mit | Python |
91fece9b3f44a907195cf3bf1e096369f1d2c4fa | fix typo in Data.collect method name | poolio/thunder,kunallillaney/thunder,mikarubi/thunder,pearsonlab/thunder,j-friedrich/thunder,pearsonlab/thunder,zhwa/thunder,oliverhuangchao/thunder,poolio/thunder,j-friedrich/thunder,jwittenbach/thunder,thunder-project/thunder,oliverhuangchao/thunder,zhwa/thunder,broxtronix/thunder,mikarubi/thunder,kcompher/thunder,kc... | python/thunder/rdds/data.py | python/thunder/rdds/data.py | from numpy import int16
FORMATS = {
'int16': int16,
'float': float
}
class Data(object):
def __init__(self, rdd):
self.rdd = rdd
def first(self):
return self.rdd.first()
def collect(self):
return self.rdd.collect()
def count(self):
return self.rdd.count()
... | from numpy import int16
FORMATS = {
'int16': int16,
'float': float
}
class Data(object):
def __init__(self, rdd):
self.rdd = rdd
def first(self):
return self.rdd.first()
def collet(self):
return self.rdd.collect()
def count(self):
return self.rdd.count()
... | apache-2.0 | Python |
3241679453f493153219850582196d9a5535e32f | Bump version | ckan/datapusher | datapusher/__init__.py | datapusher/__init__.py | __version__ = '0.0.17'
| __version__ = '0.0.16'
| agpl-3.0 | Python |
34c7f1bd861064e8bc0bbcd00df5a3f94cbeaabf | Bump version to 0.0.12 | ckan/datapusher | datapusher/__init__.py | datapusher/__init__.py | __version__ = '0.0.12'
| __version__ = '0.0.11'
| agpl-3.0 | Python |
571450425d43e1bed0c74aac502560df2bf464f1 | Move mappings out of function body | douglashill/OS-X-setup,douglashill/OS-X-setup | setupdefaults.py | setupdefaults.py | #! /usr/bin/python
# Encoding: utf-8
import json
import os
import re
import subprocess
import sys
class TypeMapping:
def __init__(self, py_types, type_string, value_transformer):
self.py_types = py_types
self.type_string = type_string
self.value_transformer = value_transformer
# Unsupported property list type... | #! /usr/bin/python
# Encoding: utf-8
import json
import os
import re
import subprocess
import sys
class TypeMapping:
def __init__(self, py_types, type_string, value_transformer):
self.py_types = py_types
self.type_string = type_string
self.value_transformer = value_transformer
def map_type(value):
# Unsuppor... | mit | Python |
b0dba4ace9a9b3fd2e74292cdd7cce9b9d98d2fd | Improve display of + and X. | zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie | seven_segment.py | seven_segment.py | """Drive a cheesy 7-segment display made of LEDs."""
import RPi.GPIO as GPIO
from time import sleep
import sys
def light_segments(segstring, pins):
assert type(segstring) == str
for p in pins:
GPIO.output(p, GPIO.LOW) # reset the many
for c in segstring:
GPIO.output(pins[int(c)], GPIO.HIGH... | """Drive a cheesy 7-segment display made of LEDs."""
import RPi.GPIO as GPIO
from time import sleep
import sys
def light_segments(segstring, pins):
assert type(segstring) == str
for p in pins:
GPIO.output(p, GPIO.LOW) # reset the many
for c in segstring:
GPIO.output(pins[int(c)], GPIO.HIGH... | mit | Python |
00e3b5df454bd944fd1c0e56db7f019591ce40e5 | repair windows to start appium | ztwo/Auto_Analysis | public/StartAppium.py | public/StartAppium.py | # -*- coding: utf-8 -*-
__author__ = 'joko'
"""
@author:joko
@time: 16/11/8 下午2:52
"""
import lib.Utils as U
import random
import platform
class Sp:
def __init__(self, device):
self.device = device
def __start_driver(self, aport, bpport):
"""
清理logcat与appium所有进程
:return:
... | # -*- coding: utf-8 -*-
__author__ = 'joko'
"""
@author:joko
@time: 16/11/8 下午2:52
"""
import lib.Utils as U
import random
class Sp:
def __init__(self, device):
self.device = device
def start_appium(self):
"""
启动appium
p:appium port
bp:bootstrap port
:return:... | mit | Python |
4bf123484bb61bc2baf000e269a5b927fbdcce00 | Add headers to download rather than display file | squirrelo/qiita,antgonza/qiita,adamrp/qiita,biocore/qiita,wasade/qiita,ElDeveloper/qiita,squirrelo/qiita,antgonza/qiita,biocore/qiita,josenavas/QiiTa,ElDeveloper/qiita,RNAer/qiita,squirrelo/qiita,squirrelo/qiita,RNAer/qiita,josenavas/QiiTa,josenavas/QiiTa,antgonza/qiita,antgonza/qiita,adamrp/qiita,adamrp/qiita,wasade/q... | qiita_pet/handlers/download.py | qiita_pet/handlers/download.py | from tornado.web import authenticated
from .base_handlers import BaseHandler
class DownloadHandler(BaseHandler):
@authenticated
def get(self, filepath_id):
# Check access to file
self.set_header('Content-Description', 'File Transfer')
self.set_header('Content-Type', 'application/octet... | from tornado.web import authenticated
from .base_handlers import BaseHandler
class DownloadHandler(BaseHandler):
@authenticated
def get(self, filepath_id):
self.set_header('X-Accel-Redirect',
'/protected/preprocessed_data/' +
filepath_id)
self.fi... | bsd-3-clause | Python |
a2d9956883fedd14e932e0057774ea53a27df58b | Use discovery. | DudLab/rank_filter,nanshe-org/rank_filter,jakirkham/rank_filter,jakirkham/rank_filter,nanshe-org/rank_filter,nanshe-org/rank_filter,DudLab/rank_filter,jakirkham/rank_filter,DudLab/rank_filter | rank_filter.recipe/run_test.py | rank_filter.recipe/run_test.py | #!/usr/bin/env python
import os
import subprocess
import sys
def main(*argv):
argv = list(argv)
return(subprocess.check_call(["python", "-m", "unittest", "discover", "-s", os.environ["SRC_DIR"]] + argv[1:],
stdin=sys.stdin,
stdout=sys.stdout... | #!/usr/bin/env python
import os
import subprocess
import sys
def main(*argv):
argv = list(argv)
os.environ["PYTHONPATH"] = os.environ["SRC_DIR"] + ":" + os.environ.get("PYTHONPATH", "")
return(subprocess.check_call(["python", "-m", "unittest", "test"] + argv[1:],
stdin... | bsd-3-clause | Python |
9656825f6b6582cb38fb3bd1d35d488913e9e180 | Use HI noise level in the regridded cube | e-koch/VLA_Lband,e-koch/VLA_Lband | 14B-088/HI/analysis/co_comparison/co_vs_hi_brightness.py | 14B-088/HI/analysis/co_comparison/co_vs_hi_brightness.py | import matplotlib.pyplot as p
import numpy as np
from astropy import units as u
from astropy.stats import mad_std
from spectral_cube import SpectralCube
import seaborn as sb
# import pandas as pd
from corner import hist2d
from paths import (iram_co21_data_path, fourteenB_HI_data_path,
paper1_figures... | from astropy.io import fits
import matplotlib.pyplot as p
import numpy as np
from astropy import units as u
from spectral_cube import SpectralCube
import seaborn as sb
# import pandas as pd
from corner import hist2d
from paths import (iram_co21_data_path, fourteenB_HI_data_path,
paper1_figures_path)... | mit | Python |
86a2e55954ff4b8f5e005296e2ae336b6be627a0 | Allow passing the rackattack connection string as an argument to the client factory | eliran-stratoscale/rackattack-api,Stratoscale/rackattack-api | py/rackattack/clientfactory.py | py/rackattack/clientfactory.py | import os
from rackattack.tcp import client
_VAR_NAME = "RACKATTACK_PROVIDER"
def factory(connectionString=None):
if connectionString is None:
if _VAR_NAME not in os.environ:
raise Exception(
"The environment variable '%s' must be defined properly" % _VAR_NAME)
connec... | import os
from rackattack.tcp import client
_VAR_NAME = "RACKATTACK_PROVIDER"
def factory():
if _VAR_NAME not in os.environ:
raise Exception(
"The environment variable '%s' must be defined properly" % _VAR_NAME)
request, subscribe, http = os.environ[_VAR_NAME].split("@@")
return clie... | apache-2.0 | Python |
9cb50f71225029429b1854ab800d50cc3480ab86 | Add return_data argument to sharedmemreceiver recv() | pyacq/pyacq,pyacq/pyacq | pyacq/core/stream/sharedmem.py | pyacq/core/stream/sharedmem.py | import struct
import numpy as np
from .streamhelpers import DataSender, DataReceiver, register_transfermode
from .ringbuffer import RingBuffer
class SharedMemSender(DataSender):
"""
"""
def __init__(self, socket, params):
DataSender.__init__(self, socket, params)
self.size = self.params['... | import struct
import numpy as np
from .streamhelpers import DataSender, DataReceiver, register_transfermode
from .ringbuffer import RingBuffer
class SharedMemSender(DataSender):
"""
"""
def __init__(self, socket, params):
DataSender.__init__(self, socket, params)
self.size = self.params['... | bsd-3-clause | Python |
eee27b3de975f8be7555dbd9a335e3308fbc3a9d | Update mnist_SVM_VGood.py | prashantas/MyDataScience | Python/mnist_SVM_VGood.py | Python/mnist_SVM_VGood.py | ### Source :: https://gist.github.com/amueller/2594372
### http://peekaboo-vision.blogspot.in/2010/09/mnist-for-ever.html
from sklearn.grid_search import GridSearchCV
from sklearn.cross_validation import StratifiedKFold
def main():
mnist = fetch_mldata("MNIST original")
X_all, y_all = mnist.data/255., mnis... | ### Source :: https://gist.github.com/amueller/2594372
### http://peekaboo-vision.blogspot.in/2010/09/mnist-for-ever.html
from sklearn.grid_search import GridSearchCV
from sklearn.cross_validation import StratifiedKFold
def main():
mnist = fetch_mldata("MNIST original")
X_all, y_all = mnist.data/255., mnis... | bsd-2-clause | Python |
aad3e7d6ca9ffcd05ab528222bd72e3ea39b4e24 | fix return | durcan/phonon_nrecoil | simple_access.py | simple_access.py | from glob import iglob
def expander(
dtype='ba',
tree='rrqDir/calibzip1',
base='/tera2/data3/cdmsbatsProd/R133/dataReleases/Prodv5-3_June2013/merged/',
data='all',
productions=['all'],
cut='',
cutrev=''):
pbase = base + data + '/' + cutrev + dtype + '/' + c... | from glob import iglob
def expander(
dtype='ba',
tree='rrqDir/calibzip1',
base='/tera2/data3/cdmsbatsProd/R133/dataReleases/Prodv5-3_June2013/merged/',
data='all',
productions=['all'],
cut='',
cutrev=''):
pbase = base + data + '/' + cutrev + dtype + '/' + c... | mit | Python |
f6920a02cfe5f9e83d75792b6f6194f235760322 | make `awx-manage expire_sessions --user xyz` more robust | wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,wwitzel3/awx | awx/main/management/commands/expire_sessions.py | awx/main/management/commands/expire_sessions.py | # Python
from importlib import import_module
# Django
from django.utils import timezone
from django.conf import settings
from django.contrib.auth import logout
from django.http import HttpRequest
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.c... | # Python
from importlib import import_module
# Django
from django.utils import timezone
from django.conf import settings
from django.contrib.auth import logout
from django.http import HttpRequest
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.c... | apache-2.0 | Python |
cf78c2f470b4a5928db91a48f744e2a368aa0be1 | add auth for manage_posts | ollien/Timpani,ollien/Timpani,ollien/Timpani | py/webserver/views.py | py/webserver/views.py | import flask
import os.path
import datetime
import database
import auth
import blog
import configmanager
from . import webhelpers
FILE_LOCATION = os.path.abspath(os.path.dirname(__file__))
CONFIG_PATH = os.path.abspath(os.path.join(FILE_LOCATION, "../../configs/"))
TEMPLATE_PATH = os.path.abspath(os.path.join(FILE_LOC... | import flask
import os.path
import datetime
import database
import auth
import blog
import configmanager
from . import webhelpers
FILE_LOCATION = os.path.abspath(os.path.dirname(__file__))
CONFIG_PATH = os.path.abspath(os.path.join(FILE_LOCATION, "../../configs/"))
TEMPLATE_PATH = os.path.abspath(os.path.join(FILE_LOC... | mit | Python |
22931c84b5ad7faa2f22ce9febbf997813da7695 | Update __init__.py | tino/pyFirmata,JoseU/pyFirmata | pyfirmata/__init__.py | pyfirmata/__init__.py | from .pyfirmata import *
from .boards import BOARDS
__version__ = '1.0.3' # Use bumpversion!
# shortcut classes
class Arduino(Board):
"""
A board that will set itself up as a normal Arduino.
"""
def __init__(self, *args, **kwargs):
args = list(args)
args.append(BOARDS['arduino'])
... | from .pyfirmata import *
from .boards import BOARDS
__version__ = '1.0.3' # Use bumpversion!
# shortcut classes
class Arduino(Board):
"""
A board that will set itself up as a normal Arduino.
"""
def __init__(self, *args, **kwargs):
args = list(args)
args.append(BOARDS['arduino'])
... | mit | Python |
fa85be3529d74ab76889ec91be15f0fea12ec2ad | Add group access control for Application | larserikgk/mobiauth-server,larserikgk/mobiauth-server,larserikgk/mobiauth-server | apps/userprofile/models.py | apps/userprofile/models.py | from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User, Group
class Organization(models.Model):
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class UserProfile(models.Model):
user = models.ForeignKey(Us... | from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
class Organization(models.Model):
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class UserProfile(models.Model):
user = models.ForeignKey(User)
... | mit | Python |
dbe0b71d16c3bd7ff09b05dbeaf7aff0adbc37ce | Move Gunicorn debugger into middleware function | nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask | snakeeyes/app.py | snakeeyes/app.py | from flask import Flask
from celery import Celery
from werkzeug.debug import DebuggedApplication
from snakeeyes.blueprints.page.views import page
from snakeeyes.blueprints.contact.views import contact
from snakeeyes.extensions import debug_toolbar, mail, csrf, flask_static_digest
def create_celery_app(app=None):
... | from flask import Flask
from celery import Celery
from werkzeug.debug import DebuggedApplication
from snakeeyes.blueprints.page.views import page
from snakeeyes.blueprints.contact.views import contact
from snakeeyes.extensions import debug_toolbar, mail, csrf, flask_static_digest
def create_celery_app(app=None):
... | mit | Python |
d78fad6937fb20a1ea7374240607b5d6800aa11b | Use the Mojang API directly; reduces overhead. | mrlolethan/MinecraftUsernameToUUID | username_to_uuid.py | username_to_uuid.py | """ Username to UUID
Converts a Minecraft username to it's UUID equivalent.
Uses the official Mojang API to fetch player data.
"""
import http.client
import json
class UsernameToUUID:
def __init__(self, username):
self.username = username
def get_uuid(self, timestamp=None):
"""
Ge... | """ Username to UUID
Converts a Minecraft username to it's UUID equivalent.
Parses http://www.lb-stuff.com/Minecraft-Name-History output to retrieve the UUID
of an old name that's no longer in use.
"""
import http.client
from bs4 import BeautifulSoup
class UsernameToUUID:
def __init__(self, username):
... | mit | Python |
0f7832311f002b1414cd5cfb83a922687f65b605 | load image named by argument | elemel/tics | lib/tics.py | lib/tics.py | #!/usr/bin/env python
# Adapted from Paul Furber's Python version of Nehe's OpenGL Lesson 3.
from __future__ import division
from OpenGL.GL import *
from OpenGL.GLU import *
import pygame, random, sys
from pygame.locals import *
class Triangle(object):
def __init__(self, corners):
self.__corners = tuple... | #!/usr/bin/env python
# Adapted from Paul Furber's Python version of Nehe's OpenGL Lesson 3.
from __future__ import division
from OpenGL.GL import *
from OpenGL.GLU import *
import pygame, random
from pygame.locals import *
class Triangle(object):
def __init__(self, corners):
self.__corners = tuple(tupl... | mit | Python |
43f67067c470386b6b24080642cc845ec1655f58 | Make _ip_address_for_interface easier to use | OPWEN/opwen-webapp,ascoderu/opwen-webapp,ascoderu/opwen-webapp,OPWEN/opwen-webapp,OPWEN/opwen-webapp,ascoderu/opwen-cloudserver,ascoderu/opwen-cloudserver,ascoderu/opwen-webapp | utils/networking.py | utils/networking.py | import fcntl
import socket
import struct
from contextlib import contextmanager
@contextmanager
def use_interface(ifname):
"""
:type ifname: str
"""
ip = _ip_address_for_interface(ifname)
original_socket = socket.socket
def rebound_socket(*args, **kwargs):
sock = original_socket(*args... | import fcntl
import socket
import struct
from contextlib import contextmanager
@contextmanager
def use_interface(ifname):
"""
:type ifname: str
"""
ip = _ip_address_for_interface(ifname.encode('ascii'))
original_socket = socket.socket
def rebound_socket(*args, **kwargs):
sock = origi... | apache-2.0 | Python |
c80a68b81e936435434931f0b5bf748bcbea54dc | Add proto of average page. Without sorting. | uvNikita/appstats,uvNikita/appstats,uvNikita/appstats | statistics/webui.py | statistics/webui.py | from flask import render_template, g, redirect, request
from db import connect_db, get_all_sum
from statistics import app
@app.before_request
def before_request():
g.db = connect_db()
g.fields = ["CPU", "TOTAL", "SQL", "SOLR", "REDIS", "MEMCACHED"]
@app.route("/")
def main_page():
sort_by = request.args.... | from flask import render_template, g, redirect, request
from db import connect_db, get_all_sum
from statistics import app
@app.before_request
def before_request():
g.db = connect_db()
g.fields = ["CPU", "TOTAL", "SQL", "SOLR", "REDIS", "MEMCACHED"]
@app.route("/")
def main_page():
sort_by = request.args.... | mit | Python |
a429c5760226bc778cdd99b235f03349712b0477 | refactor method name | eugene-eeo/tinyindex | tinyindex/index.py | tinyindex/index.py | class Index():
def __init__(self, db, *keys, **kwargs):
self.db = db
self.keys = keys
self.reverse = kwargs.get('reverse', False)
def can_index(self, datum):
return all(key in datum for key in self.keys)
def all(self):
for item in self.db.all():
if self.... | class Index():
def __init__(self, db, *keys, **kwargs):
self.db = db
self.keys = keys
self.reverse = kwargs.get('reverse', False)
def matches_keys(self, datum):
return all(key in datum for key in self.keys)
def all(self):
for item in self.db.all():
if se... | mit | Python |
abdb90d7148ae885ac719bc623b144e2a76684ff | Bump version to 10.0.8 (testing pypi build) | hhursev/recipe-scraper | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "10.0.8"
| __version__ = "10.0.7"
| mit | Python |
236a3e81164e8f7c37c50eaf59bfadd32e76735a | Make a shortcut for debugging with pdb | cropleyb/pentai,cropleyb/pentai,cropleyb/pentai | defines.py | defines.py | INFINITY = 1e+31
DIRECTIONS = ((-1,-1),(-1,0),(-1,1),
(0,-1), (0,1),
(1,-1), (1,0), (1,1))
EMPTY = 0
BLACK = 1
WHITE = 2
def opposite_colour(col):
if col == BLACK:
return WHITE
if col == WHITE:
return BLACK
from pdb import set_trace as st
| INFINITY = 1e+31
DIRECTIONS = ((-1,-1),(-1,0),(-1,1),
(0,-1), (0,1),
(1,-1), (1,0), (1,1))
EMPTY = 0
BLACK = 1
WHITE = 2
def opposite_colour(col):
if col == BLACK:
return WHITE
if col == WHITE:
return BLACK
| mit | Python |
1b248df002f6a9c207f74c9a8125ff88ec411ccb | Add speed to variable. | danieloconell/Louis | reinforcement-learning/play.py | reinforcement-learning/play.py | """Load the trained q table and make actions based on that.
"""
import time
import env
import rl
rl.load_q()
env.make("pygame")
speed = 0.2
while True:
if speed >= 0.02:
speed -= 0.05
elif speed <= 0.005 and speed >= 0.05:
print("second")
speed -= 0.005
elif speed <= 0.005 and spe... | """Load the trained q table and make actions based on that.
"""
import time
import env
import rl
rl.load_q()
env.make("pygame")
while True:
env.reset()
for _ in range(15):
if env.done:
break
action = rl.choose_action(env.player, "test")
env.action(action)
time.slee... | mit | Python |
1e630c45903bd49bb4af496869d708944d3fb328 | Remove redundant space | Fillll/reddit2telegram,Fillll/reddit2telegram | reddit2telegram/cron_app.py | reddit2telegram/cron_app.py | #encoding:utf-8
import datetime
import csv
import concurrent.futures
import logging
from multiprocessing import cpu_count
import random
import yaml
from croniter import croniter
from supplier import supply
logger = logging.getLogger(__name__)
def _create_thread_pool(config) -> concurrent.futures.Executor:
po... | # encoding:utf-8
import datetime
import csv
import concurrent.futures
import logging
from multiprocessing import cpu_count
import random
import yaml
from croniter import croniter
from supplier import supply
logger = logging.getLogger(__name__)
def _create_thread_pool(config) -> concurrent.futures.Executor:
p... | mit | Python |
d5f69bc8da5f793d31f50ec12b7a5b4dce5480c2 | Create list of precesses to start. | Fillll/reddit2telegram,Fillll/reddit2telegram | reddit2telegram/cron_app.py | reddit2telegram/cron_app.py | #encoding:utf-8
import datetime
import csv
import logging
from multiprocessing import Process
import time
import yaml
from croniter import croniter
import psutil
from supplier import supply
logger = logging.getLogger(__name__)
def read_own_cron(own_cron_filename, config):
with open(own_cron_filename) as tsv_... | #encoding:utf-8
import datetime
import csv
import logging
from multiprocessing import Process
import time
import yaml
from croniter import croniter
import psutil
from supplier import supply
logger = logging.getLogger(__name__)
def read_own_cron(own_cron_filename, config):
with open(own_cron_filename) as tsv_... | mit | Python |
696a39949d2f5a2f74b40e76f2865c212d2b1371 | Update __main__.py | bskinn/sphobjinv | src/sphobjinv/__main__.py | src/sphobjinv/__main__.py | r"""``sphobjinv`` *package execution module*.
``sphobjinv`` is a toolkit for manipulation and inspection of
Sphinx |objects.inv| files.
**Author**
Brian Skinn (bskinn@alum.mit.edu)
**File Created**
15 May 2020
**Copyright**
\(c) Brian Skinn 2016-2020
**Source Repository**
https://github.com/bskinn/... | r"""``sphobjinv`` *package execution module*.
``sphobjinv`` is a toolkit for manipulation and inspection of
Sphinx |objects.inv| files.
**Author**
Brian Skinn (bskinn@alum.mit.edu)
**File Created**
17 May 2016
**Copyright**
\(c) Brian Skinn 2016-2020
**Source Repository**
https://github.com/bskinn/... | mit | Python |
8eea952dfbbaf481c45fec5e2a87fdedc943569a | fix for article demo deposition | inveniosoftware/invenio,inveniosoftware/invenio,tiborsimko/invenio,tiborsimko/invenio | modules/webdeposit/lib/dep_types/article_metadata.py | modules/webdeposit/lib/dep_types/article_metadata.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | mit | Python |
16b27b4cadced4ebd581e2e70c463cc7a6e345cf | Use cowbell sound to indicate failure to calibrate. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | vizard/configure.py | vizard/configure.py | #!/usr/bin/env python
import sys
import viz
import vizshape
import viztask
import suit
import targets
import vrlab
M = [13, 12, 11, 10]
TRACKER = None
def workflow():
vrlab.sounds.cowbell.play()
yield viztask.waitTime(5)
for target in targets.NUMBERED:
if True:# target.center == (0, 0, 0):
... | #!/usr/bin/env python
import sys
import viz
import vizshape
import viztask
import suit
import targets
import vrlab
M = [13, 12, 11, 10]
TRACKER = None
def workflow():
vrlab.sounds.cowbell.play()
yield viztask.waitTime(5)
for target in targets.NUMBERED:
if True:# target.center == (0, 0, 0):
... | mit | Python |
fd92a55f118be7b3b387c328a8db308a8653d65f | Add parameter to exclude labels from plotting in add_event (#50) | INM-6/viziphant | viziphant/events.py | viziphant/events.py | """
Adding time events to axes plot
-------------------------------
.. autosummary::
:toctree: toctree/events/
add_event
"""
# Copyright 2017-2022 by the Viziphant team, see `doc/authors.rst`.
# License: Modified BSD, see LICENSE.txt.txt for details.
import neo
import numpy as np
import quantities as pq
... | """
Adding time events to axes plot
-------------------------------
.. autosummary::
:toctree: toctree/events/
add_event
"""
# Copyright 2017-2022 by the Viziphant team, see `doc/authors.rst`.
# License: Modified BSD, see LICENSE.txt.txt for details.
import neo
import numpy as np
import quantities as pq
... | bsd-3-clause | Python |
2e3872cbb1d5d261cfd826c32ba9aa0b568f8422 | Fix test_control | ieure/yar | yar/tests/test_control.py | yar/tests/test_control.py | # -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure <ian.eure@gmail.com>
#
import unittest
from yar.control import decode_errors
class ErrorDecodeTest(unittest.TestCase):
def test_error_decoding(self):
self.assertEqual(
decode_errors(0x80C80081),
"Error: Programming e... | # -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure <ian.eure@gmail.com>
#
import unittest
from yar.control import Control
class ErrorDecodeTest(unittest.TestCase):
def test_error_decoding(self):
c = Control(None)
print c.decode_errors(0x80C80081)
if __name__ == '__main__':
uni... | bsd-3-clause | Python |
8e025ed0ff63f0f245a1dd308c8854302074c1b3 | fix py3k unicode->bytes in new test | dash-dash/pyzmq,caidongyun/pyzmq,ArvinPan/pyzmq,Mustard-Systems-Ltd/pyzmq,swn1/pyzmq,swn1/pyzmq,swn1/pyzmq,Mustard-Systems-Ltd/pyzmq,caidongyun/pyzmq,yyt030/pyzmq,dash-dash/pyzmq,Mustard-Systems-Ltd/pyzmq,ArvinPan/pyzmq,caidongyun/pyzmq,yyt030/pyzmq,dash-dash/pyzmq,ArvinPan/pyzmq,yyt030/pyzmq | zmq/tests/test_context.py | zmq/tests/test_context.py | #
# Copyright (c) 2010 Brian E. Granger
#
# This file is part of pyzmq.
#
# pyzmq is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option)... | #
# Copyright (c) 2010 Brian E. Granger
#
# This file is part of pyzmq.
#
# pyzmq is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option)... | bsd-3-clause | Python |
c9dff1ffe485ebb082e953f3fb78d14a666dccda | add interface of wsola and shifter | k2kobayashi/sprocket | sprocket/speech/__init__.py | sprocket/speech/__init__.py | from .feature_extractor import FeatureExtractor
from .synthesizer import Synthesizer
from .shifter import Shifter
from .wsola import WSOLA
| from .feature_extractor import FeatureExtractor
from .synthesizer import Synthesizer
| mit | Python |
72c8ff3bbecdb80f4b37afca9eb39ae1c5e1d7cd | Fix nightlies (#130) | cloudify-cosmo/cloudify-gcp-plugin | .circleci/test_examples.py | .circleci/test_examples.py | ########
# Copyright (c) 2014-2019 Cloudify Platform Ltd. 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 ... | ########
# Copyright (c) 2014-2019 Cloudify Platform Ltd. 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 ... | apache-2.0 | Python |
45b8f66d053d92289319f88d0162ea63bf219837 | add impactstory email to over limit emails again | Impactstory/oadoi,Impactstory/sherlockoa,Impactstory/sherlockoa,Impactstory/oadoi,Impactstory/oadoi | emailer.py | emailer.py | import os
import jinja2
import base64
import sendgrid
import re
from sendgrid.helpers.mail.mail import Email
from sendgrid.helpers.mail.mail import Content
from sendgrid.helpers.mail.mail import Mail
from sendgrid.helpers.mail.mail import Attachment
from sendgrid.helpers.mail.mail import Personalization
def create_em... | import os
import jinja2
import base64
import sendgrid
import re
from sendgrid.helpers.mail.mail import Email
from sendgrid.helpers.mail.mail import Content
from sendgrid.helpers.mail.mail import Mail
from sendgrid.helpers.mail.mail import Attachment
from sendgrid.helpers.mail.mail import Personalization
def create_em... | mit | Python |
0dc50f4a1b67532c926fed0d5e138ba1d98eb253 | Add packages in setup | indico/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins | storage_s3/setup.py | storage_s3/setup.py | # This file is part of Indico.
# Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | mit | Python |
26c3b36ea88afe2b1e5b029bc9bda00cf801f495 | Bump version: 0.3.0 | what-studio/tossi | tossi/__about__.py | tossi/__about__.py | # -*- coding: utf-8 -*-
"""
tossi.__about__
~~~~~~~~~~~~~~~
"""
__version__ = '0.3.0'
__license__ = 'BSD'
__author__ = 'What! Studio'
__maintainer__ = 'Heungsub Lee'
__maintainer_email__ = 'sub@nexon.co.kr'
| # -*- coding: utf-8 -*-
"""
tossi.__about__
~~~~~~~~~~~~~~~
"""
__version__ = '0.2.2'
__license__ = 'BSD'
__author__ = 'What! Studio'
__maintainer__ = 'Heungsub Lee'
__maintainer_email__ = 'sub@nexon.co.kr'
| bsd-3-clause | Python |
a65948f89cf92fd4c83b414d54cc23ae5dad8037 | Update support_vector_machine.py | archonren/project | algorithms/support_vector_machine.py | algorithms/support_vector_machine.py | from __future__ import print_function
#from sklearn import svm
import preprocess.split as s
from sklearn import preprocessing
from sklearn.metrics import precision_recall_fscore_support
from sklearn.feature_selection import VarianceThreshold
from sklearn.feature_selection import SelectKBest
from sklearn.feature_select... | __author__ = 'Guanhua, Joms'
from sklearn import svm
import preprocess.split as s
def svm_test():
''' A simple SVM Classifier.
s.split_main()[0] - Training Data
s.split_main()[1] - Training Targets
s.split_main()[4] - Test Data
s.split_main()[5] - Test Targets
'''
s_classifi... | mit | Python |
d0bffff8a341f79455cba5f69c2667ba7139810b | Apply the fix from Issue1112 to make this test more robust and keep windows happy. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/bsddb/test/test_1413192.py | Lib/bsddb/test/test_1413192.py | # http://bugs.python.org/issue1413192
#
# See the bug report for details.
# The problem was that the env was deallocated prior to the txn.
import shutil
import tempfile
try:
# For Pythons w/distutils and add-on pybsddb
from bsddb3 import db
except ImportError:
# For Python >= 2.3 builtin bsddb distribution... |
# http://python.org/sf/1413192
#
# This test relies on the variable names, see the bug report for details.
# The problem was that the env was deallocated prior to the txn.
import shutil
import tempfile
try:
# For Pythons w/distutils and add-on pybsddb
from bsddb3 import db
except ImportError:
# For Python... | mit | Python |
c1d6d2ea2ed9630ab485655dd63e2026b77a7bbf | Set debug back to false | com4/eventmq | eventmq/conf.py | eventmq/conf.py | # This file is part of eventmq.
#
# eventmq is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# eventmq is distributed in the ... | # This file is part of eventmq.
#
# eventmq is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# eventmq is distributed in the ... | lgpl-2.1 | Python |
9ead2e16013084b173817a27eafa51faf04efe08 | Add support for more CI services! | RepoReapers/reaper,RepoReapers/reaper,RepoReapers/reaper,RepoReapers/reaper | attributes/continuous_integration/discoverer.py | attributes/continuous_integration/discoverer.py | import os
class CiDiscoverer(object):
"""Base class for all CiDiscoverer classes"""
def __init__(self):
self.services = [
self.__travis__,
self.__appveyor__,
self.__circleci__,
self.__houndci__,
self.__shippable__,
self.__solanoci... | import os
class CiDiscoverer(object):
"""Base class for all CiDiscoverer classes"""
def __init__(self):
self.services = [
self.__travis__,
self.__appveyor__,
self.__circleci__
]
def discover(self, path):
if not self.services:
raise E... | apache-2.0 | Python |
c30c749558ac4e04244870871ca9c6edffb2efe3 | Revert 3.4 changes | gryffon/SusumuTakuan,gryffon/SusumuTakuan | example.py | example.py | import discord
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.content.startswith('!test'):
counter = 0
tmp = aw... | import discord
import asyncio
client = discord.Client()
@client.event
@asyncio.coroutine
def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
@asyncio.coroutine
def on_message(message):
if message.content.startswith('!test'):
... | mit | Python |
e02625a6167442f003766b69f8bb8a5f96955181 | make tag user field read only | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | api/v2/serializers/tag_serializer.py | api/v2/serializers/tag_serializer.py | from core.models import Tag
from rest_framework import serializers
from .user_serializer import UserSerializer
class TagSerializer(serializers.ModelSerializer):
user = UserSerializer(read_only=True)
class Meta:
model = Tag
fields = ('id', 'name', 'description', 'user')
| from core.models import Tag
from rest_framework import serializers
from .user_serializer import UserSerializer
class TagSerializer(serializers.ModelSerializer):
user = UserSerializer()
class Meta:
model = Tag
fields = ('id', 'name', 'description', 'user')
| apache-2.0 | Python |
48361e3eda0e2904406a8abf54b798e0fa289761 | Fix example | toshima/generalsio,delimited0/generals2 | example.py | example.py |
import generals
# 1v1 on north america server
g = generals.Generals('your userid', 'your username', '1v1')
# ffa on eu server
# g = generals.Generals('your userid', 'your username', region='eu')
# private game
# g = generals.Generals('your userid', 'your username', 'your gameid')
for update in g.get_updates():
... |
import generals
# 1v1 on north america server
g = generals.Generals('your userid', 'your username', '1v1')
# ffa on eu server
# g = generals.Generals('your userid', 'your username', region='eu')
# private game
# g = generals.Generals('your userid', 'your username', 'your gameid')
for update in g.get_updates():
... | mit | Python |
d815b23f56ea95a4272fe715ce1ff71e9e4db919 | Add new courses | 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
SESSION =... | 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... | mit | Python |
5bc7d2d271d24bc42b18b617846f80c654341415 | 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 |
931cb0f9247bf11d5311bff714de74cb07085d82 | Update fabfile | untitaker/mysteryshack,untitaker/mysteryshack,untitaker/mysteryshack | fabfile.py | fabfile.py | # Just a script to update my personal server.
from fabric.api import *
env.hosts = ['unti@draco.uberspace.de']
@task
def update():
with cd('~/data/mysteryshack'):
run('git pull')
run('make')
run('svc -du ~/service/mysteryshack')
| # Just a script to update my personal server.
from fabric.api import *
env.hosts = ['unti@draco.uberspace.de']
@task
def update():
with cd('~/data/mysteryshack'):
run('git pull')
with prefix('source rust-setup.sh'):
run('make')
run('svc -du ~/service/mysteryshack')
| mit | Python |
ebba1d81c9c1b58fd63e08c03f1833e123d6ef83 | Remove ruby version requirement | fishsilo/skipjack,fishsilo/skipjack,fishsilo/skipjack | fabfile.py | fabfile.py | #!/usr/bin/env python2.7
import os.path
from fabric.api import *
env.user = 'root'
fab_dir = os.path.dirname(env.real_fabfile)
def bootstrap():
run('apt-get install -q -y ruby git')
run('gem install --no-ri --no-rdoc puppet')
run('git clone git://github.com/fishsilo/skipjack.git')
provision()
def p... | #!/usr/bin/env python2.7
import os.path
from fabric.api import *
env.user = 'root'
fab_dir = os.path.dirname(env.real_fabfile)
def bootstrap():
run('apt-get install -q -y ruby1.9.1 git')
run('gem install --no-ri --no-rdoc puppet')
run('git clone git://github.com/fishsilo/skipjack.git')
provision()
... | mit | Python |
674db619f8dc2655b4f3033b97e52da19f40022c | add a task for serving data | armstrong/docs.armstrongcms.org | fabfile.py | fabfile.py | from fabric.api import *
fabric_local = local
def local(*cmds):
for cmd in cmds:
fabric_local(cmd, capture=False)
@task
def build():
"""Build documentation"""
local("make clean dirhtml")
@task
def deploy():
"""Take built documentation and deploy it to GitHub"""
local("git checkout gh-p... | from fabric.api import *
fabric_local = local
def local(*cmds):
for cmd in cmds:
fabric_local(cmd, capture=False)
@task
def build():
"""Build documentation"""
local("make clean dirhtml")
@task
def deploy():
"""Take built documentation and deploy it to GitHub"""
local("git checkout gh-p... | apache-2.0 | Python |
ee3e9d747d5bbafceb6f6977c532698504f386c5 | implement item saving | max-arnold/fetch-google-reader | fetcher.py | fetcher.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
import argparse
import sys
import os
from libgreader import GoogleReader, ClientAuthMethod, Feed
from slugify import slugify
def authenticate(username, password):
auth = ClientAuthMethod(username, p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import argparse
import sys
import os
from libgreader import GoogleReader, ClientAuthMethod, Feed
from slugify import slugify
def authenticate(username, password):
auth = ClientAuthMethod(username, password)
return GoogleRead... | mit | Python |
67d84dcaae97c1e303d3a0be5968e7ce82d5c7cc | Improve code quality on signals.py | django-notifications/django-notifications,lukeburden/django-notifications,lukeburden/django-notifications,lukeburden/django-notifications,django-notifications/django-notifications,django-notifications/django-notifications,iberben/django-notifications,iberben/django-notifications,iberben/django-notifications | notifications/signals.py | notifications/signals.py | ''' Django notifications signal file '''
from django.dispatch import Signal
notify = Signal(providing_args=[ # pylint: disable=invalid-name
'recipient', 'actor', 'verb', 'action_object', 'target', 'description',
'timestamp', 'level'
])
| from django.dispatch import Signal
notify = Signal(providing_args=[
'recipient', 'actor', 'verb', 'action_object', 'target', 'description',
'timestamp', 'level'
])
| bsd-3-clause | Python |
6b6cb32297b29a1dc6c415150b8a9a37b38349bf | bump version | matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse | synapse/__init__.py | synapse/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
#
# 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... | # -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
#
# 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... | apache-2.0 | Python |
eca73239121f592fc751269d6c1e54e414b65113 | Change iscoro to use inspect.iscoroutine. | vertexproject/synapse,vertexproject/synapse,vertexproject/synapse | synapse/lib/coro.py | synapse/lib/coro.py | '''
Async/Coroutine related utilities.
'''
import asyncio
import inspect
import logging
logger = logging.getLogger(__name__)
import synapse.glob as s_glob
import synapse.lib.base as s_base
# FIXME: replace all instances of asyncio.iscoroutine with this function
def iscoro(item):
return inspect.iscoroutine(item)... | '''
Async/Coroutine related utilities.
'''
import asyncio
import logging
import types
logger = logging.getLogger(__name__)
import synapse.glob as s_glob
import synapse.lib.base as s_base
# FIXME: replace all instances of asyncio.iscoroutine with this function
def iscoro(item):
if isinstance(item, (types.AsyncG... | apache-2.0 | Python |
463d6627b140bf000ff9c2293acf00f0a42af85e | change position | jhgg/graphqllib,dittos/graphqllib,gabriel-laet/graphql-py,woodb/graphql-py,elastic-coders/graphqllib | tests/core_validation/test_unique_fragment_names.py | tests/core_validation/test_unique_fragment_names.py | from graphql.core.language.location import SourceLocation
from graphql.core.validation.rules import UniqueFragmentNames
from utils import expect_passes_rule, expect_fails_rule
def duplicate_fragment(fragment_name, l1, c1, l2, c2):
return {
'message': UniqueFragmentNames.duplicate_fragment_name_message(fra... | from graphql.core.language.location import SourceLocation
from graphql.core.validation.rules import UniqueFragmentNames
from utils import expect_passes_rule, expect_fails_rule
def duplicate_fragment(fragment_name, l1, c1, l2, c2):
return {
'message': UniqueFragmentNames.duplicate_fragment_name_message(fra... | mit | Python |
cd3870cf0e4c7f12b64d2d8eb5beaaf984a015e3 | Add the ability to extract only a limited time period of model results. This allows the residual analysis to be calculated on a much more modest machine than would otherwise be the case | pwcazenave/PyFVCOM | read_FVCOM_results.py | read_FVCOM_results.py |
def readFVCOM(file, varList, clipTime=False, noisy=False):
"""
Read in the FVCOM results file and spit out numpy arrays for
each of the variables specified in the varList list.
Optionally specify a timeRange which will extract only the range of times
of interest. Specify as indices and not Modifie... |
def readFVCOM(file, varList, noisy=False):
"""
Read in the FVCOM results file and spit out numpy arrays for
each of the variables.
"""
try:
from netCDF4 import Dataset
except ImportError:
raise ImportError('Failed to load the NetCDF4 library')
rootgrp = Dataset(file, 'r')
... | mit | Python |
1bd3d7d16da7cc1cf98fa68768910010251f2fea | Add test for unimplemented get_response_statements function | gunthercox/ChatterBot,vkosuri/ChatterBot | tests/storage_adapter_tests/test_storage_adapter.py | tests/storage_adapter_tests/test_storage_adapter.py | from unittest import TestCase
from chatterbot.storage import StorageAdapter
class StorageAdapterTestCase(TestCase):
"""
This test case is for the StorageAdapter base class.
Although this class is not intended for direct use,
this test case ensures that exceptions requiring
basic functionality are ... | from unittest import TestCase
from chatterbot.storage import StorageAdapter
class StorageAdapterTestCase(TestCase):
"""
This test case is for the StorageAdapter base class.
Although this class is not intended for direct use,
this test case ensures that exceptions requiring
basic functionality are ... | bsd-3-clause | Python |
1f5c289675c89c4c9bec87032a92dd38a08dfda7 | Tag new release: 2.9.0 | Floobits/floobits-sublime,Floobits/floobits-sublime | floo/version.py | floo/version.py | PLUGIN_VERSION = '2.9.0'
# The line above is auto-generated by tag_release.py. Do not change it manually.
try:
from .common import shared as G
assert G
except ImportError:
from common import shared as G
G.__VERSION__ = '0.11'
G.__PLUGIN_VERSION__ = PLUGIN_VERSION
| PLUGIN_VERSION = '2.8.7'
# The line above is auto-generated by tag_release.py. Do not change it manually.
try:
from .common import shared as G
assert G
except ImportError:
from common import shared as G
G.__VERSION__ = '0.11'
G.__PLUGIN_VERSION__ = PLUGIN_VERSION
| apache-2.0 | Python |
c47fc4f53208a7b696c29834e01f83e49b204393 | clean up leftover test in threaded backend | Duroktar/Kuai | kuai/backends/threaded.py | kuai/backends/threaded.py | from collections import namedtuple, defaultdict
import threading
import queue
from atexit import register
from kuai.backends import WeakCallback, Singleton, singleton_object
@singleton_object
class ThreadedBackend(metaclass=Singleton):
handlers = defaultdict(set)
events = queue.Queue()
isRunning = False
... | from collections import namedtuple, defaultdict
import threading
import queue
from atexit import register
from kuai.backends import WeakCallback, Singleton, singleton_object
@singleton_object
class ThreadedBackend(metaclass=Singleton):
handlers = defaultdict(set)
events = queue.Queue()
isRunning = False
... | mit | Python |
e8ec2ad3c229e791e4afdad705928d956fc5a7b9 | bump ver | aio-libs/aiobotocore | aiobotocore/__init__.py | aiobotocore/__init__.py | from .session import get_session, AioSession
__all__ = ['get_session', 'AioSession']
__version__ = '0.4.0'
| from .session import get_session, AioSession
__all__ = ['get_session', 'AioSession']
__version__ = '0.3.4a0'
| apache-2.0 | Python |
c4e830042c0fff0ab95b0676d0ef98933b27b9e5 | Add SSM::Parameter | 7digital/troposphere,cloudtools/troposphere,horacio3/troposphere,ikben/troposphere,pas256/troposphere,cloudtools/troposphere,johnctitus/troposphere,7digital/troposphere,horacio3/troposphere,johnctitus/troposphere,pas256/troposphere,ikben/troposphere | troposphere/ssm.py | troposphere/ssm.py | # Copyright (c) 2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
class Targets(AWSProperty):
props = {
'Key': (basestring, True),
'Values': ([basestring], True),
}
class Association(AWSObject):
resource_ty... | # Copyright (c) 2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
class Targets(AWSProperty):
props = {
'Key': (basestring, True),
'Values': ([basestring], True),
}
class Association(AWSObject):
resource_ty... | bsd-2-clause | Python |
443efd9edf2361bec6e22c6eb2d24473619acb9b | Remove an unused variable | mineo/lala,mineo/lala | lala/plugins/httptitle.py | lala/plugins/httptitle.py | import logging
import re
import HTMLParser
from lala.util import regex, msg
from twisted.web.client import getPage
from twisted.internet.defer import inlineCallbacks, returnValue
_regex = re.compile("(https?://.+)\s?")
def unescape(s):
p = HTMLParser.HTMLParser()
return p.unescape(s)
@regex(_regex)
@inlin... | import logging
import re
import HTMLParser
from lala.util import regex, msg
from twisted.web.client import getPage
from twisted.internet.defer import inlineCallbacks, returnValue
_regex = re.compile("(https?://.+)\s?")
_ua = "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b8) Gecko/20100101 Firefox/4.0b8"
def unescape(s):
... | mit | Python |
17bd461d5ce7b1dcf8b6d8880e9c780cc571475e | Bump version; 0.1.4.dev2 | treasure-data/td-client-python | tdclient/version.py | tdclient/version.py | __version__ = "0.1.4.dev2"
| __version__ = "0.1.4.dev1"
| apache-2.0 | Python |
28feb237d596f2647ab641190073e6e994560d3b | Monitor multiple sensors. | basilfx/LPC810-FanController,basilfx/LPC810-FanController,basilfx/LPC810-FanController | contrib/pid_plot.py | contrib/pid_plot.py | import argparse
import time
import sys
import matplotlib.pyplot as plot
def main():
"""
Monitor stdin for incoming data and parse it. When the stream closes, the
graph will be plotted.
Format of data: i,temperature_i,target_i,speed_i,pid_i,...,max_speed
"""
# Gather data
start = time.tim... | import argparse
import time
import sys
import matplotlib.pyplot as plot
def main():
"""
Monitor stdin for incoming data and parse it. When the stream closes, the
graph will be plotted.
Format of incoming data: time,current,target,control.
"""
# Gather data
start = time.time()
data = ... | mit | Python |
dea4b8b61b6ab676aaf5a50de02e029537a85139 | Add RunColormem | erykoff/redmapper,erykoff/redmapper | redmapper/__init__.py | redmapper/__init__.py | from __future__ import division, absolute_import, print_function
from ._version import __version__, __version_info__
version = __version__
from .configuration import Configuration
from .runcat import RunCatalog
from .solver_nfw import Solver
from .catalog import DataObject, Entry, Catalog
from .redsequence import Re... | from __future__ import division, absolute_import, print_function
from ._version import __version__, __version_info__
version = __version__
from .configuration import Configuration
from .runcat import RunCatalog
from .solver_nfw import Solver
from .catalog import DataObject, Entry, Catalog
from .redsequence import Re... | apache-2.0 | Python |
4492c76435363cc107a998a2221d42caa51e3366 | make style labels generic | mrahnis/surficial | surficial/cli/defaults.py | surficial/cli/defaults.py | styles = {
"line1": {
"color": "black",
"linestyle": "-",
"linewidth": 1.2,
"alpha": 0.3,
"label": "line1"
},
"line2": {
"color": "blue",
"linestyle": "-",
"linewidth": 1.4,
"alpha": 1.0,
"label": "line2"
},
"line3": {
... | styles = {
"line1": {
"color": "black",
"linestyle": "-",
"linewidth": 1.2,
"alpha": 0.3,
"label": "stream raw"
},
"line2": {
"color": "blue",
"linestyle": "-",
"linewidth": 1.4,
"alpha": 1.0,
"label": "stream de-spiked"
},
... | bsd-3-clause | Python |
2bd2409bd7a58781a75601bfb99e2a426cbd832e | Add login/logout views | DZwell/learning_journal,DZwell/learning_journal,DZwell/learning_journal | learning_journal/views.py | learning_journal/views.py | from pyramid.response import Response
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from .form import JournalForm
from sqlalchemy.exc import DBAPIError
import transaction
from pyramid.security import remember, forget
from .models import (
DBSession,
Entry,
)
@view_con... | from pyramid.response import Response
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from .form import JournalForm
from sqlalchemy.exc import DBAPIError
import transaction
from .models import (
DBSession,
Entry,
)
@view_config(route_name='home', renderer='templates/li... | mit | Python |
bfa05628cbb3f714ec6eca1fffc60fffc77ec530 | Add 1.7.3 | LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/pkgconf/package.py | var/spack/repos/builtin/packages/pkgconf/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pkgconf(AutotoolsPackage):
"""pkgconf is a program which helps to configure compiler and l... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pkgconf(AutotoolsPackage):
"""pkgconf is a program which helps to configure compiler and l... | lgpl-2.1 | Python |
6793f3fd55131ead5a931b96bbc8f0c2c8a4bfad | add version 1.1.0.1 to r-later (#21066) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-later/package.py | var/spack/repos/builtin/packages/r-later/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RLater(RPackage):
"""Utilities for Scheduling Functions to Execute Later with Event Loops
... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RLater(RPackage):
"""Executes arbitrary R or C functions some time after the current time,... | lgpl-2.1 | Python |
999044033b50f15e267df6699106409da50f972c | add 0.3.8 (#26966) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-vctrs/package.py | var/spack/repos/builtin/packages/r-vctrs/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RVctrs(RPackage):
"""Vector Helpers
Defines new notions of prototype and size that ar... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RVctrs(RPackage):
"""Vector Helpers
Defines new notions of prototype and size that ar... | lgpl-2.1 | Python |
8c1408d4c7db373f493167601c1641372d9bc060 | Set stream to stdout | stevepiercy/cookiecutter,terryjbates/cookiecutter,stevepiercy/cookiecutter,audreyr/cookiecutter,dajose/cookiecutter,luzfcb/cookiecutter,hackebrot/cookiecutter,pjbull/cookiecutter,terryjbates/cookiecutter,dajose/cookiecutter,audreyr/cookiecutter,pjbull/cookiecutter,michaeljoseph/cookiecutter,hackebrot/cookiecutter,luzfc... | cookiecutter/log.py | cookiecutter/log.py | # -*- coding: utf-8 -*-
import logging
import sys
LOG_LEVELS = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL,
}
LOG_FORMATS = {
'DEBUG': u'%(levelname)s [%(template)s] %(name)s: %(message)s',
'INFO': u'%(le... | # -*- coding: utf-8 -*-
import logging
LOG_LEVELS = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL,
}
LOG_FORMATS = {
'DEBUG': u'%(levelname)s [%(template)s] %(name)s: %(message)s',
'INFO': u'%(levelname)s: ... | bsd-3-clause | Python |
70d6c38c998f87acf1064998926fb85cf486ec7b | Remove linebreak from doc string in log.py | luzfcb/cookiecutter,audreyr/cookiecutter,pjbull/cookiecutter,pjbull/cookiecutter,audreyr/cookiecutter,hackebrot/cookiecutter,michaeljoseph/cookiecutter,hackebrot/cookiecutter,luzfcb/cookiecutter,michaeljoseph/cookiecutter | cookiecutter/log.py | cookiecutter/log.py | # -*- coding: utf-8 -*-
"""Module for setting up logging."""
import logging
import sys
LOG_LEVELS = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL,
}
LOG_FORMATS = {
'DEBUG': u'%(levelname)s %(name)s: %(message... | # -*- coding: utf-8 -*-
"""Module for setting up logging."""
import logging
import sys
LOG_LEVELS = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL,
}
LOG_FORMATS = {
'DEBUG': u'%(levelname)s %(name)s: %(message... | bsd-3-clause | Python |
1dcfc999578e3bbcb4bbfc7f622247449b6edda7 | Fix typos | iheanyi/bandcamp-dl,Mixbo/bandcamp-dl | bandcamp-dl/bandcamp-dl.py | bandcamp-dl/bandcamp-dl.py | #!/usr/bin/python
"""bandcamp-dl
Usage:
bandcamp-dl.py <url>
bandcamp-dl.py [--template=<template>] [--base-dir=<dir>]
[--full-album]
(<url> | --artist=<artist> --album=<album>)
[--overwrite]
bandcamp-dl.py (-h | --help)
bandcamp-dl.py (--version)
Options:
... | #!/usr/bin/python
"""bandcamp-dl
Usage:
bandcamp-dl.py <url>
bandcamp-dl.py [--template=<template>] [--base-dir=<dir>]
[--full-album]
(<url> | --artist=<artist> --album=<album>)
[--overwrite]
bandcamp-dl.py (-h | --help)
bandcamp-dl.py (--version)
Options:
... | unlicense | Python |
193fbb0f5ca02e76cec159defdd56225ae12eebb | Make directory listings and ".html"-less source code URLs work. | pombredanne/dxr,jonasfj/dxr,kleintom/dxr,nrc/dxr,erikrose/dxr,jbradberry/dxr,KiemVM/Mozilla--dxr,jay-z007/dxr,gartung/dxr,jay-z007/dxr,gartung/dxr,nrc/dxr,pelmers/dxr,jay-z007/dxr,kleintom/dxr,gartung/dxr,jonasfj/dxr,bozzmob/dxr,srenatus/dxr,bozzmob/dxr,srenatus/dxr,jay-z007/dxr,kleintom/dxr,pombredanne/dxr,nrc/dxr,Kie... | dxr/app.py | dxr/app.py | import os.path
from os.path import isdir
from flask import Blueprint, Flask, send_from_directory, current_app, send_file
# Look in the 'dxr' package for static files, templates, etc.:
dxr_blueprint = Blueprint('dxr_blueprint', 'dxr')
def make_app(instance_folder):
"""Return a DXR application which looks in the... | import os.path
from flask import Blueprint, Flask, send_from_directory, current_app, send_file
# Look in the 'dxr' package for static files, templates, etc.:
dxr_blueprint = Blueprint('dxr_blueprint', 'dxr')
def make_app(instance_folder):
"""Return a DXR application which looks in the given folder for
conf... | mit | Python |
67b243915ef95ff1b9337bc67053d18df372e79d | Add PSMPlayer and SamsungTVPlayer platforms | andburn/python-unitypack | unitypack/enums.py | unitypack/enums.py | from enum import IntEnum
class RuntimePlatform(IntEnum):
OSXEditor = 0
OSXPlayer = 1
WindowsPlayer = 2
OSXWebPlayer = 3
OSXDashboardPlayer = 4
WindowsWebPlayer = 5
WindowsEditor = 7
IPhonePlayer = 8
PS3 = 9
XBOX360 = 10
Android = 11
NaCl = 12
LinuxPlayer = 13
FlashPlayer = 15
WebGLPlayer = 17
MetroPla... | from enum import IntEnum
class RuntimePlatform(IntEnum):
OSXEditor = 0
OSXPlayer = 1
WindowsPlayer = 2
OSXWebPlayer = 3
OSXDashboardPlayer = 4
WindowsWebPlayer = 5
WindowsEditor = 7
IPhonePlayer = 8
PS3 = 9
XBOX360 = 10
Android = 11
NaCl = 12
LinuxPlayer = 13
FlashPlayer = 15
WebGLPlayer = 17
MetroPla... | mit | Python |
d49f4bf99255825ef9f40f11094863e1e6c1b275 | Enable learning switch mode in default topo. | stevenvanrossem/son-emu,stevenvanrossem/son-emu,stevenvanrossem/son-emu,stevenvanrossem/son-emu | src/emuvim/examples/default_single_dc_topology.py | src/emuvim/examples/default_single_dc_topology.py | """
Copyright (c) 2017 SONATA-NFV and Paderborn University
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 ap... | """
Copyright (c) 2017 SONATA-NFV and Paderborn University
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 ap... | apache-2.0 | Python |
76b466fa40dda7f675bb687b9d994fe3fde8f65f | Update Motorized_Focus_Camera_Preview.py | ArduCAM/RaspberryPi,ArduCAM/RaspberryPi,ArduCAM/RaspberryPi,ArduCAM/RaspberryPi | Motorized_Focus_Camera/Motorized_Focus_Camera_Preview.py | Motorized_Focus_Camera/Motorized_Focus_Camera_Preview.py |
import os
import time
import sys
import threading
import pygame,sys
from pygame.locals import *
from time import ctime, sleep
pygame.init()
screen=pygame.display.set_mode((320,240),0,32)
pygame.key.set_repeat(100)
def runFocus(func):
temp_val = 512
while True:
for event in pygame.event.get():
if event.type ==KEY... |
import os
import time
import sys
import threading
import pygame,sys
from pygame.locals import *
from time import ctime, sleep
pygame.init()
screen=pygame.display.set_mode((320,240),0,32)
pygame.key.set_repeat(100)
def runFocus(func):
temp_val = 512
while True:
for event in pygame.event.get():
if event.type ==KEY... | bsd-3-clause | Python |
81fd70ce979d1813b9927f8d6629119659840e9c | Clean up and document manage.py setup task | taarifa/taarifa_backend,taarifa/taarifa_backend,taarifa/taarifa_backend,taarifa/taarifa_backend | taarifa_backend/manage.py | taarifa_backend/manage.py | # Set the path
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from flask.ext.script import Manager, Server
from taarifa_backend import app
from taarifa_backend.models import clear_database, Role, User
manager = Manager(app)
# Turn on debugger by default and relo... | # Set the path
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from flask.ext.script import Manager, Server
from taarifa_backend import app
from taarifa_backend.models import clear_database, Role, User
manager = Manager(app)
# Turn on debugger by default and relo... | bsd-3-clause | Python |
d72a3549279ebf21679444ca6606a952880757a9 | Fix typo on function alias on domains/__init__.py file. | dayatz/taiga-back,obimod/taiga-back,joshisa/taiga-back,dycodedev/taiga-back,astronaut1712/taiga-back,forging2012/taiga-back,dycodedev/taiga-back,astronaut1712/taiga-back,forging2012/taiga-back,frt-arch/taiga-back,Tigerwhit4/taiga-back,gam-phon/taiga-back,Rademade/taiga-back,seanchen/taiga-back,obimod/taiga-back,coopsou... | taiga/domains/__init__.py | taiga/domains/__init__.py | # Copyright 2014 Andrey Antukh <niwi@niwi.be>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# y ou 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... | # Copyright 2014 Andrey Antukh <niwi@niwi.be>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# y ou 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... | agpl-3.0 | Python |
2ab1d327a7ad1416cdb7a39f3558bd56334f81b8 | work on py26 | mrocklin/blaze,scls19fr/blaze,ContinuumIO/blaze,jcrist/blaze,alexmojaki/blaze,caseyclements/blaze,scls19fr/blaze,nkhuyu/blaze,cowlicks/blaze,maxalbert/blaze,nkhuyu/blaze,xlhtc007/blaze,xlhtc007/blaze,dwillmer/blaze,cowlicks/blaze,LiaoPan/blaze,dwillmer/blaze,ChinaQuants/blaze,jdmcbr/blaze,jdmcbr/blaze,alexmojaki/blaze,... | blaze/data/pandas_dtype.py | blaze/data/pandas_dtype.py | import numpy as np
from datashape import *
def unit_to_dtype(ds):
"""
>>> unit_to_dtype('int32')
dtype('int32')
>>> unit_to_dtype('float64')
dtype('float64')
>>> unit_to_dtype('?int64')
dtype('float64')
>>> unit_to_dtype('string')
dtype('O')
"""
if isinstance(ds, str):
... | import numpy as np
from datashape import *
def unit_to_dtype(ds):
"""
>>> unit_to_dtype('int32')
dtype('int32')
>>> unit_to_dtype('float64')
dtype('float64')
>>> unit_to_dtype('?int64')
dtype('float64')
>>> unit_to_dtype('string')
dtype('O')
"""
if isinstance(ds, str):
... | bsd-3-clause | Python |
c4de9152f34d2831d43dfa3769a7a6452bba5814 | Update method to check both username and password | mattstibbs/blockbuster-server,mattstibbs/blockbuster-server | blockbuster/bb_security.py | blockbuster/bb_security.py | __author__ = 'matt'
from blockbuster import bb_dbconnector_factory
def credentials_are_valid(username, password):
db = bb_dbconnector_factory.DBConnectorInterfaceFactory().create()
print(username)
result = db.api_credentials_are_valid(username, password)
print (result)
return result
| __author__ = 'matt'
from blockbuster import bb_dbconnector_factory
def credentials_are_valid(username, password):
db = bb_dbconnector_factory.DBConnectorInterfaceFactory().create()
print(username)
result = db.api_username_exists(username)
print (result)
return result
| mit | Python |
4446aaed8cd88900b0880c08a1bcbca301ab5962 | fix variable name | bashu/django-simple-currencies,bashu/django-simple-currencies | currencies/views.py | currencies/views.py | # -*- coding: utf-8 -*-
from django.utils.http import is_safe_url
from django.http import HttpResponseRedirect
from django.views.decorators.cache import never_cache
from .models import Currency
from .conf import SESSION_KEY
@never_cache
def set_currency(request):
next, currency_code = (
request.REQUEST.... | # -*- coding: utf-8 -*-
from django.utils.http import is_safe_url
from django.http import HttpResponseRedirect
from django.views.decorators.cache import never_cache
from .models import Currency
from .conf import SESSION_KEY
@never_cache
def set_currency(request):
next, currency_code = (
request.REQUEST.... | bsd-3-clause | Python |
5a93548bdcb5cf9d7cbd7c4a7c275124115f38aa | Implement StartNode and RelNode classes for start lookups | akubera/cypher,bruth/cypher | cypher/functions.py | cypher/functions.py | from __future__ import unicode_literals, absolute_import
from .token import Token
from .syntax import Identifier, Value
from .utils import delimit
try:
str = unicode
except NameError:
pass
COALESCE = Token('coalesce')
TIMESTAMP = Token('timestamp')
ID = Token('id')
STR = Token('str')
REPLACE = Token('replac... | from __future__ import unicode_literals, absolute_import
from .token import Token
COALESCE = Token('coalesce')
TIMESTAMP = Token('timestamp')
ID = Token('id')
STR = Token('str')
REPLACE = Token('replace')
SUBSTRING = Token('substring')
LEFT = Token('left')
TRIM = Token('trim')
UPPER = Token('upper')
ABS = Token('abs... | bsd-2-clause | Python |
42e2a3d7d3cb76eb03cc2ba4411eaed8d3113b13 | fix indexing of keys python 2=>3 in vanity router | mozilla-iam/sso-dashboard,mozilla-iam/sso-dashboard,mozilla-iam/sso-dashboard,mozilla-iam/sso-dashboard | dashboard/vanity.py | dashboard/vanity.py | from flask import make_response
from flask import redirect
from flask import request
from op import yaml_loader
class Router(object):
def __init__(self, app):
self.app = app
self.url_list = yaml_loader.Application().vanity_urls()
def setup(self):
for url in self.url_list:
... | from flask import make_response
from flask import redirect
from flask import request
from op import yaml_loader
class Router(object):
def __init__(self, app):
self.app = app
self.url_list = yaml_loader.Application().vanity_urls()
def setup(self):
for url in self.url_list:
... | mpl-2.0 | Python |
ac8624db1f79a91c613588e7e16fed348dadd7ed | Update binary.py | shreydan/Python | code/Algorithms/Searching/binary.py | code/Algorithms/Searching/binary.py | # binary search
def binary(srchlist,srch):
"""list needs to be in ascending order to search for element"""
first = 0
last = len(srchlist)-1
while first <= last:
mid = (first + last)/2
if srch > srchlist[mid]:
first = mid+1
elif srch < srchlist[mid]:
last = mid-1
else:
return mid
return -1
| # binary search
def binary(srchlist,srch):
"""list needs to be in ascending order to search for element"""
first = 0
last = len(srchlist)-1
while first <= last:
mid = (first + last)/2
if srch > srchlist[mid]:
first = mid+1
elif srch < srchlist[mid]:
last = mid-1
else:
return mid
break
retu... | mit | Python |
098fcd313c6d6761ff9e510a63b9f111a39da2db | Add comments | bowen0701/algorithms_data_structures | alg_bfs.py | alg_bfs.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def bfs(graph_adj_d, v_start):
"""Breadth first search (BFS) algorithm in graph G(V, E)
with single source by iteration using queue.
Note:
- There is no intuitive way to combine BFS & recurs... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def bfs(graph_adj_d, v_start):
"""Breadth first search (BFS) algorithm in graph G(V, E)
with single source by iteration using queue.
Note:
- There is no intuitive way to combine BFS & recurs... | bsd-2-clause | Python |
dbd92b712781553866603d7e0a5f116d24039d14 | Change default profile iteration to 1 | odedlaz/uberlogs,odedlaz/uberlogs | profile.py | profile.py | from __future__ import print_function
import os
import sys
import time
from six.moves import range
from collections import namedtuple
import logging
import uberlogs
uberlogs.install()
logger = uberlogs.getLogger("test")
std_logger = logging.getLogger("stdtest")
Person = namedtuple('Person', ['name', 'age'])
p = Pers... | from __future__ import print_function
import os
import sys
import time
from six.moves import range
from collections import namedtuple
import uberlogs
uberlogs.install()
logger = uberlogs.getLogger("test")
Person = namedtuple('Person', ['name', 'age'])
p = Person(name="oded", age=26)
starttime = time.time()
for _... | mit | Python |
b28a40e38f0cbd40e01906063b97731ba6cd3fb6 | Add VM valid profile model | PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature | backend/geonature/core/gn_profiles/models.py | backend/geonature/core/gn_profiles/models.py | from flask import current_app
from geoalchemy2 import Geometry
from utils_flask_sqla.serializers import serializable
from utils_flask_sqla_geo.serializers import geoserializable
from geonature.utils.env import DB
@serializable
class VmCorTaxonPhenology(DB.Model):
__tablename__ = "vm_cor_taxon_phenology"
__ta... | from geonature.utils.env import DB
from utils_flask_sqla.serializers import serializable
@serializable
class VmCorTaxonPhenology(DB.Model):
__tablename__ = "vm_cor_taxon_phenology"
__table_args__ = {"schema": "gn_profiles"}
cd_ref = DB.Column(DB.Integer, primary_key=True)
period = DB.Column(DB.Integer)... | bsd-2-clause | Python |
d0b0bd2d808857c1c9c4a927d809526016349492 | add CreateProjectSerializer | unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal | backend/unpp_api/apps/project/serializers.py | backend/unpp_api/apps/project/serializers.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import transaction
from rest_framework import serializers
from agency.serializers import AgencySerializer
from common.serializers import ConfigSectorSerializer, PointSerializer
from common.models import Sector, Point
from .models import EOI
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework import serializers
from agency.serializers import AgencySerializer
from common.serializers import ConfigSectorSerializer
from common.models import Sector
from .models import EOI
class BaseProjectSerializer(serializers.ModelSerializer)... | apache-2.0 | Python |
b9470cc0dcf826ce0dd7a3d3c0080930bc951e29 | fix bad reference to moved test module | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/icds_reports/management/commands/populate_local_db_with_icds_dashboard_test_data.py | custom/icds_reports/management/commands/populate_local_db_with_icds_dashboard_test_data.py |
from django.core.management.base import BaseCommand, CommandError
from psycopg2._psycopg import IntegrityError
import settings
from custom.icds_reports.tests import agg_tests
class Command(BaseCommand):
help = "Populates your local database with test data for the dashboard."
def handle(self, *args, **optio... |
from django.core.management.base import BaseCommand, CommandError
from psycopg2._psycopg import IntegrityError
import settings
from custom.icds_reports import tests as icds_tests
class Command(BaseCommand):
help = "Populates your local database with test data for the dashboard."
def handle(self, *args, **o... | bsd-3-clause | Python |
80531076a713618cda6de815bdd6675bdf6f85f1 | Use client_name instead of schema_name | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/clients/management/commands/export_tenants.py | bluebottle/clients/management/commands/export_tenants.py | import json
from rest_framework.authtoken.models import Token
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from bluebottle.clients import properties
from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
class C... | import json
from rest_framework.authtoken.models import Token
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from bluebottle.clients import properties
from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
class C... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.