commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
605cbe5c80b7fddd34c2d5e72952403742848564 | add count to UserESFake | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/es/fake/users_fake.py | corehq/apps/es/fake/users_fake.py | from corehq.pillows.user import transform_user_for_elasticsearch
from corehq.apps.es.fake.es_query_fake import HQESQueryFake
class UserESFake(HQESQueryFake):
_all_docs = []
def domain(self, domain):
return self._filtered(
lambda doc: (doc.get('domain') == domain
o... | from corehq.pillows.user import transform_user_for_elasticsearch
from corehq.apps.es.fake.es_query_fake import HQESQueryFake
class UserESFake(HQESQueryFake):
_all_docs = []
def domain(self, domain):
return self._filtered(
lambda doc: (doc.get('domain') == domain
o... | bsd-3-clause | Python |
191e38ee6f497740a439138b3ef9e5f245ab727b | Create StartupForm. | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | organizer/forms.py | organizer/forms.py | from django import forms
from django.core.exceptions import ValidationError
from .models import Startup, Tag
class StartupForm(forms.ModelForm):
class Meta:
model = Startup
fields = '__all__'
class TagForm(forms.ModelForm):
class Meta:
model = Tag
fields = '__all__'
def... | from django import forms
from django.core.exceptions import ValidationError
from .models import Tag
class TagForm(forms.ModelForm):
class Meta:
model = Tag
fields = '__all__'
def clean_name(self):
return self.cleaned_data['name'].lower()
def clean_slug(self):
new_slug = ... | bsd-2-clause | Python |
d88cd0713f0f3308e4c1d9898a807c74154ceade | Fix error in recorder in initial run | nknytk/home-recorder,nknytk/home-recorder | lib/recorder/recorderthread.py | lib/recorder/recorderthread.py | # coding: utf-8
import os
from json import loads
from threading import Thread
from time import sleep, time
class RecorderThread:
def __init__(self):
objname = self.__str__()
endidx = objname.find(' object at ')
startidx = objname.rfind('.', 0, endidx) + 1
self.recorder_name = objna... | # coding: utf-8
import os
from json import loads
from threading import Thread
from time import sleep, time
class RecorderThread:
def __init__(self):
objname = self.__str__()
endidx = objname.find(' object at ')
startidx = objname.rfind('.', 0, endidx) + 1
self.recorder_name = objna... | apache-2.0 | Python |
c392ab707a8bcd4fe2792f0bdc017e67f27fd0e1 | Replace Context with RequestContext. | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | organizer/views.py | organizer/views.py | from django.http.response import HttpResponse
from django.shortcuts import get_object_or_404
from django.template import RequestContext, loader
from .models import Tag
def homepage(request):
tag_list = Tag.objects.all()
template = loader.get_template(
'organizer/tag_list.html')
context = RequestC... | from django.http.response import HttpResponse
from django.shortcuts import get_object_or_404
from django.template import Context, loader
from .models import Tag
def homepage(request):
tag_list = Tag.objects.all()
template = loader.get_template(
'organizer/tag_list.html')
context = Context({'tag_l... | bsd-2-clause | Python |
add555b71888549bf0f0a27f4c5e0182e42b603e | Add CODE_OF_CONDUCT.md to boilerplate | Reproducible-Science-Curriculum/rr-literate-programming,Reproducible-Science-Curriculum/rr-automation,Reproducible-Science-Curriculum/rr-literate-programming,Reproducible-Science-Curriculum/rr-automation | bin/lesson_initialize.py | bin/lesson_initialize.py | #!/usr/bin/env python3
"""Initialize a newly-created repository."""
import sys
import os
import shutil
BOILERPLATE = (
'.travis.yml',
'AUTHORS',
'CITATION',
'CODE_OF_CONDUCT.md',
'CONTRIBUTING.md',
'README.md',
'_config.yml',
'_episodes/01-introduction.md',
'_extras/about.md',
... | #!/usr/bin/env python3
"""Initialize a newly-created repository."""
import sys
import os
import shutil
BOILERPLATE = (
'.travis.yml',
'AUTHORS',
'CITATION',
'CONTRIBUTING.md',
'README.md',
'_config.yml',
'_episodes/01-introduction.md',
'_extras/about.md',
'_extras/discuss.md',
... | cc0-1.0 | Python |
8b76f2834282ae2afde583129875f22c282839ba | fix fileid | jasonham/django-qcloud-cos | QcloudCos/cos_auth.py | QcloudCos/cos_auth.py | import random
import time
from urllib.parse import quote
import hmac
import hashlib
import binascii
import base64
class Auth(object):
def __init__(self, appid, SecretID, SecretKey, bucket, file='', currentTime='', expiredTime='', rand=''):
self.appid = appid
self.SecretID = SecretID
self.S... | import random
import time
from urllib.parse import quote
import hmac
import hashlib
import binascii
import base64
class Auth(object):
def __init__(self, appid, SecretID, SecretKey, bucket, file='', currentTime='', expiredTime='', rand=''):
self.appid = appid
self.SecretID = SecretID
self.S... | apache-2.0 | Python |
2a9787ff6cc604471893f13e30e7f6ca0003f6bc | Update parser-ssh.py | aaronkaplan/intelmq-old,aaronkaplan/intelmq-old,s4n7h0/intelmq,Phantasus/intelmq,aaronkaplan/intelmq-old | intelmq/bots/parsers/dragonresearchgroup/parser-ssh.py | intelmq/bots/parsers/dragonresearchgroup/parser-ssh.py | from intelmq.lib.bot import Bot, sys
from intelmq.lib.event import Event
from intelmq.bots import utils
class DragonResearchGroupSSHParserBot(Bot):
def process(self):
report = self.receive_message()
if report:
for row in report.split('\n'):
row = row.strip() ... | from intelmq.lib.bot import Bot, sys
from intelmq.lib.event import Event
from intelmq.bots import utils
class DragonResearchGroupSSHParserBot(Bot):
def process(self):
report = self.receive_message()
if report:
for row in report.split('\n'):
row = row.strip() ... | agpl-3.0 | Python |
4bbb04247a37c1b3c9e365db10a54b741381b028 | Update migration to use kwargs | erinspace/scrapi,felliott/scrapi,fabianvf/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,jeffreyliu3230/scrapi,mehanig/scrapi,ostwald/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,fabianvf/scrapi,alexgarciac/scrapi,erinspace/scrapi,icereval/scrapi | scrapi/migrations.py | scrapi/migrations.py | import logging
from scrapi import tasks
from scrapi import settings
from scrapi.linter import RawDocument
from scrapi.processing.elasticsearch import es
logger = logging.getLogger()
@tasks.task_autoretry(default_retry_delay=30, max_retries=5)
def rename(doc, **kwargs):
source = kwargs.get('source')
target =... | import logging
# import functools
from scrapi import tasks
from scrapi import settings
from scrapi.linter import RawDocument
from scrapi.processing.elasticsearch import es
logger = logging.getLogger()
@tasks.task_autoretry(default_retry_delay=30, max_retries=5)
def rename(doc, source=None, target=None, dry=True):
... | apache-2.0 | Python |
8110b5909f7c2b0b97ff68e086da65d117b77951 | Change of the Status Function | bittracker/krempelair,bittracker/krempelair,KrempelEv/krempelair,KrempelEv/krempelair,KrempelEv/krempelair,bittracker/krempelair | krempelair/views.py | krempelair/views.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import json
import smbus
from flask import request, render_template, current_app, url_for, make_response
from flask.views import View
from lib.bus.digitalOut import digiOut
def sys_status_betrieb():
""""""
pins = digiOut()
stateMsg = ... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import json
import smbus
from flask import request, render_template, current_app, url_for, make_response
from flask.views import View
from lib.bus.digitalOut import digiOut
def sys_status(address):
pins = digiOut()
try:
stateMsg =... | agpl-3.0 | Python |
5e5608367c43ab78dbf5f3473aedab3f5ebaa4b3 | kill better | cenkalti/kuyruk,cenkalti/kuyruk | kuyruk/test/util.py | kuyruk/test/util.py | import os
import sys
import signal
import logging
import subprocess
from time import sleep
from functools import partial
from contextlib import contextmanager
import pexpect
from ..connection import LazyConnection
from ..queue import Queue as RabbitQueue
logger = logging.getLogger(__name__)
def delete_queue(*queue... | import sys
import logging
import subprocess
from time import sleep
from functools import partial
from contextlib import contextmanager
import pexpect
from ..connection import LazyConnection
from ..queue import Queue as RabbitQueue
logger = logging.getLogger(__name__)
def delete_queue(*queues):
"""Delete queues... | mit | Python |
40941ea653951eaf9f235a46380410a83edc5928 | fix spacing in eix.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/eix.py | salt/modules/eix.py | '''
Support for Eix
'''
import salt.utils
def __virtual__():
'''
Only work on Gentoo systems with eix installed
'''
if __grains__['os'] == 'Gentoo' and salt.utils.which('eix'):
return 'eix'
return False
def sync():
'''
Sync portage/overlay trees and update the eix database
... | '''
Support for Eix
'''
import salt.utils
def __virtual__():
'''
Only work on Gentoo systems with eix installed
'''
if __grains__['os'] == 'Gentoo' and salt.utils.which('eix'):
return 'eix'
return False
def sync():
'''
Sync portage/overlay trees and update the eix database
C... | apache-2.0 | Python |
a0cb67914d56f1f3d11ed9b5f8517b1558510fdb | Change the prompt to '(lmsh) ' | jamesls/labmanager-shell | labmanager/shell.py | labmanager/shell.py | import cmd
from texttable import Texttable
# A mapping from the SOAP returned names
# to the nicer to display names.
DISPLAY_TYPE_MAP = {
'dateCreated': 'created',
'fenceMode': 'fencemode',
'isDeployed': 'deployed',
'isPublic': 'public',
'bucketName': 'bucket',
}
class LMShell(cmd.Cmd):
prom... | import cmd
from texttable import Texttable
# A mapping from the SOAP returned names
# to the nicer to display names.
DISPLAY_TYPE_MAP = {
'dateCreated': 'created',
'fenceMode': 'fencemode',
'isDeployed': 'deployed',
'isPublic': 'public',
'bucketName': 'bucket',
}
class LMShell(cmd.Cmd):
DONT... | bsd-3-clause | Python |
c65913c2501827dfbe46130a9b5666886bb071e6 | update action updatefollowpersonscoord | LCAS/spqrel_tools,LCAS/spqrel_tools,LCAS/spqrel_tools,LCAS/spqrel_tools,LCAS/spqrel_tools | actions/updatefollowpersoncoord.py | actions/updatefollowpersoncoord.py | import qi
import argparse
import sys
import time
import threading
import action_base
from action_base import *
import conditions
from conditions import get_condition
actionName = "updatefollowpersoncoord"
def actionThread_exec (params):
t = threading.currentThread()
memory_service = getattr(t, "mem_serv", ... | import qi
import argparse
import sys
import time
import threading
import action_base
from action_base import *
import conditions
from conditions import get_condition
actionName = "updatefollowpersoncoord"
def actionThread_exec (params):
t = threading.currentThread()
memory_service = getattr(t, "mem_serv", ... | mit | Python |
568f816bac1fac5ea82924f3fe36eeda78983050 | remove reassign tour purpose from abm models init.py | synthicity/activitysim,synthicity/activitysim | activitysim/abm/models/__init__.py | activitysim/abm/models/__init__.py | # ActivitySim
# See full license in LICENSE.txt.
from . import accessibility
from . import atwork_subtour_destination
from . import atwork_subtour_frequency
from . import atwork_subtour_mode_choice
from . import atwork_subtour_scheduling
from . import auto_ownership
from . import cdap
from . import free_parking
from . ... | # ActivitySim
# See full license in LICENSE.txt.
from . import accessibility
from . import atwork_subtour_destination
from . import atwork_subtour_frequency
from . import atwork_subtour_mode_choice
from . import atwork_subtour_scheduling
from . import auto_ownership
from . import cdap
from . import free_parking
from . ... | agpl-3.0 | Python |
5aed2cc0944b157fb2be4cf243c2939943fa96ae | update train script | haamoon/tensorpack,haamoon/tensorpack,yinglanma/AI-project,eyaler/tensorpack,eyaler/tensorpack,ppwwyyxx/tensorpack,ppwwyyxx/tensorpack,haamoon/tensorpack | scripts/dump_train_config.py | scripts/dump_train_config.py | #!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: dump_train_config.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import argparse
import cv2
import tensorflow as tf
import imp
import tqdm
import os
from tensorpack.utils import logger
from tensorpack.utils.utils import mkdir_p
parser = argparse.ArgumentParser()
par... | #!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: dump_train_config.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import argparse
import cv2
import tensorflow as tf
import imp
import tqdm
import os
from tensorpack.utils import logger
from tensorpack.utils.utils import mkdir_p
parser = argparse.ArgumentParser()
par... | apache-2.0 | Python |
2a757e1114c992d72a6c19fa17999c966299e87d | fix fixture depreacation | ocefpaf/gridgeo,pyoceans/gridgeo | tests/test_cfvariable.py | tests/test_cfvariable.py | from itertools import zip_longest
from gridgeo.cfvariable import _filled_masked, _make_grid
from hypothesis.extra.numpy import array_shapes
import numpy as np
import pytest
from shapely.geometry import MultiPolygon
@pytest.fixture
def coords():
x = y = np.array([1, 2, 3, 4], np.int)
x, y = np.meshgrid(x,... | from itertools import zip_longest
from gridgeo.cfvariable import _filled_masked, _make_grid
from hypothesis.extra.numpy import array_shapes
import numpy as np
import pytest
from shapely.geometry import MultiPolygon
@pytest.fixture
def make_coords():
x = y = np.array([1, 2, 3, 4], np.int)
x, y = np.meshgr... | bsd-3-clause | Python |
a089b7e88351d4598b9f97b5d6da2921ea8ba411 | Update lab2.py | MintYoongi/labs,MintYoongi/labs | labs-python/lab2.py | labs-python/lab2.py | #import math
from math import cos, acos
# ввод с для выбора формулы
c = int(input('Enter c = 1 or 2 or 3: '))
# подсчет формулы, если с равно 1
if c == 1:
a = float(input('Enter a: '))
x = float(input('Enter x: '))
G = (4*(-18*(a**2)+3*a*x+10*(x**2)))/(15*(a**2)+29*a*x+12*(x**2))
print('A = {}, X = {}, ... | #import math
from math import cos, acos
c=int(input('Enter c = 1 or 2 or 3: '))
if c == 1:
a = float(input('Enter a: '))
x = float(input('Enter x: '))
G = (4*(-18*(a**2)+3*a*x+10*(x**2)))/(15*(a**2)+29*a*x+12*(x**2))
print ('A = {}, X = {}, Result: {}'.format(a,x,G))
if c == 2:
a = float(input('Ent... | mit | Python |
8cbe945f30a2bb172736c418da78ff790a7afec1 | Use verbose flags for one of the config cmd tests | hackebrot/cibopath | tests/test_cli_config.py | tests/test_cli_config.py | # -*- coding: utf-8 -*-
import configparser
import pytest
@pytest.fixture
def config_file(tmpdir):
config_path = tmpdir / 'user_config'
parser = configparser.RawConfigParser()
parser['foobar'] = {'hello': 'world'}
with config_path.open('w', encoding='utf8') as f:
parser.write(f)
return... | # -*- coding: utf-8 -*-
import configparser
import pytest
@pytest.fixture
def config_file(tmpdir):
config_path = tmpdir / 'user_config'
parser = configparser.RawConfigParser()
parser['foobar'] = {'hello': 'world'}
with config_path.open('w', encoding='utf8') as f:
parser.write(f)
return... | bsd-3-clause | Python |
28f0c6e0a44e44c5499709cfc682b4ae687bcf75 | fix call sequence | adrn/Biff,adrn/Biff,adrn/Biff | biff/tests/test_bfe.py | biff/tests/test_bfe.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import astropy.units as u
from astropy.constants import G as _G
G = _G.decompose([u.kpc,u.Myr,u.Msun]).value
import numpy as np
# Project
from .._bfe import density, potential, gradient
# Che... | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import astropy.units as u
from astropy.constants import G as _G
G = _G.decompose([u.kpc,u.Myr,u.Msun]).value
import numpy as np
# Project
from .._bfe import density, potential, gradient
# Che... | mit | Python |
2658935cfb545d7b2042fdc460fd95fb3f0b2f07 | Fix Python2 syntax when creating secret key. | Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | lava_server/settings/secret_key.py | lava_server/settings/secret_key.py | # -*- coding: utf-8 -*-
#
# secret_key.py
#
# Copyright (C) 2011-2013 Linaro Limited
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
# Copyright 2013 Neil Williams <codehelp@debian.org>
#
# This file is part of LAVA Server.
#
# LAVA Server is free software: you can redistribute it and/or modify
# it under ... | # -*- coding: utf-8 -*-
#
# secret_key.py
#
# Copyright (C) 2011-2013 Linaro Limited
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
# Copyright 2013 Neil Williams <codehelp@debian.org>
#
# This file is part of LAVA Server.
#
# LAVA Server is free software: you can redistribute it and/or modify
# it under ... | agpl-3.0 | Python |
5d82d0ba59af8f785cfe252aa6f248db64bc7fcf | Add details to TalkUrl admin page | CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer | wafer/talks/admin.py | wafer/talks/admin.py | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from wafer.talks.models import TalkType, Talk, TalkUrl
class ScheduleListFilter(admin.SimpleListFilter):
title = _('in schedule')
parameter_name = 'schedule'
def lookups(self, request, model_admin):
return (
... | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from wafer.talks.models import TalkType, Talk, TalkUrl
class ScheduleListFilter(admin.SimpleListFilter):
title = _('in schedule')
parameter_name = 'schedule'
def lookups(self, request, model_admin):
return (
... | isc | Python |
319155faeb6d7acfd53ee7b4f4b7294c1eaed05f | Fix invertible module | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | nn/invertible.py | nn/invertible.py | import abc
import functools
_FORWARD = "forward"
_BACKWARD = "backward"
class InvertibleLayer(abc.ABC):
@abc.abstractmethod
def forward(self, x):
return NotImplemented
@abc.abstractmethod
def backward(self, x):
return NotImplemented
class InvertibleNetwork(InvertibleLayer):
def __init__(self, ... | import abc
import functools
_FORWARD = "forward"
_BACKWARD = "backward"
class InvertibleLayer(abc.ABC):
def forward(self, *args):
return NotImplemented
def backward(self, *args):
return NotImplemented
class InvertibleNetwork(InvertibleLayer):
def __init__(self, *layers):
assert all(isinstance(... | unlicense | Python |
9d2098ba9875defa04912f34cc7d319a3b724aa5 | Use colornodes module. | takavfx/Bento | scripts/OnCreated.py | scripts/OnCreated.py | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
## Description
"""
This script runs when Houdini nodes are created.
"""
#-------------------------------------------------------------------------------
import colornodes
# Node type information.
node = kwargs["no... | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
## Description
"""
This script runs when Houdini nodes are created.
This code is basaed on
"""
#-------------------------------------------------------------------------------
manager_color = (0, 0.4, 1)
generator... | mit | Python |
be27ba50d88f2df5d2f99afac0a17b8a3f238f44 | fix simulation/vcd_test.py | Abhinav117/pymtl,Abhinav117/pymtl,Abhinav117/pymtl,Abhinav117/pymtl | pymtl/tools/simulation/vcd_test.py | pymtl/tools/simulation/vcd_test.py | #=======================================================================
# vcd_test.py
#=======================================================================
import inspect
# This imports all the SimulationTool tests. Below we will hack the
# setup_sim() function call in each module to use a special vcd version
# o... | #=======================================================================
# vcd_test.py
#=======================================================================
import inspect
# This imports all the SimulationTool tests. Below we will hack the
# setup_sim() function call in each module to use a special vcd version
# o... | bsd-3-clause | Python |
b9b24295f33103d9ce769ab6a92bcba0991c0f06 | correct runtime props | kemiz/cloud-config-service,kemiz/cloud-config-service | scripts/configure.py | scripts/configure.py | import os
from cloudify import ctx
cloud_config = ctx.node.properties['cloud_config']
work_directory = ctx.node.properties['working_directory']
def download_cloud_config():
_cloud_config = os.path.join(work_directory, os.path.basename(cloud_config))
ctx.logger.info('Downloading cloud configuration file')
... | import os
import json
from cloudify import ctx
cloud_config = ctx.node.properties['cloud_config']
work_directory = ctx.node.properties['working_directory']
config_path = os.path.join(work_directory, 'config.json')
def download_cloud_config():
_cloud_config = os.path.join(work_directory, os.path.basename(cloud_... | apache-2.0 | Python |
8e896715606887acee5487d083c5301bba441956 | Clarify the algorithm for range calculation using an explicit variable. | LuminosoInsight/wordfreq | scripts/gen_regex.py | scripts/gen_regex.py | import unicodedata
from ftfy import chardata
import pathlib
from pkg_resources import resource_filename
CATEGORIES = [unicodedata.category(chr(i)) for i in range(0x110000)]
DATA_PATH = pathlib.Path(resource_filename('wordfreq', 'data'))
def func_to_regex(func):
"""
Given a function that returns True or Fals... | import unicodedata
from ftfy import chardata
import pathlib
from pkg_resources import resource_filename
CATEGORIES = [unicodedata.category(chr(i)) for i in range(0x110000)]
DATA_PATH = pathlib.Path(resource_filename('wordfreq', 'data'))
def func_to_regex(func):
"""
Given a function that returns True or Fals... | mit | Python |
07a14dd0682e06bb51068af50d4434b61ae2e719 | refactor tests | datalib/libextract,datalib/libextract | tests/test_libextract.py | tests/test_libextract.py | import os
from unittest import TestCase
from tests import asset_path
from libextract import extract
from libextract.html import get_etree
FOOS_FILENAME = asset_path('full_of_foos.html')
class TestLibExtract(TestCase):
def setUp(self):
with open(FOOS_FILENAME, 'r') as fp:
self.content = extra... | import os
from unittest import TestCase
from tests import asset_path
from libextract import extract
from libextract.html import get_etree
FOOS_FILENAME = asset_path('full_of_foos.html')
class TestLibExtract(TestCase):
def setUp(self):
self.file = open(FOOS_FILENAME, 'r')
self.content = extract(... | mit | Python |
9801938405ce83e82ecf564e1cba1f9ad53692ce | add python-setuptools & swig | sassoftware/mirrorball,sassoftware/mirrorball | scripts/pkgsource.py | scripts/pkgsource.py | #!/usr/bin/python
import os
import sys
from conary.lib import util
sys.excepthook = util.genExcepthook()
sys.path.insert(0, os.environ['HOME'] + '/hg/rpath-xmllib')
sys.path.insert(0, os.environ['HOME'] + '/hg/conary')
sys.path.insert(0, os.environ['HOME'] + '/hg/mirrorball')
import logging
import updatebot.log
upd... | #!/usr/bin/python
import os
import sys
from conary.lib import util
sys.excepthook = util.genExcepthook()
sys.path.insert(0, os.environ['HOME'] + '/hg/rpath-xmllib')
sys.path.insert(0, os.environ['HOME'] + '/hg/conary')
sys.path.insert(0, os.environ['HOME'] + '/hg/mirrorball')
import logging
import updatebot.log
upd... | apache-2.0 | Python |
3acebe92462165e2b5bc77e2a2759104d07da46e | Add regression tests for substitutions. | naturalness/sensibility,naturalness/sensibility,naturalness/sensibility,naturalness/sensibility | tests/test_print_edit.py | tests/test_print_edit.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright 2017 Eddie Antonio Santos <easantos@ualberta.ca>
#
# 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/license... | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright 2017 Eddie Antonio Santos <easantos@ualberta.ca>
#
# 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/license... | apache-2.0 | Python |
2f453412a548c9dfa87147ce2d33e271a9e4e3e7 | fix flake8 | tsuyukimakoto/biisan,tsuyukimakoto/biisan | tests/test_processors.py | tests/test_processors.py | from biisan.main import (
initialize_structures,
)
from ._constants import (
ANSWER,
DATA_DIR,
)
from ._utils import ( # noqa
cd,
cleanup,
copy_first_blog,
copy_second_blog,
copy_test_local_settings,
setenv,
)
def test_register_processor():
with cd('tests'):
initializ... | from unittest import mock
from xml.etree.ElementTree import Element
from biisan.main import (
initialize_structures,
)
from ._constants import (
ANSWER,
DATA_DIR,
)
from ._utils import ( # noqa
cd,
cleanup,
copy_first_blog,
copy_second_blog,
copy_test_local_settings,
setenv,
)
d... | mit | Python |
e4b8eedd01b44b98b8cb8b9e091ac1892a0ae645 | Fix the test name to to include the function under test. | unt-libraries/django-name,damonkelley/django-name,unt-libraries/django-name,damonkelley/django-name,damonkelley/django-name,unt-libraries/django-name | tests/test_validators.py | tests/test_validators.py | import pytest
from name.models import validate_merged_with, Name
from django.core.exceptions import ValidationError
@pytest.mark.django_db
def test_validate_merged_with_fails_with_unknown_id():
with pytest.raises(ValidationError):
validate_merged_with(1)
@pytest.mark.django_db
def test_validate_merged_w... | import pytest
from name.models import validate_merged_with, Name
from django.core.exceptions import ValidationError
@pytest.mark.django_db
def test_validate_merged_with_fails_with_unknown_id():
with pytest.raises(ValidationError):
validate_merged_with(1)
@pytest.mark.django_db
def test_validate_merged_w... | bsd-3-clause | Python |
9adfbd7e3ff7043a3db582a3d938e7eb32ba7ac9 | Update countfile.py | suzannerohrback/somaticCNVpipeline,suzannerohrback/somaticCNVpipeline | bin/count/countfile.py | bin/count/countfile.py | #!/usr/bin/python
import gzip
import numpy as np
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import common
import config as cfg
def fileToDictionary(inputFile, indexColumn):
input = open(inputFil... | #!/usr/bin/python
| mit | Python |
e58416edc8ef86abbdebc4711f3afa2b4e90cc1f | Improve tests Test VM creation, destruction and cloning | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,LoveIsGrief/saltcloud-virtualbox-provider | tests/test_virtualbox.py | tests/test_virtualbox.py | # This code assumes vboxapi.py from VirtualBox distribution
# being in PYTHONPATH, or installed system-wide
import unittest
import logging
from tests.helpers import VirtualboxTestCase
import virtualbox
log = logging.getLogger()
log_handler = logging.StreamHandler()
log_handler.setLevel(logging.DEBUG)
log.addHandler(l... | # This code assumes vboxapi.py from VirtualBox distribution
# being in PYTHONPATH, or installed system-wide
import unittest
import logging
import time
import virtualbox
log = logging.getLogger()
log_handler = logging.StreamHandler()
log_handler.setLevel(logging.DEBUG)
log.addHandler(log_handler)
log.setLevel(logging.... | apache-2.0 | Python |
072e2b65d3a2f204f670c5d56161df636b7a308f | revert version change | lbryio/lbry,lbryio/lbry,lbryio/lbry | lbrynet/__init__.py | lbrynet/__init__.py | import logging
from lbrynet.custom_logger import install_logger
__name__ = "lbrynet"
__version__ = "0.30.1"
version = tuple(__version__.split('.'))
install_logger()
logging.getLogger(__name__).addHandler(logging.NullHandler())
| import logging
from lbrynet.custom_logger import install_logger
__name__ = "lbrynet"
__version__ = "0.30.1rc1"
version = tuple(__version__.split('.'))
install_logger()
logging.getLogger(__name__).addHandler(logging.NullHandler())
| mit | Python |
43bc3fbc249d39062e5301de9cf9978d50378bf8 | complete pre-integration for awesome new feature | jisazaTappsi/shatter,jisazaTappsi/BooleanSolver | boolean_solver/code.py | boolean_solver/code.py | #!/usr/bin/env python
"""A class that defines a code, with a string."""
from boolean_solver.custom_operator import CustomOperator
__author__ = 'juan pablo isaza'
class Code:
def __init__(self, rho=None, lho=None, super_method=None, code_str=None):
self.rho = rho
self.lho = lho
if supe... | #!/usr/bin/env python
"""A class that defines a code, with a string."""
from boolean_solver.custom_operator import CustomOperator
__author__ = 'juan pablo isaza'
class Code:
def __init__(self, rho=None, lho=None, super_method=None, code_str=None):
self.rho = rho
self.lho = lho
if supe... | mit | Python |
2e28ca46e9ab62425db2b44dcb79c0d86547e96e | Fix crash caused by untrated exception | mircea-vutcovici/scripts,mircea-vutcovici/scripts,mircea-vutcovici/scripts | scapy-traceroute.py | scapy-traceroute.py | #! /usr/bin/python3
import sys
import os
from scapy.all import sr1,IP,TCP,ICMP,UDP
if len(sys.argv) != 2:
sys.exit('Usage: traceroute.py <remote host>')
# we start with 1
ttl = 1
while 1:
#p=sr1(IP(dst=sys.argv[1],ttl=ttl)/ICMP(id=os.getpid()),verbose=0,timeout=3) # ICMP traceroute (Windows)
#p=sr1(... | #! /usr/bin/python3
import sys
import os
from scapy.all import sr1,IP,TCP,ICMP,UDP
if len(sys.argv) != 2:
sys.exit('Usage: traceroute.py <remote host>')
# we start with 1
ttl = 1
while 1:
#p=sr1(IP(dst=sys.argv[1],ttl=ttl)/ICMP(id=os.getpid()),verbose=0,timeout=3) # ICMP traceroute (Windows)
#p=sr1(... | bsd-3-clause | Python |
9a2ffa4be60af5c9a5e37393f15f6a2b0fbf13dd | add bbl.angewandte | yhebik/texbenri | texbenri/bbl/__main__.py | texbenri/bbl/__main__.py | #!/usr/bin/env python3
import re
class ConverterCollection(object):
"""Convert bbl contents into a format as simple as possible."""
def __init__(self, bbls):
""" """
self.bbls = bbls[:]
def conv_acsrev(self, ):
"""acsrev (revtex4) converter."""
s = self.bbls
s = re... | #!/usr/bin/env python3
import re
class ConverterCollection(object):
"""Convert bbl contents into a format as simple as possible."""
def __init__(self, bbls):
""" """
self.bbls = bbls[:]
def conv_acsrev(self, ):
"""acsrev (revtex4) converter."""
s = self.bbls
s = re... | bsd-2-clause | Python |
e12a73f2789664cfb7fcf297918555331e84f670 | fix docstring, better error handling. | petebachant/scipy,e-q/scipy,ilayn/scipy,mortonjt/scipy,maniteja123/scipy,behzadnouri/scipy,fredrikw/scipy,mikebenfield/scipy,sauliusl/scipy,haudren/scipy,vhaasteren/scipy,jonycgn/scipy,matthew-brett/scipy,teoliphant/scipy,mingwpy/scipy,larsmans/scipy,ndchorley/scipy,ortylp/scipy,sargas/scipy,zaxliu/scipy,niknow/scipy,n... | scipy/ndimage/io.py | scipy/ndimage/io.py | from numpy import array
def imread(fname, flatten=False):
"""Load an image from file.
Parameters
----------
fname : string
Image file name, e.g. ``test.jpg``.
flatten : bool
If true, convert the output to grey-scale.
Returns
-------
img_array : ndarray
The diff... | from numpy import array
def imread(fname, flatten=False):
"""Load an image from file.
Parameters
----------
im : PIL image
Input image.
flatten : bool
If true, convert the output to grey-scale.
Returns
-------
img_array : ndarray
The different colour bands/chan... | bsd-3-clause | Python |
e4dd679f20a066c86a87a42199f66b288a314fcf | Use -platform:anycpu while compiling .NET assemblies | eyecreate/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,eyecreate/tapcfg,eyecreate/tapcfg,juhovh/tapcfg | scons-tools/gmcs.py | scons-tools/gmcs.py | import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Util
csccom = "$CSC $CSCFLAGS $_CSCLIBPATH -r:$_CSCLIBS -out:${TARGET.abspath} $SOURCES"
csclibcom = "$CSC -t:library $CSCLIBFLAGS $_CSCLIBPATH $_CSCLIBS -out:${TARGET.abspath} $SOURCES"
McsBuilder = SCons.Builder.Builder(action = '$CSCCOM',
... | import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Util
csccom = "$CSC $CSCFLAGS $_CSCLIBPATH -r:$_CSCLIBS -out:${TARGET.abspath} $SOURCES"
csclibcom = "$CSC -t:library $CSCLIBFLAGS $_CSCLIBPATH $_CSCLIBS -out:${TARGET.abspath} $SOURCES"
McsBuilder = SCons.Builder.Builder(action = '$CSCCOM',
... | lgpl-2.1 | Python |
0637acc9a313a99c98748d9538ecd9490fd3af64 | Clean up comments and unused imports | zblz/conda-builder-affiliated,kbarbary/conda-builder-affiliated,zblz/conda-builder-affiliated,Cadair/conda-builder-affiliated,mwcraig/conda-builder-affiliated,astropy/conda-build-tools,Cadair/conda-builder-affiliated,astropy/conda-builder-affiliated,bmorris3/conda-builder-affiliated,cdeil/conda-builder-affiliated,kbarb... | affiliate-builder/upload_bdists.py | affiliate-builder/upload_bdists.py | from __future__ import (division, print_function, absolute_import,
unicode_literals)
import os
import glob
from conda import config
from obvci.conda_tools.build import upload
from obvci.conda_tools.build_directory import Builder
from prepare_packages import RECIPE_FOLDER, BINSTAR_CHANNEL, BD... | from __future__ import (division, print_function, absolute_import,
unicode_literals)
import os
import glob
from conda import config
#from conda_build.metadata import MetaData
from binstar_client.inspect_package.conda import inspect_conda_package
from obvci.conda_tools.build import upload
fro... | bsd-3-clause | Python |
128959ea78a2e8b3c41eb89b06fc3c8d8e131ebc | switch to using south_field_triple, cuz we do not take arguments | armstrong/armstrong.core.arm_access,armstrong/armstrong.core.arm_access | armstrong/core/arm_access/fields.py | armstrong/core/arm_access/fields.py | from django.db import models
from django.db.models.fields.related \
import ReverseSingleRelatedObjectDescriptor
from .models import AccessObject
from .widgets import AccessWidget
from .forms import AccessFormField
class AccessField(models.OneToOneField):
def __init__(self):
super(AccessField, self... | from django.db import models
from django.db.models.fields.related \
import ReverseSingleRelatedObjectDescriptor
from .models import AccessObject
from .widgets import AccessWidget
from .forms import AccessFormField
class AccessField(models.OneToOneField):
def __init__(self):
super(AccessField, self... | apache-2.0 | Python |
20c1c4ec8de2a36a0640ad071e003f843c5c6c75 | Update binary_search.py (#657) | keon/algorithms | algorithms/search/binary_search.py | algorithms/search/binary_search.py | #
# Binary search works for a sorted array.
# Note: The code logic is written for an array sorted in
# increasing order.
#For Binary Search, T(N) = T(N/2) + O(1) // the recurrence relation
#Apply Masters Theorem for computing Run time complexity of recurrence relations : T(N) = aT(N/b) + f(N)
#Here, a = 1, b = 2 => lo... | #
# Binary search works for a sorted array.
# Note: The code logic is written for an array sorted in
# increasing order.
# T(n): O(log n)
#
def binary_search(array, query):
lo, hi = 0, len(array) - 1
while lo <= hi:
mid = (hi + lo) // 2
val = array[mid]
if val == query:
... | mit | Python |
99b1b971e8d29af8cb705e68336475b64017add0 | Enable entities filtering in user feed. | arc64/datawi.re,arc64/datawi.re,arc64/datawi.re | datawire/views/frames.py | datawire/views/frames.py | from flask import Blueprint, request, url_for
from sqlalchemy.sql.expression import and_
from sqlalchemy.sql.functions import count
from datawire.auth import require
from datawire.model import Service, Frame, Match, Entity
from datawire.exc import BadRequest, NotFound
from datawire.store import load_frame, frame_url
f... | from flask import Blueprint, request, url_for
from datawire.auth import require
from datawire.model import Service, Frame, Match, Entity
from datawire.exc import BadRequest, NotFound
from datawire.store import load_frame, frame_url
from datawire.views.util import jsonify, arg_bool, obj_or_404
from datawire.views.pager... | mit | Python |
04a3aa6a26cdc5279c00b36570dd212557699749 | clean up, remove un-referencing parameters | eguil/ENSO_metrics,eguil/ENSO_metrics | scripts/my_Param.py | scripts/my_Param.py | #=================================================
# Observation
#-------------------------------------------------
obspath = {
'ERA-Interim': '/work/lee1043/DATA/reanalysis/ERAINT/mon/ERA-Interim_VAR_mo.xml',
'HadISST': '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadISST_sst.nc',
'OISST': '/w... | #=================================================
# Observation
#-------------------------------------------------
obspath = {
'ERA-Interim': '/work/lee1043/DATA/reanalysis/ERAINT/mon/ERA-Interim_VAR_mo.xml',
'HadISST': '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadISST_sst.nc',
'OISST': '/w... | bsd-3-clause | Python |
e093999810f2af9e0695e8cd69a425a7cbc00223 | Create function sha1_file | eduardoklosowski/deduplicated,eduardoklosowski/deduplicated | deduplicated/__init__.py | deduplicated/__init__.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Eduardo Klosowski
# License: MIT (see LICENSE for details)
#
from __future__ import unicode_literals
from hashlib import sha1
import os
# Global Vars
CACHE_DIR = os.path.join(os.path.expanduser('~'), '.deduplicated')
# Utils
def sha1_file(filename):
with open(f... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Eduardo Klosowski
# License: MIT (see LICENSE for details)
#
from __future__ import unicode_literals
import os
# Global Vars
CACHE_DIR = os.path.join(os.path.expanduser('~'), '.deduplicated')
# Create user directory if not exists
if not os.path.exists(CACHE_DIR):
... | mit | Python |
90543b9a0b2e4a74a15abdde3269b285020e3a58 | add support for populating elasticsearch | shawnps/nihongo,shawnps/nihongo,hermanschaaf/nihongo,gojp/nihongo,gojp/nihongo,gojp/nihongo,hermanschaaf/nihongo,shawnps/nihongo,gojp/nihongo,hermanschaaf/nihongo,shawnps/nihongo | scripts/populate.py | scripts/populate.py | from edict_parser import EdictEntry
from pymongo import Connection
import romkan
import simplejson as json
import subprocess
import sys
if len(sys.argv) <= 1:
print 'usage: populate.py [es/mongo]'
sys.exit(1)
es_or_mongo = sys.argv[1]
mongo = es_or_mongo == 'mongo'
if mongo:
MONGO_URI = 'localhost'
... | from edict_parser import EdictEntry
from pymongo import Connection
import romkan
MONGO_URI = 'localhost'
c = Connection(MONGO_URI)
mongo_db = c['greenbook']
collection = mongo_db['edict']
PATH_TO_EDICT2 = '../data/edict'
inserts = []
with open(PATH_TO_EDICT2) as f:
read_data = f.readlines()
for line in [l.d... | mit | Python |
17ac329783bce0cb88d92659cf58a3ea476c66ef | Add support for looping sample | mfergie/human-hive | scripts/sound_output_test.py | scripts/sound_output_test.py | import pyaudio
import wave
import time
import sys
import numpy as np
if len(sys.argv) < 2:
print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0])
sys.exit(-1)
wf = wave.open(sys.argv[1], 'rb')
p = pyaudio.PyAudio()
n_bytes_to_test = 1024 * 2 * 6
DEVICE_ID=2
def callback(in_data, frame_count, ... | import pyaudio
import wave
import time
import sys
import numpy as np
if len(sys.argv) < 2:
print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0])
sys.exit(-1)
wf = wave.open(sys.argv[1], 'rb')
p = pyaudio.PyAudio()
DEVICE_ID=2
def callback(in_data, frame_count, time_info, status):
data = w... | bsd-2-clause | Python |
c020053fa6a3e3abf2686ad8b6eb95efa8794c9f | Add test capturing missed expectation. Ref #2773. | pypa/setuptools,pypa/setuptools,pypa/setuptools | setuptools/tests/test_setopt.py | setuptools/tests/test_setopt.py | import io
import configparser
from setuptools.command import setopt
class TestEdit:
@staticmethod
def parse_config(filename):
parser = configparser.ConfigParser()
with io.open(filename, encoding='utf-8') as reader:
parser.read_file(reader)
return parser
@staticmethod
... | import io
import configparser
from setuptools.command import setopt
class TestEdit:
@staticmethod
def parse_config(filename):
parser = configparser.ConfigParser()
with io.open(filename, encoding='utf-8') as reader:
parser.read_file(reader)
return parser
@staticmethod
... | mit | Python |
0e9d93b7e0998df6f5299bb7666adbcdedb5de28 | Whitelist the official names for the starship factory blog. | starshipfactory/sfblog,starshipfactory/sfblog,starshipfactory/sfblog,starshipfactory/sfblog | sfblog_project/settings/prod.py | sfblog_project/settings/prod.py | from .base import * # NOQA
from os import environ
environ.setdefault('SFBLOG_CONFIG_PATH', '/etc/sfblog')
ALLOWED_HOSTS = [
"blog.starship-factory.ch",
"blog.starship-factory.com",
"blog.starship-factory.de",
"blog.starship-factory.eu",
"blog.starship-factory.org",
"blog.starshipfactory.ch",
"blog.star... | from .base import * # NOQA
from os import environ
environ.setdefault('SFBLOG_CONFIG_PATH', '/etc/sfblog')
DEBUG = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'sfblog',
'USER': 'sfblog',
'PASSWORD... | bsd-3-clause | Python |
735e1ddbc51cc3119ddd614c1e0bb0e6d88228b7 | fix typo | bbannier/ROOT,bbannier/ROOT,dawehner/root,dawehner/root,dawehner/root,bbannier/ROOT,bbannier/ROOT,dawehner/root,bbannier/ROOT,dawehner/root,bbannier/ROOT,dawehner/root,bbannier/ROOT,dawehner/root,dawehner/root | reflex/python/genreflex/gencapa.py | reflex/python/genreflex/gencapa.py | # Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose is hereby granted without fee, provided that this copyright and
# permissions notice appear in all copies and derivatives.
#
# This software is provided "as is" withou... | # Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose is hereby granted without fee, provided that this copyright and
# permissions notice appear in all copies and derivatives.
#
# This software is provided "as is" withou... | lgpl-2.1 | Python |
578e25eb97a7ff72a9d245bbf7c3a04d835a7dd8 | Add elasticsearch options | openstack/searchlight,openstack/searchlight,openstack/searchlight,lakshmisampath/searchlight | searchlight/opts.py | searchlight/opts.py | import itertools
import searchlight.common.wsgi
import searchlight.common.property_utils
import searchlight.common.config
import searchlight.elasticsearch
def list_opts():
return [
('DEFAULT',
itertools.chain(searchlight.common.wsgi.bind_opts,
searchlight.common.wsgi.soc... | import itertools
import searchlight.common.wsgi
import searchlight.common.property_utils
import searchlight.common.config
def list_opts():
return [
('DEFAULT',
itertools.chain(searchlight.common.wsgi.bind_opts,
searchlight.common.wsgi.socket_opts,
... | apache-2.0 | Python |
24306bc4838cd8feb8c5e076a868b51f5b3613ed | make vaex-core only depend on futures for python 2 (#58) | maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex | packages/vaex-core/setup.py | packages/vaex-core/setup.py | from setuptools import setup
import sys, os, imp
from setuptools import Extension
dirname = os.path.dirname(__file__)
path_version = os.path.join(dirname, "vaex/core/_version.py")
version = imp.load_source('version', path_version)
name = 'vaex'
author = "Maarten A. Breddels"
author_email= "maartenbreddels... | from setuptools import setup
import sys, os, imp
from setuptools import Extension
dirname = os.path.dirname(__file__)
path_version = os.path.join(dirname, "vaex/core/_version.py")
version = imp.load_source('version', path_version)
name = 'vaex'
author = "Maarten A. Breddels"
author_email= "maartenbreddels... | mit | Python |
bf1f6b1eb7f4e3f103d86212c79a41df9f3d5c07 | Make `vault.read` raise meaningful exception | StackStorm/st2contrib,StackStorm/st2contrib,pidah/st2contrib,StackStorm/st2contrib,pearsontechnology/st2contrib,armab/st2contrib,tonybaloney/st2contrib,armab/st2contrib,pearsontechnology/st2contrib,tonybaloney/st2contrib,pidah/st2contrib,pidah/st2contrib,tonybaloney/st2contrib,pearsontechnology/st2contrib,armab/st2cont... | packs/vault/actions/read.py | packs/vault/actions/read.py | from lib import action
class VaultReadAction(action.VaultBaseAction):
def run(self, path):
value = self.vault.read(path)
if value:
return value['data']
else:
raise KeyError("Key was not found in Vault")
| from lib import action
class VaultReadAction(action.VaultBaseAction):
def run(self, path):
return self.vault.read(path)['data']
| apache-2.0 | Python |
df6f9db32cfb0ddb286cd100cb60ec1987250bf0 | implement preset menu | CaptainDesAstres/Simple-Blender-Render-Manager,CaptainDesAstres/Blender-Render-Manager | settingMod/Preset.py | settingMod/Preset.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage preset'''
import xml.etree.ElementTree as xmlMod
from settingMod.Resolution import *
import os
class Preset:
'''class to manage preset'''
def __init__(self, xml= None):
'''initialize preset with default value or values extracted from an xml object''... | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage preset'''
import xml.etree.ElementTree as xmlMod
from settingMod.Resolution import *
import os
class Preset:
'''class to manage preset'''
def __init__(self, xml= None):
'''initialize preset with default value or values extracted from an xml object''... | mit | Python |
db5810f7141b6614aa866e65ddd696bf9ee7d157 | Revert accidental checkin | yippeecw/sfa,onelab-eu/sfa,onelab-eu/sfa,yippeecw/sfa,onelab-eu/sfa,yippeecw/sfa | sfatables/globals.py | sfatables/globals.py | import os.path
sfatables_config = '/etc/sfatables'
match_dir = os.path.join(sfatables_config, "matches")
target_dir = os.path.join(sfatables_config, "targets")
| import os.path
sfatables_config = '/Users/andy/Desktop/svn.planet-lab.org/sfa/trunk/sfatables'
match_dir = os.path.join(sfatables_config, "matches")
target_dir = os.path.join(sfatables_config, "targets")
| mit | Python |
1ae6e1f8694f882c233d50539cfa02bf06a3b62c | Add docstrings for snippets.metadata_parser | trilan/snippets,trilan/snippets | snippets/metadata_parser.py | snippets/metadata_parser.py | import re
from pygments.token import Comment
#: A regular expression object to find all metadata
#: params in source code header comments.
metadata_re = re.compile(r'!(\w+):\s*(.+)$', re.M)
def parse_comment_metadata(comment):
"""Find all metadata params in provided comment string. Found params are
returned... | import re
from pygments.token import Comment
metadata_re = re.compile(r'!(\w+):\s*(.+)$', re.M)
def parse_comment_metadata(comment):
return dict(metadata_re.findall(comment))
def parse_metadata(tokens):
comments = []
metadata = {}
is_significant = True
for token in tokens:
if token[0] ... | isc | Python |
663fa4cace22a86ee45bb4c3ec12bb2ef7a0f4bd | Add equality comparision | arush0311/coala,SanketDG/coala,SambitAcharya/coala,rimacone/testing2,NiklasMM/coala,Nosferatul/coala,scriptnull/coala,d6e/coala,AbdealiJK/coala,SambitAcharya/coala,Shade5/coala,yland/coala,nemaniarjun/coala,vinc456/coala,MariosPanag/coala,damngamerz/coala,shreyans800755/coala,d6e/coala,djkonro/coala,MariosPanag/coala,T... | coalib/analysers/results/LineResult.py | coalib/analysers/results/LineResult.py | """
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | """
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | agpl-3.0 | Python |
0df27338a7f970deb39c4d39d0908c8f884c3178 | Correct test docstrings | praekelt/seed-stage-based-messaging,praekelt/seed-stage-based-messaging,praekelt/seed-staged-based-messaging | contentstore/tests/test_signals.py | contentstore/tests/test_signals.py | """
Unit tests for contentstore signals
"""
from django.test import TestCase
from mock import patch
from contentstore.models import Schedule
from seed_stage_based_messaging import test_utils as utils
class ScheduleSignalsTests(TestCase):
"""
Tests for signals relating to the Schedule model
"""
@patch... | """
Unit tests for contentstore signals
"""
from django.test import TestCase
from mock import patch
from contentstore.models import Schedule
from seed_stage_based_messaging import test_utils as utils
class ScheduleSignalsTests(TestCase):
"""
Tests for signals relating to the Schedule model
"""
@patch... | bsd-3-clause | Python |
577263e9d1df0ee260c17ebb695d5f89c9f30181 | Update for explicit globals | mashrin/processing.py,Luxapodular/processing.py,Luxapodular/processing.py,jdf/processing.py,mashrin/processing.py,tildebyte/processing.py,mashrin/processing.py,tildebyte/processing.py,jdf/processing.py,Luxapodular/processing.py,tildebyte/processing.py,jdf/processing.py | mode/examples/Topics/Geometry/Icosahedra/Icosahedra.pyde | mode/examples/Topics/Geometry/Icosahedra/Icosahedra.pyde | """
I Like Icosahedra
by Ira Greenberg.
This example plots icosahedra. The Icosahdron is a regular polyhedron composed
of twenty equalateral triangles.
Slightly simplified to reduce the complexity of the Shape3D class and remove
the unused Dimension3D class.
"""
from icosahedron import Icosahedron
# Pre-calculate som... | """
I Like Icosahedra
by Ira Greenberg.
This example plots icosahedra. The Icosahdron is a regular polyhedron composed
of twenty equalateral triangles.
Slightly simplified to reduce the complexity of the Shape3D class and remove
the unused Dimension3D class.
"""
from icosahedron import Icosahedron
# Pre-calculate som... | apache-2.0 | Python |
244f22465ba7e9388e3f50d5327fc6c4687d6aed | Fix level saving/loading | vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah | ookoobah/data.py | ookoobah/data.py | """Data loaders.
Add functions here to load specific types of resources.
"""
from __future__ import division
import os
from pyglet import resource
resource.path = [ os.path.join('..', 'data') ]
resource.reindex()
| """Data loaders.
Add functions here to load specific types of resources.
"""
from __future__ import division
import os
from pyglet import resource
resource.path = [ 'data' ]
resource.reindex()
| mit | Python |
649c96ab2cc4a72276e8e6b7153394b9fe85ed08 | Bump _version.py | khchine5/opal,khchine5/opal,khchine5/opal | opal/_version.py | opal/_version.py | __version__ = '0.4.0.1'
| __version__ = '0.0.3rc1'
| agpl-3.0 | Python |
ab47a14acff93f52f3f995e1b8a0b9e1e742f3fe | Format number as string or it errors in some webservers | disqus/overseer | overseer/urls.py | overseer/urls.py | from django.conf.urls.defaults import *
import os.path
urlpatterns = patterns('',
url(r'^media/(?P<path>.+)?$', 'django.views.static.serve', {
'document_root': os.path.join(os.path.dirname(__file__), 'media'),
'show_indexes': True
}, name='media'),
url(r'^$', 'overseer.views.index', name=... | from django.conf.urls.defaults import *
import os.path
urlpatterns = patterns('',
url(r'^media/(?P<path>.+)?$', 'django.views.static.serve', {
'document_root': os.path.join(os.path.dirname(__file__), 'media'),
'show_indexes': True
}, name='media'),
url(r'^$', 'overseer.views.index', name=... | apache-2.0 | Python |
53df053dde987698590ed8b565c8f36cc6f7698a | Load spacetime_types.scm | sumitsourabh/opencog,TheNameIsNigel/opencog,virneo/opencog,jlegendary/opencog,jswiergo/atomspace,kinoc/opencog,virneo/atomspace,kim135797531/opencog,ruiting/opencog,sanuj/opencog,virneo/atomspace,sanuj/opencog,rodsol/atomspace,inflector/opencog,yantrabuddhi/atomspace,eddiemonroe/atomspace,williampma/opencog,printedhear... | opencog/python/pln/examples/temporal/temporal_example.py | opencog/python/pln/examples/temporal/temporal_example.py | """
For running the TemporalAgent without the cogserver
"""
from __future__ import print_function
from pln.examples.temporal import composition_agent
from pln.examples.temporal import temporal_agent
from opencog.atomspace import types, AtomSpace, TruthValue
from opencog.scheme_wrapper import load_scm, scheme_eval, sch... | """
For running the TemporalAgent without the cogserver
"""
from __future__ import print_function
from pln.examples.temporal import composition_agent
from pln.examples.temporal import temporal_agent
from opencog.atomspace import types, AtomSpace, TruthValue
from opencog.scheme_wrapper import load_scm, scheme_eval, sch... | agpl-3.0 | Python |
d06599e816bb5c6727595a2547c9999c75ec88d9 | Disable basic auth when testing | lm-tools/situational,lm-tools/sectors,lm-tools/sectors,lm-tools/sectors,lm-tools/situational,lm-tools/situational,lm-tools/sectors,lm-tools/situational,lm-tools/situational | situational/settings/testing.py | situational/settings/testing.py | from .base import *
# Sets CELERY_ALWAYS_EAGER=True, making celery tasks block.
# This makes testing much easier.
# http://docs.celeryproject.org/en/2.5/django/unit-testing.html
TEST_RUNNER = 'djcelery.contrib.test_runner.CeleryTestSuiteRunner'
BASICAUTH_DISABLED = True
LOGGING['root']['level'] = 'WARNING'
| from .base import *
# Sets CELERY_ALWAYS_EAGER=True, making celery tasks block.
# This makes testing much easier.
# http://docs.celeryproject.org/en/2.5/django/unit-testing.html
TEST_RUNNER = 'djcelery.contrib.test_runner.CeleryTestSuiteRunner'
LOGGING['root']['level'] = 'WARNING'
| bsd-3-clause | Python |
c85f21df323be38aac7859b9ea67587e293b7248 | add case for no dataset provided | solvebio/solvebio-python,solvebio/solvebio-python,solvebio/solvebio-python | solvebio/resource/savedquery.py | solvebio/resource/savedquery.py | from ..query import Query
from .dataset import Dataset
from .apiresource import CreateableAPIResource
from .apiresource import ListableAPIResource
from .apiresource import UpdateableAPIResource
from .apiresource import DeletableAPIResource
class SavedQuery(CreateableAPIResource, ListableAPIResource,
... | from ..query import Query
from .dataset import Dataset
from .apiresource import CreateableAPIResource
from .apiresource import ListableAPIResource
from .apiresource import UpdateableAPIResource
from .apiresource import DeletableAPIResource
class SavedQuery(CreateableAPIResource, ListableAPIResource,
... | mit | Python |
d3c997adb6a38a27c7db6e30757b70dd5b4a890a | change value name | MadsJensen/CAA,MadsJensen/CAA | itc_condition_side_analysis.py | itc_condition_side_analysis.py | import numpy as np
# import glob
import mne
import pandas as pd
from my_settings import (epochs_folder, tf_folder)
subjects_select = ["0005", "0006", "0007", "0008", "0009", "0010",
"0011", "0015", "0016", "0017", "0020", "0021",
"0022", "0024", "0025"]
epochs = mne.read_epochs(... | import numpy as np
# import glob
import mne
import pandas as pd
from my_settings import (epochs_folder, tf_folder)
subjects_select = ["0005", "0006", "0007", "0008", "0009", "0010",
"0011", "0015", "0016", "0017", "0020", "0021",
"0022", "0024", "0025"]
epochs = mne.read_epochs(... | bsd-3-clause | Python |
32f1ce16ce9df1f4615a0403ed56bf6fd7dbbef4 | Add missing return of Event methods | rokurosatp/slackbotpry | slackbotpry/event.py | slackbotpry/event.py | class Event:
def __init__(self, bot, data):
self.bot = bot
self.data = data
def post_message(self, text, channel=None):
if channel is None:
channel = self.data['channel']
return self.bot.post_message(text, channel)
def add_reaction(self, emoji, channel=None, times... | class Event:
def __init__(self, bot, data):
self.bot = bot
self.data = data
def post_message(self, text, channel=None):
if channel is None:
channel = self.data['channel']
self.bot.post_message(text, channel)
def add_reaction(self, emoji, channel=None, timestamp=No... | mit | Python |
258a1c2d656113edd257265d97ab689996c0f4b1 | reset Shovel IP | openstack/shovel,keedya/shovel,openstack/shovel,openstack/shovel,keedya/shovel,keedya/shovel | Horizon/rackhd/shovel.py | Horizon/rackhd/shovel.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 th... | # 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 th... | apache-2.0 | Python |
343af477c2e3b98ee46ee5126dafef2d5026187e | Change confirmation request text | iwi/linkatos,iwi/linkatos | linkatos/printer.py | linkatos/printer.py | def bot_says(channel, text, slack_client):
return slack_client.api_call("chat.postMessage",
channel=channel,
text=text,
as_user=True)
def compose_explanation(url):
return "If you would like {} to be stored pleas... | def bot_says(channel, text, slack_client):
return slack_client.api_call("chat.postMessage",
channel=channel,
text=text,
as_user=True)
def compose_explanation(url):
return "If you would like {} to be stored pleas... | mit | Python |
346e52de3851d435744799ea1f6c6066da09c252 | add versions including 2.0 and 1.88 (#23678) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/cppcheck/package.py | var/spack/repos/builtin/packages/cppcheck/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cppcheck(MakefilePackage):
"""A tool for static C/C++ code analysis."""
homepage = "ht... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cppcheck(MakefilePackage):
"""A tool for static C/C++ code analysis."""
homepage = "ht... | lgpl-2.1 | Python |
6cd8d6a26d807800352e79786b911d68848f6961 | Bump version | 596acres/django-livinglots-usercontent,596acres/django-livinglots-usercontent | livinglots_usercontent/__init__.py | livinglots_usercontent/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.3.2'
| # -*- coding: utf-8 -*-
__version__ = '0.3.1'
| agpl-3.0 | Python |
1215e26444c18bc1b2ad44167b46840a780e8ee2 | Update at 2017-07-20 16-31-10 | amoshyc/tthl-code | download.py | download.py | import json
from pathlib import Path
from subprocess import run
dataset = Path('~/tthl-dataset/').expanduser()
video_dirs = [x for x in dataset.iterdir() if x.is_dir()]
for video_dir in video_dirs:
url = json.load((video_dir / 'info.json').open())['video_src']
run(['youtube-dl', '-f', '18', '-o', str(video_dir... | import json
from pathlib import Path
from subprocess import run
dataset = Path('~/dataset/').expanduser()
video_dirs = [x for x in dataset.iterdir() if x.is_dir()]
for video_dir in video_dirs:
url = json.load((video_dir / 'info.json').open())['video_src']
run(['youtube-dl', '-f', '18', '-o', str(video_dir / 'v... | apache-2.0 | Python |
47b1d20055283eb336acd752572ce48191c903fc | Use constructor. | SpacePlant/Plankton | plankton/prng.py | plankton/prng.py | from collections import namedtuple
class PRNG:
PRNGInfo = namedtuple('PRNGInfo', ['name', # The name of the PRNG
's_name', # The shortened name of the PRNG
'type', # The algorithm type
... | from collections import namedtuple
class PRNG:
PRNGInfo = namedtuple('PRNGInfo', ['name', # The name of the PRNG
's_name', # The shortened name of the PRNG
'type', # The algorithm type
... | mit | Python |
ccf2e7ee43ec25ebf2ce4f516ed62b9332e1db62 | Standardize API methods | disqus/playa,disqus/playa | playa/web/api.py | playa/web/api.py | from playa import app
from playa.web.helpers import get_now_playing
from flask import request, redirect, url_for
import functools
import simplejson
def api(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
resp = func(*args, **kwargs)
if request.is_xhr:
return redirect(u... | from playa import app
from playa.web.helpers import get_now_playing
from flask import request
import simplejson
@app.route('/api/now_playing', methods=['GET'])
def now_playing():
return simplejson.dumps(get_now_playing())
@app.route('/api/set_volume', methods=['POST'])
def set_volume():
value = request.form... | apache-2.0 | Python |
4617b6c6af8985905aaecbdc744072b292b55939 | Bump version: 0.2.0 → 0.2.1 | h2non/pook | pook/__init__.py | pook/__init__.py | from .api import * # noqa
from .api import __all__ as api_exports
# Delegate to API export
__all__ = api_exports
# Package metadata
__author__ = 'Tomas Aparicio'
__license__ = 'MIT'
# Current version
__version__ = '0.2.1'
| from .api import * # noqa
from .api import __all__ as api_exports
# Delegate to API export
__all__ = api_exports
# Package metadata
__author__ = 'Tomas Aparicio'
__license__ = 'MIT'
# Current version
__version__ = '0.2.0'
| mit | Python |
0b4383bddeb2d8788958123ef4fb2b6a8966a0db | Remove unused imports | jupyter/jupyterlab,charnpreetsingh185/jupyterlab,jupyter/jupyterlab,charnpreetsingh185/jupyterlab,jupyter/jupyterlab,charnpreetsingh185/jupyterlab,eskirk/jupyterlab,eskirk/jupyterlab,charnpreetsingh185/jupyterlab,eskirk/jupyterlab,jupyter/jupyterlab,charnpreetsingh185/jupyterlab,eskirk/jupyterlab,eskirk/jupyterlab,jupy... | jupyterlab/labapp.py | jupyterlab/labapp.py | # coding: utf-8
"""A tornado based Jupyter lab server."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from notebook.notebookapp import NotebookApp, flags
from jupyter_core.application import JupyterApp
from traitlets import Bool, Unicode
from ._version import... | # coding: utf-8
"""A tornado based Jupyter lab server."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from notebook.notebookapp import NotebookApp, flags
from jupyter_core.application import JupyterApp
from jupyter_core.paths import ENV_CONFIG_PATH
from traitl... | bsd-3-clause | Python |
8017ffc4b1d16d8bf0ad69f662a7dae10981daf9 | refactor user admin views | mastak/Spirit,nitely/Spirit,gogobook/Spirit,a-olszewski/Spirit,dvreed/Spirit,ramaseshan/Spirit,a-olszewski/Spirit,dvreed/Spirit,nitely/Spirit,nitely/Spirit,mastak/Spirit,a-olszewski/Spirit,dvreed/Spirit,alesdotio/Spirit,gogobook/Spirit,adiyengar/Spirit,gogobook/Spirit,adiyengar/Spirit,raybesiga/Spirit,raybesiga/Spirit,... | spirit/apps/user/admin/views.py | spirit/apps/user/admin/views.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.utils.translation import ugettext as _
from djconfig import config
from spirit.utils.paginato... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.utils.translation import ugettext as _
from djconfig import config
from spirit.utils.paginato... | mit | Python |
46ab3d3783ae9d2cc9d73c564760916ea9b3acdb | Update some lighting states | flyte/zmq-io-modules,flyte/zmq-io-modules | zmq_io/example/lighting_states.py | zmq_io/example/lighting_states.py | from time import sleep
from raspledstrip.ledstrip import *
from raspledstrip import animation
ZERO_TO_ONE_100 = [x/100.0 for x in range(0, 101)]
ONE_TO_ZERO_100 = [x/100.0 for x in range(100, -1, -1)]
led = LEDStrip(32, True)
led.setMasterBrightness(1)
colour = Color(0, 0, 0)
def _fade_in(col):
global colour
... | from time import sleep
from raspledstrip.ledstrip import *
from raspledstrip import animation
led = LEDStrip(32, True)
led.setMasterBrightness(1)
def rainbow(change_event):
print "rainbow started"
ani = animation.RainbowCycle(led)
while not change_event.isSet():
ani.step()
led.update()
... | unlicense | Python |
9bb7dc9c8f7b5208c332017df8b1501315e2601f | Fix incorrect signature for get_customer_ids function | google/ads-api-report-fetcher,google/ads-api-report-fetcher,google/ads-api-report-fetcher,google/ads-api-report-fetcher | py/gaarf/utils.py | py/gaarf/utils.py | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
c21b71f2719dca71755befdb5918ea4ba56dbd96 | Add docstring to detect_encoding | DasIch/pyalysis,DasIch/pyalysis | pyalysis/utils.py | pyalysis/utils.py | # coding: utf-8
"""
pyalysis.utils
~~~~~~~~~~~~~~
:copyright: 2014 by Daniel Neuhäuser and Contributors
:license: BSD, see LICENSE.rst for details
"""
import math
import re
import codecs
import tokenize
from pyalysis._compat import PY2
# as defined in PEP 263
_magic_encoding_comment = re.compile("co... | # coding: utf-8
"""
pyalysis.utils
~~~~~~~~~~~~~~
:copyright: 2014 by Daniel Neuhäuser and Contributors
:license: BSD, see LICENSE.rst for details
"""
import math
import re
import codecs
import tokenize
from pyalysis._compat import PY2
# as defined in PEP 263
_magic_encoding_comment = re.compile("co... | bsd-3-clause | Python |
422fdea958328ec817ad9c9fac54e60f9fe134df | bump patch number | dswah/pyGAM | pygam/__init__.py | pygam/__init__.py | """
GAM toolkit
"""
from __future__ import absolute_import
from pygam.pygam import GAM
from pygam.pygam import LinearGAM
from pygam.pygam import LogisticGAM
from pygam.pygam import GammaGAM
from pygam.pygam import PoissonGAM
from pygam.pygam import InvGaussGAM
from pygam.pygam import ExpectileGAM
from pygam.terms im... | """
GAM toolkit
"""
from __future__ import absolute_import
from pygam.pygam import GAM
from pygam.pygam import LinearGAM
from pygam.pygam import LogisticGAM
from pygam.pygam import GammaGAM
from pygam.pygam import PoissonGAM
from pygam.pygam import InvGaussGAM
from pygam.pygam import ExpectileGAM
from pygam.terms im... | apache-2.0 | Python |
8a7b6962a26de7035d64dce23285960c78678a2a | Use double quotes on help string | MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS | server/resources.py | server/resources.py | from flask import request
from flask_restful import Resource, Api, abort, reqparse
from .models import db, Comment, Lecture
api = Api()
class CommentListResource(Resource):
def get(self, lecture_id):
db_lecture = Lecture.query.filter(Lecture.id == lecture_id).first()
if not db_lecture:
... | from flask import request
from flask_restful import Resource, Api, abort, reqparse
from .models import db, Comment, Lecture
api = Api()
class CommentListResource(Resource):
def get(self, lecture_id):
db_lecture = Lecture.query.filter(Lecture.id == lecture_id).first()
if not db_lecture:
... | mit | Python |
b8191dbc8ccafcc8debcba88d140a3c341fa57fc | Set version to 0.6.0a | erigones/Ludolph,erigones/Ludolph | ludolph/__init__.py | ludolph/__init__.py | """
Ludolph: Monitoring Jabber Bot
Version: 0.6.0a
Homepage: https://github.com/erigones/Ludolph
Copyright (C) 2012-2015 Erigones, s. r. o.
See the LICENSE file for copying permission.
"""
__version__ = '0.6.0a'
| """
Ludolph: Monitoring Jabber Bot
Version: 0.5.1
Homepage: https://github.com/erigones/Ludolph
Copyright (C) 2012-2015 Erigones, s. r. o.
See the LICENSE file for copying permission.
"""
__version__ = '0.6.0a'
| bsd-3-clause | Python |
138a4a5ff8e59d53694d84d28eb67ebcc83c53a6 | fix wrong import that triggers on site without sfatables installed | onelab-eu/sfa,yippeecw/sfa,onelab-eu/sfa,yippeecw/sfa,yippeecw/sfa,onelab-eu/sfa | sfa/util/sfatablesRuntime.py | sfa/util/sfatablesRuntime.py | # sfa should not depend on sfatables
# if the sfatables.runtime import fails, just define run_sfatables as identity
try:
from sfatables.runtime import SFATablesRules
def fetch_context(slice_hrn, user_hrn, contexts):
"""
Returns the request context required by sfatables. At some point, this
... | # sfa should not depend on sfatables
# if the sfatables.runtime import fails, just define run_sfatables as identity
try:
from sfatables.runtime import SFATablesRules
def fetch_context(slice_hrn, user_hrn, contexts):
"""
Returns the request context required by sfatables. At some point, this
... | mit | Python |
fde2d4f9fc411c031b679e946375f7f77beee46d | fix a bug | quheng/chalk,quheng/chalk,quheng/chalk | spider/spider/spiders/vcbeat.py | spider/spider/spiders/vcbeat.py | import scrapy
import requests
import json
class VcbeatSpider(scrapy.Spider):
name = "vcbeat"
def start_requests(self):
article_list_url = 'http://www.vcbeat.net/Index/Index/ajaxGetArticleList'
article_url = 'http://www.vcbeat.net/Index/Index/ajaxGetArticleList'
categoryId = '2999'
... | import scrapy
import requests
import json
class VcbeatSpider(scrapy.Spider):
name = "bioon"
def start_requests(self):
article_list_url = 'http://www.vcbeat.net/Index/Index/ajaxGetArticleList'
article_url = 'http://www.vcbeat.net/Index/Index/ajaxGetArticleList'
categoryId = 'http://www.... | mit | Python |
2e292ddeb4148e12b8972fa0a25c03ab4c5e61a8 | Use native python truncate for privsep | mahak/cinder,openstack/cinder,openstack/cinder,mahak/cinder | cinder/privsep/fs.py | cinder/privsep/fs.py | # Copyright 2018 Red Hat, Inc
# Copyright 2017 Rackspace Australia
# Copyright 2018 Michael Still and Aptira
#
# 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.ap... | # Copyright 2018 Red Hat, Inc
# Copyright 2017 Rackspace Australia
# Copyright 2018 Michael Still and Aptira
#
# 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.ap... | apache-2.0 | Python |
a30683ee3c062aa8bceaa4e02563b17e481f4964 | Add wait for applications to deploy q | battlemidget/conjure-up,Ubuntu-Solutions-Engineering/conjure,ubuntu/conjure-up,battlemidget/conjure-up,ubuntu/conjure-up,conjure-up/conjure-up,Ubuntu-Solutions-Engineering/conjure,conjure-up/conjure-up | conjure/controllers/deploystatus/gui.py | conjure/controllers/deploystatus/gui.py | from conjure.ui.views.deploystatus import DeployStatusView
from ubuntui.ev import EventLoop
from conjure.app_config import app
from conjure import utils
from conjure import controllers
from conjure import async
from conjure import juju
from functools import partial
from . import common
import os.path as path
import os
... | from conjure.ui.views.deploystatus import DeployStatusView
from ubuntui.ev import EventLoop
from conjure.app_config import app
from conjure import utils
from conjure import controllers
from conjure import async
from functools import partial
from . import common
import os.path as path
import os
import sys
this = sys.m... | mit | Python |
9251429dcabc11ecc562c2305e011dd10b7387ff | add an extension if we cant find one | leakim/svtplay-dl,spaam/svtplay-dl,qnorsten/svtplay-dl,qnorsten/svtplay-dl,selepo/svtplay-dl,iwconfig/svtplay-dl,dalgr/svtplay-dl,olof/svtplay-dl,olof/svtplay-dl,selepo/svtplay-dl,leakim/svtplay-dl,OakNinja/svtplay-dl,leakim/svtplay-dl,iwconfig/svtplay-dl,OakNinja/svtplay-dl,OakNinja/svtplay-dl,dalgr/svtplay-dl,spaam/s... | lib/svtplay/http.py | lib/svtplay/http.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import sys
import time
import re
from svtplay.output import progress # FIXME use progressbar() instead
from svtplay.log import log
if sys.version_info > (3, 0):
from urllib.request impor... | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import sys
import time
import re
from svtplay.output import progress # FIXME use progressbar() instead
from svtplay.log import log
if sys.version_info > (3, 0):
from urllib.request impor... | mit | Python |
7be498ffad3a7cd954972b80d71812b36cd405f0 | disable archive convert operation in anchore_manager temporarily | anchore/anchore-engine,anchore/anchore-engine,anchore/anchore-engine | anchore_manager/cli/__init__.py | anchore_manager/cli/__init__.py | import os
import click
import subprocess
import sys
import logging
import db, archivestorage, service
from anchore_manager import version
#import anchore_manager.clients
#from anchoreservice.subsys import logger
@click.group()
@click.option('--debug', is_flag=True, help='Debug output to stderr')
@click.option('--jso... | import os
import click
import subprocess
import sys
import logging
import db, archivestorage, service
from anchore_manager import version
#import anchore_manager.clients
#from anchoreservice.subsys import logger
@click.group()
@click.option('--debug', is_flag=True, help='Debug output to stderr')
@click.option('--jso... | apache-2.0 | Python |
290c8731dd280a94caf0879a584039d121dadd59 | Fix pid sequence migration to work for new or existing sequence | emory-libraries/pidman,emory-libraries/pidman | pidman/pid/migrations/0002_pid_sequence_initial_value.py | pidman/pid/migrations/0002_pid_sequence_initial_value.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from pidman.pid.noid import decode_noid, encode_noid
from pidman.pid import models as pid_models
def pid_sequence_lastvalue(apps, schema_editor):
# if the database has existing pids, update the sequence last ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from pidman.pid.noid import decode_noid, encode_noid
from pidman.pid import models as pid_models
def pid_sequence_lastvalue(apps, schema_editor):
# if the database has existing pids, update the sequence last ... | apache-2.0 | Python |
e457f09f280bc86bc7b5cdcfb4fa3ebf093402ec | Upgrade Dropbox to OAuth 2 | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/dropbox.py | services/dropbox.py | import foauth.providers
class Dropbox(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'https://www.dropbox.com/'
docs_url = 'https://www.dropbox.com/developers/reference/api'
favicon_url = 'https://cf.dropboxstatic.com/static/images/favicon-vflk5FiAC.ico'
category = 'Fil... | import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_PLAINTEXT
class Dropbox(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.dropbox.com/'
docs_url = 'https://www.dropbox.com/developers/reference/api'
favicon_url = 'https://cf.dropboxstatic.com/... | bsd-3-clause | Python |
d67150cbbe185ecb338b73f8d2bea65eaec4ec67 | implement getMessages | mlsteele/one-time-chat,mlsteele/one-time-chat,mlsteele/one-time-chat | client/client.py | client/client.py | import requests
import sys
class OTC_Client(object):
## A client is initialized with the address of the server it intends to connect to
## TODO: fix the initialization with pad. Client shouldn't get access to pad
def __init__(self,server_address,device_id,username=None,):
self.encrypt_index = 0... | import requests
import sys
class OTC_Client(object):
## A client is initialized with the address of the server it intends to connect to
## TODO: fix the initialization with pad. Client shouldn't get access to pad
def __init__(self,server_address,username=None,device_id):
self.encrypt_index = 0 ... | mit | Python |
4d924289aefadcb1e37ea3ed8d0bc176b8667158 | add a core template folder for admin pages | zguangyu/epen,zguangyu/epen,zguangyu/epen | epen/app.py | epen/app.py | from flask import Flask
from flask.ext.pymongo import PyMongo
from flask.ext.login import LoginManager
import jinja2
app = Flask("epen")
app.config.from_pyfile("config.py")
_my_loader = jinja2.ChoiceLoader([
app.jinja_loader,
jinja2.FileSystemLoader("themes/%s" % (app.config["THEME"],)),
jinja2.FileSystemL... | from flask import Flask
from flask.ext.pymongo import PyMongo
from jinja2 import FileSystemLoader
app = Flask("epen")
app.config.from_pyfile("config.py")
app.jinja_loader = FileSystemLoader("themes/%s" % (app.config["THEME"],))
mongo = PyMongo(app)
| mit | Python |
68264c77453708656fbc83916789de6f1f337ef6 | Cut values that are too long | shirone/angkot,shirone/angkot,shirone/angkot,shirone/angkot,angkot/angkot,angkot/angkot,angkot/angkot,angkot/angkot | angkot/route/submission/data.py | angkot/route/submission/data.py | from datetime import datetime
import geojson
from shapely.geometry import asShape
_max_length = None
def _get_max_lengths(field_map):
from ..models import Submission
res = {}
for field in field_map:
res[field] = Submission._meta.get_field(field).max_length
return res
def normalize(prop):
... | from datetime import datetime
import geojson
from shapely.geometry import asShape
def normalize(prop):
'''Convert old format to the new one'''
field_map = dict(city='kota',
company='perusahaan',
number='nomor',
origin='berangkat',
... | agpl-3.0 | Python |
6127b02324d0b7af4015dc0be68023a77ce852ad | document conflict with clang (#7096) | mfherbst/spack,matthiasdiener/spack,tmerrick1/spack,krafczyk/spack,iulian787/spack,krafczyk/spack,mfherbst/spack,iulian787/spack,matthiasdiener/spack,EmreAtes/spack,mfherbst/spack,LLNL/spack,krafczyk/spack,LLNL/spack,matthiasdiener/spack,LLNL/spack,EmreAtes/spack,LLNL/spack,EmreAtes/spack,matthiasdiener/spack,mfherbst/... | var/spack/repos/builtin/packages/elfutils/package.py | var/spack/repos/builtin/packages/elfutils/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
d87f44e987c72313d74b3b885dab01aa3faf7e87 | fix url and deps (#15877) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-scoop/package.py | var/spack/repos/builtin/packages/py-scoop/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyScoop(PythonPackage):
"""SCOOP (Scalable COncurrent Operations in Python) is a distribu... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyScoop(PythonPackage):
"""SCOOP (Scalable COncurrent Operations in Python) is a distribu... | lgpl-2.1 | Python |
5a3dbb6afa77947d184418c71da987ddc76fff9f | Fix financeInformation type | agdsn/sipa,MarauderXtreme/sipa,agdsn/sipa,MarauderXtreme/sipa,agdsn/sipa,agdsn/sipa,MarauderXtreme/sipa | sipa/model/pycroft/schema.py | sipa/model/pycroft/schema.py | # -*- coding: utf-8 -*-
from __future__ import annotations
from typing import List
from sipa.model.pycroft.unserialize import unserializer
@unserializer
class UserData:
id: int
user_id: str
login: str
realname: str
status: UserStatus
room: str
mail: str
cache: bool
traffic_balance... | # -*- coding: utf-8 -*-
from __future__ import annotations
from typing import List
from sipa.model.pycroft.unserialize import unserializer
@unserializer
class UserData:
id: int
user_id: str
login: str
realname: str
status: UserStatus
room: str
mail: str
cache: bool
traffic_balance... | mit | Python |
a0de3bca1bbf289256ace69d462db83bcb3c5abc | synchronize projects faster - with fabric.contrib.upload_project | davidhalter/depl,davidhalter/depl | depl/deploy/_utils.py | depl/deploy/_utils.py | import textwrap
from fabric.api import put, sudo
from fabric.contrib.project import upload_project
def lazy(func):
def wrapper(*args, **kwargs):
return lambda: func(*args, **kwargs)
return wrapper
def nginx_config(url, port, locations):
config = """
server {
listen %s;
... | import textwrap
from os.path import join
from fabric.api import put, sudo
def lazy(func):
def wrapper(*args, **kwargs):
return lambda: func(*args, **kwargs)
return wrapper
def nginx_config(url, port, locations):
config = """
server {
listen %s;
server_name %s... | mit | Python |
e04bf75c3ff53ba02a7e55bd2b0819952932ceed | allow /lib | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/executors/SWIFT.py | dmoj/executors/SWIFT.py | from dmoj.executors.compiled_executor import CompiledExecutor
class Executor(CompiledExecutor):
ext = 'swift'
name = 'SWIFT'
command = 'swiftc'
fs = ['/lib']
test_program = 'print(readLine()!)'
def get_compile_args(self):
return [self.get_command(), self._code]
| from dmoj.executors.compiled_executor import CompiledExecutor
class Executor(CompiledExecutor):
ext = 'swift'
name = 'SWIFT'
command = 'swiftc'
test_program = 'print(readLine()!)'
def get_compile_args(self):
return [self.get_command(), self._code]
| agpl-3.0 | Python |
d8d1db486619f970ba3ac94c81461c4ff48e7a77 | add missing newline | byteweaver/django-eca-catalogue | eca_catalogue/tests/models_tests.py | eca_catalogue/tests/models_tests.py | from django.test import TestCase
from eca_catalogue.tests.models import NestedProductCategory
from eca_catalogue.tests.factories import ProductCategoryFactory, ProductFactory, SellingPointFactory
class ProductCategoryTestCase(TestCase):
def test_model(self):
obj = ProductCategoryFactory()
self.as... | from django.test import TestCase
from eca_catalogue.tests.models import NestedProductCategory
from eca_catalogue.tests.factories import ProductCategoryFactory, ProductFactory, SellingPointFactory
class ProductCategoryTestCase(TestCase):
def test_model(self):
obj = ProductCategoryFactory()
self.as... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.