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 |
|---|---|---|---|---|---|---|---|---|
b8616c40544f7cbca094c1b46ed89bedfe61a67d | allow textpress to access __version__ and __url__ (fixes attribute error) | mitsuhiko/zine,mitsuhiko/zine,mitsuhiko/zine | textpress/__init__.py | textpress/__init__.py | # -*- coding: utf-8 -*-
"""
textpress
~~~~~~~~~
TextPress is a simple python weblog software.
Get a WSGI Application
======================
To get the WSGI application for TextPress you can use the `make_app`
function. This function can either create a dispatcher for one instance
or... | # -*- coding: utf-8 -*-
"""
textpress
~~~~~~~~~
TextPress is a simple python weblog software.
Get a WSGI Application
======================
To get the WSGI application for TextPress you can use the `make_app`
function. This function can either create a dispatcher for one instance
or... | bsd-3-clause | Python |
2e8768d9a556afd2b2e6c974dcbcf24fee5ba6ff | Add pretty printing for GList and GSList | MathieuDuponchelle/glib,cention-sany/glib,OpenInkpot-archive/iplinux-glib2.0,darren-clark/android_platform_external_bluetooth_glib,OpenInkpot-archive/iplinux-glib2.0,johne53/MB3Glib,tamaskenez/glib,ieei/glib,endlessm/glib,tamaskenez/glib,pstglia/platform-external-bluetooth-glib,johne53/MB3Glib,cosimoc/glib,iConsole/Con... | glib/glib.py | glib/glib.py | import gdb
# This is not quite right, as local vars may override symname
def read_global_var (symname):
return gdb.selected_frame().read_var(symname)
def g_quark_to_string (quark):
if quark == None:
return None
quark = long(quark)
if quark == 0:
return None
val = read_global_var ("... | import gdb
# This is not quite right, as local vars may override symname
def read_global_var (symname):
return gdb.selected_frame().read_var(symname)
def g_quark_to_string (quark):
if quark == None:
return None
quark = long(quark)
if quark == 0:
return None
val = read_global_var ("... | lgpl-2.1 | Python |
47c3440843ac67dc87371420b2620af32afc9777 | convert legacy grouptest to query serviceapi directly | ameihm0912/vmintgr,ameihm0912/vmintgr | grouptest.py | grouptest.py | #!/usr/bin/python
import sys
import getopt
import libvmintgr
import json
import pyservicelib as slib
def usage():
sys.stdout.write('usage: grouptest.py [-hj] [-f path] (ip|host):string\n')
confpath = None
jsonoutput = False
try:
opts, args = getopt.getopt(sys.argv[1:], 'f:hj')
except getopt.GetoptError as ... | #!/usr/bin/python
import sys
import getopt
import libvmintgr
import json
def usage():
sys.stdout.write('usage: grouptest.py [-hj] [-f path] (ip|host):string\n')
confpath = None
jsonoutput = False
try:
opts, args = getopt.getopt(sys.argv[1:], 'f:hj')
except getopt.GetoptError as e:
sys.stderr.write(str(e... | mpl-2.0 | Python |
0f92fec0af7fe8e725654562c0eea004f54f0937 | Fix failure to add subscribers on upgrade | rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac | trac/upgrades/db40.py | trac/upgrades/db40.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists of vo... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists of vo... | bsd-3-clause | Python |
db0cb74ce1e6f4588dda5f4cb4ef5efc08162c31 | Add indent flag for data util | christabor/flask_jsondash,christabor/flask_jsondash,christabor/flask_jsondash | flask_jsondash/data_utils/filetree.py | flask_jsondash/data_utils/filetree.py | #!/usr/bin/env python
"""
A utility for getting d3 friendly hierarchical data structures
from the list of files and directories on a given path.
Re-purposed from:
github.com/christabor/MoAL/blob/master/MOAL/get_file_tree.py
"""
import os
from pprint import pprint
import errno
import json
import click
def path_hie... | #!/usr/bin/env python
"""
A utility for getting d3 friendly hierarchical data structures
from the list of files and directories on a given path.
Re-purposed from:
github.com/christabor/MoAL/blob/master/MOAL/get_file_tree.py
"""
import os
from pprint import pprint
import errno
import json
import click
def path_hie... | mit | Python |
2a49cdce802a991d83ac8a41086d10d6280cfac5 | Use requests from task | qvazzler/Flexget,crawln45/Flexget,spencerjanssen/Flexget,poulpito/Flexget,ianstalk/Flexget,crawln45/Flexget,voriux/Flexget,crawln45/Flexget,JorisDeRieck/Flexget,ZefQ/Flexget,vfrc2/Flexget,sean797/Flexget,ZefQ/Flexget,ratoaq2/Flexget,v17al/Flexget,tsnoam/Flexget,tsnoam/Flexget,oxc/Flexget,cvium/Flexget,camon/Flexget,v17... | flexget/plugins/urlrewrite_eztv.py | flexget/plugins/urlrewrite_eztv.py | from __future__ import unicode_literals, division, absolute_import
import re
import logging
from urlparse import urlparse, urlunparse
from requests import RequestException
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexget.utils imp... | from __future__ import unicode_literals, division, absolute_import
import re
import logging
from urlparse import urlparse, urlunparse
from requests import RequestException
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexget.utils imp... | mit | Python |
c7b4c3d6cb7e2c7dd4588aac7bb53622f5476e38 | fix DealFactory for split amount | HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily | lily/deals/factories.py | lily/deals/factories.py | import datetime
from factory.declarations import SubFactory, LazyAttribute, SelfAttribute
from factory.django import DjangoModelFactory
from factory.fuzzy import FuzzyDecimal, FuzzyDate, FuzzyChoice
from faker.factory import Factory
from lily.accounts.factories import AccountFactory
from lily.deals.models import Deal... | import datetime
from factory.declarations import SubFactory, LazyAttribute, SelfAttribute
from factory.django import DjangoModelFactory
from factory.fuzzy import FuzzyDecimal, FuzzyDate, FuzzyChoice
from faker.factory import Factory
from lily.accounts.factories import AccountFactory
from lily.deals.models import Deal... | agpl-3.0 | Python |
7fc6a901aec364fa24b04f872e6d421b751716a1 | Update ipc_lista2.02.py | any1m1c/ipc20161 | lista2/ipc_lista2.02.py | lista2/ipc_lista2.02.py | #ipc_lista2.02
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça um valor e mostre na tela se o valor é positivo ou negativo.
valor = float(input("Informe um numero: "))
if (valor > 0):
| #ipc_lista2.02
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça um valor e mostre na tela se o valor é positivo ou negativo.
valor = float(input("Informe um numero: "))
if (valor > 0
| apache-2.0 | Python |
cc7ecdde38b097abf146cf3bba3ee054751825cb | Update justipinfo.py | pmatv/justip-info | justipinfo.py | justipinfo.py | from flask import Flask, request, url_for
import GeoIP
import socket
app = Flask(__name__, static_url_path='/static')
geoipcity="/usr/share/GeoIP/GeoIPCity.dat"
geoipasnum="/usr/share/GeoIP/GeoIPASNum.dat"
#Get information about IP address from GeoIP database
def ipdata(ipaddr):
ipfull = GeoIP.open(geoipcity, Ge... | Ifrom flask import Flask, request, url_for
import GeoIP
import socket
app = Flask(__name__, static_url_path='/static')
geoipcity="/usr/share/GeoIP/GeoIPCity.dat"
geoipasnum="/usr/share/GeoIP/GeoIPASNum.dat"
#Get information about IP address from GeoIP database
def ipdata(ipaddr):
ipfull = GeoIP.open(geoipcity, G... | mit | Python |
d382aea28da3849f898fe8b87542c13e74b7fc83 | ADD report | ingadhoc/odoo-nautical,adhoc-dev/odoo-nautical | addons/nautical_reports/__openerp__.py | addons/nautical_reports/__openerp__.py | # -*- coding: utf-8 -*-
{'active': False,
'author': u'Ingenieria ADHOC',
'category': u'base.module_category_knowledge_management',
'depends': [
'nautical_x',
'report_aeroo',
'report_aeroo_ooo',
'l10n_ar_aeroo_base',
],
'description': """
Nautical Reports
=============... | # -*- coding: utf-8 -*-
{'active': False,
'author': u'Ingenieria ADHOC',
'category': u'base.module_category_knowledge_management',
'depends': [
'nautical_x',
'report_aeroo',
'report_aeroo_ooo',
'l10n_ar_aeroo_base',
],
'description': """
Nautical Reports
=============... | agpl-3.0 | Python |
81476e297f791f73d7e3f11ad5a6c377863871cc | Update ipc_lista2.06.py | any1m1c/ipc20161 | lista2/ipc_lista2.06.py | lista2/ipc_lista2.06.py | #ipc_lista2.06
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que leia três números e mostre o maior deles.
num1 = int(input("Insira um numero: ")
num2 = int(input("Insira outro numero: ")
num3 = int(input("Insira mais um numero: ")
if num1>num2
if num1>num3:
print
... | #ipc_lista2.06
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que leia três números e mostre o maior deles.
num1 = int(input("Insira um numero: ")
num2 = int(input("Insira outro numero: ")
num3 = int(input("Insira mais um numero: ")
if num1>num2
if num1>num3
if num2>num1
... | apache-2.0 | Python |
a9609ade02238d67d3980f61533063b93a830d58 | Update trash.py | Programmeerclub-WLG/Agenda-App | gui/trash.py | gui/trash.py |
"""
Dit is het bestand voor het prullenbak scherm voor de Agenda-App
Het heeft een aantal functies en dezen staat beschreven in de drive.
<LICENSE>
<COPYRIGHT NOTICE>
<DEVELOPER>
<VERSION and DATE>
"""
| apache-2.0 | Python | |
587d6542d1c5e80aa22f99318727cab7dbdcb1b8 | clean juliaset.py | moksh100/juliasets | juliaset.py | juliaset.py | import cmath;
import numpy;
import time;
class JuliaSet(object):
def __init__(self, c, n=100, _d=0.001):
self.c=c;
self.set=numpy.array([]);
self._d=_d;
if(n>0):
self.n=n;
else:
print "Reset n to 100";
self._complexplane = numpy.array([]);
... | import cmath;
import numpy;
import time;
class JuliaSet(object):
def __init__(self, c, n=100, _d=0.001):
self.c=c;
self.set=numpy.array([]);
self._d=_d;
if(n>0):
self.n=n;
else:
print "Reset n to 100";
self._complexplane = numpy.array([]);
... | mit | Python |
7e5ea3684cd13ad87122e67645e843da883dcd4f | Fix typo | softwaresaved/international-survey | analysis/include/transforming_title.py | analysis/include/transforming_title.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
In case of several questions representing items (such as for likert) or questions that needs to be grouped
(such as the questions with severla y/n) it is impossible to have a proper title. Here it is the corresponding dictionary to match the code of the question with t... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
In case of several questions representing items (such as for likert) or questions that needs to be grouped
(such as the questions with severla y/n) it is impossible to have a proper title. Here it is the corresponding dictionary to match the code of the question with t... | bsd-3-clause | Python |
bbf22dc68202d81a8c7e94fbb8e61d819d808115 | Make pledge foreignkey to userprofile | TejasM/wisely,TejasM/wisely,TejasM/wisely | wisely_project/pledges/models.py | wisely_project/pledges/models.py | from django.utils import timezone
from django.db import models
from users.models import Course, BaseModel, UserProfile
class Pledge(BaseModel):
user = models.ForeignKey(UserProfile)
course = models.ForeignKey(Course)
money = models.DecimalField(max_digits=8, decimal_places=2)
pledge_date = models.Dat... | from django.utils import timezone
from django.db import models
from users.models import Course, BaseModel, User
class Pledge(BaseModel):
user = models.ForeignKey(User)
course = models.ForeignKey(Course)
money = models.DecimalField(max_digits=8, decimal_places=2)
pledge_date = models.DateTimeField('da... | mit | Python |
f20cb62ab846f167a5687775a941c9c8f5c97ea8 | downgrade default logging | NielsZeilemaker/knit,blaze/knit,blaze/knit,NielsZeilemaker/knit | knit/utils.py | knit/utils.py | from __future__ import print_function, division, absolute_import
import re
import logging
import subprocess
format = ('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logging.basicConfig(format=format, level=logging.INFO)
def set_logging(level):
logger = logging.getLogger('knit')
logger.setLevel(leve... | from __future__ import print_function, division, absolute_import
import re
import logging
import subprocess
format = ('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logging.basicConfig(format=format, level=logging.DEBUG)
def conf_to_dict(fname):
name_match = re.compile("<name>(.*?)</name>")
val_mat... | bsd-3-clause | Python |
50d33e7b03373d82db91162a023df5a4eaa856f4 | debug add controlled features and predict_proba | feruxmax/ml_sophie | learning.py | learning.py | import pandas as pd
from sklearn.cross_validation import KFold
from sklearn.cross_validation import cross_val_score
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import precision_score
from sklearn.preprocessing import StandardScaler
from sklearn.... | import pandas as pd
from sklearn.cross_validation import KFold
from sklearn.cross_validation import cross_val_score
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import precision_score
from sklearn.preprocessing import StandardScaler
from sklearn.... | mit | Python |
2d374e55baeffc0e090ed6b6bbaf5e3e0d82095f | Update version number for a new release | Situphen/Python-ZMarkdown,Situphen/Python-ZMarkdown,Situphen/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown | markdown/__version__.py | markdown/__version__.py | #
# markdown/__version__.py
#
# version_info should conform to PEP 386
# (major, minor, micro, alpha/beta/rc/final, #)
# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
# (1, 2, 0, 'beta', 2) => "1.2b2"
version_info = (2, 6, 0, 'zds', 9)
def _get_version():
" Returns a PEP 386-compliant version number from version_info. "
... | #
# markdown/__version__.py
#
# version_info should conform to PEP 386
# (major, minor, micro, alpha/beta/rc/final, #)
# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
# (1, 2, 0, 'beta', 2) => "1.2b2"
version_info = (2, 6, 0, 'zds', 8)
def _get_version():
" Returns a PEP 386-compliant version number from version_info. "
... | bsd-3-clause | Python |
ee83b1a14a06a49c68d8eaa19358550b1a935cd1 | Fix malformed error | matrix-org/matrix-python-sdk | matrix_client/errors.py | matrix_client/errors.py | class MatrixError(Exception):
"""A generic Matrix error. Specific errors will subclass this."""
pass
class MatrixUnexpectedResponse(MatrixError):
"""The home server gave an unexpected response. """
def __init__(self, content=""):
super(MatrixError, self).__init__(content)
self.content... | class MatrixError(Exception):
"""A generic Matrix error. Specific errors will subclass this."""
pass
class MatrixUnexpectedResponse(MatrixError):
"""The home server gave an unexpected response. """
def __init__(self, content=""):
super(MatrixError, self).__init__(content)
self.content... | apache-2.0 | Python |
8eca7b30865e4d02fd440f55ad3215dee6fab8a1 | Add warning when removing an asset without full path | tracek/gee_asset_manager | gee_asset_manager/batch_remover.py | gee_asset_manager/batch_remover.py | import fnmatch
import logging
import sys
import ee
def delete(asset_path):
root_idx = asset_path.rfind('/')
if root_idx == -1:
logging.warning('Asset not found. Make sure you pass full asset name, e.g. users/pinkiepie/rainbow')
sys.exit(1)
root = asset_path[:root_idx]
all_assets_names... | import fnmatch
import logging
import sys
import ee
def delete(asset_path):
root = asset_path[:asset_path.rfind('/')]
all_assets_names = [e['id'] for e in ee.data.getList({'id': root})]
filtered_names = fnmatch.filter(all_assets_names, asset_path)
if not filtered_names:
logging.warning('Nothin... | apache-2.0 | Python |
2458620f3f5ce5995a4cac7b715f200af94871e0 | Update AuthorizedHandler | fkmclane/MCP,fkmclane/MCP,fkmclane/MCP,fkmclane/MCP | mcp/interface/common.py | mcp/interface/common.py | import base64
import os
import web
from .. import users
class AuthorizedHandler(web.HTTPHandler):
auth = [ 'Basic', 'Key' ]
realm = 'unknown'
def respond(self):
auth_header = self.request.headers.get('Authorization')
if not auth_header:
return unauthorized()
try:
self.auth_type, self.auth_string = a... | import base64
import os
import web
from .. import users
class AuthorizedHandler(web.HTTPHandler):
auth = [ 'Basic', 'Key' ]
realm = 'unknown'
def respond(self):
auth_header = self.request.headers.get('Authorization')
if not auth_header:
return unauthorized()
try:
self.auth_type, self.auth_string = a... | mit | Python |
1441eb5585883876e58f233e94519d79a8d290dd | Add test descriptions for NetworkTest | openworm/PyOpenWorm,gsarma/PyOpenWorm,gsarma/PyOpenWorm,openworm/PyOpenWorm | tests/NetworkTest.py | tests/NetworkTest.py | import sys
sys.path.insert(0,".")
import unittest
import neuroml
import neuroml.writers as writers
import PyOpenWorm
from PyOpenWorm import *
import networkx
import rdflib
import rdflib as R
import pint as Q
import os
import subprocess as SP
import subprocess
import tempfile
import doctest
from glob import glob
from ... | import sys
sys.path.insert(0,".")
import unittest
import neuroml
import neuroml.writers as writers
import PyOpenWorm
from PyOpenWorm import *
import networkx
import rdflib
import rdflib as R
import pint as Q
import os
import subprocess as SP
import subprocess
import tempfile
import doctest
from glob import glob
from ... | mit | Python |
7a4108714a95c3b9ea28478e1ee9fed5795b23f4 | Fix bug when calling a function without parameters | stcorp/legato | legato/run.py | legato/run.py | import subprocess
import re
import logging
import thread
from importlib import import_module
from datetime import datetime
logger = logging.getLogger(__name__)
def run_task(job_name, shell=None, cmd=None, python=None, env={}, **kwargs):
def run_parallel_task(what, run_shell=False):
try:
clock... | import subprocess
import re
import logging
import thread
from importlib import import_module
from datetime import datetime
logger = logging.getLogger(__name__)
def run_task(job_name, shell=None, cmd=None, python=None, env={}, **kwargs):
def run_parallel_task(what, run_shell=False):
try:
clock... | bsd-3-clause | Python |
74f81eb97f7116db184bc6749999c6fb2d61b4e1 | add absolute url maker | kylewm/mf2py,tommorris/mf2py,kylewm/mf2py,tommorris/mf2py | mf2py/parse_property.py | mf2py/parse_property.py | from bs4 import Tag
from dom_helpers import get_attr
from urlparse import urljoin
## functions to parse the propertis of elements
def text(el):
# add value-class-pattern
prop_value = get_attr(el, "title", check_name="abbr")
if prop_value is not None:
return prop_value
prop_value = get_attr(el,... | from bs4 import Tag
from dom_helpers import get_attr
## functions to parse the propertis of elements
def text(el):
# add value-class-pattern
prop_value = get_attr(el, "title", check_name="abbr")
if prop_value is not None:
return prop_value
prop_value = get_attr(el, "value", check_name=("data",... | mit | Python |
5d4ade01460ed346c89ed8223c617e291e804818 | Make sure tests pass if there's no SQLAlchemy | snare/scruffy | tests/state_tests.py | tests/state_tests.py | import os
try:
import sqlalchemy
HAVE_SQLALCHEMY = True
except:
HAVE_SQLALCHEMY = False
from nose.tools import *
from scruffy.state import *
STATE_FILE = 'test.state'
def setup():
State(STATE_FILE).cleanup()
def test_state():
s = State(STATE_FILE)
s['xxx'] = 1
assert s.d == {'xxx': 1}
... | import os
from nose.tools import *
from scruffy.state import *
STATE_FILE = 'test.state'
def setup():
State(STATE_FILE).cleanup()
def test_state():
s = State(STATE_FILE)
s['xxx'] = 1
assert s.d == {'xxx': 1}
s.save()
assert os.path.exists(STATE_FILE)
s2 = State(STATE_FILE)
assert s2[... | mit | Python |
60de09cb9fa81cca6c269b84d9c285cf6ca4dd0d | test to trigger travis | ericmjonas/pychirpz,ericmjonas/pychirpz,ericmjonas/pychirpz | tests/test_chirpz.py | tests/test_chirpz.py | import numpy as np
import chirpz
def test_fft_eq():
N = 128
for M in [128, 32, 10]:
for start_idx in [0, 4, 8]:
x = np.random.normal(0, 1, N)
x_fft = np.fft.fft(x)
w_delta = 2.0*np.pi/N
start = start_idx * w_delta
x_chirpz = chirpz.... | import numpy as np
import chirpz
def test_fft_eq():
N = 128
for M in [128, 32, 10]:
for start_idx in [0, 4, 8]:
x = np.random.normal(0, 1, N)
x_fft = np.fft.fft(x)
w_delta = 2.0*np.pi/N
start = start_idx * w_delta
x_chirpz = chirpz.... | mit | Python |
a64370d96775d191ddb2094740f2c3bcd48fea2a | add N (ŋ) to the consonants set. | jwilk/anorack,jwilk/anorack | lib/misc.py | lib/misc.py | # Copyright © 2016 Jakub Wilk <jwilk@jwilk.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the “Software”), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, p... | # Copyright © 2016 Jakub Wilk <jwilk@jwilk.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the “Software”), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, p... | mit | Python |
0255a9cc22999d3111076155feab85ebe3198492 | Add FIXME to address removing debug information from generated shaders. | chinmaygarde/flutter_engine,rmacnak-google/engine,devoncarew/engine,devoncarew/engine,chinmaygarde/flutter_engine,devoncarew/engine,rmacnak-google/engine,rmacnak-google/engine,rmacnak-google/engine,flutter/engine,chinmaygarde/flutter_engine,chinmaygarde/flutter_engine,flutter/engine,chinmaygarde/flutter_engine,rmacnak-... | impeller/tools/build_metal_library.py | impeller/tools/build_metal_library.py | # Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import argparse
import errno
import os
import subprocess
def MakeDirectories(path):
try:
os.makedirs(path)
except OSError as exc:... | # Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import argparse
import errno
import os
import subprocess
def MakeDirectories(path):
try:
os.makedirs(path)
except OSError as exc:... | bsd-3-clause | Python |
62c452fa262d716f61516daae062099279ee56db | add test for refine_3_8() | vlukes/sfepy,BubuLK/sfepy,RexFuzzle/sfepy,RexFuzzle/sfepy,sfepy/sfepy,rc/sfepy,lokik/sfepy,vlukes/sfepy,BubuLK/sfepy,RexFuzzle/sfepy,lokik/sfepy,lokik/sfepy,rc/sfepy,RexFuzzle/sfepy,BubuLK/sfepy,rc/sfepy,sfepy/sfepy,lokik/sfepy,sfepy/sfepy,vlukes/sfepy | tests/test_domain.py | tests/test_domain.py | import os.path as op
from sfepy.base.testing import TestCommon
from sfepy import data_dir
from sfepy.fem import Mesh, Domain
def refine(domain, out_dir, level=3):
for ii in range(3):
domain = domain.refine()
filename = op.join(out_dir, 'refine_' + domain.mesh.name + '.mesh')
domain.mesh.wr... | import os.path as op
from sfepy.base.testing import TestCommon
class Test(TestCommon):
@staticmethod
def from_conf(conf, options):
from sfepy import data_dir
from sfepy.fem import Mesh, Domain
mesh = Mesh('mesh', data_dir + '/meshes/various_formats/small3d.mesh')
domain = Dom... | bsd-3-clause | Python |
939f68a3ad5d889a53ccbab6eb25b418c1e56a85 | Remove a hack for GPUVerify that is no longer necessary. | symbooglix/boogie-runner,symbooglix/boogie-runner | BoogieRunner/Runners/GPUVerify.py | BoogieRunner/Runners/GPUVerify.py | # vim: set sw=2 ts=2 softtabstop=2 expandtab:
from . RunnerBase import RunnerBaseClass
from .. ResultType import ResultType
from .. Analysers.GPUVerify import GPUVerifyAnalyser
import logging
import os
import psutil
import re
import sys
import yaml
_logger = logging.getLogger(__name__)
class GPUVerifyRunnerException(... | # vim: set sw=2 ts=2 softtabstop=2 expandtab:
from . RunnerBase import RunnerBaseClass
from .. ResultType import ResultType
from .. Analysers.GPUVerify import GPUVerifyAnalyser
import logging
import os
import psutil
import re
import sys
import yaml
_logger = logging.getLogger(__name__)
class GPUVerifyRunnerException(... | bsd-3-clause | Python |
72a6fff15829c62d8f80ce424d6b73472571aaed | return company 1 normal year | Micronaet/micronaet-product,Micronaet/micronaet-product | inventory_status_company1/company1.py | inventory_status_company1/company1.py | # -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | # -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | agpl-3.0 | Python |
0c435ef863ee24a95554a10353f9d27c04c49260 | fix testcase | er1iang/hfut_stu_lib,evilerliang/hfut-stu-lib,er1iang/hfut-stu-lib | tests/test_parser.py | tests/test_parser.py | # -*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from bs4 import BeautifulSoup
from hfut_stu_lib import parser, BaseSession
class TestParser(object):
def test_parse_tr_strs(self):
single_tag = "<tr><td>Fuck!</td></tr>"
assert ... | # -*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from bs4 import BeautifulSoup
from hfut_stu_lib import parser
class TestParser(object):
def test_parse_tr_strs(self):
single_tag = "<tr><td>Fuck!</td></tr>"
assert parser.parse_... | mit | Python |
14a39093ed39104d55a14b6dd2cb1653ccc8f1e6 | Remove the temp file when we're done. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_bsddb.py | Lib/test/test_bsddb.py | #! /usr/bin/env python
"""Test script for the bsddb C module
Roger E. Masse
"""
import os
import bsddb
import tempfile
from test_support import verbose
def test(openmethod, what):
if verbose:
print '\nTesting: ', what
fname = tempfile.mktemp()
f = openmethod(fname, 'c')
if verbose... | #! /usr/bin/env python
"""Test script for the bsddb C module
Roger E. Masse
"""
import bsddb
import tempfile
from test_support import verbose
def test(openmethod, what):
if verbose:
print '\nTesting: ', what
fname = tempfile.mktemp()
f = openmethod(fname, 'c')
if verbose:
p... | mit | Python |
eda7494959d547ea4f6e932516b9388fd63e4695 | Drop miscellaneous deprecated features | pinax/django-announcements,pinax/django-announcements,pinax/pinax-announcements | pinax/announcements/models.py | pinax/announcements/models.py | from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
class Announcement(models.Model):
"""
A single announcement.
"""
DISMISSAL_NO = 1
DISMISSAL_SESSION = 2
DISMISS... | from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class Announcement(models.Model):
"""
A single announcement.
"""
DISMISSAL_NO = 1
DISMISSAL_SESSION = 2
DISMIS... | mit | Python |
060e47f2282cdfa38c883b06bb5023db96022d0a | write a less verbose more informative docstring | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator_abstract/models/base_nav_tree_item.py | accelerator_abstract/models/base_nav_tree_item.py | from __future__ import unicode_literals
import swapper
from django.db import models
from sitetree.models import TreeItemBase
from accelerator_abstract.models.accelerator_model import AcceleratorModel
class BaseNavTreeItem(TreeItemBase, AcceleratorModel):
"""
The tree field specifies the NavTree object that ... | from __future__ import unicode_literals
import swapper
from django.db import models
from sitetree.models import TreeItemBase
from accelerator_abstract.models.accelerator_model import AcceleratorModel
class BaseNavTreeItem(TreeItemBase, AcceleratorModel):
"""
A class used to represent a django sitetree item
... | mit | Python |
77b73f9def931bb33be73e5fb6d7d2f88913e7a0 | Update __init__.py | delitamakanda/socialite,delitamakanda/socialite,delitamakanda/socialite | app/main/__init__.py | app/main/__init__.py | from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
from ..models import Permission
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
| from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
from ..models import Permission
from . import cache
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
| mit | Python |
f7964fe9d8fef174e3b0c3acedf33a05be019f5a | Fix for new Fastly log format | pydotorg/pypi,pydotorg/pypi,pydotorg/pypi,pydotorg/pypi | tools/rsyslog-cdn.py | tools/rsyslog-cdn.py | #!/usr/bin/python -u
import sys
import redis
import csv
import posixpath
import datetime
import logging
import logging.handlers
from email.utils import parsedate
PRECISIONS = [
("hour", "%y-%m-%d-%H", datetime.timedelta(days=2)),
("daily", "%y-%m-%d", datetime.timedelta(days=32)),
]
logger = logging.getLog... | #!/usr/bin/python -u
import sys
import redis
import csv
import posixpath
import datetime
import logging
import logging.handlers
from email.utils import parsedate
PRECISIONS = [
("hour", "%y-%m-%d-%H", datetime.timedelta(days=2)),
("daily", "%y-%m-%d", datetime.timedelta(days=32)),
]
logger = logging.getLog... | bsd-3-clause | Python |
649c9c1cb879c0b60f5a39a5dacbcf7e71946d27 | remove unused methods | Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith | lazyblacksmith/models/sde/activity.py | lazyblacksmith/models/sde/activity.py | # -*- encoding: utf-8 -*-
from . import db
class Activity(db.Model):
item_id = db.Column(db.Integer, db.ForeignKey('item.id'), primary_key=True)
time = db.Column(db.Integer, nullable=True)
activity = db.Column(db.Integer, primary_key=True, autoincrement=False)
| # -*- encoding: utf-8 -*-
from . import db
class Activity(db.Model):
item_id = db.Column(db.Integer, db.ForeignKey('item.id'), primary_key=True)
time = db.Column(db.Integer, nullable=True)
activity = db.Column(db.Integer, primary_key=True, autoincrement=False)
@classmethod
def get_activity_name(... | bsd-3-clause | Python |
fade1a373e4505a739acbb81f8642143dc011869 | Revise to better var name: posdiff_len_d from London | bowen0701/algorithms_data_structures | lc1027_longest_arithmetic_sequence.py | lc1027_longest_arithmetic_sequence.py | """Leetcode 1027. Longest Arithmetic Sequence
Medium
URL: https://leetcode.com/problems/longest-arithmetic-sequence/
Given an array A of integers, return the length of the longest arithmetic
subsequence in A.
Recall that a subsequence of A is a list A[i_1], A[i_2], ..., A[i_k] with
0 <= i_1 < i_2 < ... < i_k <= A.le... | """Leetcode 1027. Longest Arithmetic Sequence
Medium
URL: https://leetcode.com/problems/longest-arithmetic-sequence/
Given an array A of integers, return the length of the longest arithmetic
subsequence in A.
Recall that a subsequence of A is a list A[i_1], A[i_2], ..., A[i_k] with
0 <= i_1 < i_2 < ... < i_k <= A.le... | bsd-2-clause | Python |
427e22346b640ce82cfce89eab29324045203b94 | Update urls.py | WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight | TWLight/resources/urls.py | TWLight/resources/urls.py | from django.conf.urls import url
from django_filters.views import FilterView
from .models import Partner
from .filters import PartnerFilter
from . import views
urlpatterns = [
url(r'^$',
views.PartnersFilterView.as_view(filterset_class=PartnerFilter),
name='filter'
),
url(r'^(?P<pk>\d+)/$'... | from django.conf.urls import url
from django_filters.views import FilterView
from .models import Partner
from .filters import PartnerFilter
from . import views
urlpatterns = [
url(r'^$',
views.PartnersFilterView.as_view(filterset_class=PartnerFilter),
name='filter'
),
url(r'^(?P<pk>\d+)/$'... | mit | Python |
6949685f91f49fe0f0cd7287f9c05b6a0f862066 | Update cybergis-script-geogig-osm-sync.py | state-hiu/cybergis-scripts,state-hiu/cybergis-scripts | bin/cybergis-script-geogig-osm-sync.py | bin/cybergis-script-geogig-osm-sync.py | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
import time
import os
import sys
#==#
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib', 'cybergis')))
import gg._geogig_sync_osm
#==#
parser = argparse.ArgumentParser... | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
import time
import os
import sys
#==#
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib', 'cybergis')))
import gg._geogig_sync_osm
#==#
parser = argparse.ArgumentParser... | mit | Python |
18a874f312a57b4b9b7a5ce5cf9857585f0f0fef | Fix error if no units | agepoly/truffe2,ArcaniteSolutions/truffe2,ArcaniteSolutions/truffe2,agepoly/truffe2,agepoly/truffe2,ArcaniteSolutions/truffe2,agepoly/truffe2,ArcaniteSolutions/truffe2 | truffe2/app/utils.py | truffe2/app/utils.py | from django.conf import settings
def add_current_unit(request):
"""Template context processor to add current unit"""
return {'CURRENT_UNIT': get_current_unit(request)}
def get_current_unit(request):
"""Return the current unit"""
from units.models import Unit
current_unit_pk = request.session.g... |
def add_current_unit(request):
"""Template context processor to add current unit"""
return {'CURRENT_UNIT': get_current_unit(request)}
def get_current_unit(request):
"""Return the current unit"""
from units.models import Unit
current_unit_pk = request.session.get('current_unit_pk', 1)
try... | bsd-2-clause | Python |
47196c1bca15919dfc6d78dfef23f7091028093a | add validator error message | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | apps/users/fields.py | apps/users/fields.py | import re
from django.core.validators import RegexValidator
from django.forms.fields import Field
from django.forms.widgets import Input
from django.utils.translation import ugettext as _
class CommaSeparatedEmailField(Field):
default_validators = [RegexValidator(
# a list of emails, separated by commas w... | import re
from django.core.validators import RegexValidator
from django.forms.fields import Field
from django.forms.widgets import Input
class CommaSeparatedEmailField(Field):
default_validators = [RegexValidator(
# a list of emails, separated by commas with optional space after
regex=r'^([^@]+@[^... | agpl-3.0 | Python |
0a1358f27db3abb04032fac1b8a3da09d846d23e | Fix a bug introduced in the latest revision, testing auth header in initialize_server_request now, thanks Chris McMichael for the report and patch | e-loue/django-oauth-plus | oauth_provider/utils.py | oauth_provider/utils.py | import oauth.oauth as oauth
from django.conf import settings
from django.http import HttpResponse
from stores import DataStore
OAUTH_REALM_KEY_NAME = 'OAUTH_REALM_KEY_NAME'
def initialize_server_request(request):
"""Shortcut for initialization."""
# Django converts Authorization header in HTTP_AUTHORIZATION... | import oauth.oauth as oauth
from django.conf import settings
from django.http import HttpResponse
from stores import DataStore
OAUTH_REALM_KEY_NAME = 'OAUTH_REALM_KEY_NAME'
def initialize_server_request(request):
"""Shortcut for initialization."""
oauth_request = oauth.OAuthRequest.from_request(request.meth... | bsd-3-clause | Python |
56547f3922eb38ae82586e3b365b5ba4768e078c | fix pubsub with zmq_fallback | darkwallet/python-obelisk,cpacia/python-libbitcoinclient | obelisk/zmq_fallback.py | obelisk/zmq_fallback.py | import zmq
from twisted.internet import task
from twisted.internet import reactor
class ZmqSocket:
context = zmq.Context(1)
def __init__(self, cb, version, type = zmq.DEALER):
self._cb = cb
self._type = type
if self._type=='SUB':
self._type = zmq.SUB
def ... | import zmq
from twisted.internet import task
from twisted.internet import reactor
class ZmqSocket:
context = zmq.Context(1)
def __init__(self, cb, version):
self._cb = cb
def connect(self, address):
self._socket = ZmqSocket.context.socket(zmq.DEALER)
self._socket.connect(address)... | agpl-3.0 | Python |
47ab595099f9fdebc6576c61669c3a1d1677fa68 | Disable proxy by default | andrekeller/archvyrt | archvyrt/__init__.py | archvyrt/__init__.py | #!/usr/bin/python3
"""
Libvirt provisioning for ArchLinux host system.
"""
import argparse
import json
import logging
import os
from archvyrt.domain import Domain
from archvyrt.provisioner.archlinux import ArchlinuxProvisioner
from archvyrt.provisioner.plain import PlainProvisioner
from archvyrt.provisioner.ubuntu i... | #!/usr/bin/python3
"""
Libvirt provisioning for ArchLinux host system.
"""
import argparse
import json
import logging
import os
from archvyrt.domain import Domain
from archvyrt.provisioner.archlinux import ArchlinuxProvisioner
from archvyrt.provisioner.plain import PlainProvisioner
from archvyrt.provisioner.ubuntu i... | mit | Python |
2376c3d28a95aa28c83ab35c944078f59cb00462 | refactor payment logger handler a little to import model when required | onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle | bluebottle/payments_logger/handlers.py | bluebottle/payments_logger/handlers.py | import logging
class PaymentLogHandler(logging.Handler):
"""
Log handler for storing payment events as PaymentLogEntry entries in the db
"""
def __init__(self):
logging.Handler.__init__(self)
def emit(self, record):
# NOTE: need to import this here otherwise it causes a circular r... | import logging
from .models import PaymentLogEntry
class PaymentLogHandler(logging.Handler, object):
"""
Log handler for storing payment events as PaymentLogEntry entries in the db
"""
def emit(self, record):
# TODO: we should use the formatting features of the logging library
# ... | bsd-3-clause | Python |
0f04ec5d350e996e561cf0046b053d792af8085d | Add logging to update | robertu94/autograder,robertu94/autograder,robertu94/autograder | autograder/update.py | autograder/update.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module is part of the Clemson ACM Auto Grader
This module is responsible for cloning and updating repositories.
"""
import logging
LOGGER = logging.getLogger(__name__)
def update(settings, student):
"""
Updates a to the latest student submission
re... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module is part of the Clemson ACM Auto Grader
This module is responsible for cloning and updating repositories.
"""
import logging
LOGGER = logging.getLogger(__name__)
def update(settings, student):
"""
Updates a to the latest student submission
re... | bsd-2-clause | Python |
c1e612366ccf508d6243bcccf35a42181349b9ce | Fix urls | praekelt/jmbo-banner,praekelt/jmbo-banner | banner/tests/urls.py | banner/tests/urls.py | from django.conf.urls import patterns, include
urlpatterns = patterns(
'',
(r'^jmbo/', include('jmbo.urls')),
(r'^comments/', include('django.contrib.comments.urls')),
(r'^banner/', include('banner.urls')),
)
| from django.conf.urls.defaults import patterns, include
urlpatterns = patterns(
'',
(r'^jmbo/', include('jmbo.urls')),
(r'^comments/', include('django.contrib.comments.urls')),
(r'^banner/', include('banner.urls')),
)
| bsd-3-clause | Python |
5e2f3d115ae987588c701962c26ba0baea1c8a30 | Fix import of REOPEN_FILES constant in dispatcher.py | thomasalrin/beaver,josegonzalez/python-beaver,timstoop/python-beaver,python-beaver/python-beaver,doghrim/python-beaver,rajmarndi/python-beaver,Open-Party/python-beaver,jlambert121/beaver,imacube/python-beaver,davidmoravek/python-beaver,PierreF/beaver,imacube/python-beaver,thomasalrin/beaver,PierreF/beaver,davidmoravek/... | beaver/dispatcher.py | beaver/dispatcher.py | # -*- coding: utf-8 -*-
import multiprocessing
import Queue
import signal
import sys
from beaver.config import FileConfig, BeaverConfig
from beaver.queue import run_queue
from beaver.ssh_tunnel import create_ssh_tunnel
from beaver.utils import setup_custom_logger, REOPEN_FILES
from beaver.worker import Worker
def ru... | # -*- coding: utf-8 -*-
import multiprocessing
import Queue
import signal
import sys
from beaver.config import FileConfig, BeaverConfig
from beaver.queue import run_queue
from beaver.ssh_tunnel import create_ssh_tunnel
from beaver.utils import setup_custom_logger
from beaver.worker import Worker, REOPEN_FILES
def ru... | mit | Python |
304e124acff9c7cf712645f558181426d3e9e67b | add logging to the proxy module | ironfroggy/django-better-cache,ironfroggy/django-better-cache | bettercache/proxy.py | bettercache/proxy.py | """Fulfills a request by passing it along to another server, if this one
cannot fulfill it.
This is used in configurations where bettercache runs on its own, acting
solely as a caching layer, and deferring requests it does not have in the
cache.
"""
from httplib2 import Http
import logging
from django.http import H... | """Fulfills a request by passing it along to another server, if this one
cannot fulfill it.
This is used in configurations where bettercache runs on its own, acting
solely as a caching layer, and deferring requests it does not have in the
cache.
"""
from httplib2 import Http
from django.http import HttpResponse
fro... | mit | Python |
0355a04234dddee2703777623c08741e76d32c93 | fix version name | androguard/androguard,shuxin/androguard,huangtao2003/androguard,androguard/androguard,reox/androguard | androguard/__init__.py | androguard/__init__.py | # The current version of Androguard
# Please use only this variable in any scripts,
# to keep the version number the same everywhere.
__version__ = "3.1.0rc1"
| # The current version of Androguard
# Please use only this variable in any scripts,
# to keep the version number the same everywhere.
__version__ = "3.1.0-rc1"
| apache-2.0 | Python |
302def522b8a6e812b9e909a7fbf89dbbe85c686 | create and teardown the tables on setup and teardown | cd34/apex,cd34/apex,Qwait/apex,Qwait/apex | apex/tests/__init__.py | apex/tests/__init__.py | import os
import unittest
from sqlalchemy import engine_from_config
from pyramid import testing
from sqlalchemy.orm import sessionmaker
from apex.models import DBSession
from apex.models import Base
here = os.path.abspath(os.path.dirname(__file__))
""" bare minimum settings required for testing
"""
settings = {
'... | import os
import unittest
from sqlalchemy import engine_from_config
from pyramid import testing
from sqlalchemy.orm import sessionmaker
from apex.models import DBSession
here = os.path.abspath(os.path.dirname(__file__))
""" bare minimum settings required for testing
"""
settings = {
'sqlalchemy.url':'sqlite:///ap... | mit | Python |
1fa0eb2c792b3cc89d27b322c80548f022b7fbb9 | Modify exception handler to cover multiple data types i.e. dict and list and handle when more than one error returned | monikagrabowska/osf.io,hmoco/osf.io,asanfilippo7/osf.io,njantrania/osf.io,sloria/osf.io,MerlinZhang/osf.io,acshi/osf.io,mluke93/osf.io,asanfilippo7/osf.io,Johnetordoff/osf.io,haoyuchen1992/osf.io,ckc6cz/osf.io,GageGaskins/osf.io,chrisseto/osf.io,ticklemepierce/osf.io,chennan47/osf.io,caseyrygt/osf.io,DanielSBrown/osf.i... | api/base/exceptions.py | api/base/exceptions.py |
from rest_framework import status
from rest_framework.exceptions import APIException
def json_api_exception_handler(exc, context):
"""
Custom exception handler that returns errors object as an array
"""
from rest_framework.views import exception_handler
response = exception_handler(exc, context)
... | from rest_framework.exceptions import APIException
from rest_framework import status
def jsonapi_exception_handler(exc, context):
"""
Custom exception handler that returns errors object as an array with a 'detail' member
"""
from rest_framework.views import exception_handler
response = exception_ha... | apache-2.0 | Python |
08310cd70d33c8a21fe66e4494d8201caa34a9bc | remove unused settings | nstoik/farm_monitor,nstoik/farm_monitor,nstoik/farm_monitor,nstoik/farm_monitor,nstoik/farm_monitor | api/fm_api/settings.py | api/fm_api/settings.py | """Application configuration."""
# pylint: disable=too-few-public-methods
import os
class Config:
"""Base configuration."""
SECRET_KEY = os.environ.get("FM_API_SECRET", "secret-key")
JWT_SECRET_KEY = os.environ.get("FM_API_JWT_SECRET", "secret-key")
APP_DIR = os.path.abspath(os.path.dirname(__file__... | """Application configuration."""
# pylint: disable=too-few-public-methods
import os
class Config:
"""Base configuration."""
SECRET_KEY = os.environ.get("FM_API_SECRET", "secret-key")
JWT_SECRET_KEY = os.environ.get("FM_API_JWT_SECRET", "secret-key")
APP_DIR = os.path.abspath(os.path.dirname(__file__... | apache-2.0 | Python |
654e12cec3955d627fff12ba4ee802205fae9ef0 | fix the comment | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | machine_learning/python/pocket_pla.py | machine_learning/python/pocket_pla.py | import random
import numpy as np
FEATURE = 5
def sign(num):
if np.sign(num) <= 0:
return -1.0
return 1.0
def pla(X,y,m):
''' improved (pocket) perceptron learning algorithm
Arguments:
X {numpy array or numpy matrix}
y {numpy array or numpy matrix} -- target
m {integer} -... | import random
import numpy as np
FEATURE = 5
def sign(num):
if np.sign(num) <= 0:
return -1.0
return 1.0
def pla(X,y,m):
''' improved (pocket) perceptron learning algorithm
Arguments:
X {list or numpy array}
y {list or numpy array} -- target
m {integer} -- the size of tr... | cc0-1.0 | Python |
4c1bf1757baa5beec50377724961c528f5985864 | Support capture screenshot for no-selenium test | KarlGong/ptest,KarlGong/ptest | ptest/screencapturer.py | ptest/screencapturer.py | import threading
import traceback
import StringIO
import plogger
try:
from PIL import ImageGrab
except ImportError:
PIL_installed = False
else:
PIL_installed = True
try:
import wx
except ImportError:
wxpython_installed = False
else:
wxpython_installed = True
__author__ = 'karl.gong'
def t... | import threading
import traceback
import plogger
__author__ = 'karl.gong'
def take_screen_shot():
current_thread = threading.currentThread()
active_browser = current_thread.get_property("browser")
if active_browser is not None:
while True:
try:
active_browser.switch... | apache-2.0 | Python |
f78f2595ad57c992367f11dc66a5eb76c7e1522d | fix strptime | eric6356/apod-crawler | apod/spiders/mixins.py | apod/spiders/mixins.py | import re
import logging
from datetime import datetime
from urllib.parse import urlparse
from apod.items import APODItem
logger = logging.getLogger(__name__)
def parse_apod(response, apod):
date = response.css('center:first-child>p:last-child::text').extract_first().strip()
try:
apod['date'] = date... | import re
import logging
from datetime import datetime
from urllib.parse import urlparse
from apod.items import APODItem
logger = logging.getLogger(__name__)
def parse_apod(response, apod):
date = response.css('center:first-child>p:last-child::text').extract_first()
try:
apod['date'] = datetime.str... | mit | Python |
e2f1316264a458f0fe3277d2e5857c6ff80013e2 | Set framerate to 24. | misalcedo/RapBot,misalcedo/RapBot,misalcedo/RapBot,misalcedo/RapBot | Vision/src/main/python/service.py | Vision/src/main/python/service.py | from picamera import PiCamera
from mjpeg import FrameSplitter
from stream import StreamingServer, BaseStreamingHandler
class StreamingHandler(BaseStreamingHandler):
def send_frame(self):
camera.capture(self.wfile, 'bmp', use_video_port=True)
def send_frames(self):
try:
video_outpu... | from picamera import PiCamera
from mjpeg import FrameSplitter
from stream import StreamingServer, BaseStreamingHandler
class StreamingHandler(BaseStreamingHandler):
def send_frame(self):
camera.capture(self.wfile, 'bmp', use_video_port=True)
def send_frames(self):
try:
video_outpu... | mit | Python |
1eabd993825f1d7e4775bda135ec43c913fd24e2 | implement method to find the newest log file. This will be used at startup and when the software determines the log has been rotated | kirkmawa/nacspeed | nacspeed.py | nacspeed.py | #!/usr/bin/which python3
import csv
import configparser
import sqlite3
import ldap3
import time
import os
import datetime
Config=configparser.ConfigParser()
Config.read("config/config.ini")
if Config['nacspeed']['icanread'] != "true":
print ("Please edit config.ini")
exit()
def modify_time (filename):
t = os.p... | #!/usr/bin/which python3
import csv
import configparser
import sqlite3
import ldap3
import time
import os
import datetime
Config=configparser.ConfigParser()
Config.read("config/config.ini")
if Config['nacspeed']['icanread'] != "true":
print ("Please edit config.ini")
exit()
def modify_time (filename):
t = os.p... | mit | Python |
df6d44efe9ea1adb913030ff87d02ff4c3a0cd19 | fix version string | desihub/desiutil,desihub/desiutil | py/desiUtil/__init__.py | py/desiUtil/__init__.py | # License information goes here
# -*- coding: utf-8 -*-
"""
========
desiUtil
========
This package provides low-level utilities for general use by DESI_.
.. _DESI: http://desi.lbl.gov
"""
#
from __future__ import absolute_import, division, print_function, unicode_literals
# The line above will help with 2to3 support... | # License information goes here
# -*- coding: utf-8 -*-
"""
========
desiUtil
========
This package provides low-level utilities for general use by DESI_.
.. _DESI: http://desi.lbl.gov
"""
#
from __future__ import absolute_import, division, print_function, unicode_literals
# The line above will help with 2to3 support... | bsd-3-clause | Python |
982012cddf414f45969ab08504aa73b808d7d6b5 | convert long to int | ChanduERP/odoo,jeasoft/odoo,kifcaliph/odoo,ygol/odoo,sergio-incaser/odoo,brijeshkesariya/odoo,dariemp/odoo,kybriainfotech/iSocioCRM,BT-ojossen/odoo,pedrobaeza/OpenUpgrade,Ichag/odoo,Adel-Magebinary/odoo,leorochael/odoo,jiachenning/odoo,wangjun/odoo,inspyration/odoo,mmbtba/odoo,mlaitinen/odoo,oliverhr/odoo,ehirt/odoo,pa... | addons/hr/mail_message.py | addons/hr/mail_message.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 | Python |
72a61bbbe777d66e1005aeb06b523c73101f634e | handle multiple lines in mdstcl cell | MDSplus/jupyter | mdstcl_kernel/mdstcl_kernel/kernel.py | mdstcl_kernel/mdstcl_kernel/kernel.py | from ipykernel.kernelbase import Kernel
from MDSplus import Data
class MdstclKernel(Kernel):
implementation = 'Mdstcl'
implementation_version = '1.0'
language = 'no-op'
language_version = '0.1'
language_info = {
'name': 'mdstcl commands',
'mimetype': 'text/plain',
'file_exte... | from ipykernel.kernelbase import Kernel
from MDSplus import Data
class MdstclKernel(Kernel):
implementation = 'Mdstcl'
implementation_version = '1.0'
language = 'no-op'
language_version = '0.1'
language_info = {
'name': 'mdstcl commands',
'mimetype': 'text/plain',
'file_exte... | mit | Python |
d813e1a8effc0c2b981268cae08b763cdf5d40a8 | test the paths for clear sign | alfredodeza/merfi | merfi/tests/backends/test_rpm_sign.py | merfi/tests/backends/test_rpm_sign.py | from merfi.backends import rpm_sign
from merfi.tests.util import CallRecorder
from tambo import Transport
class RpmSign(object):
def setup(self):
self.backend = rpm_sign.RpmSign([])
self.backend.detached = CallRecorder()
self.backend.clear_sign = CallRecorder()
# fake command-line... | from merfi.backends import rpm_sign
from merfi.tests.util import CallRecorder
from tambo import Transport
class RpmSign(object):
def setup(self):
self.backend = rpm_sign.RpmSign([])
self.backend.detached = CallRecorder()
self.backend.clear_sign = CallRecorder()
# fake command-line... | mit | Python |
2ea66453eda34b740eb95da605af647faf8135f5 | allow customizing rating confirmation page based on rating | dfang/odoo,hip-odoo/odoo,dfang/odoo,hip-odoo/odoo,dfang/odoo,ygol/odoo,hip-odoo/odoo,dfang/odoo,hip-odoo/odoo,ygol/odoo,hip-odoo/odoo,ygol/odoo,dfang/odoo,ygol/odoo,ygol/odoo,ygol/odoo,hip-odoo/odoo,dfang/odoo,ygol/odoo | addons/rating/controllers/main.py | addons/rating/controllers/main.py | # -*- coding: utf-8 -*-
import werkzeug
from openerp import http
from openerp.http import request
from openerp.tools.translate import _
class Rating(http.Controller):
@http.route('/rating/<string:token>/<int:rate>', type='http', auth="public")
def open_rating(self, token, rate, **kwargs):
assert rat... | # -*- coding: utf-8 -*-
import werkzeug
from openerp import http
from openerp.http import request
from openerp.tools.translate import _
class Rating(http.Controller):
@http.route('/rating/<string:token>/<int:rate>', type='http', auth="public")
def open_rating(self, token, rate, **kwargs):
assert rat... | agpl-3.0 | Python |
3f878e0b034ddaaf2da29fd8981c8fa46e2825ae | Initialize struct flock for AIX with O_LARGEFILE used by Python. | mapbox/gyp,mapbox/gyp,mapbox/gyp,mapbox/gyp,mapbox/gyp | pylib/gyp/flock_tool.py | pylib/gyp/flock_tool.py | #!/usr/bin/env python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""These functions are executed via gyp-flock-tool when using the Makefile
generator. Used on systems that don't have a built-in flock."""
... | #!/usr/bin/env python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""These functions are executed via gyp-flock-tool when using the Makefile
generator. Used on systems that don't have a built-in flock."""
... | bsd-3-clause | Python |
b5f0739707d1cacdaff9d4d3ac236f987cf7f64f | add nuts to tests | dhiapet/PyMC3,wanderer2/pymc3,clk8908/pymc3,superbobry/pymc3,kyleam/pymc3,tyarkoni/pymc3,dhiapet/PyMC3,superbobry/pymc3,kmather73/pymc3,arunlodhi/pymc3,MCGallaspy/pymc3,JesseLivezey/pymc3,hothHowler/pymc3,CVML/pymc3,wanderer2/pymc3,CVML/pymc3,jameshensman/pymc3,Anjum48/pymc3,MichielCottaar/pymc3,LoLab-VU/pymc,hothHowle... | pymc/tests/test_step.py | pymc/tests/test_step.py | from .checks import *
from .models import simple_model, mv_simple
from theano.tensor import constant
from scipy.stats.mstats import moment
def check_stat(name, trace, var, stat, value, bound):
s = stat(trace[var], axis=0)
close_to(s, value, bound)
def test_step_continuous():
start, model, (mu, C) = mv_s... | from .checks import *
from .models import simple_model, mv_simple
from theano.tensor import constant
from scipy.stats.mstats import moment
def check_stat(name, trace, var, stat, value, bound):
s = stat(trace[var], axis=0)
close_to(s, value, bound)
def test_step_continuous():
start, model, (mu, C) = mv_s... | apache-2.0 | Python |
6eb57b4c8bcbdb007d18738928d2c71e7e802f6b | Bump version to 2.6.1 | pyQode/pyqode.core,pyQode/pyqode.core,zwadar/pyqode.core | pyqode/core/__init__.py | pyqode/core/__init__.py | # -*- coding: utf-8 -*-
"""
The core package contains the core components needed for writing a pyqode based
application. It is the "de facto" requirement for any pyqode extension.
It contains the base classes for both the backend and the frontend and provides
a series of modes and panels that might be useful for any k... | # -*- coding: utf-8 -*-
"""
The core package contains the core components needed for writing a pyqode based
application. It is the "de facto" requirement for any pyqode extension.
It contains the base classes for both the backend and the frontend and provides
a series of modes and panels that might be useful for any k... | mit | Python |
1b53508b8e3d879744f83340707d7579e5eadc84 | Bump the version to 0.7.9 | aldryn/aldryn-client,aldryn/aldryn-client | aldryn_client/__init__.py | aldryn_client/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.7.9'
| # -*- coding: utf-8 -*-
__version__ = '0.7.8'
| bsd-3-clause | Python |
aa8acd7c9186bb4b12f982651c989e13c548443d | Set version as 0.9.0 | Alignak-monitoring-contrib/alignak-webui,Alignak-monitoring-contrib/alignak-webui,Alignak-monitoring-contrib/alignak-webui | alignak_webui/__init__.py | alignak_webui/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=global-statement
# Copyright (c) 2015-2017:
# Frederic Mohier, frederic.mohier@alignak.net
#
"""
Alignak - Web User Interface
"""
# Package name
__pkg_name__ = u"alignak_webui"
# Checks types for PyPI keywords
# Used for:
# - PyPI keywords
# - dir... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=global-statement
# Copyright (c) 2015-2017:
# Frederic Mohier, frederic.mohier@alignak.net
#
"""
Alignak - Web User Interface
"""
# Package name
__pkg_name__ = u"alignak_webui"
# Checks types for PyPI keywords
# Used for:
# - PyPI keywords
# - dir... | agpl-3.0 | Python |
a3b9dd96ffeafd02e511a58a1013f5a6b0158cb5 | Add conftest.py with mongo configuration for tests | NSLS-II/amostra | amostra/tests/conftest.py | amostra/tests/conftest.py | import amostra.mongo_client
from pymongo import MongoClient
import pytest
connection = MongoClient('localhost', 27017)
db = connection['tests-amostra']
db['samples'].drop()
db['samples_revisions'].drop()
@pytest.fixture()
def client():
client = amostra.mongo_client.Client('mongodb://localhost:27017/tests-amostr... | bsd-3-clause | Python | |
11dda9d58d41699367e802c9a38b87c3e17e68bd | make sure to convert Arch.function_prologs to a set before calling union on it | axt/angr,angr/angr,tyb0807/angr,chubbymaggie/angr,schieb/angr,f-prettyland/angr,schieb/angr,axt/angr,f-prettyland/angr,chubbymaggie/angr,chubbymaggie/angr,axt/angr,angr/angr,iamahuman/angr,iamahuman/angr,tyb0807/angr,tyb0807/angr,angr/angr,f-prettyland/angr,schieb/angr,iamahuman/angr | angr/analyses/boyscout.py | angr/analyses/boyscout.py | import re
import logging
from collections import defaultdict
from archinfo import all_arches
from ..analysis import Analysis, register_analysis
l = logging.getLogger("angr.analyses.boyscout")
class BoyScout(Analysis):
"""
Try to determine the architecture and endieness of a binary blob
"""
def __ini... | import re
import logging
from collections import defaultdict
from archinfo import all_arches
from ..analysis import Analysis, register_analysis
l = logging.getLogger("angr.analyses.boyscout")
class BoyScout(Analysis):
"""
Try to determine the architecture and endieness of a binary blob
"""
def __ini... | bsd-2-clause | Python |
39876ada545658a291622563d2b1f3e6911ae280 | Change int to float | DarkAce65/rpi-led-matrix,DarkAce65/rpi-led-matrix | python/animationBase.py | python/animationBase.py | #!/usr/bin/env python
from rgbmatrix import RGBMatrix
import sys, time
from ball import Ball
rows = 16
chains = 1
parallel = 1
ledMatrix = RGBMatrix(rows, chains, parallel)
numRows = 16
height = ledMatrix.height
width = ledMatrix.width
ball = Ball(5, 9, 4)
try:
print "Press Ctrl + C to stop executing"
while True:
... | #!/usr/bin/env python
from rgbmatrix import RGBMatrix
import sys, time
from ball import Ball
rows = 16
chains = 1
parallel = 1
ledMatrix = RGBMatrix(rows, chains, parallel)
numRows = 16
height = ledMatrix.height
width = ledMatrix.width
ball = Ball(5, 9, 4)
try:
print "Press Ctrl + C to stop executing"
while True:
... | mit | Python |
202e14e0dc8e809b1e08a69c5706122cb42754e8 | Add EventList and EventCreate, MetricCommon | jdgwartney/pulse-api-cli,boundary/boundary-api-cli,jdgwartney/pulse-api-cli,wcainboundary/boundary-api-cli,boundary/pulse-api-cli,boundary/boundary-api-cli,jdgwartney/boundary-api-cli,boundary/pulse-api-cli,jdgwartney/boundary-api-cli,wcainboundary/boundary-api-cli | boundary/__init__.py | boundary/__init__.py | #
# Copyright 2014-2015 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | #
# Copyright 2014-2015 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | apache-2.0 | Python |
6688cbfb17064d6c49f82d6174bfc62f4bc9fda0 | Kill log spam on outputer setup. | ponderousmad/pyndent | outputer.py | outputer.py | from __future__ import print_function
import datetime
import os
import sys
global tee_file
tee_file = None
# http://stackoverflow.com/questions/29772158/make-ipython-notebook-print-in-real-time
class flushfile():
def __init__(self, f):
self.f = f
def __getattr__(self,name):
return object.__ge... | from __future__ import print_function
import datetime
import os
import sys
global tee_file
tee_file = None
# http://stackoverflow.com/questions/29772158/make-ipython-notebook-print-in-real-time
class flushfile():
def __init__(self, f):
self.f = f
def __getattr__(self,name):
return object.__ge... | mit | Python |
c82f0f10ea8b96377ebed8a6859ff3cd8ed4cd3f | Fix Python 2/3 exception base class compatibility | blue-yonder/turbodbc,blue-yonder/turbodbc,blue-yonder/turbodbc,blue-yonder/turbodbc | python/turbodbc/exceptions.py | python/turbodbc/exceptions.py | from __future__ import absolute_import
from functools import wraps
from turbodbc_intern import Error as InternError
# Python 2/3 compatibility
try:
from exceptions import StandardError as _BaseError
except ImportError:
_BaseError = Exception
class Error(_BaseError):
pass
class InterfaceError(Error):... | from __future__ import absolute_import
from functools import wraps
from exceptions import StandardError
from turbodbc_intern import Error as InternError
class Error(StandardError):
pass
class InterfaceError(Error):
pass
class DatabaseError(Error):
pass
def translate_exceptions(f):
@wraps(f)
... | mit | Python |
9ec940493b5960b7d5c9815d2ebdae51a62ca519 | Update __init__.py | williamFalcon/pytorch-lightning,williamFalcon/pytorch-lightning | pytorch_lightning/__init__.py | pytorch_lightning/__init__.py | """Root package info."""
__version__ = '0.8.0rc4'
__author__ = 'William Falcon et al.'
__author_email__ = 'waf2107@columbia.edu'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright (c) 2018-2020, %s.' % __author__
__homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning'
# this has to be simple string, ... | """Root package info."""
__version__ = '0.8.0rc3'
__author__ = 'William Falcon et al.'
__author_email__ = 'waf2107@columbia.edu'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright (c) 2018-2020, %s.' % __author__
__homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning'
# this has to be simple string, ... | apache-2.0 | Python |
12138ced7c730b8b1a72f798ce74f1452ec8f4e0 | Update __init__.py | williamFalcon/pytorch-lightning,williamFalcon/pytorch-lightning | pytorch_lightning/__init__.py | pytorch_lightning/__init__.py | """Root package info."""
__version__ = '0.7.6rc2'
__author__ = 'William Falcon et al.'
__author_email__ = 'waf2107@columbia.edu'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright (c) 2018-2020, %s.' % __author__
__homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning'
# this has to be simple string, ... | """Root package info."""
__version__ = '0.7.6rc1'
__author__ = 'William Falcon et al.'
__author_email__ = 'waf2107@columbia.edu'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright (c) 2018-2020, %s.' % __author__
__homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning'
# this has to be simple string, ... | apache-2.0 | Python |
179ca377139ad89ed60a96e83777fdddc047705c | Fix typo in admin.py | AASHE/iss | iss/admin.py | iss/admin.py | from django.contrib import admin
from .models import Organization
class OrganizationAdmin(admin.ModelAdmin):
fields = ('account_num', 'org_name', 'city', 'state', 'country_iso')
admin.site.register(Organization, OrganizationAdmin)
| from django.contrib import admin
from .models import Oganization
class OrganizationAdmin(admin.ModelAdmin):
fields = ('account_num', 'org_name', 'city', 'state', 'country_iso')
admin.site.register(Organization, OrganizationAdmin)
| mit | Python |
d68b2f826b2c25180d866302961f78709b6d38a7 | Exclude figshare from listing child folders - Add comment | saradbowman/osf.io,acshi/osf.io,mfraezz/osf.io,erinspace/osf.io,acshi/osf.io,hmoco/osf.io,monikagrabowska/osf.io,Johnetordoff/osf.io,aaxelb/osf.io,monikagrabowska/osf.io,felliott/osf.io,chennan47/osf.io,caneruguz/osf.io,Nesiehr/osf.io,adlius/osf.io,pattisdr/osf.io,adlius/osf.io,laurenrevere/osf.io,binoculars/osf.io,crc... | api/addons/serializers.py | api/addons/serializers.py | from rest_framework import serializers as ser
from api.base.serializers import JSONAPISerializer, LinksField
from api.base.utils import absolute_reverse
class NodeAddonFolderSerializer(JSONAPISerializer):
class Meta:
type_ = 'node_addon_folders'
id = ser.CharField(read_only=True)
kind = ser.CharFi... | from rest_framework import serializers as ser
from api.base.serializers import JSONAPISerializer, LinksField
from api.base.utils import absolute_reverse
class NodeAddonFolderSerializer(JSONAPISerializer):
class Meta:
type_ = 'node_addon_folders'
id = ser.CharField(read_only=True)
kind = ser.CharFi... | apache-2.0 | Python |
958f4a4e7c6c66e7509c745f77e1826e3159df4f | Add task to build html doc. | mindw/numpy,ogrisel/numpy,dwf/numpy,WillieMaddox/numpy,WarrenWeckesser/numpy,astrofrog/numpy,jankoslavic/numpy,githubmlai/numpy,ajdawson/numpy,sinhrks/numpy,jonathanunderwood/numpy,mortada/numpy,gfyoung/numpy,ahaldane/numpy,Srisai85/numpy,yiakwy/numpy,kirillzhuravlev/numpy,gmcastil/numpy,rhythmsosad/numpy,bringingheave... | pavement.py | pavement.py | import os
import subprocess
try:
from hash import md5
except ImportError:
import md5
import sphinx
import distutils
import numpy.distutils
try:
from paver.tasks import VERSION as _PVER
if not _PVER >= '1.0':
raise RuntimeError("paver version >= 1.0 required (was %s)" % _PVER)
except ImportErr... | import os
import subprocess
try:
from hash import md5
except ImportError:
import md5
import sphinx
import distutils
import numpy.distutils
try:
from paver.tasks import VERSION as _PVER
if not _PVER >= '1.0':
raise RuntimeError("paver version >= 1.0 required (was %s)" % _PVER)
except ImportErr... | bsd-3-clause | Python |
c9d82c0439a1fa307430c3fdeae78420e6ec892a | Build with dev version | lasote/conan-openssl,lasote/conan-openssl,lasote/conan-openssl | build_with_docker.py | build_with_docker.py | import os
import platform
import sys
if __name__ == "__main__":
for gcc_version in ["4.6", "4.8", "4.9", "5.2"]:
image_name = "lasote/conangcc%s" % gcc_version.replace(".", "")
os.system("sudo docker pull %s" % image_name)
curdir = os.path.abspath(os.path.curdir)
command = ... | import os
import platform
import sys
if __name__ == "__main__":
for gcc_version in ["4.6", "4.8", "4.9", "5.2"]:
image_name = "lasote/conangcc%s" % gcc_version.replace(".", "")
os.system("sudo docker pull %s" % image_name)
curdir = os.path.abspath(os.path.curdir)
command = ... | mit | Python |
c62452b564d6e1f7516886ce31f677b9c1c8f248 | Debug filtered laser data on web server | SebastianCallh/kartoffel-tsea29,SebastianCallh/kartoffel-tsea29 | pi/laser.py | pi/laser.py | from eventbus import EventBus
from protocol import LASER_ADDR
from time import sleep
DEBUG_LASER = True
class Laser:
DELTA_LIMIT = 100
def __init__(self):
self.data = 0
self.last_data = 0
if DEBUG_LASER:
self.debug_file = open('laser_measurements.dat', 'w')
... | from eventbus import EventBus
from protocol import LASER_ADDR
from time import sleep
DEBUG_LASER = True
class Laser:
DELTA_LIMIT = 100
def __init__(self):
self.data = 0
self.last_data = 0
if DEBUG_LASER:
self.debug_file = open('laser_measurements.dat', 'w')
... | mit | Python |
f2e65293eaa35b0342a95d0394db18f8347496b6 | use CallRecorder in clone tests | red-hat-storage/rhcephpkg,red-hat-storage/rhcephpkg | rhcephpkg/tests/test_clone.py | rhcephpkg/tests/test_clone.py | import os
import pytest
from rhcephpkg import Clone
from rhcephpkg.tests.util import CallRecorder
class CheckCallRecorder(CallRecorder):
def __call__(self, cmd):
""" Store cmd, in order to verify it later. """
self.called += 1
if cmd[:2] == ['git', 'clone']:
self.fake_git_clon... | import os
import pytest
from rhcephpkg import Clone
class TestClone(object):
def setup_method(self, method):
""" Reset last_cmd before each test. """
self.last_cmd = None
def fake_git_clone(self, *args):
""" Just make a directory in cwd. """
try:
dirname = args[1]... | mit | Python |
540cbc24e3a182f239c3a7504bc5121c1a0267cd | add format node name to node_utils | nsauder/treeano,diogo149/treeano,diogo149/treeano,nsauder/treeano,jagill/treeano,jagill/treeano,nsauder/treeano,diogo149/treeano,jagill/treeano | canopy/node_utils.py | canopy/node_utils.py | """
TODO should this be in treeano.node_utils
"""
import treeano
from . import walk_utils
def postwalk_node(root_node, fn):
"""
traverses a tree of nodes in a postwalk with a function that can
transform nodes
"""
def postwalk_fn(obj):
if isinstance(obj, treeano.core.NodeAPI):
... | """
TODO should this be in treeano.node_utils
"""
import treeano
from . import walk_utils
def postwalk_node(root_node, fn):
"""
traverses a tree of nodes in a postwalk with a function that can
transform nodes
"""
def postwalk_fn(obj):
if isinstance(obj, treeano.core.NodeAPI):
... | apache-2.0 | Python |
e973e6ef17c367ecaeaf97d588f270bc5bc4175d | Raise ValidationError on email sending error | Edmonton-Public-Library/centennial,Edmonton-Public-Library/centennial,Edmonton-Public-Library/centennial | centennial/models.py | centennial/models.py | from django.core.exceptions import ValidationError
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.db import models
import datetime
import socket
from centennial.constants import FACEBOOK_KEY_LEN, BIBLIO_USER_LEN
from util.email import emailer, email_template
c... | from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.db import models
import datetime
import socket
from centennial.constants import FACEBOOK_KEY_LEN, BIBLIO_USER_LEN
from util.email import emailer, email_template
class UserProfile(models.Model):
user = models.O... | mit | Python |
7da8db55b4ab183e07507c265f817df6f0fd8f8f | Clean up | b1quint/samfp,b1quint/samfp | samfp/io/tests/test_logger.py | samfp/io/tests/test_logger.py |
import io
import unittest
import sys
from samfp.io.logger import get_logger
class TestLogFormat(unittest.TestCase):
def setUp(self):
self.held_stdout, sys.stdout = sys.stdout, io.StringIO()
self.held_stderr, sys.stderr = sys.stderr, io.StringIO()
self.streamer = sys.stderr
def tear... |
import io
import unittest
import sys
from samfp.io.logger import get_logger, SamFpLogger
class TestLogFormat(unittest.TestCase):
def setUp(self):
self.held_stdout, sys.stdout = sys.stdout, io.StringIO()
self.held_stderr, sys.stderr = sys.stderr, io.StringIO()
self.streamer = sys.stderr
... | bsd-3-clause | Python |
661bfb022d65fdc3c906d2d8a27286b4a52ac287 | add more search tests | codeforamerica/straymapper,codeforamerica/straymapper,codeforamerica/straymapper | animals/tests.py | animals/tests.py | from datetime import datetime
from django.core.urlresolvers import reverse
from django.test import TestCase
from animals.models import Animal
class AnimalsViewsTestCase(TestCase):
fixtures = ['animals_testdata.json']
def test_index(self):
resp = self.client.get(reverse('animals_index'))
self... | from datetime import datetime
from django.core.urlresolvers import reverse
from django.test import TestCase
from animals.models import Animal
class AnimalsViewsTestCase(TestCase):
fixtures = ['animals_testdata.json']
def test_index(self):
resp = self.client.get(reverse('animals_index'))
self... | bsd-3-clause | Python |
5d1aeb4dde805b13b8c088adcd20017aa7e5321a | bump version | kenjhim/anki,subfusc/anki,jakesyl/ruby-card,hssm/anki,weihautin/anki,jakesyl/ruby-card,xuewenfei/anki,jkitching/anki,abeyer/anki,weihautin/anki,holycrepe/anki,florianjacob/anki,hssm/anki,ospalh/libanki3,sunclx/anki,Arthaey/anki,socialpercon/anki-1,eduOS/anki,LucasCabello/anki,Stvad/anki,go38/anki | anki/__init__.py | anki/__init__.py | # -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sys
import os
import platform
if sys.version_info[0] > 2:
raise Exception("Anki should be run with Python 2")
elif sys.version_info[1] < 6:
raise Exception("... | # -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sys
import os
import platform
if sys.version_info[0] > 2:
raise Exception("Anki should be run with Python 2")
elif sys.version_info[1] < 6:
raise Exception("... | agpl-3.0 | Python |
0b653dd3c03939d1f8ca03da8bba7f19b5cfc541 | bump anpy | regardscitoyens/anpy,regardscitoyens/anpy | anpy/__init__.py | anpy/__init__.py | # -*- coding: utf-8 -*-
# _ _ _______ __
# /\ | \ | | __ \ \ / /
# / \ | \| | |__) \ \_/ /
# / /\ \ | . ` | ___/ \ /
# / ____ \| |\ | | | |
# /_/ \_\_| \_|_| |_|
# Set default logging handler to avoid "No handler found" warnings.
import logging
__title__ = 'anpy'
__... | # -*- coding: utf-8 -*-
# _ _ _______ __
# /\ | \ | | __ \ \ / /
# / \ | \| | |__) \ \_/ /
# / /\ \ | . ` | ___/ \ /
# / ____ \| |\ | | | |
# /_/ \_\_| \_|_| |_|
# Set default logging handler to avoid "No handler found" warnings.
import logging
__title__ = 'anpy'
__... | mit | Python |
c0d6e5ce13f4ba1fe93149cdbc22f731b842c828 | Fix backward compatibility with jax <= 0.2.5. Fixes #9 | deepmind/chex,deepmind/chex | chex/_src/pytypes.py | chex/_src/pytypes.py | # Lint as: python3
# Copyright 2020 DeepMind Technologies Limited. 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
#
# ... | # Lint as: python3
# Copyright 2020 DeepMind Technologies Limited. 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
#
# ... | apache-2.0 | Python |
7aa7d3fe97c9db276f07ec0f0c59ec742f000c11 | Update Envoy to 5a87f1e59b42ad546698d389f6ccac9406534e17 (#554) | envoyproxy/nighthawk,envoyproxy/nighthawk,envoyproxy/nighthawk,envoyproxy/nighthawk | bazel/repositories.bzl | bazel/repositories.bzl | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
ENVOY_COMMIT = "5a87f1e59b42ad546698d389f6ccac9406534e17" # September 25th, 2020
ENVOY_SHA = "739c62249bae60f633f91dee846825f1d5ddcc469d45ef370e57f1a010c13258"
HDR_HISTOGRAM_C_VERSION = "0.11.1" # September 17th, 2020
HDR_HISTOGRAM_C_SHA = "855007... | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
ENVOY_COMMIT = "9eeba8fd427d9bd0ef947ec14a3157083cc7bf0e" # September 17th, 2020
ENVOY_SHA = "4537bde6652ea00db9b45c126c0519619909bc0d79c6ede02d68a8782f8c1c67"
HDR_HISTOGRAM_C_VERSION = "0.11.1" # September 17th, 2020
HDR_HISTOGRAM_C_SHA = "855007... | apache-2.0 | Python |
f6de2a9e9c86232e364374268791ceb67b9deee2 | Correct a few paths in the REQUIRED_PATHS for JPF | dbeyer/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec | benchexec/tools/jpf.py | benchexec/tools/jpf.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
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
ht... | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2018 Dirk Beyer
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
ht... | apache-2.0 | Python |
80f1ee23f85aee9a54e0c6cae7a30dddbe96541b | Use new fixtures for geography views test | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | scorecard/tests/test_views.py | scorecard/tests/test_views.py | import json
from django.test import (
TransactionTestCase,
Client,
override_settings,
)
@override_settings(
SITE_ID=2,
STATICFILES_STORAGE="django.contrib.staticfiles.storage.StaticFilesStorage",
)
class GeographyDetailViewTestCase(TransactionTestCase):
serialized_rollback = True
fixtures... | import json
from infrastructure.models import FinancialYear
from django.test import (
TransactionTestCase,
Client,
override_settings,
)
from . import (
import_data,
)
from .resources import (
GeographyResource,
MunicipalityProfileResource,
MedianGroupResource,
RatingCountGroupResource,... | mit | Python |
20fd255d8539d532c72932a5bdfd94c4cf351258 | return none when no outputter specified | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/output/__init__.py | salt/output/__init__.py | '''
Used to manage the outputter system. This package is the modular system used
for managing outputters.
'''
# Import salt utils
import salt.loader
def display_output(data, out, opts=None):
'''
Print the passed data using the desired output
'''
if opts is None:
opts = {}
outputters = sal... | '''
Used to manage the outputter system. This package is the modular system used
for managing outputters.
'''
# Import salt utils
import salt.loader
def display_output(data, out, opts=None):
'''
Print the passed data using the desired output
'''
if opts is None:
opts = {}
outputters = sal... | apache-2.0 | Python |
69d9c4039641aeff81acdfc5f8ed735571e5ab70 | Update wsgi.py | pattisdr/osf.io,monikagrabowska/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,erinspace/osf.io,TomBaxter/osf.io,monikagrabowska/osf.io,pattisdr/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,icereval/osf.io,alexschiller/osf.io,Johnetordoff/osf.io,chrisseto/osf.io,leb2dg/osf.io,HalcyonChimera/osf.io,adlius/os... | api/base/wsgi.py | api/base/wsgi.py | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
from website import settings
from api.base import settings as api_settings
if not settings.DEBUG_MODE... | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
from website import settings
from api.base import settings as api_settings
if not settings.DEBUG_MODE... | apache-2.0 | Python |
2a5fe564db5fdb268138eb9c3f5e354ed2c4a0a4 | update for mercator points | agrc/Crash-web,agrc/Crash-web,agrc/Crash-web,agrc/Crash-web | scripts/create_points_json.py | scripts/create_points_json.py | from arcpy.da import SearchCursor
import json
import os
import re
import sys
pattern = re.compile(r'\s+')
dict = {'points': []}
configuration = sys.argv[1]
script_dir = os.path.dirname(__file__)
file = os.path.join(script_dir, '..', 'src', 'points.json')
table = os.path.join(script_dir, '{}.sde'.format(configuration... | from arcpy.da import SearchCursor
import json
import os
import re
import sys
pattern = re.compile(r'\s+')
dict = {'points': []}
configuration = sys.argv[1]
script_dir = os.path.dirname(__file__)
file = os.path.join(script_dir, '..', 'src', 'points.json')
table = os.path.join(script_dir, '{}.sde'.format(configuration... | mit | Python |
f2039f9ff8b166906cdaa4cf401f88975ce06bb9 | Update server_mqtt.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | cloud/server_mqtt.py | cloud/server_mqtt.py | #Server MQTT source code.
| #Server MQTT source code.
1
23456
| mit | Python |
ea2c9dc529b7e1f16a8ecfef3639c64ee75d2d8e | Rename AppConfig name to not conflict with Django | arcivanov/karellen-kombu-ext,karellen/karellen-kombu-ext | kombu/transport/django/__init__.py | kombu/transport/django/__init__.py | """Kombu transport using the Django database as a message store."""
from __future__ import absolute_import
from django.conf import settings
from django.core import exceptions as errors
from kombu.five import Empty
from kombu.transport import virtual
from kombu.utils.encoding import bytes_to_str
from kombu.utils.json ... | """Kombu transport using the Django database as a message store."""
from __future__ import absolute_import
from django.conf import settings
from django.core import exceptions as errors
from kombu.five import Empty
from kombu.transport import virtual
from kombu.utils.encoding import bytes_to_str
from kombu.utils.json ... | apache-2.0 | Python |
e61ad193ab9e2d146aa427b74070b6d0e2992b42 | Rename of digitalInOut | bittracker/krempelair,bittracker/krempelair,KrempelEv/krempelair,bittracker/krempelair,KrempelEv/krempelair,KrempelEv/krempelair | krempelair/lib/bus/digitalInOut.py | krempelair/lib/bus/digitalInOut.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
krempelair.lib.bus.digitalInOut
Simple Wraper Libary
:copyright: (c) 2017 by @graphics80 on github.com.
:license: AGPL-3.0, see LICENSE for more details.
"""
import smbus
import logging as log
class digiInOut():
def __init__(self):
s... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
krempelair.lib.bus.digitalOut
Simple Wraper Libary
:copyright: (c) 2017 by @graphics80 on github.com.
:license: AGPL-3.0, see LICENSE for more details.
"""
import smbus
import logging as log
class digiOut():
def __init__(self):
self.... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.