commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
2e361627ca94b3a3b1cdd9583d22ca8ff81a0591
rpn/util.py
rpn/util.py
from functools import wraps import subprocess _SELECTIONS = { '+': 'clipboard', '*': 'primary', } def _store_selection(data, selection): with subprocess.Popen(['xclip', '-selection', selection], stdin=subprocess.PIPE) as xclip: xclip.stdin.wri...
from functools import wraps import subprocess _SELECTIONS = { '+': 'clipboard', '*': 'primary', } def _store_selection(data, selection): with subprocess.Popen(['xclip', '-selection', selection], stdin=subprocess.PIPE) as xclip: xclip.stdin.wri...
Fix typo resulting in NameError
Fix typo resulting in NameError
Python
isc
pilona/RPN,pilona/RPN
de7e36f6b83c6d41c46b222ea94eff3b6f1909e6
ser2file/ser2file.py
ser2file/ser2file.py
#!/usr/bin/env python3 import sys import serial import datetime if __name__=='__main__': try: ser = serial.Serial('COM1', 115200, timeout=1) print("opened " + ser.portstr) except serial.SerialException: print('could not open port') sys.exit(1) pass f = open(datetime.datetime.now().strftime("%y-%m-%d_%H-%M...
#!/usr/bin/env python3 import sys import serial import datetime if __name__=='__main__': try: ser = serial.Serial('COM1', 115200, timeout=1) print("opened " + ser.portstr) except serial.SerialException: print('could not open port') sys.exit(1) pass f = open(datetime.datetime.now().strftime("%y-%m-%d_%H-%M...
Use TAB instead of ;
Use TAB instead of ;
Python
mit
Make-O-Matic/experiments
a15bbbd22d8fa32abd7b10179a3289f1ec396c3a
tests/test_ultrametric.py
tests/test_ultrametric.py
from viridis import tree from six.moves import range import pytest @pytest.fixture def base_tree(): t = tree.Ultrametric(list(range(6))) t.merge(0, 1, 0.1) t.merge(6, 2, 0.2) t.merge(3, 4, 0.3) t.merge(8, 5, 0.4) t.merge(7, 8, 0.5) return t def test_split(base_tree): t = base_tree ...
from viridis import tree from six.moves import range import pytest @pytest.fixture def base_tree(): t = tree.Ultrametric(list(range(6))) t.merge(0, 1, 0.1) t.merge(6, 2, 0.2) t.merge(3, 4, 0.3) t.merge(8, 5, 0.4) t.merge(7, 8, 0.5) return t def test_split(base_tree): t = base_tree ...
Use num_leaves function in tests
Use num_leaves function in tests
Python
mit
jni/viridis
024b862bdd4ae3bf4c3058ef32b6016b280a4cf6
tests/web/test_request.py
tests/web/test_request.py
import unittest from performance.web import Request, RequestTypeError, RequestTimeError class RequestTestCase(unittest.TestCase): def setUp(self): self.url = 'http://www.google.com' def test_constants(self): self.assertEqual('get', Request.GET) self.assertEqual('post', Request.POST) ...
import unittest from performance.web import Request, RequestTypeError, RequestTimeError class RequestTestCase(unittest.TestCase): def setUp(self): self.host = 'http://www.google.com' def test_constants(self): self.assertEqual('get', Request.GET) self.assertEqual('post', Request.POST) ...
Remove tests for response_time, update variable names
Remove tests for response_time, update variable names
Python
mit
BakeCode/performance-testing,BakeCode/performance-testing
8b351036f6431bd760565b23d9e887e7d8a73840
mysql_statsd/thread_manager.py
mysql_statsd/thread_manager.py
import Queue import signal import threading import time class ThreadManager(): """Knows how to manage dem threads""" quit = False quitting = False threads = [] def __init__(self, queue=Queue.Queue(), threads=[], config={}): """Program entry point""" # Set up queue self.qu...
import Queue import signal import threading import time class ThreadManager(): """Knows how to manage dem threads""" quit = False quitting = False threads = [] def __init__(self, threads=[]): """Program entry point""" self.threads = threads self.register_signal_handlers() ...
Remove config handling from threadmanager (was unused)
Remove config handling from threadmanager (was unused)
Python
bsd-3-clause
spilgames/mysql-statsd,medvedik/mysql-statsd,art-spilgames/mysql-statsd,db-art/mysql-statsd,medvedik/mysql-statsd,bnkr/mysql-statsd
d37555f71d61aa2f40b6d959833d7dd08bc269d4
tmserver/jtui/__init__.py
tmserver/jtui/__init__.py
import logging from flask import Blueprint, current_app, jsonify from tmserver.error import register_http_error_classes jtui = Blueprint('jtui', __name__) logger = logging.getLogger(__name__) def register_error(cls): """Decorator to register exception classes as errors that can be serialized to JSON""" ...
import logging from flask import Blueprint jtui = Blueprint('jtui', __name__) logger = logging.getLogger(__name__) import tmserver.jtui.api
Remove jtui blueprint specific error handler
Remove jtui blueprint specific error handler
Python
agpl-3.0
TissueMAPS/TmServer
d17dc6285d2eab6662230313ed4ff8fa63ab2994
demetsiiify/blueprints/__init__.py
demetsiiify/blueprints/__init__.py
from .api import api from .auth import auth from .iiif import iiif from .view import view __all__ = [api, auth, iiif, view]
from .api import api from .iiif import iiif from .view import view __all__ = [api, iiif, view]
Fix accidental import from other branch
Fix accidental import from other branch
Python
agpl-3.0
jbaiter/demetsiiify,jbaiter/demetsiiify,jbaiter/demetsiiify
b167b1d9ff4278d142c1eeffc5ef443b11459cd9
lamson-server/config/settings.py
lamson-server/config/settings.py
# This file contains python variables that configure Lamson for email processing. import logging import pymongo hostnames = ['kasm.clayadavis.net', 'openkasm.com', 'remixmail.com'] # You may add additional parameters such as `username' and `password' if your # relay server requires authentication, `starttls' (boolean)...
# This file contains python variables that configure Lamson for email processing. import logging import pymongo hostnames = ['kasm.clayadavis.net', 'openkasm.com', #'remixmail.com', ] # You may add additional parameters such as `username' and `password' if your # relay server req...
Remove remixmail from hosts for now
Remove remixmail from hosts for now
Python
mit
clayadavis/OpenKasm,clayadavis/OpenKasm
d866dc0f6a33925e2a8cd910a8b6226f8b7ed50d
pytablereader/__init__.py
pytablereader/__init__.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import from tabledata import ( DataError, EmptyDataError, InvalidDataError, InvalidHeaderNameError, InvalidTableNameError, ) from .__version__ import __author__, __copyright_...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import from tabledata import DataError, InvalidHeaderNameError, InvalidTableNameError from .__version__ import __author__, __copyright__, __email__, __license__, __version__ from ._constant impo...
Remove an import that deprecated and unused
Remove an import that deprecated and unused
Python
mit
thombashi/pytablereader,thombashi/pytablereader,thombashi/pytablereader
5eb7558873a62739edcc5c633561c45e9781384e
migrations/versions/1d91199c02c5_.py
migrations/versions/1d91199c02c5_.py
"""empty message Revision ID: 1d91199c02c5 Revises: Create Date: 2017-05-01 23:02:26.034481 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '1d91199c02c5' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gener...
"""Add user banned column Revision ID: 1d91199c02c5 Revises: Create Date: 2017-05-01 23:02:26.034481 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '1d91199c02c5' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands a...
Add message to user ban migration
Add message to user ban migration
Python
agpl-3.0
CMU-Senate/tcc-room-reservation,CMU-Senate/tcc-room-reservation,CMU-Senate/tcc-room-reservation
699a2d8d97d8c526f9fb269245d5fb593d47d3ca
rasa/nlu/tokenizers/__init__.py
rasa/nlu/tokenizers/__init__.py
class Tokenizer: pass class Token: def __init__(self, text, offset, data=None): self.offset = offset self.text = text self.end = offset + len(text) self.data = data if data else {} def set(self, prop, info): self.data[prop] = info def get(self, prop, default=N...
import functools class Tokenizer: pass @functools.total_ordering class Token: def __init__(self, text, offset, data=None): self.offset = offset self.text = text self.end = offset + len(text) self.data = data if data else {} def set(self, prop, info): self.data[pr...
Fix to make sanitize_examples() be able to sort tokens
Fix to make sanitize_examples() be able to sort tokens
Python
apache-2.0
RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu
75402ed564a0e37732bceb2b44261630e69bc250
src/smsfly/util.py
src/smsfly/util.py
from functools import wraps from bs4 import BeautifulSoup as bs from errors import XMLError, PhoneError, StartTimeError, EndTimeError, LifetimeError, SpeedError, AlphanameError, TextError, InsufficientFundsError ERROR_MAP = { 'XMLERROR': XMLError, 'ERRPHONES': PhoneError, 'ERRSTARTTIME': StartTime...
from functools import wraps from bs4 import BeautifulSoup as bs from .errors import ( XMLError, PhoneError, StartTimeError, EndTimeError, LifetimeError, SpeedError, AlphanameError, TextError, InsufficientFundsError ) ERROR_MAP = { 'XMLERROR': XMLError, 'ERRPHONES': PhoneError, 'ERRSTARTTIME':...
Fix import of error classes
Fix import of error classes
Python
mit
wk-tech/python-smsfly
4eade25270273d4a779034fef3818f15066ee647
src/streaming-programs/car-average-speeds.py
src/streaming-programs/car-average-speeds.py
#!/usr/bin/python import sys import json # Count average speeds for links def main(locationdata_dictionary_file): locationdata = {} with open(locationdata_dictionary_file, "r") as dictionary_file: locationdata = json.load(dictionary_file) for input_line in sys.stdin: data = json.loads(in...
#!/usr/bin/python import sys import json # Count average speeds for links def main(locationdata_dictionary_file): locationdata = {} with open(locationdata_dictionary_file, "r") as dictionary_file: locationdata = json.load(dictionary_file) for input_line in sys.stdin: data = json.loads(in...
Test average speed calculation by tracking sum and count separately
Test average speed calculation by tracking sum and count separately
Python
mit
gofore/aws-emr,gofore/aws-emr,gofore/aws-emr,gofore/aws-emr
fa3605047619495be3ddc3de8a3c3579d57deca4
djedi/tests/test_admin.py
djedi/tests/test_admin.py
from django.core.urlresolvers import reverse from djedi.tests.base import ClientTest class PanelTest(ClientTest): def test_admin_panel(self): url = reverse('index') response = self.client.get(url) self.assertIn(u'Djedi Test', response.content) self.assertIn(u'window.DJEDI_NODES', ...
from django.core.urlresolvers import reverse from django.utils.encoding import smart_unicode from djedi.tests.base import ClientTest class PanelTest(ClientTest): def test_embed(self): url = reverse('index') response = self.client.get(url) self.assertIn(u'Djedi Test', response.content) ...
Add tests for rendering cms admin
Add tests for rendering cms admin
Python
bsd-3-clause
andreif/djedi-cms,andreif/djedi-cms,5monkeys/djedi-cms,andreif/djedi-cms,joar/djedi-cms,joar/djedi-cms,5monkeys/djedi-cms,5monkeys/djedi-cms,joar/djedi-cms
583e3bc4ba82191e34b715485650248398afc2b6
src/endpoints/base.py
src/endpoints/base.py
class Base: def __init__(self, client): self.client = client
class Base: def __init__(self, client): self.client = client def build_query(self, query): if query is None: query_string = '' else: query_string = '?' for key, value in query.items(): if not query_string.endswith('?'): query_string = query_string + '&' query_string = query_string + key ...
Add method to build a query string to every class
Add method to build a query string to every class
Python
mit
Vaelor/python-mattermost-driver
140e75fb3d96de3784c4ccc7272bbfa0e6b67d39
pinax/invitations/__init__.py
pinax/invitations/__init__.py
import pkg_resources __version__ = pkg_resources.get_distribution("pinax-invitations").version
import pkg_resources __version__ = pkg_resources.get_distribution("pinax-invitations").version default_app_config = "pinax.invitations.apps.AppConfig"
Set default_app_config to point to the correct AppConfig
Set default_app_config to point to the correct AppConfig
Python
unknown
pinax/pinax-invitations,jacobwegner/pinax-invitations,eldarion/kaleo,rizumu/pinax-invitations
9fe573614e2f3ca9a6e738afb7f1af84b541092c
invertedindex.py
invertedindex.py
#!/usr/bin/env python3 # -*- coding: utf8 -*- # import class InvertedIndex: def __init__(self): self.index = dict() def add_mail(self, mail): for key in ["simple_terms_body", "complexe_terms_body"]: for terms in mail[key]: if terms in self.index.keys(): ...
#!/usr/bin/env python3 # -*- coding: utf8 -*- # import class InvertedIndex: def __init__(self): self.index = dict() def add_mail(self, mail): for key in ["simple_terms_body", "complexe_terms_body"]: for terms in mail[key]: if terms in self.index.keys(): ...
Add some access function to inverted index
Add some access function to inverted index
Python
mit
Nedgang/adt_project
d86fc7edd64eba36bf91fc9ad718bb77c7e2b862
yubico_client/__init__.py
yubico_client/__init__.py
__version__ = (1, 6, 3)
__version__ = (1, 6, 3) __all__ = [ 'Yubico' ] from yubico_client.yubico import Yubico
Allow users to directly do from yubico_client import Yubico.
Allow users to directly do from yubico_client import Yubico.
Python
bsd-3-clause
Kami/python-yubico-client
bf41f23d71491050dc79a2975b26ffe210b45505
examples/test_contains_selector.py
examples/test_contains_selector.py
from seleniumbase import BaseCase class ContainsSelectorTests(BaseCase): def test_contains_selector(self): self.open("https://xkcd.com/2207/") self.assert_text("Math Work", "#ctitle") self.click('a:contains("Next")') self.assert_text("Drone Fishing", "#ctitle")
from seleniumbase import BaseCase class ContainsSelectorTests(BaseCase): def test_contains_selector(self): self.open("https://xkcd.com/2207/") self.assert_element('div.box div:contains("Math Work")') self.click('a:contains("Next")') self.assert_element('div div:contains("Dr...
Update an example that uses the ":contains()" selector
Update an example that uses the ":contains()" selector
Python
mit
seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase
517c8978c33d7e9f0251985f2ca39b6f2514ae9e
hack/boxee/skin/boxee/720p/scripts/boxeehack_clear_cache.py
hack/boxee/skin/boxee/720p/scripts/boxeehack_clear_cache.py
import os,mc import xbmc, xbmcgui def fanart_function(): if mc.ShowDialogConfirm("Clear fanart cache", "Are you sure you want to clear the fanart cache?", "Cancel", "OK"): pass def thumbnail_function(): if mc.ShowDialogConfirm("Clear thumbnail cache", "Are you sure you want to clear the thumbnail cach...
import os,mc import xbmc, xbmcgui def fanart_function(): if mc.ShowDialogConfirm("Clear fanart cache", "Are you sure you want to clear the fanart cache?", "Cancel", "OK"): pass def thumbnail_function(): if mc.ShowDialogConfirm("Clear thumbnail cache", "Are you sure you want to clear the thumbnail cach...
Correct clearing of fanart cache
Correct clearing of fanart cache
Python
mit
cigamit/boxeehack,cigamit/boxeehack,vLBrian/boxeehack-cigamit,vLBrian/boxeehack-cigamit
a15813399992fb8bbf951854a218e30e4cddd717
prime-factors/prime_factors.py
prime-factors/prime_factors.py
# File: prime_factors.py # Purpose: Compute the prime factors of a given natural number. # Programmer: Amal Shehu # Course: Exercism # Date: Monday 26 September 2016, 12:05 AM def prime_factors(number): factors = [] if number > 1: for num in range(2, number): if (nu...
# File: prime_factors.py # Purpose: Compute the prime factors of a given natural number. # Programmer: Amal Shehu # Course: Exercism # Date: Monday 26 September 2016, 12:05 AM def prime_factors(number, n=2, factors=None): if factors is None: factors = [] for num in range(n, num...
Add two more arguments with function
Add two more arguments with function
Python
mit
amalshehu/exercism-python
9311cbe8ed7a434adb46340640895b48e8cc4027
examples/pi-montecarlo/pi_distarray.py
examples/pi-montecarlo/pi_distarray.py
""" Estimate pi using a Monte Carlo method with distarray. Usage: $ python pi_distarray.py <number of points> """ import sys from distarray.client import RandomModule, Context from util import timer context = Context() random = RandomModule(context) @timer def calc_pi(n): """Estimate pi using distributed Num...
""" Estimate pi using a Monte Carlo method with distarray. Usage: $ python pi_distarray.py <number of points> """ import sys from distarray.random import Random from distarray.client import Context from util import timer context = Context() random = Random(context) @timer def calc_pi(n): """Estimate pi usi...
Change to reflect recent API changes.
Change to reflect recent API changes.
Python
bsd-3-clause
RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray
108768166c660b0ba38da07b21f687d5813734f2
jsonconfigparser/__init__.py
jsonconfigparser/__init__.py
from .configparser import JSONConfigParser from .utils import convert_input, dict_, list_, fieldtypes from .commands import view, add_file, add_field, delete, edit version = '0.0.1'
from .configparser import JSONConfigParser from .utils import dict_, list_, fieldtypes, command, call from .commands import add_file, add_field, view, edit, delete, append version = '0.0.1'
Make sure correct functions are imported
Make sure correct functions are imported
Python
mit
justanr/JSONConfigParser
67186bff0a37d941e5cfb3420dbd1c0ac010c7b6
gconvert.py
gconvert.py
#!/usr/bin/env python import json import re from urllib import urlopen api = 'http://www.google.com/ig/calculator?hl=en&q={}{}=?{}' def convert(value, src_units, dst_units): url = api.format(value, src_units, dst_units) data = urlopen(url).read().decode('utf-8', 'ignore') # Convert to valid JSON: {foo:...
#!/usr/bin/env python import json import re from urllib import urlopen api = 'http://www.google.com/ig/calculator?hl=en&q={}{}=?{}' def convert(value, src_units, dst_units): url = api.format(value, src_units, dst_units) # read and preprocess the response resp = urlopen(url).read() resp = resp.repl...
Handle scientific notation in response
Handle scientific notation in response
Python
mit
jason0x43/jc-units
e8c9762cbfac6dbb4dab252bd9cdf0a4e01f3a36
scipy/ndimage/tests/test_regression.py
scipy/ndimage/tests/test_regression.py
import numpy as np from numpy.testing import * import scipy.ndimage as ndimage def test_byte_order_median(): """Regression test for #413: median_filter does not handle bytes orders.""" a = np.arange(9, dtype='<f4').reshape(3, 3) ref = ndimage.filters.median_filter(a,(3, 3)) b = np.arange(9, dtype='>f4...
import numpy as np from numpy.testing import * import scipy.ndimage as ndimage def test_byte_order_median(): """Regression test for #413: median_filter does not handle bytes orders.""" a = np.arange(9, dtype='<f4').reshape(3, 3) ref = ndimage.filters.median_filter(a,(3, 3)) b = np.arange(9, dtype='>f4...
Use run_module_suite instead of deprecated NumpyTest.
Use run_module_suite instead of deprecated NumpyTest. git-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@5310 d6536bca-fef9-0310-8506-e4c0a848fbcf
Python
bsd-3-clause
jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,scipy/scipy-svn,lesserwhirls/scipy-cwt,scipy/scipy-svn,scipy/scipy-svn,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,scipy/scipy-svn
bdc8ac1db8681dd45d4498ccd9735be5b1cdb1b7
hash_table.py
hash_table.py
#!/usr/bin/env python '''Implementation of a simple hash table. The table has `hash`, `get` and `set` methods. The hash function uses a very basic hash algorithm to insert the value into the table. ''' class HashItem(object): def __init__(self, key, value): self.key = key self.value = value cla...
#!/usr/bin/env python '''Implementation of a simple hash table. The table has `hash`, `get` and `set` methods. The hash function uses a very basic hash algorithm to insert the value into the table. ''' class HashItem(object): def __init__(self, key, value): self.key = key self.value = value cla...
Add handling for duplicate keys in set; fix bug in hash function (was calling ord on key instead of character); change name of class to HashTable from Hash
Add handling for duplicate keys in set; fix bug in hash function (was calling ord on key instead of character); change name of class to HashTable from Hash
Python
mit
jwarren116/data-structures-deux
7dec24bb55b7c33133f62f8f124fde0948d417a8
snippet/example/python/utils.py
snippet/example/python/utils.py
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, unicode_literals, print_function, division import sys if sys.version_info[0] < 3: PY3, Unicode, Bytes = False, unicode, str else: PY3, Unicode, Bytes = True, str, bytes to_bytes = lambda v, e="utf-8": v.encode(e) if isinstance(v...
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, unicode_literals, print_function, division import sys if sys.version_info[0] < 3: PY3, Unicode, Bytes = False, unicode, str else: PY3, Unicode, Bytes = True, str, bytes to_bytes = lambda v, e="utf-8": v.encode(e) if isinstance(v...
Add the python example ObjectDict
Add the python example ObjectDict
Python
mit
xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet
c5c77ba407e195e3cc98bb75a961fe112736fca6
homebrew/command_line.py
homebrew/command_line.py
# -*- coding: utf-8 -*- from .homebrew import HomeBrew def main(): HomeBrew().log_info()
# -*- coding: utf-8 -*- import argparse from .homebrew import HomeBrew def main(): argparse.ArgumentParser(description='Get homebrew info').parse_args() HomeBrew().log_info()
Add argparse for info on hb command
Add argparse for info on hb command
Python
isc
igroen/homebrew
207a1a8fad79ccfa0c244aa0a1d0d25fee87c438
testfixtures/tests/test_docs.py
testfixtures/tests/test_docs.py
# Copyright (c) 2009-2012 Simplistix Ltd # # See license.txt for more details. from doctest import REPORT_NDIFF,ELLIPSIS from glob import glob from manuel import doctest, capture from manuel.testing import TestSuite from nose.plugins.skip import SkipTest from os.path import dirname, join, pardir import os from . imp...
# Copyright (c) 2009-2012 Simplistix Ltd # # See license.txt for more details. from doctest import REPORT_NDIFF,ELLIPSIS from glob import glob from manuel import doctest, capture from manuel.testing import TestSuite from nose.plugins.skip import SkipTest from os.path import dirname, join, pardir import os from . imp...
Use a WORKSPACE to make life easier in Jenkins.
Use a WORKSPACE to make life easier in Jenkins.
Python
mit
nebulans/testfixtures,Simplistix/testfixtures
6a9fb4f8ad3c8fda2b12688be5058e95d5e995e7
tests/test_main.py
tests/test_main.py
import os def test_qt_api(): """ If QT_API is specified, we check that the correct Qt wrapper was used """ from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets QT_API = os.environ.get('QT_API', None) if QT_API == 'pyside': import PySide assert QtCore.QEvent is PySid...
import os from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets def assert_pyside(): import PySide assert QtCore.QEvent is PySide.QtCore.QEvent assert QtGui.QPainter is PySide.QtGui.QPainter assert QtWidgets.QWidget is PySide.QtGui.QWidget assert QtWebEngineWidgets.QWebEnginePage is PySid...
Check that the priority order is respected if QT_API or USE_QT_API are not specified.
Check that the priority order is respected if QT_API or USE_QT_API are not specified.
Python
mit
goanpeca/qtpy,davvid/qtpy,davvid/qtpy,goanpeca/qtpy,spyder-ide/qtpy
66420e5b72f58652aca1cf0353897bd43ee57aef
nipype/testing/__init__.py
nipype/testing/__init__.py
"""Simple utility to pull in all the testing functions we're likely to use. """ import numpy as np from distutils.version import LooseVersion from nose.tools import (assert_true, assert_false, assert_not_equal, assert_raises) from nose import SkipTest if LooseVersion(np.__version__) >= '1.2':...
"""Simple utility to pull in all the testing functions we're likely to use. """ import numpy as np from distutils.version import LooseVersion from nose.tools import (assert_true, assert_false, assert_not_equal, assert_raises) from nose import SkipTest, with_setup if LooseVersion(np.__version_...
Add import of with_setup that got lost in the numpy testing merge.
Add import of with_setup that got lost in the numpy testing merge. git-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@1236 ead46cd0-7350-4e37-8683-fc4c6f79bf00
Python
bsd-3-clause
carolFrohlich/nipype,FCP-INDI/nipype,gerddie/nipype,JohnGriffiths/nipype,FCP-INDI/nipype,Leoniela/nipype,mick-d/nipype_source,fprados/nipype,FredLoney/nipype,christianbrodbeck/nipype,carolFrohlich/nipype,carolFrohlich/nipype,wanderine/nipype,wanderine/nipype,gerddie/nipype,wanderine/nipype,mick-d/nipype,sgiavasis/nipyp...
45325a43cf4525ef39afec86c03451525f907e92
hiro/utils.py
hiro/utils.py
""" random utility functions """ import datetime import functools import time from .errors import InvalidTypeError def timedelta_to_seconds(delta): """ converts a timedelta object to seconds """ seconds = delta.microseconds seconds += (delta.seconds + delta.days * 24 * 3600) * 10 ** 6 return f...
""" random utility functions """ import calendar import datetime import functools from .errors import InvalidTypeError def timedelta_to_seconds(delta): """ converts a timedelta object to seconds """ seconds = delta.microseconds seconds += (delta.seconds + delta.days * 24 * 3600) * 10 ** 6 retu...
Fix TZ-dependent return values from time_in_seconds()
Fix TZ-dependent return values from time_in_seconds() time.mktime assumes that the time tuple is in local time, rather than UTC. Use calendar.timegm instead for consistency.
Python
mit
alisaifee/hiro,alisaifee/hiro
4ca420de76b2c385b07f46681a779b160f2af62f
mpl_style_gallery/__main__.py
mpl_style_gallery/__main__.py
from argparse import ArgumentParser from . import app from . import build parser = ArgumentParser() parser.add_argument('action', nargs='?', default='build', choices=['build', 'display']) args = parser.parse_args() if args.action == 'build': build.save_all_plots() if args.action in ('build'...
#!/usr/bin/env python """ Create Matplotlib style gallery for all Matplotlib stylesheets and display in the browser. By default, all plots are rebuilt, but this can be avoided using the `--skip-build` (`-s`) flag. """ import argparse from . import app from . import build def main(): formatter = argparse.Argument...
Clean up API for main module
Clean up API for main module
Python
bsd-3-clause
tonysyu/matplotlib-style-gallery,tonysyu/matplotlib-style-gallery,tonysyu/matplotlib-style-gallery
f0a6a091e4b2d3943cdd582d3183602ad50b9729
httpDissec.py
httpDissec.py
# sudo apt-get install python-scapy from scapy.all import * # sudo pip install scapy_http from scapy.layers import http from scapy.layers.http import HTTPResponse import sys packets = rdpcap("task07_f1.pcap") requests = [] answers = [] def has_http_header(packet): return packet.haslayer(HTTPResponse) def extra...
# sudo apt-get install python-scapy from scapy.all import * # sudo pip install scapy_http from scapy.layers import http from scapy.layers.http import HTTPResponse import sys packets = rdpcap("task07_f1.pcap") requests = [] answers = [] def has_http_header(packet): return packet.haslayer(HTTPResponse) def extra...
Set name of stored file
Set name of stored file
Python
mit
alexst07/http_dissector
b8f948b58b06648c94fb746ae519a44a7e96ae15
tools/perf/perf_tools/kraken.py
tools/perf/perf_tools/kraken.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import multi_page_benchmark from telemetry import util def _Mean(l): return float(sum(l)) / len(l) if len(l) > 0 else 0.0 class Kraken...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import multi_page_benchmark from telemetry import util def _Mean(l): return float(sum(l)) / len(l) if len(l) > 0 else 0.0 class Kraken...
Increase Kraken timeout to allow it to pass on Android.
[Telemetry] Increase Kraken timeout to allow it to pass on Android. BUG=163680 TEST=tools/perf/run_multipage_benchmarks --browser=android-content-shell kraken tools/perf/page_sets/kraken.json Review URL: https://chromiumcodereview.appspot.com/11519015 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@172374 0039...
Python
bsd-3-clause
ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,bright-sparks/chromium-spacewalk,bright-sparks/chromium-spacewalk,Chilledheart/chromium,crosswalk-project/chromium-crosswalk-efl,dushu1203/chromium.src,M4sse/chromium.src,mogoweb/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,anirudhSK/chromium,Fireblend/chro...
1819f9cb080f847ea5d669571853b28d8fc1ce1c
Script/test_screenshot.py
Script/test_screenshot.py
import unittest import os import time import shutil import filecmp import base64 import glob import json class ScreenShotTest(unittest.TestCase): def test_screenshots(self): generated_file_paths = glob.glob('build/Dev/Cpp/Test/Release/*.png') for path in generated_file_paths: name = os...
import sys import unittest import os import time import shutil import filecmp import base64 import glob import json class ScreenShotTest(unittest.TestCase): def test_screenshots(self): generated_file_paths = glob.glob('build/Dev/Cpp/Test/Release/*.png') success = True for path in generat...
Improve a script to test
Improve a script to test
Python
mit
effekseer/Effekseer,effekseer/Effekseer,effekseer/Effekseer,effekseer/Effekseer,effekseer/Effekseer,effekseer/Effekseer,effekseer/Effekseer
f86f684e659ab1e6c1c9d7c7f5f126e7814e7e8a
napper_kittydar.py
napper_kittydar.py
import sys, socket, time, logging import shlex, subprocess from hdfs import * logging.basicConfig() if len(sys.argv) < 4: print "usage: napper_kittydar <job name> <worker ID> <executable>" sys.exit(1) job_name = sys.argv[1] worker_id = int(sys.argv[2]) kittydar_path = " ".join(sys.argv[3:]) # fetch inputs from ...
import sys, socket, time, logging import shlex, subprocess from hdfs import * logging.basicConfig() if len(sys.argv) < 4: print "usage: napper_kittydar <job name> <worker ID> <executable>" sys.exit(1) job_name = sys.argv[1] worker_id = int(sys.argv[2]) kittydar_path = " ".join(sys.argv[3:]) # fetch inputs from ...
Use smaller data sets for Kittydar.
Use smaller data sets for Kittydar.
Python
mit
ms705/napper
4210d2ecb1b74c2a94c704c20eec9faaf75c5a9a
main.py
main.py
import sys,requests,configparser github_username = '' github_token = '' free_user = '' free_pass = '' def loadConfig(): config = configparser.ConfigParser() config.read('config.cfg') global github_username,github_token,free_user,free_pass try: github_username = config['Github']['username']...
import sys,requests,configparser github_username = '' github_token = '' free_user = '' free_pass = '' def loadConfig(): config = configparser.ConfigParser() config.read('config.cfg') global github_username,github_token,free_user,free_pass try: github_username = config['Github']['username'] ...
Send SMS, only if there are notifications
Send SMS, only if there are notifications
Python
mit
Walz/github-sms-notifications
4c70c4b9558a5f18d7aa32f153db4de773d66ef2
opps/images/tests/generate.py
opps/images/tests/generate.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from mock import patch from unittest import TestCase from django.template import Template, Context class TestThumborURLTTagMock(TestCase): url = 'oppsproject.org/path/image.jpg' generate_url_path = 'opps.images.templatetags.images_tags.image_url' def render(s...
#!/usr/bin/env python # -*- coding: utf-8 -*- from unittest import TestCase from django.template import Template, Context class TestImagesTags(TestCase): url = 'oppsproject.org/path/image.jpg' generate_url_path = 'opps.images.templatetags.images_tags.image_url' def render(self, arguments): source...
Add test templatetag image_url return
Add test templatetag image_url return
Python
mit
opps/opps,opps/opps,YACOWS/opps,YACOWS/opps,opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,jeanmask/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,jeanmask/opps
5f90db398bd67aec857900f5838fb6af8f3b8c23
test/test_process.py
test/test_process.py
import piquant.process as ps import os.path import time import utils SCRIPT_NAME = "./script.sh" def _write_and_run_script(dirname, command): utils.write_executable_script(dirname, SCRIPT_NAME, command) ps.run_in_directory(dirname, SCRIPT_NAME) time.sleep(0.1) def test_run_in_directory_executes_command...
import piquant.process as ps import os.path import time import utils SCRIPT_NAME = "./script.sh" def _write_and_run_script(dirname, command): utils.write_executable_script(dirname, SCRIPT_NAME, command) ps.run_in_directory(dirname, SCRIPT_NAME) time.sleep(0.1) def test_run_in_directory_executes_command...
Fix test not working on OS X.
Fix test not working on OS X. test_run_in_directory_executes_command_in_directory() didn't take into account that the directory returned by tempfile.mkdtemp() might be a symlink.
Python
mit
lweasel/piquant,lweasel/piquant
791e254c6f1efed88bdc0714ee9bb264634e74a8
transunit.py
transunit.py
#from lxml import etree as ET class TransUnit(object): "Container for XLIFF trans-unit element" def __init__(self, argument): self.origin_unit = argument self.attributes = argument.attrib self.id = '' self.ns = '' self.state = '' @staticmethod def create(xml_...
class TransUnit(object): "Container for XLIFF trans-unit element" def __init__(self, argument): self.origin_unit = argument self.attributes = argument.attrib self.id = '' self.ns = '' self.state = '' @staticmethod def create(xml_tu): tunit = TransUnit(...
Restructure transUnit class for better readibility
Restructure transUnit class for better readibility
Python
mit
jakub-szczepaniak/xliff
184c94252a909528fee2bc29c421c814bf7c49ee
django_fake_database_backends/backends/mysql/schema.py
django_fake_database_backends/backends/mysql/schema.py
from django.db.backends.mysql.schema import DatabaseSchemaEditor \ as BaseDatabaseSchemaEditor import sys class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): def execute(self, sql, params=()): sql = str(sql) if self.collect_sql: ending = "" if sql.endswith(";") else ";" ...
from django.db.backends.mysql.schema import DatabaseSchemaEditor \ as BaseDatabaseSchemaEditor import datetime import sys class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): def execute(self, sql, params=()): sql = str(sql) if self.collect_sql: ending = "" if sql.endswith(";") el...
Add quotes around date and time for python 2
Add quotes around date and time for python 2
Python
mit
David-Wobrock/django-fake-database-backends
23cd1ea939df8d78952f9b096207de0a3453529f
tests/test_create.py
tests/test_create.py
from matador.commands import CreateTicket, CreatePackage from dulwich.repo import Repo from pathlib import Path def test_add_to_git(project_repo): pass def test_create_ticket(session, project_repo): test_ticket = 'test-ticket' CreateTicket(ticket=test_ticket) ticket_folder = Path(project_repo, 'depl...
from matador.commands import CreateTicket, CreatePackage from dulwich.repo import Repo from pathlib import Path def test_add_to_git(project_repo): pass def test_create_ticket(session, project_repo): test_ticket = 'test-ticket' CreateTicket(ticket=test_ticket) ticket_folder = Path(project_repo, 'dep...
Add test for package commit
Add test for package commit
Python
mit
Empiria/matador
cd4fe7636d6d5254189de870f262cfa9c3c0461a
sirius/__init__.py
sirius/__init__.py
import os as _os from . import LI_V00 from . import TB_V01 from . import BO_V901 from . import BO_V02 from . import TS_V01 from . import SI_V12 from . import coordinate_system with open(_os.path.join(__path__[0], 'VERSION'), 'r') as _f: __version__ = _f.read().strip() __all__ = ['LI_V00', 'TB_V01', 'BO_V901', 'T...
import os as _os from . import LI_V00 from . import TB_V01 from . import BO_V02 from . import TS_V01 from . import SI_V12 from . import coordinate_system with open(_os.path.join(__path__[0], 'VERSION'), 'r') as _f: __version__ = _f.read().strip() __all__ = ['LI_V00', 'TB_V01', 'BO_V02', 'TS_V01', 'SI_V12'] li =...
Change booster default version (BO.V02)
Change booster default version (BO.V02)
Python
mit
lnls-fac/sirius
ea7177614dc2094e95aeea33f6249f14c792fee8
Discord/modules/ciphers.py
Discord/modules/ciphers.py
def encode_caesar(message, key): encoded_message = "" for character in message: if not ('a' <= character <= 'z' or 'A' <= character <= 'Z'): # .isalpha() ? encoded_message += character continue shifted = ord(character) + int(key) if character.islower() and shifted > ord('z') or character.isupper() and sh...
def encode_caesar(message, key): encoded_message = "" for character in message: if not character.isalpha() or not character.isascii(): encoded_message += character continue shifted = ord(character) + int(key) if character.islower() and shifted > ord('z') or character.isupper() and shifted > ord('Z'): ...
Use string methods for encode and decode caesar functions
[Discord] Use string methods for encode and decode caesar functions To determine (in)valid characters to encode and decode
Python
mit
Harmon758/Harmonbot,Harmon758/Harmonbot
61b4aa0d99cddf88219157eb9120032c8aaf8998
nbcollate/cli.py
nbcollate/cli.py
#!/usr/bin/env python """nbcollate combines a set of Jupyter notebooks into a single notebook. Command-line interface for nbcollate. """ import argparse import logging import os import sys import nbformat from . import nbcollate, nb_add_metadata Parser = argparse.ArgumentParser(description="Create a combined notebo...
#!/usr/bin/env python """nbcollate combines a set of Jupyter notebooks into a single notebook. Command-line interface for nbcollate. """ import argparse import logging import os import sys import nbformat from . import nbcollate, nb_add_metadata Parser = argparse.ArgumentParser(description="Create a combined notebo...
Add metadata to assignment notebook
Add metadata to assignment notebook
Python
mit
olin-computing/nbcollate
9f9d36025db87b7326b235131063ef852f43cef8
euxfel_h5tools/h5index.py
euxfel_h5tools/h5index.py
import csv import h5py import sys def hdf5_datasets(grp): """Print CSV data of all datasets in an HDF5 file. path, shape, dtype """ writer = csv.writer(sys.stdout) writer.writerow(['path', 'shape', 'dtype']) def visitor(path, item): if isinstance(item, h5py.Dataset): write...
import csv import h5py import sys def hdf5_datasets(grp): """Print CSV data of all datasets in an HDF5 file. path, shape, dtype """ all_datasets = [] def visitor(path, item): if isinstance(item, h5py.Dataset): all_datasets.append([path, item.shape, item.dtype.str]) grp.vis...
Sort datasets for index of HDF5 files
Sort datasets for index of HDF5 files
Python
bsd-3-clause
European-XFEL/h5tools-py
24a0fcbaea3bca88278f294f41e4b6abd1e82cf3
src/rocommand/__init__.py
src/rocommand/__init__.py
# __init__.py #__version__ = "0.2.1" # Initial version with installation package #__version__ = "0.2.2" # Updated README documentation for PyPI page #__version__ = "0.2.3" # Experimenting with distribution options #__version__ = "0.2.4" # Added MANIFEST.in so that data files are part of sdist #_...
# __init__.py #__version__ = "0.2.1" # Initial version with installation package #__version__ = "0.2.2" # Updated README documentation for PyPI page #__version__ = "0.2.3" # Experimenting with distribution options #__version__ = "0.2.4" # Added MANIFEST.in so that data files are part of sdist #_...
Add comments summarizing changes in this version
Add comments summarizing changes in this version
Python
mit
wf4ever/ro-manager,wf4ever/ro-manager,wf4ever/ro-manager,wf4ever/ro-manager
71ce7f3e745b9cee357f867f126dce65f6e210ac
main.py
main.py
import os import sys PROJECT_ROOT = os.path.dirname(__file__) sys.path.insert(0, os.path.join(PROJECT_ROOT, 'vroom')) import pygame import math from world import Universe # Initialize pygame pygame.init() size = width, height = 800, 600 black = 0, 0, 0 screen = pygame.display.set_mode(size) clock = pygame.time.Clo...
import os import sys PROJECT_ROOT = os.path.dirname(__file__) sys.path.insert(0, os.path.join(PROJECT_ROOT, 'vroom')) import pygame import math from world import Universe # Initialize pygame pygame.init() size = width, height = 800, 600 black = 0, 0, 0 screen = pygame.display.set_mode(size) clock = pygame.time.Clo...
Add more roads on map
Add more roads on map
Python
mit
thibault/vroom
d4d517611104a8b42ccc79a310c510edd5f0eae5
numba/cuda/simulator/cudadrv/driver.py
numba/cuda/simulator/cudadrv/driver.py
''' Most of the driver API is unsupported in the simulator, but some stubs are provided to allow tests to import correctly. ''' def device_memset(dst, val, size, stream=0): dst.view('u1')[:size].fill(bytes([val])[0]) def host_to_device(dst, src, size, stream=0): dst.view('u1')[:size] = src.view('u1')[:size]...
''' Most of the driver API is unsupported in the simulator, but some stubs are provided to allow tests to import correctly. ''' def device_memset(dst, val, size, stream=0): dst.view('u1')[:size].fill(bytes([val])[0]) def host_to_device(dst, src, size, stream=0): dst.view('u1')[:size] = src.view('u1')[:size]...
Fix simulator by adding missing USE_NV_BINDING to simulator
CUDA: Fix simulator by adding missing USE_NV_BINDING to simulator
Python
bsd-2-clause
cpcloud/numba,numba/numba,seibert/numba,IntelLabs/numba,cpcloud/numba,cpcloud/numba,seibert/numba,IntelLabs/numba,numba/numba,IntelLabs/numba,numba/numba,cpcloud/numba,seibert/numba,numba/numba,seibert/numba,IntelLabs/numba,numba/numba,cpcloud/numba,IntelLabs/numba,seibert/numba
7865d7a37562be8b0af9b3668043d8c08138814b
examples/get_each_args.py
examples/get_each_args.py
#! /usr/bin/env python # -*- coding: utf-8 -*- from clint.arguments import Args from clint.textui import puts, colored all_args = Args().grouped for item in all_args: if item is not '_': puts(colored.red("key:%s"%item)) print(all_args[item].all)
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys import os sys.path.insert(0, os.path.abspath('..')) from clint.arguments import Args from clint.textui import puts, colored all_args = Args().grouped for item in all_args: if item is not '_': puts(colored.red("key:%s"%item)) print(all_ar...
Add clint to import paths
Add clint to import paths
Python
isc
kennethreitz/clint
19ea9c2078ffb506bcab9f175e4275577901c599
bulbs/indexable/management/commands/synces.py
bulbs/indexable/management/commands/synces.py
from django.core.management.base import NoArgsCommand from elasticutils import get_es from pyelasticsearch.exceptions import IndexAlreadyExistsError, ElasticHttpError from bulbs.indexable.conf import settings from bulbs.indexable.models import polymorphic_indexable_registry class Command(NoArgsCommand): help = ...
from django.core.management.base import NoArgsCommand from elasticutils import get_es from pyelasticsearch.exceptions import IndexAlreadyExistsError, ElasticHttpError from bulbs.indexable.conf import settings from bulbs.indexable.models import polymorphic_indexable_registry class Command(NoArgsCommand): help = ...
Create index mappings independently of index, just update settings?
Create index mappings independently of index, just update settings?
Python
mit
theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,pombredanne/django-bulbs,theonion/django-bulbs,pombredanne/django-bulbs,theonion/django-bulbs
55290d237b851c9a245b710fb8b85c4d9a0b9388
addons/base_action_rule/migrations/8.0.1.0/post-migration.py
addons/base_action_rule/migrations/8.0.1.0/post-migration.py
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 HBEE (http://www.hbee.eu) # @author: Paulius Sladkevičius <paulius@hbee.eu> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 HBEE (http://www.hbee.eu) # @author: Paulius Sladkevičius <paulius@hbee.eu> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
Set action rules kind to 'on_time'
Set action rules kind to 'on_time'
Python
agpl-3.0
0k/OpenUpgrade,0k/OpenUpgrade,hifly/OpenUpgrade,Endika/OpenUpgrade,0k/OpenUpgrade,pedrobaeza/OpenUpgrade,bwrsandman/OpenUpgrade,OpenUpgrade-dev/OpenUpgrade,grap/OpenUpgrade,pedrobaeza/OpenUpgrade,grap/OpenUpgrade,OpenUpgrade/OpenUpgrade,damdam-s/OpenUpgrade,mvaled/OpenUpgrade,mvaled/OpenUpgrade,Endika/OpenUpgrade,pedro...
c78e1e7aff407355d26c12d06663a7dfb95314b1
accelerator/tests/contexts/analyze_judging_context.py
accelerator/tests/contexts/analyze_judging_context.py
from accelerator.tests.factories import ( CriterionFactory, CriterionOptionSpecFactory, ) from accelerator.tests.contexts.judge_feedback_context import ( JudgeFeedbackContext, ) from accelerator.models import ( JUDGING_FEEDBACK_STATUS_COMPLETE, ) class AnalyzeJudgingContext(JudgeFeedbackContext): ...
from accelerator.tests.factories import ( CriterionFactory, CriterionOptionSpecFactory, ) from accelerator.tests.contexts.judge_feedback_context import ( JudgeFeedbackContext, ) from accelerator.models import ( JUDGING_FEEDBACK_STATUS_COMPLETE, JudgeApplicationFeedback, ) class AnalyzeJudgingConte...
Add needed_reads method to avoid magic numbers
Add needed_reads method to avoid magic numbers
Python
mit
masschallenge/django-accelerator,masschallenge/django-accelerator
e69559b81e9b52eb0834df67b0197aa0f734db3c
wafer/talks/admin.py
wafer/talks/admin.py
from django.contrib import admin from wafer.talks.models import Talk class TalkAdmin(admin.ModelAdmin): list_display = ('corresponding_author', 'title', 'status') admin.site.register(Talk, TalkAdmin)
from django.contrib import admin from wafer.talks.models import Talk class TalkAdmin(admin.ModelAdmin): list_display = ('corresponding_author', 'title', 'status') list_editable = ('status',) admin.site.register(Talk, TalkAdmin)
Make talk status editale from the talk list overview
Make talk status editale from the talk list overview
Python
isc
CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer
49bd893340f456f18101fb2fec7d66026326f401
bot/action/extra/messages/stored_message.py
bot/action/extra/messages/stored_message.py
import json from bot.action.core.command import UnderscoredCommandBuilder from bot.action.extra.messages import analyzer from bot.api.domain import ApiObject class StoredMessage: def __init__(self, message_id, message, *edited_messages): self.message_id = message_id self.message = message ...
import json from bot.action.core.command import UnderscoredCommandBuilder from bot.action.extra.messages import analyzer, StoredMessageMapper from bot.api.domain import ApiObject class StoredMessage: def __init__(self, message_id, message, *edited_messages, incomplete=False): self.message_id = message_id...
Add a from_message static method to StoredMessage, also an incomplete field
Add a from_message static method to StoredMessage, also an incomplete field
Python
agpl-3.0
alvarogzp/telegram-bot,alvarogzp/telegram-bot
d14160537292c87f870fa8c7d99c253b61420dde
blazeweb/registry.py
blazeweb/registry.py
from paste.registry import StackedObjectProxy as PasteSOP class StackedObjectProxy(PasteSOP): # override b/c of # http://trac.pythonpaste.org/pythonpaste/ticket/482 def _pop_object(self, obj=None): """Remove a thread-local object. If ``obj`` is given, it is checked against the popped ob...
from paste.registry import StackedObjectProxy as PasteSOP class StackedObjectProxy(PasteSOP): # override b/c of # http://trac.pythonpaste.org/pythonpaste/ticket/482 def _pop_object(self, obj=None): """Remove a thread-local object. If ``obj`` is given, it is checked against the popped ob...
Fix boolean conversion of StackedObjectProxy in Python 3
Fix boolean conversion of StackedObjectProxy in Python 3
Python
bsd-3-clause
level12/blazeweb,level12/blazeweb,level12/blazeweb
08bffa5f6df497f28fe3481fe80b517628b0f1a3
tmdb3/cache_engine.py
tmdb3/cache_engine.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #----------------------- # Name: cache_engine.py # Python Library # Author: Raymond Wagner # Purpose: Base cache engine class for collecting registered engines #----------------------- class Engines( object ): def __init__(self): self._engines = {} def regi...
#!/usr/bin/env python # -*- coding: utf-8 -*- #----------------------- # Name: cache_engine.py # Python Library # Author: Raymond Wagner # Purpose: Base cache engine class for collecting registered engines #----------------------- class Engines( object ): def __init__(self): self._engines = {} def regi...
Add __contains__ for proper lookup in cache Engines class.
Add __contains__ for proper lookup in cache Engines class.
Python
bsd-3-clause
wagnerrp/pytmdb3,naveenvhegde/pytmdb3
0c913d4bf94637da916b609b1b1d0d34b03776b7
tests/test_logger.py
tests/test_logger.py
import pytest from mugloar import dragon, logger @pytest.fixture def log_instance(): """Returns a Logger instance""" return logger.Logger() @pytest.fixture def knight(): return {'agility': 8, 'endurance': 8, 'armor': 0, 'attack': 4} @pytest.fixture def dragon_instance(): return dragon.Dragon() @...
import pytest from mugloar import dragon, logger @pytest.fixture def log_instance(): """Returns a Logger instance""" return logger.Logger() @pytest.fixture def knight(): return [('endurance', 8), ('attack', 8), ('armor', 0), ('agility', 4)] @pytest.fixture def dragon_instance(): return dragon.Drag...
Implement rudimentary unit tests for logger class
Implement rudimentary unit tests for logger class
Python
mit
reinikai/mugloar
3d5b893083e9d53516e1738b6fedbd890722b2e9
src/cadorsfeed/views/about.py
src/cadorsfeed/views/about.py
from flask import Module from cadorsfeed.views.util import render_file about = Module(__name__) @about.route('/') def homepage(): return render_file('index.html') @about.route('/disclaimer') def disclaimer(): return render_file('disclaimer.html') @about.route('/about') def about_page(): return render_f...
from flask import Module from cadorsfeed.views.util import render_file about = Module(__name__) @about.route('/') @about.route('/home') def homepage(): return render_file('index.html') @about.route('/disclaimer') def disclaimer(): return render_file('disclaimer.html') @about.route('/about') def about_page(...
Make /home point to /.
Make /home point to /.
Python
mit
kurtraschke/cadors-parse,kurtraschke/cadors-parse
fc41951d1e395c3cdc8994b4c025e9776d67d4e0
http.py
http.py
from django.http import HttpResponse class HttpResponseCreated(HttpResponse): status_code = 201 class HttpResponseNoContent(HttpResponse): status_code = 204 class HttpResponseNotAllowed(HttpResponse): status_code = 405 def __init__(self, allow_headers): """ RFC2616: The response MUST...
from django.http import HttpResponse class HttpResponseCreated(HttpResponse): status_code = 201 class HttpResponseNoContent(HttpResponse): status_code = 204 class HttpResponseNotAllowed(HttpResponse): status_code = 405 def __init__(self, allow_headers): """ RFC2616: The response MUST...
Add Response class for unsupported media
Add Response class for unsupported media
Python
mit
danrex/django-riv,danrex/django-riv
6323084f97ac80a579d9c8ef7d5fec9cd9a3ec4d
src/ipf/ipfblock/connection.py
src/ipf/ipfblock/connection.py
# -*- coding: utf-8 -*- import ioport import weakref class Connection(object): """ Connection class for IPFBlock Connection binding OPort and IPort of some IPFBlocks """ def __init__(self, oport, iport): # Check port compatibility and free of input port if ioport.is_connect...
# -*- coding: utf-8 -*- import ioport import weakref class Connection(object): """ Connection class for IPFBlock Connection binding OPort and IPort of some IPFBlocks """ def __init__(self, oport, iport): # Check port compatibility and free of input port if ioport.is_connect...
Check weakrefs to porst before using in destructor.
Check weakrefs to porst before using in destructor. Prevent raise of exception in case of connect deletion after block.
Python
lgpl-2.1
anton-golubkov/Garland,anton-golubkov/Garland
8ea1ee477a8f9f31e2fcb5fb92a02243723c822e
Instanssi/admin_upload/models.py
Instanssi/admin_upload/models.py
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User from django.contrib import admin from Instanssi.kompomaatti.models import Event import os.path class UploadedFile(models.Model): event = models.ForeignKey(Event, verbose_name=u'Tapahtuma') user = models.ForeignKey...
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User from django.contrib import admin from Instanssi.kompomaatti.models import Event import os.path class UploadedFile(models.Model): event = models.ForeignKey(Event, verbose_name=u'Tapahtuma') user = models.ForeignKey...
Delete old files when modified
admin_upload: Delete old files when modified
Python
mit
Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org
34c65649fc017c087aa229863bbb2c95f1be4134
tests/test_same_origin.py
tests/test_same_origin.py
from http.cookies import SimpleCookie from django.conf import settings from sockjs.tornado.session import ConnectionInfo from swampdragon.connections.sockjs_connection import SubscriberConnection from swampdragon.testing.dragon_testcase import DragonTestCaseAsync import uuid class TestSession(object): def __init_...
try: from http.cookies import SimpleCookie except ImportError: from Cookie import SimpleCookie from django.conf import settings from sockjs.tornado.session import ConnectionInfo from swampdragon.connections.sockjs_connection import SubscriberConnection from swampdragon.testing.dragon_testcase import DragonTest...
Fix import error of SimpleCookie for python 2.7
Fix import error of SimpleCookie for python 2.7 `Cookie` was renamed to `http.cookies` in Python 3
Python
bsd-3-clause
faulkner/swampdragon,Manuel4131/swampdragon,d9pouces/swampdragon,sahlinet/swampdragon,seclinch/swampdragon,jonashagstedt/swampdragon,Manuel4131/swampdragon,Manuel4131/swampdragon,michael-k/swampdragon,boris-savic/swampdragon,bastianh/swampdragon,bastianh/swampdragon,boris-savic/swampdragon,seclinch/swampdragon,michael-...
95220c99ae6062fed7d4211c67b8dffc031f4c7c
tests/versioning/tests.py
tests/versioning/tests.py
from __future__ import absolute_import import os.path import pytest import subprocess from django.conf import settings from raven.versioning import fetch_git_sha, fetch_package_version from raven.utils import six def has_git_requirements(): return os.path.exists(os.path.join(settings.PROJECT_ROOT, '.git', 'ref...
from __future__ import absolute_import import os.path import pytest import subprocess from django.conf import settings from raven.versioning import fetch_git_sha, fetch_package_version from raven.utils import six def has_git_requirements(): return os.path.exists(os.path.join(settings.PROJECT_ROOT, '.git', 'ref...
Remove use of check_output (not in Py2.6)
Remove use of check_output (not in Py2.6)
Python
bsd-3-clause
johansteffner/raven-python,johansteffner/raven-python,getsentry/raven-python,akalipetis/raven-python,ewdurbin/raven-python,ewdurbin/raven-python,danriti/raven-python,getsentry/raven-python,getsentry/raven-python,johansteffner/raven-python,ewdurbin/raven-python,akalipetis/raven-python,danriti/raven-python,danriti/raven-...
072526a6ec1794edc0f729f2ecb66c47ed38abb9
harmony/extensions/rng.py
harmony/extensions/rng.py
import random from discord.ext import commands class RNG: def __init__(self, bot): self.bot = bot @commands.command() async def roll(self, dice: str = None): """Roll some dice. Keyword arguments: dice -- number of dice (X) and faces (Y) in the format XdY """ ...
import random from discord.ext import commands class RNG: def __init__(self, bot): self.bot = bot @commands.command() async def roll(self, dice: str): """Roll some dice. Keyword arguments: dice -- number of dice (X) and faces (Y) in the format XdY """ try...
Make roll better and worse
Make roll better and worse
Python
apache-2.0
knyghty/harmony
52f8e68835eb67e522dd8f1c7725d460eaa2cab7
RPS/rps-1.py
RPS/rps-1.py
# A simple rock, paper, scissors script submitted as a demo of easy game-making # In Python # Certain parts of this program are functional—that is, written in functions that # work together. Some parts aren't. As we improve the program, you'll find that # This functional way of doing things has some real advantages. i...
""" A simple rock, paper, scissors script submitted as a demo of easy game-making In Python. """ import random # We need thr random module for the computer to play # This dictionary relates a choice to what it defeats for easy comparison later. beats = { "rock":"scissors", "paper":"rock", "scissors":"paper...
Refactor out functions from rps1
Refactor out functions from rps1
Python
mit
mttaggart/python-cs
e16b2de7dd7c6e0df100bba08d3a7465bbbb4424
tests/test_service.py
tests/test_service.py
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives import serialization, hashes import requests import base64 import unittest import os class TestPosieService(unittest.TestCase): POSIE_URL = os.getenv('POSIE_...
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization import base64 import unittest import sys import os sys.path.append(os.path.abspath('../server.py')) import server class TestPosieService(unittest.TestCase): def test_key_generation(self): ...
Remove requests and drop external tests (now in integration)
Remove requests and drop external tests (now in integration)
Python
mit
ONSdigital/edcdi
461019099c41ca4ef2fc7ccfec0141ed5b7e3bd6
tests/test_unicode.py
tests/test_unicode.py
# coding: utf-8 import sys import pytest import jupytext from .utils import list_all_notebooks @pytest.mark.parametrize('nb_file', list_all_notebooks('.ipynb') + list_all_notebooks('.Rmd')) def test_notebook_contents_is_unicode(nb_file): nb = jupytext.readf(nb_file) for cell in nb.ce...
# coding: utf-8 import sys import pytest import jupytext from .utils import list_all_notebooks try: unicode # Python 2 except NameError: unicode = str # Python 3 @pytest.mark.parametrize('nb_file', list_all_notebooks('.ipynb') + list_all_notebooks('.Rmd')) def test_notebook_conte...
Define unicode in Python 3
Define unicode in Python 3 __unicode__ was removed in Python 3 because all __str__ are Unicode. [flake8](http://flake8.pycqa.org) testing of https://github.com/mwouts/jupytext on Python 3.7.0 $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./.jupyter/jupyter_notebook_con...
Python
mit
mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext
eb893151d12f81f1ebe388f0b4ae650aa6f6552c
ticketing/__init__.py
ticketing/__init__.py
""" Ticketing ~~~~~~~~~ """ try: VERSION = __import__('pkg_resources') \ .get_distribution('django-ticketing').version except Exception, e: VERSION = 'unknown'
""" Ticketing ~~~~~~~~~ """ VERSION = (0, 6, 0, 'final', 0)
Change the version string so it doesn't cause any errors.
Change the version string so it doesn't cause any errors.
Python
mit
streeter/django-ticketing
4f98c8ff8ef724b65106a040ffaf67800dff1611
animations.py
animations.py
""" All animators should be functions which take the input time as a number from 0 to 1 and return a new value for the property they are animating. For numerical properties, this should also be normalized to a [0, 1] scale, allowing for the possibility of a [-1, 1] scale as well. """ def Linear(start, finish): de...
""" All animators should be functions which take the input time as a number from 0 to 1 and return a new value for the property they are animating. For numerical properties, this should also be normalized to a [0, 1] scale, allowing for the possibility of a [-1, 1] scale as well. """ def Linear(start, finish): de...
Remove some debugging print statements that slipped through.
Remove some debugging print statements that slipped through.
Python
lgpl-2.1
platipy/spyral
c370eb048aa6fe6e64f9cd738717d1deaccf8b2f
modules/pipestrconcat.py
modules/pipestrconcat.py
# pipestrconcat.py #aka stringbuilder # from pipe2py import util def pipe_strconcat(context, _INPUT, conf, **kwargs): """This source builds a string and yields it forever. Keyword arguments: context -- pipeline context _INPUT -- not used conf: part -- parts Yields (_OUTPUT):...
# pipestrconcat.py #aka stringbuilder # from pipe2py import util def pipe_strconcat(context, _INPUT, conf, **kwargs): """This source builds a string and yields it forever. Keyword arguments: context -- pipeline context _INPUT -- not used conf: part -- parts Yields (_OUTPUT):...
Handle subkey for submodule, in strconcat at least
Handle subkey for submodule, in strconcat at least
Python
mit
nerevu/riko,nerevu/riko
94ae82e8a2915c6c7d353d03aa363ae687805344
testing/models/test_proposal.py
testing/models/test_proposal.py
import pytest try: from unittest import mock except ImportError: import mock from k2catalogue import models @pytest.fixture def proposal(): return models.Proposal(proposal_id='abc', pi='pi', title='title', pdf_url='pdf_url') def test_proposal_printing(proposal): assert re...
import pytest try: from unittest import mock except ImportError: import mock from k2catalogue import models @pytest.fixture def proposal(): return models.Proposal(proposal_id='abc', pi='pi', title='title', pdf_url='pdf_url') def test_proposal_printing(proposal): assert re...
Add more tests around the proposal model behaviour
Add more tests around the proposal model behaviour
Python
mit
mindriot101/k2catalogue
be871f0c6e027e2e51233600c49a502dc6b9a15b
calaccess_raw/__init__.py
calaccess_raw/__init__.py
import os from django.conf import settings from django.db.models.loading import get_models, get_app default_app_config = 'calaccess_raw.apps.CalAccessRawConfig' def get_download_directory(): """ Returns the download directory where we will store downloaded data. """ if hasattr(settings, 'CALACCESS_DOW...
import os from django.conf import settings from django.apps import apps as django_apps default_app_config = 'calaccess_raw.apps.CalAccessRawConfig' def get_download_directory(): """ Returns the download directory where we will store downloaded data. """ if hasattr(settings, 'CALACCESS_DOWNLOAD_DIR'): ...
Update get_model_list to use app config rather than deprecated django.db.models.loading functions
Update get_model_list to use app config rather than deprecated django.db.models.loading functions
Python
mit
dcloud/django-calaccess-raw-data
0eca195f9c29824f354cae53a4005f04c67eb86f
nodeconductor/cloud/views.py
nodeconductor/cloud/views.py
from rest_framework import permissions as rf_permissions from rest_framework import exceptions from nodeconductor.core import viewsets from nodeconductor.cloud import models from nodeconductor.cloud import serializers from nodeconductor.structure import filters as structure_filters from nodeconductor.structure import ...
from rest_framework import permissions as rf_permissions from rest_framework import exceptions from nodeconductor.core import viewsets from nodeconductor.cloud import models from nodeconductor.cloud import serializers from nodeconductor.structure import filters as structure_filters from nodeconductor.structure import ...
Optimize SQL queries used for fetching clouds
Optimize SQL queries used for fetching clouds
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
09a27308c97ae45992df0128ac1743147658fb98
tests/unit/test_saysomething.py
tests/unit/test_saysomething.py
import pytest from pmxbot import saysomething class TestMongoDBChains: @pytest.fixture def mongodb_chains(self, request, mongodb_uri): k = saysomething.MongoDBChains.from_URI(mongodb_uri) k.db = k.db.database.connection[ k.db.database.name + '_test' ][k.db.name] request.addfinalizer(k.db.drop) return ...
import itertools import functools from more_itertools import recipes import pytest from pmxbot import saysomething class TestMongoDBChains: @pytest.fixture def mongodb_chains(self, request, mongodb_uri): k = saysomething.MongoDBChains.from_URI(mongodb_uri) k.db = k.db.database.connection[ k.db.database.na...
Add test capturing expected behavior under more complex inputs.
Add test capturing expected behavior under more complex inputs.
Python
mit
yougov/pmxbot,yougov/pmxbot,yougov/pmxbot
3df9cdb0f96e68fb6870f3ee261cd206d38fb787
octane/tests/test_app.py
octane/tests/test_app.py
# 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 # distributed under t...
# 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 # distributed under t...
Refactor test to use cool py.test's fixture
Refactor test to use cool py.test's fixture
Python
apache-2.0
Mirantis/octane,stackforge/fuel-octane,Mirantis/octane,stackforge/fuel-octane
75606e2b13a29a5d68894eda86dbede8292fb0c8
website/project/taxonomies/__init__.py
website/project/taxonomies/__init__.py
from modularodm import fields from framework.mongo import ( ObjectId, StoredObject, utils as mongo_utils ) from website.util import api_v2_url @mongo_utils.unique_on(['text']) class Subject(StoredObject): _id = fields.StringField(primary=True, default=lambda: str(ObjectId())) text = fields.String...
import pymongo from modularodm import fields from framework.mongo import ( ObjectId, StoredObject, utils as mongo_utils ) from website.util import api_v2_url @mongo_utils.unique_on(['text']) class Subject(StoredObject): __indices__ = [ { 'unique': True, 'key_or_list':...
Add unique index on the subject model for @chrisseto
Add unique index on the subject model for @chrisseto
Python
apache-2.0
hmoco/osf.io,alexschiller/osf.io,CenterForOpenScience/osf.io,Johnetordoff/osf.io,HalcyonChimera/osf.io,baylee-d/osf.io,aaxelb/osf.io,samchrisinger/osf.io,HalcyonChimera/osf.io,CenterForOpenScience/osf.io,cslzchen/osf.io,cwisecarver/osf.io,Johnetordoff/osf.io,crcresearch/osf.io,chrisseto/osf.io,alexschiller/osf.io,aaxel...
57f8715b8a5ec74efdf5c386226f3e416f7df9e5
python_practice/numpy_exercise2.py
python_practice/numpy_exercise2.py
import numpy as np Matrix_A = np.array( [[1,1],[0,1]] ) Matrix_B = np.array( [[2,0],[3,4]] ) print Matrix_A*Matrix_B print Matrix_A.dot(Matrix_B) print np.dot(Matrix_A, Matrix_B) Matrix_C = np.ones((2,3), dtype=int) Matrix_C *= 3 print Matrix_C Matrix_D = np.ones((2,3), dtype=int) print Matrix_C+Matrix_D
import numpy as np Matrix_A = np.array( [[1,1],[0,1]] ) Matrix_B = np.array( [[2,0],[3,4]] ) print Matrix_A*Matrix_B print Matrix_A.dot(Matrix_B) print np.dot(Matrix_A, Matrix_B) Matrix_C = np.ones((2,3), dtype=int) Matrix_C *= 3 print Matrix_C Matrix_D = np.ones((2,3), dtype=int) print Matrix_C+Matrix_D ...
Add get the element by col and row
Add get the element by col and row
Python
mit
jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm
98c1875d544cd3287b1df91f6216f57d09b93bdc
waterbutler/tasks/move.py
waterbutler/tasks/move.py
import asyncio from waterbutler.core import utils from waterbutler.tasks import core from waterbutler.tasks import settings @core.celery_task def move(src_bundle, dest_bundle): src_args, src_provider = src_bundle.pop('args'), utils.make_provider(**src_bundle.pop('provider')) dest_args, dest_provider = dest_bu...
import os import time from waterbutler.core import utils from waterbutler.tasks import core @core.celery_task def move(src_bundle, dest_bundle, callback_url, auth): src_args, src_provider = src_bundle.pop('args'), utils.make_provider(**src_bundle.pop('provider')) dest_args, dest_provider = dest_bundle.pop('ar...
Send callback when finished moving
Send callback when finished moving
Python
apache-2.0
rafaeldelucena/waterbutler,icereval/waterbutler,hmoco/waterbutler,RCOSDP/waterbutler,TomBaxter/waterbutler,Ghalko/waterbutler,chrisseto/waterbutler,Johnetordoff/waterbutler,cosenal/waterbutler,felliott/waterbutler,CenterForOpenScience/waterbutler,rdhyee/waterbutler,kwierman/waterbutler
2539f8adbe2b7deed2974c4245fd8087a8f05e65
wluopensource/osl_comments/models.py
wluopensource/osl_comments/models.py
from django.contrib.comments.models import Comment from django.db import models class OslComment(Comment): parent_comment = models.ForeignKey(Comment, blank=True, null=True, related_name='parent_comment') inline_to_object = models.BooleanField() edit_timestamp = models.DateTimeField(auto_now=True)
from django.contrib.comments.models import Comment from django.contrib.comments.signals import comment_was_posted from django.db import models class OslComment(Comment): parent_comment = models.ForeignKey(Comment, blank=True, null=True, related_name='parent_comment') inline_to_object = models.BooleanField() ...
Use signals to add authenticated user URL to comment when posted
Use signals to add authenticated user URL to comment when posted
Python
bsd-3-clause
jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website
3ed06913ab26b44f133ef2e91ea2f626af72c996
comics/comics/gucomics.py
comics/comics/gucomics.py
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = 'GU Comics' language = 'en' url = 'http://www.gucomics.com/' start_date = '2000-07-10' rights = 'Woody Hearn' class Crawler(CrawlerBase): hi...
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = 'GU Comics' language = 'en' url = 'http://www.gucomics.com/' start_date = '2000-07-10' rights = 'Woody Hearn' class Crawler(CrawlerBase): hi...
Split line to avoid flake8 warning
Split line to avoid flake8 warning
Python
agpl-3.0
datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics
9742d86c802bc16759fdb6bc0de6c46eb316d01d
Lib/xml/__init__.py
Lib/xml/__init__.py
"""Core XML support for Python. This package contains three sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Meggins...
"""Core XML support for Python. This package contains three sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Meggins...
Use the string module instead of string methods; this should still work with Python 1.5.2 for now.
Use the string module instead of string methods; this should still work with Python 1.5.2 for now.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
28d4538e02d66d06fcba1d386b506502c7bad4a0
bakery/views.py
bakery/views.py
# -*- coding: utf-8 -*- from django.views.generic import ListView, TemplateView from bakery.cookies.models import Cookie class HomeView(ListView): model = Cookie template_name = 'home.html' home = HomeView.as_view() class StylesView(TemplateView): template_name = 'styles.html' styles = StylesView.as...
# -*- coding: utf-8 -*- from django.db.models import Q from django.views.generic import ListView, TemplateView from bakery.cookies.models import Cookie class HomeView(ListView): model = Cookie template_name = 'home.html' def get_queryset(self): queryset = super(HomeView, self).get_queryset() ...
Integrate search in home view
Integrate search in home view
Python
bsd-3-clause
muffins-on-dope/bakery,muffins-on-dope/bakery,muffins-on-dope/bakery
47132cda83dcb26b7d94b5631ba145d925f05da3
test/test_commonsdowloader.py
test/test_commonsdowloader.py
#!/usr/bin/env python # -*- coding: latin-1 -*- """Unit tests.""" import unittest import commonsdownloader class TestCommonsDownloader(unittest.TestCase): """Testing methods from commonsdownloader.""" def test_clean_up_filename(self): """Test clean_up_filename.""" values = [('Example.jpg',...
#!/usr/bin/env python # -*- coding: latin-1 -*- """Unit tests.""" import unittest import commonsdownloader class TestCommonsDownloader(unittest.TestCase): """Testing methods from commonsdownloader.""" def test_clean_up_filename(self): """Test clean_up_filename.""" values = [('Example.jpg',...
Add unit test for make_thumb_url()
Add unit test for make_thumb_url()
Python
mit
Commonists/CommonsDownloader
47b4779b82035d0478985c85c3e7e95581ef8efe
CodeFights/arrayPacking.py
CodeFights/arrayPacking.py
#!/usr/local/bin/python # Code Fights Are Equally Strong Problem def arrayPacking(): pass def main(): tests = [ [], [] ] for t in tests: res = arrayPacking(t[0]) if t[1] == res: print("PASSED: arrayPacking({}) returned {}" .format(t[0], ...
#!/usr/local/bin/python # Code Fights Array Packing (Core) Problem def arrayPacking(a): return sum([n << 8*i for i, n in enumerate(a)]) def main(): tests = [ [[24, 85, 0], 21784], [[23, 45, 39], 2567447] ] for t in tests: res = arrayPacking(t[0]) if t[1] == res: ...
Solve Code Fights array packing problem
Solve Code Fights array packing problem
Python
mit
HKuz/Test_Code
27e79e49af76a0f981f54c1ac2b88ad409bacb95
xie/graphics/utils.py
xie/graphics/utils.py
class TextCodec: def __init__(self): pass def encodeStartPoint(self, p): return "0000{0[0]:02X}{0[1]:02X}".format(p) def encodeEndPoint(self, p): return "0001{0[0]:02X}{0[1]:02X}".format(p) def encodeControlPoint(self, p): return "0002{0[0]:02X}{0[1]:02X}".format(p) def encodeStrokeExpression(self, poi...
class TextCodec: def __init__(self): pass def encodeStartPoint(self, p): return "0{0[0]:02X}{0[1]:02X}".format(p) def encodeEndPoint(self, p): return "1{0[0]:02X}{0[1]:02X}".format(p) def encodeControlPoint(self, p): return "2{0[0]:02X}{0[1]:02X}".format(p) def encodeStrokeExpression(self, pointExpress...
Change the text format for drawing a stroke. To use 5 digits but not 8 digits to present a point.
Change the text format for drawing a stroke. To use 5 digits but not 8 digits to present a point.
Python
apache-2.0
xrloong/Xie
90f1cfb302c5b95243731c3c6688c5c3193b821c
mmd_tools/auto_scene_setup.py
mmd_tools/auto_scene_setup.py
# -*- coding: utf-8 -*- import bpy def setupFrameRanges(): s, e = 1, 1 for i in bpy.data.actions: ts, te = i.frame_range s = min(s, ts) e = max(e, te) bpy.context.scene.frame_start = s bpy.context.scene.frame_end = e bpy.context.scene.rigidbody_world.point_cache.frame_start...
# -*- coding: utf-8 -*- import bpy def setupFrameRanges(): s, e = 1, 1 for i in bpy.data.actions: ts, te = i.frame_range s = min(s, ts) e = max(e, te) bpy.context.scene.frame_start = s bpy.context.scene.frame_end = e if bpy.context.scene.rigidbody_world is not None: ...
Fix the bug that causes "set frame range" error on a scene that has no rigid body world.
Fix the bug that causes "set frame range" error on a scene that has no rigid body world.
Python
mit
sugiany/blender_mmd_tools,lordscales91/blender_mmd_tools
01ebdc54886f01a9aa58098c8987b0ce7620706a
simplestatistics/statistics/standard_deviation.py
simplestatistics/statistics/standard_deviation.py
import math from .variance import variance def standard_deviation(data): """ The `standard deviation`_ is the square root of variance_ (the sum of squared deviations from the mean). The standard deviation is a commonly used measure of the variation and distance of a set of values in a sample from t...
import math from .variance import variance def standard_deviation(data, sample = True): """ The `standard deviation`_ is the square root of variance_ (the sum of squared deviations from the mean). The standard deviation is a commonly used measure of the variation and distance of a set of values in ...
Add sample param to Standard Deviation function
Add sample param to Standard Deviation function Boolean param to make possible to calculate Standard Deviation for population (Default is sample).
Python
unknown
sheriferson/simple-statistics-py,tmcw/simple-statistics-py,sheriferson/simplestatistics
e0cd0f9a14ac354f19c4e91367ac75b34d58ae8e
pirx/checks.py
pirx/checks.py
#!/usr/bin/env python import socket import sys def host(name): return socket.gethostname() == name def arg(name, expected_value=None): args = [ arg.split('=') for arg in sys.argv[1:] if '=' in arg else (arg, None) ] for arg_name, arg_value in args: if arg_name.lstrip('--') == name: ...
#!/usr/bin/env python import socket import sys def host(name): """Check if host name is equal to the given name""" return socket.gethostname() == name def arg(name, expected_value=None): """ Check if command-line argument with a given name was passed and if it has the expected value. """ ...
Set docstrings for check functions
Set docstrings for check functions
Python
mit
piotrekw/pirx
af1df841b3d0c013c0678fa6fb9821b61a9eb87c
policy_evaluation/deterministic.py
policy_evaluation/deterministic.py
from torch.autograd import Variable class DeterministicPolicy(object): def __init__(self, policy): """Assumes policy returns an autograd.Variable""" self.name = "DP" self.policy = policy self.cuda = next(policy.parameters()).is_cuda def get_action(self, state): """ Ta...
from torch.autograd import Variable class DeterministicPolicy(object): def __init__(self, policy): """Assumes policy returns an autograd.Variable""" self.name = "DP" self.policy = policy self.cuda = next(policy.parameters()).is_cuda def get_action(self, state): """ Ta...
Make DQN backward compatible with pytorch 0.1.2.
Make DQN backward compatible with pytorch 0.1.2.
Python
mit
floringogianu/categorical-dqn
73b380000ad1ba87169f3a9a7bd219b76109945e
selectable/tests/__init__.py
selectable/tests/__init__.py
from django.db import models from django.utils.encoding import python_2_unicode_compatible from ..base import ModelLookup from ..registry import registry @python_2_unicode_compatible class Thing(models.Model): name = models.CharField(max_length=100) description = models.CharField(max_length=100) def __s...
from django.db import models from django.utils.encoding import python_2_unicode_compatible from ..base import ModelLookup from ..registry import registry @python_2_unicode_compatible class Thing(models.Model): name = models.CharField(max_length=100) description = models.CharField(max_length=100) def __s...
Fix warning in test suite when running under Django 1.11
Fix warning in test suite when running under Django 1.11
Python
bsd-2-clause
mlavin/django-selectable,mlavin/django-selectable,mlavin/django-selectable
3a2ca4573866b7b81d4b946ce87b9f36b487d272
src/dojo.py
src/dojo.py
class Dojo(object): def __init__(self): self.all_rooms = [] self.all_people = [] def create_room(self, room_type, room_name): pass
class Dojo(object): """This class is responsible for managing and allocating rooms to people""" def __init__(self): self.all_rooms = [] self.all_people = [] def create_room(self, room_type, room_name): pass
Add docstring to Dojo class
Add docstring to Dojo class
Python
mit
EdwinKato/Space-Allocator,EdwinKato/Space-Allocator
11eac909105ee944ebef38bd23e1f320a8dd1175
shakespearelang/character.py
shakespearelang/character.py
from .errors import ShakespeareRuntimeError class Character: """A character in an SPL play.""" def __init__(self, name): self.value = 0 self.stack = [] self.on_stage = False self.name = name @classmethod def from_dramatis_persona(cls, persona): name = persona....
from .errors import ShakespeareRuntimeError from .utils import normalize_name class Character: """A character in an SPL play.""" def __init__(self, name): self.value = 0 self.stack = [] self.on_stage = False self.name = name @classmethod def from_dramatis_persona(cls,...
Use utils to simplify code
Use utils to simplify code
Python
mit
zmbc/shakespearelang,zmbc/shakespearelang,zmbc/shakespearelang
21d5acb0ed340f15feccd5938ae51d47739f930a
falmer/commercial/queries.py
falmer/commercial/queries.py
import graphene from .models import Offer from . import types class Query(graphene.ObjectType): all_offers = graphene.List(types.Offer) def resolve_all_offers(self, info): return Offer.objects.all()
import graphene from .models import Offer from . import types class Query(graphene.ObjectType): all_offers = graphene.List(types.Offer) def resolve_all_offers(self, info): return Offer.objects.order_by('company_name').all()
Order offers by company name
Order offers by company name Closes #373
Python
mit
sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer
6c34a6c3e73a41cb94bc761a7001cfa9bba24eb3
combobox.py
combobox.py
import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * class ComboBox(QWidget): def __init__(self, parent=None, items=[]): super(ComboBox, self).__init__(parent) layout = QHBoxLayout() self.cb = QComboBox() self.items = items self.cb....
try: from PyQt5.QtWidgets import QWidget, QHBoxLayout, QComboBox except ImportError: # needed for py3+qt4 # Ref: # http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html # http://stackoverflow.com/questions/21217399/pyqt4-qtcore-qvariant-object-instead-of-a-string if sys.version_info.majo...
Update imports and added PyQt4 support
Update imports and added PyQt4 support
Python
mit
tzutalin/labelImg,tzutalin/labelImg
baabc63ffad0b9641bd3d68800a9db84fe4076d3
src/__init__.py
src/__init__.py
__version_info__ = ('1', '10', '3') __version__ = '.'.join(__version_info__) from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper, BoundFunctionWrapper, WeakFunctionProxy, resolve_path, apply_patch, wrap_object, wrap_object_attribute, function_wrapper, wrap_function_wrapper,...
__version_info__ = ('1', '10', '3') __version__ = '.'.join(__version_info__) from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper, BoundFunctionWrapper, WeakFunctionProxy, resolve_path, apply_patch, wrap_object, wrap_object_attribute, function_wrapper, wrap_function_wrapper,...
Add post import hook discovery to public API.
Add post import hook discovery to public API.
Python
bsd-2-clause
GrahamDumpleton/wrapt,github4ry/wrapt,linglaiyao1314/wrapt,pombredanne/wrapt,wujuguang/wrapt,linglaiyao1314/wrapt,wujuguang/wrapt,akash1808/wrapt,pombredanne/wrapt,GrahamDumpleton/wrapt,github4ry/wrapt,akash1808/wrapt
62818c327997e804090ad8fab328e05410d65d89
resolwe/flow/tests/test_backend.py
resolwe/flow/tests/test_backend.py
# pylint: disable=missing-docstring from __future__ import absolute_import, division, print_function, unicode_literals import os import shutil from django.conf import settings from django.contrib.auth import get_user_model from django.test import TestCase from resolwe.flow.engines.local import manager from resolwe.f...
# pylint: disable=missing-docstring from __future__ import absolute_import, division, print_function, unicode_literals import os import shutil from django.conf import settings from django.contrib.auth import get_user_model from django.test import TestCase from resolwe.flow.engines.local import manager from resolwe.f...
Remove (potentialy dangerous) data path recreation
Remove (potentialy dangerous) data path recreation
Python
apache-2.0
jberci/resolwe,genialis/resolwe,jberci/resolwe,genialis/resolwe
25ea87b810d717690679613251fbc262f11c021f
pajbot/modules/linefarming.py
pajbot/modules/linefarming.py
import logging from pajbot.managers.handler import HandlerManager from pajbot.models.user import User from pajbot.modules import BaseModule from pajbot.modules import ModuleSetting log = logging.getLogger(__name__) class LineFarmingModule(BaseModule): ID = __name__.split(".")[-1] NAME = "Line Farming" ...
import logging from pajbot.managers.handler import HandlerManager from pajbot.models.user import User from pajbot.modules import BaseModule from pajbot.modules import ModuleSetting log = logging.getLogger(__name__) class LineFarmingModule(BaseModule): ID = __name__.split(".")[-1] NAME = "Line Farming" ...
Revert to using += to increment user's lines Doing it the "atomic" way was causing str(user.num_lines) to become ""user".num_lines + :num_lines_1" which is not intended
Revert to using += to increment user's lines Doing it the "atomic" way was causing str(user.num_lines) to become ""user".num_lines + :num_lines_1" which is not intended
Python
mit
pajlada/pajbot,pajlada/pajbot,pajlada/pajbot,pajlada/tyggbot,pajlada/tyggbot,pajlada/tyggbot,pajlada/pajbot,pajlada/tyggbot
2b3406a46625fd5350200dcb6d2dc32224d3c609
warehouse/defaults.py
warehouse/defaults.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals # The base domain name for this installation. Used to control linking to # sub-domains. SERVER_NAME = "warehouse.local" # The URI for our PostgreSQL database. SQLALCHEMY_DATABASE_URI = "postgres:///ware...
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals # The base domain name for this installation. Used to control linking to # sub-domains. SERVER_NAME = "warehouse.local" # The URI for our PostgreSQL database. SQLALCHEMY_DATABASE_URI = "postgres:///ware...
Remove a no longer used setting
Remove a no longer used setting With the removal of eventlet there is no longer a mechanism for timing out a synchronization.
Python
bsd-2-clause
davidfischer/warehouse