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
cd07f1801f76b8481f2485f92dafb63bf3359c43
add filter sim
liyi193328/seq2seq,liyi193328/seq2seq,liyi193328/seq2seq,liyi193328/seq2seq,liyi193328/seq2seq
run_scripts/filter_sim_json.py
run_scripts/filter_sim_json.py
#encoding=utf-8 import sys if sys.version_info[0] == 2: reload(sys) sys.setdefaultencoding("utf-8") import os import codecs import json import click @click.command() @click.argument("json_path", "json path from get_q2q_sim.py, every cell contain source, predict, score") @click.argument("save_path", "store filter...
#encoding=utf-8 import sys if sys.version_info[0] == 2: reload(sys) sys.setdefaultencoding("utf-8") import os import codecs import json import click @click.command() @click.argument("json_path", "json path from get_q2q_sim.py, every cell contain source, predict, score") @click.argument("save_path", "store filter...
apache-2.0
Python
caec3ea0bb901103a228fd767c32ca90d5632210
Remove mention of `core` from `print_columnized()`-docstring.
seblin/shcol
shcol/highlevel.py
shcol/highlevel.py
# -*- coding: utf-8 -*- # Copyright (c) 2013-2015, Sebastian Linke # Released under the Simplified BSD license # (see LICENSE file for details). """ Highlevel functions to support some cases where columnizing can be useful. """ from __future__ import print_function from . import config, core, helpers __all__ = ['p...
# -*- coding: utf-8 -*- # Copyright (c) 2013-2015, Sebastian Linke # Released under the Simplified BSD license # (see LICENSE file for details). """ Highlevel functions to support some cases where columnizing can be useful. """ from __future__ import print_function from . import config, core, helpers __all__ = ['p...
bsd-2-clause
Python
1abeef7014481083da23caf0324dfbc0e05ceece
fix view
wolfg1969/my-wechat-app
wechat_app.py
wechat_app.py
import io from flask import Flask, request, send_file from flask_redis import Redis from wechat_sdk import WechatConf, WechatBasic import wechat_message_handler app = Flask(__name__) app.config.from_envvar('MY_WECHAT_APP_SETTINGS') redis = Redis(app) wechat_conf = WechatConf( token=app.config['WX_TOKEN'], a...
import io from flask import Flask, request, send_file from flask_redis import Redis from wechat_sdk import WechatConf, WechatBasic import wechat_message_handler app = Flask(__name__) app.config.from_envvar('MY_WECHAT_APP_SETTINGS') redis = Redis(app) wechat_conf = WechatConf( token=app.config['WX_TOKEN'], a...
mit
Python
854d4246fc559de85379bf8ff6df42c456ee1592
simplify migration from pre-ids
paulfitz/sheetsite,paulfitz/sheetsite
sheetsite/chain.py
sheetsite/chain.py
import daff import os from sheetsite.ids import process_ids from sheetsite.site import Site from sheetsite.source import read_source from sheetsite.destination import write_destination import shutil def apply_chain(site, path): if not(os.path.exists(path)): os.makedirs(path) source = site['source'] ...
import daff import os from sheetsite.ids import process_ids from sheetsite.site import Site from sheetsite.source import read_source from sheetsite.destination import write_destination import shutil def apply_chain(site, path): if not(os.path.exists(path)): os.makedirs(path) source = site['source'] ...
mit
Python
df5dd28f19a6e82164ecda9278cd73dfef78f048
Use strict template rendering.
PaulMcMillan/sherry,PaulMcMillan/sherry
sherry/__init__.py
sherry/__init__.py
import jinja2 from flask import Flask from sherry import converters app = Flask(__name__) app.config.from_object('sherry.default_settings') app.url_map.converters['mac'] = converters.MacConverter app.jinja_env.undefined = jinja2.StrictUndefined import sherry.views
from flask import Flask app = Flask(__name__) app.config.from_object('sherry.default_settings') import sherry.views
bsd-2-clause
Python
62c18241f0da960c44210445a850a834a181e6cd
Add support for Django >=1.6, which dropped django.conf.urls.defaults
KonstantinSchubert/django-shibboleth-adapter,ties/django-shibboleth-remoteuser,abhishekshivanna/django-shibboleth-remoteuser,trevoriancox/django-shibboleth-remoteuser,UCL-RITS/django-shibboleth-remoteuser,ties/django-shibboleth-remoteuser,KonstantinSchubert/django-shibboleth-adapter,CloudComputingCourse/django-shibbole...
shibboleth/urls.py
shibboleth/urls.py
from distutils.version import StrictVersion import django if StrictVersion(django.get_version()) >= StrictVersion('1.6'): from django.conf.urls import patterns, url, include else: from django.conf.urls.defaults import * from views import ShibbolethView, ShibbolethLogoutView, ShibbolethLoginView urlpatt...
from django.conf.urls.defaults import * from views import ShibbolethView, ShibbolethLogoutView, ShibbolethLoginView urlpatterns = patterns('', url(r'^login/$', ShibbolethLoginView.as_view(), name='login'), url(r'^logout/$', ShibbolethLogoutView.as_view(), name='logout'), url(r'^$', ShibbolethView....
mit
Python
28adc5bd5d51fac404d7e8ae6de2d67c5dbc1a5f
Bump version.
concordusapps/python-shield
shield/_version.py
shield/_version.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import, division __version_info__ = (0, 2, 2) __version__ = '.'.join(map(str, __version_info__))
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import, division __version_info__ = (0, 2, 1) __version__ = '.'.join(map(str, __version_info__))
mit
Python
17ddd05e35f7cff90530cdb2df0c4971b97e7302
Update logging to log async functions properly
festinuz/cmcb,festinuz/cmcb
cmcb/utils.py
cmcb/utils.py
import sys import inspect from functools import wraps, _make_key import redis def logging(*triggers, out=sys.stdout): """Will log function if all triggers are True""" log = min(triggers) # will be False if any trigger is false def wrapper(function): @wraps(function) def wrapped_function...
import sys from functools import wraps, _make_key import redis def logging(*triggers, out=sys.stdout): """Will log function if all triggers are True""" log = min(triggers) # will be False if any trigger is false def wrapper(function): @wraps(function) def wrapped_function(*args, **kwarg...
mit
Python
89af9edbfd9651e93c910b19e6c77bfd0b91394a
Update d.py
xsthunder/acm,xsthunder/acm,xsthunder/a,xsthunder/a,xsthunder/a,xsthunder/acm,xsthunder/a,xsthunder/a,xsthunder/acm
at/abc126/d.py
at/abc126/d.py
# 二分图染色,本题中图是树 read = input n = int(read()) v = [[] for i in range(n+1)] # 邻接 used = [0 for i in range(n+1)] # 节点 1~n def add(f,t,w): v[f].append((t, w)) for i in range(n-1): f,t,w = map(int, read().split()) add(f,t,w) add(t,f,w) # 从1出发,贪心即可,1画1,理论不会有回环 # def dfs(f, s, fa=-1): # if s % 2 == 0: # ...
read = input n = int(read()) v = [[] for i in range(n+1)] # 邻接 used = [0 for i in range(n+1)] # 节点 1~n def add(f,t,w): v[f].append((t, w)) for i in range(n-1): f,t,w = map(int, read().split()) add(f,t,w) add(t,f,w) # 从1出发,贪心即可,1画1,理论不会有回环 # def dfs(f, s, fa=-1): # if s % 2 == 0: # used[f] =...
mit
Python
ff77fd14081b7828e9ba6a60b5d9b3e0580d2b54
use call instead of run to make python2 compatible
NeurotechBerkeley/bci-course,NeurotechBerkeley/bci-course
lab7/paradigm/play_tag_movie_new.py
lab7/paradigm/play_tag_movie_new.py
# from kivy.app import App # from kivy.uix.video import Video import sys import time from pylsl import StreamInfo, StreamOutlet import subprocess try: input = raw_input except NameError: pass info = StreamInfo('Ganglion_EEG', 'Markers', 1, 0.0, 'int32', 'marker') outlet = StreamOutlet(info) i...
# from kivy.app import App # from kivy.uix.video import Video import sys import time from pylsl import StreamInfo, StreamOutlet import subprocess try: input = raw_input except NameError: pass info = StreamInfo('Ganglion_EEG', 'Markers', 1, 0.0, 'int32', 'marker') outlet = StreamOutlet(info) i...
mit
Python
40a18d111952a6bac82c240a008d6f423b5e6838
Use unicode literals
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/utils/decorators/state.py
salt/utils/decorators/state.py
# -*- coding: utf-8 -*- ''' Decorators for salt.state :codeauthor: :email:`Bo Maryniuk (bo@suse.de)` ''' from __future__ import absolute_import, unicode_literals from salt.exceptions import SaltException def state_output_check(func): ''' Checks for specific types in the state output. Raises an Exception...
# -*- coding: utf-8 -*- ''' Decorators for salt.state :codeauthor: :email:`Bo Maryniuk (bo@suse.de)` ''' from __future__ import absolute_import from salt.exceptions import SaltException def state_output_check(func): ''' Checks for specific types in the state output. Raises an Exception in case particula...
apache-2.0
Python
f8a721108a593c2ae277641ec3ebe315749070bd
Check array data types.
eliteraspberries/avena
avena/xcor2.py
avena/xcor2.py
#!/usr/bin/env python """Cross-correlation of image arrays.""" import numpy from numpy import fft from . import filter, image, np, tile _DETREND_FACTOR = 0.10 def _detrend_filter(array): m, n = array.shape r = int(numpy.sqrt(m * n) * _DETREND_FACTOR) f = filter._high_pass_filter((m, n), r) numpy...
#!/usr/bin/env python """Cross-correlation of image arrays.""" import numpy from numpy import fft from . import filter, image, np, tile _DETREND_FACTOR = 0.10 def _detrend_filter(array): m, n = array.shape r = int(numpy.sqrt(m * n) * _DETREND_FACTOR) f = filter._high_pass_filter((m, n), r) numpy...
isc
Python
9e03c98c3c890b65d497be17eb05648fcd6a355a
Set id on start
openprocurement/openprocurement.buildout
aws_startup.py
aws_startup.py
import argparse import urlparse import os import ConfigParser import subprocess from requests import Session ZONE_TO_ID = { 'eu-west-1a': 'a', 'eu-west-1b': 'b', 'eu-west-1c': 'c' } cur_dir = os.path.dirname(__file__) parser = argparse.ArgumentParser(description='------ AWS Startup Script ------') parser....
import argparse import urlparse import os import ConfigParser import subprocess from requests import Session cur_dir = os.path.dirname(__file__) parser = argparse.ArgumentParser(description='------ AWS Startup Script ------') parser.add_argument('api_dest', type=str, help='Destination to database') params = parser.par...
apache-2.0
Python
c039e4a2e322ee4e0a173f164be598dc630d3579
fix ProxyError inheritance
mitmproxy/mitmproxy,tekii/mitmproxy,meizhoubao/mitmproxy,dxq-git/mitmproxy,ikoz/mitmproxy,ujjwal96/mitmproxy,zlorb/mitmproxy,mosajjal/mitmproxy,zbuc/mitmproxy,liorvh/mitmproxy,sethp-jive/mitmproxy,ikoz/mitmproxy,onlywade/mitmproxy,macmantrl/mitmproxy,zbuc/mitmproxy,MatthewShao/mitmproxy,ddworken/mitmproxy,Kriechi/mitmp...
libmproxy/proxy/primitives.py
libmproxy/proxy/primitives.py
from __future__ import absolute_import class ProxyError(Exception): def __init__(self, code, message, headers=None): super(ProxyError, self).__init__(self, message) self.code, self.headers = code, headers class ConnectionTypeChange(Exception): """ Gets raised if the connection type has be...
from __future__ import absolute_import class ProxyError(Exception): def __init__(self, code, msg, headers=None): self.code, self.msg, self.headers = code, msg, headers def __str__(self): return "ProxyError(%s, %s)" % (self.code, self.msg) class ConnectionTypeChange(Exception): """ Ge...
mit
Python
ff492e1acb78f43677c926b231a04da7ac1012b4
use full path of library insted of the relative path, when import a module.
zordsdavini/qtile,zordsdavini/qtile
libqtile/widget/quick_exit.py
libqtile/widget/quick_exit.py
# Copyright (c) 2019, Shunsuke Mie # # 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, publish, distr...
# Copyright (c) 2019, Shunsuke Mie # # 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, publish, distr...
mit
Python
a40f96ba76657ee1180089447ce6f35d99c00e3d
fix python dependance
iw3hxn/LibrERP,iw3hxn/LibrERP,iw3hxn/LibrERP,iw3hxn/LibrERP,iw3hxn/LibrERP
l10n_it_account/__openerp__.py
l10n_it_account/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2010-2013 Associazione OpenERP Italia # (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero ...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2010-2013 Associazione OpenERP Italia # (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero ...
agpl-3.0
Python
f04667fc229e8b9be2567b9687a6cc5ec5980ab1
remove TL from master component __init__
landlab/landlab,ManuSchmi88/landlab,Carralex/landlab,ManuSchmi88/landlab,RondaStrauch/landlab,ManuSchmi88/landlab,Carralex/landlab,RondaStrauch/landlab,amandersillinois/landlab,amandersillinois/landlab,cmshobe/landlab,landlab/landlab,SiccarPoint/landlab,RondaStrauch/landlab,Carralex/landlab,landlab/landlab,laijingtao/l...
landlab/components/__init__.py
landlab/components/__init__.py
from .craters import CratersComponent from .chi_index import ChiFinder from .diffusion import LinearDiffuser from .fire_generator import FireGenerator from .flexure import Flexure from .flow_accum import AccumFlow from .flow_routing import FlowRouter, DepressionFinderAndRouter from .glacier_thin_ice_model import Glacie...
from .craters import CratersComponent from .chi_index import ChiFinder from .diffusion import LinearDiffuser from .fire_generator import FireGenerator from .flexure import Flexure from .flow_accum import AccumFlow from .flow_routing import FlowRouter, DepressionFinderAndRouter from .glacier_thin_ice_model import Glacie...
mit
Python
85afc6bdae871d9ffe90a50b7b7232938e6f6beb
bump revision number
beni55/gunicorn,pschanely/gunicorn,jamesblunt/gunicorn,urbaniak/gunicorn,wong2/gunicorn,malept/gunicorn,alex/gunicorn,prezi/gunicorn,pschanely/gunicorn,keakon/gunicorn,ccl0326/gunicorn,ccl0326/gunicorn,1stvamp/gunicorn,prezi/gunicorn,jamesblunt/gunicorn,mvaled/gunicorn,mvaled/gunicorn,z-fork/gunicorn,GitHublong/gunicor...
gunicorn/__init__.py
gunicorn/__init__.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. version_info = (0, 7, 1) __version__ = ".".join(map(str, version_info))
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. version_info = (0, 7, 0) __version__ = ".".join(map(str, version_info))
mit
Python
e918ef8240f0f532d10ee3694816b0c9899d3f30
add tag property to DomainRecord
linode/python-linode-api
linode_api4/objects/domain.py
linode_api4/objects/domain.py
from __future__ import absolute_import from linode_api4.errors import UnexpectedResponseError from linode_api4.objects import Base, DerivedBase, Property class DomainRecord(DerivedBase): api_endpoint = "/domains/{domain_id}/records/{id}" derived_url_path = "records" parent_id_name = "domain_id" prop...
from __future__ import absolute_import from linode_api4.errors import UnexpectedResponseError from linode_api4.objects import Base, DerivedBase, Property class DomainRecord(DerivedBase): api_endpoint = "/domains/{domain_id}/records/{id}" derived_url_path = "records" parent_id_name = "domain_id" prop...
bsd-3-clause
Python
3f9cb658d1b3070534b00e32316284b92748b3e9
Use roots_approx_equal
rparini/cxroots,rparini/cxroots
cxroots/tests/test_simplerootfinding.py
cxroots/tests/test_simplerootfinding.py
import unittest import numpy as np from scipy import pi from cxroots import Circle, Rectangle, PolarRect from cxroots.tests.ApproxEqual import roots_approx_equal class TestRootfindingPolynomial(unittest.TestCase): def setUp(self): self.roots = roots = [-1.234, 0, 1+1j, 1-1j, 2.345] self.multiplicities = [1,1,1,...
import unittest import numpy as np from scipy import pi from cxroots import Circle, Rectangle, PolarRect from cxroots.tests.SetsApproxEqual import sets_approx_equal class TestRootfindingPolynomial(unittest.TestCase): def setUp(self): self.roots = roots = [-1.234, 0, 1+1j, 1-1j, 2.345] self.f = lambda z: (z-roo...
bsd-3-clause
Python
fa772e8a4abe0e9fba10720a0ebaadb8d240dbde
allow reading only first n rows in amazon data
Evfro/polara
polara/datasets/amazon.py
polara/datasets/amazon.py
from ast import literal_eval import gzip import pandas as pd def parse_meta(path): with gzip.open(path, 'rt') as gz: for line in gz: yield literal_eval(line) def get_amazon_data(path=None, meta_path=None, nrows=None): res = [] if path: data = pd.read_csv(path, header=None, ...
from ast import literal_eval import gzip import pandas as pd def parse_meta(path): with gzip.open(path, 'rt') as gz: for line in gz: yield literal_eval(line) def get_amazon_data(path=None, meta_path=None): res = [] if path: data = pd.read_csv(path, header=None, ...
mit
Python
dd65ea98f7fa00394a302ac0e5e0bc32b6298277
Set base
mywaystar/sublime-42-norminette
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Baptiste JAMIN # Copyright (c) 2016 Baptiste JAMIN # # License: MIT # """This module exports the 42Norminette plugin class.""" import shlex from SublimeLinter.lint import Linter, persist import sublime import os imp...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Baptiste JAMIN # Copyright (c) 2016 Baptiste JAMIN # # License: MIT # """This module exports the 42Norminette plugin class.""" import shlex from SublimeLinter.lint import Linter, persist import sublime import os imp...
mit
Python
c545b2cac93e18be11efeacad28bb0d7e0d4bef8
Reposition W293
SublimeLinter/SublimeLinter-flake8
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Aparajita Fishman # Copyright (c) 2013-2014 Aparajita Fishman # Copyright (c) 2015-2016 The SublimeLinter Community # # License: MIT # """This module exports the Flake8 plugin linter class.""" from SublimeLinter.li...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Aparajita Fishman # Copyright (c) 2013-2014 Aparajita Fishman # Copyright (c) 2015-2016 The SublimeLinter Community # # License: MIT # """This module exports the Flake8 plugin linter class.""" from SublimeLinter.li...
mit
Python
564bca1e051f6b1cc068d1dd53de55fcf4dc7c6f
Use SublimeLinter-javac as a base
jawshooah/SublimeLinter-contrib-scalac
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Josh Hagins # Copyright (c) 2014 Josh Hagins # # License: MIT # """This module exports the Scalac plugin class.""" from SublimeLinter.lint import Linter, util class Scalac(Linter): """Provides an interface to...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Josh Hagins # Copyright (c) 2014 Josh Hagins # # License: MIT # """This module exports the Scalac plugin class.""" from SublimeLinter.lint import Linter, util class Scalac(Linter): """Provides an interface to...
mit
Python
1262366714500b34a943ae5c481f6489d7c44563
Rename environment variable to match slim-lint
elstgav/SublimeLinter-slim-lint
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Gavin Elster # Copyright (c) 2015 Gavin Elster # # License: MIT # """This module exports the SlimLint plugin class.""" import os from SublimeLinter.lint import RubyLinter, util class SlimLint(RubyLinter): """...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Gavin Elster # Copyright (c) 2015 Gavin Elster # # License: MIT # """This module exports the SlimLint plugin class.""" import os from SublimeLinter.lint import RubyLinter, util class SlimLint(RubyLinter): """...
mit
Python
628d65a15b5c51cb7d4a68e1e6babc01a712a538
Add initial file for GUI
cgsheeh/SFWR3XA3_Redevelopment,cgsheeh/SFWR3XA3_Redevelopment
src/redevbazaar.py
src/redevbazaar.py
import pyforms from pyforms import BaseWidget from pyforms.Controls import ControlText class WelcomeScreen(BaseWidget): def __init__(self): super(WelcomeScreen, self).__init__("TEST1") self.testText = ControlText("WHERE IS THIS") self.mainmenu = [ { 'Home': [ {'My Listings': self.__getlistingsEv...
import pyforms from pyforms import BaseWidget from pyforms.Controls import ControlText class WelcomeScreen(BaseWidget): def __init__(self): super(WelcomeScreen, self).__init__("TEST1") self.testText = ControlText("WHERE IS THIS") if __name__ == "__main__": pyforms.startApp(WelcomeScreen)
mit
Python
e94f66f74f2f93f5d9b8f359a709000a3f529b36
add mp image url
MashSoftware/petitions,MashSoftware/petitions,MashSoftware/petitions
application/routes.py
application/routes.py
import json import requests from application import app from application.utils import get_mp, constituency_extent, constituency_collection from flask import render_template, request from operator import itemgetter @app.route('/', methods=["GET"]) def index(): return render_template('index.html') @app.route('/peti...
import json import requests from application import app from application.utils import get_mp, constituency_extent, constituency_collection from flask import render_template, request from operator import itemgetter @app.route('/', methods=["GET"]) def index(): return render_template('index.html') @app.route('/peti...
mit
Python
2724a345c4a722f493425e2853e3a4ba3cbff8ff
Add a spot for the city.
lectroidmarc/SacTraffic,lectroidmarc/SacTraffic
appengine/models.py
appengine/models.py
"""Model classes for SacTraffic.""" from datetime import datetime, timedelta from google.appengine.ext import db from google.appengine.api import memcache class CHPData(db.Model): """Holds the last successful CHP data fetch.""" data = db.BlobProperty(required=True) updated = db.DateTimeProperty(auto_now=True) d...
"""Model classes for SacTraffic.""" from datetime import datetime, timedelta from google.appengine.ext import db from google.appengine.api import memcache class CHPData(db.Model): """Holds the last successful CHP data fetch.""" data = db.BlobProperty(required=True) updated = db.DateTimeProperty(auto_now=True) d...
isc
Python
1f5930b4ac9b91562768c01c8ff32ad6ceaa721e
Add docstring to app_engine_config.py
tstillwell2k17/GAE-BLOGAPP-MULTI_USER-DEMO,tstillwell2k17/GAE-BLOGAPP-MULTI_USER-DEMO,tstillwell2k17/GAE-BLOGAPP-MULTI_USER-DEMO
appengine_config.py
appengine_config.py
""" This module is used to add any third party libraries to the project codebase. See the libs folder and the README file. This file is parsed when deploying the application or running the local development server. """ # appengine_config.py from google.appengine.ext import vendor # Add any li...
# appengine_config.py from google.appengine.ext import vendor # Add any libraries install in the "libs" folder. vendor.add('libs')
mit
Python
579b1a2052959edc853bc8cfbbddd60c5c70a196
use redis to lock updates
oremj/freddo
apps/updater/tasks.py
apps/updater/tasks.py
import json from subprocess import Popen, PIPE, STDOUT from celery.task import task from django.conf import settings import redisutils def run(script): p = Popen(script, stdout=PIPE, stderr=STDOUT, shell=True) out, err = p.communicate() return p.returncode, out, err @task(ignore_result=True) def update...
import json from subprocess import Popen, PIPE, STDOUT from celery.task import task from django.conf import settings import redisutils def run(script): p = Popen(script, stdout=PIPE, stderr=STDOUT, shell=True) out, err = p.communicate() return p.returncode, out, err @task(ignore_result=True) def update...
mpl-2.0
Python
7fc57f554dc199564cd66257078a9d67180a61f6
Add a match word.
shinshin86/little-magnifying-py-glass,shinshin86/little-magnifying-py-glass
word_match.py
word_match.py
# -*- coding: utf-8 -*- import re def word_check(check_word): # Not process case # => TODO this function if check_word == "。": return True elif check_word == "、": return True elif check_word == " ": return True elif check_word == "": return True elif check_w...
# -*- coding: utf-8 -*- import re def word_check(check_word): # Not process case # => TODO this function if check_word == "。": return True elif check_word == "、": return True elif check_word == " ": return True elif check_word == "": return True elif check_w...
mit
Python
8b331a126d15665e22004304eb8c8b34e248b736
Add images to articles
mfitzp/django-golifescience
apps/blog/models.py
apps/blog/models.py
import os.path import datetime # Django from django.conf import settings from django.db import models from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.contrib.sites.managers import CurrentSiteManager from ...
import os.path import datetime # Django from django.conf import settings from django.db import models from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.contrib.sites.managers import CurrentSiteManager from ...
bsd-3-clause
Python
13b602c50f3be62b2a3a8b267ba00b685fc0c7fe
Update data migration with new CPS description
smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning
python/ecep/portal/migrations/0011_auto_20160518_1211.py
python/ecep/portal/migrations/0011_auto_20160518_1211.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def populate_enrollment_info(apps, schema_editor): """ Populate the Enrollment info based on static text """ Location = apps.get_model('portal', 'Location') for loc in Location.objects.all():...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def populate_enrollment_info(apps, schema_editor): """ Populate the Enrollment info based on static text """ Location = apps.get_model('portal', 'Location') for loc in Location.objects.all():...
mit
Python
a66a6bb3f4ba6db11a762e44621c6752b4f9f5ca
Fix for Window.onError not using $pyjs
pombredanne/pyjs,lovelysystems/pyjamas,lovelysystems/pyjamas,anandology/pyjamas,lancezlin/pyjs,andreyvit/pyjamas,minghuascode/pyj,minghuascode/pyj,Hasimir/pyjs,anandology/pyjamas,certik/pyjamas,spaceone/pyjs,gpitel/pyjs,Hasimir/pyjs,lovelysystems/pyjamas,gpitel/pyjs,Hasimir/pyjs,pyjs/pyjs,minghuascode/pyj,Hasimir/pyjs,...
library/pyjamas/platform/WindowPyJS.py
library/pyjamas/platform/WindowPyJS.py
def setOnError(onError): if (not callable(onError)): raise TypeError("object is not callable") JS("""\ $wnd.onerror=function(msg, url, linenumber){ return onError(msg, url, linenumber); } """) def onError(msg, url, linenumber): dialog=doc().createElement("div") dialog.class...
def setOnError(onError): if (not callable(onError)): raise TypeError("object is not callable") JS("""\ $wnd.onerror=function(msg, url, linenumber){ return onError(msg, url, linenumber); } """) def onError(msg, url, linenumber): dialog=JS("""$doc.createElement("div")""") dia...
apache-2.0
Python
0ff8211cd69d3c957c09e95f612eb842f1edb335
add comment
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
tests/syft/lib/numpy/array_test.py
tests/syft/lib/numpy/array_test.py
# third party import numpy as np import pytest # syft absolute import syft as sy ExampleArray = [ np.array([1, 2, -3], dtype=np.int8), np.array([1, 2, -3], dtype=np.int16), np.array([1, 2, -3], dtype=np.int32), np.array([1, 2, -3], dtype=np.int64), np.array([1, 2, 3], dtype=np.uint8), # np.arr...
# third party import numpy as np import pytest # syft absolute import syft as sy ExampleArray = [ np.array([1, 2, -3], dtype=np.int8), np.array([1, 2, -3], dtype=np.int16), np.array([1, 2, -3], dtype=np.int32), np.array([1, 2, -3], dtype=np.int64), np.array([1, 2, 3], dtype=np.uint8), # np.arr...
apache-2.0
Python
c2b1ba76beebef7030ee1a9a063db95cd843674f
Update venv
snipsco/snipsskills,snipsco/snipsskills,snipsco/snipsskills,snipsco/snipsskills
snipsskills/commands/install/skill.py
snipsskills/commands/install/skill.py
# -*-: coding utf-8 -*- import os from ..base import Base from ...utils.pip_installer import PipInstaller from snipsskillscore import pretty_printer as pp class SkillInstallerException(Exception): pass class SkillInstallerWarning(Exception): pass class SkillInstaller(Base): def run(self, force_d...
# -*-: coding utf-8 -*- import os from ..base import Base from ...utils.pip_installer import PipInstaller from snipsskillscore import pretty_printer as pp class SkillInstallerException(Exception): pass class SkillInstallerWarning(Exception): pass class SkillInstaller(Base): def run(self, force_d...
mit
Python
ee90073152bb3e147fa619d91d3cb74ee7bc47e9
Add dequeue method
derekmpham/interview-prep,derekmpham/interview-prep
array/create-queue.py
array/create-queue.py
# Create queue using a list class Queue: def __init__(self, head=None): self.storage = [head] def enqueue(self, new_element): self.storage.append(new_element) def dequeue(self): return self.storage.pop(0)
# Create queue using a list class Queue: def __init__(self, head=None): self.storage = [head] def enqueue(self, new_element): self.storage.append(new_element)
mit
Python
6f94526a2cbc5acbc60e869c2cce88707df6ada5
update after StructIntf implementation
Nic30/hwtLib,Nic30/hwtLib
hwtLib/samples/iLvl/axi/simpleAxiRegs.py
hwtLib/samples/iLvl/axi/simpleAxiRegs.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from hwt.code import If, connect from hwt.hdlObjects.typeShortcuts import vecT from hwt.interfaces.utils import addClkRstn, propagateClkRstn from hwt.synthesizer.interfaceLevel.unit import Unit from hwt.synthesizer.param import Param from hwtLib.amba.axiLite import AxiLit...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from hwt.code import If, connect from hwt.hdlObjects.typeShortcuts import vecT from hwt.interfaces.utils import addClkRstn, propagateClkRstn from hwt.synthesizer.interfaceLevel.unit import Unit from hwt.synthesizer.param import Param from hwtLib.amba.axiLite import AxiLit...
mit
Python
c19a38b0c09172fe74ed92646723a2c36583bb87
reduce processes.
nbrady-techempower/FrameworkBenchmarks,F3Community/FrameworkBenchmarks,nbrady-techempower/FrameworkBenchmarks,jeevatkm/FrameworkBenchmarks,marko-asplund/FrameworkBenchmarks,victorbriz/FrameworkBenchmarks,seem-sky/FrameworkBenchmarks,ratpack/FrameworkBenchmarks,Jesterovskiy/FrameworkBenchmarks,mfirry/FrameworkBenchmarks...
wsgi/setup.py
wsgi/setup.py
import subprocess import setup_util import multiprocessing import os bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin') NCPU = multiprocessing.cpu_count() CIRCUS_INI = """\ [watcher:app] cmd = {BIN}/chaussette --fd=$(circus.sockets.app) --backend=meinheld hello.app use_sockets = True numprocesses ...
import subprocess import setup_util import multiprocessing import os bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin') NCPU = multiprocessing.cpu_count() CIRCUS_INI = """\ [watcher:app] cmd = {BIN}/chaussette --fd=$(circus.sockets.app) --backend=meinheld hello.app use_sockets = True numprocesses ...
bsd-3-clause
Python
327fa87b7b6f2ac204312918c27d5437080e600e
make pretty
RoboJackets/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software
soccer/gameplay/positions/position.py
soccer/gameplay/positions/position.py
# See PEP 0563 : Enabling the future behavior in Python 3.7 # In this current version, it is not allowed to have a return # type of the current class, which has not fully been defined yet # pylint: disable=no-name-in-module from __future__ import annotations # type: ignore import robocup import single_robot_composite...
# See PEP 0563 : Enabling the future behavior in Python 3.7 # In this current version, it is not allowed to have a return # type of the current class, which has not fully been defined yet # pylint: disable=no-name-in-module from __future__ import annotations # type: ignore import robocup import single_robot_composite_...
apache-2.0
Python
a968156d8a96cd4685c3973657b368d8f310ea74
Add docstring
ironman5366/W.I.L.L,ironman5366/W.I.L.L
basicclient.py
basicclient.py
#An EXTREMELY basic client for W.I.L.L., mainly used for light debugging import easygui import urllib import sys def main(command): '''A basic debugging oriented client using easygui''' command=urllib.urlencode({"command":command}) answer=urllib.urlopen("http://127.0.0.1:5000?context=command&%s"%command).read() eas...
#An EXTREMELY basic client for W.I.L.L., mainly used for light debugging import easygui import urllib import sys def main(command): command=urllib.urlencode({"command":command}) answer=urllib.urlopen("http://127.0.0.1:5000?context=command&%s"%command).read() easygui.msgbox(answer) while True: command=easygui.enterb...
mit
Python
b286e03f96cce8518dd60b74ff8dac6d7b7c5a97
Support users with no name
LABHR/octohatrack,glasnt/octohat
octohatrack/helpers.py
octohatrack/helpers.py
#!/usr/bin/env python import sys def _sort_by_name(contributor): if contributor.get('name'): return contributor['name'].lower() return contributor['user_name'] def display_results(repo_name, contributors, api_len): """ Fancy display. """ print("\n") print("All Contributors:")...
#!/usr/bin/env python import sys def display_results(repo_name, contributors, api_len): """ Fancy display. """ print("\n") print("All Contributors:") # Sort and consolidate on Name seen = [] for user in sorted(contributors, key=lambda k: k['name'].lower()): if user["name"] ...
bsd-3-clause
Python
e59118b9f72d060b6386301a984989ee7bb195eb
Remove an unused import
drj11/pypng,drj11/pypng
code/mkiccp.py
code/mkiccp.py
#!/usr/bin/env python # $URL$ # $Rev$ # Make ICC Profile # References # # [ICC 2001] ICC Specification ICC.1:2001-04 (Profile version 2.4.0) # [ICC 2004] ICC Specification ICC.1:2004-10 (Profile version 4.2.0.0) # Local module. import iccp def black(m): """Return a function that maps all values from [0.0,m] to 0...
#!/usr/bin/env python # $URL$ # $Rev$ # Make ICC Profile # References # # [ICC 2001] ICC Specification ICC.1:2001-04 (Profile version 2.4.0) # [ICC 2004] ICC Specification ICC.1:2004-10 (Profile version 4.2.0.0) import struct # Local module. import iccp def black(m): """Return a function that maps all values fr...
mit
Python
a6bdf63816243b00c9f463b174886538b3705b91
Update addons version
OCA/l10n-switzerland,OCA/l10n-switzerland
l10n_ch_base_bank/__openerp__.py
l10n_ch_base_bank/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi. Copyright Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by t...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi. Copyright Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by t...
agpl-3.0
Python
1c883c1931dbadc2b786db1d11968908f9b3201f
Fix broken SQL
fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver
src/ctf_gameserver/controller/database.py
src/ctf_gameserver/controller/database.py
from ctf_gameserver.lib.database import transaction_cursor from ctf_gameserver.lib.date_time import ensure_utc_aware from ctf_gameserver.lib.exceptions import DBDataError def get_control_info(db_conn, prohibit_changes=False): """ Returns a dictionary containing relevant information about the competion, as sto...
from ctf_gameserver.lib.database import transaction_cursor from ctf_gameserver.lib.date_time import ensure_utc_aware from ctf_gameserver.lib.exceptions import DBDataError def get_control_info(db_conn, prohibit_changes=False): """ Returns a dictionary containing relevant information about the competion, as sto...
isc
Python
ac2f37f88475998197d619a584824e9c2c30eea1
Update __init__.py
stiphyMT/plantcv,stiphyMT/plantcv,danforthcenter/plantcv,stiphyMT/plantcv,danforthcenter/plantcv,danforthcenter/plantcv
plantcv/plantcv/transform/__init__.py
plantcv/plantcv/transform/__init__.py
from plantcv.plantcv.transform.color_correction import get_color_matrix from plantcv.plantcv.transform.color_correction import get_matrix_m from plantcv.plantcv.transform.color_correction import calc_transformation_matrix from plantcv.plantcv.transform.color_correction import apply_transformation_matrix from plantcv.pl...
from plantcv.plantcv.transform.color_correction import get_color_matrix from plantcv.plantcv.transform.color_correction import get_matrix_m from plantcv.plantcv.transform.color_correction import calc_transformation_matrix from plantcv.plantcv.transform.color_correction import apply_transformation_matrix from plantcv.pl...
mit
Python
8e747655f08fb56bcdd5b272c2b3a659afe228a9
Add cors headers to the signing servlet
matrix-org/sydent,matrix-org/sydent,matrix-org/sydent
sydent/http/servlets/blindlysignstuffservlet.py
sydent/http/servlets/blindlysignstuffservlet.py
# -*- coding: utf-8 -*- # Copyright 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
# -*- coding: utf-8 -*- # Copyright 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
apache-2.0
Python
d6f0bcaf272592dae046aa2d4fbf0e304da73d8e
fix bug
cloudorz/apple
launch.py
launch.py
# coding: utf-8 ''' ''' import os.path import tornado.web import tornado.httpserver import tornado.database import tornado.options import tornado.ioloop from tornado.options import define, options from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, scoped_session from apps.loud import Lou...
# coding: utf-8 ''' ''' import os.path import tornado.web import tornado.httpserver import tornado.database import tornado.options import tornado.ioloop from tornado.options import define, options from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, scoped_session from apps.loud import Lou...
bsd-3-clause
Python
0566f69d12c80dfb50be20da5352f14457d00819
fix the ptoblem about the observed monomass and calculated monomass, tagDTASelect.py
wangchulab/CIMAGE,wangchulab/CIMAGE,wangchulab/CIMAGE,wangchulab/CIMAGE,wangchulab/CIMAGE,wangchulab/CIMAGE,wangchulab/CIMAGE,wangchulab/CIMAGE,wangchulab/CIMAGE
python/tagDTASelect.py
python/tagDTASelect.py
#!/usr/bin/env python # # tag each peptide line in DTASelect output file with its IPI name at beginning import sys from sys import argv if len(argv) != 2: print 'Usage: %s <DTASelect-filter.txt>'%argv[0] print 'tag each peptide line in DTASelect output file with its IPI name at beginning' sys.exit(-1) ##...
#!/usr/bin/env python # # tag each peptide line in DTASelect output file with its IPI name at beginning import sys from sys import argv if len(argv) != 2: print 'Usage: %s <DTASelect-filter.txt>'%argv[0] print 'tag each peptide line in DTASelect output file with its IPI name at beginning' sys.exit(-1) ##...
mit
Python
6dc5d39f5fb075a5a810e18506a714d89a57a016
Change the ipython printing test to use init_printing().
yashsharan/sympy,debugger22/sympy,dqnykamp/sympy,MechCoder/sympy,lidavidm/sympy,toolforger/sympy,Sumith1896/sympy,skidzo/sympy,dqnykamp/sympy,sahmed95/sympy,kaushik94/sympy,hrashk/sympy,vipulroxx/sympy,farhaanbukhsh/sympy,Davidjohnwilson/sympy,madan96/sympy,shikil/sympy,MridulS/sympy,rahuldan/sympy,wanglongqi/sympy,ahh...
sympy/interactive/tests/test_ipythonprinting.py
sympy/interactive/tests/test_ipythonprinting.py
"""Tests that the IPython printing module is properly loaded. """ from sympy.interactive.session import init_ipython_session from sympy.external import import_module # run_cell was added in IPython 0.11 ipython = import_module("IPython", min_module_version="0.11") # disable tests if ipython is not present if not ipy...
"""Tests that the IPython printing module is properly loaded. """ from sympy.interactive.session import init_ipython_session from sympy.external import import_module # run_cell was added in IPython 0.11 ipython = import_module("IPython", min_module_version="0.11") # disable tests if ipython is not present if not ipy...
bsd-3-clause
Python
1ba6f53fb0503f9443f13e5affea70c244ee98d1
update to use the algorithm class
Xia0ben/IQPlayground
launch.py
launch.py
import os.path import pickle from files import InvertedFile, Reader from algorithm import SimpleScanAlgorithm file_path = "latimes/la100590" pickle_path = "pickles/la100590" if os.path.isfile(pickle_path): with open(pickle_path, "rb") as file: inv_file = pickle.load(file) else: documents = Reader.r...
import os.path import pickle from files import Inverted_File, Reader file_path = "latimes/la100590" pickle_path = "pickles/la100590" if os.path.isfile(pickle_path): with open(pickle_path, "rb") as file: inv_file = pickle.load(file) else: documents = Reader.read_file(file_path) print("Number of ...
mit
Python
9128d9032dac95128a01f60ef62b448e8e807a27
Optimise collegehumor.py
CJ-Jackson/django-mediaembedder
mediaembedder/services/collegehumor.py
mediaembedder/services/collegehumor.py
services = [] def collegehumor(self): id = self.match.group('collegehumor_id') width = 640 height = 360 if self.width: width = self.width elif 'og:video:width' in self.data['meta']: width = int(self.data['meta']['og:video:width']) if self.height: height = self.height ...
services = [] def collegehumor(self): id = self.match.group('collegehumor_id') if self.width: width = self.width else: try: width = int(self.data['meta']['og:video:width']) except: width = 640 if self.height: height = self.height else: ...
mit
Python
027c6c696ef8c58856806eb916c85f9fde97f758
Update FA icons.
michaelkuty/horizon-contrib,michaelkuty/horizon-contrib,michaelkuty/horizon-contrib
horizon_contrib/tables/filters.py
horizon_contrib/tables/filters.py
from datetime import datetime from django.utils.safestring import SafeString def timestamp_to_datetime(value): return datetime.fromtimestamp(value) def nonbreakable_spaces(value): return SafeString(value.replace(' ', '&nbsp;')) def unit_times(value): return SafeString('%s%s' % (value, '&times;')) ...
from datetime import datetime from django.utils.safestring import SafeString def timestamp_to_datetime(value): return datetime.fromtimestamp(value) def nonbreakable_spaces(value): return SafeString(value.replace(' ', '&nbsp;')) def unit_times(value): return SafeString('%s%s' % (value, '&times;')) ...
bsd-3-clause
Python
c64d3f5701ee9e228d53f4228327ca2392fbb305
Update repo created event
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
polyaxon/event_manager/events/repo.py
polyaxon/event_manager/events/repo.py
from event_manager import event_actions, event_subjects from event_manager.event import Attribute, Event REPO_CREATED = '{}.{}'.format(event_subjects.REPO, event_actions.CREATED) REPO_DOWNLOADED = '{}.{}'.format(event_subjects.REPO, event_actions.DOWNLOADED) REPO_NEW_COMMIT = '{}.new_commit'.format(event_subjects.REPO...
from event_manager import event_actions, event_subjects from event_manager.event import Attribute, Event REPO_CREATED = '{}.{}'.format(event_subjects.REPO, event_actions.CREATED) REPO_DOWNLOADED = '{}.{}'.format(event_subjects.REPO, event_actions.DOWNLOADED) REPO_NEW_COMMIT = '{}.new_commit'.format(event_subjects.REPO...
apache-2.0
Python
9c47519a8327640124adf27e23c80327269ad745
Tweak allocator
explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc
thinc/backends/_cupy_allocators.py
thinc/backends/_cupy_allocators.py
from typing import cast from ..types import ArrayXd from ..util import tensorflow2xp try: import tensorflow except ImportError: pass try: import torch import torch.cuda except ImportError: pass try: from cupy.cuda.memory import MemoryPointer from cupy.cuda.memory import UnownedMemory exc...
from typing import cast from ..types import ArrayXd from ..util import tensorflow2xp try: import tensorflow except ImportError: pass try: import torch except ImportError: pass try: from cupy.cuda.memory import MemoryPointer from cupy.cuda.memory import UnownedMemory except ImportError: p...
mit
Python
7ec29c392a49c6ad4c2a7d2501d12c85c2480242
insert data into mysql database
varnish/varnish-microservice-monitor,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/varnish-microservice-monitor
log-reader/log/LogDatabase.py
log-reader/log/LogDatabase.py
from simplemysql import SimpleMysql class LogDatabase: def __init__(self, **keyVals): # saving database parameters self.dbParams = keyVals # table information self.tablePrefix = 'zipkin_' self.tables = ['spans', 'annotations'] # connect to database self.db ...
from simplemysql import SimpleMysql class LogDatabase: def __init__(self, **keyVals): # saving database parameters self.dbParams = keyVals # table information self.tablesPrefix = 'zipkin_' self.tables = ['spans', 'annotations'] # connect to database self.db...
bsd-2-clause
Python
b4d350e165fe7351cdb0ce1fc03e992da89cd185
Make the ship shut up
cnlohr/bridgesim,cnlohr/bridgesim,cnlohr/bridgesim,cnlohr/bridgesim
src/server/Ship.py
src/server/Ship.py
from Entity import Entity from Component import * from Missile import Missile import sys class Ship(Entity): def __init__(self, config, universe): super().__init__(config, universe) self.__dict__.update(config) self.energy = self.maxEnergy # How much power Engineering is giving to each component - ...
from Entity import Entity from Component import * from Missile import Missile import sys class Ship(Entity): def __init__(self, config, universe): super().__init__(config, universe) self.__dict__.update(config) self.energy = self.maxEnergy # How much power Engineering is giving to each component - ...
mit
Python
90e62a41b49a978b4bea3a5af87d26ef1fb23009
Fix namespacing when retrieving remote URIs
redmatter/combine
combine/uri.py
combine/uri.py
# Copyright (c) 2010 John Reese # Licensed under the MIT license import urllib2 import urlparse from combine import Package, File class URI: def __init__(self, uri, package=None, format=None, target=None): self.uri = uri self.parse = urlparse.urlparse(uri) self.package = package ...
# Copyright (c) 2010 John Reese # Licensed under the MIT license import urllib2 import urlparse from combine import Package, File class URI: def __init__(self, uri, package=None, format=None, target=None): self.uri = uri self.parse = urlparse.urlparse(uri) self.package = package ...
mit
Python
d14454e59f6ba6b2f7f2227e1a22e67c392c944e
make pyxl work when using codecs.decode in addition to codecs.streamreader
wfxiang08/pyxl,dropbox/pyxl,pyxl4/pyxl4,lez/pyxl3
pyxl/codec/register.py
pyxl/codec/register.py
#!/usr/bin/env python # # 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, softwar...
#!/usr/bin/env python # # 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, softwar...
apache-2.0
Python
4133f5f4c04ae75bb8fbe368d851957bceb844e3
Update math_reverse_integer.py
ngovindaraj/Python
leetcode/math_reverse_integer.py
leetcode/math_reverse_integer.py
# @file Math Reverse Integer # @brief Given a 32-bit signed integer, reverse digits of an integer. # https://leetcode.com/problems/reverse-integer/ ''' Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Outpu...
# @file Math Reverse Integer # @brief Given a 32-bit signed integer, reverse digits of an integer. # https://leetcode.com/problems/reverse-integer/ ''' Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Outpu...
mit
Python
12a89261e5b831096e734688edf4a9c1b6ee21b3
Fix pub integration test on arm64 macs
dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk
tools/bots/pub_integration_test.py
tools/bots/pub_integration_test.py
#!/usr/bin/env python3 # Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. import optparse import os import subprocess import sys import shutil import tempfil...
#!/usr/bin/env python3 # Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. import optparse import os import subprocess import sys import shutil import tempfil...
bsd-3-clause
Python
d701885655b2b459df3920e8dd10df195138b11e
Add CSV output via hooks (#36)
deepgram/kur
kur/model/hooks/output_hook.py
kur/model/hooks/output_hook.py
""" Copyright 2016 Deepgram 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, software distri...
""" Copyright 2016 Deepgram 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, software distri...
apache-2.0
Python
ba69549405b86573f2996db8d0d4336e0c2a084b
Replace urllib2 w/ requests
lexifdev/crawlers,lexifdev/crawlers,teampopong/crawlers,majorika/crawlers,teampopong/crawlers,majorika/crawlers
bills/utils.py
bills/utils.py
#! /usr/bin/python2.7 # -*- coding: utf-8 -*- import html5lib import json import os import traceback import requests HEADERS = { 'Referer': 'http://likms.assembly.go.kr/bill/jsp/BillSearchResult.jsp', } def check_dir(directory): if not os.path.exists(directory): os.makedirs(directory) def get_elems...
#! /usr/bin/python2.7 # -*- coding: utf-8 -*- import html5lib import json import os from shutil import copyfileobj import urllib2 opener = urllib2.build_opener() opener.addheaders.append(('Referer', 'http://likms.assembly.go.kr/bill/jsp/BillSearchResult.jsp')) def check_dir(directory): if not os.path.exists(dire...
agpl-3.0
Python
e64e86a68bae51cd5aefbff563112c0f4765065c
Set version number for v1.0.1
ajdawson/gridfill
gridfill/__init__.py
gridfill/__init__.py
"""Fill missing values in a grid.""" # Copyright (c) 2012-2014 Andrew Dawson # # 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 # ...
"""Fill missing values in a grid.""" # Copyright (c) 2012-2014 Andrew Dawson # # 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 # ...
mit
Python
866f95cfb0db14da0596efe41a128baf2a3a1cfe
Fix form PageForm needs updating.
ad-m/django-basic-tinymce-flatpages
django_basic_tinymce_flatpages/admin.py
django_basic_tinymce_flatpages/admin.py
from django.conf import settings from django.contrib import admin from django.contrib.flatpages.admin import FlatpageForm, FlatPageAdmin from django.contrib.flatpages.models import FlatPage from django.utils.module_loading import import_string FLATPAGE_WIDGET = getattr(settings, 'FLATPAGE_WIDGET', 'tinymce.widgets.Tin...
from django.conf import settings from django.contrib import admin from django.contrib.flatpages.admin import FlatpageForm, FlatPageAdmin from django.contrib.flatpages.models import FlatPage from django.utils.module_loading import import_string FLATPAGE_WIDGET = getattr(settings, 'FLATPAGE_WIDGET', 'tinymce.widgets.Tin...
bsd-3-clause
Python
04983c399cfdd70cdde121bbbf4e06b8e94370b1
add get_available_languages().
ulule/django-linguist
linguist/mixins.py
linguist/mixins.py
# -*- coding: utf-8 -*- from .models import Translation from .utils import get_cache_key class LinguistMixin(object): def clear_translations_cache(self): self._linguist.clear() @property def language(self): return self._linguist.language @language.setter def language(self, value...
# -*- coding: utf-8 -*- from .models import Translation from .utils import get_cache_key class LinguistMixin(object): def clear_translations_cache(self): self._linguist.clear() @property def language(self): return self._linguist.language @language.setter def language(self, value...
mit
Python
c40d0450846e5f23413587e138792dbad8e2afd3
fix AttributeError
onelab-eu/sfa,yippeecw/sfa,yippeecw/sfa,onelab-eu/sfa,yippeecw/sfa,onelab-eu/sfa
sfa/rspecs/elements/element.py
sfa/rspecs/elements/element.py
class Element(dict): fields = {} def __init__(self, fields={}, element=None, keys=None): self.element = element dict.__init__(self, dict.fromkeys(self.fields)) if not keys: keys = fields.keys() for key in keys: if key in fields: self[key]...
class Element(dict): fields = {} def __init__(self, fields={}, element=None, keys=None): self.element = element dict.__init__(self, dict.fromkeys(self.fields)) if not keys: keys = fields.keys() for key in keys: if key in fields: self[key]...
mit
Python
857a7542c8e55b0162420e408f5175ae48c5f030
Remove gaps for workspace widget. Change colors.
alberand/lemonbar,alberand/lemonbar,alberand/lemonbar
widgets/ws.py
widgets/ws.py
#!/usr/bin/env python3 import sys import json import subprocess from utils import set_b_color, set_f_color, set_spacing from widgets.widget import Widget from widgets.config import colors, icons class Workspaces(Widget): ''' ''' def __init__(self, value=''): ''' Params: bg: b...
#!/usr/bin/env python3 import sys import json import subprocess from utils import set_b_color, set_f_color, set_spacing from widgets.widget import Widget from widgets.config import colors, icons class Workspaces(Widget): ''' ''' def __init__(self, value=''): ''' Params: bg: b...
mit
Python
acc1131002d9c498042ce1bd4a737dee6b47a2dd
Remove redundant import.
bretth/django-pavlova-project,bretth/django-pavlova-project,bretth/django-pavlova-project
project/project_name/settings/base.py
project/project_name/settings/base.py
from os.path import abspath, basename, dirname DJANGO_ROOT = dirname(dirname(abspath(__file__))) # Absolute filesystem path to the top-level project folder: SITE_ROOT = dirname(DJANGO_ROOT) # Site name: SITE_NAME = basename(DJANGO_ROOT)
from os.path import abspath, basename, dirname from sys import path DJANGO_ROOT = dirname(dirname(abspath(__file__))) # Absolute filesystem path to the top-level project folder: SITE_ROOT = dirname(DJANGO_ROOT) # Site name: SITE_NAME = basename(DJANGO_ROOT)
mit
Python
d1008437dcf618700bce53913f3450aceda8a23f
Remove xadmin as it will not work with guardian.
weijia/djangoautoconf,weijia/djangoautoconf
djangoautoconf/auto_conf_admin_utils.py
djangoautoconf/auto_conf_admin_utils.py
from guardian.admin import GuardedModelAdmin from django.contrib import admin #The following not work with guardian? #import xadmin as admin def register_to_sys(class_inst, admin_class=None): if admin_class is None: admin_class = type(class_inst.__name__ + "Admin", (GuardedModelAdmin, ), {}) try: ...
from guardian.admin import GuardedModelAdmin #from django.contrib import admin import xadmin as admin def register_to_sys(class_inst, admin_class = None): if admin_class is None: admin_class = type(class_inst.__name__+"Admin", (GuardedModelAdmin, ), {}) try: admin.site.register(class_inst, ad...
bsd-3-clause
Python
23d1d4f11b081eb946df0895e8e622a2c53cfc72
Update filter_genes_matrix.py
jfnavarro/st_analysis
scripts/filter_genes_matrix.py
scripts/filter_genes_matrix.py
#! /usr/bin/env python """ Script that takes a ST dataset (matrix of counts) where the columns are genes and the rows are spot coordinates gene gene XxY XxY And removes the columns of genes matching the regular expression given as input. @Author Jose Fernandez Navarro <jose.fernandez.navarro@scilifela...
#! /usr/bin/env python """ Script that takes a ST dataset (matrix of counts) where the columns are genes and the rows are spot coordinates gene gene XxY XxY And removes the columns of genes matching the regular expression given as input. @Author Jose Fernandez Navarro <jose.fernandez.navarro@scilifela...
mit
Python
76e35d291ae6619aaf95636deec96247b2e64d62
Add logging to Cloudformation
CloudHeads/lambda_utils
lambda_utils/cloudformation.py
lambda_utils/cloudformation.py
import json import urllib2 from lambda_utils import Event, logging class Cloudformation(Event): event = None status = None response = None reason = None def wrapped_function(self, event, context): logging.info(event) self.event = self.extract_event(event) self.status = ...
import json import urllib2 from lambda_utils import Event class Cloudformation(Event): event = None status = None response = None reason = None def wrapped_function(self, event, context): self.event = self.extract_event(event) self.status = 'FAILED' self.response = None ...
mit
Python
331da7f3004f295a120b3e61a9b525c16bb7f62a
Update version to 2.0-dev.
tsiegleauq/OpenSlides,rolandgeider/OpenSlides,OpenSlides/OpenSlides,ostcar/OpenSlides,normanjaeckel/OpenSlides,normanjaeckel/OpenSlides,CatoTH/OpenSlides,rolandgeider/OpenSlides,ostcar/OpenSlides,CatoTH/OpenSlides,jwinzer/OpenSlides,boehlke/OpenSlides,emanuelschuetze/OpenSlides,jwinzer/OpenSlides,jwinzer/OpenSlides,nor...
openslides/__init__.py
openslides/__init__.py
__author__ = 'OpenSlides Team <support@openslides.org>' __description__ = 'Presentation and assembly system' __version__ = '2.0-dev'
__author__ = 'OpenSlides Team <support@openslides.org>' __description__ = 'Presentation and assembly system' __version__ = '2.0b5'
mit
Python
3a878c528929fa7090f0dd16f97e1ae1b0d73be1
Remove feature selection
davidgasquez/kaggle-airbnb
scripts/generate_submission.py
scripts/generate_submission.py
#!/usr/bin/env python import pandas as pd import numpy as np import datetime from sklearn.preprocessing import LabelEncoder from xgboost.sklearn import XGBClassifier from sklearn.ensemble import ExtraTreesClassifier from sklearn.feature_selection import SelectFromModel def generate_submission(y_pred, test_users_ids,...
#!/usr/bin/env python import pandas as pd import numpy as np import datetime from sklearn.preprocessing import LabelEncoder from xgboost.sklearn import XGBClassifier from sklearn.ensemble import ExtraTreesClassifier from sklearn.feature_selection import SelectFromModel def generate_submission(y_pred, test_users_ids,...
mit
Python
35119551542a2e403e6d66b371d9913d6d1ed440
Add unicode treatment on JSONField rendering
opps/opps,jeanmask/opps,opps/opps,jeanmask/opps,williamroot/opps,williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,YACOWS/opps,YACOWS/opps
opps/fields/widgets.py
opps/fields/widgets.py
#!/usr/bin/env python # -*- coding: utf-8 -* import json from django import forms from django.template.loader import render_to_string from .models import Field, FieldOption class JSONField(forms.TextInput): model = Field def render(self, name, value, attrs=None): elements = [] try: ...
#!/usr/bin/env python # -*- coding: utf-8 -* import json from django import forms from django.template.loader import render_to_string from .models import Field, FieldOption class JSONField(forms.TextInput): model = Field def render(self, name, value, attrs=None): elements = [] try: ...
mit
Python
40080380c194c8d8a46250f5e75fa210600f8005
update crawler
vitorfs/woid,vitorfs/woid,vitorfs/woid
scripts/hackernews_services.py
scripts/hackernews_services.py
from unipath import Path import sys import os PROJECT_DIR = Path(os.path.abspath(__file__)).parent.parent sys.path.append(PROJECT_DIR) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'woid.settings') import django django.setup() import time import threading from django.utils import timezone from woid.crawler.craw...
from unipath import Path import sys import os PROJECT_DIR = Path(os.path.abspath(__file__)).parent.parent sys.path.append(PROJECT_DIR) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'woid.settings') import django django.setup() import time import threading from django.utils import timezone from woid.crawler.craw...
apache-2.0
Python
ab17649005ce87277a8af11994d3f1fc7de2d120
Update file_system_storage.py
ArabellaTech/django-image-diet
image_diet/file_system_storage.py
image_diet/file_system_storage.py
import os from image_diet import settings from django.conf import settings as main_settings from django.contrib.staticfiles.storage import StaticFilesStorage class ImageDietFileSystemStorage(StaticFilesStorage): def post_process(self, files, *args, **kwargs): results = [] print 'test' pri...
import os from image_diet import settings from django.conf import settings as main_settings from django.contrib.staticfiles.storage import StaticFilesStorage class ImageDietFileSystemStorage(StaticFilesStorage): def post_process(self, files, *args, **kwargs): results = [] print 'test' pri...
mit
Python
bca06e7888af9d47e93eff6500c71343525c3f24
Make sure instance_class is present. Default num cache nodes to 1
yaybu/touchdown,mitchellrj/touchdown
touchdown/aws/elasticache/cache.py
touchdown/aws/elasticache/cache.py
# Copyright 2014 Isotoma Limited # # 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 2014 Isotoma Limited # # 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
ea9b40f4b69ebdce7ac060a467151c8e80c5513e
Fix up whoisaccount with new metadata key
Heufneutje/txircd
txircd/modules/core/whoisaccount.py
txircd/modules/core/whoisaccount.py
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import IModuleData, ModuleData from zope.interface import implements irc.RPL_WHOISACCOUNT = "330" class WhoisAccount(ModuleData): implements(IPlugin, IModuleData) name = "WhoisAccount" core = True def actions...
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import IModuleData, ModuleData from zope.interface import implements irc.RPL_WHOISACCOUNT = "330" class WhoisAccount(ModuleData): implements(IPlugin, IModuleData) name = "WhoisAccount" core = True def actions...
bsd-3-clause
Python
b226a96229a75a0cdcfc3acca3ec84beba2c1613
refresh camera after changing it does not work FIX
madhuni/AstroBox,madhuni/AstroBox,AstroPrint/AstroBox,abinashk-inf/AstroBox,abinashk-inf/AstroBox,AstroPrint/AstroBox,madhuni/AstroBox,AstroPrint/AstroBox,abinashk-inf/AstroBox,madhuni/AstroBox,abinashk-inf/AstroBox
src/astroprint/api/camera.py
src/astroprint/api/camera.py
# coding=utf-8 __author__ = "Daniel Arroyo <daniel@astroprint.com>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' import octoprint.util as util from flask import jsonify, request, abort from octoprint.server import restricted_access, SUCCESS from octoprint.server.api import a...
# coding=utf-8 __author__ = "Daniel Arroyo <daniel@astroprint.com>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' import octoprint.util as util from flask import jsonify, request, abort from octoprint.server import restricted_access, SUCCESS from octoprint.server.api import a...
agpl-3.0
Python
004a804e1d4bbf2caf588bb98127f6bbb8357a72
Update projectfiles_unchanged.py version 4
kullo/smartsqlite,kullo/smartsqlite,kullo/smartsqlite
projectfiles_unchanged.py
projectfiles_unchanged.py
#!/usr/bin/env python3 # # This script is used on Linux, OS X and Windows. # Python 3 required. # Returns 0 if project files are unchanged and 1 else. # # Script version: 4 import os import glob import hashlib import sys matches = [] tmp_file = "projectfiles.md5.tmp" exlude_dirs = set(['.git', 'docs']) def get_subdi...
#!/usr/bin/env python3 # # This script is used on Linux, OS X and Windows. # Python 3 required. # Returns 0 if project files are unchanged and 1 else. # # Script version: 3 import os import glob import hashlib import sys matches = [] tmp_file = "projectfiles.md5.tmp" exlude_dirs = set(['.git', 'docs']) def get_subdi...
bsd-3-clause
Python
ad06f149015fc78365df3a20f7b66d6b00de3da7
Rename related state to joined to match interface update
juju-solutions/layer-apache-flume-hdfs,juju-solutions/layer-apache-flume-hdfs
reactive/flume_hdfs.py
reactive/flume_hdfs.py
from charms.reactive import when, when_not from charms.reactive import set_state, remove_state, is_state from charmhelpers.core import hookenv from charms.layer.apache_flume_base import Flume from charms.reactive.helpers import any_file_changed @when_not('hadoop.joined') def report_unconnected(): hookenv.status_s...
from charms.reactive import when, when_not from charms.reactive import set_state, remove_state, is_state from charmhelpers.core import hookenv from charms.layer.apache_flume_base import Flume from charms.reactive.helpers import any_file_changed @when_not('hadoop.related') def report_unconnected(): hookenv.status_...
apache-2.0
Python
657a22dc282452b9ffeb408721623c3029cf5ad2
save allvisit filename on paths object
adrn/thejoker,adrn/thejoker
scripts/make-troup-allVisit.py
scripts/make-troup-allVisit.py
""" Create a subset of APOGEE's allVisit file that contains only the stars in Troup's sample. """ # Standard library import os # Third-party from astropy.io import fits import h5py import numpy as np # Project from thejoker import Paths paths = Paths(__file__) def main(): allVisit_path = os.path.join(paths.ro...
""" Create a subset of APOGEE's allVisit file that contains only the stars in Troup's sample. """ # Standard library import os # Third-party from astropy.io import fits import h5py import numpy as np # Project from thejoker import Paths paths = Paths(__file__) def main(): allVisit_path = os.path.join(paths.ro...
mit
Python
075bb05e57e63bb3e4f6cf70ce2c7db883d920e2
correct curve radius formula
FlorianGraef/adv-lane-lines-vehicle-detection
lane_line.py
lane_line.py
import numpy as np from collections import deque class LaneLine(): def __init__(self): # was the line detected in the last iteration? self.detected = False # x values of the last n fits of the line self.recent_xfitted = deque([]) self.recent_yfitted = None ...
import numpy as np from collections import deque class LaneLine(): def __init__(self): # was the line detected in the last iteration? self.detected = False # x values of the last n fits of the line self.recent_xfitted = deque([]) self.recent_yfitted = None ...
mit
Python
0c47016840b9b9b0feaeab6076a48da0b41d3520
Edit notifier.notify()
openstack/osprofiler,stackforge/osprofiler,openstack/osprofiler,stackforge/osprofiler,openstack/osprofiler,stackforge/osprofiler
osprofiler/notifier.py
osprofiler/notifier.py
# Copyright 2014 Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
# Copyright 2014 Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
apache-2.0
Python
0aa22c1a24fb649a9186d36e44a5a7f1a53e66df
Add items() method to odict() as suggested by @streeto. Closes #49.
atpy/atpy
atpy/odict.py
atpy/odict.py
from __future__ import print_function, division import numpy as np class odict(object): def __init__(self): self.keys = [] self.values = [] def __setitem__(self, key, value): if type(key) == int: if key > len(self.keys) - 1: raise Exception("Element %i doe...
from __future__ import print_function, division import numpy as np class odict(object): def __init__(self): self.keys = [] self.values = [] def __setitem__(self, key, value): if type(key) == int: if key > len(self.keys) - 1: raise Exception("Element %i doe...
mit
Python
7bfa9d24f7af811746bbb0336b5e75a592cff186
Fix KeyError: 'version' due to 403 Forbidden error
jpdoria/aws_eis
aws_eis/lib/checks.py
aws_eis/lib/checks.py
import json import sys import requests def py_version(): if sys.version_info < (3, 0, 0): print(sys.version) print('You must use Python 3.x to run this application.') sys.exit(1) def get_version(endpoint): r = requests.get('https://{}'.format(endpoint)) es_version = json.loads(r....
import json import sys import requests def py_version(): if sys.version_info < (3, 0, 0): print(sys.version) print('You must use Python 3.x to run this application.') sys.exit(1) def get_version(endpoint): r = requests.get('https://{}'.format(endpoint)) es_version = json.loads(r....
mit
Python
5e71f486a06165d499334e9616e5f29ec411940f
make all arguments optional for get_demos_path (#138)
mila-iqia/babyai
babyai/utils/demos.py
babyai/utils/demos.py
import os import pickle from .. import utils def get_demos_path(demos=None, env=None, origin=None, valid=False): valid_suff = '_valid' if valid else '' demos_path = (demos + valid_suff if demos else env + "_" + origin + valid_suff) + '.pkl' return os.path.join(utils.sto...
import os import pickle from .. import utils def get_demos_path(demos, env, origin, valid): valid_suff = '_valid' if valid else '' demos_path = (demos + valid_suff if demos else env + "_" + origin + valid_suff) + '.pkl' return os.path.join(utils.storage_dir(), 'demos', ...
bsd-3-clause
Python
cd006f8d3885005e867255e63819fc8a5c7430bf
Add getter for text widget
BrickText/BrickText
redactor/TextEditor.py
redactor/TextEditor.py
from tkinter import * class TextEditor(): def __init__(self): self.root = Tk() self.root.wm_title("BrickText") self.text_panel = Text(self.root) self.text_panel.pack(fill=BOTH, expand=YES) def start(self): self.root.mainloop() def get_root(self): return se...
from tkinter import * class TextEditor(): def __init__(self): self.root = Tk() self.root.wm_title("BrickText") self.text_panel = Text(self.root) self.text_panel.pack(fill=BOTH, expand=YES) def start(self): self.root.mainloop() def get_root(self): return se...
mit
Python
61108f794b53048aae3fc9840abf34a4150bb83a
Combine tests into one
CubicComet/exercism-python-solutions
leap/leap.py
leap/leap.py
def is_leap_year(y): return (y % 4 == 0) and (y % 100 != 0 or y % 400 == 0)
def is_leap_year(y): if y % 400 == 0: return True elif y % 100 == 0: return False elif y % 4 == 0: return True else: return False
agpl-3.0
Python
7c02a79a5eb2dd6b9b49b2eefbdde1064a73de17
Fix exception handling in TagField
RedPanal/redpanal,RedPanal/redpanal,RedPanal/redpanal
redpanal/core/forms.py
redpanal/core/forms.py
from django import forms from django.utils.translation import ugettext as _ from taggit.utils import parse_tags, edit_string_for_tags class TagParseError(Exception): pass def tags_to_editable_string(tags): return u' '.join([u"#%s" % t for t in tags]) def parse_tags(string): tags = string.split() for...
from django import forms from django.utils.translation import ugettext as _ from taggit.utils import parse_tags, edit_string_for_tags class TagParseError(Exception): pass def tags_to_editable_string(tags): return u' '.join([u"#%s" % t for t in tags]) def parse_tags(string): tags = string.split() for...
agpl-3.0
Python
f2c0c1ab83dbc2344612e4cbf66d39acefa2fd4f
define encoding
jjangsangy/py-translate,jjangsangy/py-translate
translate/tests/test_translator.py
translate/tests/test_translator.py
# -*- coding: utf-8 -*- try: import unittest2 as unittest except ImportError: import unittest from nose.tools import * from translate import translator class TestTranslator(unittest.TestCase): def typeassert(self): instance = translator('en', 'en', str()) self.assertIsInstance(instance, ...
try: import unittest2 as unittest except ImportError: import unittest from nose.tools import * from translate import translator class TestTranslator(unittest.TestCase): def typeassert(self): instance = translator('en', 'en', str()) self.assertIsInstance(instance, dict) self.asser...
apache-2.0
Python
ae11251f7669e4ddde6f0491ff1fe0afdfd54a7a
Change 'language' to 'syntax', that is more precise terminology.
SublimeLinter/SublimeLinter-jsl
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Aparajita Fishman # Copyright (c) 2013 Aparajita Fishman # # Project: https://github.com/SublimeLinter/SublimeLinter-contrib-jsl # License: MIT # """This module exports the JSL plugin linter class.""" from SublimeLi...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Aparajita Fishman # Copyright (c) 2013 Aparajita Fishman # # Project: https://github.com/SublimeLinter/SublimeLinter-contrib-jsl # License: MIT # """This module exports the JSL plugin linter class.""" from SublimeLi...
mit
Python
ce5d02adc02b421ee2a16e988fa9fa122fc872a8
Update run_init_temp.py
cornell-zhang/datuner,cornell-zhang/datuner,cornell-zhang/datuner,cornell-zhang/datuner,cornell-zhang/datuner,cornell-zhang/datuner
scripts/tests/run_init_temp.py
scripts/tests/run_init_temp.py
import os import sys pwd =os.getcwd() tpath = "vtr_flow_holder" design = "diffeq1" wrksp = "workspace_holder" proc_num = 1 datpath = sys.path[0] srcFile = datpath+"/run_DATuner.py" rep_cmd = "sed -e \"s:TOOL_PATH:"+tpath+":g\" -e \"s:DESIGN_NAME:"+design+":g\" -e \"s:WORKSPACE:"+wrksp+":g\" -e \"s:DATuner_PATH:"+dat...
import os import sys pwd =os.getcwd() tpath = vtr_flow_holder design = diffeq1 wrksp = workspace_holder proc_num = 1 datpath = sys.path[0] srcFile = datpath+"/run_DATuner.py" rep_cmd = "sed -e \"s:TOOL_PATH:"+tpath+":g\" -e \"s:DESIGN_NAME:"+design+":g\" -e \"s:WORKSPACE:"+wrksp+":g\" -e \"s:DATuner_PATH:"+datpath+"...
bsd-3-clause
Python
4a298d076546df563239861689dba46606d4f6f0
bump version: 0.2.8
BenevolentAI/guacamol
guacamol/__init__.py
guacamol/__init__.py
__version__ = "0.2.8"
__version__ = "0.2.7"
mit
Python
be5772a6d64a0ceeb1c5748364ca10f376d2fe51
Add customizable SHOP_CHARGE_CURRENCY setting
BCGamer/cartridge-stripe,BCGamer/cartridge-stripe
cartridge_stripe/__init__.py
cartridge_stripe/__init__.py
import logging import cartridge import stripe from django.utils.translation import ugettext as _ from django.conf import settings logger = logging.getLogger(__name__) CURRENCY = getattr(settings, 'SHOP_CHARGE_CURRENCY', 'usd') class CheckoutError(Exception): """ Should be raised in billing/shipping and pay...
import logging import cartridge import stripe from django.utils.translation import ugettext as _ logger = logging.getLogger(__name__) class CheckoutError(Exception): """ Should be raised in billing/shipping and payment handlers for cases such as an invalid shipping address or an unsuccessful payment...
mit
Python
8b889c10abf043f6612409973458e8a0f0ed952e
Initialize the log counter to 0xFF
japesinator/Bad-Crypto,japesinator/Bad-Crypto
bonus_level.py
bonus_level.py
#!/usr/bin/env python from time import sleep # Usage: ./bonus_level.py, then input your plaintext enclosed by quotes # Note: I haven't made a ciphertext for this because the attack on it depends # a lot on the machine it was implemented on secret = input("Please enter your plaintext: ") for char in secret: log_c...
#!/usr/bin/env python from time import sleep # Usage: ./bonus_level.py, then input your plaintext enclosed by quotes # Note: I haven't made a ciphertext for this because the attack on it depends # a lot on the machine it was implemented on secret = input("Please enter your plaintext: ") for char in secret: for i...
mit
Python
64c8fd3fa18dd6644a67cbd9e9aa5f20eb5e85a7
Add krelloptions variant that is used to turn on a configuration option to build the thread safe lightweight libraries.
EmreAtes/spack,krafczyk/spack,matthiasdiener/spack,matthiasdiener/spack,tmerrick1/spack,krafczyk/spack,LLNL/spack,matthiasdiener/spack,EmreAtes/spack,lgarren/spack,iulian787/spack,EmreAtes/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,skosukhin/spack,skosukhin/spack,mfherbst/spack,EmreAtes/spack,TheTimmy/spa...
var/spack/packages/mrnet/package.py
var/spack/packages/mrnet/package.py
from spack import * class Mrnet(Package): """The MRNet Multi-Cast Reduction Network.""" homepage = "http://paradyn.org/mrnet" url = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz" version('4.0.0', 'd00301c078cba57ef68613be32ceea2f') version('4.1.0', '5a248298b395b329e2371bf25366115c'...
from spack import * class Mrnet(Package): """The MRNet Multi-Cast Reduction Network.""" homepage = "http://paradyn.org/mrnet" url = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz" version('4.0.0', 'd00301c078cba57ef68613be32ceea2f') version('4.1.0', '5a248298b395b329e2371bf25366115c'...
lgpl-2.1
Python
1842cac64940a43a43399e6e942c59265b03c1a7
Add `viewable` field to Concept preserialize template
chop-dbhi/serrano,rv816/serrano_night,rv816/serrano_night,chop-dbhi/serrano
serrano/resources/templates.py
serrano/resources/templates.py
Category = { 'fields': [':pk', 'name', 'order', 'parent_id'], 'allow_missing': True, } BriefField = { 'fields': [':pk', 'name', 'description'], 'allow_missing': True, } Field = { 'fields': [ ':pk', 'name', 'plural_name', 'description', 'keywords', 'app_name', 'model_name', 'field_n...
Category = { 'fields': [':pk', 'name', 'order', 'parent_id'], 'allow_missing': True, } BriefField = { 'fields': [':pk', 'name', 'description'], 'allow_missing': True, } Field = { 'fields': [ ':pk', 'name', 'plural_name', 'description', 'keywords', 'app_name', 'model_name', 'field_n...
bsd-2-clause
Python
bbd0c68669ffa0fd2d01ac8f86302673ed7b710e
Add default configuration for mongo
Widukind/dlstats,MichelJuillard/dlstats,mmalter/dlstats,mmalter/dlstats,mmalter/dlstats,MichelJuillard/dlstats,Widukind/dlstats,MichelJuillard/dlstats
dlstats/configuration.py
dlstats/configuration.py
import configobj import validate import os def _get_filename(): """Return the configuration file path.""" appname = 'dlstats' if os.name == 'posix': if "HOME" in os.environ: if os.path.isfile(os.environ["HOME"]+'/.'+appname+'/main.conf'): return os.environ["HOME"]+'/.'+a...
import configobj import validate import os def _get_filename(): """Return the configuration file path.""" appname = 'dlstats' if os.name == 'posix': if "HOME" in os.environ: if os.path.isfile(os.environ["HOME"]+'/.'+appname+'/main.conf'): return os.environ["HOME"]+'/.'+a...
agpl-3.0
Python