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 |
|---|---|---|---|---|---|---|---|---|
04664a035c2d67236ae9befe83110190d17b194c | Add a couple of TODOs | Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed | updates.py | updates.py | #!/usr/bin/python3
# requires system Python and the python3-apt package
from collections import OrderedDict # Starting with Python 3.7, we could just use vanilla dicts
import apt # ImportError? apt install python3-apt
def describe(pkg):
# Python 3.7 equivalent:
# return {"Name": pkg.name, "Installed": pkg.installed.... | #!/usr/bin/python3
# requires system Python and the python3-apt package
from collections import OrderedDict # Starting with Python 3.7, we could just use vanilla dicts
import apt # ImportError? apt install python3-apt
def describe(pkg):
# Python 3.7 equivalent:
# return {"Name": pkg.name, "Installed": pkg.installed.... | mit | Python |
1e7f9d13d0e118d0d75225f69628680c8af3a8ae | fix name | ponty/pyscreenshot,ponty/pyscreenshot,ponty/pyscreenshot | tests/test_pyside.py | tests/test_pyside.py | from ref import backend_ref
from size import backend_size
def test_size_pyside():
backend_size('pyside')
def test_ref_pyside():
backend_ref('pyside')
| from ref import backend_ref
from size import backend_size
def test_size_pyqt():
backend_size('pyside')
def test_ref_pyqt():
backend_ref('pyside')
| bsd-2-clause | Python |
7e24a1be37871d58d5d39fcb6736716f99821dda | Improve help text | harrischristiansen/generals-bot | base/client/constants.py | base/client/constants.py | '''
@ Harris Christiansen (Harris@HarrisChristiansen.com)
Generals.io Automated Client - https://github.com/harrischristiansen/generals-bot
Constants: Constants used throughout the code
'''
SHOULD_DIRTY_MAP_ON_MOVE = True
ENDPOINT_BOT = "ws://botws.generals.io/socket.io/?EIO=3&transport=websocket"
ENDPOINT_PUBLIC ... | '''
@ Harris Christiansen (Harris@HarrisChristiansen.com)
Generals.io Automated Client - https://github.com/harrischristiansen/generals-bot
Constants: Constants used throughout the code
'''
SHOULD_DIRTY_MAP_ON_MOVE = True
ENDPOINT_BOT = "ws://botws.generals.io/socket.io/?EIO=3&transport=websocket"
ENDPOINT_PUBLIC ... | mit | Python |
1f9fa8db0811a8853e072492b14fef4c107411b7 | Fix server sys.path to find the pyqode package | zwadar/pyqode.core,pyQode/pyqode.core,pyQode/pyqode.core | test/server.py | test/server.py | """
Server used for tests
"""
import sys
import os
# ensure sys knows about pyqode.core
sys.path.insert(0, os.path.abspath('..'))
from pyqode.core import code_completion
from pyqode.core import server
from pyqode.core import workers
if __name__ == '__main__':
workers.CodeCompletion.providers.append(
code_c... | """
Server used for tests
"""
from pyqode.core import code_completion
from pyqode.core import server
from pyqode.core import workers
if __name__ == '__main__':
workers.CodeCompletion.providers.append(
code_completion.DocumentWordsProvider())
server.run()
| mit | Python |
0f72371fae4f614932adc45a3461c1bcff5f569a | Test for File.write_line() | BakeCode/performance-testing,BakeCode/performance-testing | tests/test_result.py | tests/test_result.py | import unittest
from performance_testing.result import Result, File
import os
import shutil
class ResultTestCase(unittest.TestCase):
def setUp(self):
self.current_directory = os.path.dirname(os.path.abspath(__file__))
self.result_directory = os.path.join(self.current_directory, 'assets/test_result... | import unittest
from performance_testing.result import Result, File
import os
import shutil
class ResultTestCase(unittest.TestCase):
def setUp(self):
self.current_directory = os.path.dirname(os.path.abspath(__file__))
self.result_directory = os.path.join(self.current_directory, 'assets/test_result... | mit | Python |
ee06edd57dfef223b80d7b01feff4da723660de0 | Disable temporary tests on dates | skirsdeda/djangocms-blog,nephila/djangocms-blog,nephila/djangocms-blog,skirsdeda/djangocms-blog,nephila/djangocms-blog,skirsdeda/djangocms-blog | tests/test_search.py | tests/test_search.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from haystack.constants import DEFAULT_ALIAS
from haystack.query import SearchQuerySet
from djangocms_blog.models import Post
from .base import BaseTest
class BlogIndexingTests(BaseTest):
def setUp(self):
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from haystack.constants import DEFAULT_ALIAS
from haystack.query import SearchQuerySet
from djangocms_blog.models import Post
from .base import BaseTest
class BlogIndexingTests(BaseTest):
def setUp(self):
... | bsd-3-clause | Python |
bcecf5626768c8399e9293fe12a25511eeb6c52d | Bump version to 3.1-beta | godotengine/godot,honix/godot,pkowal1982/godot,Paulloz/godot,josempans/godot,Valentactive/godot,ZuBsPaCe/godot,MarianoGnu/godot,firefly2442/godot,firefly2442/godot,Faless/godot,okamstudio/godot,DmitriySalnikov/godot,godotengine/godot,groud/godot,ZuBsPaCe/godot,josempans/godot,guilhermefelipecgs/godot,ex/godot,okamstudi... | version.py | version.py | short_name = "godot"
name = "Godot Engine"
major = 3
minor = 1
status = "beta"
module_config = ""
| short_name = "godot"
name = "Godot Engine"
major = 3
minor = 1
status = "alpha"
module_config = ""
| mit | Python |
ca9f91aaf5fd15ab58875363858fd5f73305a410 | comment complex_test_header and pointcloud | eEcoLiDAR/eEcoLiDAR | laserchicken/test_utils.py | laserchicken/test_utils.py | from laserchicken.keys import *
import numpy as np
import datetime as dt
def generate_simple_test_point_cloud():
# This simple_test_point cloud and the simple_test_header should be in sync. Some tests depend on it.
pc = {point: {'x': {'type': 'float', 'data': np.array([1, 2, 3])},
'y': {'typ... | from laserchicken.keys import *
import numpy as np
import datetime as dt
def generate_simple_test_point_cloud():
# This simple_test_point cloud and the simple_test_header should be in sync. Some tests depend on it.
pc = {point: {'x': {'type': 'float', 'data': np.array([1, 2, 3])},
'y': {'typ... | apache-2.0 | Python |
1b4fc9471297dbc704cf0efaac54fce5891014d7 | make the proxy command (relay/server) required | lincheney/ssh-forward-proxy,lincheney/ssh-forward-proxy | bin/ssh-forward-proxy.py | bin/ssh-forward-proxy.py | import logging
import argparse
logging.basicConfig(level=logging.INFO)
import ssh_forward_proxy as ssh
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Forward all SSH requests to remote but authenticating as the proxy')
parser.add_argument('-i', dest='identity_file', help='Path to id... | import logging
import argparse
logging.basicConfig(level=logging.INFO)
import ssh_forward_proxy as ssh
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Forward all SSH requests to remote but authenticating as the proxy')
parser.add_argument('-i', dest='identity_file', help='Path to id... | mit | Python |
c354f387023a6d7b7aebbd2b61fb7336fe72f346 | Bump to next v.0.13.0a0 (#217) | barrachri/aiodocker,gaopeiliang/aiodocker,barrachri/aiodocker,gaopeiliang/aiodocker,paultag/aiodocker,barrachri/aiodocker,gaopeiliang/aiodocker | aiodocker/__init__.py | aiodocker/__init__.py | from .docker import Docker
__version__ = '0.13.0a0'
__all__ = ("Docker", )
| from .docker import Docker
__version__ = '0.12.0'
__all__ = ("Docker", )
| mit | Python |
9d1d8729077a619d724812c6919d6126d5eedcd2 | Speed up test | Parsl/parsl,swift-lang/swift-e-lab,Parsl/parsl,Parsl/parsl,swift-lang/swift-e-lab,Parsl/parsl | parsl/tests/test_ipp/test_python_worker_fail.py | parsl/tests/test_ipp/test_python_worker_fail.py | """Testing bash apps
"""
import parsl
from parsl import *
import time
import argparse
# parsl.set_stream_logger()
workers = IPyParallelExecutor()
dfk = DataFlowKernel(executors=[workers])
@App('python', dfk)
def import_echo(x, string, sleep=0, stdout=None):
import time
time.sleep(sleep)
print(string)
... | """Testing bash apps
"""
import parsl
from parsl import *
import time
import argparse
# parsl.set_stream_logger()
workers = IPyParallelExecutor()
dfk = DataFlowKernel(executors=[workers])
@App('python', dfk)
def import_echo(x, string, sleep=0, stdout=None):
import time
time.sleep(sleep)
print(string)
... | apache-2.0 | Python |
b0bde22e3ff0d2df2773f41aeaf8eb0ba6d0fa3f | Allow a default value to be specified when fetching a field value | jskeet/gcloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet | tools/getapifield.py | tools/getapifield.py | # Copyright 2019 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 2019 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 |
6d7f7ebb913bf99d36c551ef3105c98c7150c68b | Update version_info.py - 20 | postpdm/ich_bau,postpdm/ich_bau | ich_bau/templatetags/version_info.py | ich_bau/templatetags/version_info.py | from django import template
register = template.Library()
@register.simple_tag(name='site_version_info')
def site_version_info():
return 'v0.0020 at 20.03.2020'
| from django import template
register = template.Library()
@register.simple_tag(name='site_version_info')
def site_version_info():
return 'v0.0019 at 05.02.2020'
| apache-2.0 | Python |
f51915a6c373de39785d8273b2a9f6e11ff67b9e | Test for no pairs from one particle | benwaugh/dimuon | test_dimuon.py | test_dimuon.py | from dimuon import find_pairs
def test_find_pairs():
particles = None
pairs = find_pairs(particles)
def test_no_particles():
particles = []
pairs = find_pairs(particles)
assert len(pairs) == 0
def test_one_particle():
particles = [None]
pairs = find_pairs(particles)
assert len(pairs) ... | from dimuon import find_pairs
def test_find_pairs():
particles = None
pairs = find_pairs(particles)
def test_no_particles():
particles = []
pairs = find_pairs(particles)
assert len(pairs) == 0
| mit | Python |
a84e6e2a31408bcefbb6ecb5ba354e70bb870f56 | use slightly smaller textarea | adieu/allbuttonspressed,adieu/allbuttonspressed | minicms/admin.py | minicms/admin.py | from .models import Block, Page
from django.contrib import admin
from django.contrib.admin.widgets import AdminTextareaWidget
from django.db import models
# The default TextField doesn't have enough rows
class UsableTextarea(AdminTextareaWidget):
def __init__(self, attrs=None):
default_attrs = {'rows': '32... | from .models import Block, Page
from django.contrib import admin
from django.contrib.admin.widgets import AdminTextareaWidget
from django.db import models
# The default TextField doesn't have enough rows
class UsableTextarea(AdminTextareaWidget):
def __init__(self, attrs=None):
default_attrs = {'rows': '40... | bsd-3-clause | Python |
6385b19090df0f36cbd16c96ee6ab763441ae460 | add test for passing parameters | k-bx/mockstar,k-bx/mockstar | mockstar_test.py | mockstar_test.py | # -*- coding: utf-8 -*-
import unittest
from unittest import TestCase
from mock import Mock
from mock import patch
from mockstar import p
from mockstar import DotDict
def side_effect_one():
pass
def side_effect_two():
pass
def side_effect_three():
val = side_effect_four()
return val * 2
def si... | # -*- coding: utf-8 -*-
import unittest
from unittest import TestCase
from mock import Mock
from mockstar import p
from mockstar import DotDict
def side_effect_one():
pass
def side_effect_two():
pass
def side_effect_three():
val = side_effect_four()
return val * 2
def side_effect_four():
r... | bsd-2-clause | Python |
e7544073a4496d4ba9514f85e8957c54d32cc201 | Fix Typo | iGene/igene_bot,aver803bath5/igene_bot | models/google.py | models/google.py | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | mit | Python |
a800edd62b53b7546f98e56dcc9775933799befd | bump to 0.3.5. | 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.3.5"
| # 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.3.4"
| bsd-3-clause | Python |
25aba1a9cd0aa57b35c6bc9e5083a601585a214e | bump to 0.4.2. | 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.4.2"
| # 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.4.1"
| bsd-3-clause | Python |
240ebf998ebd633d6c5d8f90f46892071522759e | Fix #1. Supporting python3 | yychen/twd97 | twd97/__init__.py | twd97/__init__.py | from twd97.converter import fromwgs84, towgs84
| from converter import fromwgs84, towgs84
| mit | Python |
82bd501f89d3a228c3de9a2f355266b374c35a54 | Add current project path to the first position of sys.modules | bufferx/twork,bufferx/twork | twork/assembly.py | twork/assembly.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/>
#
# 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/L... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/>
#
# 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/L... | apache-2.0 | Python |
1b05a5359781bf972243697dcf7187de3eb5503c | Fix test cases | shichao-an/twitter-photos | twphotos/tests.py | twphotos/tests.py | import os
os.environ['TWPHOTOS_TEST_CONFIG'] = '0'
import shutil
from unittest import TestCase
from .settings import PROJECT_PATH
from .photos import TwitterPhotos
TEST_OUTPUT = 'test-output'
TEST_USER = 'WIRED'
class TestPhotos(TestCase):
"""Test TwitterPhotos class programmatically"""
def setUp(self):
... | import os
import shutil
from unittest import TestCase
from .settings import PROJECT_PATH
from .photos import TwitterPhotos
TEST_OUTPUT = 'test-output'
TEST_USER = 'WIRED'
class TestPhotos(TestCase):
"""Test TwitterPhotos class programmatically"""
def setUp(self):
d = os.path.join(PROJECT_PATH, TEST_... | bsd-2-clause | Python |
182cad51f830e21320f2442804b674cd32306ba8 | Sort navigation links by position and alphabetical order, closes: #1797. | SmartJog/webengine,SmartJog/webengine | utils/__init__.py | utils/__init__.py | import os
def get_valid_plugins():
"""
Returns a list of valid webengine plugins.
Returns: [('name', <module 'webengine.name'>), ...]
"""
webengine = __import__('webengine')
def __isplugin(mod_name):
""" Nested method of get_valid_plugins, tries to import webengine.<mod_name>... | import os
def get_valid_plugins():
"""
Returns a list of valid webengine plugins.
Returns: [('name', <module 'webengine.name'>), ...]
"""
webengine = __import__('webengine')
def __isplugin(mod_name):
""" Nested method of get_valid_plugins, tries to import webengine.<mod_name>... | lgpl-2.1 | Python |
8067a67998273996d086f715748b2d7f09790bb0 | Use direct jpg data instead of jpg file | OTL/rostensorflow | image_recognition.py | image_recognition.py | import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge
import cv2
import numpy as np
import tensorflow as tf
from tensorflow.models.image.imagenet import classify_image
class RosTensorFlow():
def __init__(self):
classify_image.maybe_download_and_extra... | import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge, CvBridgeError
import cv2
import numpy as np
import tensorflow as tf
from tensorflow.models.image.imagenet import classify_image
class RosTensorFlow():
def __init__(self):
classify_image.maybe_down... | apache-2.0 | Python |
fb53986a1e20859e421f4c86c664fd862e3b882e | fix mongodb | shmiko/big-fat-python-tests,shmiko/big-fat-python-tests | mongodb_query.py | mongodb_query.py | db.schedule.find("bookings" : {"$elemMatch" : { "date" : new ISODate("2016-08-09T10:00:00.000Z")}})
>> { "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
"date": ISODate("2016-08-09T10:00:00.000Z")
}
]
}
db.schedule.insert(
{ "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
... | db.schedule.find("bookings" : {"$elemMatch" : { "date" : new ISODate("2016-08-09T10:00:00.000Z")}})
>> { "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
"date": ISODate("2016-08-09T10:00:00.000Z")
}
]
}
db.schedule.insert(
{ "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
... | apache-2.0 | Python |
be80c525fbb1dfb9cc1ea6a713fc2b152dfd5440 | fix mongodb | shmiko/big-fat-python-tests,shmiko/big-fat-python-tests | mongodb_query.py | mongodb_query.py | db.schedule.find("bookings" : {"$elemMatch" : { "date" : new ISODate("2016-08-09T10:00:00.000Z")}})
>> { "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
"date": ISODate("2016-08-09T10:00:00.000Z")
}
]
}
db.schedule.insert(
{ "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
... | db.schedule.find("bookings" : {"$elemMatch" : { "date" : new ISODate("2016-08-09T10:00:00.000Z")}})
>> { "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
"date": ISODate("2016-08-09T10:00:00.000Z")
}
]
}
db.schedule.insert(
{ "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
... | apache-2.0 | Python |
f27d51beecd423335835b005d2938224102a7460 | remove unused import | RaRe-Technologies/smart_open,piskvorky/smart_open,RaRe-Technologies/smart_open | integration-tests/test_s3_readline.py | integration-tests/test_s3_readline.py | from smart_open import open
def read_lines(url, limit):
lines = []
with open(url, 'r', errors='ignore') as fin:
for i, l in enumerate(fin):
if i == limit:
break
lines.append(l)
return lines
def test(benchmark):
#
# This file is around 850MB.
#... | import sys
from smart_open import open
def read_lines(url, limit):
lines = []
with open(url, 'r', errors='ignore') as fin:
for i, l in enumerate(fin):
if i == limit:
break
lines.append(l)
return lines
def test(benchmark):
#
# This file is around 8... | mit | Python |
6482303cee3c6678cfed1f3a22dccd3758093c12 | Expand config to include jarvis data directories | clb6/jarvis-cli | jarvis_cli/config.py | jarvis_cli/config.py | import os
import configparser
from jarvis_cli.exceptions import JarvisCliConfigError
from jarvis_cli.client import DBConn
JARVIS_CLI_DIRECTORY = os.path.join(os.environ["HOME"], ".jarvis")
def _get_config(environment):
config = configparser.ConfigParser()
config_path = os.path.join(JARVIS_CLI_DIRECTORY, "cli... | import os
import configparser
from jarvis_cli.exceptions import JarvisCliConfigError
from jarvis_cli.client import DBConn
def get_client_connection(environment):
config = configparser.ConfigParser()
config_path = os.path.join(os.environ["HOME"], ".jarvis", "cli_config.ini")
if config.read(config_path):
... | apache-2.0 | Python |
6acdeab4e0b6811ba4d7b03e2a00860a5783e20f | add shortcode to admin | praekelt/hellomama-registration,praekelt/hellomama-registration | vas2nets/admin.py | vas2nets/admin.py | from django.contrib import admin
from .models import VoiceCall
class VoiceCallAdmin(admin.ModelAdmin):
list_display = ['id', 'shortcode', 'created_at', 'msisdn', 'duration',
'reason']
admin.site.register(VoiceCall, VoiceCallAdmin)
| from django.contrib import admin
from .models import VoiceCall
class VoiceCallAdmin(admin.ModelAdmin):
list_display = ['id', 'created_at', 'msisdn', 'duration', 'reason']
admin.site.register(VoiceCall, VoiceCallAdmin)
| bsd-3-clause | Python |
99a2a7535478e77154670cc3a11832d7a5ac7d78 | Update version | globocom/vault,globocom/vault,globocom/vault,globocom/vault | vault/__init__.py | vault/__init__.py | # -*- coding: utf-8 -*-
default_app_config = 'vault.apps.VaultConfig'
__version__ = '1.1.1'
| # -*- coding: utf-8 -*-
default_app_config = 'vault.apps.VaultConfig'
__version__ = '1.1.0'
| apache-2.0 | Python |
9ccae8267d1884e25bf5268fe59b16e99475397f | Change hidden function | RuiShu/Neural-Net-Bayesian-Optimization,RuiShu/Neural-Net-Bayesian-Optimization,RuiShu/Neural-Net-Bayesian-Optimization | learning_objective/hidden_function.py | learning_objective/hidden_function.py | """
@Author: Rui Shu
@Date: 4/11/15
Provides a proxy hidden function for running of optimizer and mpi_optimizer
"""
import numpy as np
import time
noiseless_g = lambda x: 10*np.sin(x) - x
g = lambda x: noiseless_g(x) + np.random.randn()/10 # Define the hidden function
def evaluate(query, lim_domain):
... | """
@Author: Rui Shu
@Date: 4/11/15
Provides a proxy hidden function for running of optimizer and mpi_optimizer
"""
import numpy as np
import time
noiseless_g = lambda x: 10*np.sin(x) - x
g = lambda x: noiseless_g(x) + np.random.randn()/10 # Define the hidden function
def evaluate(query, lim_domain):
... | mit | Python |
ed09a238f8ff2925305e82ff310127fc3ba632e0 | make cache update nullable | django-leonardo/django-leonardo,django-leonardo/django-leonardo,amboycharlie/Child-Friendly-LCMS,amboycharlie/Child-Friendly-LCMS,amboycharlie/Child-Friendly-LCMS,django-leonardo/django-leonardo,django-leonardo/django-leonardo,amboycharlie/Child-Friendly-LCMS | leonardo/module/web/widgets/mixins.py | leonardo/module/web/widgets/mixins.py |
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .const import PAGINATION_CHOICES
class ListWidgetMixin(models.Model):
"""Common fields for object lists
"""
objects_per_page = models.PositiveIntegerField(
verbos... |
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .const import PAGINATION_CHOICES
class ListWidgetMixin(models.Model):
"""Common fields for object lists
"""
objects_per_page = models.PositiveIntegerField(
verbos... | bsd-3-clause | Python |
2e27306c09038dda3dd722282c9cf2645d13c113 | Fix fpm on Python2.5 | schatt/fpm,elvido/fpm,wyaeld/fpm,fetep/fpm,gearmover/fpm,djhaskin987/merge-demo,pskrz/fpm,rbramwell/fpm,josephfrazier/fpm,gearmover/fpm,gearmover/fpm,josephfrazier/fpm,josephfrazier/fpm,dischord01/fpm,tjyang/fpm,cturra/fpm,wyaeld/fpm,doghrim/fpm,hlawrenz/fpm,sideci-sample/sideci-sample-fpm,vi4m/fpm,josephfrazier/fpm,pa... | lib/fpm/package/pyfpm/get_metadata.py | lib/fpm/package/pyfpm/get_metadata.py | from distutils.core import Command
import re
import time
import pkg_resources
try:
import json
except ImportError:
import simplejson as json
# Note, the last time I coded python daily was at Google, so it's entirely
# possible some of my techniques below are outdated or bad.
# If you have fixes, let me know.
... | from distutils.core import Command
import json
import re
import time
import pkg_resources
# Note, the last time I coded python daily was at Google, so it's entirely
# possible some of my techniques below are outdated or bad.
# If you have fixes, let me know.
class get_metadata(Command):
description = "get package ... | mit | Python |
a79f6d6b07a77a11314d5c763905a048db2783a6 | remove obsolete state return feature | nominum/nomcc | nomcc/message.py | nomcc/message.py | # Copyright (C) 2011-2014,2016 Nominum, Inc.
#
# 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 ag... | # Copyright (C) 2011-2014,2016 Nominum, Inc.
#
# 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 ag... | apache-2.0 | Python |
762a4351c2d1552cd99a2ce90c8641d781eec259 | change for windows... | 4D42/pdfcropall | pdfcropall.py | pdfcropall.py | #!/usr/bin/env python3
import sys
import os
def for_os(filesname):
osname = sys.platform
if osname == "linux":
filesname = filesname.replace(' ','\ ')
filesname = filesname.replace('(','\(')
filesname = filesname.replace(')','\)')
if osname == "win32":
filesname = '"'+filesname+'"'
return filesname
if _... | #!/usr/bin/env python3
import sys
import os
def for_os(filesname):
osname = sys.platform
if osname == "linux":
filesname = filesname.replace(' ','\ ')
filesname = filesname.replace('(','\(')
filesname = filesname.replace(')','\)')
#if osname == "win32":
return filesname
if __name__ == "__main__":
prin... | mit | Python |
b77b030908a6c589411224912f9a5e5e0e090829 | Make printf %-safe | Nazek42/wistful-c | wistfulc.py | wistfulc.py | sample_code = """\
if only <stdlib.h> were included...
if only <stdio.h> were included...
if only <math.h> were included...
if only int x were 3...
if x were 3...
wish "Hello World" upon a star
*sigh*
if wishes were horses..."""
import re
from functools import reduce
import subprocess
import os
import sys
def add_to_... | sample_code = """\
if only <stdlib.h> were included...
if only <stdio.h> were included...
if only <math.h> were included...
if only int x were 3...
if x were 3...
wish "Hello World" upon a star
*sigh*
if wishes were horses..."""
import re
from functools import reduce
import subprocess
import os
import sys
def add_to_... | apache-2.0 | Python |
847a66ed8eb19206ecc77904dd5db547284b905f | Make sure exit code is used in -E situation | mindw/pip,pjdelport/pip,patricklaw/pip,alquerci/pip,esc/pip,harrisonfeng/pip,haridsv/pip,prasaianooz/pip,habnabit/pip,ncoghlan/pip,blarghmatey/pip,h4ck3rm1k3/pip,msabramo/pip,Gabriel439/pip,alex/pip,xavfernandez/pip,zvezdan/pip,haridsv/pip,Ivoz/pip,cjerdonek/pip,yati-sagade/pip,harrisonfeng/pip,RonnyPfannschmidt/pip,al... | pip/runner.py | pip/runner.py | import sys
import os
def run():
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
## FIXME: this is kind of crude; if we could create a fake pip
## module, then exec into it and update pip.__path__ properly, we
## wouldn't have to update sys.path:
sys.path.insert(0, base)
impor... | import sys
import os
def run():
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
## FIXME: this is kind of crude; if we could create a fake pip
## module, then exec into it and update pip.__path__ properly, we
## wouldn't have to update sys.path:
sys.path.insert(0, base)
impor... | mit | Python |
d854e19f4a1c6e5b2ae4007152bbd962fb851642 | Update version number for trunk to 1.4.0. | jankoslavic/numpy,felipebetancur/numpy,jschueller/numpy,bringingheavendown/numpy,mhvk/numpy,SiccarPoint/numpy,BabeNovelty/numpy,Linkid/numpy,mortada/numpy,simongibbons/numpy,Srisai85/numpy,mathdd/numpy,dwillmer/numpy,Srisai85/numpy,sigma-random/numpy,tacaswell/numpy,bringingheavendown/numpy,behzadnouri/numpy,behzadnour... | numpy/version.py | numpy/version.py | version='1.4.0'
release=False
if not release:
version += '.dev'
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_ve... | version='1.3.0'
release=False
if not release:
version += '.dev'
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_ve... | bsd-3-clause | Python |
779dc154b799a6660f7f60ef50c09fc445329999 | Update version to 1.0b3 | rhythmsosad/numpy,kirillzhuravlev/numpy,stefanv/numpy,endolith/numpy,ESSS/numpy,dch312/numpy,rgommers/numpy,pbrod/numpy,brandon-rhodes/numpy,tdsmith/numpy,mhvk/numpy,KaelChen/numpy,MSeifert04/numpy,empeeu/numpy,SunghanKim/numpy,CMartelLML/numpy,mortada/numpy,matthew-brett/numpy,Eric89GXL/numpy,pbrod/numpy,shoyer/numpy,... | numpy/version.py | numpy/version.py | version='1.0b3'
release=False
if not release:
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_version__',
... | version='1.0b2'
release=False
if not release:
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_version__',
... | bsd-3-clause | Python |
2bbc289ce21365e18b04cb865328c494b75075fd | Update head revision to 0.9.9 | Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,illume/numpy3k,Ademan/NumPy-GSoC,chadnetzer/numpy-gaurdro,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,efiring/numpy-work,jasonmccampbell/numpy-refactor-sprint,teoliphant/numpy-refactor,chadnetzer/numpy-gaurdro,teoliphant/numpy-refactor,chadnetzer/numpy... | numpy/version.py | numpy/version.py | version='0.9.9'
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_version__',
open(svn_version_file),
... | version='0.9.7'
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_version__',
open(svn_version_file),
... | bsd-3-clause | Python |
d4cf4de3257719cf703c580a3d8d6f50629d2a22 | remove 1011 from valid codes (for now .. until INTERNAL_SERVER_ERROR is official) | luhn/AutobahnPython,magnux/AutobahnPython,inirudebwoy/AutobahnPython,leedm777/AutobahnPython,meejah/AutobahnPython,iffy/AutobahnPython,wrapp/AutobahnPython,flyser/AutobahnPython,D3f0/AutobahnPython,rapyuta/autobahn_rce,rapyuta/autobahn_rce,nucular/AutobahnPython,leedm777/AutobahnPython,Jenselme/AutobahnPython,crossbari... | lib/python/autobahn/case/case7_7_X.py | lib/python/autobahn/case/case7_7_X.py | ###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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... | ###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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... | mit | Python |
547691a1fe7d0618047c311341acd35c526827ac | Update to version v0.12.1 | pignacio/python-nvd3,vdloo/python-nvd3,liang42hao/python-nvd3,vdloo/python-nvd3,yelster/python-nvd3,Coxious/python-nvd3,BibMartin/python-nvd3,yelster/python-nvd3,BibMartin/python-nvd3,liang42hao/python-nvd3,pignacio/python-nvd3,mgx2/python-nvd3,mgx2/python-nvd3,oz123/python-nvd3,oz123/python-nvd3,mgx2/python-nvd3,pigna... | nvd3/__init__.py | nvd3/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
__version__ = '0.12.1' # ... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
__version__ = '0.12.0' # ... | mit | Python |
7bf68cbafe16a95342e2c74c28f6b2b0daad65a8 | Update 0.2.8 | keras-team/keras-cv,keras-team/keras-cv,keras-team/keras-cv | keras_cv/__init__.py | keras_cv/__init__.py | # Copyright 2022 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2022 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
e15eeb05f93dd4745d4a14422c5e15ffc3cc3119 | remove demo url | openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms | openstax/urls.py | openstax/urls.py | from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailcore import urls as wagtail_urls... | from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailcore import urls as wagtail_urls... | agpl-3.0 | Python |
7a49e7c4344f7d78a84644ade5ca1c3251065f4a | Use `glob.glob` instead of `os.walk` | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/grains/ssds.py | salt/grains/ssds.py | # -*- coding: utf-8 -*-
'''
Detect SSDs
'''
# Import python libs
import glob
import salt.utils
import logging
log = logging.getLogger(__name__)
def ssds():
'''
Return list of disk devices that are SSD (non-rotational)
'''
ssd_devices = []
for entry in glob.glob('/sys/block/*/queue/rotational... | # -*- coding: utf-8 -*-
'''
Detect SSDs
'''
import os
import salt.utils
import logging
log = logging.getLogger(__name__)
def ssds():
'''
Return list of disk devices that are SSD (non-rotational)
'''
SSDs = []
for subdir, dirs, files in os.walk('/sys/block'):
for dir in dirs:
... | apache-2.0 | Python |
f11a21ae5dd25310ac8165759ceb532de1365f64 | update default config options | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | saltcloud/config.py | saltcloud/config.py | '''
Manage configuration files in salt-cloud
'''
# Import python libs
import os
# Import salt libs
import salt.config
def cloud_config(path):
'''
Read in the salt cloud config and return the dict
'''
opts = {# Provider defaults
'provider': '',
'location': '',
# Us... | '''
Manage configuration files in salt-cloud
'''
# Import python libs
import os
# Import salt libs
import salt.config
def cloud_config(path):
'''
Read in the salt cloud config and return the dict
'''
opts = {# Provider defaults
'provider': '',
'location': '',
# Us... | apache-2.0 | Python |
cdd57a8706ca615af85d298ba3a99c80f1e9dba0 | Update mono.py to get 2.10.5 | bl8/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild,bl8/bockbuild,bl8/bockbuild | packages/mono.py | packages/mono.py | class MonoPackage (Package):
def __init__ (self):
Package.__init__ (self, 'mono', '2.10.5',
sources = [
'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2',
'patches/mono-runtime-relocation.patch'
],
configure_flags = [
'--with-jit=yes',
'--with-ikvm=no',
'--wit... | class MonoPackage (Package):
def __init__ (self):
Package.__init__ (self, 'mono', '2.10.4',
sources = [
'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2',
'patches/mono-runtime-relocation.patch'
],
configure_flags = [
'--with-jit=yes',
'--with-ikvm=no',
'--wit... | mit | Python |
89d8ee0b91c9fd579dcf965e9e07f18954625c72 | Add support for manual journals | wegotpop/pyxero,jarekwg/pyxero,jaymcconnell/pyxero,opendesk/pyxero,thisismyrobot/pyxero,freakboy3742/pyxero,MJMortimer/pyxero,unomena/pyxero,schinckel/pyxero,unomena/pyxeropos,jacobg/pyxero,direvus/pyxero | xero/api.py | xero/api.py | from .manager import Manager
class Xero(object):
"""An ORM-like interface to the Xero API"""
OBJECT_LIST = (u'Contacts', u'Accounts', u'CreditNotes',
u'Currencies', u'Invoices', u'Items', u'Organisation',
u'Payments', u'TaxRates', u'TrackingCategories', u'ManualJournals'... | from .manager import Manager
class Xero(object):
"""An ORM-like interface to the Xero API"""
OBJECT_LIST = (u'Contacts', u'Accounts', u'CreditNotes',
u'Currencies', u'Invoices', u'Items', u'Organisation',
u'Payments', u'TaxRates', u'TrackingCategories')
def __init__... | bsd-3-clause | Python |
98c011af0ee3413f5c6d1cfdbfdd8a9d8ed59b86 | Revise to sum_deq & revise comment | bowen0701/algorithms_data_structures | lc0067_add_binary.py | lc0067_add_binary.py | """Leetcode 67. Add Binary
Easy
URL: https://leetcode.com/problems/add-binary/
Given two binary strings, return their sum (also a binary string).
The input strings are both non-empty and contains only characters 1 or 0.
Example 1:
Input: a = "11", b = "1"
Output: "100"
Example 2:
Input: a = "1010", b = "1011"
Outp... | """Leetcode 67. Add Binary
Easy
URL: https://leetcode.com/problems/add-binary/
Given two binary strings, return their sum (also a binary string).
The input strings are both non-empty and contains only characters 1 or 0.
Example 1:
Input: a = "11", b = "1"
Output: "100"
Example 2:
Input: a = "1010", b = "1011"
Outp... | bsd-2-clause | Python |
3ac16f20bbb4eef6607111ac5777f7db21095412 | Add functiion for emotion recognizing | sevazhidkov/lksh-analyse | parse_poldnev.py | parse_poldnev.py | """
Script that parsing poldnev.ru, checking students factors
using Emotion API and creating 'visits.csv'.
@author: Seva Zhidkov
@license: MIT
"""
import os
import time
import csv
import json
import re
import requests
import lxml.html
POLDNEV_BASE_URL = 'http://poldnev.ru/lksh/id{}'
STUDENT_IMAGE_REGEX = re.compile(... | """
Script that parsing poldnev.ru, checking students factors
using Emotion API and creating 'visits.csv'.
@author: Seva Zhidkov
@license: MIT
"""
import csv
import json
import re
import requests
import lxml.html
def detect_emotions(photo_url):
pass
POLDNEV_BASE_URL = 'http://poldnev.ru/lksh/id{}'
STUDENT_IMA... | mit | Python |
1ab5d60d6e49226f7dfd17416993b9460e5b688f | Add basic view for index page with no context | jwarren116/RoadTrip,jwarren116/RoadTrip,jwarren116/RoadTrip | planner/views.py | planner/views.py | from django.shortcuts import render
def index(request):
return render(request, 'base.html')
| from django.shortcuts import render
# Create your views here.
| apache-2.0 | Python |
511c7c858d6cd99b66b0cd7fc187dc73034bb3fa | Check for existence of isatty on stdout before calling it | thaim/ansible,thaim/ansible | lib/ansible/color.py | lib/ansible/color.py | # (c) 2012, 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) any lat... | # (c) 2012, 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) any lat... | mit | Python |
e6d92aa8d56d670109daecb9a8f0e22d2f88f50c | Update debug middleware for Python 3. | ghostwords/localore,ghostwords/localore,ghostwords/localore | localore/localore/middleware/debug.py | localore/localore/middleware/debug.py | import json
from django.http import HttpResponse
# from http://stackoverflow.com/a/19249559
class NonHtmlDebugToolbarMiddleware(object):
"""
The Django Debug Toolbar usually only works for views that return HTML.
This middleware wraps any non-HTML response in HTML if the request
has a 'debug' query p... | import json
from django.http import HttpResponse
# from http://stackoverflow.com/a/19249559
class NonHtmlDebugToolbarMiddleware(object):
"""
The Django Debug Toolbar usually only works for views that return HTML.
This middleware wraps any non-HTML response in HTML if the request
has a 'debug' query p... | mpl-2.0 | Python |
3a7bd1eb2a91861ba044b46fada158034ccd6b23 | Fix Tests | meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent | mainapp/tests/test_document_access.py | mainapp/tests/test_document_access.py | from django.test import TestCase, override_settings
from mainapp.models import Paper, File
@override_settings(ELASTICSEARCH_DSL_AUTOSYNC=False, ELASTICSEARCH_DSL_AUTO_REFRESH=False)
class TestDocumentAccess(TestCase):
fixtures = ['initdata']
base_paper_len = 2
def test_delete_document(self):
pap... | from django.test import TestCase, override_settings
from mainapp.models import Paper, File
@override_settings(ELASTICSEARCH_DSL_AUTOSYNC=False, ELASTICSEARCH_DSL_AUTO_REFRESH=False)
class TestDocumentAccess(TestCase):
fixtures = ['initdata']
base_paper_len = 2
def test_delete_document(self):
pap... | mit | Python |
802a8ec31cb37a38f976917674ed5604599a1848 | add long_description | rmulvey/mc,cortlandstarrett/mc,rmulvey/mc,leviathan747/mc,rmulvey/mc,leviathan747/mc,xtuml/mc,leviathan747/mc,cortlandstarrett/mc,xtuml/mc,lwriemen/mc,xtuml/mc,xtuml/mc,lwriemen/mc,rmulvey/mc,lwriemen/mc,lwriemen/mc,leviathan747/mc,xtuml/mc,rmulvey/mc,cortlandstarrett/mc,lwriemen/mc,cortlandstarrett/mc,leviathan747/mc,... | pymc/setup.py | pymc/setup.py | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(name='pymc3020... | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name='pymc3020',
version='1.0.1',
description='Python executor for MC-3020',
author='Levi Starrett',
author_email='levi@roxsoftware.com',
url='https://github.com/xtu... | apache-2.0 | Python |
38748da362f484c3f84dfa63c8ff052ec1661820 | Update main.py | clccmh/pomodoro | pomodoro/main.py | pomodoro/main.py | #!/usr/bin/env python
import click
import progressbar
import time
@click.command()
@click.option('--minutes', default=25, help='Number of minutes, default 25.')
def pomodoro(minutes):
bar = progressbar.ProgressBar(widgets=[
progressbar.Bar(),
])
for i in bar(range(minutes*60)):
time.sleep(... | #!/usr/bin/env python
__version__ = '0.0.1'
import click
import progressbar
import time
@click.command()
@click.option('--minutes', default=25, help='Number of minutes, default 25.')
def pomodoro(minutes):
bar = progressbar.ProgressBar(widgets=[
progressbar.Bar(),
])
for i in bar(range(minutes*60)... | mit | Python |
1e0763c97100f4efb1db4c72c200f759bfde9a56 | update scheduler cron | niqdev/packtpub-crawler,niqdev/packtpub-crawler,niqdev/packtpub-crawler | script/scheduler.py | script/scheduler.py | from apscheduler.schedulers.blocking import BlockingScheduler
import os
import shutil
sched = BlockingScheduler()
#@sched.scheduled_job('interval', minutes=5)
@sched.scheduled_job('cron', day_of_week='mon-sun', hour=10)
def scheduled_job():
print('New job: packtpub-crawler')
#print(os.listdir(os.curdir))
... | from apscheduler.schedulers.blocking import BlockingScheduler
import os
import shutil
sched = BlockingScheduler()
#@sched.scheduled_job('interval', minutes=5)
@sched.scheduled_job('cron', hour=9)
def scheduled_job():
print('New job: packtpub-crawler')
#print(os.listdir(os.curdir))
shutil.rmtree('./ebooks... | mit | Python |
95f1438d88865ca5619ca4759f621d778ed75483 | fix pgw_shop_id | logithr/django-htpayway,logithr/django-htpayway | project/utils.py | project/utils.py | from htpayway import PayWay
from mock import Mock
from decimal import Decimal
class ThisPayWay(PayWay):
pgw_shop_id = '20000185'
pgw_secret_key = "pZclhO{2G+RlMR#FWX{9g5'C"
def set_order(self, order):
# mock data
self.order = Mock(name='order')
self.order.id = '11'
self.o... | from htpayway import PayWay
from mock import Mock
from decimal import Decimal
class ThisPayWay(PayWay):
pgw_shop_id = '20000186'
pgw_secret_key = "pZclhO{2G+RlMR#FWX{9g5'C"
def set_order(self, order):
# mock data
self.order = Mock(name='order')
self.order.id = '11'
self.o... | mit | Python |
ca440802b4548ca24cb4c7a83b65c890c06254e4 | Debug flag | cf-platform-eng/aws-pcf-quickstart,cf-platform-eng/aws-pcf-quickstart,cf-platform-eng/aws-pcf-quickstart | quickstart.py | quickstart.py | import datetime
import os
import sys
import time
import click
PATH = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(1, os.path.join(PATH, 'lib'))
from lib import settings, om_manager
# todo: cli flag...?
om_manager.debug_mode = True
@click.group()
@click.option('--debug/--no-debug', default=False)
@cl... | import datetime
import os
import sys
import time
import click
PATH = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(1, os.path.join(PATH, 'lib'))
from lib import settings, om_manager
# todo: cli flag...?
om_manager.debug_mode = False
@click.group()
@click.pass_context
def cli(ctx):
my_settings = s... | apache-2.0 | Python |
bcb28563b0b8e3cfbc574771ad8a9929ec58efd2 | Update XFileSharing.py | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/hoster/XFileSharing.py | module/plugins/hoster/XFileSharing.py | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class XFileSharing(XFSHoster):
__name__ = "XFileSharing"
__type__ = "hoster"
__version__ = "0.62"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
__config__ = [("activated... | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class XFileSharing(XFSHoster):
__name__ = "XFileSharing"
__type__ = "hoster"
__version__ = "0.61"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
__config__ = [("activated... | agpl-3.0 | Python |
995d14e1d0734654c83d7534595f89228f815ef3 | fix (Windows) issue #42 | llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy | llvm-config-win32.py | llvm-config-win32.py | import sys, os
def find_path_of(filename, envvar='PATH'):
"""Finds the path from $PATH where the file exists, returns None if not found."""
pathlist = os.getenv(envvar).split(os.pathsep)
for path in pathlist:
if os.path.exists(os.path.join(path, filename)):
return os.path.abspath(path)
... | import sys, os
def find_path_of(filename, envvar='PATH'):
"""Finds the path from $PATH where the file exists, returns None if not found."""
pathlist = os.getenv(envvar).split(os.pathsep)
for path in pathlist:
if os.path.exists(os.path.join(path, filename)):
return os.path.abspath(path)
... | bsd-3-clause | Python |
54bd5a1311c8e2a9c9097888c4b302558308054d | change CNN spider into a crawl spider | dmkoch/scrapy-intro,dmkoch/scrapy-intro | newsbot/newsbot/spiders/cnn_spider.py | newsbot/newsbot/spiders/cnn_spider.py | from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from ..items import ArticleItem
class CnnSpider(CrawlSpider):
name = 'cnn'
allowed_domains = ['www.cnn.com']
start_urls = [
'http://w... | from scrapy.spider import BaseSpider
class CnnSpider(BaseSpider):
name = 'cnn'
allowed_domains = ['www.cnn.com']
start_urls = [
'http://www.cnn.com/',
]
def parse(self, response):
open('homepage.html', 'wb').write(response.body)
| mit | Python |
a46783afc4c4c92e917c12b68972a56bdb8f2597 | make compatible with Python 3 | SpiderLabs/owasp-modsecurity-crs,SpiderLabs/owasp-modsecurity-crs,SpiderLabs/owasp-modsecurity-crs,SpiderLabs/owasp-modsecurity-crs,coreruleset/coreruleset,SpiderLabs/owasp-modsecurity-crs,umarfarook882/owasp-modsecurity-crs,coreruleset/coreruleset,SpiderLabs/owasp-modsecurity-crs,umarfarook882/owasp-modsecurity-crs,co... | util/regexp-assemble/regexp-cmdline.py | util/regexp-assemble/regexp-cmdline.py | #!/usr/bin/env python
#
# Convert a word list to a list of regexps usable by Regexp::Assemble.
#
# Examples:
# cat regexp-932100.txt | ./regexp-cmdline.py unix | ./regexp-assemble.pl
# cat regexp-932110.txt | ./regexp-cmdline.py windows | ./regexp-assemble.pl
# cat regexp-932150.txt | ./regexp-cmdline.py unix | ./reg... | #!/usr/bin/env python
#
# Convert a word list to a list of regexps usable by Regexp::Assemble.
#
# Examples:
# cat regexp-932100.txt | ./regexp-cmdline.py unix | ./regexp-assemble.pl
# cat regexp-932110.txt | ./regexp-cmdline.py windows | ./regexp-assemble.pl
# cat regexp-932150.txt | ./regexp-cmdline.py unix | ./reg... | apache-2.0 | Python |
388895522ffc4f817759005a08c6bb6be1dafc30 | Increment version number | jbittel/django-mama-cas,jbittel/django-mama-cas,orbitvu/django-mama-cas,orbitvu/django-mama-cas | mama_cas/__init__.py | mama_cas/__init__.py | __version_info__ = (1, 2, 0)
__version__ = '.'.join([str(v) for v in __version_info__])
| __version_info__ = (1, 1, 1)
__version__ = '.'.join([str(v) for v in __version_info__])
| bsd-3-clause | Python |
8f355bd81a4f3f12c98375e1b2ca1bfa55737cac | Bump version | renalreg/cornflake | cornflake/__init__.py | cornflake/__init__.py | __version__ = '0.2.2'
| __version__ = '0.2.1'
| mit | Python |
1602f256dedf098345930b9af4228fc32d1c43d9 | add set_rtld_flags to __init__.py | tbenthompson/cppimport,tbenthompson/cppimport,tbenthompson/cppimport | cppimport/__init__.py | cppimport/__init__.py | from cppimport.config import set_quiet, force_rebuild, file_exts, turn_off_strict_prototypes, set_rtld_flags
from cppimport.importer import imp, imp_from_filepath
from cppimport.templating import setup_pybind11
from cppimport.importer import imp as cppimport
| from cppimport.config import set_quiet, force_rebuild, file_exts, turn_off_strict_prototypes
from cppimport.importer import imp, imp_from_filepath
from cppimport.templating import setup_pybind11
from cppimport.importer import imp as cppimport
| mit | Python |
92ad206b84dff9f02d1c855232d1489ced9cbdf3 | Use re instead of shlex.split to find executable | thaim/ansible,thaim/ansible | lib/ansible/runner/action_plugins/raw.py | lib/ansible/runner/action_plugins/raw.py | # (c) 2012, 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) any lat... | # (c) 2012, 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) any lat... | mit | Python |
fb9591c4a2801bfe5f5380c3e33aa44a25db3591 | Add absolute URLs to form and question admin | cschwede/django-customforms | customforms/models.py | customforms/models.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.db import models
class Form(models.Model):
title = models.CharField(_("Title"), max_length=255)
def __unicode__(self):
return u'%s' % self.title
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from django.db import models
class Form(models.Model):
title = models.CharField(_("Title"), max_length=255)
def __unicode__(self):
return u'%s' % self.title
class Meta:
ordering = ('title', )
... | apache-2.0 | Python |
5a1f72de985b9c6bccafa0b2e9f21be9abbc77ca | Add log-level CLI option | praekeltfoundation/certbot,praekeltfoundation/certbot | marathon_acme/cli.py | marathon_acme/cli.py | import argparse
import sys
def main(raw_args=sys.argv[1:]):
"""
A tool to automatically request, renew and distribute Let's Encrypt
certificates for apps running on Marathon and served by marathon-lb.
"""
parser = argparse.ArgumentParser(
description='Automatically manage ACME certificates... | import argparse
import sys
def main(raw_args=sys.argv[1:]):
"""
A tool to automatically request, renew and distribute Let's Encrypt
certificates for apps running on Marathon and served by marathon-lb.
"""
parser = argparse.ArgumentParser(
description='Automatically manage ACME certificates... | mit | Python |
1b6ab75db3619ba4e686ee504a954c5391598c34 | fix logging | ponty/psidialogs,ponty/psidialogs,ponty/psidialogs | psidialogs/backend_api.py | psidialogs/backend_api.py | from psidialogs.mixins import AllMixin
from psidialogs.backendloader import BackendLoader
import logging
log = logging.getLogger(__name__)
def opendialog(funcname, argdict):
for (k, v) in argdict.items():
if v is None:
argdict[k] = ""
log.debug(funcname)
log.debug(argdict)
b = Ba... | from psidialogs.mixins import AllMixin
from psidialogs.backendloader import BackendLoader
import logging
def opendialog(funcname, argdict):
for (k, v) in argdict.items():
if v is None:
argdict[k] = ""
logging.debug(funcname)
logging.debug(argdict)
b = BackendLoader().selected()
... | bsd-2-clause | Python |
854b8102518f102308d545603cd93e0c9945c4b9 | Bump version | timxx/gitc,timxx/gitc | qgitc/version.py | qgitc/version.py | # -*- coding: utf-8 -*-
VERSION_MAJOR = 2
VERSION_MINOR = 0
VERSION_PATCH = 1
VERSION = "{}.{}.{}".format(VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH)
| # -*- coding: utf-8 -*-
VERSION_MAJOR = 2
VERSION_MINOR = 0
VERSION_PATCH = 0
VERSION = "{}.{}.{}".format(VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH)
| apache-2.0 | Python |
b208e1ed4ad8bda465ac0cb5d83e5f64a81556c0 | manage when a user changes their mind | battlemidget/juju-layer-node | reactive/node.py | reactive/node.py | from charms.reactive import (
hook,
set_state,
remove_state,
main,
when_not,
)
from charmhelpers.core import (
hookenv,
unitdata,
)
from charms import apt
config = hookenv.config()
kv = unitdata.kv()
@when_not('nodejs.available')
def install_nodejs():
""" Installs defined node runt... | from charms.reactive import (
hook,
set_state,
remove_state,
main,
when_not,
)
from charmhelpers.core import (
hookenv,
unitdata,
)
from charms import apt
config = hookenv.config()
kv = unitdata.kv()
@when_not('nodejs.available')
def install_nodejs():
""" Installs defined node runt... | mit | Python |
f3359b7ad48fbbbbed30160e748d6c663b6fcdbd | fix #392 | ysekky/GPy,dhhjx880713/GPy,befelix/GPy,SheffieldML/GPy,SheffieldML/GPy,dhhjx880713/GPy,esiivola/GPYgradients,esiivola/GPYgradients,dhhjx880713/GPy,mikecroucher/GPy,befelix/GPy,SheffieldML/GPy,mikecroucher/GPy,ysekky/GPy,befelix/GPy,ysekky/GPy,esiivola/GPYgradients,SheffieldML/GPy,befelix/GPy,dhhjx880713/GPy,mikecrouche... | GPy/mappings/__init__.py | GPy/mappings/__init__.py | # Copyright (c) 2013, 2014 GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from .kernel import Kernel
from .linear import Linear
from .mlp import MLP
from .additive import Additive
from .compound import Compound
from .constant import Constant
from .identity import Identity
fr... | # Copyright (c) 2013, 2014 GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from .kernel import Kernel
from .linear import Linear
from .mlp import MLP
from .additive import Additive
from .compound import Compound
from .constant import Constant
| bsd-3-clause | Python |
4926dd72c831960c7d6167f1ec73a663506aee82 | Fix wrong variable name. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/encodings/charmap.py | Lib/encodings/charmap.py | """ Generic Python Character Mapping Codec.
Use this codec directly rather than through the automatic
conversion mechanisms supplied by unicode() and .encode().
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import codecs
### Codec APIs
class... | """ Generic Python Character Mapping Codec.
Use this codec directly rather than through the automatic
conversion mechanisms supplied by unicode() and .encode().
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import codecs
### Codec APIs
class... | mit | Python |
10f31cc96c776453be941ed0010cf4e88233c975 | update swallow_argv test with prefix-matching | ipython/ipython,ipython/ipython | IPython/kernel/tests/test_launcher.py | IPython/kernel/tests/test_launcher.py | """Tests for kernel utility functions
Authors
-------
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2011, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed ... | """Tests for kernel utility functions
Authors
-------
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2011, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed ... | bsd-3-clause | Python |
eea4914e2ac082ad1fecc6131cbfea52f9565139 | update dev version after 0.39.0 tag [ci skip] | desihub/desitarget,desihub/desitarget | py/desitarget/_version.py | py/desitarget/_version.py | __version__ = '0.39.0.dev3998'
| __version__ = '0.39.0'
| bsd-3-clause | Python |
b1a839e46a1c197fbd091a97fee0dea6f6f0b660 | bump dev version after 0.7.0 tag | desihub/desitarget,desihub/desitarget | py/desitarget/_version.py | py/desitarget/_version.py | __version__ = '0.7.0.dev406'
| __version__ = '0.7.0'
| bsd-3-clause | Python |
482d9fe0cfd1d729316530b684e058b8f08cc4b4 | Add meme font | The-Penultimate-Defenestrator/memefarm | memefarm/__init__.py | memefarm/__init__.py | """
memefarm - generate an effectively unlimited number of memes by blindly
combining random images and words.
"""
# Dependencies
from PIL import Image, ImageDraw, ImageFont
import random
# Internal modules
import imagesearch
import wordgen
# GLOBALS
commonwords = wordgen.getWords() # Common english words
memefon... | """
memefarm - generate an effectively unlimited number of memes by blindly
combining random images and words.
"""
# Dependencies
from PIL import Image
import random
# Internal modules
import imagesearch
import wordgen
# Load words
commonwords = wordgen.getWords()
class memefarm(object):
""" A 'meme farm' ca... | mit | Python |
d6ff777c7fb3f645c021da1319bb5d78d13aa9db | Fix python siphashing to match c implementation | janLo/automation_mesh,janLo/automation_mesh,janLo/automation_mesh | meshnet/interface.py | meshnet/interface.py | import serial
import struct
from siphashc import siphash
def _hash(key: bytes, sender: int, receiver: int, msg_type: int, data: bytes):
packed_data = struct.pack(">hhB", sender, receiver, msg_type) + data
return struct.pack(">Q", siphash(key, packed_data))
class SerialMessage(object):
def __init__(self)... | import serial
import struct
from siphashc import siphash
def _hash(key: str, sender: int, receiver: int, msg_type: int, data: bytes):
packed_data = struct.pack(">h>hBs", sender, receiver, msg_type, data)
return struct.pack("Q", siphash(key, packed_data))
class SerialMessage(object):
def __init__(self):
... | bsd-3-clause | Python |
6ae6db2b7dbb8ed2226cdb8d969329019bbe2993 | add restart | mabotech/mabo_sup | py/mabo_sup/controller.py | py/mabo_sup/controller.py |
"""restart app/service"""
import subprocess
class Controller(object):
"""class"""
def __init__(self):
pass
def listen(self):
"""listen restart command"""
pass
def alert(self):
"""send mail"""
pass
def restart(service):
"... |
"""restart app/service"""
class Controller(object):
def __init__(self):
pass
| mit | Python |
9d6ad3b56d078143ddbbfec0674a6a0cb7f2030f | Convert result of optimization to a tuple | cigroup-ol/metaopt,cigroup-ol/metaopt,cigroup-ol/metaopt | metaopt/core/main.py | metaopt/core/main.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function, with_statement
from threading import Timer
from metaopt.core.returnspec import ReturnSpec
from metaopt.invoker.multiprocess import MultiProcessInvoker
from metaopt.invoker.pluggable import PluggableInvoker
from metaopt.optimizer.saes import SAES... | # -*- coding: utf-8 -*-
from __future__ import division, print_function, with_statement
from threading import Timer
from metaopt.core.returnspec import ReturnSpec
from metaopt.invoker.multiprocess import MultiProcessInvoker
from metaopt.invoker.pluggable import PluggableInvoker
from metaopt.optimizer.saes import SAES... | bsd-3-clause | Python |
7f314ac89ef5dac18afac30f9ad86f6bf47b630b | Remove unused module level variables | alexandermendes/pybossa-discourse | pybossa_discourse/view.py | pybossa_discourse/view.py | # -*- coding: utf8 -*-
"""Views module for pybossa-discourse."""
from flask import Blueprint, request, url_for, flash, redirect
from flask import current_app as app
from flask.ext.login import logout_user, current_user
def index():
"""Attempt to sign in via SSO then redirect to Discourse."""
discourse_sso = ... | # -*- coding: utf8 -*-
"""Views module for pybossa-discourse."""
from flask import Blueprint, request, url_for, flash, redirect
from flask import current_app as app
from flask.ext.login import logout_user, current_user
discourse_sso = app.extensions['discourse']['sso']
discourse_client = app.extensions['discourse']['... | bsd-3-clause | Python |
1fe9dbdbe1eaf02a9e53dfe5ce890358296f4efb | Increment version for release | pycroscopy/pycroscopy | pycroscopy/__version__.py | pycroscopy/__version__.py | version = '0.60.2'
time = '2018-07-30 14:04:51'
| version = '0.60.1'
time = '2018-06-19 09:41:25'
| mit | Python |
25dd1a2579195021900d641eddcc084c00084b25 | use numpy random | jameshicks/pydigree,jameshicks/pydigree | pydigree/recombination.py | pydigree/recombination.py | #!/usr/bin/env python
from array import array
from bisect import bisect_left
import numpy as np
def recombine(chr1, chr2, map):
newchrom = _recombine_haldane(chr1, chr2, map)
if isinstance(chr1, array) and isinstance(chr2, array):
if chr1.typecode != chr2.typecode:
raise ValueError('Chrom... | #!/usr/bin/env python
import random
from array import array
from bisect import bisect_left
import numpy as np
def recombine(chr1, chr2, map):
newchrom = _recombine_haldane(chr1, chr2, map)
if isinstance(chr1, array) and isinstance(chr2, array):
if chr1.typecode != chr2.typecode:
raise Va... | apache-2.0 | Python |
8a29430d0254d4e5e9b13db5369d7bc2883a7ca7 | Update pylsy_test.py | bcho/Pylsy,muteness/Pylsy,bcho/Pylsy,huiyi1990/Pylsy,gnithin/Pylsy,gnithin/Pylsy,huiyi1990/Pylsy,muteness/Pylsy | pylsy/tests/pylsy_test.py | pylsy/tests/pylsy_test.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
from pylsy.pylsy import pylsytable
class PylsyTableTests(unittest.TestCase):
def setUp(self):
attributes = ["name", "age"]
self.table = pylsytable(attributes)
def tearDown(self):
self.table = None
de... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
import sys
sys.path.append('..')
from pylsy import pylsytable
class PylsyTableTests(unittest.TestCase):
def setUp(self):
attributes = ["name", "age"]
self.table = pylsytable(attributes)
def tearDown(self):
... | mit | Python |
0cabd9f72f902a993d52bbae5a9f45580254a44f | return values for testcase | mhalder/pyproject,mhalder/pyproject | pyproject/simplemodule.py | pyproject/simplemodule.py | # -*- coding: utf-8 -*-
#
# Copyright 2012 Martin Halder <martin.halder@gmail.com>
#
# This file is part of PyProject.
#
# PyProject 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 Lice... | # -*- coding: utf-8 -*-
#
# Copyright 2012 Martin Halder <martin.halder@gmail.com>
#
# This file is part of PyProject.
#
# PyProject 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 Lice... | bsd-2-clause | Python |
a392e6fce8cbdf62390bd559f5b8c729c0ba1110 | Revert "Raise a warning when failing run_decoding_tests." | google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,Ti... | slave/skia_slave_scripts/run_decoding_tests.py | slave/skia_slave_scripts/run_decoding_tests.py | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia skimage executable. """
from build_step import BuildStep
import sys
class RunDecodingTests(BuildStep):
def _Ru... | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia skimage executable. """
from build_step import BuildStep, BuildStepWarning
import sys
class RunDecodingTests(Bui... | bsd-3-clause | Python |
36d99edb6747fea58bb1effbfc306af09939779e | use transaction | shownotes/snotes20-restapi,shownotes/snotes20-restapi | snotes20/management/commands/importexternal.py | snotes20/management/commands/importexternal.py | import logging
import datetime
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from snotes20.datasources import sources
import snotes20.models as models
logger = logging.getLogger(__name__)
def import_from_source(source):
logger.info("downloading Podcasts")
... | from django.core.management.base import BaseCommand, CommandError
import logging
import datetime
from snotes20.datasources import sources
import snotes20.models as models
logger = logging.getLogger(__name__)
def import_from_source(source):
logger.info("importing Podcasts")
podcasts = source.get_podcasts()
... | agpl-3.0 | Python |
f828b79ed30edcc87837d820e6b5712de16a3118 | bump version -> 2.2.0.dev3 | omry/omegaconf | omegaconf/version.py | omegaconf/version.py | import sys # pragma: no cover
__version__ = "2.2.0.dev3"
msg = """OmegaConf 2.0 and above is compatible with Python 3.6 and newer.
You have the following options:
1. Upgrade to Python 3.6 or newer.
This is highly recommended. new features will not be added to OmegaConf 1.4.
2. Continue using OmegaConf 1.4:
Yo... | import sys # pragma: no cover
__version__ = "2.2.0.dev2"
msg = """OmegaConf 2.0 and above is compatible with Python 3.6 and newer.
You have the following options:
1. Upgrade to Python 3.6 or newer.
This is highly recommended. new features will not be added to OmegaConf 1.4.
2. Continue using OmegaConf 1.4:
Yo... | bsd-3-clause | Python |
4c5be9a3b99ad47a1492a2b3481498273ec3a6cd | bump repo version | omry/omegaconf | omegaconf/version.py | omegaconf/version.py | import sys # pragma: no cover
__version__ = "2.0.0rc24"
msg = """OmegaConf 2.0 and above is compatible with Python 3.6 and newer.
You have the following options:
1. Upgrade to Python 3.6 or newer.
This is highly recommended. new features will not be added to OmegaConf 1.4.
2. Continue using OmegaConf 1.4:
You... | import sys # pragma: no cover
__version__ = "2.0.0rc23"
msg = """OmegaConf 2.0 and above is compatible with Python 3.6 and newer.
You have the following options:
1. Upgrade to Python 3.6 or newer.
This is highly recommended. new features will not be added to OmegaConf 1.4.
2. Continue using OmegaConf 1.4:
You... | bsd-3-clause | Python |
3e8d1efc04d28b11f0ca8b4c14f84b4fdd3b88ba | Fix import error | DarkmatterVale/regex4dummies | regex4dummies/__init__.py | regex4dummies/__init__.py | from regex4dummies import regex4dummies
from toolkit import Toolkit
| from regex4dummies import regex4dummies
| mit | Python |
2bcda9a2e80386cbd0f269b422ad9fa693a5b4de | Add "Python :: 3" classifier to reprozip-jupyter | ViDA-NYU/reprozip,ViDA-NYU/reprozip,ViDA-NYU/reprozip,ViDA-NYU/reprozip,ViDA-NYU/reprozip | reprozip-jupyter/setup.py | reprozip-jupyter/setup.py | import io
import os
from setuptools import setup
# pip workaround
os.chdir(os.path.abspath(os.path.dirname(__file__)))
# Need to specify encoding for PY3, which has the worst unicode handling ever
with io.open('README.rst', encoding='utf-8') as fp:
description = fp.read()
setup(name='reprozip-jupyter',
ve... | import io
import os
from setuptools import setup
# pip workaround
os.chdir(os.path.abspath(os.path.dirname(__file__)))
# Need to specify encoding for PY3, which has the worst unicode handling ever
with io.open('README.rst', encoding='utf-8') as fp:
description = fp.read()
setup(name='reprozip-jupyter',
ve... | bsd-3-clause | Python |
0df3fe9b900fcfb96953195f4f5ed013cd4ebb55 | update version | bird-house/pywps-proxy,bird-house/twitcher,bird-house/pywps-proxy | twitcher/__init__.py | twitcher/__init__.py | import logging
logger = logging.getLogger(__name__)
__version__ = '0.3.3'
def main(global_config, **settings):
"""
This function returns a Pyramid WSGI application.
"""
from pyramid.config import Configurator
config = Configurator(settings=settings)
# include twitcher components
config.... | import logging
logger = logging.getLogger(__name__)
__version__ = '0.3.2'
def main(global_config, **settings):
"""
This function returns a Pyramid WSGI application.
"""
from pyramid.config import Configurator
config = Configurator(settings=settings)
# include twitcher components
config.... | apache-2.0 | Python |
e9af799900df8f3dd6f4b55f796e918c80a48b5a | Handle 'Interrupted system call' corectly in InputHookContext. | ddalex/python-prompt-toolkit,jonathanslenders/python-prompt-toolkit,jaseg/python-prompt-toolkit,amjith/python-prompt-toolkit,melund/python-prompt-toolkit,ALSchwalm/python-prompt-toolkit,niklasf/python-prompt-toolkit | prompt_toolkit/eventloop/inputhook.py | prompt_toolkit/eventloop/inputhook.py | """
Similar to `PyOS_InputHook` of the Python API. Some eventloops can have an
inputhook to allow easy integration with other event loops.
When the eventloop of prompt-toolkit is idle, it can call such a hook. This
hook can call another eventloop that runs for a short while, for instance to
keep a graphical user inter... | """
Similar to `PyOS_InputHook` of the Python API. Some eventloops can have an
inputhook to allow easy integration with other event loops.
When the eventloop of prompt-toolkit is idle, it can call such a hook. This
hook can call another eventloop that runs for a short while, for instance to
keep a graphical user inter... | bsd-3-clause | Python |
b2bab786c4af3dcca7d35b1e6ecff8699e542ec4 | Add a pytest hook for creating the coverage data_file directory | jbeezley/girder,jbeezley/girder,girder/girder,kotfic/girder,jbeezley/girder,data-exp-lab/girder,Xarthisius/girder,data-exp-lab/girder,girder/girder,RafaelPalomar/girder,jbeezley/girder,girder/girder,kotfic/girder,manthey/girder,kotfic/girder,girder/girder,RafaelPalomar/girder,Xarthisius/girder,RafaelPalomar/girder,Xart... | pytest_girder/pytest_girder/plugin.py | pytest_girder/pytest_girder/plugin.py | import os
from .fixtures import * # noqa
def pytest_configure(config):
"""
Create the necessary directories for coverage. This is necessary because neither coverage nor
pytest-cov have support for making the data_file directory before running.
"""
covPlugin = config.pluginmanager.get_plugin('_cov... | from .fixtures import * # noqa
def pytest_addoption(parser):
group = parser.getgroup('girder')
group.addoption('--mock-db', action='store_true', default=False,
help='Whether or not to mock the database using mongomock.')
group.addoption('--mongo-uri', action='store', default='mongodb:... | apache-2.0 | Python |
61799c59f5acddeb79248f5f2244b047cb737e29 | move get_posts and get_stream methods into User | davejlin/treehouse,davejlin/treehouse,davejlin/treehouse,davejlin/treehouse,davejlin/treehouse,davejlin/treehouse,davejlin/treehouse,davejlin/treehouse | python/flask/social-network/models.py | python/flask/social-network/models.py | import datetime
from flask_bcrypt import generate_password_hash
from flask_login import UserMixin
from peewee import *
DATABASE = SqliteDatabase('social.db')
class User(UserMixin, Model):
username = CharField(unique=True)
email = CharField(unique=True)
password = CharField(max_length=100)
joined_at = DateTimeFie... | import datetime
from flask_bcrypt import generate_password_hash
from flask_login import UserMixin
from peewee import *
DATABASE = SqliteDatabase('social.db')
class User(UserMixin, Model):
username = CharField(unique=True)
email = CharField(unique=True)
password = CharField(max_length=100)
joined_at = DateTimeFie... | unlicense | Python |
65330d63992fa2f8696308a06991cb9b031668b1 | Update curlCallee.py | mudragada/util-scripts | pythonworks/Curls/Curls/curlCallee.py | pythonworks/Curls/Curls/curlCallee.py | from curlRequester import sendCurlRequest
username = 'admin'
password = 'password'
instancesFile = 'instancesspreadout'
def BrowsePageServiceFlush():
path = 'url/?shouldInvokeMethod=flushAllBrowseCaches'
typeList = ['831','832','834']
curlOnSocketsFromFile(instancesFile, path , username, password, typeList... | __author__ = 'Krishna Mudragada'
from curlRequester import sendCurlRequest
username = 'krishna'
password = 'Eagles@123'
instancesFile = 'instancesspreadout'
def BrowsePageServiceFlush():
path = 'aeo/commerce/catalog/services/BrowsePageService/?shouldInvokeMethod=flushAllBrowseCaches'
typeList = ['831','832','... | mit | Python |
8a26c2f9fefdf76aaffaf8ee276f810e10935796 | Implement EvidenceRequest.__eq__() | sherlocke/pywatson | pywatson/question/evidence_request.py | pywatson/question/evidence_request.py | class EvidenceRequest(object):
"""Include this with a Question to request evidence from Watson"""
def __init__(self, items=3, profile=False):
self.items = items
self.profile = profile
def __eq__(self, other):
"""Return True iff self is equivalent to other
:param other: an ... | class EvidenceRequest(object):
"""Include this with a Question to request evidence from Watson"""
def __init__(self, items=3, profile=False):
self.items = items
self.profile = profile
def __eq__(self, other):
return False
| mit | Python |
b1e6f3eacccb5e575ac47b6a40809f4671510672 | Drop Python 2 support in split_level utility function | rsinger86/drf-flex-fields | rest_flex_fields/utils.py | rest_flex_fields/utils.py | from collections.abc import Iterable
def is_expanded(request, key):
""" Examines request object to return boolean of whether
passed field is expanded.
"""
expand = request.query_params.get("expand", "")
expand_fields = []
for e in expand.split(","):
expand_fields.extend([e for e i... | try:
# Python 3
from collections.abc import Iterable
string_types = (str,)
except ImportError:
# Python 2
from collections import Iterable
string_types = (str, unicode)
def is_expanded(request, key):
""" Examines request object to return boolean of whether
passed field is expanded.... | mit | Python |
40980253f3ea8dd03e8f14d25f9098c8c910d989 | Update validate-binary-search-tree.py | kamyu104/LeetCode,kamyu104/LeetCode,githubutilities/LeetCode,githubutilities/LeetCode,kamyu104/LeetCode,githubutilities/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCo... | Python/validate-binary-search-tree.py | Python/validate-binary-search-tree.py | # Time: O(n)
# Space: O(1)
#
# Given a binary tree, determine if it is a valid binary search tree (BST).
#
# Assume a BST is defined as follows:
#
# The left subtree of a node contains only nodes with keys less than the node's key.
# The right subtree of a node contains only nodes with keys greater than the node's ... | # Time: O(n)
# Space: O(logn)
#
# Given a binary tree, determine if it is a valid binary search tree (BST).
#
# Assume a BST is defined as follows:
#
# The left subtree of a node contains only nodes with keys less than the node's key.
# The right subtree of a node contains only nodes with keys greater than the node... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.