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
7c5747688dffd41737c841ac354c4947939006c3
django_excel_tools/exceptions.py
django_excel_tools/exceptions.py
class BaseExcelError(Exception): def __init__(self, message): super(BaseExcelError, self).__init__() self.message = message class ValidationError(BaseExcelError): pass class ColumnNotEqualError(BaseExcelError): pass class FieldNotExist(BaseExcelError): pass class SerializerConfi...
class BaseExcelError(Exception): def __init__(self, message): super(BaseExcelError, self).__init__() self.message = message class ColumnNotEqualError(BaseExcelError): pass class FieldNotExist(BaseExcelError): pass class ImportOperationFailed(BaseExcelError): pass class Serialize...
Add exception for import operation error and validation error
Add exception for import operation error and validation error
Python
mit
NorakGithub/django-excel-tools
8e4d77636a9846296225ddbfab872be4c7486261
dask_distance/_pycompat.py
dask_distance/_pycompat.py
# -*- coding: utf-8 -*- try: irange = xrange except NameError: irange = range
# -*- coding: utf-8 -*- try: irange = xrange except NameError: irange = range try: from itertools import izip except ImportError: izip = zip
Add izip for Python 2/3 compatibility
Add izip for Python 2/3 compatibility Simply use `izip` from `itertools` on Python 2 and alias `izip` as `zip` on Python 3. This way an iterable form of `zip` remains available on both Python 2 and Python 3 that is named `izip`. Should help avoid having the performance of the two implementations from diverging too far...
Python
bsd-3-clause
jakirkham/dask-distance
21541a4a1b2fcdfaa4bb7d2fbebf7db702eebacc
app/main.py
app/main.py
import csv import yaml import parse import deparse def main(): with open('data/features.csv', 'r') as f: segments = [segment for segment in csv.DictReader(f)] with open('data/diacritics.yaml') as f: diacritics = yaml.load(f) with open('data/feature-strings-with-diacritics.csv') as f: ...
import csv import yaml import parse import evolve import deparse def evolve_words(words, available_rules, generations=5): '''Evolves the given list of words according to the given list of rules, for a number of generations. If no more applicable rules are available, the evolution will stop early. Returns...
Create basic flow of evolution process.
Create basic flow of evolution process.
Python
mit
kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve
fe4a0e0b86300f7da5f45a5541ee9c42c0a76ab7
docker_manager/dispatcher.py
docker_manager/dispatcher.py
import requests_unixsocket import urllib import json import re def dockerapi_dispatcher(app,request): method = request.method uri = re.match(r"^.+/dockerapi/(.+)", request.url).group(1) session = requests_unixsocket.Session() unix_socket = urllib.quote_plus( app.config['SOCKET'] ) return getattr(s...
import requests_unixsocket import urllib import re def dockerapi_dispatcher(app,request): method = request.method uri = re.match(r"^.+/dockerapi/(.+)", request.url).group(1) session = requests_unixsocket.Session() unix_socket = urllib.quote_plus( app.config['SOCKET'] ) return getattr(session,metho...
Remove unsed json module import
Remove unsed json module import
Python
apache-2.0
nathanIL/docker-manager,nathanIL/docker-manager,nathanIL/docker-manager
1b18d81f673e9f982e9778823198cbc336285db4
tests/grammar_creation_test/NonterminalAddingTest.py
tests/grammar_creation_test/NonterminalAddingTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import * class NonterminalAddingTest(TestCase): pass if __name__ == '__main__': main()
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import * from grammpy.exceptions import NotNonterminalException class A(Nonterminal): pass class B(Nonterminal): pass class C(Nonterminal): ...
Add test of adding nonterminals when grammar is create
Add test of adding nonterminals when grammar is create
Python
mit
PatrikValkovic/grammpy
8b04e4de91f60a2727f9c7a6f5a56d86279c667d
avalonstar/apps/live/urls.py
avalonstar/apps/live/urls.py
# -*- coding: utf-8 -*- from django.conf import settings from django.conf.urls import patterns, include, url from django.views.generic import RedirectView from .views import AwayView, DiscussionView, GameView, PrologueView urlpatterns = patterns('', # Because sooner or later, avalonstar.tv/ will be a welcome pag...
# -*- coding: utf-8 -*- from django.conf import settings from django.conf.urls import patterns, include, url from django.views.generic import RedirectView from .views import (AwayView, DiscussionView, EpilogueView, GameView, PrologueView) urlpatterns = patterns('', # Because sooner or later, avalonstar.tv/ w...
Add a URL conf for the EpilogueView.
Add a URL conf for the EpilogueView.
Python
apache-2.0
bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv
5cbbe25d9bbfbea804d22f399ec16ed438c492e4
moss/plots.py
moss/plots.py
import os.path as op import numpy as np import nibabel as nib import seaborn as sns def plot_mask_distribution(fname, hist=False): """Plot the distribution of voxel coordinates in a mask file. Parameters ---------- fname : string path to binary mask file Returns ------- ax : matpl...
import os.path as op import numpy as np import nibabel as nib import matplotlib.pyplot as plt import seaborn as sns def plot_mask_distribution(fname, ax=None, hist=False): """Plot the distribution of voxel coordinates in a mask file. Parameters ---------- fname : string path to binary mask fil...
Allow for shade or hist in mask plot
Allow for shade or hist in mask plot
Python
bsd-3-clause
mwaskom/moss,mwaskom/moss
99f862b6c123b8c6d81e931254c061e64431bccc
pysingcells/logger.py
pysingcells/logger.py
# -*- coding: utf-8 -*- """ Function related to logging """ # stp import import sys import logging # fief import from fief import filter_effective_parameters as fief log = logging.getLogger() @fief def setup_logging(options): log_level = 10 if "logging_level" in options else options["logging_level"] ...
# -*- coding: utf-8 -*- """ Function related to logging """ # stp import import sys import logging # fief import from fief import filter_effective_parameters as fief log = logging.getLogger() @fief def setup_logging(options): log_level = 10 if "logging_level" in options else options["logging_level"] ...
Add time in logging trace
Add time in logging trace
Python
mit
Fougere87/pysingcells
1bc174d357423964191625faad6733466320face
application.py
application.py
import os import sentry_sdk from flask import Flask from sentry_sdk.integrations.flask import FlaskIntegration from sentry_sdk.integrations import logging from app import create_app sentry_sdk.init( dsn=os.environ['SENTRY_DSN'], integrations=[FlaskIntegration()], environment=os.environ['NOTIFY_ENVIRONMEN...
import os import sentry_sdk from flask import Flask from sentry_sdk.integrations.flask import FlaskIntegration from sentry_sdk.integrations.redis import RedisIntegration from sentry_sdk.integrations import logging from app import create_app sentry_sdk.init( dsn=os.environ['SENTRY_DSN'], integrations=[FlaskIn...
Add RedisIntegration to Sentry trial
Add RedisIntegration to Sentry trial This should expose additional performance stats.
Python
mit
alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin
6de1eb3e3279af6fa09ddafd0e220becac7edf21
author/urls.py
author/urls.py
from django.conf.urls import patterns from django.conf.urls import url from django.views.generic.base import RedirectView from django.core.urlresolvers import reverse_lazy from django.contrib.auth.views import login from django.contrib.auth.decorators import login_required from author import views urlpatterns = patt...
from django.conf.urls import patterns from django.conf.urls import url from django.views.generic.base import RedirectView from django.core.urlresolvers import reverse_lazy from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import Permission from django.contrib.auth.views import l...
Add permission checks in author app
Add permission checks in author app
Python
bsd-3-clause
stefantsov/blackbox3,stefantsov/blackbox3,stefantsov/blackbox3
69029424035c8506a46b94422fd347871ee51269
accelerator/tests/factories/program_family_factory.py
accelerator/tests/factories/program_family_factory.py
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from __future__ import unicode_literals import swapper from factory import ( DjangoModelFactory, Sequence, ) from accelerator.apps import AcceleratorConfig ProgramFamily = swapper.load_model(AcceleratorConfig.name, 'ProgramFamily') class ProgramFamily...
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from __future__ import unicode_literals import swapper from factory import ( DjangoModelFactory, Sequence, ) from accelerator.apps import AcceleratorConfig ProgramFamily = swapper.load_model(AcceleratorConfig.name, 'ProgramFamily') class ProgramFamily...
Add new field to factory
Add new field to factory
Python
mit
masschallenge/django-accelerator,masschallenge/django-accelerator
3860e0a9ac99c4c4422630e4133bf3b35927bf41
conf_site/sponsorship/tests/__init__.py
conf_site/sponsorship/tests/__init__.py
import factory from symposion.schedule.tests.factories import ConferenceFactory from symposion.sponsorship.models import SponsorLevel, Sponsor class SponsorLevelFactory(factory.django.DjangoModelFactory): conference = factory.SubFactory(ConferenceFactory) name = factory.Faker("color_name") order = factor...
import factory from symposion.schedule.tests.factories import ConferenceFactory from symposion.sponsorship.models import SponsorLevel, Sponsor class SponsorLevelFactory(factory.django.DjangoModelFactory): conference = factory.SubFactory(ConferenceFactory) name = factory.Faker("color_name") order = factor...
Allow SponsorFactory to create active sponsors.
Allow SponsorFactory to create active sponsors.
Python
mit
pydata/conf_site,pydata/conf_site,pydata/conf_site
58321c0471f10169ea5c0f705cdb35825036d77f
cat_leds.py
cat_leds.py
#!/usr/bin/env python """Display standard input on LEDs.""" import sys import RPi.GPIO as GPIO from seven_segment import print_leds pins = [17, 23, 24, 22, 27, 25, 5] GPIO.setmode(GPIO.BCM) GPIO.setup(pins, GPIO.OUT) pipe_contents = sys.stdin.read() print_leds(pipe_contents, pins) GPIO.cleanup()
#!/usr/bin/env python """Display standard input on LEDs.""" import sys import RPi.GPIO as GPIO from seven_segment import print_leds pins = [6, 19, 5, 13, 20, 12, 16] GPIO.setmode(GPIO.BCM) GPIO.setup(pins, GPIO.OUT) pipe_contents = sys.stdin.read() print_leds(pipe_contents, pins, 1/2.0) GPIO.cleanup()
Set up for my new 7 seg display.
Set up for my new 7 seg display.
Python
mit
zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie
caaf8e40c99f410b09580b81c4fa7a094395319c
test/test_progress_bar.py
test/test_progress_bar.py
import pytest from downloads.download import _progress_bar @pytest.mark.parametrize( "current,block_size,total_size", [ ( 100, 32, 100 * 32, ), ( 75, 32, 100 * 32, ), ( 50, ...
import pytest from downloads.download import _progress_bar @pytest.mark.parametrize( "current,block_size,total_size", [ ( 100, 32, 100 * 32, ), ( 75, 32, 100 * 32, ), ( 50, ...
Test width of progress bar
Test width of progress bar
Python
mit
audy/downloads
f30d2f5b09ae3a62bff02165a173af6e25345a60
trevornet/nets/pynet/aimath.py
trevornet/nets/pynet/aimath.py
import math import sys def sigmoid(x): try: val = 1/(1 + math.exp(-x)) except OverflowError: val = sys.float_info.max return val def sigmoidprime(x): return (1 - sigmoid(x))*sigmoid(x)
import math import sys def sigmoid(x): try: val = 1/(1 + math.exp(-x)) except OverflowError: val = 0. return val def sigmoidprime(x): return (1 - sigmoid(x))*sigmoid(x)
Fix mistake in sigmoid function
Fix mistake in sigmoid function
Python
mit
tmerr/trevornet
4510a4a22965d002bd41293fd8fe629c8285800d
tests/test_errors.py
tests/test_errors.py
# coding: pyxl import pytest from pyxl.codec.register import pyxl_decode from pyxl.codec.parser import ParseError def test_malformed_if(): with pytest.raises(ParseError): pyxl_decode(b""" <frag> <if cond="{true}">foo</if> this is incorrect! <else...
# coding: pyxl import pytest from pyxl.codec.register import pyxl_decode from pyxl.codec.parser import ParseError from pyxl.codec.html_tokenizer import BadCharError def test_malformed_if(): with pytest.raises(ParseError): pyxl_decode(b""" <frag> <if cond="{true}">foo</if> ...
Add test for BadCharError exception.
Add test for BadCharError exception.
Python
apache-2.0
pyxl4/pyxl4
25e4730c4614a26cdecd60eb0846e69578353d2c
tomcrypt/__init__.py
tomcrypt/__init__.py
import os import ctypes # We need to manually load the _core SO the first time so that we can specify # that it use the RTLD_GLOBAL flag. Otherwise (when not on a Mac) the runtime # linker will not be able to resolve undefined symbols in the other modules. _core_handle = ctypes.CDLL( os.path.join(os.path.dirname(...
import ctypes class Error(ValueError): def __init__(self, *args, **kwargs): self.code = kwargs.get('code', -1) ValueError.__init__(self, *args) class LibError(Error): pass # We need to manually load the _core the first time so that we can specify # that it use the RTLD_GLOBAL flag. Otherwi...
Use import to locate _core
Linking: Use import to locate _core Related to #8
Python
bsd-3-clause
mikeboers/PyTomCrypt,mikeboers/PyTomCrypt,mikeboers/PyTomCrypt
b4ce1a023bf047524f40ac63f40d46a70c8f6f77
src/dirtyfields/dirtyfields.py
src/dirtyfields/dirtyfields.py
# Adapted from http://stackoverflow.com/questions/110803/dirty-fields-in-django from django.db.models.signals import post_save class DirtyFieldsMixin(object): def __init__(self, *args, **kwargs): super(DirtyFieldsMixin, self).__init__(*args, **kwargs) post_save.connect(reset_state, sender=self.__cl...
# Adapted from http://stackoverflow.com/questions/110803/dirty-fields-in-django from django.db.models.signals import post_save class DirtyFieldsMixin(object): def __init__(self, *args, **kwargs): super(DirtyFieldsMixin, self).__init__(*args, **kwargs) post_save.connect(reset_state, sender=self.__cl...
Check primary keys for foreign key and one-to-one fields
Check primary keys for foreign key and one-to-one fields
Python
bsd-3-clause
stanhu/django-dirtyfields
67ea33e9e46ff321c2915d46a354d66756ff9c2b
main.py
main.py
#!/usr/bin/env python """ This is the main file for a script that reads info off a game on kongregate.com and acts upon it. """ # import line/s for builtin modules # import pyautogui __author__ = "Alex Flores Escarcega" __copyright__ = "Copyright 2007, Alex Flores Escarcega" __credits__ = ["Alex Flores Escarcega"] __...
#!/usr/bin/env python """ This is the main file for a script that reads info off a game on kongregate.com and acts upon it. """ # import line/s for builtin modules # import pyautogui __author__ = "Alex Flores Escarcega" __copyright__ = "Copyright 2007, Alex Flores Escarcega" __credits__ = ["Alex Flores Escarcega"] __...
Add method to find the coordinates of game
Add method to find the coordinates of game
Python
mit
hydrophilicsun/Automating-Endless-Expansion
8b6daefb98c20ddb288604f7aa2202c21df2c526
main.py
main.py
__author__ = 'alex' print 45 print 54
_author__ = 'alex' import sys import xml.dom.minidom as dom def get_Res_Matrix(length,nodes,nets_d,elem_type): Res = [[[] for j in range(length)] for i in range(length)] for i in range(nodes.length): if nodes[i].nodeType != elem_type: continue name = nodes[i].nodeName if name == "diode"...
Read and parse xml to Matrix
Read and parse xml to Matrix
Python
mit
BaydinAlexey/proglangs_baydin,BaydinAlexey/proglangs_baydin
fa2fb3387912474eff2b6c2a14d6304fcf5cd1f8
erasmus/cogs/bible/testing_server_preferences_group.py
erasmus/cogs/bible/testing_server_preferences_group.py
from __future__ import annotations from typing import TYPE_CHECKING from botus_receptus.app_commands import test_guilds_only from discord import app_commands from .daily_bread.daily_bread_preferences_group import DailyBreadPreferencesGroup if TYPE_CHECKING: from ...erasmus import Erasmus from ...l10n import...
from __future__ import annotations from typing import TYPE_CHECKING from botus_receptus.app_commands import test_guilds_only from discord import app_commands from .daily_bread.daily_bread_preferences_group import DailyBreadPreferencesGroup if TYPE_CHECKING: from ...erasmus import Erasmus from ...l10n import...
Use serverprefs localizer for TestingServerPreferencesGroup
Use serverprefs localizer for TestingServerPreferencesGroup
Python
bsd-3-clause
bryanforbes/Erasmus
d044576e08e06dd6a2c68ab7868c281cd2979764
wsgi.py
wsgi.py
from app import create_app from credstash import getAllSecrets import os default_env_file = '/home/ubuntu/environment' environment = 'live' if os.path.isfile(default_env_file): with open(default_env_file, 'r') as environment_file: environment = environment_file.readline().strip() # on aws get secrets an...
from credstash import getAllSecrets import os default_env_file = '/home/ubuntu/environment' environment = 'live' if os.path.isfile(default_env_file): with open(default_env_file, 'r') as environment_file: environment = environment_file.readline().strip() # on aws get secrets and export to env os.environ....
Order of imports means the config doesn't get set up properly
Order of imports means the config doesn't get set up properly
Python
mit
gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin
f3ec0593bb67db25c4f5af4b3b00d82d5e4e0f04
csv2ofx/mappings/gls.py
csv2ofx/mappings/gls.py
from operator import itemgetter mapping = { 'has_header': True, 'currency': 'EUR', 'delimiter': ';', 'bank': 'GLS Bank', 'account': itemgetter('Kontonummer'), # Chop up the dotted German date format and put it in ridiculous M/D/Y order 'date': lambda r: r['Buchungstag'][3:5] + '/' ...
from __future__ import absolute_import from operator import itemgetter mapping = { 'has_header': True, 'currency': 'EUR', 'delimiter': ';', 'bank': 'GLS Bank', 'account': itemgetter('Kontonummer'), # Chop up the dotted German date format and put it in ridiculous M/D/Y order 'date': lambda ...
Add import for other python versions
Add import for other python versions
Python
mit
reubano/csv2ofx,reubano/csv2ofx
3e52078450a4205fdfaa2d4ba2448bce3d3d19d7
gpio_components/input_devices.py
gpio_components/input_devices.py
from RPi import GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) class InputDevice(object): def __init__(self, pin): self.pin = pin GPIO.setup(pin, GPIO.IN, GPIO.PUD_UP) def is_pressed(self): return GPIO.input(self.pin) == 0 class Button(InputDevice): pass
from RPi import GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) class InputDevice(object): def __init__(self, pin=None): if pin is None: raise InputDeviceError('No GPIO pin number given') self.pin = pin self.pull = GPIO.PUD_UP self.edge = GPIO.FALLING sel...
Add wait_for_input and add_callback methods to InputDevice
Add wait_for_input and add_callback methods to InputDevice
Python
bsd-3-clause
lurch/python-gpiozero,waveform80/gpio-zero,agiledata/python-gpiozero,Gadgetoid/python-gpiozero,cymplecy/python-gpioone,RPi-Distro/python-gpiozero,MrHarcombe/python-gpiozero
0a9f378784e8c30cdf16d4d1caaf3b98f112bb90
nap/meta.py
nap/meta.py
from __future__ import unicode_literals class Meta(object): '''Generic container for Meta classes''' def __new__(cls, meta=None): # Return a new class base on ourselves attrs = dict( (name, getattr(meta, name)) for name in dir(meta) if not name[0] == '_' ...
from __future__ import unicode_literals class Meta(object): '''Generic container for Meta classes''' def __new__(cls, meta=None): # Return a new class base on ourselves attrs = dict( (name, getattr(meta, name)) for name in dir(meta) if not name[0] == '_' and...
Make Meta class enforce only known properties
Make Meta class enforce only known properties
Python
bsd-3-clause
MarkusH/django-nap,limbera/django-nap
ea5bfe240cc349144e089f606534726863f2c21b
media/sites/lapinkansa.py
media/sites/lapinkansa.py
import requests from bs4 import BeautifulSoup def nouda( url , out ): r = requests.get( url ) r.encoding = 'UTF-8' soup = BeautifulSoup( r.text ) teksti = soup.find_all( class_ ='post-meta' ) for string in teksti[0].stripped_strings: out.write( string.encode('utf8') + ' ' ) if __name__ == '__main__'...
import requests from bs4 import BeautifulSoup def nouda( url , out ): r = requests.get( url ) r.encoding = 'UTF-8' soup = BeautifulSoup( r.text ) teksti = soup.find_all( class_ = 'news-excerpt' ) for string in teksti[0].stripped_strings: out.write( string.encode('utf8') + ' ' ) if __name__ == '__mai...
Fix to new page layout
Fix to new page layout
Python
mit
HIIT/digivaalit-2015,HIIT/digivaalit-2015,HIIT/digivaalit-2015
b21d63d8df7d17e150702c531ef449f409100eff
wot_clan_battles/views_auth.py
wot_clan_battles/views_auth.py
import six from django.http import HttpResponseRedirect from django.shortcuts import reverse from django.conf import settings from openid.consumer import consumer import wargaming wot = wargaming.WoT(settings.WARGAMING_KEY, language='ru', region='ru') def auth_callback(request): oidconsumer = consumer.Consume...
import six from django.http import HttpResponseRedirect from django.shortcuts import reverse from django.conf import settings from openid.consumer import consumer import wargaming wot = wargaming.WoT(settings.WARGAMING_KEY, language='ru', region='ru') def auth_callback(request): oidconsumer = consumer.Consume...
Remove debug print from view
Remove debug print from view
Python
mit
monester/wot-battles,monester/wot-battles,monester/wot-battles,monester/wot-battles
69a417c421d774c4998ae721b85211a60757ce85
fit_blackbody.py
fit_blackbody.py
import numpy as np from scipy.optimize import curve_fit from astropy import units as u from planck import planck_function def bb_flux(wavelength, temperature, angular_radius): bb_flux = (np.pi) * planck_function(wavelength, temperature) * (angular_radius)**2 return bb_flux def bb_flux_nounits(wavelength, tem...
import numpy as np from scipy.optimize import curve_fit from astropy import units as u from planck import planck_function, dplanck_dT def bb_flux(wavelength, temperature, angular_radius): bb_flux = (np.pi) * planck_function(wavelength, temperature) * (angular_radius)**2 return bb_flux def bb_flux_nounits(wav...
Add derivative of BB flux with temperature
Add derivative of BB flux with temperature Added functions which calculate the derivative of the blackbody flux with temperature (with units and without units)
Python
mit
JALusk/SNoBoL,JALusk/SuperBoL,JALusk/SNoBoL
fcc4eb6feaf05c950bcb0cb3f5861e631dacd8d4
migrations/versions/16ef0d8ffae1_add_user_roles.py
migrations/versions/16ef0d8ffae1_add_user_roles.py
"""Add user roles Revision ID: 16ef0d8ffae1 Revises: 8acb1453abb Create Date: 2015-03-17 15:45:05.406297 """ # revision identifiers, used by Alembic. revision = '16ef0d8ffae1' down_revision = '8acb1453abb' from alembic import op import sqlalchemy as sa from findaconf import db from findaconf.models import Group ...
"""Add user roles Revision ID: 16ef0d8ffae1 Revises: 8acb1453abb Create Date: 2015-03-17 15:45:05.406297 """ # revision identifiers, used by Alembic. revision = '16ef0d8ffae1' down_revision = '8acb1453abb' from alembic import op import sqlalchemy as sa from sqlalchemy.sql import table, column from findaconf.models...
Refactor data migration for Group model
Refactor data migration for Group model Undelying explanation as in commit f580a63909166efccc8030eb36d8b2fe697f7236
Python
mit
koorukuroo/findaconf,cuducos/findaconf,koorukuroo/findaconf,cuducos/findaconf,cuducos/findaconf,koorukuroo/findaconf
eddf3ec729fd385fd3ec2ec425db1d777a302e46
tensorprob/distributions/exponential.py
tensorprob/distributions/exponential.py
import tensorflow as tf from .. import config from ..distribution import Distribution @Distribution def Exponential(lambda_, name=None): X = tf.placeholder(config.dtype, name=name) Distribution.logp = tf.log(lambda_) - lambda_*X def cdf(lim): return tf.constant(1, dtype=config.dtype) - tf.exp(-...
import tensorflow as tf from .. import config from ..distribution import Distribution @Distribution def Exponential(lambda_, name=None): X = tf.placeholder(config.dtype, name=name) Distribution.logp = tf.log(lambda_) - lambda_*X def integral(lower, upper): return tf.exp(-lambda_*lower) - tf.exp...
Correct integral used for Exponential distributon
Correct integral used for Exponential distributon
Python
mit
ibab/tensorprob,tensorprob/tensorprob,ibab/tensorfit
56902792b2a7fdd25bd64781e9e98a63db2ee348
all/__init__.py
all/__init__.py
###---------------------------------------------------------------------------- from .help import HyperHelpCommand, HyperHelpNavigateCommand from .help import HyperHelpListener ###----------------------------------------------------------------------------
###---------------------------------------------------------------------------- __version_tuple = (1, 0, 0) __version__ = ".".join([str(num) for num in __version_tuple]) # These are exposed to Sublime to implement the core of the help system. from .help import HyperHelpCommand, HyperHelpNavigateCommand from .help im...
Include a package version number
Include a package version number This includes in the core package the concept of a version number that underlying code could use to determine what version of the core it is interfacing with. This is only really needed for packages that get at the underlying core code in hyperhelp, which at the moment would only be t...
Python
mit
OdatNurd/hyperhelp
28d48dd681dd20d839aa0748ee478947a0eb3da0
hiss/__init__.py
hiss/__init__.py
import pygame class Sprite(): def __init__(self, name): self.name = name self.costumes = [] def addCostume(self, costumePath): costume = pygame.image.load(costumePath) self.costumes.append(costume)
import pygame, time, random class Stage(): def __init__(self, name): self.name = name self.costumes = [] def addCostume(self, costumePath): costume = pygame.image.load(costumePath) self.costumes.append(costume) class Sprite(Stage): def __init__(self, name): ...
Split Sprite and Stage, begin code
Split Sprite and Stage, begin code The way I see it, sprites should be an extension of the stage. After all, the stage is like one big sprite that can't move. Also, begin code has been added.
Python
mit
PySlither/Slither,PySlither/Slither
eef8c0c99a6a02602cc9da75eadf180e65ad55b0
collectd_haproxy/__init__.py
collectd_haproxy/__init__.py
version_info = (1, 0, 1) __version__ = ".".join(map(str, version_info)) try: import collectd collectd_present = True except ImportError: collectd_present = False from .plugin import HAProxyPlugin if collectd_present: HAProxyPlugin.register(collectd)
try: import collectd collectd_present = True except ImportError: collectd_present = False from .plugin import HAProxyPlugin version_info = (1, 0, 1) __version__ = ".".join(map(str, version_info)) if collectd_present: HAProxyPlugin.register(collectd)
Fix style test complaing about non-top import.
Fix style test complaing about non-top import.
Python
mit
wglass/collectd-haproxy
342515edc89d6666a5dc9064de7d2ceea9a7b468
accelerator/tests/test_program_cycle.py
accelerator/tests/test_program_cycle.py
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from __future__ import unicode_literals from django.test import TestCase from accelerator.tests.factories import ProgramCycleFactory class TestProgramCycle(TestCase): def test_display_name_no_short_name(self): cycle = ProgramCycleFactory(short_name...
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from __future__ import unicode_literals from django.test import TestCase from accelerator.tests.factories import ProgramCycleFactory class TestProgramCycle(TestCase): def test_display_name_no_short_name(self): cycle = ProgramCycleFactory(short_name...
Add tests for the functionality added
[AC-7049] Add tests for the functionality added
Python
mit
masschallenge/django-accelerator,masschallenge/django-accelerator
8e10801ab28b3db02b301c27966aeaabc154329b
opps/core/models/image.py
opps/core/models/image.py
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from opps.core.models.publishable import Publishable class Image(Publishable): title = models.CharField(_(u"Title"), max_length=140) slug = models.SlugField(_(u"Slug"), max_length=150, blank=True) ...
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from opps.core.models.publishable import Publishable from opps.core.models import Source class Image(Publishable): title = models.CharField(_(u"Title"), max_length=140) slug = models.SlugField(_(u"S...
Change credit to source models
Change credit to source models
Python
mit
opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,opps/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps
6dd1881fc2631602d7e34aede208abf42ed688aa
renderMenu.py
renderMenu.py
#!/usr/bin/env python import json, os, requests from awsauth import S3Auth from datetime import datetime from pytz import timezone from flask import Flask, render_template, url_for from models import app, db, FoodMenu, FoodServices MIXPANEL_TOKEN = os.environ.get('MIXPANEL_TOKEN') @app.route('/') def renderMenu(): n...
#!/usr/bin/env python import json, os, requests from awsauth import S3Auth from datetime import datetime from pytz import timezone from flask import Flask, render_template, url_for, jsonify from models import app, db, FoodMenu, FoodServices MIXPANEL_TOKEN = os.environ.get('MIXPANEL_TOKEN') @app.route('/') def renderM...
Add API endpoints to serve data in JSON format.
Add API endpoints to serve data in JSON format.
Python
mit
alykhank/FoodMenu,alykhank/FoodMenu,alykhank/FoodMenu
3b79447e1027cc4965ab3272c34740b82d79c66c
tools/perf/benchmarks/start_with_url.py
tools/perf/benchmarks/start_with_url.py
# Copyright 2014 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 measurements import startup import page_sets from telemetry import benchmark @benchmark.Disabled class StartWithUrlCold(benchmark.Benchmark): """Mea...
# Copyright 2014 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 measurements import startup import page_sets from telemetry import benchmark @benchmark.Enabled('android', 'has tabs') class StartWithUrlCold(benchmar...
Enable statup_with_url.cold benchmark on android.
Enable statup_with_url.cold benchmark on android. The benchmark works locally, and collects an important datapoint for our current optimization work. Review URL: https://codereview.chromium.org/508303004 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#298526}
Python
bsd-3-clause
axinging/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,markYoungH/chromium.src,M4sse/chromium.src,markYoungH/chromium.src,jaruba/chromium.src,M4sse/chromium.src,chuan9/chromium-crosswalk,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,dushu1...
f177e6acbafa514f6e6ac4563cb92c49f3213618
data_structures/Stack/Python/Stack.py
data_structures/Stack/Python/Stack.py
# Author: AlexBanks97 # Purpose: LIFO Stack implementation using python array. # Date: October 15th 2017 class Stack(object): def __init__(self): # Initialize stack as empty array self.stack = []
# Author: AlexBanks97 # Purpose: LIFO Stack implementation using python array. # Date: October 15th 2017 class Stack(object): def __init__(self): # Initialize stack as empty array self.stack = [] # Return and remove the last element of the stack array. def pop(self): # If the stack...
Add pop method and implementation
Add pop method and implementation
Python
cc0-1.0
ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,Deepak345/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,manikTharaka/al-go-rithms,Deepak345/a...
e0ce0095fd488852a7d565ecaf49eba0b8dbd7d5
db/sql_server/pyodbc.py
db/sql_server/pyodbc.py
from django.db import connection from django.db.models.fields import * from south.db import generic class DatabaseOperations(generic.DatabaseOperations): """ django-pyodbc (sql_server.pyodbc) implementation of database operations. """ def create_table(self, table_name, fields): # Tweak stuff a...
from django.db import connection from django.db.models.fields import * from south.db import generic class DatabaseOperations(generic.DatabaseOperations): """ django-pyodbc (sql_server.pyodbc) implementation of database operations. """ add_column_string = 'ALTER TABLE %s ADD %s;' def create_ta...
Add column support for sql server
Add column support for sql server --HG-- extra : convert_revision : svn%3A69d324d9-c39d-4fdc-8679-7745eae9e2c8/trunk%40111
Python
apache-2.0
theatlantic/django-south,theatlantic/django-south
98405875fd8ec682caa04244a900e6ce9eac9acb
pavement.py
pavement.py
import sys from paver.easy import task, needs, path, sh, cmdopts, options from paver.setuputils import setup, install_distutils_tasks from distutils.extension import Extension from distutils.dep_util import newer sys.path.insert(0, path('.').abspath()) import version setup(name='microdrop-plugin-manager', vers...
import platform import sys from paver.easy import task, needs, path, sh, cmdopts, options from paver.setuputils import setup, install_distutils_tasks from distutils.extension import Extension from distutils.dep_util import newer sys.path.insert(0, path('.').abspath()) import version install_requires = ['configobj',...
Add pywin32 as Windows required package
[FIX] Add pywin32 as Windows required package
Python
bsd-3-clause
wheeler-microfluidics/mpm
f764e9e0f3cba7c387952fe8f19aa702825e8378
tests/test_core/test_server.py
tests/test_core/test_server.py
from mock import patch import sure # noqa from moto.server import main def test_wrong_arguments(): try: main(["name", "test1", "test2", "test3"]) assert False, ("main() when called with the incorrect number of args" " should raise a system exit") except SystemExit: ...
from mock import patch import sure # noqa from moto.server import main, create_backend_app, DomainDispatcherApplication def test_wrong_arguments(): try: main(["name", "test1", "test2", "test3"]) assert False, ("main() when called with the incorrect number of args" " should...
Add more test coverage for the server.
Add more test coverage for the server.
Python
apache-2.0
william-richard/moto,Affirm/moto,Brett55/moto,gjtempleton/moto,whummer/moto,Affirm/moto,rocky4570/moto,ZuluPro/moto,spulec/moto,Brett55/moto,gjtempleton/moto,okomestudio/moto,ZuluPro/moto,alexdebrie/moto,rouge8/moto,william-richard/moto,gjtempleton/moto,botify-labs/moto,braintreeps/moto,2rs2ts/moto,spulec/moto,okomestu...
54add3fa95ab450e5afcbbf7fe8a3205bfc5889c
indra/tests/test_reading_scripts_aws.py
indra/tests/test_reading_scripts_aws.py
import boto3 from os import path, chdir from subprocess import check_call from nose.plugins.attrib import attr from indra.tools.reading import submit_reading_pipeline as srp s3 = boto3.client('s3') HERE = path.dirname(path.abspath(__file__)) @attr('nonpublic') def test_normal_pmid_reading_call(): chdir(path...
import boto3 from os import path, chdir from subprocess import check_call from nose.plugins.attrib import attr from indra.tools.reading import submit_reading_pipeline as srp from indra.sources import sparser s3 = boto3.client('s3') HERE = path.dirname(path.abspath(__file__)) @attr('nonpublic') def test_normal_p...
Add test with currently known-stall sentance.
Add test with currently known-stall sentance.
Python
bsd-2-clause
bgyori/indra,pvtodorov/indra,pvtodorov/indra,sorgerlab/indra,sorgerlab/indra,sorgerlab/indra,pvtodorov/indra,bgyori/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/indra,johnbachman/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/belpy,sorgerlab/belpy,johnbachman/belpy,bgyori/indra
fbe78315efcbf646710da6bf7d6a9d6c26fa8645
bayesian_jobs/handlers/clean_postgres.py
bayesian_jobs/handlers/clean_postgres.py
from selinon import StoragePool from cucoslib.models import WorkerResult, Analysis from .base import BaseHandler class CleanPostgres(BaseHandler): """ Clean JSONB columns in Postgres """ def execute(self): s3 = StoragePool.get_connected_storage('S3Data') results = self.postgres.session.query...
from selinon import StoragePool from cucoslib.models import WorkerResult, Analysis from .base import BaseHandler class CleanPostgres(BaseHandler): """ Clean JSONB columns in Postgres """ def execute(self): s3 = StoragePool.get_connected_storage('S3Data') results = self.postgres.session.query...
Mark error flag if an object is not present on S3
Mark error flag if an object is not present on S3
Python
apache-2.0
fabric8-analytics/fabric8-analytics-jobs,fabric8-analytics/fabric8-analytics-jobs
435e8fc4d9ad8c071a96e37e483fcbc194a94fc6
tests/integration/files/file/base/_modules/runtests_decorators.py
tests/integration/files/file/base/_modules/runtests_decorators.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import import time # Import Salt libs import salt.utils.decorators def _fallbackfunc(): return False, 'fallback' def working_function(): ''' CLI Example: .. code-block:: bash ''' return True @salt.utils.decorato...
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import import time # Import Salt libs import salt.utils.decorators def _fallbackfunc(): return False, 'fallback' def working_function(): ''' CLI Example: .. code-block:: bash ''' return True @salt.utils.decorat...
Fix tests: add module function docstring
Fix tests: add module function docstring
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
75a70e31791c523da6bf6b0ce4409a77f2784ed5
byceps/services/user/transfer/models.py
byceps/services/user/transfer/models.py
""" byceps.services.user.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from typing import Optional from attr import attrs from ....typing import UserID @attrs(auto_attribs=True, frozen=True, slots=True) class Us...
""" byceps.services.user.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from dataclasses import dataclass from typing import Optional from ....typing import UserID @dataclass(frozen=True) class User: id: UserI...
Change user transfer model from `attrs` to `dataclass`
Change user transfer model from `attrs` to `dataclass`
Python
bsd-3-clause
m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
60a4da0ea090e95ad566743b5ceba874d051d8d9
pronto/serializers/obo.py
pronto/serializers/obo.py
import io from typing import BinaryIO, ClassVar from ._fastobo import FastoboSerializer from .base import BaseSerializer class OboSerializer(FastoboSerializer, BaseSerializer): format = "obo" def dump(self, file): writer = io.TextIOWrapper(file) try: # dump the header ...
import io from typing import BinaryIO, ClassVar from ._fastobo import FastoboSerializer from .base import BaseSerializer class OboSerializer(FastoboSerializer, BaseSerializer): format = "obo" def dump(self, file): writer = io.TextIOWrapper(file) try: # dump the header ...
Fix bug in OboSerializer` causing `Ontology.dump` to crash
Fix bug in OboSerializer` causing `Ontology.dump` to crash
Python
mit
althonos/pronto
e51d35545d038b5cb7035cc74f39e4a5c2b0756a
thinglang/execution/classes.py
thinglang/execution/classes.py
from thinglang.lexer.symbols.base import LexicalIdentifier class ThingInstance(object): def __init__(self, cls): self.cls = cls self.methods = { x.name: x for x in self.cls.children } self.members = {} def __contains__(self, item): return item in self.memb...
from thinglang.lexer.symbols.base import LexicalIdentifier class ThingInstance(object): def __init__(self, cls): self.cls = cls self.methods = { x.name: x for x in self.cls.children } self.members = {} def __contains__(self, item): return item in self.memb...
Fix bug in ThingInstace __setitem__
Fix bug in ThingInstace __setitem__
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
324f05e1cbffdad2da209a7ee515f1d9a32cf93b
main.py
main.py
#!/usr/bin/env python import sys import json from pprint import pprint try: import requests except ImportError: print( 'Script requires requests package. \n' 'You can install it by running "pip install requests"' ) exit() API_URL = 'http://jsonplaceholder.typicode.com/posts/' def get_...
#!/usr/bin/env python import sys import json from pprint import pprint try: import requests except ImportError: print( 'Script requires requests package. \n' 'You can install it by running "pip install requests"' ) exit() API_URL = 'http://jsonplaceholder.typicode.com/posts/' def get_...
Add message about starting loading data
Add message about starting loading data
Python
mit
sevazhidkov/rest-wrapper
42804d3182b9b7489583250856e31a8daaef5fa3
protolint/__init__.py
protolint/__init__.py
# -*- coding: utf-8 -*- """ protolint ~~~~~~~~~ """ from . import cli from . import linter from . import output __version__ = (1, 0, 0)
# -*- coding: utf-8 -*- """ protolint ~~~~~~~~~ """ __version__ = (1, 0, 0) from . import cli from . import linter from . import output
Fix CLI module during build
Fix CLI module during build
Python
mit
sgammon/codeclimate-protobuf,sgammon/codeclimate-protobuf
baa088e1e6cc503b9f0bcfbacf62327a6527550b
kmeldb/mounts.py
kmeldb/mounts.py
import os def get_fat_mounts(): fat_mounts = [] mounts = os.popen('mount') for line in mounts.readlines(): device, ign1, mount_point, ign2, filesystem, options = line.split() if 'fat' in filesystem: fat_mounts.append((mount_point, filesystem, device)) return fat_mounts de...
import os try: import psutil except ImportError: print('Falling back to parsing mounts output') HAVE_PSUTIL = False else: print('Using psutil') HAVE_PSUTIL = True def get_fat_mounts(): # global HAVE_PSUTIL # HAVE_PSUTIL = False fat_mounts = [] if HAVE_PSUTIL: partitions =...
Use psutil.disk_partitions to get FAT formatted partitions.
Use psutil.disk_partitions to get FAT formatted partitions.
Python
apache-2.0
chrrrisw/kmel_db,chrrrisw/kmel_db
d89e43c649aba78ac9722ca39f9e0c67be0cc897
precision/accounts/models.py
precision/accounts/models.py
from django.db import models # Create your models here.
from django.contrib.auth.models import AbstractUser from django.db import models from django.utils.translation import ugettext_lazy as _ class SchoolAdministrator(AbstractUser): pass
Add an simple abstract user model for school administrators which will be used later
Add an simple abstract user model for school administrators which will be used later
Python
mit
FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management,FreeCodeCampRoma/precision_school-management
4a29b5169524205bfa50a89379f4439d0de40296
refabric/context_managers.py
refabric/context_managers.py
from contextlib import contextmanager from fabric.context_managers import settings, hide from fabric.state import env @contextmanager def sudo(user=None): with settings(sudo_user=user or env.sudo_user or env.user, use_sudo=True): yield silent = lambda *h: settings(hide('commands', *h), warn_only=True) ...
from contextlib import contextmanager from fabric.context_managers import settings, hide from fabric.state import env from refabric.state import apply_role_definitions @contextmanager def sudo(user=None): with settings(sudo_user=user or env.sudo_user or env.user, use_sudo=True): yield @contextmanager d...
Add role context manager setting role and definitions
Add role context manager setting role and definitions
Python
mit
5monkeys/refabric
5748b1a7dc4a5be3b2b9da9959eabe586347078a
tensorflow_federated/python/program/value_reference.py
tensorflow_federated/python/program/value_reference.py
# Copyright 2021, The TensorFlow Federated Authors. # # 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 o...
# Copyright 2021, The TensorFlow Federated Authors. # # 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 o...
Update the Value Reference API to be more precise about the types of values being referenced.
Update the Value Reference API to be more precise about the types of values being referenced. PiperOrigin-RevId: 404647934
Python
apache-2.0
tensorflow/federated,tensorflow/federated,tensorflow/federated
622b81296b292035b970891cd259eaac113d20c1
apps/accounts/conf.py
apps/accounts/conf.py
from django.conf import settings # noqa from appconf import AppConf class AccountConf(AppConf): """ Custom settings for the account module. Mainly settings required for the login on the remote system. """ PID = 3 LOGIN_TYPE = 'login' LOGIN_SUCCESS_URL = 'home' ENFORCE_LOGIN_TIMEOUT = ...
from django.conf import settings # noqa from appconf import AppConf class AccountConf(AppConf): """ Custom settings for the account module. Mainly settings required for the login on the remote system. """ PID = 3 LOGIN_TYPE = 'login' LOGIN_SUCCESS_URL = 'home' ENFORCE_LOGIN_TIMEOUT = ...
Change internal name of UNCCD role back to previous correct value
Change internal name of UNCCD role back to previous correct value
Python
apache-2.0
CDE-UNIBE/qcat,CDE-UNIBE/qcat,CDE-UNIBE/qcat,CDE-UNIBE/qcat
6e3151cd9e4c5309959c93b2ed683bb74d88a640
backend/breach/tests/test_sniffer.py
backend/breach/tests/test_sniffer.py
from mock import patch from django.test import TestCase from breach.sniffer import Sniffer class SnifferTest(TestCase): def setUp(self): self.endpoint = 'http://localhost' self.sniffer = Sniffer(self.endpoint) self.source_ip = '147.102.239.229' self.destination_host = 'dionyziz.c...
from mock import patch from django.test import TestCase from breach.sniffer import Sniffer class SnifferTest(TestCase): def setUp(self): self.endpoint = 'http://localhost' self.sniffer = Sniffer(self.endpoint, '147.102.239.229', 'dionyziz.com', 'wlan0', '8080') @patch('breach.sniffer.request...
Migrate Sniffer unit test to new API
Migrate Sniffer unit test to new API
Python
mit
esarafianou/rupture,esarafianou/rupture,dimriou/rupture,dimriou/rupture,dimkarakostas/rupture,dimriou/rupture,esarafianou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,esarafianou/rupture,dionyziz/rupture,dionyziz/rupture,dionyziz/rupture,dionyziz/rupture,dimriou/rupture,dimriou/rupture,dionyziz/rupture,dimkarako...
15e713f76f1fbfef26d9a7d3d3c95fac2d8f213e
casepro/settings_production_momza.py
casepro/settings_production_momza.py
from __future__ import unicode_literals import os # import our default settings from settings_production import * # noqa PODS[0]['contact_id_fieldname'] = os.environ.get( # noqa: F405 'REGISTRATION_CONTACT_ID_FIELDNAME', 'registrant_id', ) PODS[0]['field_mapping'] = [ # noqa: F405 {"field": "msisdn_re...
from __future__ import unicode_literals import os # import our default settings from settings_production import * # noqa PODS[0]['contact_id_fieldname'] = os.environ.get( # noqa: F405 'REGISTRATION_CONTACT_ID_FIELDNAME', 'registrant_id', ) PODS[0]['field_mapping'] = [ # noqa: F405 {"field": "faccode",...
Remove cell number and language from pod
Remove cell number and language from pod We started using the identity store and the hub to fetch this information, but unfortunately the field names are different depending on which service the info is coming from. These 2 fields are already displayed in the CasePro interface so it makes sense to not use the pod at ...
Python
bsd-3-clause
praekelt/casepro,praekelt/casepro,praekelt/casepro
7bf391e772cbece78b521f1e357ced4bef6908f4
bin/upload_version.py
bin/upload_version.py
#!python import os import sys import json import requests if __name__ == '__main__': version = sys.argv[1] filepath = sys.argv[2] filename = filepath.split('/')[-1] github_token = os.environ['GITHUB_TOKEN'] auth = (github_token, 'x-oauth-basic') commit_sha = os.environ['CIRCLE_SHA1'] params = json.dumps...
#!python import os import sys import json import requests if __name__ == '__main__': version = sys.argv[1] filepath = sys.argv[2] filename = filepath.split('/')[-1] github_token = os.environ['GITHUB_TOKEN'] auth = (github_token, 'x-oauth-basic') commit_sha = os.environ['CIRCLE_SHA1'] params = json.dumps...
Set automatic releases as 'prerelease'.
Set automatic releases as 'prerelease'.
Python
bsd-2-clause
pubnative/redash,pubnative/redash,imsally/redash,hudl/redash,denisov-vlad/redash,M32Media/redash,chriszs/redash,easytaxibr/redash,M32Media/redash,jmvasquez/redashtest,crowdworks/redash,pubnative/redash,ninneko/redash,hudl/redash,denisov-vlad/redash,amino-data/redash,EverlyWell/redash,imsally/redash,vishesh92/redash,44p...
694ea053fe87e4811acf0dde47826fec3eb1c9f7
source/run.py
source/run.py
import asyncio import time from autoreiv import AutoReiv def main(): while True: bot = AutoReiv() bot.load() try: bot.run(bot.config.get('login'), bot.config.get('password')) except Exception as e: print('* Crashed with error: {}'.format(e)) finally: print('* Disconnected.') asyncio.set_event_...
import asyncio import time from autoreiv import AutoReiv def main(): while True: bot = AutoReiv() bot.load() try: bot.run(bot.config.get('login'), bot.config.get('password')) except Exception as e: print('* Crashed with error: {}'.format(e)) finally: if not bot.is_closed: bot.close() prin...
Make sure the event loop gets closed on disconnect
Make sure the event loop gets closed on disconnect
Python
mit
diath/AutoReiv
27efc29b76ff0a65cd5ff12360701ca61231f53f
examples/thread_pool.py
examples/thread_pool.py
from diesel import quickstart, sleep from diesel.util.pool import ThreadPool from diesel.protocols.http import HttpClient, HttpHeaders import random def handle_it(i): print 'S', i sleep(random.random()) print 'E', i def c(): for x in xrange(0, 20): yield x make_it = c().next threads = Thread...
from diesel import quickstart, sleep, quickstop from diesel.util.pool import ThreadPool import random def handle_it(i): print 'S', i sleep(random.random()) print 'E', i def c(): for x in xrange(0, 20): yield x make_it = c().next def stop_it(): quickstop() threads = ThreadPool(10, handle...
Clean it up with a finalizer.
Clean it up with a finalizer.
Python
bsd-3-clause
dieseldev/diesel
e5a872bd128e6b3ea3cc82df4094d41843148bce
runtests.py
runtests.py
#!/usr/bin/env python import sys from os.path import abspath, dirname from django.conf import settings import django sys.path.insert(0, abspath(dirname(__file__))) if not settings.configured: settings.configure( INSTALLED_APPS=( 'django.contrib.contenttypes', 'django.contrib.ses...
#!/usr/bin/env python import sys from os.path import abspath, dirname from django.conf import settings import django sys.path.insert(0, abspath(dirname(__file__))) if not settings.configured: settings.configure( INSTALLED_APPS=( 'django.contrib.contenttypes', 'django.contrib.ses...
Add AuthenticationMiddleware to tests (for 1.7)
Add AuthenticationMiddleware to tests (for 1.7)
Python
mit
treyhunner/django-email-log,treyhunner/django-email-log
5a4e8ec1179b2ae3b37190ea45fb0d72ce4d7a90
canopen/sync.py
canopen/sync.py
class SyncProducer(object): """Transmits a SYNC message periodically.""" #: COB-ID of the SYNC message cob_id = 0x80 def __init__(self, network): self.network = network self.period = None self._task = None def transmit(self): """Send out a SYNC message once.""" ...
class SyncProducer(object): """Transmits a SYNC message periodically.""" #: COB-ID of the SYNC message cob_id = 0x80 def __init__(self, network): self.network = network self.period = None self._task = None def transmit(self, count=None): """Send out a SYNC messag...
Allow specifying counter in SYNC message
Allow specifying counter in SYNC message Addresses #63
Python
mit
christiansandberg/canopen,christiansandberg/canopen
91bf74104c0eee2ca3d8d4fdd293390daf173166
checker/main.py
checker/main.py
#!/usr/bin/env python import os import sys import subprocess import getopt class Chdir: def __init__(self, newPath): self.savedPath = os.getcwd() os.chdir(newPath) class Checker: def __init__(self, path): self.path = path def get_jobs(self): Chdir(self.path) jobs...
#!/usr/bin/env python import os import sys import subprocess import getopt class Checker: def __init__(self, path): if not os.path.isdir(path): sys.exit(1); self.path = os.path.realpath(path) self.jobs = self.getExecutableFiles(self.path) def getExecutableFiles(self,path)...
Streamline the filesystem looping code.
Streamline the filesystem looping code.
Python
mit
bsuweb/checker
a32f7cab9ce32c1c2169b55b1e37957a093e47f8
collect_district_court_case_details.py
collect_district_court_case_details.py
import datetime import pymongo import os from courtreader import readers # Connect to database client = pymongo.MongoClient(os.environ['DISTRICT_DB']) db = client.va_district_court_cases # Connect to District Court Reader reader = readers.DistrictCourtReader() reader.connect() # Fill in cases while True: case = ...
import datetime import pymongo import os import sys from courtreader import readers # Connect to database client = pymongo.MongoClient(os.environ['DISTRICT_DB']) db = client.va_district_court_cases # Connect to District Court Reader reader = readers.DistrictCourtReader() reader.connect() # Fill in cases while True: ...
Set FIPS code from command line
Set FIPS code from command line
Python
mit
bschoenfeld/va-court-scraper,bschoenfeld/va-court-scraper
e0e2b4fc60a945e9680c171109fd1cbb6f21e304
celery/run_carrizo.py
celery/run_carrizo.py
import dem import tasks from celery import * carrizo = dem.DEMGrid('tests/data/carrizo.tif') d = 100 max_age = 10**3.5 age_step = 1 num_ages = max_age/age_step num_angles = 180 ages = np.linspace(0, max_age, num=num_ages) angles = np.linspace(-np.pi/2, np.pi/2, num=num_angles) template_fits = [tasks.match_template.s...
import dem import tasks from celery import * carrizo = dem.DEMGrid('tests/data/carrizo.tif') d = 100 max_age = 10**3.5 age_step = 1 num_ages = max_age/age_step num_angles = 180 ages = np.linspace(0, max_age, num=num_ages) angles = np.linspace(-np.pi/2, np.pi/2, num=num_angles) template_fits = [tasks.match_template.s...
Add test script for Carrizo data
Add test script for Carrizo data
Python
mit
stgl/scarplet,rmsare/scarplet
d2b4810d74364394e7e7ecf8f8c5b1011a250f77
notescli/commands.py
notescli/commands.py
import config import cliparser import indexer import io import os def command_ls(index): with index.index.searcher() as searcher: results = searcher.documents() print "Indexed files:" for result in results: print result["filename"] def command_view(index, query): result_file = indexer.find_resul...
import config import cliparser import indexer import io import os def command_ls(index): print "Indexed files:" for filename in index.list_files(): print filename def command_view(index, query): result_file = indexer.find_result(index.index, query) if result_file is None: print "No results found" el...
Replace implementation of ls by using the indexer
Replace implementation of ls by using the indexer
Python
mit
phss/notes-cli
a5b4a657a1717e2fb9e4c53f93b5232dd58a1c68
shop_richcatalog/views.py
shop_richcatalog/views.py
from shop.views import ShopListView, ShopDetailView from shop_richcatalog.models import Catalog from shop.models import Product class CatalogListView(ShopListView): ''' TODO. ''' model = Catalog #generic_template = "shop_richcatalog/catalog_list.html" class CatalogDetailView(ShopDetailView): ...
from shop.views import ShopListView, ShopDetailView from shop_richcatalog.models import Catalog from shop.models import Product class CatalogListView(ShopListView): ''' Display all catalogs in a tree. ''' model = Catalog class CatalogDetailView(ShopDetailView): ''' Display detailed catalog ...
Document the view classes and make fix their spacing for pep8.
Document the view classes and make fix their spacing for pep8.
Python
bsd-3-clause
nimbis/django-shop-richcatalog,nimbis/django-shop-richcatalog
9639eb34f53444387621ed0a27ef9b273b38df79
slackclient/_slackrequest.py
slackclient/_slackrequest.py
import json import requests import six class SlackRequest(object): @staticmethod def do(token, request="?", post_data=None, domain="slack.com"): ''' Perform a POST request to the Slack Web API Args: token (str): your authentication token request (str): the me...
import json import requests import six class SlackRequest(object): @staticmethod def do(token, request="?", post_data=None, domain="slack.com"): ''' Perform a POST request to the Slack Web API Args: token (str): your authentication token request (str): the me...
Fix bug preventing API calls requiring a file ID
Fix bug preventing API calls requiring a file ID For example, an API call to files.info takes a file ID argument named "file", which was stripped out by this call. Currently, there is only one request type that accepts file data (files.upload). Every other use of 'file' is an ID that aught to be contained in the reque...
Python
mit
slackhq/python-slackclient,slackapi/python-slackclient,slackapi/python-slackclient,slackapi/python-slackclient
2395d08c672250b5df273eb36415c8200dd7f801
tests/tests_twobody/test_mean_elements.py
tests/tests_twobody/test_mean_elements.py
import pytest from poliastro.twobody.mean_elements import get_mean_elements def test_get_mean_elements_raises_error_if_invalid_body(): body = "PlanetNine" with pytest.raises(ValueError) as excinfo: get_mean_elements(body) assert f"The input body '{body}' is invalid." in excinfo.exconly()
import pytest from poliastro.bodies import Sun from poliastro.twobody.mean_elements import get_mean_elements def test_get_mean_elements_raises_error_if_invalid_body(): body = Sun with pytest.raises(ValueError) as excinfo: get_mean_elements(body) assert f"The input body '{body}' is invalid." in e...
Add test for error check
Add test for error check
Python
mit
poliastro/poliastro
599811e2a80b6f123d3beeb8906c0b82e975da86
maintenancemode/views/defaults.py
maintenancemode/views/defaults.py
from django.template import Context, loader from maintenancemode import http def temporary_unavailable(request, template_name='503.html'): """ Default 503 handler, which looks for the requested URL in the redirects table, redirects if found, and displays 404 page if not redirected. Templates: `50...
from django.template import RequestContext, loader from maintenancemode import http def temporary_unavailable(request, template_name='503.html'): """ Default 503 handler, which looks for the requested URL in the redirects table, redirects if found, and displays 404 page if not redirected. Templates: ...
Use RequestContext instead of just Context.
Use RequestContext instead of just Context.
Python
bsd-3-clause
aarsan/django-maintenancemode,21strun/django-maintenancemode,shanx/django-maintenancemode,21strun/django-maintenancemode,shanx/django-maintenancemode,aarsan/django-maintenancemode
0983715cd2ee4eb3ac411e1ff24fa2e49df54eb5
src/manage.py
src/manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
#!/usr/bin/env python import os import sys if __name__ == "__main__": # Browsers doesn't use content negotiation using ETags with HTTP 1.0 servers # Force Django to use HTTP 1.1 when using the runserver command from wsgiref import simple_server simple_server.ServerHandler.http_version = "1.1" os....
Allow to tests ETags when using the runserver command
Allow to tests ETags when using the runserver command
Python
agpl-3.0
jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud
efebbe998ac67810f6e0f86b685ab18f1ccf2bda
nio_cli/commands/config.py
nio_cli/commands/config.py
from .base import Base import requests class Config(Base): """ Get basic nio info """ def __init__(self, options, *args, **kwargs): super().__init__(options, *args, **kwargs) self._resource = 'services' if self.options['services'] else 'blocks' self._resource_name = \ self....
from .base import Base import requests class Config(Base): """ Get basic nio info """ def __init__(self, options, *args, **kwargs): super().__init__(options, *args, **kwargs) self._resource = 'services' if self.options['services'] else 'blocks' self._resource_name = \ self....
Remove additional http get request
Remove additional http get request
Python
apache-2.0
nioinnovation/nio-cli,neutralio/nio-cli
2a1a5073e069b1fbf5b7803417b59339ec72d026
netdisco/discoverables/belkin_wemo.py
netdisco/discoverables/belkin_wemo.py
""" Discovers Belkin Wemo devices. """ from . import SSDPDiscoverable class Discoverable(SSDPDiscoverable): """ Adds support for discovering Belkin WeMo platform devices. """ def info_from_entry(self, entry): """ Returns most important info from a uPnP entry. """ device = entry.description['...
""" Discovers Belkin Wemo devices. """ from . import SSDPDiscoverable class Discoverable(SSDPDiscoverable): """ Adds support for discovering Belkin WeMo platform devices. """ def info_from_entry(self, entry): """ Returns most important info from a uPnP entry. """ device = entry.description['...
Add MAC address to wemo discovery attributes
Add MAC address to wemo discovery attributes
Python
mit
sfam/netdisco,brburns/netdisco,balloob/netdisco
8900aa1b47449bd6ad204725c3a98f75e17eb3ba
python/array_manipulation.py
python/array_manipulation.py
#!/bin/python3 import math import os import random import re import sys def arrayManipulation(n, queries): # An array used to capture the difference of an element # compared to the previous element. # Therefore the value of diffs[n] after all array manipulations is # the cumulative sum of values from...
#!/bin/python3 import math import os import random import re import sys def arrayManipulation(n, queries): diffs = getArrayOfDiffs(n, queries) return maxFromDiffs(diffs) def maxFromDiffs(diffs): sumSoFar = 0 maxSoFar = 0 for diff in diffs: sumSoFar += diff if sumSoFar > maxSoFar:...
Refactor into getArrayOfDiffs and maxFromDiffs
Refactor into getArrayOfDiffs and maxFromDiffs
Python
mit
rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank
e8584f4193658399ea9bb2317915caff78fce88b
corehq/apps/commtrack/management/commands/update_supply_point_locations.py
corehq/apps/commtrack/management/commands/update_supply_point_locations.py
from django.core.management.base import BaseCommand from casexml.apps.case.models import CommCareCase from corehq.util.couch import iter_update, DocUpdate class Command(BaseCommand): help = ("Make sure all supply point cases have their owner_id set " "to the location_id") def handle(self, *args, ...
from xml.etree import ElementTree from django.core.management.base import BaseCommand from casexml.apps.case.mock import CaseBlock from casexml.apps.case.models import CommCareCase from dimagi.utils.chunked import chunked from dimagi.utils.couch.database import iter_docs from corehq.apps.domain.models import Domain f...
Use CaseBlocks to update case owner_ids
Use CaseBlocks to update case owner_ids
Python
bsd-3-clause
dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq
553731a0ea12a8303076dc3d83bfbba91e6bc3e8
scripts/merge_duplicate_users.py
scripts/merge_duplicate_users.py
from django.db.models.functions import Lower from django.db.models import Count from bluebottle.members.models import Member from bluebottle.clients.models import Client from bluebottle.clients.utils import LocalTenant from bluebottle.activities.models import Activity, Contributor from bluebottle.initiatives.models ...
from django.db.models.functions import Lower from django.db.models import Count from bluebottle.members.models import Member from bluebottle.clients.models import Client from bluebottle.clients.utils import LocalTenant from bluebottle.activities.models import Activity, Contributor from bluebottle.initiatives.models ...
Make sure we remember to which the user was merged
Make sure we remember to which the user was merged
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
2ca3f28b4423fc8ecd19591a039b7a5c814ab25b
webserver/codemanagement/validators.py
webserver/codemanagement/validators.py
from django.core.validators import RegexValidator sha1_validator = RegexValidator(regex="^[a-f0-9]{40}$", message="Must be valid sha1 sum") tag_validator = RegexValidator(regex="^[A-Za-z][\w\-\.]+[A-Za-z]$", message="Must be letters and numbers" + ...
from django.core.validators import RegexValidator from django.core.exceptions import ValidationError from dulwich.repo import check_ref_format import re sha1_validator = RegexValidator(regex="^[a-f0-9]{40}$", message="Must be valid sha1 sum") tag_regex = re.compile(r'^[A-Za-z][\w\-\.]+...
Make dulwich check the tag.
Make dulwich check the tag.
Python
bsd-3-clause
siggame/webserver,siggame/webserver,siggame/webserver
290bf5b5e577673a15e9a71033a5df2704ccff7a
opencademy/model/openacademy_session.py
opencademy/model/openacademy_session.py
# -*- coding: utf-8 -*- from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") in...
# -*- coding: utf-8 -*- from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") ...
Add domain or and ilike
[REF] openacademy: Add domain or and ilike
Python
apache-2.0
LihanHA/opencademy-project
42b69fdb0d9267c339200185feddefb430aea6ae
geartracker/admin.py
geartracker/admin.py
from django.contrib import admin from geartracker.models import * class ItemAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("make", "model", "size")} list_display = ('__unicode__', 'type', 'metric_weight', 'acquired') list_filter = ('archived', 'category', 'type', 'make', 'tags') search_field...
from django.contrib import admin from geartracker.models import * class ItemAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("make", "model", "size")} list_display = ('__unicode__', 'type', 'metric_weight', 'acquired') list_filter = ('archived', 'category', 'type', 'make') search_fields = ('ma...
Remove tags from list_filter and filter_horizontal
Remove tags from list_filter and filter_horizontal
Python
bsd-3-clause
pigmonkey/django-geartracker
2a6399a74110b6a9e0d48349c68775986c13a579
pyservice/context.py
pyservice/context.py
""" RequestContext stores state relevant to the current request, as well as keeping track of the plugin execution order and providing a simple method `advance` for calling the next plugin in the chain. """ import collections class Container(collections.defaultdict): DEFAULT_FACTORY = lambda: None def __init_...
""" RequestContext stores state relevant to the current request, as well as keeping track of the plugin execution order and providing a simple method `advance` for calling the next plugin in the chain. """ import ujson import collections class Container(collections.defaultdict): DEFAULT_FACTORY = lambda: None ...
Create class for request process recursion
Create class for request process recursion
Python
mit
numberoverzero/pyservice
cd342448675f3174bf74118de0447c1b0f169f3e
python/volumeBars.py
python/volumeBars.py
#!/usr/bin/env python from rgbmatrix import RGBMatrix from random import randint import numpy import math import time rows = 16 chains = 1 parallel = 1 ledMatrix = RGBMatrix(rows, chains, parallel) height = ledMatrix.height width = ledMatrix.width barWidth = width / 16 pi = numpy.pi barHeights = numpy.empty([16]) for...
#!/usr/bin/env python from rgbmatrix import RGBMatrix from random import randint import numpy import math import time rows = 16 chains = 1 parallel = 1 ledMatrix = RGBMatrix(rows, chains, parallel) height = ledMatrix.height width = ledMatrix.width barWidth = width / 16 pi = numpy.pi barHeights = numpy.empty([16]) for...
Create a more random function
Create a more random function
Python
mit
DarkAce65/rpi-led-matrix,DarkAce65/rpi-led-matrix
6c6021cd1a206a91432da096400358e5eb0255fe
nasa_data.py
nasa_data.py
import requests import os def get_apod(): os.makedirs("APODs", exist_ok=True) try: apod_data = requests.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY").json() image_url = apod_data["url"] if image_url.endswith(".gif"): raise TypeError image_data = requ...
import requests import os def get_apod(): os.makedirs("APODs", exist_ok=True) try: # check if website is accessible apod_data = requests.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY") apod_data.raise_for_status() apod_data = apod_data.json() # check if i...
Update 0.7.0 - specified try-block to check the status - changed except block - allowed .gif format but only up to 3MP (Twitter limitation)
Update 0.7.0 - specified try-block to check the status - changed except block - allowed .gif format but only up to 3MP (Twitter limitation)
Python
mit
FXelix/space_facts_bot
b702569c800953eb3476c927fbc1085e67c88dbd
ghettoq/messaging.py
ghettoq/messaging.py
from Queue import Empty from itertools import cycle class Queue(object): def __init__(self, backend, name): self.name = name self.backend = backend def put(self, payload): self.backend.put(self.name, payload) def get(self): payload = self.backend.get(self.name) i...
from Queue import Empty from itertools import cycle class Queue(object): def __init__(self, backend, name): self.name = name self.backend = backend def put(self, payload): self.backend.put(self.name, payload) def get(self): payload = self.backend.get(self.name) i...
Raise QueueEmpty when all queues has been tried.
QueueSet: Raise QueueEmpty when all queues has been tried.
Python
bsd-3-clause
ask/ghettoq
e4275c4f1a408dd9f8095bef4ed650ccc54401e9
packages/mono-llvm-2-10.py
packages/mono-llvm-2-10.py
GitHubTarballPackage ('mono', 'llvm', '2.10', '943edbc1a93df204d687d82d34d2b2bdf9978f4e', configure = 'CFLAGS="-m32" CPPFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32" ./configure --prefix="%{prefix}" --enable-optimized --enable-targets="x86 x86_64" --target=i386-apple-darwin10.8.0', override_properties = { 'make': 'make...
GitHubTarballPackage ('mono', 'llvm', '2.10', '943edbc1a93df204d687d82d34d2b2bdf9978f4e', configure = './configure --prefix="%{prefix}" --enable-optimized --enable-targets="x86 x86_64" --target=i386-apple-darwin10.8.0', override_properties = { 'make': 'make' } )
Fix llvm so it doesn't corrupt the env when configuring itself
Fix llvm so it doesn't corrupt the env when configuring itself
Python
mit
BansheeMediaPlayer/bockbuild,mono/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild
979aada6964a5c8ef1f5c787ce84d72420626901
migrations/versions/36cbde703cc0_add_build_priority.py
migrations/versions/36cbde703cc0_add_build_priority.py
"""Add Build.priority Revision ID: 36cbde703cc0 Revises: fe743605e1a Create Date: 2014-10-06 10:10:14.729720 """ # revision identifiers, used by Alembic. revision = '36cbde703cc0' down_revision = 'fe743605e1a' from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('build', sa.Column('prio...
"""Add Build.priority Revision ID: 36cbde703cc0 Revises: fe743605e1a Create Date: 2014-10-06 10:10:14.729720 """ # revision identifiers, used by Alembic. revision = '36cbde703cc0' down_revision = '2c6662281b66' from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('build', sa.Column('pri...
Update build priority down revision
Update build priority down revision 2c6662281b66
Python
apache-2.0
dropbox/changes,dropbox/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes
c0e00f3caf12ad95bc753e65fc3721623c552aa0
diceware.py
diceware.py
from random import randint def sysrand(sides=6, rolls=5): return ''.join(map(str, [randint(1, sides) for i in range(rolls)])) def randorg(sides=6, rolls=5): raise NotImplemented def generate(suggestions=1, words=6, apikey=''): with open('diceware.wordlist.asc.txt', 'r') as f: wordlist = dict([map(str.strip, lin...
from __future__ import print_function from httplib import HTTPSConnection from random import randint from uuid import uuid4 import json, sys def sysrand(suggestions, words, rolls=5, sides=6, **kwargs): print('sysrand', file=sys.stderr) for i in range(suggestions): yield [''.join(map(str, [randint(1...
Add random.org support for generating keys
Add random.org support for generating keys * Replace tabs with spaces (d'oh!) * Implement random key functions as generators so that we can retrieve numbers necessary for all suggestions in one request from random.org without burning through requests * Send a request to the random.org API and parse the response in...
Python
mit
darthmall/Alfred-Diceware-Workflow
62d5c5b2bf33a228938924a44e229f2f2cb4e02c
registrasion/urls.py
registrasion/urls.py
from django.conf.urls import url, include, patterns urlpatterns = patterns( "registrasion.views", url(r"^category/([0-9]+)$", "product_category", name="product_category"), url(r"^checkout$", "checkout", name="checkout"), url(r"^invoice/([0-9]+)$", "invoice", name="invoice"), url(r"^invoice/([0-9]+)...
from django.conf.urls import url, patterns urlpatterns = patterns( "registrasion.views", url(r"^category/([0-9]+)$", "product_category", name="product_category"), url(r"^checkout$", "checkout", name="checkout"), url(r"^invoice/([0-9]+)$", "invoice", name="invoice"), url(r"^invoice/([0-9]+)/pay$", "...
Revert "Registrasion URLs now include django-nested-admin"
Revert "Registrasion URLs now include django-nested-admin" This reverts commit 58eed33c429c1035801e840b41aa7104c02b9b5a.
Python
apache-2.0
chrisjrn/registrasion,chrisjrn/registrasion
b089522f108c9071013e0cc00813e29bc415595c
logbot/irc_client.py
logbot/irc_client.py
import irc.client import sys import os class IrcClient(object): def __init__(self, server, port, channel, bot_name): self.server = server self.port = port self.channel = channel self.bot_name = bot_name def start(self): self._client = irc.client.IRC() self._cli...
import irc.client import sys import os class IrcClient(object): def __init__(self, server, port, channel, bot_name): self.server = server self.port = port self.channel = channel self.bot_name = bot_name def start(self): self._client = irc.client.IRC() self._cli...
Add nick to the log
Add nick to the log
Python
mit
mlopes/LogBot
ced2be321f347f3e28e79e5cfac4e4a83f6b6819
fireplace/cards/blackrock/collectible.py
fireplace/cards/blackrock/collectible.py
from ..utils import * ## # Minions # Flamewaker class BRM_002: events = [ OWN_SPELL_PLAY.after(Hit(RANDOM_ENEMY_MINION, 1) * 2) ] ## # Spells # Solemn Vigil class BRM_001: action = [Draw(CONTROLLER) * 2] def cost(self, value): return value - self.game.minionsKilledThisTurn # Dragon's Breath class BRM_0...
from ..utils import * ## # Minions # Flamewaker class BRM_002: events = [ OWN_SPELL_PLAY.after(Hit(RANDOM_ENEMY_MINION, 1) * 2) ] # Imp Gang Boss class BRM_006: events = [ Damage(SELF).on(Summon(CONTROLLER, "BRM_006t")) ] ## # Spells # Solemn Vigil class BRM_001: action = [Draw(CONTROLLER) * 2] def c...
Implement Demonwrath and Imp Gang Boss
Implement Demonwrath and Imp Gang Boss
Python
agpl-3.0
smallnamespace/fireplace,Meerkov/fireplace,smallnamespace/fireplace,butozerca/fireplace,NightKev/fireplace,butozerca/fireplace,Ragowit/fireplace,amw2104/fireplace,Meerkov/fireplace,beheh/fireplace,liujimj/fireplace,liujimj/fireplace,oftc-ftw/fireplace,amw2104/fireplace,Ragowit/fireplace,jleclanche/fireplace,oftc-ftw/fi...
2959fa0a9f69cbfb7611bbc12488089921d26ab8
IPython/frontend/html/notebook/__init__.py
IPython/frontend/html/notebook/__init__.py
"""The IPython HTML Notebook""" # check for tornado 2.1.0 msg = "The IPython Notebook requires tornado >= 2.1.0" try: import tornado except ImportError: raise ImportError(msg) else: if tornado.version_info < (2,1,0): raise ImportError(msg+", but you have %s"%tornado.version) del msg
"""The IPython HTML Notebook""" # check for tornado 2.1.0 msg = "The IPython Notebook requires tornado >= 2.1.0" try: import tornado except ImportError: raise ImportError(msg) try: version_info = tornado.version_info except AttributeError: raise ImportError(msg + ", but you have < 1.1.0") if version_in...
Fix for tornado check for tornado < 1.1.0
Fix for tornado check for tornado < 1.1.0 Tornado < 1.1.0 does not have the ``version_info`` variable to check. Debian squeeze has tornado 1.0.1.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
fb256b042a485aefa2d9e45b39daa551a3f779ff
examples/open_file_dialog.py
examples/open_file_dialog.py
import webview import threading """ This example demonstrates creating an open file dialog. """ def open_file_dialog(): import time time.sleep(5) print(webview.create_file_dialog(webview.OPEN_DIALOG, allow_multiple=True)) if __name__ == '__main__': t = threading.Thread(target=open_file_dialog) t...
import webview import threading """ This example demonstrates creating an open file dialog. """ def open_file_dialog(): import time time.sleep(5) file_types = ('Image Files (*.bmp;*.jpg;*.gif)', 'All files (*.*)') print(webview.create_file_dialog(webview.OPEN_DIALOG, allow_multiple=True, file_types=f...
Modify example to include file_types param
[All] Modify example to include file_types param
Python
bsd-3-clause
r0x0r/pywebview,r0x0r/pywebview,shivaprsdv/pywebview,r0x0r/pywebview,shivaprsdv/pywebview,shivaprsdv/pywebview,shivaprsdv/pywebview,r0x0r/pywebview,r0x0r/pywebview
d1e5f55681eda2b2b358013ad5dca3a58619c914
pycom/objects.py
pycom/objects.py
# encoding: utf-8 ### Attribute Wrapper class AttrWrapper(object): attrs = [] def __setattr__(self, name, value): if name not in self.attrs: raise AttributeError("'%s' is not supported" % name) object.__setattr__(self, name, value) def __repr__(self): attrs = [] ...
# encoding: utf-8 ### Attribute Wrapper class AttrWrapper(object): attrs = [] def __setattr__(self, name, value): if name not in self.attrs: raise AttributeError("'%s' is not supported" % name) object.__setattr__(self, name, value) def __repr__(self): attrs = [] ...
Add the function to get the value of object, dict, list, or tuple.
Add the function to get the value of object, dict, list, or tuple.
Python
mit
xgfone/pycom,xgfone/xutils
482b8f7738da51c394969e526b37093d3c52d663
pyconkr/tests.py
pyconkr/tests.py
# -*- coding: utf-8 -*- from django.test import TestCase from django.http import HttpResponse from django.test import Client from django.core.urlresolvers import reverse_lazy, reverse from django.contrib.auth import get_user_model from pyconkr.helper import render_io_error User = get_user_model() class HelperFunct...
# -*- coding: utf-8 -*- from django.test import TestCase from django.http import HttpResponse from django.test import Client from django.core.urlresolvers import reverse_lazy, reverse from django.contrib.auth import get_user_model from pyconkr.helper import render_io_error User = get_user_model() class HelperFunct...
Add profile model signal test case
Add profile model signal test case
Python
mit
pythonkr/pyconapac-2016,pythonkr/pyconapac-2016,pythonkr/pyconapac-2016
ab99a515995e121944e0e7b355e8980984a2fd98
util.py
util.py
__author__ = 'zifnab' import string from passlib.hash import sha512_crypt import database from flask_login import login_user def random_string(size=10, chars=string.ascii_letters + string.digits): import random return ''.join(random.choice(chars) for x in range(size)) def create_user(**kwargs): username ...
__author__ = 'zifnab' import string from passlib.hash import sha512_crypt from random import SystemRandom import database from flask_login import login_user _random = SystemRandom() def random_string(size=10, chars=string.ascii_letters + string.digits): return ''.join(_random.choice(chars) for x in range(size)) ...
Use a cryptographically secure PRNG in random_string().
Use a cryptographically secure PRNG in random_string(). By default python uses a non-CS PRNG, so with some analysis, "random_string"s could be predicted.
Python
mit
zifnab06/zifb.in,zifnab06/zifb.in
2aa45922f7d018398e028c2aed964cf2ec00038a
bika/lims/browser/widgets/recordswidget.py
bika/lims/browser/widgets/recordswidget.py
from AccessControl import ClassSecurityInfo from Products.ATExtensions.widget import RecordsWidget as ATRecordsWidget from Products.Archetypes.Registry import registerWidget class RecordsWidget(ATRecordsWidget): security = ClassSecurityInfo() _properties = ATRecordsWidget._properties.copy() _properties.upd...
from AccessControl import ClassSecurityInfo from Products.ATExtensions.widget import RecordsWidget as ATRecordsWidget from Products.Archetypes.Registry import registerWidget class RecordsWidget(ATRecordsWidget): security = ClassSecurityInfo() _properties = ATRecordsWidget._properties.copy() _properties.upd...
Allow empty values in Records Widget
Allow empty values in Records Widget
Python
agpl-3.0
anneline/Bika-LIMS,veroc/Bika-LIMS,veroc/Bika-LIMS,veroc/Bika-LIMS,DeBortoliWines/Bika-LIMS,labsanmartin/Bika-LIMS,rockfruit/bika.lims,labsanmartin/Bika-LIMS,anneline/Bika-LIMS,rockfruit/bika.lims,DeBortoliWines/Bika-LIMS,anneline/Bika-LIMS,DeBortoliWines/Bika-LIMS,labsanmartin/Bika-LIMS
c088a28c9f7020cb64c25eb0e83dfdcd286015d3
app/assets.py
app/assets.py
from flask.ext.assets import Bundle app_css = Bundle( 'app.scss', 'map.scss', filters='scss', output='styles/app.css' ) app_js = Bundle( 'app.js', 'descriptor.js', 'map.js', 'resources.js', filters='jsmin', output='scripts/app.js' ) vendor_css = Bundle( 'vendor/semantic.mi...
from flask.ext.assets import Bundle app_css = Bundle( '*.scss', filters='scss', output='styles/app.css' ) app_js = Bundle( 'app.js', 'descriptor.js', 'map.js', 'resources.js', filters='jsmin', output='scripts/app.js' ) vendor_css = Bundle( 'vendor/semantic.min.css', output...
Generalize scss bundle to track all scss files
Generalize scss bundle to track all scss files
Python
mit
hack4impact/maps4all,hack4impact/asylum-connect-catalog,hack4impact/maps4all-jlc-sp2,hack4impact/maps4all,hack4impact/asylum-connect-catalog,hack4impact/asylum-connect-catalog,AsylumConnect/asylum-connect-catalog,hack4impact/maps4all,hack4impact/maps4all-jlc-sp2,hack4impact/maps4all-jlc-sp2,hack4impact/asylum-connect-c...
ddbc9624aacf9e15897bdfb46fc2016888db114b
git/pmstats2/get-pm-stats.py
git/pmstats2/get-pm-stats.py
#!/usr/bin/env python # get-pmstats.py # Henry J Schmale # November 25, 2017 # # Calculates the additions and deletions per day within a git repository # by parsing out the git log. It opens the log itself. # Produces output as a CSV import subprocess from datetime import datetime changes_by_date = {} git_log = subp...
#!/usr/bin/env python # get-pmstats.py # Henry J Schmale # November 25, 2017 # # Calculates the additions and deletions per day within a git repository # by parsing out the git log. It opens the log itself. # Produces output as a CSV import subprocess from datetime import datetime def chomp_int(val): try: ...
Fix script for repos with binaries
Fix script for repos with binaries
Python
mit
HSchmale16/UsefulScripts,HSchmale16/UsefulScripts,HSchmale16/UsefulScripts,HSchmale16/UsefulScripts,HSchmale16/UsefulScripts
c1a2a1052d215f9971c7bb1e580fd88ab0b395f8
background_hang_reporter_job/tracked.py
background_hang_reporter_job/tracked.py
class AllHangs(object): title = "All Hangs" @staticmethod def matches_hang(_): return True class DevtoolsHangs(object): title = "Devtools Hangs" @staticmethod def matches_hang(hang): #pylint: disable=unused-variable stack, duration, thread, runnable, process, annotatio...
class AllHangs(object): title = "All Hangs" @staticmethod def matches_hang(_): return True class DevtoolsHangs(object): title = "Devtools Hangs" @staticmethod def matches_hang(hang): #pylint: disable=unused-variable stack, duration, thread, runnable, process, annotatio...
Fix frame string check in devtools tracking
Fix frame string check in devtools tracking
Python
mit
squarewave/background-hang-reporter-job,squarewave/background-hang-reporter-job
a8596fd4a76460bd3e15509825d3cb3f82a3f8c4
test/integration/ggrc/converters/test_import_delete.py
test/integration/ggrc/converters/test_import_delete.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from ggrc.converters import errors from integration.ggrc import TestCase class TestBasicCsvImport(TestCase): def setUp(self): TestCase.setUp(self) self.client.get("/login") def test_policy_ba...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from integration.ggrc import TestCase class TestBasicCsvImport(TestCase): def setUp(self): TestCase.setUp(self) self.client.get("/login") def test_policy_basic_import(self): filename = "c...
Optimize basic delete import tests
Optimize basic delete import tests The dry-run check is now automatically performed on each import and we do not need to duplicate the work in the delete test.
Python
apache-2.0
selahssea/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core
9d10d279a1f7de2a5572229d68a7065fb9353ab9
linkedin_scraper/parsers/employment.py
linkedin_scraper/parsers/employment.py
from typing import Tuple from linkedin_scraper.parsers.base import BaseParser class EmploymentParser(BaseParser): def __init__(self): self.professions_list = self.get_lines_from_datafile( 'professions_list.txt') def parse(self, item: str) -> Tuple[str, str]: """ Parse Lin...
from typing import Tuple from linkedin_scraper.parsers.base import BaseParser class EmploymentParser(BaseParser): def __init__(self): self.professions_list = self.get_lines_from_datafile( 'professions_list.txt') def parse(self, item: str) -> Tuple[str, str]: """ Parse Lin...
Remove duplicated split call from EmploymentParser.
Remove duplicated split call from EmploymentParser.
Python
mit
nihn/linkedin-scraper,nihn/linkedin-scraper
650a4733aa6e15b80e2adeec34fc479a3b2885e3
src/cmdline/config.py
src/cmdline/config.py
import os import sys try: import pkg_resources d = pkg_resources.get_distribution('metermaid') pkg_locations = ( os.path.join(d.location, 'config'), os.path.join(os.path.dirname(d.location), 'config'), ) except ImportError: pkg_locations = () def get_config_paths(filename=None): ...
import os import sys try: import pkg_resources d = pkg_resources.get_distribution('metermaid') pkg_locations = ( os.path.join(d.location, 'config'), os.path.join(os.path.dirname(d.location), 'config'), ) except ImportError: pkg_locations = () def get_config_paths(filename=None): ...
Use etc relative to sys.prefix
Use etc relative to sys.prefix
Python
apache-2.0
rca/cmdline