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 |
|---|---|---|---|---|---|---|---|---|
6a14f9d316ad906f5ca82520d64b9cea1da9bf0e | Hide inputted password. | dovf/matrix-python-sdk,matrix-org/matrix-python-sdk | samples/SimpleChatClient.py | samples/SimpleChatClient.py | #!/bin/env python3
from matrix_client.client import MatrixClient
from matrix_client.api import MatrixRequestError
from requests.exceptions import MissingSchema
from getpass import getpass
import sys
def on_message(event):
if event['type'] == "m.room.member":
if event['membership'] == "join":
... | #!/bin/env python3
from matrix_client.client import MatrixClient
from matrix_client.api import MatrixRequestError
from requests.exceptions import MissingSchema
import sys
def on_message(event):
if event['type'] == "m.room.member":
if event['membership'] == "join":
print("{0} joined".format(even... | apache-2.0 | Python |
705bcb1e96399928cf3902e2651e65bee7e2ead0 | Fix pylint | SasView/sasmodels,SasView/sasmodels,SasView/sasmodels,SasView/sasmodels | sasmodels/models/lorentz.py | sasmodels/models/lorentz.py | r"""
Lorentz (Ornstein-Zernicke Model)
Definition
----------
The Ornstein-Zernicke model is defined by
.. math:: I(q)=\frac{\text{scale}}{1+(qL)^2}+\text{background}
The parameter $L$ is the screening length *cor_length*.
For 2D data the scattering intensity is calculated in the same way as 1D,
where the $q$ vecto... | r"""
Lorentz (Ornstein-Zernicke Model)
Definition
----------
The Ornstein-Zernicke model is defined by
.. math:: I(q)=\frac{\text{scale}}{1+(qL)^2}+\text{background}
The parameter $L$ is the screening length *cor_length*.
For 2D data the scattering intensity is calculated in the same way as 1D,
where the $q$ vecto... | bsd-3-clause | Python |
abd1951d421d3a703c85fd059945f315a77ce288 | add permission to access config api. | tobyqin/testcube,tobyqin/testcube,tobyqin/testcube,tobyqin/testcube | testcube/core/api/views.py | testcube/core/api/views.py | from rest_framework import viewsets
from rest_framework.permissions import IsAdminUser
from .serializers import *
from ..models import *
class ProjectViewSet(viewsets.ModelViewSet):
queryset = Project.objects.all()
serializer_class = ProjectSerializer
class ProductViewSet(viewsets.ModelViewSet):
querys... | from rest_framework import viewsets
from .serializers import *
from ..models import *
class ProjectViewSet(viewsets.ModelViewSet):
queryset = Project.objects.all()
serializer_class = ProjectSerializer
class ProductViewSet(viewsets.ModelViewSet):
queryset = Product.objects.all()
serializer_class = P... | mit | Python |
def1037fc6750c0ce2a42fbbf8c63498d4fff1c6 | Update 05_Ambient_Light_Monitoring.py | userdw/RaspberryPi_3_Starter_Kit | 05_Ambient_Light_Monitoring/05_Ambient_Light_Monitoring.py | 05_Ambient_Light_Monitoring/05_Ambient_Light_Monitoring.py | import MCP3202,wiringpi,time,os # import library WiringPi-Python
from time import sleep # import library sleep
wiringpi.wiringPiSetup() # Must be called before using IO Function
wiringpi.softPwmCreate(24,0,100) # Set PWM on pin 24, start value 0, max value 100
def translate(value,leftMin,leftMax,ri... | import MCP3202,wiringpi,time,os # import library WiringPi-Python
from time import sleep # import library sleep
wiringpi.wiringPiSetup() # Must be called before using IO Function
wiringpi.softPwmCreate(24,0,100) # Set PWM on pin 24, start value 0, max value 100
def translate(value,leftMin,leftMa... | mit | Python |
17ee8e97e97ce2776c44afe387e8b3b0584dedb0 | Build minizip portion of zlib on non-Windows. | csulmone/gyp,csulmone/gyp,csulmone/gyp,csulmone/gyp | samples/zlib.gyp | samples/zlib.gyp | {
'variables': {
'depth': '../..',
},
'includes': [
'../../build/common.gypi',
'../../build/external_code.gypi',
],
'targets': [
{
'target_name': 'zlib',
'type': 'static_library',
'sources': [
'contrib/minizip/ioapi.c',
'contrib/minizip/ioapi.h',
'cont... | {
'variables': {
'depth': '../..',
},
'includes': [
'../../build/common.gypi',
'../../build/external_code.gypi',
],
'targets': [
{
'target_name': 'zlib',
'type': 'static_library',
'sources': [
'contrib/minizip/ioapi.c',
'contrib/minizip/ioapi.h',
'cont... | bsd-3-clause | Python |
557c2ab8d6a0416219e3323427bd5e7bd735554f | Fix case typo in 'to_dataframe' abstract method return type. | google/nitroml | nitroml/analytics/materialized_artifact.py | nitroml/analytics/materialized_artifact.py | # Copyright 2020 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 2020 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 |
1e72f42a7e3a520096726b4e12fe33c23c93045e | fix example tests | mattfenwick/NMRPyStar,mattfenwick/NMRPyStar | nmrpystar/test/testexamples/testloading.py | nmrpystar/test/testexamples/testloading.py | '''
@author: matt
'''
from ...examples import loading
import unittest
class TestLoading(unittest.TestCase):
def testFromFile(self):
z = loading.parseFile('bmrb17661.txt')
print z.value
self.assertEqual(z.status, 'success')
# no point in continuing with the tests if the parsing... | '''
@author: matt
'''
from ...examples import loading
import unittest
notnow = """
class TestLoading(unittest.TestCase):
def testFromFile(self):
z = loading.parseFile('bmrb17661.txt')
print z.value
self.assertEqual(z.status, 'success')
# no point in continuing with the tests if... | mit | Python |
b1f6a090c009417c49a9fb152918a15dd18e0c6a | correct path to ask_update.py in docstring | debugger22/sympy,chaffra/sympy,mcdaniel67/sympy,shipci/sympy,dqnykamp/sympy,meghana1995/sympy,grevutiu-gabriel/sympy,postvakje/sympy,ChristinaZografou/sympy,oliverlee/sympy,pandeyadarsh/sympy,MridulS/sympy,pandeyadarsh/sympy,lidavidm/sympy,farhaanbukhsh/sympy,iamutkarshtiwari/sympy,MridulS/sympy,sahilshekhawat/sympy,ga... | bin/ask_update.py | bin/ask_update.py | #!/usr/bin/env python
""" Update the ask_generated.py file
This must be run each time known_facts is changed
Should be run from sympy root directory
$ python bin/ask_update.py
"""
from sympy.assumptions.ask import (compute_known_facts, known_facts,
known_facts_keys)
f = open('sympy/assumptions/ask_generat... | #!/usr/bin/env python
""" Update the ask_generated.py file
This must be run each time known_facts is changed
Should be run from sympy root directory
$ python sympy/assumptions/ask_update.py
"""
from sympy.assumptions.ask import (compute_known_facts, known_facts,
known_facts_keys)
f = open('sympy/assumptio... | bsd-3-clause | Python |
7fea91387e54d2f81448682149dda0aa8cc2c44e | bump to 0.53.1 | efiop/dvc,efiop/dvc,dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol | dvc/version.py | dvc/version.py | # Used in setup.py, so don't pull any additional dependencies
#
# Based on:
# - https://github.com/python/mypy/blob/master/mypy/version.py
# - https://github.com/python/mypy/blob/master/mypy/git.py
import os
import subprocess
_BASE_VERSION = "0.53.1"
def _generate_version(base_version):
"""Generate a versio... | # Used in setup.py, so don't pull any additional dependencies
#
# Based on:
# - https://github.com/python/mypy/blob/master/mypy/version.py
# - https://github.com/python/mypy/blob/master/mypy/git.py
import os
import subprocess
_BASE_VERSION = "0.53.0"
def _generate_version(base_version):
"""Generate a versio... | apache-2.0 | Python |
8f4da52b5b10108111dc01bb0b2d904b2e0e82b5 | fix the version check in the script | RonnyPfannschmidt/setuptools_scm,RonnyPfannschmidt/setuptools_scm,pypa/setuptools_scm,pypa/setuptools_scm | testing/runtests_travis.py | testing/runtests_travis.py |
from subprocess import call
import os
if os.environ.get('TOXENV'):
import tox
tox.cmdline()
elif os.environ.get('SELFINSTALL'):
call('python setup.py sdist', shell=True)
call('easy_install dist/*', shell=True)
import pkg_resources
dist = pkg_resources.get_distribution('setuptools_scm')
as... |
from subprocess import call
import os
if os.environ.get('TOXENV'):
import tox
tox.cmdline()
elif os.environ.get('SELFINSTALL'):
call('python setup.py sdist', shell=True)
call('easy_install dist/*', shell=True)
import pkg_resources
dist = pkg_resources.get_distribution('setuptools_scm')
as... | mit | Python |
e3c77086752b14b816b52300397a640bef254df2 | fix a typo in config.py | zguangyu/epen,zguangyu/epen,zguangyu/epen | epen/config.py | epen/config.py | # The default locale to use if no locale selector is registered. This
# defaults to 'en'.
BABEL_DEFAULT_LOCALE = "zh-hans"
# The timezone to use for user facing dates. This defaults to 'UTC' which
# also is the timezone your application must use internally.
BABEL_DEFAULT_TIMEZONE = "Asia/Shanghai"
# The theme to use ... | # The default locale to use if no locale selector is registered. This
# defaults to 'en'.
BABEL_DEFAULT_LOCALE = "zh-hans"
# The timezone to use for user facing dates. This defaults to 'UTC' which
# also is the timezone your application must use internally.
BABEL_DEFAULT_TIMEZONE = "Asia/Shanghai"
# The theme to use ... | mit | Python |
e1140dee97a7bbc284ed63f05601bd4494271fb2 | make more legible | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/feature/iem/hits.py | scripts/feature/iem/hits.py | import matplotlib.pyplot as plt
import mx.DateTime
x = []
y = []
for line in open('hits.txt'):
tokens = line.split(":")
ts = mx.DateTime.strptime(tokens[0], '%d %B %Y')
x.append( ts )
y.append( int(tokens[1]) )
fig = plt.figure()
ax = fig.add_subplot(111)
ax.semilogy(x, y, lw=3)
#ax.set_xlim( x[0].t... | import matplotlib.pyplot as plt
import mx.DateTime
x = []
y = []
for line in open('hits.txt'):
tokens = line.split(":")
ts = mx.DateTime.strptime(tokens[0], '%d %B %Y')
x.append( ts )
y.append( int(tokens[1]) )
fig = plt.figure()
ax = fig.add_subplot(111)
ax.semilogy(x, y)
#ax.set_xlim( x[0].ticks()... | mit | Python |
f81cb41617ada783f8be617762ecd21b127feba7 | Fix tests | cjellick/rancher,rancher/rancher,rancherio/rancher,cjellick/rancher,cjellick/rancher,rancher/rancher,rancherio/rancher,rancher/rancher,rancher/rancher | tests/core/test_machine.py | tests/core/test_machine.py | from common import auth_check
def test_machine_fields(cclient):
fields = {
'useInternalIpAddress': 'cr',
'nodeTaints': 'r',
'nodeLabels': 'r',
'nodeAnnotations': 'r',
'namespaceId': 'cr',
'conditions': 'r',
'allocatable': 'r',
'capacity': 'r',
... | from common import auth_check
def test_machine_fields(cclient):
fields = {
'useInternalIpAddress': 'cr',
'nodeTaints': 'r',
'nodeLabels': 'r',
'nodeAnnotations': 'r',
'namespaceId': 'cr',
'conditions': 'r',
'allocatable': 'r',
'capacity': 'r',
... | apache-2.0 | Python |
578496f8b81d62f7f08ba71a2625b33a227b498a | Add spacing to animals. | probcomp/cgpm,probcomp/cgpm | tests/graphical/animals.py | tests/graphical/animals.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | apache-2.0 | Python |
954124bbbdcb8e3f0db6ebdafeb2133b06f50c65 | add missing object inheritance | sripathikrishnan/redis-rdb-tools | tests/memprofiler_tests.py | tests/memprofiler_tests.py | import unittest
from rdbtools import RdbParser
from rdbtools import MemoryCallback
import os
class Stats(object):
def __init__(self):
self.records = {}
def next_record(self, record):
self.records[record.key] = record
def get_stats(file_name):
stats = Stats()
callback = Memory... | import unittest
from rdbtools import RdbParser
from rdbtools import MemoryCallback
import os
class Stats():
def __init__(self):
self.records = {}
def next_record(self, record):
self.records[record.key] = record
def get_stats(file_name):
stats = Stats()
callback = MemoryCallba... | mit | Python |
127ef0d221c7da5143c23864517d21cc5000473b | Update __init__.py | adamtheturtle/vws-python,adamtheturtle/vws-python | tests/mock_vws/__init__.py | tests/mock_vws/__init__.py | """
A mock implementation of Vuforia Web Services.
"""
| mit | Python | |
fc3c6477a0e05a01c668fbcde84bf670911ca4c0 | improve mouseout test | cobrateam/splinter,cobrateam/splinter,cobrateam/splinter | tests/mouse_interaction.py | tests/mouse_interaction.py | # -*- coding: utf-8 -*-
# Copyright 2012 splinter 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 .fake_webapp import EXAMPLE_APP
class MouseInteractionTest(object):
def test_mouse_over(self):
"Should be able to per... | # -*- coding: utf-8 -*-
# Copyright 2012 splinter 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 .fake_webapp import EXAMPLE_APP
class MouseInteractionTest(object):
def test_mouse_over(self):
"Should be able to per... | bsd-3-clause | Python |
137b82409c06d47ff2372c38f8a03fd1da2f3936 | swap sequence, so the exception gets thrown later. | joerg84/arangodb,fceller/arangodb,baslr/ArangoDB,baslr/ArangoDB,graetzer/arangodb,hkernbach/arangodb,baslr/ArangoDB,graetzer/arangodb,hkernbach/arangodb,hkernbach/arangodb,baslr/ArangoDB,wiltonlazary/arangodb,fceller/arangodb,graetzer/arangodb,arangodb/arangodb,Simran-B/arangodb,joerg84/arangodb,fceller/arangodb,joerg8... | 3rdParty/V8-4.3.61/build/gyp/gyp_main.py | 3rdParty/V8-4.3.61/build/gyp/gyp_main.py | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import os.path
# TODO(mark): sys.path manipulation is some temporary testing stuff.
try:
sys.path.append(os.path.join(os.path.... | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import os.path
# TODO(mark): sys.path manipulation is some temporary testing stuff.
try:
import gyp
sys.path.append(os.path.... | apache-2.0 | Python |
6ddb70e6ef973928f1c43d51e91082712bdc92a9 | Remove canonical processor from processing init | mehanig/scrapi,felliott/scrapi,fabianvf/scrapi,felliott/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,erinspace/scrapi,fabianvf/scrapi | scrapi/processing/__init__.py | scrapi/processing/__init__.py | import os
from celery.signals import worker_process_init
from scrapi import settings
from scrapi.processing.base import BaseProcessor
__all__ = []
for mod in os.listdir(os.path.dirname(__file__)):
root, ext = os.path.splitext(mod)
if ext == '.py' and root not in ['__init__', 'base']:
__all__.append(r... | import os
from celery.signals import worker_process_init
from scrapi import settings
from scrapi.processing.base import BaseProcessor
__all__ = []
for mod in os.listdir(os.path.dirname(__file__)):
root, ext = os.path.splitext(mod)
if ext == '.py' and root not in ['__init__', 'base']:
__all__.append(r... | apache-2.0 | Python |
66c6a60b7d55c4c985f7f21c911190cab5c00d7f | Fix util import. | faneshion/MatchZoo,faneshion/MatchZoo | matchzoo/__init__.py | matchzoo/__init__.py | from pathlib import Path
USER_DIR = Path.expanduser(Path('~')).joinpath('.matchzoo')
if not USER_DIR.exists():
USER_DIR.mkdir()
USER_DATA_DIR = USER_DIR.joinpath('datasets')
if not USER_DATA_DIR.exists():
USER_DATA_DIR.mkdir()
from .logger import logger
from .version import __version__
from .utils import *
f... | from pathlib import Path
USER_DIR = Path.expanduser(Path('~')).joinpath('.matchzoo')
if not USER_DIR.exists():
USER_DIR.mkdir()
USER_DATA_DIR = USER_DIR.joinpath('datasets')
if not USER_DATA_DIR.exists():
USER_DATA_DIR.mkdir()
from .logger import logger
from .version import __version__
from . import processo... | apache-2.0 | Python |
7fb815046011ab1bb5c6a16ca80143b828f9d63b | Remove daily_analysis from serializer | ItsCalebJones/SpaceLaunchNow-Server,ItsCalebJones/SpaceLaunchNow-Server,ItsCalebJones/SpaceLaunchNow-Server | bot/serializer.py | bot/serializer.py | from bot.models import Launch, Notification, DailyDigestRecord
from rest_framework import serializers
class NotificationSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Notification
fields = (
'launch', 'url', 'wasNotifiedTwentyFourHour', 'wasNotifiedOneHour', '... | from bot.models import Launch, Notification, DailyDigestRecord
from rest_framework import serializers
class NotificationSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Notification
fields = (
'launch', 'url', 'wasNotifiedTwentyFourHour', 'wasNotifiedOneHour', '... | apache-2.0 | Python |
9b6b1f5b75247e39945832b6f8d9409c21186df3 | Remove dead code from experimental module | samedder/azure-cli,samedder/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,samedder/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli | src/azure-cli-core/azure/cli/core/extensions/experimental.py | src/azure-cli-core/azure/cli/core/extensions/experimental.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | mit | Python |
caefc30377f45ecdb955fec86e7de681a5cb6522 | Add break line on clean txt files | SetaSouto/license-plate-detection | clean_txt_files.py | clean_txt_files.py | """
Script to clean the txt generated files and kept only the 37 class: LICENSE-PLATE and set the number 0 to the class.
"""
import os
dataset_dir = "data/dataset/"
for filename in list(filter(lambda x: x[-3:] == "txt", os.listdir(dataset_dir))):
with open(dataset_dir + filename, 'r') as f:
content = f.re... | """
Script to clean the txt generated files and kept only the 37 class: LICENSE-PLATE and set the number 0 to the class.
"""
import os
dataset_dir = "data/dataset/"
for filename in list(filter(lambda x: x[-3:] == "txt", os.listdir(dataset_dir))):
with open(dataset_dir + filename, 'r') as f:
content = f.re... | mit | Python |
444bba442e581226b650af929c85ccc885c60297 | Disable jaeger logging by default | globality-corp/microcosm,globality-corp/microcosm | microcosm/tracing.py | microcosm/tracing.py | from jaeger_client.config import (
DEFAULT_REPORTING_HOST,
DEFAULT_REPORTING_PORT,
DEFAULT_SAMPLING_PORT,
Config,
)
from microcosm.api import binding, defaults, typed
from microcosm.config.types import boolean
SPAN_NAME = "span_name"
@binding("tracer")
@defaults(
sample_type="ratelimiting",
... | from jaeger_client.config import (
DEFAULT_REPORTING_HOST,
DEFAULT_REPORTING_PORT,
DEFAULT_SAMPLING_PORT,
Config,
)
from microcosm.api import binding, defaults, typed
SPAN_NAME = "span_name"
@binding("tracer")
@defaults(
sample_type="ratelimiting",
sample_param=typed(int, 10),
sampling_... | apache-2.0 | Python |
f65199b9c6d66a87019424a7c6accae5b734d777 | Fix merge issues | alphagov/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,mtek... | app/main/__init__.py | app/main/__init__.py | from flask import Blueprint
main = Blueprint('main', __name__)
@main.after_request
def add_cache_control(response):
response.cache_control.no_cache = True
return response
from . import errors
from .views import services, suppliers, login
| from flask import Blueprint
main = Blueprint('main', __name__)
@main.after_request
def add_cache_control(response):
response.cache_control.no_cache = True
return response
from . import errors
from .views import services, suppliers, login
| mit | Python |
ed30c04f37fd80b8bbba0b5328befc4a28897210 | Support Unicode titles in YTS | sharkone/scrapyard | scrapyard/yts.py | scrapyard/yts.py | import cache
import network
import scraper
import urllib
YTS_URL = 'http://yts.re'
################################################################################
def movie(movie_info):
magnet_infos = []
if movie_info['imdb_id']:
json_data = network.json_get_cached(YTS_URL + '/api/v2/list_movies.jso... | import cache
import network
import scraper
import urllib
YTS_URL = 'http://yts.re'
################################################################################
def movie(movie_info):
magnet_infos = []
if movie_info['imdb_id']:
json_data = network.json_get_cached(YTS_URL + '/api/v2/list_movies.jso... | mit | Python |
1bd281c11d719cf412bf61481da62cc5ad2307f3 | Add task ID as number | jkimbo/freight,klynton/freight,rshk/freight,getsentry/freight,getsentry/freight,klynton/freight,rshk/freight,getsentry/freight,klynton/freight,rshk/freight,jkimbo/freight,jkimbo/freight,jkimbo/freight,rshk/freight,klynton/freight,getsentry/freight,getsentry/freight | ds/notifiers/slack.py | ds/notifiers/slack.py | from __future__ import absolute_import, unicode_literals
__all__ = ['SlackNotifier']
import json
import requests
from ds.models import App, TaskStatus
from .base import Notifier, NotifierEvent
class SlackNotifier(Notifier):
def get_options(self):
return {
'webhook_url': {'required': True},... | from __future__ import absolute_import, unicode_literals
__all__ = ['SlackNotifier']
import json
import requests
from ds.models import App, TaskStatus
from .base import Notifier, NotifierEvent
class SlackNotifier(Notifier):
def get_options(self):
return {
'webhook_url': {'required': True},... | apache-2.0 | Python |
864555f431a5dc0560e93ef9055e6cc49c499835 | Adjust test for returned name | westernx/sgmock | tests/test_basic_create.py | tests/test_basic_create.py | from common import *
class TestBasicCreate(TestCase):
def test_create_default_return(self):
sg = Shotgun()
type_ = 'Dummy' + mini_uuid().upper()
spec = dict(name=mini_uuid())
proj = sg.create(type_, spec)
print proj
self.assertIsNot(spec, proj)
self.ass... | from common import *
class TestBasicCreate(TestCase):
def test_create_default_return(self):
sg = Shotgun()
type_ = 'Dummy' + mini_uuid().upper()
spec = dict(name=mini_uuid())
proj = sg.create(type_, spec)
self.assertIsNot(spec, proj)
self.assertEqual(len(proj),... | bsd-3-clause | Python |
43701e38d6f03be1143615e0f73ff45ba6bc996b | drop unused test | kurttheviking/agileid-py,kurttheviking/agileid-py | tests/test_to_hexstring.py | tests/test_to_hexstring.py | from bson.objectid import ObjectId
import os
import sys
import unittest
sys.path.insert(0, os.path.abspath('..'))
import agileid
def to_hexstring_invalid():
return agileid.to_hexstring('rar')
def to_hexstring_invalid_oid():
oid = str(ObjectId())
return agileid.to_hexstring('user!' + oid)
class Test(... | from bson.objectid import ObjectId
import os
import sys
import unittest
sys.path.insert(0, os.path.abspath('..'))
import agileid
def to_hexstring_invalid():
return agileid.to_hexstring('rar')
def to_hexstring_invalid_oid():
oid = str(ObjectId())
return agileid.to_hexstring('user!' + oid)
class Test(... | isc | Python |
2720e708240790feeec838f02e97451b603adf14 | Update dsub to 0.1.9.dev0 | DataBiosphere/dsub,DataBiosphere/dsub | dsub/_dsub_version.py | dsub/_dsub_version.py | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
1b80972fe97bebbb20d9e6073b41d286f253c1ef | Use FileWrapper to send files to browser in chunks of 8KB | sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer | documents/views/utils.py | documents/views/utils.py | import mimetypes
import os
from django.http import HttpResponse
from django.core.servers.basehttp import FileWrapper
mimetypes.init()
mimetypes.add_type('application/epub+zip','.epub')
mimetypes.add_type('text/x-brl','.brl')
mimetypes.add_type('text/x-sbsform-g0','.bv')
mimetypes.add_type('text/x-sbsform-g1','.bv')
m... | import mimetypes
import os
from django.http import HttpResponse
mimetypes.init()
mimetypes.add_type('application/epub+zip','.epub')
mimetypes.add_type('text/x-brl','.brl')
mimetypes.add_type('text/x-sbsform-g0','.bv')
mimetypes.add_type('text/x-sbsform-g1','.bv')
mimetypes.add_type('text/x-sbsform-g2','.bk')
def re... | agpl-3.0 | Python |
94a12422379b3a2ecde11e51c4a82c31db26f978 | add missing import | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/web/rpchooks.py | mint/web/rpchooks.py | #
# Copyright (c) 2005-2006 rPath, Inc.
#
# All Rights Reserved
#
import base64
import simplejson
import sys
import xmlrpclib
from mod_python import apache
from mint import config
from mint import server
from mint import maintenance
from mint.web.webhandler import getHttpAuth
from conary.repository import errors
de... | #
# Copyright (c) 2005-2006 rPath, Inc.
#
# All Rights Reserved
#
import base64
import simplejson
import sys
import xmlrpclib
from mod_python import apache
from mint import config
from mint import server
from mint.web.webhandler import getHttpAuth
from conary.repository import errors
def rpcHandler(req, cfg, pathIn... | apache-2.0 | Python |
a12e3f0de9e8c10c279d795744f87b7e716bd34c | Allow south to handle MarkupFilebrowserFiled | Iv/django-markiup-filebrowser,Iv/django-markiup-filebrowser | markitup_filebrowser/fields.py | markitup_filebrowser/fields.py | from markitup.fields import MarkupField
import widgets
class MarkupFilebrowserFiled(MarkupField):
def formfield(self, **kwargs):
defaults = {'widget': widgets.MarkitUpFilebrowserWiget}
defaults.update(kwargs)
return super(MarkupFilebrowserFiled, self).formfield(**defaults)
from django.con... | from markitup.fields import MarkupField
import widgets
class MarkupFilebrowserFiled(MarkupField):
def formfield(self, **kwargs):
defaults = {'widget': widgets.MarkitUpFilebrowserWiget}
defaults.update(kwargs)
return super(MarkupFilebrowserFiled, self).formfield(**defaults)
from django.con... | bsd-3-clause | Python |
075acb5d779419449ea73ec7d36c66829549bb05 | fix bug on model user profile | laprice/newfies-dialer,romonzaman/newfies-dialer,romonzaman/newfies-dialer,newfies-dialer/newfies-dialer,laprice/newfies-dialer,saydulk/newfies-dialer,newfies-dialer/newfies-dialer,emartonline/newfies-dialer,saydulk/newfies-dialer,Star2Billing/newfies-dialer,newfies-dialer/newfies-dialer,Star2Billing/newfies-dialer,new... | newfies/user_profile/models.py | newfies/user_profile/models.py | from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from dialer_gateway.models import Gateway
from dialer_settings.models import DialerSetting
class UserProfile(models.Model):
"""This defines extra features for the user
**Attributes... | from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from dialer_gateway.models import Gateway
from dialer_settings.models import DialerSetting
class UserProfile(models.Model):
"""This defines extra features for the user
**Attributes... | mpl-2.0 | Python |
2ace9ce514d7299a8f3e8dca134a6e4eb3284937 | Move parsing loop into the class itself. | zimolzak/Ignition-poker-parser | parser2.py | parser2.py | from pprint import pprint
class Hand:
def __init__(self, string):
segments = "seats preflop flop turn river".split()
self.seats = None
self.preflop = None
self.flop = None
self.turn = None
self.river = None
self.summary = None
## step 2: split each ha... | from pprint import pprint
input = open('example_ignition.txt').read()
hands = input.split('\n\n\n')
class Hand:
def __init__(self, se=None, p=None, f=None, t=None, r=None, su=None):
self.seats = se
self.preflop = p
self.flop = f
self.turn = t
self.river = r
self.summ... | mit | Python |
a1ab1f8a9adbe69478129acbe2656d694e74739e | Allow creating the DB schema with `python -m clog.models.log` | imiric/clog-server,imiric/clog-server,imiric/clog-server | clog/models/log.py | clog/models/log.py | from datetime import datetime
import peewee as pw
from . import db, BaseModel
class Log(BaseModel):
hash = pw.CharField(max_length=255)
data = pw.TextField()
class Event(BaseModel):
log = pw.ForeignKeyField(Log, related_name='events')
source = pw.CharField(max_length=255)
date = pw.DateTimeFie... | from datetime import datetime
import peewee as pw
from . import db, BaseModel
class Log(BaseModel):
hash = pw.CharField(max_length=255)
data = pw.TextField()
class Event(BaseModel):
log = pw.ForeignKeyField(Log, related_name='events')
source = pw.CharField(max_length=255)
date = pw.DateTimeFie... | mit | Python |
575356a40bdbe6efa1872bdfbb82a0354bf6cd9e | increment version # | lfairchild/PmagPy,lfairchild/PmagPy,lfairchild/PmagPy | pmagpy/version.py | pmagpy/version.py | """
Module contains current pmagpy version number.
Version number is displayed by GUIs
and used by setuptools to assign number to pmagpy/pmagpy-cli.
"""
"pmagpy-4.2.9"
version = 'pmagpy-4.2.9'
| """
Module contains current pmagpy version number.
Version number is displayed by GUIs
and used by setuptools to assign number to pmagpy/pmagpy-cli.
"""
"pmagpy-4.2.8"
version = 'pmagpy-4.2.8'
| bsd-3-clause | Python |
ad577e592c771af784545ec41b7f48d36fcfcc82 | Add appengine workaround for oauth (#628) | GoogleCloudPlatform/python-docs-samples,canglade/NLP,hashems/Mobile-Cloud-Development-Projects,sharbison3/python-docs-samples,canglade/NLP,sharbison3/python-docs-samples,BrandonY/python-docs-samples,JavaRabbit/CS496_capstone,JavaRabbit/CS496_capstone,GoogleCloudPlatform/python-docs-samples,sharbison3/python-docs-sample... | appengine/standard/firebase/firetactoe/appengine_config.py | appengine/standard/firebase/firetactoe/appengine_config.py | import os.path
from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib')
# Patch os.path.expanduser. This should be fixed in GAE
# versions released after Nov 2016.
os.path.expanduser = lambda path: path
| from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib')
| apache-2.0 | Python |
ed9c25e1b2ad4035d02ad98df70ebaada0bfcac0 | update of tests | TUW-GEO/rt1 | tests/test_examples_int.py | tests/test_examples_int.py | # -*- coding: utf-8 -*-
"""
test examples given in paper by comparison against reference solution.
the actual comparison is done by checking the equality of the interaction-term
with a numerical solution (generated with numerical_evaluation.py)
"""
import unittest
import numpy as np
import os
import sys
#sys.... | # -*- coding: utf-8 -*-
"""
test examples given in paper by comparison against reference solution.
the actual comparison is done by checking the equality of the interaction-term
with a numerical solution (generated with numerical_evaluation.py)
"""
import unittest
import numpy as np
import os
import sys
#sys.... | apache-2.0 | Python |
777b3ff1ac7dc81a8040e3968e2b11cfc6a4761c | Print case date on author assignment. modified: cl/people_db/import_judges/assign_authors.py | voutilad/courtlistener,voutilad/courtlistener,voutilad/courtlistener,voutilad/courtlistener,voutilad/courtlistener | cl/people_db/import_judges/assign_authors.py | cl/people_db/import_judges/assign_authors.py | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 18 18:27:09 2016
@author: elliott
"""
from cl.corpus_importer.import_columbia.parse_judges import find_judges
from cl.lib.import_lib import find_person
from cl.search.models import OpinionCluster
def assign_authors(testing=False):
clusters = OpinionCluster.objects... | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 18 18:27:09 2016
@author: elliott
"""
from cl.corpus_importer.import_columbia.parse_judges import find_judges
from cl.lib.import_lib import find_person
from cl.search.models import OpinionCluster
def assign_authors(testing=False):
clusters = OpinionCluster.objects... | agpl-3.0 | Python |
81b601118591573da8ce32c6de75d79b94b26f24 | add root to sys.path | blossomica/airmozilla,mozilla/airmozilla,blossomica/airmozilla,mozilla/airmozilla,kenrick95/airmozilla,blossomica/airmozilla,kenrick95/airmozilla,mozilla/airmozilla,mozilla/airmozilla,kenrick95/airmozilla,blossomica/airmozilla,kenrick95/airmozilla,kenrick95/airmozilla | wsgi/playdoh.wsgi | wsgi/playdoh.wsgi | import os
import site
os.environ.setdefault('CELERY_LOADER', 'django')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'airmozilla.settings')
# Add the app dir to the python path so we can import manage.
wsgidir = os.path.dirname(__file__)
site.addsitedir(os.path.abspath(os.path.join(wsgidir, '../')))
from django.c... | import os
import site
os.environ.setdefault('CELERY_LOADER', 'django')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'airmozilla.settings')
# Add the app dir to the python path so we can import manage.
#wsgidir = os.path.dirname(__file__)
#site.addsitedir(os.path.abspath(os.path.join(wsgidir, '../')))
from django... | bsd-3-clause | Python |
86117cc5505630bbe1583e74177c1d789e231d4d | Add import statement | HERA-Team/Monitor_and_Control,HERA-Team/hera_mc,HERA-Team/hera_mc | scripts/mc_add_observation.py | scripts/mc_add_observation.py | #! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2017 the HERA Collaboration
# Licensed under the 2-clause BSD license.
from __future__ import absolute_import, division, print_function
import argparse
import os
import numpy as np
from astropy.time import Time, TimeDelta
import aipy
from pyuvd... | #! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2017 the HERA Collaboration
# Licensed under the 2-clause BSD license.
from __future__ import absolute_import, division, print_function
import argparse
import numpy as np
from astropy.time import Time, TimeDelta
import aipy
from pyuvdata import... | bsd-2-clause | Python |
fd5509abcaa064b6da072d013ee29ad3e8b2ec99 | Reorganize imports. | GeneralMaximus/secondhand | tracker/models.py | tracker/models.py | from django.contrib.auth.models import User
from django.db import models
class Task(models.Model):
name = models.DateTimeField()
user = models.ForeignKey(User)
class WorkSession(models.Model):
task = models.ForeignKey('Task')
user = models.ForeignKey(User)
start_time = models.DateTimeField()
... | from django.db import models
from django.contrib.auth.models import User
class Task(models.Model):
name = models.DateTimeField()
user = models.ForeignKey(User)
class WorkSession(models.Model):
task = models.ForeignKey('Task')
user = models.ForeignKey(User)
start_time = models.DateTimeField()
... | mit | Python |
3607d5e794a3d519741ac9d9591577569b2f9a7f | rename unit to u to prevent automatic include in eclipse to find it instead of Unit class, but this file should not be in HWT | Nic30/HWToolkit | cli_toolkit/vivado/samples/synthetizeUnit.py | cli_toolkit/vivado/samples/synthetizeUnit.py | # [TODO] mv to hwtLib
from hdl_toolkit.samples.iLvl.simple2 import SimpleUnit2
from cli_toolkit.vivado.api import portmapXdcForUnit, walkEachBitOnUnit
from cli_toolkit.vivado.xdcGen import IoStandard
from cli_toolkit.shortcuts import buildUnit
if __name__ == "__main__":
u = SimpleUnit2()
def getConstrains(un... | from hdl_toolkit.samples.iLvl.simple2 import SimpleUnit2
from cli_toolkit.vivado.api import portmapXdcForUnit, walkEachBitOnUnit
from cli_toolkit.vivado.xdcGen import IoStandard
from cli_toolkit.shortcuts import buildUnit
if __name__ == "__main__":
unit = SimpleUnit2()
def getConstrains(unit):
def r(r... | mit | Python |
35021a7351923a376ee1af94334a4482c4dcf1e8 | embed emacs and vim setting in file | iglpdc/nipype,JohnGriffiths/nipype,gerddie/nipype,pearsonlab/nipype,FredLoney/nipype,mick-d/nipype,wanderine/nipype,wanderine/nipype,dgellis90/nipype,gerddie/nipype,mick-d/nipype_source,gerddie/nipype,rameshvs/nipype,sgiavasis/nipype,dmordom/nipype,mick-d/nipype,pearsonlab/nipype,mick-d/nipype_source,christianbrodbeck/... | nipype/interfaces/spm/utils.py | nipype/interfaces/spm/utils.py | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from nipype.interfaces.spm.base import SPMCommandInputSpec, SPMCommand
from nipype.interfaces.matlab import MatlabInputSpec, MatlabCommand
from nipype.interfaces.base import File
from nipype.utils.filemanip... | from nipype.interfaces.spm.base import SPMCommandInputSpec, SPMCommand
from nipype.interfaces.base import File
from nipype.utils.filemanip import split_filename
import os
class Analyze2niiInputSpec(SPMCommandInputSpec):
analyze_file = File(exists=True, mandatory=True)
class Analyze2niiOutputSpec(SPMCommandInputSp... | bsd-3-clause | Python |
68a229ec97e193d63edfc8a1960898e39f3b08fd | handle critical and non-critical tags + log level | userzimmermann/robotframework-python3,Senseg/robotframework,Senseg/robotframework,Senseg/robotframework,Senseg/robotframework,userzimmermann/robotframework-python3,userzimmermann/robotframework-python3,userzimmermann/robotframework-python3,Senseg/robotframework,userzimmermann/robotframework-python3 | src/robot/result/configurer.py | src/robot/result/configurer.py | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | apache-2.0 | Python |
7c993016f55b53dca74455ec2b668c7699e749c5 | Move import of AttributeAdapter sooner to allow plugins to load it for their respective imports. | datajoint/datajoint-python,dimitri-yatsenko/datajoint-python | datajoint/__init__.py | datajoint/__init__.py | """
DataJoint for Python is a framework for building data piplines using MySQL databases
to represent pipeline structure and bulk storage systems for large objects.
DataJoint is built on the foundation of the relational data model and prescribes a
consistent method for organizing, populating, and querying data.
The Da... | """
DataJoint for Python is a framework for building data piplines using MySQL databases
to represent pipeline structure and bulk storage systems for large objects.
DataJoint is built on the foundation of the relational data model and prescribes a
consistent method for organizing, populating, and querying data.
The Da... | lgpl-2.1 | Python |
3437a0130084a49e730ac8bbde9d6dac5650bfbb | add index concurrently | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sms/migrations/0045_auto_20200902_0938.py | corehq/apps/sms/migrations/0045_auto_20200902_0938.py | # Generated by Django 2.2.13 on 2020-09-02 09:38
from django.db import migrations, models
TABLE_NAME = 'sms_sms'
INDEX_NAME = 'sms_sms_process_fa9dfa_idx'
COLUMNS = ['processed_timestamp']
CREATE_INDEX_SQL = "CREATE INDEX CONCURRENTLY IF NOT EXISTS {} ON {} ({})".format(
INDEX_NAME, TABLE_NAME, ','.join(COLUMNS... | # Generated by Django 2.2.13 on 2020-09-02 09:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sms', '0044_opt_keywords'),
]
operations = [
migrations.AddIndex(
model_name='sms',
index=models.Index(fields=['pro... | bsd-3-clause | Python |
93330d1b6b4b294b0c734dcd1e60d2839fc4f868 | Make modules uninstallable | BT-rmartin/partner-contact,BT-rmartin/partner-contact,OCA/partner-contact,OCA/partner-contact | partner_contact_nationality/__openerp__.py | partner_contact_nationality/__openerp__.py | # -*- coding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version ... | # -*- coding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version ... | agpl-3.0 | Python |
a76d71fc02e4b33efa78a5aa00301c83bbd7e872 | Use `TokenSyntax` | apple/swift,glessard/swift,JGiola/swift,hooman/swift,xwu/swift,atrick/swift,tkremenek/swift,gregomni/swift,atrick/swift,rudkx/swift,xwu/swift,benlangmuir/swift,hooman/swift,tkremenek/swift,benlangmuir/swift,gregomni/swift,rudkx/swift,tkremenek/swift,tkremenek/swift,parkera/swift,hooman/swift,roambotics/swift,roambotics... | utils/gyb_syntax_support/kinds.py | utils/gyb_syntax_support/kinds.py | """
All the known base syntax kinds. These will all be considered non-final classes
and other types will be allowed to inherit from them.
"""
SYNTAX_BASE_KINDS = ['Decl', 'Expr', 'Pattern', 'Stmt',
'Syntax', 'SyntaxCollection', 'Type']
def kind_to_type(kind):
"""
Converts a SyntaxKind to ... | """
All the known base syntax kinds. These will all be considered non-final classes
and other types will be allowed to inherit from them.
"""
SYNTAX_BASE_KINDS = ['Decl', 'Expr', 'Pattern', 'Stmt',
'Syntax', 'SyntaxCollection', 'Type']
def kind_to_type(kind):
"""
Converts a SyntaxKind to ... | apache-2.0 | Python |
8099d8702842f3c8ed8176195c825b1c5524761f | bump to 0.5.4. | tsuru/tsuru-circus | tsuru/__init__.py | tsuru/__init__.py | # Copyright 2013 tsuru-circus authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
__version__ = "0.5.4"
| # Copyright 2013 tsuru-circus authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
__version__ = "0.5.3"
| bsd-3-clause | Python |
0bccdce96ecadfd4f27508b84074a024d1a4b15e | Check that invoice items sum to total | pwaring/125-accounts,pwaring/125-accounts | scripts/generate-invoice.py | scripts/generate-invoice.py | #!/usr/bin/env python3
import argparse
import decimal
import sys
import yaml
import jinja2
import weasyprint
decimal.getcontext().prec = 2
parser = argparse.ArgumentParser()
parser.add_argument('--data', help='path to data directory', required=True)
parser.add_argument('--number', help='Invoice number', type=int, r... | #!/usr/bin/env python3
import argparse
import yaml
import jinja2
import weasyprint
parser = argparse.ArgumentParser()
parser.add_argument('--data', help='path to data directory', required=True)
parser.add_argument('--number', help='Invoice number', type=int, required=True)
args = parser.parse_args()
data_directory =... | mit | Python |
f21fcba4e75a5b0e161b11859243d6656a3e9fb3 | Mend method call signatures | Mause/dcputoolchain-module-site,Mause/dcputoolchain-module-site | tests/test_module_utils.py | tests/test_module_utils.py | import common
class TestModuleUtils(common.DMSTestCase):
def test_get_module_data(self):
data = \
'''
MODULE = {
Type = "Hardware",
Name = "HMD2043",
Version = "1.1",
SDescription = "Deprecated HMD2043 hardw... | import common
class TestModuleUtils(common.DMSTestCase):
def test_get_module_data(self, get_url_content):
data = \
'''
MODULE = {
Type = "Hardware",
Name = "HMD2043",
Version = "1.1",
SDescription = "Depreca... | mit | Python |
aa708b970996e03f63709aa1af250ba416626265 | update analysis test for python 3 | ljchang/nltools,ljchang/neurolearn,elvandy/nltools | nltools/tests/test_analysis.py | nltools/tests/test_analysis.py | from __future__ import division
import os
import numpy as np
import nibabel as nb
import pandas as pd
from nltools.simulator import Simulator
from nltools.analysis import Roc
from nltools.data import Brain_Data
import matplotlib
matplotlib.use('TkAgg')
def test_roc(tmpdir):
sim = Simulator()
r = 10
sigma ... | from __future__ import division
import os
import numpy as np
import nibabel as nb
import pandas as pd
from nltools import analysis, simulator
from nltools.data import Brain_Data
import matplotlib
matplotlib.use('TkAgg')
def test_roc(tmpdir):
sim = simulator.Simulator()
r = 10
sigma = .1
y = [0, 1]
... | mit | Python |
2f96ed6e089a1c3b240d6a0de8e64fd732d9fb16 | use subprocess | ITKTools/ITKTools,ITKTools/ITKTools,ITKTools/ITKTools,ITKTools/ITKTools | src/scripts/pxcompressimage.py | src/scripts/pxcompressimage.py | #!/usr/bin/env python
import fileinput
import sys
import subprocess
import glob
import os.path
from optparse import OptionParser
#import os
#import shutil
#import re
#from optparse import OptionParser # Deprecated with python 2.7
#import argparse # Requires python 2.7 or greater
#-----------------------------------... | #!/usr/bin/env python
import fileinput
import sys
import glob
import os.path
from optparse import OptionParser
#import os
#import shutil
#import re
#from optparse import OptionParser # Deprecated with python 2.7
#import argparse # Requires python 2.7 or greater
#-----------------------------------------------------... | apache-2.0 | Python |
eb5dc3ef7e7904549f50a4255477ed50d3ee53ab | Reduce fetch size to 5000. Don't run job on startup. | kkwteh/twinyewest | twinsies/clock.py | twinsies/clock.py | from apscheduler.schedulers.blocking import BlockingScheduler
from twinsies.twitter import (random_trend_query, fetch_tweets, dig_for_twins,
update_status)
from memory_profiler import profile
sched = BlockingScheduler()
@sched.scheduled_job('interval', minutes=16)
@profile
def twinsy_finder(fetch_size=5000):
... | from apscheduler.schedulers.blocking import BlockingScheduler
from twinsies.twitter import (random_trend_query, fetch_tweets, dig_for_twins,
update_status)
from memory_profiler import profile
sched = BlockingScheduler()
@sched.scheduled_job('interval', minutes=16)
@profile
def twinsy_finder(fetch_size=10000):
... | mit | Python |
c95d8130cea104f7ec333d5b8f87b21ad5c17dc8 | add autocomplete attributes to name field so doesn't autocomplete with user name fixes #3041 | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/apps/bplan/forms.py | meinberlin/apps/bplan/forms.py | from django import forms
from meinberlin.apps.extprojects.forms import ExternalProjectCreateForm
from meinberlin.apps.extprojects.forms import ExternalProjectForm
from . import models
class StatementForm(forms.ModelForm):
class Meta:
model = models.Statement
fields = ['name', 'email', 'statement... | from django import forms
from meinberlin.apps.extprojects.forms import ExternalProjectCreateForm
from meinberlin.apps.extprojects.forms import ExternalProjectForm
from . import models
class StatementForm(forms.ModelForm):
class Meta:
model = models.Statement
fields = ['name', 'email', 'statement... | agpl-3.0 | Python |
ea8ccd12232db471a0db4278c4d1605ea16c0d1c | split hostname out of path | CyberReboot/vent,bpagon13/vent,cprafullchandra/vent,CyberReboot/vent,cglewis/vent,bpagon13/vent,Jeff-Wang93/vent,bpagon13/vent,lilchurro/vent,cglewis/vent,lilchurro/vent,Jeff-Wang93/vent,CyberReboot/vent,cglewis/vent,lilchurro/vent,Jeff-Wang93/vent,cprafullchandra/vent | vent/core/rq-worker/file_watch.py | vent/core/rq-worker/file_watch.py | def file_queue(path):
"""
Processes files that have been added from the rq-worker, starts plugins
that match the mime type for the new file.
"""
import ConfigParser
import docker
import magic
import os
import time
d_client = docker.from_env()
images = []
hostname, path... | def file_queue(path):
"""
Processes files that have been added from the rq-worker, starts plugins
that match the mime type for the new file.
"""
import ConfigParser
import docker
import magic
import os
import time
d_client = docker.from_env()
images = []
# read in conf... | apache-2.0 | Python |
796e734f67ea3c4afcb6c17204108d9b2c3d7120 | Validate email id, while editing user profile | CoderBounty/coderbounty,CoderBounty/coderbounty,atuljain/coderbounty,atuljain/coderbounty,atuljain/coderbounty,CoderBounty/coderbounty,atuljain/coderbounty,CoderBounty/coderbounty | website/forms.py | website/forms.py | from django import forms
from .models import Issue,Bounty,UserProfile
from django.contrib.auth.models import User
class IssueCreateForm(forms.ModelForm):
issueUrl = forms.CharField(label="issueUrl")
class Meta:
model = Issue
fields = ('title','language','content')
class BountyCreateForm(forms.... | from django import forms
from .models import Issue,Bounty,UserProfile
from django.contrib.auth.models import User
class IssueCreateForm(forms.ModelForm):
issueUrl = forms.CharField(label="issueUrl")
class Meta:
model = Issue
fields = ('title','language','content')
class BountyCreateForm(forms.... | agpl-3.0 | Python |
ba1f0f75aa9b5db8440074bb6d48580c884adde0 | Update application url | hackerspace-ntnu/website,hackerspace-ntnu/website,hackerspace-ntnu/website | website/views.py | website/views.py | from django.shortcuts import render
from django.http import HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from news.models import Article, Event
from door.models import DoorStatus
from datetime import datetime
from itertools import chain
def index(request):
number_of_news = 3
# S... | from django.shortcuts import render
from django.http import HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from news.models import Article, Event
from door.models import DoorStatus
from datetime import datetime
from itertools import chain
def index(request):
number_of_news = 3
# S... | mit | Python |
705d0b53fd5906891c025685a714e0cfb95e1afa | Add functions to load sample traj and sim objects | kbsezginel/tee_mof,kbsezginel/tee_mof | thermof/sample/__init__.py | thermof/sample/__init__.py | """
Sample input files for predicting thermal conductivity of porous crystals using Lammps
"""
import os
from thermof import Simulation, Trajectory
from thermof.parameters import k_parameters
sample_dir = os.path.abspath(os.path.dirname(__file__))
# Lammps input file with thermal flux measured in single direction
sin... | """
Sample input files for predicting thermal conductivity of porous crystals using Lammps
"""
import os
sample_dir = os.path.abspath(os.path.dirname(__file__))
# Lammps input file with thermal flux measured in single direction
single_inp_path = os.path.join(sample_dir, 'in_single.cond.sample') # Single MOF
# ... | mit | Python |
e18cd136dcaa13225b0144ba310c926aaadee38a | Introduce scope_types in server group policy | klmitch/nova,mahak/nova,openstack/nova,openstack/nova,mahak/nova,mahak/nova,klmitch/nova,klmitch/nova,openstack/nova,klmitch/nova | nova/policies/server_groups.py | nova/policies/server_groups.py | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | apache-2.0 | Python |
0072a1eafac0c147953a3abec5cdfad0e50210fa | Prepare for 1.2 version | etalab/udata,opendatateam/udata,etalab/udata,davidbgk/udata,davidbgk/udata,davidbgk/udata,opendatateam/udata,etalab/udata,opendatateam/udata | udata/__init__.py | udata/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
uData
'''
from __future__ import unicode_literals
__version__ = '1.2.0.dev'
__description__ = 'Open data portal'
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
uData
'''
from __future__ import unicode_literals
__version__ = '1.1.1.dev'
__description__ = 'Open data portal'
| agpl-3.0 | Python |
7b9a04cb8655fad955829936c2b43b9ca37b3fe8 | Add state column to user create api | vrk-kpa/api-catalog,vrk-kpa/api-catalog,vrk-kpa/api-catalog,vrk-kpa/api-catalog | ckanext/ckanext-apicatalog_routes/ckanext/apicatalog_routes/db.py | ckanext/ckanext-apicatalog_routes/ckanext/apicatalog_routes/db.py | import uuid
from ckan import model
from ckan.lib import dictization
from ckan.plugins import toolkit
from sqlalchemy import Column, types
from sqlalchemy.ext.declarative import declarative_base
import logging
log = logging.getLogger(__name__)
Base = declarative_base()
def make_uuid():
return unicode(uuid.uuid4(... | import uuid
from ckan import model
from ckan.lib import dictization
from ckan.plugins import toolkit
from sqlalchemy import Column, types
from sqlalchemy.ext.declarative import declarative_base
import logging
log = logging.getLogger(__name__)
Base = declarative_base()
def make_uuid():
return unicode(uuid.uuid4(... | mit | Python |
61e09f3f1b5d07a8dbaceaccb483c7886dd1b228 | add CONN_IFACE_CONTACT_CAPA and CONN_IFACE_CONTACTS | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | tests/twisted/constants.py | tests/twisted/constants.py | """
Some handy constants for other tests to share and enjoy.
"""
HT_CONTACT = 1
HT_CONTACT_LIST = 3
CHANNEL = "org.freedesktop.Telepathy.Channel"
CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT"
CHANNEL_TYPE_STREAM_... | """
Some handy constants for other tests to share and enjoy.
"""
HT_CONTACT = 1
HT_CONTACT_LIST = 3
CHANNEL = "org.freedesktop.Telepathy.Channel"
CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT"
CHANNEL_TYPE_STREAM_... | lgpl-2.1 | Python |
4daac5ff78e1488e342300e8dde1d3b4adb9a08c | upgrade constants.py from Gabble | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | tests/twisted/constants.py | tests/twisted/constants.py | """
Some handy constants for other tests to share and enjoy.
"""
HT_CONTACT = 1
CHANNEL = "org.freedesktop.Telepathy.Channel"
CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT"
CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Ty... | """
Some handy constants for other tests to share and enjoy.
"""
HT_CONTACT = 1
CHANNEL = "org.freedesktop.Telepathy.Channel"
CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube.DRAFT"
CHANNEL_TYPE = CHANNEL + '.ChannelType'
TARGET_HANDLE_TYPE = CHANNEL + '.TargetHandl... | lgpl-2.1 | Python |
98b0eb3d492cb816db7ffa7ad062dde36a1feadf | Use testtools as test base class. | varunarya10/oslo.i18n,openstack/oslo.i18n | tests/unit/test_gettext.py | tests/unit/test_gettext.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/l... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/l... | apache-2.0 | Python |
65103a7351ec029371a167eb10e116d1b613a836 | make the logout view return to the login page, fixes #1975 | ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide | calebasse/urls.py | calebasse/urls.py | from django.conf.urls import patterns, include, url
from django.views.generic.simple import redirect_to
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from urls_utils import decorated_includes
from calebasse.api import EventResource, OccurrenceResource
admin.autodiscover()... | from django.conf.urls import patterns, include, url
from django.views.generic.simple import redirect_to
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from urls_utils import decorated_includes
from calebasse.api import EventResource, OccurrenceResource
admin.autodiscover()... | agpl-3.0 | Python |
c65306f78f1eb97714fd2086d20ff781faf78c3a | Make py starterpackage more like java/c++ one | HMProgrammingClub/NYCSL,HMProgrammingClub/NYCSL,HMProgrammingClub/NYCSL,HMProgrammingClub/NYCSL,HMProgrammingClub/NYCSL,HMProgrammingClub/NYCSL,HMProgrammingClub/NYCSL | problems/starterpackages/SteinerStarter.py | problems/starterpackages/SteinerStarter.py | import math
import sys
# A helper class for working with points.
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
class Edge:
def __init__(self, p1, p2):
self.p1 = p1
self.p2 = p2
# Gets a problem from a file as an list of points.
def getProblem(filename):
pts = []
with open(filename, 'r') as ... | import math
import sys
# A helper class for working with points.
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
class Edge:
def __init__(self, p1, p2):
self.p1 = p1
self.p2 = p2
def getProblem(filename):
pts = []
with open(filename, 'r') as input:
for line in input:
l = line.split(' ')
... | mit | Python |
375c84fe2e76932bf1785bc02c450f4874dacf2b | Remove unecessary print statements on epoch duration | mrcslws/nupic.research,numenta/nupic.research,subutai/nupic.research,numenta/nupic.research,subutai/nupic.research,mrcslws/nupic.research | projects/vernon_examples/simple_example.py | projects/vernon_examples/simple_example.py | # Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... | # Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... | agpl-3.0 | Python |
596e5e350fa05dcd9dd0aa5969fdde7495f36351 | Simplify block_ast.py a little | smarr/PySOM,smarr/PySOM,SOM-st/PySOM,SOM-st/PySOM | src/som/vmobjects/block_ast.py | src/som/vmobjects/block_ast.py | from rlib import jit
from som.interpreter.ast.frame import is_on_stack
from som.vmobjects.abstract_object import AbstractObject
from som.vmobjects.primitive import Primitive
class AstBlock(AbstractObject):
_immutable_fields_ = ["_method", "_outer"]
def __init__(self, method, context_values):
Abstra... | from rlib import jit
from som.interpreter.ast.frame import is_on_stack
from som.vmobjects.abstract_object import AbstractObject
from som.vmobjects.primitive import Primitive
class AstBlock(AbstractObject):
_immutable_fields_ = ["_method", "_outer"]
def __init__(self, method, context_values):
Abstra... | mit | Python |
aef6d7dc76e4f50069a15c12850120bad593b5f1 | add unwrap.py to python modules in setup.py | newville/scikit-image,ofgulban/scikit-image,ajaybhat/scikit-image,GaZ3ll3/scikit-image,Hiyorimi/scikit-image,SamHames/scikit-image,almarklein/scikit-image,bennlich/scikit-image,warmspringwinds/scikit-image,blink1073/scikit-image,ClinicalGraphics/scikit-image,ajaybhat/scikit-image,vighneshbirodkar/scikit-image,ofgulban/... | unwrap2D/setup.py | unwrap2D/setup.py | from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
#from Cython.Build import cythonize
import numpy as np
ext_modules = [
Extension('unwrap2D',
['unwrap2D.pyx',
'Miguel_2D_unwrapper_with_mask_and_wrap_around_option.c',
... | from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
#from Cython.Build import cythonize
import numpy as np
ext_modules = [
Extension('unwrap2D',
['unwrap2D.pyx',
'Miguel_2D_unwrapper_with_mask_and_wrap_around_option.c',
... | bsd-3-clause | Python |
6ecca227b87bdc14f8f2620d370851647394f141 | Fix missing import | thaim/ansible,thaim/ansible | v2/test/compat.py | v2/test/compat.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | mit | Python |
c14c823f20f45524530c1e661a19281513972872 | Fix test for Python 3.8 | explosion/srsly,explosion/srsly,explosion/srsly,explosion/srsly | srsly/tests/test_pickle_api.py | srsly/tests/test_pickle_api.py | # coding: utf8
from __future__ import unicode_literals
from .._pickle_api import pickle_dumps, pickle_loads
def test_pickle_dumps():
data = {"hello": "world", "test": 123}
expected = [
b"\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00}\x94(\x8c\x05hello\x94\x8c\x05world\x94\x8c\x04test\x94K{u.",
... | # coding: utf8
from __future__ import unicode_literals
from .._pickle_api import pickle_dumps, pickle_loads
def test_pickle_dumps():
data = {"hello": "world", "test": 123}
expected = [
b"\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00}\x94(\x8c\x05hello\x94\x8c\x05world\x94\x8c\x04test\x94K{u.",
... | mit | Python |
bcd80b0cba68741b78b13bb771625d861aebc0d9 | Migrate v20 not handling exception | fabian4/trove,cp16net/trove,zhangg/trove,zhujzhuo/openstack-trove,zhujzhuo/openstack-trove,mmasaki/trove,hplustree/trove,changsimon/trove,openstack/trove,cp16net/trove,zhujzhuo/openstack-trove,openstack/trove,zhangg/trove,fabian4/trove,changsimon/trove,mmasaki/trove,redhat-openstack/trove,mmasaki/trove,fabian4/trove,hp... | trove/db/sqlalchemy/migrate_repo/versions/020_configurations.py | trove/db/sqlalchemy/migrate_repo/versions/020_configurations.py | # Copyright 2014 Rackspace
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | # Copyright 2014 Rackspace
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | apache-2.0 | Python |
f15f235135eaf879eb8e783062aeaf1227e946b4 | Bump version 0.0.2 | creafz/django-paginated-modelformset | paginated_modelformset/__init__.py | paginated_modelformset/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from paginated_modelformset.formset import PaginatedModelFormSet
from paginated_modelformset.paginator import FormSetPage, FormSetPaginator
__author__ = 'Alex Parinov'
__email__ = 'creafz@gmail.com'
__license__ = 'MIT'
__version__ = '0.... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from paginated_modelformset.formset import PaginatedModelFormSet
from paginated_modelformset.paginator import FormSetPage, FormSetPaginator
__author__ = 'Alex Parinov'
__email__ = 'creafz@gmail.com'
__license__ = 'MIT'
__version__ = '0.... | mit | Python |
8df363ccb5faf6637373de01001d33dc5f885d46 | Bump version to 1.1.1 | emory-libraries/ddi-search,emory-libraries/ddi-search | ddisearch/__init__.py | ddisearch/__init__.py | # file ddisearch/__init__.py
#
# Copyright 2014 Emory University
#
# 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 appli... | # file ddisearch/__init__.py
#
# Copyright 2014 Emory University
#
# 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 appli... | apache-2.0 | Python |
138904ef93b0f7afdc4ae33b1388e2b74c868c1a | Fix gsdcurl to correctly URL-quote a password passed via GSDCURL_PASSWORD | bcwaldon/coreos-scripts,crawford/scripts,zhang0137/scripts,mjg59/scripts,trnubo/scripts,endocode/scripts,sigma/coreos-scripts,andrejro/coreos--scripts,vmware/coreos-scripts,BugRoger/scripts,andrejro/coreos--scripts,smilart/scripts,smilart/scripts,endocode/scripts,fivethreeo/scripts,fivethreeo/scripts,bcwaldon/coreos-sc... | bin/cros_gsdcurl.py | bin/cros_gsdcurl.py | #!/usr/bin/python
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import getpass
import os
import re
import subprocess
import sys
import tempfile
import urllib
def Authenticate():
default_usern... | #!/usr/bin/python
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import getpass
import os
import re
import subprocess
import sys
import tempfile
import urllib
def Authenticate():
default_usern... | bsd-3-clause | Python |
3be6a89e0a7efd41e4b8e3eed1635b15e8e36684 | Put service/product mapping to process | rameshgopalakrishnan/v_excel_inventory,rameshgopalakrishnan/v_excel_inventory,rameshgopalakrishnan/v_excel_inventory | service_and_process/models.py | service_and_process/models.py | from django.db import models
from django.contrib.auth.models import User
class MasterAttribute(models.Model):
"""Cotton, Linen"""
TYPE_CHOICES = ((1, 'Material'), )
label = models.TextField()
type = models.IntegerField(choices=TYPE_CHOICES)
class Meta:
unique_together = (("label", "type... | from django.db import models
from django.contrib.auth.models import User
class MasterAttribute(models.Model):
"""Cotton, Linen"""
TYPE_CHOICES = ((1, 'Material'), )
label = models.TextField()
type = models.IntegerField(choices=TYPE_CHOICES)
class Meta:
unique_together = (("label", "type... | apache-2.0 | Python |
d8ef4936fd19280a0fe26b399d938c3d8aeddcc0 | Make sure the serializer can't return the password | pyshopml/jobs-backend,pyshopml/jobs-backend | jobs_backend/users/tests/test_serializers.py | jobs_backend/users/tests/test_serializers.py | from unittest import TestCase
from .. import serializers
from ..models import User
from . import factories
class UserRetrieveSerializerTestCase(TestCase):
def setUp(self):
self.user = factories.ActiveUserFactory.create()
self.serializer = serializers.UserRetrieveSerializer(instance=self.user)
... | from unittest import TestCase
from .. import serializers
from ..models import User
from . import factories
class UserRetrieveSerializerTestCase(TestCase):
def setUp(self):
self.user = factories.ActiveUserFactory.create()
self.serializer = serializers.UserRetrieveSerializer(instance=self.user)
... | mit | Python |
865b9d8307f35203d7242e9c431ec2f6cb65c42e | Revert "Made commands consistent on use of underscores. Re-enabled 'interpret' command that had been misplaced." | tetherless-world/graphene,tetherless-world/graphene,tetherless-world/satoru,tetherless-world/satoru,tetherless-world/satoru,tetherless-world/graphene,tetherless-world/satoru,tetherless-world/graphene | whyis/manager.py | whyis/manager.py | # -*- coding:utf-8 -*-
import flask_script as script
from whyis import commands
from whyis.app_factory import app_factory
from whyis.config_utils import import_config_module
class Manager(script.Manager):
def __init__(self):
script.Manager.__init__(self, app_factory)
config = import_config_mo... | # -*- coding:utf-8 -*-
import flask_script as script
from whyis import commands
from whyis.app_factory import app_factory
from whyis.config_utils import import_config_module
class Manager(script.Manager):
def __init__(self):
script.Manager.__init__(self, app_factory)
config = import_config_mo... | apache-2.0 | Python |
096ad9487d463a8eb3c3fb3eb7b5e2de1cef712f | remove unused super() call in NullTarget | siddhantgoel/streaming-form-data | streaming_form_data/targets.py | streaming_form_data/targets.py | import hashlib
class BaseTarget:
"""Targets determine what to do with some input once the parser is done with
it. Any new Target should inherit from this class and override
data_received.
"""
def __init__(self):
self.multipart_filename = None
# 'multipart_filename ' is filled before ... | import hashlib
class BaseTarget:
"""Targets determine what to do with some input once the parser is done with
it. Any new Target should inherit from this class and override
data_received.
"""
def __init__(self):
self.multipart_filename = None
# 'multipart_filename ' is filled before ... | mit | Python |
283fbea6ffc36cc12babed29f73a37373cf0bae2 | Fix pep8 | RuralIndia/pari,RuralIndia/pari,RuralIndia/pari,RuralIndia/pari | pari/article/context_processors.py | pari/article/context_processors.py | from .models import Type
from django.contrib.sites.models import RequestSite
def types(request):
return {'types': Type.objects.all()}
def sites(request):
return {'site': RequestSite(request)}
| from .models import Type
from django.contrib.sites.models import RequestSite
def types(request):
return {'types': Type.objects.all()}
def sites(request):
return {'site': RequestSite(request)}
| bsd-3-clause | Python |
f57c2c2d537033971771a5e8fc2230339376efca | bump version | pwyliu/strikepackage | strikepackage/strikepackage.py | strikepackage/strikepackage.py | """strikepackage
strikepackage thinks your mom is a classy lady.
Usage:
strikepackage deploy <xenserver_url> [--conf <config_file>]
strikepackage mkconfig
strikepackage (-h | --help)
strikepackage (-v | --version)
Examples:
* Run strikepackage against XenServer API:
strikepackage deploy https://myxen... | """strikepackage
strikepackage thinks your mom is a classy lady.
Usage:
strikepackage deploy <xenserver_url> [--conf <config_file>]
strikepackage mkconfig
strikepackage (-h | --help)
strikepackage (-v | --version)
Examples:
* Run strikepackage against XenServer API:
strikepackage deploy https://myxen... | mit | Python |
a67ced3bca091d8aa6c69b715b91ddba9857ab9b | Fix typo. Closes #111. | YihaoLu/statsmodels,josef-pkt/statsmodels,rgommers/statsmodels,huongttlan/statsmodels,wzbozon/statsmodels,alekz112/statsmodels,statsmodels/statsmodels,bashtage/statsmodels,alekz112/statsmodels,ChadFulton/statsmodels,jstoxrocky/statsmodels,saketkc/statsmodels,statsmodels/statsmodels,phobson/statsmodels,hainm/statsmodels... | scikits/statsmodels/tools/tests/test_parallel.py | scikits/statsmodels/tools/tests/test_parallel.py | from scikits.statsmodels.tools.parallel import parallel_func
from numpy import arange, testing
from math import sqrt
def test_parallel():
x = arange(10.)
parallel, p_func, n_jobs = parallel_func(sqrt, n_jobs=-1, verbose=0)
y = parallel(p_func(i**2) for i in range(10))
testing.assert_equal(x,y)
| from scikits.statsmodels.tools.parallel import parallel_func
from numpy import arange, testing
from math import sqrt
def test_parrallel():
x = arange(10.)
parallel, p_func, n_jobs = parallel_func(sqrt, n_jobs=-1, verbose=0)
y = parallel(p_func(i**2) for i in range(10))
testing.assert_equal(x,y)
| bsd-3-clause | Python |
c82b551a9eed0716224841d4917f97ccec75ff14 | Fix addtoken cli method | jjulik/keezer-pi,jjulik/keezer-pi,jjulik/keezer-pi,jjulik/keezer-pi | keezer_server/keezer_server/keezer_server.py | keezer_server/keezer_server/keezer_server.py | import os
import sqlite3
import random
import string
from flask import Flask
from flask import Flask, request, session, g, redirect, url_for, abort
app = Flask(__name__)
app.config.update(dict(
DATABASE=os.path.join(app.root_path, 'keezer_server.db'),
DEBUG=False
))
app.config.from_envvar('KEEZER_SETTINGS', silent... | import os
import sqlite3
from flask import Flask
from flask import Flask, request, session, g, redirect, url_for, abort
app = Flask(__name__)
app.config.update(dict(
DATABASE=os.path.join(app.root_path, 'keezer_server.db'),
DEBUG=False
))
app.config.from_envvar('KEEZER_SETTINGS', silent=True)
@app.route('/')
def ... | mit | Python |
3f635db216c292c0eec720d28ecfbec3e23f1ca5 | Patch S3Boto3Storage to prevent closed file error when collectin static | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ynr/s3_storage.py | ynr/s3_storage.py | import os
from storages.backends.s3boto3 import S3Boto3Storage, SpooledTemporaryFile
from django.contrib.staticfiles.storage import ManifestFilesMixin
from pipeline.storage import PipelineMixin
from django.conf import settings
class PatchedS3Boto3Storage(S3Boto3Storage):
def _save_content(self, obj, content, pa... | from storages.backends.s3boto3 import S3Boto3Storage
from django.contrib.staticfiles.storage import ManifestFilesMixin
from pipeline.storage import PipelineMixin
from django.conf import settings
class StaticStorage(PipelineMixin, ManifestFilesMixin, S3Boto3Storage):
"""
Store static files on S3 at STATICFILE... | agpl-3.0 | Python |
f6d60fb851dbca9b97bbe88461fa4258ac9825ea | Fix style errors | Uname-a/knife_scraper,Uname-a/knife_scraper,Uname-a/knife_scraper | willie/logger.py | willie/logger.py | # coding=utf8
from __future__ import unicode_literals
import logging
class IrcLoggingHandler(logging.Handler):
def __init__(self, bot, level):
super(IrcLoggingHandler, self).__init__(level)
self._bot = bot
self._channel = bot.config.core.logging_channel
def emit(self, record):
... | import logging
class IrcLoggingHandler(logging.Handler):
def __init__(self, bot, level):
super(IrcLoggingHandler, self).__init__(level)
self._bot = bot
self._channel = bot.config.core.logging_channel
def emit(self, record):
try:
msg = self.format(record)
... | mit | Python |
ff2544c0b38b9632e7d7a548b13d817a15fa53c5 | Implement UUID extraction for Query | erget/Presence | presence/query.py | presence/query.py | import json
from .coda_aware import CODA_Aware
from datetime import datetime
class Query(CODA_Aware):
"""Find CODA products based on search criteria."""
def _datetime_to_filter_string(self, dt, cmp):
str = "IngestionDate " + cmp + dt.strftime("datetime'%Y-%m%dT%I:%M:%S'")
return str... | import json
from .coda_aware import CODA_Aware
from datetime import datetime
class Query(CODA_Aware):
def __init__(self, time_start, time_end, bbox, prod_type):
self.time_start = time_start
self.time_end = time_end
self.bbox = bbox,
self.prod_type = prod_type
if ... | mit | Python |
c725eccc8503b58ebdc992d2a4278bcb0aa42692 | return values for expand function | swaroopsm/Console-Bitly | ConsoleBitly/__init__.py | ConsoleBitly/__init__.py | #!/usr/bin/python
import urllib
import urllib2
import json
class ConsoleBitly:
def __init__(self,bitly_username,bitly_apikey):
self.bitly_username=bitly_username
self.bitly_apikey=bitly_apikey
def shorten(self,req):
try:
url="http://api.bitly.com/v3/shorten?login="+self.bitly_username+"&apiKey="+self.bit... | #!/usr/bin/python
import urllib
import urllib2
import json
class ConsoleBitly:
def __init__(self,bitly_username,bitly_apikey):
self.bitly_username=bitly_username
self.bitly_apikey=bitly_apikey
def shorten(self,req):
try:
url="http://api.bitly.com/v3/shorten?login="+self.bitly_username+"&apiKey="+self.bit... | mit | Python |
f481dd61863421509af4ac9d4b9adaf1a2978396 | Update openblas.py | vadimkantorov/wigwam | wigs/openblas.py | wigs/openblas.py | class openblas(Wig):
tarball_uri = 'https://github.com/xianyi/OpenBLAS/archive/v$RELEASE_VERSION$.tar.gz'
last_release_version = 'v0.2.18'
supported_features = ['debug', 'threads']
default_features = ['+threads']
def setup(self):
self.skip('configure')
self.make_flags += ['FC=gfortran', 'NO_AFFINITY=1']
sel... | class openblas(Wig):
tarball_uri = 'https://github.com/xianyi/OpenBLAS/archive/v$RELEASE_VERSION$.tar.gz'
last_release_version = 'v0.2.18'
supported_features = ['debug']
def setup(self):
self.skip('configure')
self.make_flags += ['FC=gfortran', 'NO_AFFINITY=1', 'USE_OPENMP=1']
self.make_install_flags += [S.P... | mit | Python |
3a5fd0d00234cfa1441f890f8bfcc66d95ad714b | fix argument of mogrify command | ShapeNet/JointEmbedding,ShapeNet/JointEmbedding,ShapeNet/JointEmbedding,ShapeNet/JointEmbedding | src/experiments/compute_distance_matrices/crop_resize_fixedview.py | src/experiments/compute_distance_matrices/crop_resize_fixedview.py | import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(os.path.dirname(BASE_DIR)))
from global_variables import *
# parallely crop and resize images
os.system("find %s -name '*.png'|xargs -n 1 -P 40 mogrify -trim -resize '227x227!'" % (g_fixedview_image_folder))
| import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(os.path.dirname(BASE_DIR)))
from global_variables import *
# parallely crop and resize images
os.system("find %s -name '*.png'|xargs -n 1 -P 40 mogrify -trim -resize '227*227!'" % (g_fixedview_image_folder))
| bsd-3-clause | Python |
af4dab1ab92cd9e85bf32c09998a98bfdd5db806 | Deploy Travis CI build 404 to GitHub | jacebrowning/template-python-demo | demo/test/__init__.py | demo/test/__init__.py | """Tests for the `demo` package."""
| """Tests for the demo package."""
| mit | Python |
555a95976954a11e7d9d3e58f07cc5f6c0d57a3c | use click help strings to show defaults | carlgeorge/wock,carlwgeorge/wock | wock/__init__.py | wock/__init__.py | import os
import pathlib
import click
from .utils import ContextObj
@click.group()
@click.option('--pkgname', help='[{}]'.format(pathlib.Path.cwd().name))
@click.option('--release', envvar='WOCK',
help='[{}]'.format(os.environ.get('WOCK')))
@click.option('--architecture', default='x86_64', help='[x86_64... | import os
import click
from .utils import ContextObj
@click.group()
@click.option('--pkgname',
help='Desired package name.\t[current directory name]')
@click.option('--release', envvar='WOCK',
help='Desired release.\t[{}]'.format(os.environ.get('WOCK')))
@click.option('--architecture', def... | apache-2.0 | Python |
7b939076fba1bb11d0ded504bcf10da457b3d092 | Remove check for domain in DOI | mattclark/osf.io,crcresearch/osf.io,aaxelb/osf.io,saradbowman/osf.io,adlius/osf.io,mattclark/osf.io,laurenrevere/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,leb2dg/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,sloria/osf.io,mfraezz/osf.io,chrisseto/osf.io,pattisdr/osf.io,sloria/osf.io,adlius/osf.io,felliott/osf.i... | scripts/add_identifiers_to_existing_preprints.py | scripts/add_identifiers_to_existing_preprints.py | import logging
import time
from website.app import init_app
from website.identifiers.utils import request_identifiers_from_ezid
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def add_identifiers_to_preprints():
from osf.models import PreprintService
preprints_without_identifie... | import logging
import time
from website.app import init_app
from website.identifiers.utils import get_top_level_domain, request_identifiers_from_ezid
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def add_identifiers_to_preprints():
from osf.models import PreprintService
prepr... | apache-2.0 | Python |
ade3a316166d3c4c362becd7880e60bd9387b259 | Select only unsubscribed contacts from mailjet on sync script | ulule/django-courriers,ulule/django-courriers | courriers/management/commands/mailjet_sync_unsubscribed.py | courriers/management/commands/mailjet_sync_unsubscribed.py | from django.core.management.base import BaseCommand
from django.db import DEFAULT_DB_ALIAS
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--connection',
action='store',
dest='connection',
... | from django.core.management.base import BaseCommand
from django.db import DEFAULT_DB_ALIAS
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--connection',
action='store',
dest='connection',
... | mit | Python |
9dd13303ff874b494a95496c3e089e2962b50e67 | Fix indexing issue | steinbrecher/pi-qrng | select_winner.py | select_winner.py | ###############################################################################
# #
# # File Name: select_winner.py
# #
# # Current owner: Greg Steinbrecher (steinbrecher@alum.mit.edu)
# # Last Modified Time-stamp: <2015-02-11 06:49:49 gstein>
# #
# # Created by: Greg Steinbrecher (steinbrecher@alum.mit.edu)
# # Cre... | ###############################################################################
# #
# # File Name: select_winner.py
# #
# # Current owner: Greg Steinbrecher (steinbrecher@alum.mit.edu)
# # Last Modified Time-stamp: <2015-02-11 06:46:58 gstein>
# #
# # Created by: Greg Steinbrecher (steinbrecher@alum.mit.edu)
# # Cre... | mit | Python |
2511e72360ae8a89607ac65f06a6cff0d14bdbba | Revert back to Mouse for plot demo | aforren1/toon | demos/live-plotter.py | demos/live-plotter.py | import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
from toon.input import MpDevice
from toon.input.mouse import Mouse
class LivePlot(pg.GraphicsLayoutWidget):
def __init__(self):
super(LivePlot, self).__init__()
self.plot = self.addPlot()
self.curves = []
... | import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
from toon.input import MpDevice
from toon.input.cyberglove import Cyberglove
class LivePlot(pg.GraphicsLayoutWidget):
def __init__(self):
super(LivePlot, self).__init__()
self.plot = self.addPlot()
self.curves... | mit | Python |
d4fa1ffea7b507eb9f12fef2c70511368bdcaa34 | Fix name clash | CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer | wafer/conf_registration/models.py | wafer/conf_registration/models.py | from django.contrib.auth.models import User
from django.db import models
class ConferenceOptionGroup(models.Model):
"""Used to manage relationships"""
name = models.CharField(max_length=255)
def __unicode__(self):
return u'%s' % self.name
class ConferenceOption(models.Model):
name = models... | from django.contrib.auth.models import User
from django.db import models
class ConferenceOptionGroup(models.Model):
"""Used to manage relationships"""
name = models.CharField(max_length=255)
def __unicode__(self):
return u'%s' % self.name
class ConferenceOption(models.Model):
name = models... | isc | Python |
f282f8256cbb36f045c9ccd42f1a47ef6d22e12a | Update mailgun.py | jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi | apps/mail/mailgun.py | apps/mail/mailgun.py | import requests
# Sending e-mail
def send_email():
return requests.post(
"https://api.mailgun.net/v3/sandboxa4e92f05144a3973f6f8c031849e3.mailgun.org/messages",
auth=("api", "key-3fb9acb996e674af4816edf1055a7"),
data={"from": "BerePi/TinyOS<sensormail@sky>",
"to": ["gadin.kang@gmail.com"],
"subjec... | import requests
# Try running this locally.
def send_email():
return requests.post(
"https://api.mailgun.net/v3/sandboxa4e92f05144a3973f6f8c031849e3.mailgun.org/messages",
auth=("api", "key-3fb9acb996e674af4816edf1055a7"),
data={"from": "BerePi/TinyOS<sensormail@sky>",
"to": ["gadin.kang@gmail.com"],
... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.