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 |
|---|---|---|---|---|---|---|---|---|
afacc8f00c45a85afac3d5c2a35f296f7df11fc4 | normalize data, get VP18KWT data | vitbaisa/pycts602 | pycts602api.py | pycts602api.py | #!/usr/bin/env python
#coding=utf-8
__author__ = 'Vit Baisa'
import time
import serial
import struct
import minimalmodbus
from cts602_registers import registers
class CTS602API(minimalmodbus.Instrument):
def __init__(self, portname='/dev/ttyUSB0', slaveaddr=30):
minimalmodbus.Instrument.__init__(self, p... | #!/usr/bin/env python
#coding=utf-8
__author__ = 'Vit Baisa'
import time
import serial
import struct
import minimalmodbus
from cts602_registers import registers
class CTS602API(minimalmodbus.Instrument):
def __init__(self, portname, slaveaddr=30):
minimalmodbus.Instrument.__init__(self, portname, slavea... | mit | Python |
f390dc6d100a97bcf8cffdceedc2a8b6b74c594e | fix indent | emre/usta | usta/server.py | usta/server.py |
import os
import os.path
from flask import Flask, request
from werkzeug import secure_filename
from clint.textui import puts, indent, colored
from gevent.wsgi import WSGIServer
from utils import (get_config, get_cli_arguments, check_auth, allowed_file, get_available_filename, get_config_filename)
def get_app(usta_... |
import os
import os.path
from flask import Flask, request
from werkzeug import secure_filename
from clint.textui import puts, indent, colored
from gevent.wsgi import WSGIServer
from utils import (get_config, get_cli_arguments, check_auth, allowed_file, get_available_filename, get_config_filename)
def get_app(usta_... | mit | Python |
6844917fb51e9d24de130fd4728053d62c7946da | define colors.clear as 38 | nathants/py-util | util/colors.py | util/colors.py | import sys
import os
force = 'COLORS' in os.environ
def _make_color(code, text):
if force or sys.stdout.isatty():
return "\033[{}m{}\033[0m".format(code, text)
else:
return text
clear = lambda text: _make_color(38, text)
red = lambda text: _make_color(31, text)
green = lambda text: _m... | import sys
import os
force = 'COLORS' in os.environ
def _make_color(code, text):
if force or sys.stdout.isatty():
return "\033[{}m{}\033[0m".format(code, text)
else:
return text
red = lambda text: _make_color(31, text)
green = lambda text: _make_color(32, text)
yellow = lambda text: _m... | mit | Python |
f97da02e11ce7eabfa86c87198e254bfb4d1e4c6 | Create a new Query.Log entry for each successful query. | cdubz/rdap-explorer,cdubz/rdap-explorer | query/views.py | query/views.py | """
Views for the rdap_explorer project, query app.
"""
import ipwhois
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import csrf_protect
from json import dumps
from... | """
Views for the rdap_explorer project, query app.
"""
import ipwhois
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import csrf_protect
from json import dumps
from... | mit | Python |
1d07bcd8a953b477275175b754d054a584dcdbcf | Modify crawler to save name of user who contributed an entry | RolandR/place-atlas,RolandR/place-atlas,RolandR/place-atlas,RolandR/place-atlas | redditcrawl.py | redditcrawl.py |
#6y7LtOjoNEfe72g62kZfwtFHMWkQ8XsZvcQ8xZDe
import praw
outfile = open('temp.js', 'w')
credentials = open('credentials', 'r')
client_id = credentials.readline().strip(' \t\n\r')
client_secret = credentials.readline().strip(' \t\n\r')
startId = 466
reddit = praw.Reddit(client_id=client_id, client_secret=client_secre... |
#6y7LtOjoNEfe72g62kZfwtFHMWkQ8XsZvcQ8xZDe
import praw
outfile = open('temp.js', 'w')
credentials = open('credentials', 'r')
client_id = credentials.readline().strip(' \t\n\r')
client_secret = credentials.readline().strip(' \t\n\r')
startId = 466
reddit = praw.Reddit(client_id=client_id, client_secret=client_secre... | agpl-3.0 | Python |
f3b3ad940446d1e0098a52c4a872b2f1e9270fd7 | Send response after update | UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario | plenario/update.py | plenario/update.py | from flask import Flask, abort
import plenario.tasks as tasks
from plenario.tasks import celery_app
"""
Task server that runs in AWS Elastic Beanstalk worker environment.
Takes POST requests for cron-scheduled tasks.
Posts most of them to the Celery queue living on Redis,
but also runs METAR updates right away.
"""
... | from flask import Flask, abort
import plenario.tasks as tasks
from plenario.tasks import celery_app
"""
Task server that runs in AWS Elastic Beanstalk worker environment.
Takes POST requests for cron-scheduled tasks.
Posts most of them to the Celery queue living on Redis,
but also runs METAR updates right away.
"""
... | mit | Python |
ed01fcf7c993b9e8454e22a6e8162a2fd97fef89 | Add proper header. | Storj/plowshare-wrapper | plowshare/hosts.py | plowshare/hosts.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014 Storj Labs
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including witho... | anonymous = [
"euroshare_eu",
"ge_tt",
"gfile_ru",
"multiupload",
"rghost",
"zalil_ru"
]
| mit | Python |
c11a9dab9c514dd21bd2a24ca3da533a7f7756b4 | fix bug in float parsing | sorki/pllm,sorki/pllm | pllm/config.py | pllm/config.py | import os
import ConfigParser
version = "0.0"
bindir = "/usr/bin"
sysconfdir = "/etc"
prefix = "/usr"
datadir = "/usr/share"
libdir = "/usr/lib64"
def config_parser():
config = ConfigParser.SafeConfigParser()
config_list = [os.path.join(sysconfdir, "pllm", "config"),
os.path.expanduser("~/... | import os
import ConfigParser
version = "0.0"
bindir = "/usr/bin"
sysconfdir = "/etc"
prefix = "/usr"
datadir = "/usr/share"
libdir = "/usr/lib64"
def config_parser():
config = ConfigParser.SafeConfigParser()
config_list = [os.path.join(sysconfdir, "pllm", "config"),
os.path.expanduser("~/... | bsd-3-clause | Python |
e0d7397716917dd1b1a8d4a45b9a8e3fb934b39d | add null_safe and only debugprint when change | abhiii5459/sympy,drufat/sympy,sunny94/temp,Vishluck/sympy,shikil/sympy,ahhda/sympy,meghana1995/sympy,kumarkrishna/sympy,abloomston/sympy,AunShiLord/sympy,cswiercz/sympy,hrashk/sympy,dqnykamp/sympy,shipci/sympy,sahilshekhawat/sympy,lidavidm/sympy,meghana1995/sympy,postvakje/sympy,beni55/sympy,kaushik94/sympy,atsao72/sym... | sympy/rr/strat_pure.py | sympy/rr/strat_pure.py | # Generic strategies. No dependence on SymPy
def exhaust(rule):
def exhaustive_rl(expr):
new, old = rule(expr), expr
while(new != old):
new, old = rule(new), new
return new
return exhaustive_rl
def memoize(rule):
cache = {}
def memoized_rl(expr):
if expr in ... | # Generic strategies. No dependence on SymPy
def exhaust(rule):
def exhaustive_rl(expr):
new, old = rule(expr), expr
while(new != old):
new, old = rule(new), new
return new
return exhaustive_rl
def memoize(rule):
cache = {}
def memoized_rl(expr):
if expr in ... | bsd-3-clause | Python |
26c0b82442fd1a6e9f9c7af59d08da49248933e7 | Fix spd migrations | liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator | src/adhocracy_spd/adhocracy_spd/evolution/__init__.py | src/adhocracy_spd/adhocracy_spd/evolution/__init__.py | """Scripts to migrate legacy objects in existing databases."""
import logging # pragma: no cover
from adhocracy_core.evolution import log_migration
from adhocracy_core.evolution import migrate_new_sheet
logger = logging.getLogger(__name__) # pragma: no cover
@log_migration
def remove_spd_workflow_assignment_sheet... | """Scripts to migrate legacy objects in existing databases."""
import logging # pragma: no cover
from adhocracy_core.evolution import log_migration
from adhocracy_core.evolution import migrate_new_sheet
logger = logging.getLogger(__name__) # pragma: no cover
@log_migration
def remove_spd_workflow_assignment_sheet... | agpl-3.0 | Python |
95205d0f5ec757de507ab9505bd6da05cc1014aa | comment changes | rmcminn/Portfolio,rmcminn/Portfolio,rmcminn/Portfolio | portfolio/index.py | portfolio/index.py | import logging
import os
from flask import Flask, redirect, render_template, request, url_for
from flask_sslify import SSLify
app = Flask(__name__)
sslify = SSLify(app, permanent=True)
# Page Routes
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html')
# File Routes
@app.route... | import logging
import os
from flask import Flask, redirect, render_template, request, url_for
from flask_sslify import SSLify
app = Flask(__name__)
sslify = SSLify(app, permanent=True)
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html')
# Files
@app.route('/sitemap.xml')
def... | mit | Python |
dbdba349ec3230690236367d7979c6690098f137 | add debug flag to config. | EsriOceans/btm | Install/toolbox/scripts/config.py | Install/toolbox/scripts/config.py | import os
# current directory
local_path = os.path.dirname(__file__)
# default mode for tools. Expect them to be run from a Python toolbox,
# not the command line by default.
mode = 'toolbox'
# debug mode, enables extra logging
debug = False
| import os
# current directory
local_path = os.path.dirname(__file__)
# default mode for tools. Expect them to be run from a Python toolbox,
# not the command line by default.
mode = 'toolbox'
| mpl-2.0 | Python |
464ad98b3611b2a5daebe1bb75352f930408ccee | Add explicit export to connection.py to fix mypy error (#1063) | pynamodb/PynamoDB | pynamodb/connection/__init__.py | pynamodb/connection/__init__.py | """
PynamoDB lowest level connection
"""
from pynamodb.connection.base import Connection
from pynamodb.connection.table import TableConnection
__all__ = [
"Connection",
"TableConnection",
]
| """
PynamoDB lowest level connection
"""
from pynamodb.connection.base import Connection
from pynamodb.connection.table import TableConnection
| mit | Python |
e54fdb548c175e446bb2885ca000f00cf9045a49 | Order Provider by name | InternetSemLimites/PublicAPI,InternetSemLimites/PublicAPI,InternetSemLimites/PublicAPI | InternetSemLimites/core/models.py | InternetSemLimites/core/models.py | from django.db import models
class State(models.Model):
name = models.CharField('Nome', max_length=128)
abbr = models.CharField('Sigla', max_length=2)
def __str__(self):
return '{} ({})'.format(self.name, self.abbr)
class Meta:
ordering = ['name']
class Provider(models.Model):
... | from django.db import models
class State(models.Model):
name = models.CharField('Nome', max_length=128)
abbr = models.CharField('Sigla', max_length=2)
def __str__(self):
return '{} ({})'.format(self.name, self.abbr)
class Meta:
ordering = ['name']
class Provider(models.Model):
... | mit | Python |
f84b9d02599279ed70c226dbbd02c975663f577b | Update P01_allMyCats1.py added docstring and wrapped in main() function | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | pythontutorials/books/AutomateTheBoringStuffWithPython/Chapter04/P01_allMyCats1.py | pythontutorials/books/AutomateTheBoringStuffWithPython/Chapter04/P01_allMyCats1.py | """All my cats 1.0
This program inefficiently showcases your cats by prompting for user input for each cat.
"""
def main():
print('Enter the name of cat 1: ')
catName1 = input()
print('Enter the name of cat 2: ')
catName2 = input()
print('Enter the name of cat 3: ')
catName3 = input()
pr... | # This program inefficiently showcases your cats
print('Enter the name of cat 1: ')
catName1 = input()
print('Enter the name of cat 2: ')
catName2 = input()
print('Enter the name of cat 3: ')
catName3 = input()
print('Enter the name of cat 4: ')
catName4 = input()
print('Enter the name of cat 5: ')
catName5 = input()
p... | mit | Python |
a26f68ba907c6567b2c715969b000dce832a3fde | Set results per search to 2000 | todrobbins/lmgtdfy,opendata/lmgtdfy,todrobbins/lmgtdfy,opendata/lmgtdfy | opendata/settings_example.py | opendata/settings_example.py | BROKER_URL = 'amqp://guest:guest@localhost//'
CELERY_ACCEPT_CONTENT = ['json', 'pickle', ]
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangopr... | BROKER_URL = 'amqp://guest:guest@localhost//'
CELERY_ACCEPT_CONTENT = ['json', 'pickle', ]
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangopr... | mit | Python |
ba8fa5372c20c371b992186d4252d2119b7c4a0b | Make sure that use_tink_errors can be used with keyword arguments. | google/tink,google/tink,google/tink,google/tink,google/tink,google/tink,google/tink,google/tink | python/tink/core/_tink_error.py | python/tink/core/_tink_error.py | # Copyright 2019 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
6712fb0f17438111cfa5113893a9725f59041074 | update setup.py to all install | jack-oquin/python_tools | pressures/setup.py | pressures/setup.py | from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='pressures',
version='0.1.0',
description='Make blood pressure reports.',
long_description=readme,
author="Jack O'Quin",
author_email='... | from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='pressures',
version='0.1.0',
description='Make blood pressure reports.',
long_description=readme,
author="Jack O'Quin",
author_email='... | bsd-3-clause | Python |
5430d1d4f6a1d86929d15d5dc8221aea3e268d00 | Add error when curl is not installed | lukassnoek/ICON2017,lukassnoek/ICON2017 | download_data.py | download_data.py | """ This script downloads the data for the ICON2017 MVPA workshop
from Surfdrive (a data storage repository/drive from the
Dutch institute for IT in science/academia) using cURL,
which should be cross-platform. """
from __future__ import print_function
import subprocess
import os
import zipfile
import os.path as op
im... | """ This script downloads the data for the ICON2017 MVPA workshop
from Surfdrive (a data storage repository/drive from the
Dutch institute for IT in science/academia) using cURL,
which should be cross-platform. """
from __future__ import print_function
import subprocess
import os
import zipfile
import os.path as op
t... | mit | Python |
d215e4d675240cb07e9d8285aa1812de7da2327b | fix show error if static file not found | EndyKaufman/django-postgres-angularjs-blog,EndyKaufman/django-postgres-angularjs-blog,EndyKaufman/django-postgres-angularjs-blog,EndyKaufman/django-postgres-angularjs-blog | project/helpers.py | project/helpers.py | # -*- coding: utf-8 -*-
from django.core import serializers
from django.contrib.staticfiles.templatetags.staticfiles import static
import json
import inspect
def is_method(obj, name):
return hasattr(obj, name) and inspect.ismethod(getattr(obj, name))
def itemsToJsonObject(items):
json_items = serializers.se... | # -*- coding: utf-8 -*-
from django.core import serializers
from django.contrib.staticfiles.templatetags.staticfiles import static
import json
import inspect
def is_method(obj, name):
return hasattr(obj, name) and inspect.ismethod(getattr(obj, name))
def itemsToJsonObject(items):
json_items = serializers.se... | mit | Python |
58d5a025cb1fc967174f20be7262b11a1ffd8490 | Fix spacing in basic_check | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | scoring_engine/engine/basic_check.py | scoring_engine/engine/basic_check.py | class BasicCheck(object):
def __init__(self, service):
self.service = service
def properties(self):
return self.service.properties
def get_ip_address(self):
ip = [property_obj.value for property_obj in self.properties() if property_obj.name == 'IP Address']
if ip:
... | class BasicCheck(object):
def __init__(self, service):
self.service = service
def properties(self):
return self.service.properties
def get_ip_address(self):
ip = [property_obj.value for property_obj in self.properties() if property_obj.name == 'IP Address']
if ip:
... | mit | Python |
3c9f0620e79b44712335141619bfee73d0bca2f1 | Bump patch | egtaonline/quiesce | egta/__init__.py | egta/__init__.py | __version__ = '0.0.17'
| __version__ = '0.0.16'
| apache-2.0 | Python |
2f38ab91faa76abc61ba068b8713f70b8ff4ca3c | Bump version for hotfix | hangoutsbot/hangups | hangups/version.py | hangups/version.py | __version__ = '0.2.10.1'
| __version__ = '0.2.10'
| mit | Python |
8add180a5363e7b5bd6c505e4d367812ba3b024b | add optional support of id string schema validation | rockstar/puff | puff.py | puff.py | """A library for validating SQLAlchemy-jsonapi apis."""
import copy
from sqlalchemy.sql import sqltypes as types
_TYPE_MAP = {
types.Integer: 'integer',
types.String: 'string',
types.Boolean: 'boolean',
}
_BASE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'type': 'object',
... | """A library for validating SQLAlchemy-jsonapi apis."""
import copy
from sqlalchemy.sql import sqltypes as types
_TYPE_MAP = {
types.Integer: 'integer',
types.String: 'string',
types.Boolean: 'boolean',
}
_BASE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'type': 'object',
... | mit | Python |
04ea5c5292df41e3414c2387ae86a74ee0321026 | Fix HTTPS host-url | gustavofoa/blog.musicasparamissa.com.br,gustavofoa/blog.musicasparamissa.com.br,gustavofoa/blog.musicasparamissa.com.br,gustavofoa/blog.musicasparamissa.com.br | publishconf.py | publishconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'https://blog.musicasparamissa.com.br'
RELATIV... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'http://blog.musicasparamissa.com.br'
RELATIVE... | mit | Python |
f822dd45e5d2d982ad7d8b21a9684a2d80bdeed8 | update confusion matrix | justinhyou/GestureRecognition-CNN,justinhyou/GestureRecognition-CNN | confusion_matrix.py | confusion_matrix.py | import numpy as np
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import itertools
classes = np.array([1,2])
cm = np.array(([1,2],[0,1]))
plt.figure()
plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)
plt.colorbar()
tick_marks = np.arange(len(classes))
plt.xticks(tick_marks, class... | import matplotlib.pyplot as plt
import numpy as np
m = np.array([[1, 0, 0, 0], [0, 1, 1, 1], [0, 1, 0, 1], [1, 0, 0, 1]])
plt.matshow(m)
plt.colorbar()
plt.show()
| mit | Python |
51902f67b03fe255637df21ce5336889c8d98d17 | Update noise.py | zsdonghao/tensorlayer,zsdonghao/tensorlayer | tensorlayer/layers/noise.py | tensorlayer/layers/noise.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
import tensorlayer as tl
from tensorlayer import logging
from tensorlayer.decorators import deprecated_alias
from tensorlayer.layers.core import Layer
__all__ = [
'GaussianNoise',
]
class GaussianNoise(Layer):
"""
The :class:`GaussianNoi... | #! /usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
import tensorlayer as tl
from tensorlayer import logging
from tensorlayer.decorators import deprecated_alias
from tensorlayer.layers.core import Layer
__all__ = [
'GaussianNoise',
]
class GaussianNoise(Layer):
"""
The :class:`GaussianNoi... | apache-2.0 | Python |
7ebadc3a1befa265dfc65e78dfbe98041b96d076 | Update SERIAL_DEVICE to match the Raspberry Pi | zacharylawrence/ENEE408I-Team-9,zacharylawrence/ENEE408I-Team-9,zacharylawrence/ENEE408I-Team-9 | serial_com_test/raspberry_pi/test.py | serial_com_test/raspberry_pi/test.py | import serial
import time
# Define Constants
SERIAL_DEVICE = "/dev/ttyACM0"
# Establish Connection
ser = serial.Serial(SERIAL_DEVICE, 9600)
time.sleep(2)
print("Connection Established");
# Send Data to Pi
ser.write('h')
time.sleep(5);
ser.write('l')
| import serial
import time
# Define Constants
SERIAL_DEVICE = "/dev/tty.usbmodem1421"
# Establish Connection
ser = serial.Serial(SERIAL_DEVICE, 9600)
time.sleep(2)
print("Connection Established");
# Send Data to Pi
ser.write('h')
time.sleep(5);
ser.write('l')
| mit | Python |
d6ffeef8ce4ab8f93fd4c0ee7366d75d222c89be | Add default message. | not-nexus/shelf,kyle-long/pyshelf,kyle-long/pyshelf,not-nexus/shelf | pyshelf/app.py | pyshelf/app.py | import flask
from pyshelf.routes.artifact import artifact
import pyshelf.response_map as response_map
app = flask.Flask(__name__)
app.register_blueprint(artifact)
@app.errorhandler(Exception)
def generic_exception_handler(error):
if not error.message:
error.message = "Internal Server Error"
return res... | import flask
from pyshelf.routes.artifact import artifact
import pyshelf.response_map as response_map
app = flask.Flask(__name__)
app.register_blueprint(artifact)
@app.errorhandler(Exception)
def generic_exception_handler(error):
return response_map.create_500(msg=error.message)
@app.after_request
def format_res... | mit | Python |
07573e89ed4a34715951b76b70c8a7c914bed634 | Update webhost.py | anvanza/invenavi,anvanza/invenavi,anvanza/invenavi | web/webhost.py | web/webhost.py | import sys
import logging
from twisted.python import log
from twisted.internet import reactor, defer
from twisted.web.server import Site
from twisted.web.static import File
from autobahn.websocket import listenWS
from autobahn.wamp import exportRpc, \
WampServerFactory, \
... | import sys
import logging
from twisted.python import log
from twisted.internet import reactor, defer
from twisted.web.server import Site
from twisted.web.static import File
from autobahn.websocket import listenWS
from autobahn.wamp import exportRpc, \
WampServerFactory, \
... | mit | Python |
f0c728668ea88bc84a03eaf0d03b81ec075f0afc | Añade url para create | migonzalvar/alpha,migonzalvar/alpha,migonzalvar/alpha,migonzalvar/alpha,abertal/alpha,abertal/alpha,abertal/alpha,abertal/alpha | webapp/urls.py | webapp/urls.py | from django.conf.urls import include, url
from django.views.generic import RedirectView
from . import views
person = [
url(r'^$', views.PersonList.as_view(), name='person-list'),
url(r'^new/$', views.PersonCreate.as_view(), name='person-create'),
url(r'^(?P<pk>[^/]+)/$', views.PersonDetail.as_view(), name... | from django.conf.urls import include, url
from django.views.generic import RedirectView
from . import views
person = [
url(r'^$', views.PersonList.as_view(), name='person-list'),
url(r'^new/$', views.PersonCreate.as_view(), name='person-create'),
url(r'^(?P<pk>[^/]+)/$', views.PersonDetail.as_view(), name... | bsd-3-clause | Python |
ba842af48c1d137584811d75d15c3b7ceddc2372 | Add more ways to suck line numbers from nodes | mitar/pychecker,mitar/pychecker | pychecker2/File.py | pychecker2/File.py | from pychecker2.util import parents
from compiler import ast
class File:
def __init__(self, name):
self.name = name
self.parseTree = None
self.scopes = {}
self.root_scope = None
self.warnings = []
def __cmp__(self, other):
return cmp(self.name, other.name)
... | from pychecker2.util import type_filter
from compiler import ast
class File:
def __init__(self, name):
self.name = name
self.parseTree = None
self.scopes = {}
self.root_scope = None
self.warnings = []
def __cmp__(self, other):
return cmp(self.name, other.name)
... | bsd-3-clause | Python |
0fd47b8ef057504e331c7ba771d62fe00722ab26 | Fix an issue with non-site admins using share button | SlideAtlas/SlideAtlas-Server,SlideAtlas/SlideAtlas-Server,SlideAtlas/SlideAtlas-Server,SlideAtlas/SlideAtlas-Server | slideatlas/api/v2/resources/user.py | slideatlas/api/v2/resources/user.py | # coding=utf-8
from slideatlas import models, security
from ..base import ListAPIResource, ItemAPIResource
from ..blueprint import api
from ..common import abort
################################################################################
__all__ = ('UserListAPI', 'UserItemAPI')
################################... | # coding=utf-8
from slideatlas import models, security
from ..base import ListAPIResource, ItemAPIResource
from ..blueprint import api
from ..common import abort
################################################################################
__all__ = ('UserListAPI', 'UserItemAPI')
################################... | apache-2.0 | Python |
480c6144b22baf8e993bd37aadd8fd2463b6fdbe | Make config moar usable | alisaifee/pyutrack,alisaifee/pyutrack | pyutrack/config.py | pyutrack/config.py | import os
import anyconfig
from pyutrack import Credentials
class Config(object):
DEFAULT_PATH = os.path.expanduser('~/.pyutrack')
def __init__(self, path=DEFAULT_PATH):
self.__config = {}
self.__path = path
self.__load(
path, allow_not_exist=path == self.DEFAULT_PATH
... | import os
import anyconfig
from pyutrack import Credentials
CONFIG_PATH = os.path.expanduser('~/.pyutrack')
class Config(object):
def __init__(self, path=CONFIG_PATH):
self.__config = {}
self.__load(path, allow_not_exist=path == CONFIG_PATH)
def __load(self, path, allow_not_exist):
... | mit | Python |
5b42a08d672270e3467ad0342e1f56f6638094c3 | Add rain_get_str method | scizzorz/rain,philipdexter/rain,scizzorz/rain,philipdexter/rain,scizzorz/rain,scizzorz/rain,philipdexter/rain,philipdexter/rain | rain/engine.py | rain/engine.py | from ctypes import CFUNCTYPE, POINTER
from ctypes import Structure
from ctypes import byref
from ctypes import c_char_p
from ctypes import c_int
from ctypes import c_uint16
from ctypes import c_uint32
from ctypes import c_uint64
from ctypes import c_uint8
from ctypes import c_void_p
from ctypes import cast
import llvm... | from ctypes import CFUNCTYPE, POINTER, c_char_p, c_int, byref
from ctypes import c_uint8
from ctypes import c_uint16
from ctypes import c_uint32
from ctypes import c_uint64
from ctypes import Structure
import llvmlite.binding as llvm
class Box(Structure):
_fields_ = [("type", c_uint8),
("data", c_uint... | mit | Python |
9c339d28ae899740281b085cbb2b8fd73425249c | Add empty line for PEP8 | City-of-Helsinki/kerrokantasi,stephawe/kerrokantasi,stephawe/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,stephawe/kerrokantasi,City-of-Helsinki/kerrokantasi | democracy/views/label.py | democracy/views/label.py | from rest_framework import serializers, viewsets, filters
import django_filters
from democracy.models import Label
from democracy.pagination import DefaultLimitPagination
class LabelFilter(django_filters.FilterSet):
label = django_filters.CharFilter(lookup_type='icontains')
class Meta:
model = Label... | from rest_framework import serializers, viewsets, filters
import django_filters
from democracy.models import Label
from democracy.pagination import DefaultLimitPagination
class LabelFilter(django_filters.FilterSet):
label = django_filters.CharFilter(lookup_type='icontains')
class Meta:
model = Label
... | mit | Python |
ae258bfd15c8809c0c2ac1b4426c0e25e290da74 | Add doc strings and class to unlabeled data. | benigls/spam,benigls/spam | spam.py | spam.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
from sklearn.cross_validation import train_test_split
from spam.common import DATASET_META
from spam.common.utils import get_file_path_list
from spam.preprocess import preprocess
file_path_list = get_file_path_list(DATASET_META)
# transform list of ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
from sklearn.cross_validation import train_test_split
from spam.common import DATASET_META
from spam.common.utils import get_file_path_list
from spam.preprocess import preprocess
file_path_list = get_file_path_list(DATASET_META)
# transform list of ... | mit | Python |
684fe929780bfbf15dce1cf42dc35bf60af9aae5 | Update at 2017-07-18 22-59-32 | amoshyc/tthl-code | test.py | test.py | import json
import random
from pathlib import Path
import numpy as np
from scipy.misc import imresize
from moviepy.editor import VideoFileClip
def window_generator(video_dirs, n_samples, batch_size, timesteps):
videos = [VideoFileClip(str(x / 'video.mp4')) for x in video_dirs]
labels = [
json.load((x ... | import json
import random
from pathlib import Path
import numpy as np
from moviepy.editor import VideoFileClip
def window_generator(video_dirs, n_samples, batch_size, timesteps):
videos = [VideoFileClip(str(x / 'video.mp4')) for x in video_dirs]
labels = [
json.load((x / 'label.json').open())['label']... | apache-2.0 | Python |
cad0d68dae776d0fe5cb5bac4bfdbe061631001d | test for list (which is still hardcoded to json) | blake-sheridan/py-serializer,blake-sheridan/py-serializer | test.py | test.py | import unittest
# temp
import sys
sys.path.append('build/lib.linux-x86_64-3.3')
import encoder.json
class JsonTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.encode = encoder.json.Encoder().encode
def test_None(self):
self.assertEqual(self.encode(None), 'null')
def t... | import unittest
# temp
import sys
sys.path.append('build/lib.linux-x86_64-3.3')
import encoder.json
class JsonTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.encode = encoder.json.Encoder().encode
def test_None(self):
self.assertEqual(self.encode(None), 'null')
def t... | apache-2.0 | Python |
7b5a8fcaab9e72508fd56a16643ae33a49715280 | Add another test to test functionality | zillolo/vsut-python | test.py | test.py | from vsut.unit import Case, Suite
class TestCase(Case):
def testAll(self):
self.assertEqual(1, 1)
self.assertEqual(1, 2)
self.assertNotEqual(1, 2)
self.assertNotEqual(1, 1)
self.assertTrue(True)
self.assertTrue(False)
self.assertFalse(False)
self.as... | from vsut.unit import Case, Suite, test
class TestCase(Case):
def run(self):
self.assertEqual(1, 1)
self.assertEqual(1, 2)
self.assertNotEqual(1, 2)
self.assertNotEqual(1, 1)
self.assertTrue(True)
self.assertTrue(False)
self.assertFalse(False)
self.... | mit | Python |
4e4521a23100b24bd75e5e7d6cebdd03fe0ddcc9 | update Fritz actions to work with fritzconnection > 0.8 | Monschichi/upnp,Monschichi/upnp,Monschichi/upnp | upnp.py | upnp.py | #!/usr/bin/env python3
from flask import (
Flask,
jsonify,
render_template,
)
from fritzconnection import FritzConnection
app = Flask(__name__, static_url_path='/static')
fc = FritzConnection()
@app.route('/status', methods=['GET'])
def status():
link = fc.call_action('WANCommonIFC', 'GetCommonLinkP... | #!/usr/bin/env python3
from flask import (
Flask,
jsonify,
render_template,
)
from fritzconnection import FritzConnection
app = Flask(__name__, static_url_path='/static')
fc = FritzConnection()
@app.route('/status', methods=['GET'])
def status():
link = fc.call_action('WANCommonInterfaceConfig', 'Ge... | apache-2.0 | Python |
3a0d43cfbe0a5d3c7af1f6cb7f5fc00a21d46b1d | include presskit in urls | SpreadBand/SpreadBand,SpreadBand/SpreadBand | urls.py | urls.py | from django.conf.urls.defaults import *
from django.contrib.gis import admin
import authority
import settings
admin.autodiscover()
authority.autodiscover()
urlpatterns = patterns('',
# temporary index page
url(r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'index.html'}, name='home')... | from django.conf.urls.defaults import *
from django.contrib.gis import admin
import authority
import settings
admin.autodiscover()
authority.autodiscover()
urlpatterns = patterns('',
# temporary index page
url(r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'index.html'}, name='home')... | agpl-3.0 | Python |
0145cecc150ff2d756eda790110c41d183e7890a | Improve utils documentation | Mic92/ParkAPI,offenesdresden/ParkAPI,Mic92/ParkAPI,offenesdresden/ParkAPI | util.py | util.py | import pytz
from datetime import datetime
from os import path
import json
def get_lots_from_json(city, lot_name):
"""
Get the total value from the highest known value in the last saved JSON file.
This is useful for cities that don't publish total number of spaces for a parking lot.
Caveats:
- Re... | import pytz
from datetime import datetime
from os import path
# if city does not send totals, we can push totals to the higest known value
# saved in the json file
# if the lot_name does not exits returns 0
# problem: if one lot name exist twice, it takes always the last value
# but the same lot name should never exi... | mit | Python |
ef90c77479e874dc37a6b5e1af9242081e233cde | add function to convert activation to image | Petr-By/qtpyvis | util.py | util.py | class ArgumentError(ValueError):
'''Invalid argument exception'''
pass
def to_image(array):
'''Convert a float array to 8bit grayscale
Parameters
----------
array : np.ndarray
Array of 2/3 dimensions and numeric dtype. In case of 3 dimensions, the image set is
... | class ArgumentError(ValueError):
"""Invalid argument exception"""
pass
| mit | Python |
913f0c4dcb37a32b0171c8b26c5e215ae7a65cfb | Put the [0] in the wrong place | harej/requestoid,harej/requestoid | wiki.py | wiki.py | from . import tool_labs_utils
sql = tool_labs_utils
def CanonicalPageTitle(raw_input):
output = raw_input.replace(' ', '_')
output = output[0].upper() + output[1:]
return output
def WikipediaQuery(language, sqlquery):
return sql.WMFReplica().query(language + 'wiki', sqlquery, None)
def GetPageId(language, paget... | from . import tool_labs_utils
sql = tool_labs_utils
def CanonicalPageTitle(raw_input):
output = raw_input.replace(' ', '_')
output = output[0].upper() + output[1:]
return output
def WikipediaQuery(language, sqlquery):
return sql.WMFReplica().query(language + 'wiki', sqlquery, None)
def GetPageId(language, paget... | mit | Python |
85b1770e06d68cfbb1edc880d701de332c69512e | remove virtualenv from wsgi.py | jfmatth/openshift-django16,jfmatth/openshift-django16 | wsgi.py | wsgi.py | #!/usr/bin/python
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| #!/usr/bin/python
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
#if sys.version_info < (3,0,0):
# sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'],'mysite'))
#
# virtenv = os.path.join(os.environ['OPENSHIFT_PYTHON_DIR'],'virtenv')
# virtualenv = os.path.join(virtenv,... | mit | Python |
9c93b6b25745433b617d9bd543804f637b49623a | use proxy to call input() in configure() step | Halibot/halibot,Halibot/halibot | halibot/halconfigurer.py | halibot/halconfigurer.py | get_input = input
class Option():
def __init__(self, key, prompt=None, default=None):
self.key = key
self.prompt = prompt if prompt != None else key
self.default = default
def ask(self):
prompt = self.prompt
if self.default != None:
prompt += ' [' + str(self.default) + ']'
prompt += ': '
v = get_i... |
class Option():
def __init__(self, key, prompt=None, default=None):
self.key = key
self.prompt = prompt if prompt != None else key
self.default = default
def ask(self):
prompt = self.prompt
if self.default != None:
prompt += ' [' + str(self.default) + ']'
prompt += ': '
v = input(prompt)
if v ==... | bsd-3-clause | Python |
493b42bae9d9d83fa44f223812a4757b35e42688 | Remove hoomd/update/__init__.__all__ | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/update/__init__.py | hoomd/update/__init__.py | from hoomd.update.box_resize import BoxResize
# TODO remove when no longer necessary
class _updater:
pass
| from hoomd.update.box_resize import BoxResize
# TODO remove when no longer necessary
class _updater:
pass
__all__ = ['BoxResize']
| bsd-3-clause | Python |
f99111a8ad34c89a79cd62ccf4b94e3d267a939a | Use --update when installing requirements | HubbeKing/Hubbot_Twisted | hubbot/Modules/Update.py | hubbot/Modules/Update.py | from __future__ import unicode_literals
from hubbot.moduleinterface import ModuleInterface, ModuleAccessLevel
from hubbot.response import IRCResponse, ResponseType
import os
import sys
import subprocess
class Update(ModuleInterface):
triggers = ["update"]
help = "update - pulls the latest code from GitHub"
... | from __future__ import unicode_literals
from hubbot.moduleinterface import ModuleInterface, ModuleAccessLevel
from hubbot.response import IRCResponse, ResponseType
import os
import sys
import subprocess
class Update(ModuleInterface):
triggers = ["update"]
help = "update - pulls the latest code from GitHub"
... | mit | Python |
1b0c6c8070246daf9aee5c5af017f27e23eb7ecd | Use generic name for matrix | DarkAce65/rpi-led-matrix,DarkAce65/rpi-led-matrix | python/ball.py | python/ball.py | #!/usr/bin/env python
import sys, time
import math
class Ball:
gravity = -3 # Dots per second squared
def __init__(self, x=0, y=0):
self.r = 255
self.g = 0
self.b = 0
self.x = 0
self.y = 0
self.vx = 0
self.vy = 0
def updateValues(self, timeElapsed=1): # timeElapsed in seconds
self.x += self.vx * ... | #!/usr/bin/env python
import sys, time
import math
class Ball:
gravity = -3 # Dots per second squared
def __init__(self, x=0, y=0):
self.r = 255
self.g = 0
self.b = 0
self.x = 0
self.y = 0
self.vx = 0
self.vy = 0
def updateValues(self, timeElapsed=1): # timeElapsed in seconds
self.x += self.vx * ... | mit | Python |
3738030019dc6ab1646fac9b37932f8f8fd8bd24 | Update demo.py | Kaceykaso/design_by_roomba,Kaceykaso/design_by_roomba | python/demo.py | python/demo.py | #! /usr/bin/env python
import serial
import time
# Serial port
N = "/dev/ttyUSB0"
def ints2str(lst):
'''
Taking a list of notes/lengths, convert it to a string
'''
s = ""
for i in lst:
if i < 0 or i > 255:
raise Exception
s = s + str(chr(i))
return s
# do some init... | #! /usr/bin/env python
import serial
import time
# Serial port
N = "/dev/ttyUSB0"
def ints2str(lst):
'''
Taking a list of notes/lengths, convert it to a string
'''
s = ""
for i in lst:
if i < 0 or i > 255:
raise Exception
s = s + str(chr(i))
return s
# do some init... | mit | Python |
9ec35300975a141162749cba015cedbe900f97eb | Fix bug with collector losing last group of input | djmattyg007/IdiotScript | idiotscript/Collector.py | idiotscript/Collector.py | class Collector(object):
def __init__(self):
self._groups = []
self._current_group = None
def add_input(self, new_input):
if self._current_group is None:
self._current_group = []
self._groups.append(self._current_group)
self._current_group.append(new_inpu... | class Collector(object):
def __init__(self):
self._groups = []
self._current_group = None
def add_input(self, new_input):
if self._current_group is None:
self._current_group = []
self._current_group.append(new_input)
def finalise_group(self):
self._group... | unlicense | Python |
5a7d0defd39d2a35ec4abe36437605ffbc528bcd | ADD markdown table support | jmaupetit/md2pdf | md2pdf/core.py | md2pdf/core.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from markdown2 import markdown, markdown_path
from weasyprint import HTML, CSS
from .exceptions import ValidationError
def md2pdf(pdf_file_path, md_content=None, md_file_path=None,
css_file_path=None, base_url=None):
"""
Converts inp... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from markdown2 import markdown, markdown_path
from weasyprint import HTML, CSS
from .exceptions import ValidationError
def md2pdf(pdf_file_path, md_content=None, md_file_path=None,
css_file_path=None, base_url=None):
"""
Converts inp... | mit | Python |
67797482392638724e717cff94788de6baad7930 | Connect up different element threshold for randspectra | sbird/fake_spectra,sbird/fake_spectra,sbird/fake_spectra | randspectra.py | randspectra.py | # -*- coding: utf-8 -*-
"""Class to gather and analyse various metal line statistics"""
import numpy as np
import hdfsim
import spectra
class RandSpectra(spectra.Spectra):
"""Generate metal line spectra from simulation snapshot"""
def __init__(self,num, base, numlos=5000, res = 1., cdir = None, thresh=10**20.... | # -*- coding: utf-8 -*-
"""Class to gather and analyse various metal line statistics"""
import numpy as np
import hdfsim
import spectra
class RandSpectra(spectra.Spectra):
"""Generate metal line spectra from simulation snapshot"""
def __init__(self,num, base, numlos=5000, res = 1., cdir = None, thresh=10**20.... | mit | Python |
9f1c8050bffac569993ae652f574e7a9f54b4772 | Change user existing check | mpiannucci/crosswynds-promo,mpiannucci/crosswynds-promo,mpiannucci/crosswynds-promo,mpiannucci/crosswynds-promo | models/user.py | models/user.py | from google.appengine.ext import db
class User(db.Model):
''' IP addresses that have accessed the promo '''
email = db.StringProperty()
referer = db.IntegerProperty()
referal_id = db.IntegerProperty()
created = db.DateTimeProperty(auto_now_add=True)
modified = db.DateTimeProperty(auto_now=True)... | from google.appengine.ext import db
class User(db.Model):
''' IP addresses that have accessed the promo '''
email = db.StringProperty()
referer = db.IntegerProperty()
referal_id = db.IntegerProperty()
created = db.DateTimeProperty(auto_now_add=True)
modified = db.DateTimeProperty(auto_now=True)... | mit | Python |
38600d15214c98809e3078c163add305f0756a48 | Switch to use range instead of xrange since we are moving off Python 2 eventually, as suggested by :truber. | nth10sd/lithium,nth10sd/lithium,MozillaSecurity/lithium,MozillaSecurity/lithium | interestingness/range.py | interestingness/range.py | #!/usr/bin/env python
from __future__ import print_function
# Repeats an interestingness test a given number of times.
# If "RANGENUM" is present, it is replaced in turn with each number in the range.
#
# Use for:
#
# 1. Intermittent testcases.
#
# Repeating the test can make the bug occur often enough for Lithium ... | #!/usr/bin/env python
from __future__ import print_function
# Repeats an interestingness test a given number of times.
# If "RANGENUM" is present, it is replaced in turn with each number in the range.
#
# Use for:
#
# 1. Intermittent testcases.
#
# Repeating the test can make the bug occur often enough for Lithium ... | mpl-2.0 | Python |
5d465d165eb455253e01975e722d8aa49a199bcf | Fix docstring. | gwax/mtgcdb,gwax/mtg_ssm | mtgcdb/util.py | mtgcdb/util.py | """General helper methods and classes."""
import re
import sqlalchemy.types as sqlt
class SqlEnumType(sqlt.SchemaType, sqlt.TypeDecorator):
"""Type class for storing a python3 enum in SQL.
Derived from: http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/
"""
def __init__(self, enum_cls):
... | """General helper methods and classes."""
import re
import sqlalchemy.types as sqlt
class SqlEnumType(sqlt.SchemaType, sqlt.TypeDecorator):
"""Type class for storing a python3 enum in SQL.
Derived from: http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/
"""
def __init__(self, enum_cls):
... | mit | Python |
07a92f54c927d8b79c70e49616bf421669d00f60 | Test for symmetric distance matrix | skearnes/muv | muv/spatial.py | muv/spatial.py | """
Spatial statistics.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
from scipy.spatial.distance import cdist, is_valid_dm
def distance(a, b):
"""
Calculate distances between examples in two datasets.
Parameters
... | """
Spatial statistics.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
from scipy.spatial.distance import cdist
def distance(a, b):
"""
Calculate distances between examples in two datasets.
Parameters
---------... | bsd-3-clause | Python |
0934fcaed19b32aecc6b3d1d29c141f1f9af1281 | Fix root url conf | jf248/scrape-the-plate,jf248/scrape-the-plate,jf248/scrape-the-plate,jf248/scrape-the-plate | mysite/urls.py | mysite/urls.py | """
mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | """
mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | mit | Python |
1e2d9755f68f852cb2772ba4127857595e86effa | Fix assignment | openkamer/openkamer,openkamer/openkamer,openkamer/openkamer,openkamer/openkamer | document/create.py | document/create.py | import logging
from typing import List
from tkapi import Api
from tkapi.zaak import Zaak
from tkapi.zaak import ZaakSoort
logger = logging.getLogger(__name__)
class DossierId:
dossier_id = None
dossier_sub_id = None
def __init__(self, dossier_id, dossier_sub_id=None):
self.dossier_id = dossier_... | import logging
from typing import List
from tkapi import Api
from tkapi.zaak import Zaak
from tkapi.zaak import ZaakSoort
logger = logging.getLogger(__name__)
class DossierId:
dossier_id: None
dossier_sub_id: None
def __init__(self, dossier_id, dossier_sub_id=None):
self.dossier_id = dossier_id... | mit | Python |
d2417e46edab3ca39c7be106beb6d3c05cdf51cb | bump version | arcticfoxnv/slackminion,arcticfoxnv/slackminion | slackminion/plugins/core/__init__.py | slackminion/plugins/core/__init__.py | version = '0.9.4'
| version = '0.9.3'
| mit | Python |
226db8fea7651912afdcb6726dc2783aed3d7a2f | Update python test | enjin/contracts | solidity/python/BenchmarkPurchase.py | solidity/python/BenchmarkPurchase.py | from sys import argv
from decimal import Decimal
from Formula import calculatePurchaseReturn
def formulaTest(supply,reserve,ratio,amount):
fixed = Decimal(calculatePurchaseReturn(supply,reserve,ratio,amount))
real = Decimal(supply)*((1+Decimal(amount)/Decimal(reserve))**(Decimal(ratio)/100)-1)
if fix... | from sys import argv
from decimal import Decimal
from Formula import calculatePurchaseReturn
def formulaTest(_supply, _reserveBalance, _reserveRatio, _amount):
fixed = calculatePurchaseReturn(_supply, _reserveBalance, _reserveRatio, _amount)
real = Decimal(_supply)*((1+Decimal(_amount)/Decimal(_reserveBa... | apache-2.0 | Python |
fc4bc4ff2d13ad8c7e58d85fada821e3615ec040 | return float instead of int | Mashdon/RaspAquaLight,Mashdon/RaspAquaLight,Mashdon/RaspAquaLight | Start.py | Start.py | # -*- coding: utf-8 -*-
from WebServ import Server
from WebServ.WebController import C_WebController
from Model import C_Model
from threading import Thread
from time import sleep
import os
if os.name == "nt":
prod = False
else:
prod = True
role_web = 0
role_led = 1
role_save = 2
pin_R = 17
pin_G = 22
pin_B ... | # -*- coding: utf-8 -*-
from WebServ import Server
from WebServ.WebController import C_WebController
from Model import C_Model
from threading import Thread
from time import sleep
import os
if os.name == "nt":
prod = False
else:
prod = True
role_web = 0
role_led = 1
role_save = 2
pin_R = 17
pin_G = 22
pin_B ... | mit | Python |
a6bd46743ce3a5ae756b2420e118f992ad34bd8c | allow lap() to not print | rlowrance/re-avm | Timer.py | Timer.py | import atexit
import os
import pdb
import time
class Timer(object):
def __init__(self):
# time.clock() returns:
# unix ==> processor time in seconds as float (cpu time)
# windows ==> wall-clock seconds since first call to this function
# NOTE: time.clock() is deprecated in pytho... | import atexit
import time
class Timer(object):
def __init__(self):
self._program_start_clock = time.clock() # processor time in seconds
self._program_start_time = time.time() # time in seconds since the epoch
self._program = (self._program_start_clock, self._program_start_time)
s... | bsd-3-clause | Python |
6d5e80771f04fe2aa7cb83c89bdb4e16178b219b | Drop existing products table before creation | joykuotw/python-endpoints,joykuotw/python-endpoints,joykuotw/python-endpoints | DB.py | DB.py | # Create a database
import sqlite3
import csv
from datetime import datetime
import sys
reload(sys)
sys.setdefaultencoding('utf8')
class createDB():
def readCSV(self, filename):
try:
conn = sqlite3.connect('databaseForTest.db')
print 'DB Creation Successful!'
cur = ... | # Create a database
import sqlite3
import csv
from datetime import datetime
import sys
reload(sys)
sys.setdefaultencoding('utf8')
class createDB():
def readCSV(self, filename):
try:
conn = sqlite3.connect('databaseForTest.db')
print 'DB Creation Successful!'
cur = ... | mit | Python |
906d65627198277b62c54a26fb75bf8ab24afcf5 | Allow the admin to filter down showing only requests by a certain user or ip address. | gnublade/django-request,kylef/django-request,kylef/django-request,kylef/django-request,Derecho/django-request,gnublade/django-request,gnublade/django-request | request/admin.py | request/admin.py | from django.contrib import admin
from request.models import Request
class RequestAdmin(admin.ModelAdmin):
list_display = ('time', 'path', 'response', 'method', 'request_from')
fieldsets = (
('Request', {
'fields': ('method', 'path', 'time', 'is_secure', 'is_ajax')
}),
('Resp... | from django.contrib import admin
from request.models import Request
class RequestAdmin(admin.ModelAdmin):
list_display = ('time', 'path', 'response', 'method', 'request_from')
fieldsets = (
('Request', {
'fields': ('method', 'path', 'time', 'is_secure', 'is_ajax')
}),
('Resp... | bsd-2-clause | Python |
8e0afc06d221d86677a172fdb7d1388225504ba6 | Add specific required-property to all arguments | nok/resp,nok/resp | resp/__main__.py | resp/__main__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from Parser import Parser
def main():
# Arguments:
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--redis_cmd', type=str, default='', required=True)
parser.add_argument('-i', '--input', type=str, default='', required=False... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
from Parser import Parser
def main(argv):
# Arguments:
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--redis_cmd', type=str, default='')
parser.add_argument('-i', '--input', type=str, default='')
parser.add... | mit | Python |
8236f607c6f2cf4f1a13bc0a6ec681f7bddbbfb9 | Update version number. | EducationalTestingService/rsmtool | rsmtool/version.py | rsmtool/version.py | """
This module exists solely for version information so we only have to change it
in one place. Based on the suggestion `here. <http://bit.ly/16LbuJF>`_
"""
__version__ = '6.1.0'
VERSION = tuple(int(x) for x in __version__.split('.'))
| """
This module exists solely for version information so we only have to change it
in one place. Based on the suggestion `here. <http://bit.ly/16LbuJF>`_
"""
__version__ = '6.0.1'
VERSION = tuple(int(x) for x in __version__.split('.'))
| apache-2.0 | Python |
abcc3de36bbf76b817aa6ac3a06012b69e1e5927 | Fix missing directory. | thylong/ian,thylong/ian,thylong/ian,thylong/ian | install/install.py | install/install.py | import urllib2
import os
def make_executable(path):
mode = os.stat(path).st_mode
mode |= (mode & 0o444) >> 2
os.chmod(path, mode)
if __name__ == '__main__':
response = urllib2.urlopen('https://github.com/thylong/ian/releases/download/ian-v0.2/ian')
data = response.read()
path = "/usr/local/... | import urllib2
import os
def make_executable(path):
mode = os.stat(path).st_mode
mode |= (mode & 0o444) >> 2
os.chmod(path, mode)
if __name__ == '__main__':
response = urllib2.urlopen('https://github.com/thylong/ian/releases/download/ian-v0.2/ian')
data = response.read()
path = "/usr/local/... | apache-2.0 | Python |
86186563513e952116f6ac22eb5a9b9df759d751 | Test pre-commit hook | lwindg/sanji,imZack/sanji,Sanji-IO/sanji | sanji/publish.py | sanji/publish.py | from sanji.message import SanjiMessage
from sanji.message import SanjiMessageType
"""
Publish message module
"""
class Publish(object):
# pylint:
"""
Publish class
"""
def __init__(self, connection):
self._connection = connection
for method in ["get", "post", "put", "delete"]:
... | from sanji.message import SanjiMessage
from sanji.message import SanjiMessageType
"""
Publish message module
"""
class Publish(object):
"""
Publish class
"""
def __init__(self, connection):
self._connection = connection
for method in ["get", "post", "put", "delete"]:
self.__... | mit | Python |
5caacecded5b64bc3a9e2a232a3ea5531e1a1433 | Handle finger and locals | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/output/key.py | salt/output/key.py | '''
The standard outputter used for keys
'''
# Import salt libs
import salt.utils
def output(data):
'''
Read in the dict structure generated by the salt key api methods and
print the structure.
'''
color = salt.utils.get_colors(
not bool(__opts__.get('no_color', False)))
cmap... | '''
The standard outputter used for keys
'''
# Import salt libs
import salt.utils
def output(data):
'''
Read in the dict structure generated by the salt key api methods and
print the structure.
'''
color = salt.utils.get_colors(
not bool(__opts__.get('no_color', False)))
cmap... | apache-2.0 | Python |
92a7ad38a0fb4b9e5d78a1dc7b1988769b86e1de | Bump version for development. | prabhuramachandran/ipyaml | ipyaml/__init__.py | ipyaml/__init__.py | __version__ = '0.4.dev0'
| __version__ = '0.3'
| bsd-2-clause | Python |
56d60077d10ce0f013683c8bcb4d3be61b7c9681 | Allow to view realm members in realms tree view | Alignak-monitoring-contrib/alignak-webui,Alignak-monitoring-contrib/alignak-webui,Alignak-monitoring-contrib/alignak-webui | alignak_webui/plugins/realms/realms.py | alignak_webui/plugins/realms/realms.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016:
# Frederic Mohier, frederic.mohier@gmail.com
#
# This file is part of (WebUI).
#
# (WebUI) 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 Fou... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016:
# Frederic Mohier, frederic.mohier@gmail.com
#
# This file is part of (WebUI).
#
# (WebUI) 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 Fou... | agpl-3.0 | Python |
130066b4d0f01cbbdf6fd4c871380dd4de9a594a | fix tests on node 6 | NickCarneiro/curlconverter,NickCarneiro/curlconverter,NickCarneiro/curlconverter,NickCarneiro/curlconverter,NickCarneiro/curlconverter,NickCarneiro/curlconverter,NickCarneiro/curlconverter,NickCarneiro/curlconverter,NickCarneiro/curlconverter | fixtures/python_output/get_charles_syntax.py | fixtures/python_output/get_charles_syntax.py | import requests
headers = {
'Host': 'api.ipify.org',
'Accept': '*/*',
'User-Agent': 'GiftTalk/2.7.2 (iPhone; iOS 9.0.2; Scale/3.00)',
'Accept-Language': 'en-CN;q=1, zh-Hans-CN;q=0.9',
}
params = (
('format', 'json'),
)
requests.get('http://api.ipify.org/', headers=headers, params=params)
#NB. Or... | import requests
headers = {
'Host': 'api.ipify.org',
'Accept': '*/*',
'User-Agent': 'GiftTalk/2.7.2 (iPhone; iOS 9.0.2; Scale/3.00)',
'Accept-Language': 'en-CN;q=1, zh-Hans-CN;q=0.9',
}
params = (
('format', 'json'),
('', ''),
)
requests.get('http://api.ipify.org/', headers=headers, params=pa... | mit | Python |
1f4b85881b127b879241f2dafb88483c3c20bdd4 | Remove dft from build. | mathdd/numpy,numpy/numpy,WarrenWeckesser/numpy,dwf/numpy,anntzer/numpy,pelson/numpy,mathdd/numpy,ddasilva/numpy,GaZ3ll3/numpy,gmcastil/numpy,cjermain/numpy,rajathkumarmp/numpy,rhythmsosad/numpy,felipebetancur/numpy,hainm/numpy,dwillmer/numpy,stefanv/numpy,abalkin/numpy,ViralLeadership/numpy,githubmlai/numpy,dwillmer/nu... | numpy/setup.py | numpy/setup.py | #!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('numpy',parent_package,top_path)
config.add_subpackage('distutils')
config.add_subpackage('testing')
config.add_subpackage('f2py')
config.add_subp... | #!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('numpy',parent_package,top_path)
config.add_subpackage('distutils')
config.add_subpackage('testing')
config.add_subpackage('f2py')
config.add_subp... | bsd-3-clause | Python |
ca039e305ee031668b34b364454e3d5b2e94636c | Add the method allow | xgfone/pycom,xgfone/xutils | xutils/rate.py | xutils/rate.py | # -*- coding: utf-8 -*-
from __future__ import division
import time
from threading import Thread
try:
from queue import Queue
except ImportError:
from Queue import Queue
class Rate(object):
def __init__(self, rate, hz=10):
if rate < 1 or hz < 1:
raise ValueError("rate and hz must be... | # -*- coding: utf-8 -*-
from __future__ import division
import time
from threading import Thread
try:
from queue import Queue
except ImportError:
from Queue import Queue
class Rate(object):
def __init__(self, rate, hz=10):
if rate < 1 or hz < 1:
raise ValueError("rate and hz must be... | mit | Python |
e3feec33df1b0f0f1825f44ca540aa8fa84c1d3a | Add some more error types | Yelp/yelp-python | yelp/errors.py | yelp/errors.py | # -*- coding: UTF-8 -*-
import json
class YelpError(Exception):
def __init__(self, code, msg, response):
self.code = code
self.msg = msg
self.id = response['error']['id']
self.text = response['error']['text']
class AreaTooLarge(YelpError):
pass
class BadCategory(YelpError... | # -*- coding: UTF-8 -*-
import json
class YelpError(Exception):
def __init__(self, code, msg, response):
self.code = code
self.msg = msg
self.id = response['error']['id']
self.text = response['error']['text']
class InternalError(YelpError):
pass
class ExceededReqs(YelpErr... | mit | Python |
ddd03d77c66242145ed617d54d61d54060153d15 | Bump 0.0.4 | manosim/django-rest-framework-docs,manosim/django-rest-framework-docs,ekonstantinidis/django-rest-framework-docs,manosim/django-rest-framework-docs,ekonstantinidis/django-rest-framework-docs,ekonstantinidis/django-rest-framework-docs | rest_framework_docs/__init__.py | rest_framework_docs/__init__.py | __version__ = '0.0.4'
| __version__ = '0.0.3'
| bsd-2-clause | Python |
2d4ba3f09063c64207106252ebcb822eddbe3642 | disable the very time consuming IWC test | CollectQT/qapc,CollectQT/qapc | test/test_IWC_integration.py | test/test_IWC_integration.py | # builtin
import os
import sys
# external
import vcr
############################################################
# setup
############################################################
base_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
sys.path.append(base_dir)
from lib import utils, IWC_integr... | # builtin
import os
import sys
# external
import vcr
############################################################
# setup
############################################################
base_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
sys.path.append(base_dir)
from lib import utils, IWC_integr... | agpl-3.0 | Python |
cafa2e23c4464fd8ce2bf9f0b0d7b9a34ca85cf9 | Add test for get_trending_repo_names | staranjeet/github-trending-cli | test/test_github_trending.py | test/test_github_trending.py | import unittest
from githubtrending import trending as githubtrending
from . import data
class TestGithubTrending(unittest.TestCase):
def test_read_page(self):
for each in data.READ_PAGE_DATA:
url = each.get('url')
expected_status_code = each.get('status_code')
respon... | import unittest
from githubtrending import trending as githubtrending
from . import data
class TestGithubTrending(unittest.TestCase):
def test_read_page(self):
for each in data.READ_PAGE_DATA:
url = each.get('url')
expected_status_code = each.get('status_code')
respon... | mit | Python |
967b4693f0b9eb4a1a5e2a89ce57fc185cafd81e | Fix dev env test - pytest version bump | micahflee/securedrop,heartsucker/securedrop,micahflee/securedrop,ehartsuyker/securedrop,conorsch/securedrop,micahflee/securedrop,garrettr/securedrop,ehartsuyker/securedrop,heartsucker/securedrop,conorsch/securedrop,conorsch/securedrop,heartsucker/securedrop,ehartsuyker/securedrop,ehartsuyker/securedrop,garrettr/secured... | testinfra/development/test_development_environment.py | testinfra/development/test_development_environment.py | import pytest
import getpass
def test_development_app_dependencies(Package):
"""
Ensure development apt dependencies are installed.
"""
development_apt_dependencies = [
'libssl-dev',
'ntp',
'python-dev',
'python-pip',
]
for dependency in development_apt_dependencies:
... | import pytest
import getpass
def test_development_app_dependencies(Package):
"""
Ensure development apt dependencies are installed.
"""
development_apt_dependencies = [
'libssl-dev',
'ntp',
'python-dev',
'python-pip',
]
for dependency in development_apt_dependencies:
... | agpl-3.0 | Python |
953eec2343427425b7470d4d74218f9b47499320 | Fix typo. I need to enable a linter. | supermitch/mech-ai,supermitch/mech-ai,supermitch/mech-ai | server/player.py | server/player.py | import json
from utils import json_serializer
class Player(object):
def __init__(self, name=None):
self.name = name if name else ''
self.pos = (0, 0)
self.health = 0
self.score = 0
self.ammo = 0
self.orientation = 'north'
@property
def json(self):
... | import json
from utils import json_serializer
class Player(object):
def __init__(self, name=None):
self.name = name if name else ''
self.pos = (0, 0)
self.health = 0
self.score = 0
self.ammo = 0
self.orientation = 'north'
@property
def json(self):
... | mit | Python |
00c785fe504a066be2fa15a1830c0dc76f36d84b | Update ipc_lista1.14.py | any1m1c/ipc20161 | lista1/ipc_lista1.14.py | lista1/ipc_lista1.14.py | #ipc_lista1.14
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
#João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar o rendimento diário de seu trabalho. Toda vez que ele traz um peso de peixes maior que o estabelecido pelo regulamento de pesca do estado de São Paulo (50... | #ipc_lista1.14
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
#João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar o rendimento diário de seu trabalho. Toda vez que ele traz um peso de peixes maior que o estabelecido pelo regulamento de pesca do estado de São Paulo (50... | apache-2.0 | Python |
8e603328ff08888a1236e6b8ca0adbeb8bae819b | Add validation to api for missing required values | vrk-kpa/api-catalog,vrk-kpa/api-catalog,vrk-kpa/api-catalog,vrk-kpa/api-catalog | ckanext/ckanext-apply_permissions_for_service/ckanext/apply_permissions_for_service/logic.py | ckanext/ckanext-apply_permissions_for_service/ckanext/apply_permissions_for_service/logic.py | from ckan.plugins import toolkit as tk
import model
_ = tk._
def service_permission_application_create(context, data_dict):
tk.check_access('service_permission_application_create', context, data_dict)
errors = {}
error_summary = {}
organization = data_dict.get('organization')
if organization is... | from ckan.plugins import toolkit as tk
import model
import ckan.model as ckan_model
def service_permission_application_create(context, data_dict):
tk.check_access('service_permission_application_create', context, data_dict)
organization = data_dict.get('organization')
vat_id = data_dict.get('vat_id')
... | mit | Python |
73f7c9fb4e3d7bc4f275fa53b255d7d61552590a | Update version to 1.8 | zalando/lizzy-client | lizzy_client/version.py | lizzy_client/version.py | MAJOR_VERSION = 1
MINOR_VERSION = 8
VERSION = "{MAJOR_VERSION}.{MINOR_VERSION}".format_map(locals())
| MAJOR_VERSION = 1
MINOR_VERSION = 7
VERSION = "{MAJOR_VERSION}.{MINOR_VERSION}".format_map(locals())
| apache-2.0 | Python |
1864c9e8d7a9f0d6da065ff77f5787dbf888f646 | Add Django migrations | aldryn/aldryn-disqus,aldryn/aldryn-disqus | aldryn_disqus/migrations/0001_initial.py | aldryn_disqus/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0012_auto_20150607_2207'),
]
operations = [
migrations.CreateModel(
name='DisqusPlugin',
fiel... | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DisqusPlugin'
db.create_table('cmsplugin_disqusplugin', (
('cmsplugin_ptr', self.gf('d... | bsd-3-clause | Python |
4bea2f8b58bc74f8b79d7301509bce754d6d1fed | Update server.py | AkshatM/Scribe,AkshatM/Scribe,AkshatM/Scribe | server/server.py | server/server.py | import BaseHTTPServer as bhttp
from urlparse import urlparse as parser
from urlparse import parse_qs as query_parser
from crawler import crawler
from SocketServer import ThreadingMixIn
port = 8080 # default port to use
'''Implements BaseHTTPServer that runs the crawler before responding to a GET request.
GET request... | import BaseHTTPServer as bhttp
from urlparse import urlparse as parser
from urlparse import parse_qs as query_parser
from crawler import crawler
from SocketServer import ThreadingMixIn
port = 8080 # default port to use
'''Implements BaseHTTPServer that runs the crawler before responding to a GET request.
GET request... | cc0-1.0 | Python |
455b07cc4312da682a6fdd16c22feec895cea24b | Fix wrong test | Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel | apps/explorer/tests/test_templatetags.py | apps/explorer/tests/test_templatetags.py | from django.test import TestCase
from ..templatetags import explorer
class HighlightTestCase(TestCase):
def test_highlight_returns_text_when_empty_word(self):
expected = 'foo bar baz'
assert explorer.highlight('foo bar baz', '') == expected
def test_highlight(self):
expected = '<s... | from django.test import TestCase
from ..templatetags import explorer
class HighlightTestCase(TestCase):
def test_highlight_returns_text_when_empty_word(self):
expected = 'foo bar baz'
assert explorer.highlight('foo bar baz', '') == expected
def test_highlight(self):
expected = '<s... | bsd-3-clause | Python |
9d7f0245a5da226026c90232bc77cb04053463f1 | use more models | darenr/wordnet-clusters | wv.py | wv.py | import os
import json
from gensim.models import Word2Vec
print ' *', 'loading wv model'
modelFile = os.environ['HOME'] + "/models/" + "glove.6B.300d.txt"
#modelFile = os.environ['HOME'] + "/models/" + "glove.twitter.27B.200d.txt"
model = Word2Vec.load_word2vec_format(modelFile, binary=False)
print ' *', 'model ready... | import os
from gensim.models import Word2Vec
print 'loading wv model'
model = Word2Vec.load_word2vec_format(os.environ['HOME'] + "/models/glove.6B.300d.txt", binary=False)
print 'model ready'
w1 = 'nostalgia'
w2 = 'memory'
print w1, w2, 'similarity:', model.similarity(w1,w2)
for w in ['nostalgia', 'blurred', 'figur... | mit | Python |
57bc427339200fc07a02bdf8d76290b84f65991d | Test changes. | ewh/bit-math | test_stuff/client_tester.py | test_stuff/client_tester.py | ## Copyright (c) 2013 Edward Weston Hunter
## See the file license.txt for copying permission.
from bitmath import BinInt, Context, Environment
def random_tests():
i1 = BinInt(8)
i1.bit_on(1)
i1.bit_on(5)
print i1
i1.invert()
print i1
i1.left_shift(2)
print i1
i1.right_shift()
... | ## Copyright (c) 2013 Edward Weston Hunter
## See the file license.txt for copying permission.
from bitmath import BinInt
def main():
i1 = BinInt(8)
i1.bit_on(1)
i1.bit_on(5)
print i1
i1.invert()
print i1
i1.left_shift(2)
print i1
i1.right_shift()
print i1
i1.invert()
... | mit | Python |
56441d42ed87e2adad8b36c25cf695b0747a8c16 | Use imports from django_xworkflows instead of imports from xworkflows in tests | rbarrois/django_xworkflows | tests/djworkflows/models.py | tests/djworkflows/models.py | from django.db import models as djmodels
from django_xworkflows import models
class MyWorkflow(models.Workflow):
states = ('foo', 'bar', 'baz')
transitions = (
('foobar', 'foo', 'bar'),
('gobaz', ('foo', 'bar'), 'baz'),
('bazbar', 'baz', 'bar'),
)
initial_state = 'foo'
class ... | from django.db import models as djmodels
import xworkflows
from django_xworkflows import models
class MyWorkflow(xworkflows.Workflow):
states = ('foo', 'bar', 'baz')
transitions = (
('foobar', 'foo', 'bar'),
('gobaz', ('foo', 'bar'), 'baz'),
('bazbar', 'baz', 'bar'),
)
initial_... | bsd-2-clause | Python |
63c3943586b6d1bb921b2e72a72cf93fe3c40c33 | support for django < 1.10 and 1.10 | tony/django-docutils,tony/django-docutils | django_docutils/views.py | django_docutils/views.py | # -*- coding: utf-8 -*-
import django
from django.core.exceptions import ImproperlyConfigured
from django.views.generic.base import TemplateView
from django.template.response import TemplateResponse
from django.template.loader import select_template
class DocutilsResponse(TemplateResponse):
template_name = 'ba... | # -*- coding: utf-8 -*-
from django.core.exceptions import ImproperlyConfigured
from django.views.generic.base import TemplateView
from django.template.response import TemplateResponse
from django.template.loader import select_template
class DocutilsResponse(TemplateResponse):
template_name = 'base.html'
d... | mit | Python |
f4c9ebadf6774e2f5f10e83656c727f22d18c120 | Update django_facebook/admin.py | javipalanca/Django-facebook,ganescoo/Django-facebook,troygrosfield/Django-facebook,cyrixhero/Django-facebook,tuxos/Django-facebook,pjdelport/Django-facebook,sitsbeyou/Django-facebook,selwin/Django-facebook,cyrixhero/Django-facebook,abendleiter/Django-facebook,VishvajitP/Django-facebook,jcpyun/Django-facebook,takeshines... | django_facebook/admin.py | django_facebook/admin.py | from django.contrib import admin
from django.conf import settings
from django.core.urlresolvers import reverse
from django_facebook import admin_actions
from django_facebook import models
class FacebookUserAdmin(admin.ModelAdmin):
list_display = ('user_id', 'name', 'facebook_id',)
search_fields = ('name',)
... | from django.contrib import admin
from django.conf import settings
from django.core.urlresolvers import reverse
from django_facebook import admin_actions
from django_facebook import models
class FacebookUserAdmin(admin.ModelAdmin):
list_display = ('user_id', 'name', 'facebook_id',)
search_fields = ('name',)
... | bsd-3-clause | Python |
83a16ba4485f3e483adc20352cb0cef7c02f8ef2 | Convert unit test to test all registered schemas instead of plugins directly. | vfrc2/Flexget,poulpito/Flexget,jacobmetrick/Flexget,ibrahimkarahan/Flexget,Danfocus/Flexget,oxc/Flexget,ibrahimkarahan/Flexget,asm0dey/Flexget,qvazzler/Flexget,dsemi/Flexget,crawln45/Flexget,thalamus/Flexget,tsnoam/Flexget,patsissons/Flexget,tsnoam/Flexget,vfrc2/Flexget,Danfocus/Flexget,drwyrm/Flexget,v17al/Flexget,grr... | tests/test_config_schema.py | tests/test_config_schema.py | from __future__ import unicode_literals, division, absolute_import
import jsonschema
from flexget import config_schema
from tests import FlexGetBase
class TestSchemaValidator(FlexGetBase):
def test_registered_schemas_are_valid(self):
for path in config_schema.schema_paths:
schema = config_sc... | from __future__ import unicode_literals, division, absolute_import
import jsonschema
from flexget import config_schema
from flexget import plugin
from tests import FlexGetBase
class TestSchemaValidator(FlexGetBase):
def test_plugin_schemas_are_valid(self):
for p in plugin.plugins.values():
i... | mit | Python |
939f37cc21a653082eee1f16bf5411e404cf928a | Fix list paths | jason-neal/eniric,jason-neal/eniric | eniric/__init__.py | eniric/__init__.py | __version__ = '0.1'
__all__ = ["atmosphere", "IOmodule", "nIRanalysis", "plotting_functions", "Qcalculator", "resample",
"snr_normalization", "utilities"]
# Read the users config.yaml file.
# If it doesn't exist, print a useful help message
import yaml
import os
try:
f = open("config.yaml")
config ... | __version__ = '0.1'
__all__ = ["atmosphere", "IOmodule", "nIRanalysis", "plotting_functions", "Qcalculator", "resample",
"snr_normalization", "utilities"]
# Read the users config.yaml file.
# If it doesn't exist, print a useful help message
import yaml
import os
try:
f = open("config.yaml")
config ... | mit | Python |
d1ff40c3278b3f2f3ec1a1f79c931256f766fc1a | Remove unused import | davidlonjon/aws-proxies,davidlonjon/aws-proxies | symaps_proxies/main.py | symaps_proxies/main.py | # -*- coding: utf-8 -*-
import lib.common.aws_utils as aws
import logging
import settings
import sys
def setup_logger():
"""Setup logger
Returns:
object: Logger
"""
try: # Python 2.7+
from logging import NullHandler
except ImportError:
cla... | # -*- coding: utf-8 -*-
import lib.common.aws_utils as aws
import logging
import settings
import json
import sys
def setup_logger():
"""Setup logger
Returns:
object: Logger
"""
try: # Python 2.7+
from logging import NullHandler
except ImportError:
... | mit | Python |
5a57b4c92a83c4992d494b1f031ee09ffd6c6199 | Add CAN_DETECT | meetmangukiya/coala-bears,srisankethu/coala-bears,incorrectusername/coala-bears,vijeth-aradhya/coala-bears,horczech/coala-bears,Vamshi99/coala-bears,mr-karan/coala-bears,Asnelchristian/coala-bears,ku3o/coala-bears,gs0510/coala-bears,sounak98/coala-bears,shreyans800755/coala-bears,shreyans800755/coala-bears,madhukar01/c... | bears/ruby/RubySyntaxBear.py | bears/ruby/RubySyntaxBear.py | from coalib.bearlib.abstractions.Linter import linter
@linter(executable='ruby',
use_stdout=False,
use_stderr=True,
output_format='regex',
output_regex=r'.+?:(?P<line>\d+): (?P<message>.*?'
r'(?P<severity>error|warning)[,:] \S+)\s?'
r'(?:\S+\s(... | from coalib.bearlib.abstractions.Linter import linter
@linter(executable='ruby',
use_stdout=False,
use_stderr=True,
output_format='regex',
output_regex=r'.+?:(?P<line>\d+): (?P<message>.*?'
r'(?P<severity>error|warning)[,:] \S+)\s?'
r'(?:\S+\s(... | agpl-3.0 | Python |
86988050c942449453af6637a5d6bf84cf1bc7e0 | bump version | executablebooks/markdown-it-py,executablebooks/markdown-it-py,executablebooks/markdown-it-py | markdown_it/__init__.py | markdown_it/__init__.py | from .main import MarkdownIt # noqa: F401
__version__ = "0.4.0"
| from .main import MarkdownIt # noqa: F401
__version__ = "0.3.3"
| mit | Python |
b2adc927d30dc6666cdd3b156f7e28c9068a9645 | Print notes | konomae/lastpass-python | example/example.py | example/example.py | #!/usr/bin/env python
# coding: utf-8
import json
import os
from lastpass import (
Vault,
LastPassIncorrectYubikeyPasswordError,
LastPassIncorrectGoogleAuthenticatorCodeError
)
DEVICE_ID = "example.py"
with open(os.path.join(os.path.dirname(__file__), 'credentials.json')) as f:
credentials = json.loa... | #!/usr/bin/env python
# coding: utf-8
import json
import os
from lastpass import (
Vault,
LastPassIncorrectYubikeyPasswordError,
LastPassIncorrectGoogleAuthenticatorCodeError
)
DEVICE_ID = "example.py"
with open(os.path.join(os.path.dirname(__file__), 'credentials.json')) as f:
credentials = json.loa... | mit | Python |
bc071a524d1695e6d95b42709442dddaf4185cd9 | FIX visibility of forecast button | OCA/account-closing,OCA/account-closing | account_invoice_start_end_dates/__manifest__.py | account_invoice_start_end_dates/__manifest__.py | # Copyright 2016-2019 Akretion France
# Copyright 2018-2019 Camptocamp
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Invoice Start End Dates",
"version": "13.0.1.0.0",
"category": "Accounting & Finance",
"li... | # Copyright 2016-2019 Akretion France
# Copyright 2018-2019 Camptocamp
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Invoice Start End Dates",
"version": "13.0.1.0.0",
"category": "Accounting & Finance",
"li... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.