commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
a28c3e9614cc8ab82ed0d1796d68a5b03906f801 | seleniumbase/config/proxy_list.py | seleniumbase/config/proxy_list.py | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | Update the sample proxy list | Update the sample proxy list
| Python | mit | mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase |
9d59bca61b2836e7db3c50d5558a46aa2dbaea08 | tests/run_tests.py | tests/run_tests.py | #! /usr/bin/env python
# ======================================================================
# matscipy - Python materials science tools
# https://github.com/libAtoms/matscipy
#
# Copyright (2014) James Kermode, King's College London
# Lars Pastewka, Karlsruhe Institute of Technology
#
# This progr... | #! /usr/bin/env python
# ======================================================================
# matscipy - Python materials science tools
# https://github.com/libAtoms/matscipy
#
# Copyright (2014) James Kermode, King's College London
# Lars Pastewka, Karlsruhe Institute of Technology
#
# This progr... | Add crack test to test runner. | Add crack test to test runner.
| Python | lgpl-2.1 | libAtoms/matscipy,libAtoms/matscipy,libAtoms/matscipy,libAtoms/matscipy |
6d942a84da5f9a07ea1fac96ec0667ded623be60 | tests/test_util.py | tests/test_util.py | import unittest
import tabula
try:
FileNotFoundError
from unittest.mock import patch, MagicMock
from urllib.request import Request
except NameError:
FileNotFoundError = IOError
from mock import patch, MagicMock
from urllib2 import Request
class TestUtil(unittest.TestCase):
def test_enviro... | import unittest
import tabula
try:
FileNotFoundError
from unittest.mock import patch, MagicMock
from urllib.request import Request
except NameError:
FileNotFoundError = IOError
from mock import patch, MagicMock
from urllib2 import Request
class TestUtil(unittest.TestCase):
def test_enviro... | Remove assert_called for Python 3.5 compatibility | fix: Remove assert_called for Python 3.5 compatibility
| Python | mit | chezou/tabula-py |
5d4210ceb34773dffce7d0bb27f38115bb8e1a9f | tests/testcases.py | tests/testcases.py | from __future__ import unicode_literals
from __future__ import absolute_import
from fig.packages.docker import Client
from fig.service import Service
from fig.cli.utils import docker_url
from . import unittest
class DockerClientTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.client ... | from __future__ import unicode_literals
from __future__ import absolute_import
from fig.packages.docker import Client
from fig.service import Service
from fig.cli.utils import docker_url
from . import unittest
class DockerClientTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.client ... | Fix tests when there is an image with int tag | Fix tests when there is an image with int tag
| Python | apache-2.0 | mosquito/docker-compose,thaJeztah/docker.github.io,thaJeztah/docker.github.io,bsmr-docker/compose,gdevillele/docker.github.io,BSWANG/denverdino.github.io,jiekechoo/compose,jgrowl/compose,docker/docker.github.io,brunocascio/compose,ZJaffee/compose,gdevillele/docker.github.io,LuisBosquez/docker.github.io,kojiromike/compo... |
8c97ffed1531315dd50639c40b0bccad0fc1ef2d | textual_runtime.py | textual_runtime.py | # Runtime for managing the interactive component of the game. Allows user to play the game
# through a text based interface.
from game import DiscState
class TextualRuntime:
def __init__(self, game):
self.game = game
self.state = {
"continue": True
}
def start(self):
while self.state["cont... | # Runtime for managing the interactive component of the game. Allows user to play the game
# through a text based interface.
from game import DiscState
class TextualRuntime:
def __init__(self, game):
self.game = game
self.state = {
"continue": True
}
def start(self):
while self.state["cont... | Add ability to drop discs on slots | Add ability to drop discs on slots
| Python | mit | misterwilliam/connect-four |
566739e88098eb40da26bd0930ac2d65ffdb999c | src/nyc_trees/apps/core/helpers.py | src/nyc_trees/apps/core/helpers.py |
def user_is_census_admin(user):
return user.is_authenticated() and user.is_census_admin
def user_is_group_admin(user, group):
return user.is_authenticated() and (user.is_census_admin or
group.admin == user)
def user_has_online_training(user):
return user.is_authe... | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from apps.users.models import TrustedMapper
def user_is_census_admin(user):
return user.is_authenticated() and user.is_census_admin
def user_is_group_admin(user, group):
ret... | Hide "Request Individual Mapper Status" button if approved | Hide "Request Individual Mapper Status" button if approved
There's no point to showing this button once you have been approved as
an individual mapper for this group.
| Python | agpl-3.0 | RickMohr/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,maurizi/nyc-trees,kdeloach/nyc-trees,RickMohr/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,RickMohr/nyc-trees,maurizi/nyc-trees,RickMohr/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,maurizi/ny... |
44faefd4bd0bfa3dede8686903759a033c1072d6 | flask_simple_serializer/response.py | flask_simple_serializer/response.py | import json
from flask import Response as SimpleResponse
from .status_codes import HTTP_200_OK
from .serializers import BaseSerializer
class Response(SimpleResponse):
def __init__(self, data, headers=None, status_code=HTTP_200_OK):
"""
For now the content/type always will be application/json.
... | from flask import Response as SimpleResponse
from flask import json
from .status_codes import HTTP_200_OK
from .serializers import BaseSerializer
class Response(SimpleResponse):
def __init__(self, data, headers=None, status_code=HTTP_200_OK):
"""
For now the content/type always will be applicati... | Replace json for flask.json to manage the Response | Replace json for flask.json to manage the Response
| Python | mit | marcosschroh/Flask-Simple-Serializer |
3f17f454172d15e9279e00ccc2acfb931bf685f1 | transmutagen/tests/test_origen.py | transmutagen/tests/test_origen.py | import os
from itertools import combinations
import numpy as np
from ..tape9utils import origen_to_name
DATA_DIR = os.path.abspath(os.path.join(__file__, os.path.pardir,
os.path.pardir, os.path.pardir, 'docker', 'data'))
def load_data(datafile):
with open(datafile) as f:
return eval(f.read(), {'arra... | import os
from itertools import combinations
import numpy as np
from ..tape9utils import origen_to_name
DATA_DIR = os.path.abspath(os.path.join(__file__, os.path.pardir,
os.path.pardir, os.path.pardir, 'docker', 'data'))
def load_data(datafile):
with open(datafile) as f:
return eval(f.read(), {'arra... | Add a sanity test for the data | Add a sanity test for the data
| Python | bsd-3-clause | ergs/transmutagen,ergs/transmutagen |
905690beacad9731bb113bdbeedf0ed2c7df3160 | profile_audfprint_match.py | profile_audfprint_match.py | import audfprint
import cProfile
import pstats
argv = ["audfprint", "match", "-d", "tmp.fpdb", "--density", "200", "query.mp3", "query2.mp3"]
cProfile.run('audfprint.main(argv)', 'fpmstats')
p = pstats.Stats('fpmstats')
p.sort_stats('time')
p.print_stats(10)
| import audfprint
import cProfile
import pstats
argv = ["audfprint", "match", "-d", "fpdbase.pklz", "--density", "200", "query.mp3"]
cProfile.run('audfprint.main(argv)', 'fpmstats')
p = pstats.Stats('fpmstats')
p.sort_stats('time')
p.print_stats(10)
| Update profile for local data. | Update profile for local data.
| Python | mit | dpwe/audfprint |
e7998648c42d5bcccec7239d13521a5b77a738af | src/utils/indices.py | src/utils/indices.py | import json
import os
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Index
from model import APIDoc
def exists():
return Index(APIDoc.Index.name).exists()
def setup():
"""
Setup Elasticsearch Index.
Primary index with dynamic template.
Secondary index with static mappings... | import json
import os
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Index
from model import APIDoc
def exists():
return Index(APIDoc.Index.name).exists()
def setup():
"""
Setup Elasticsearch Index with dynamic template.
Run it on an open index to update dynamic mapping.
... | Allow setup function to update dynamic mapping | Allow setup function to update dynamic mapping
| Python | mit | Network-of-BioThings/smartAPI,Network-of-BioThings/smartAPI,Network-of-BioThings/smartAPI,Network-of-BioThings/smartAPI,Network-of-BioThings/smartAPI |
3a8ff4ce62c2a0f3e7ebc61284894fc69ec36b79 | django_sqs/message.py | django_sqs/message.py | import base64
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
import django.utils.simplejson as json
import boto.sqs.message
from django.contrib.contenttypes.models import ContentType
class ModelInstanceMessage(boto.sqs.message.RawMessage):
""... | import base64
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
import django.utils.simplejson as json
import boto.sqs.message
from django.contrib.contenttypes.models import ContentType
class ModelInstanceMessage(boto.sqs.message.RawMessage):
""... | Raise ValueError on get_body instead of random exception when initializing ModelInstanceMessage. | Raise ValueError on get_body instead of random exception when initializing ModelInstanceMessage.
| Python | bsd-3-clause | mpasternacki/django-sqs |
9b0618d3b52c74bf2abd65a581807087cbaa2ca4 | grammpy_transforms/NongeneratingSymbolsRemove/nongeneratingSymbolsRemove.py | grammpy_transforms/NongeneratingSymbolsRemove/nongeneratingSymbolsRemove.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy-transforms
"""
from grammpy import Grammar
def _copy_grammar(grammar):
return Grammar(terminals=(item.s for item in grammar.terms()),
nonterminals=grammar.nonterms(),
... | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy-transforms
"""
from copy import copy
from grammpy import Grammar
def _copy_grammar(grammar):
return copy(grammar)
def remove_nongenerating_symbol(grammar: Grammar, transform_grammar=False) -> Grammar:
... | Switch to new version of grammpy (1.1.2) and use copy method | Switch to new version of grammpy (1.1.2) and use copy method
| Python | mit | PatrikValkovic/grammpy |
0f21ef4fe5a1e95668f5fdbeda4d8a37da65484f | trombi/__init__.py | trombi/__init__.py | # Copyright (c) 2010 Inoi Oy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute,... | # Copyright (c) 2010 Inoi Oy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute,... | Add version information under trombi module | Add version information under trombi module
| Python | mit | inoi/trombi |
4c11a3c8f0cd82ebee3269e76450562aa8d2b8c3 | troposphere/sns.py | troposphere/sns.py | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
try:
from awacs.aws import Policy
policytypes = (dict, Policy)
except ImportError:
policytypes = dict,
class Subscription(AWSProperty):
props = {
... | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
try:
from awacs.aws import Policy
policytypes = (dict, Policy)
except ImportError:
policytypes = dict,
class Subscription(AWSProperty):
props = {
... | Add missing properties to SNS::Subscription | Add missing properties to SNS::Subscription
| Python | bsd-2-clause | johnctitus/troposphere,ikben/troposphere,cloudtools/troposphere,johnctitus/troposphere,ikben/troposphere,cloudtools/troposphere,pas256/troposphere,pas256/troposphere |
6038bcd507c43eb86e04c6a32abf9b8249c8872e | tests/server/handlers/test_zip.py | tests/server/handlers/test_zip.py | import asyncio
import io
import zipfile
from unittest import mock
from tornado import testing
from waterbutler.core import streams
from tests import utils
class TestZipHandler(utils.HandlerTestCase):
def setUp(self):
super().setUp()
identity_future = asyncio.Future()
identity_future.se... | import asyncio
import io
import zipfile
from unittest import mock
from tornado import testing
from waterbutler.core import streams
from tests import utils
class TestZipHandler(utils.HandlerTestCase):
@testing.gen_test
def test_download_stream(self):
data = b'freddie brian john roger'
strea... | Remove deprecated test setup and teardown code | Remove deprecated test setup and teardown code
| Python | apache-2.0 | rdhyee/waterbutler,kwierman/waterbutler,hmoco/waterbutler,CenterForOpenScience/waterbutler,cosenal/waterbutler,Ghalko/waterbutler,rafaeldelucena/waterbutler,felliott/waterbutler,icereval/waterbutler,RCOSDP/waterbutler,TomBaxter/waterbutler,chrisseto/waterbutler,Johnetordoff/waterbutler |
e9c23c7a0c622e8db29d066f1cd1a679dc6eb1bf | salt/grains/external_ip.py | salt/grains/external_ip.py | # -*- coding: utf-8 -*-
# This file is here to ensure that upgrades of salt remove the external_ip
# grain
| # -*- coding: utf-8 -*-
# This file is here to ensure that upgrades of salt remove the external_ip
# grain, this file should be removed in the Boron release
| Add note to remove file | Add note to remove file
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
35a9de1ba8f6c1bcb6ae35c9f965657de973412f | tokenizers/sentiment_tokenizer.py | tokenizers/sentiment_tokenizer.py | from nltk.sentiment.util import mark_negation
from nltk.util import trigrams
import re
import validators
from .happy_tokenizer import Tokenizer
class SentimentTokenizer(object):
def __init__(self):
self.tknzr = Tokenizer()
@staticmethod
def reduce_lengthening(text):
"""
Replace re... | from nltk.sentiment.util import mark_negation
from nltk.util import trigrams
import re
import validators
from .happy_tokenizer import Tokenizer
class SentimentTokenizer(object):
def __init__(self):
self.tknzr = Tokenizer()
@staticmethod
def reduce_lengthening(text):
"""
Replace re... | Use map to loop instead of mapping a list | Use map to loop instead of mapping a list
| Python | apache-2.0 | chuajiesheng/twitter-sentiment-analysis |
3c7e6e1f02b9d73497cb49359d542d3fa4c9a85f | utils/rc_sensor.py | utils/rc_sensor.py | #!/usr/bin/env python
import rcsensor
print(rcsensor.get_count(200, 10, 22))
| #!/usr/bin/env python
from common.rcsensor import rcsensor as rcsensor
class RcSensor(object):
def __init__(self, gpio, cycles=200, discharge_delay=10):
if gpio is None:
raise ValueError("Must supply gpio value")
self.gpio = gpio
self.cycles = cycles
self.discharge_de... | Create a RC sensor class object | Create a RC sensor class object
| Python | mit | mecworks/garden_pi,mecworks/garden_pi,mecworks/garden_pi,mecworks/garden_pi |
a5e8f6af93debd98b626ee382a843d5dedbf70f8 | test/benchmarks/general/blocks/read_sigproc.py | test/benchmarks/general/blocks/read_sigproc.py | from timeit import default_timer as timer
import bifrost as bf
from bifrost import pipeline as bfp
from bifrost import blocks as blocks
from bifrost_benchmarks import PipelineBenchmarker
class SigprocBenchmarker(PipelineBenchmarker):
def run_benchmark(self):
with bf.Pipeline() as pipeline:
fil_... | """ Test the sigproc read function """
from timeit import default_timer as timer
import bifrost as bf
from bifrost import pipeline as bfp
from bifrost import blocks as blocks
from bifrost_benchmarks import PipelineBenchmarker
class SigprocBenchmarker(PipelineBenchmarker):
""" Test the sigproc read function """
... | Add docstrings for sigproc benchmarks | Add docstrings for sigproc benchmarks
| Python | bsd-3-clause | ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost |
9a2cc99b068b2aaa572f52b4516852b239577c34 | dummyserver/server.py | dummyserver/server.py | #!/usr/bin/python
import threading, socket
"""
Dummy server using for unit testing
"""
class Server(threading.Thread):
def __init__(self, handler, host='localhost', port=8021):
threading.Thread.__init__(self)
self.handler = handler
self.host = host
self.port = port
self.... | #!/usr/bin/python
import threading, socket
class Server(threading.Thread):
""" Dummy server using for unit testing """
def __init__(self, handler, host='localhost', port=8021):
threading.Thread.__init__(self)
self.handler = handler
self.host = host
self.port = port
... | Put docstring inside Server class | Put docstring inside Server class
| Python | apache-2.0 | psf/requests |
47352af38ace09af3572bc63d8c1da4d27cafb86 | app/notify_client/job_api_client.py | app/notify_client/job_api_client.py |
from notifications_python_client.base import BaseAPIClient
from app.notify_client import _attach_current_user
class JobApiClient(BaseAPIClient):
def __init__(self, base_url=None, client_id=None, secret=None):
super(self.__class__, self).__init__(base_url=base_url or 'base_url',
... |
from notifications_python_client.base import BaseAPIClient
from app.notify_client import _attach_current_user
class JobApiClient(BaseAPIClient):
def __init__(self, base_url=None, client_id=None, secret=None):
super(self.__class__, self).__init__(base_url=base_url or 'base_url',
... | Add limit_days query param to the get_job endpoint. | Add limit_days query param to the get_job endpoint.
| Python | mit | alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin |
aa6cf034e41f9426e6b4688ffe832f802efb7864 | fbalerts.py | fbalerts.py | '''
Check your Facebook notifications on command line.
Author: Amit Chaudhary ( studenton.com@gmail.com )
'''
import json
# Configuration
notifications = 5 # Number of Notifications
profile_id = '1XXXXXXXXXXXXXX'
token = 'write token here'
url = 'https://www.facebook.com/feeds/notifications.php?id=' + \
p... | '''
Check your Facebook notifications on command line.
Author: Amit Chaudhary ( studenton.com@gmail.com )
'''
import json
# Configuration
notifications = 5 # Number of Notifications
profile_id = '1XXXXXXXXXXXXXX'
token = 'write token here'
base_url = 'https://www.facebook.com/feeds/notifications.php?id={0}&vi... | Use new string formatting method | Use new string formatting method | Python | mit | studenton/facebook-alerts |
afa76e2643ed75c6864d2281afd3e220b848e487 | iscc_bench/textid/unicode_blocks.py | iscc_bench/textid/unicode_blocks.py | # -*- coding: utf-8 -*-
"""Blocks of unicode ranges"""
from pprint import pprint
import requests
URL = "https://www.unicode.org/Public/UCD/latest/ucd/Blocks.txt"
def load_blocks():
blocks = {}
data = requests.get(URL).text
for line in data.splitlines():
if line and not line.startswith('#'):
... | # -*- coding: utf-8 -*-
"""Blocks of unicode ranges"""
import unicodedata
from pprint import pprint
import requests
URL = "https://www.unicode.org/Public/UCD/latest/ucd/Blocks.txt"
def load_blocks():
"""Load and parse unicode blocks from unicode standard"""
blocks = {}
data = requests.get(URL).text
f... | Add various unicode spec helper functions | Add various unicode spec helper functions
| Python | bsd-2-clause | coblo/isccbench |
0f5a632d625d65f4edf9e31efa75708a79eee16c | CaseStudies/glass/Implementations/Python_Simplified/Implementation/readTable.py | CaseStudies/glass/Implementations/Python_Simplified/Implementation/readTable.py | """
This module implements a portion of the Input Format Module. In this
case the input is the tabular data necessary for the different interpolations.
"""
import numpy as np
def read_num_col(filename):
with open(filename, 'rb') as f:
num_col = [f.readline()]
num_col = np.genfromtxt(num_col, delimi... | """
This module implements a portion of the Input Format Module. In this
case the input is the tabular data necessary for the different interpolations.
"""
def read_num_col(filename):
with open(filename, "r") as f:
line = f.readline()
z_array = line.split(",")[1::2]
z_array = [float(i) for i in z... | Remove numpy dependency from glassbr python code | Remove numpy dependency from glassbr python code
| Python | bsd-2-clause | JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software |
ea6c57de01f420bdd344194e5529a0e91036c634 | greenfan/management/commands/create-job-from-testspec.py | greenfan/management/commands/create-job-from-testspec.py | #
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.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/LICENSE... | #
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.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/LICENSE... | Allow us to create both virtual and physical jobs | Allow us to create both virtual and physical jobs
| Python | apache-2.0 | sorenh/python-django-greenfan,sorenh/python-django-greenfan |
bfc94287cc5886495851733a45872a8979900435 | lily/notes/migrations/0010_remove_polymorphic_cleanup.py | lily/notes/migrations/0010_remove_polymorphic_cleanup.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('notes', '0009_remove_polymorphic_data_migrate'),
]
operations = [
migrations.AlterField(
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
import django_extensions.db.fields
# Comment for testing migrations in Travis continuous deployment.
class Migration(migrations.Migration):
dependencies = [
('notes', '0009_remove_polymorphic_data_migrate')... | Test migrations with continuous deployment. | Test migrations with continuous deployment.
| Python | agpl-3.0 | HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily |
bc3e31838fd1b5eec3c4ca17f5fab4588ac87904 | tests/client/test_TelnetClient.py | tests/client/test_TelnetClient.py | import unittest
import unittest.mock as mock
from ogn.client.client import TelnetClient
class TelnetClientTest(unittest.TestCase):
@mock.patch('ogn.client.client.socket')
def test_connect(self, socket_mock):
def callback(raw_message):
pass
client = TelnetClient()
client.r... | import unittest
import unittest.mock as mock
from ogn.client.client import TelnetClient
class TelnetClientTest(unittest.TestCase):
@mock.patch('ogn.client.client.socket')
def test_connect_disconnect(self, socket_mock):
client = TelnetClient()
client.connect()
client.sock.connect.asser... | Update to receiver version 0.2.6 | Update to receiver version 0.2.6
Update to receiver version 0.2.6
Better testing
| Python | agpl-3.0 | glidernet/python-ogn-client |
ba6f29106ba6b8957d82cf042753e4b48a671da6 | waterbutler/providers/osfstorage/metadata.py | waterbutler/providers/osfstorage/metadata.py | from waterbutler.core import metadata
class BaseOsfStorageMetadata:
@property
def provider(self):
return 'osfstorage'
class OsfStorageFileMetadata(BaseOsfStorageMetadata, metadata.BaseFileMetadata):
@property
def name(self):
return self.raw['name']
@property
def path(self):
... | from waterbutler.core import metadata
class BaseOsfStorageMetadata:
@property
def provider(self):
return 'osfstorage'
class OsfStorageFileMetadata(BaseOsfStorageMetadata, metadata.BaseFileMetadata):
@property
def name(self):
return self.raw['name']
@property
def path(self):
... | Return User and download count | Return User and download count
| Python | apache-2.0 | rdhyee/waterbutler,hmoco/waterbutler,CenterForOpenScience/waterbutler,Johnetordoff/waterbutler,TomBaxter/waterbutler,kwierman/waterbutler,RCOSDP/waterbutler,Ghalko/waterbutler,icereval/waterbutler,cosenal/waterbutler,felliott/waterbutler,chrisseto/waterbutler,rafaeldelucena/waterbutler |
be86fc3f3c7ec9dc213f8f527da59d5578be8b2a | irma/fileobject/handler.py | irma/fileobject/handler.py | from irma.database.nosqlhandler import NoSQLDatabase
from bson import ObjectId
class FileObject(object):
_uri = None
_dbname = None
_collection = None
def __init__(self, dbname=None, id=None):
if dbname:
self._dbname = dbname
self._dbfile = None
if id:
... | from irma.database.nosqlhandler import NoSQLDatabase
from bson import ObjectId
class FileObject(object):
_uri = None
_dbname = None
_collection = None
def __init__(self, dbname=None, id=None):
if dbname:
self._dbname = dbname
self._dbfile = None
if id:
... | Delete method added in FileObject | Delete method added in FileObject
| Python | apache-2.0 | hirokihamasaki/irma,hirokihamasaki/irma,quarkslab/irma,hirokihamasaki/irma,hirokihamasaki/irma,quarkslab/irma,hirokihamasaki/irma,quarkslab/irma,quarkslab/irma |
010c87de588009371adbab8a234de78d9da4ebbd | fullcalendar/admin.py | fullcalendar/admin.py | from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from mezzanine.core.admin import StackedDynamicInlineAdmin, DisplayableAdmin
from fullcalendar.models import *
class EventCategoryAdmin(admin.ModelAdmin):
list_display = ('name',)
class OccurrenceInline(StackedDynamicInlineA... | from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from mezzanine.core.admin import StackedDynamicInlineAdmin, DisplayableAdmin
from fullcalendar.models import *
class EventCategoryAdmin(admin.ModelAdmin):
list_display = ('name',)
class OccurrenceInline(StackedDynamicInlineA... | Fix Django system check error for a editable field that is not displayed | Fix Django system check error for a editable field that is not displayed
This error,
"CommandError: System check identified some issues:
ERRORS:
<class 'fullcalendar.admin.EventAdmin'>: (admin.E122) The value of 'list_editable[0]' refers to 'status', which is not an attribute of 'events.Event'."
was given for Django >... | Python | mit | jonge-democraten/mezzanine-fullcalendar |
4a85ecaaae1452e74acc485d032f00e8bedace47 | cmsplugin_filer_link/cms_plugins.py | cmsplugin_filer_link/cms_plugins.py | from __future__ import unicode_literals
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
from django.conf import settings
from .models import FilerLinkPlugin
class FilerLinkPlugin(CMSPluginBase):
module = 'Filer'
model = File... | from __future__ import unicode_literals
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
from django.conf import settings
from .models import FilerLinkPlugin
class FilerLinkPlugin(CMSPluginBase):
module = 'Filer'
model = File... | Add "page_link" to "raw_id_fields" to prevent the run of "decompress" | Add "page_link" to "raw_id_fields" to prevent the run of "decompress"
Same issue as the already merged pull request for issue #106 however this applies to cmsfiler_link | Python | bsd-3-clause | stefanfoulis/cmsplugin-filer,creimers/cmsplugin-filer,wlanslovenija/cmsplugin-filer,jschneier/cmsplugin-filer,creimers/cmsplugin-filer,divio/cmsplugin-filer,yvess/cmsplugin-filer,brightinteractive/cmsplugin-filer,yvess/cmsplugin-filer,nephila/cmsplugin-filer,jschneier/cmsplugin-filer,stefanfoulis/cmsplugin-filer,sephii... |
c25b7820ccd52b943586af42d09ce53c3633ed96 | cmsplugin_simple_markdown/models.py | cmsplugin_simple_markdown/models.py | import threading
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models.pluginmodel import CMSPlugin
from cmsplugin_simple_markdown import utils
localdata = threading.local()
localdata.TEMPLATE_CHOICES = utils.autodiscover_templates()
TEMPLATE_CHOICES = localdata.TEMPLATE... | import threading
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models.pluginmodel import CMSPlugin
from cmsplugin_simple_markdown import utils
localdata = threading.local()
localdata.TEMPLATE_CHOICES = utils.autodiscover_templates()
TEMPLATE_CHOICES = localdata.TEMPLATE... | Add some tiny docstring to the unicode method | Add some tiny docstring to the unicode method
| Python | bsd-3-clause | Alir3z4/cmsplugin-simple-markdown,Alir3z4/cmsplugin-simple-markdown |
79ac1550b5acd407b2a107e694c66cccfbc0be89 | alerts/lib/deadman_alerttask.py | alerts/lib/deadman_alerttask.py | from alerttask import AlertTask
class DeadmanAlertTask(AlertTask):
def __init__(self):
self.deadman = True
def executeSearchEventsSimple(self):
# We override this method to specify the size as 1
# since we only care about if ANY events are found or not
return self.main_query.e... | from alerttask import AlertTask
class DeadmanAlertTask(AlertTask):
def executeSearchEventsSimple(self):
# We override this method to specify the size as 1
# since we only care about if ANY events are found or not
return self.main_query.execute(self.es, indices=self.event_indices, size=1)
| Remove deadman alerttask init method | Remove deadman alerttask init method
| Python | mpl-2.0 | jeffbryner/MozDef,gdestuynder/MozDef,mozilla/MozDef,mpurzynski/MozDef,mozilla/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,Phrozyn/MozDef,mozilla/MozDef,jeffbryner/MozDef,mozilla/MozDef... |
91ad56ea892d2f2fdb2af97f81ec70a7b9f9305c | analysis/sanity-check-velocity.py | analysis/sanity-check-velocity.py | #!/usr/bin/env python
import climate
import joblib
import lmj.cubes
import numpy as np
def _check(t):
t.load()
t.add_velocities(smooth=0)
vel = abs(t.df[t.marker_velocity_columns].values).flatten()
vel = vel[np.isfinite(vel)]
pct = np.percentile(vel, [1, 2, 5, 10, 20, 50, 80, 90, 95, 98, 99])
... | #!/usr/bin/env python
import climate
import joblib
import lmj.cubes
import numpy as np
def _check(t):
t.load()
t.add_velocities(smooth=0)
t.add_accelerations(smooth=0)
vel = abs(t.df[t.marker_velocity_columns].values).flatten()
vel = vel[np.isfinite(vel)]
pct = np.percentile(vel, [1, 2, 5, 10... | Use trial logging. Tweak numpy logging output. | Use trial logging. Tweak numpy logging output.
| Python | mit | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment |
0cccd467ac4c0bd8b8110fcfe47f81d73a238aa9 | plugins/uptime.py | plugins/uptime.py | import time
class Plugin:
def __init__(self, vk_bot):
self.vk_bot = vk_bot
self.vk_bot.add_command('uptime', self.uptime)
async def uptime(self, vk_api, sender, message):
await self.vk_bot.send_message(sender, 'Total uptime: {} seconds'.format(round(time.time() - self.vk_bot.start_tim... | import time
class Plugin:
def __init__(self, vk_bot):
self.vk_bot = vk_bot
self.vk_bot.add_command('uptime', self.uptime)
async def uptime(self, vk_api, sender, message):
await self.vk_bot.send_message(sender,
'Total uptime: {} seconds'.format(ro... | Fix code string length (PEP8) | Fix code string length (PEP8)
| Python | mit | roman901/vk_bot |
e26434ee69545b8c16b62ebd78e5bec0c95d579a | lib/rapidsms/webui/urls.py | lib/rapidsms/webui/urls.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import os
urlpatterns = []
# load the rapidsms configuration
from rapidsms.config import Config
conf = Config(os.environ["RAPIDSMS_INI"])
# iterate each of the active rapidsms apps (from the ini),
# and (attempt to) import the urls.py from each. it's okay
# if t... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import os, sys
urlpatterns = []
loaded = []
# load the rapidsms configuration
from rapidsms.config import Config
conf = Config(os.environ["RAPIDSMS_INI"])
# iterate each of the active rapidsms apps (from the ini),
# and (attempt to) import the urls.py from each. it... | Print a list of which URLs got loaded. This doesn't help that much when trying to debug errors that keep URLs from getting loaded. But it's a start. | Print a list of which URLs got loaded. This doesn't help that much when
trying to debug errors that keep URLs from getting loaded. But it's a
start.
| Python | bsd-3-clause | rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy |
48af7d169bac32898763af671f3a30170b85d2cd | tests/__main__.py | tests/__main__.py | import unittest
if __name__ == '__main__':
all_tests = unittest.TestLoader().discover('./', pattern='*_tests.py')
unittest.TextTestRunner().run(all_tests)
| import sys
import unittest
if __name__ == '__main__':
all_tests = unittest.TestLoader().discover('./', pattern='*_tests.py')
ret = unittest.TextTestRunner().run(all_tests)
sys.exit(not ret.wasSuccessful())
| Fix an issue when unit tests always return 0 status. | Fix an issue when unit tests always return 0 status.
| Python | mit | sergeymironov0001/twitch-chat-bot |
9dc35ebafb3e33c3736c8d58a8cb2353695ddedb | tests/settings.py | tests/settings.py | DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}}
SECRET_KEY = "secrekey"
INSTALLED_APPS = ["phonenumber_field", "tests"]
| DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}}
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
SECRET_KEY = "secrekey"
INSTALLED_APPS = ["phonenumber_field", "tests"]
| Set DEFAULT_AUTO_FIELD for the test project | Set DEFAULT_AUTO_FIELD for the test project
https://docs.djangoproject.com/en/dev/releases/3.2/#customizing-type-of-auto-created-primary-keys
Avoid warnings on Django master:
```
tests.TestModelPhoneNU: (models.W042) Auto-created primary key used when not defining a primary key type, by default
'django.db.models.Au... | Python | mit | stefanfoulis/django-phonenumber-field |
25478444e1ec5b4b1c9f811fea7fe0b401f14514 | lingcod/bookmarks/forms.py | lingcod/bookmarks/forms.py | from lingcod.features.forms import FeatureForm
from lingcod.bookmarks.models import Bookmark
from django import forms
class BookmarkForm(FeatureForm):
name = forms.CharField(label='Bookmark Name')
latitude = forms.FloatField(widget=forms.HiddenInput())
longitude = forms.FloatField(widget=forms.HiddenInput(... | from lingcod.features.forms import FeatureForm
from lingcod.bookmarks.models import Bookmark
from django import forms
class BookmarkForm(FeatureForm):
name = forms.CharField(label='Bookmark Name')
latitude = forms.FloatField(widget=forms.HiddenInput())
longitude = forms.FloatField(widget=forms.HiddenInput(... | Allow IP to be blank in form | Allow IP to be blank in form
| Python | bsd-3-clause | Alwnikrotikz/marinemap,google-code-export/marinemap,google-code-export/marinemap,Alwnikrotikz/marinemap,google-code-export/marinemap,google-code-export/marinemap,Alwnikrotikz/marinemap,Alwnikrotikz/marinemap |
9217bfc6bab0d152e33d9fda60218c404b61d064 | cmd2/__init__.py | cmd2/__init__.py | #
# -*- coding: utf-8 -*-
from .cmd2 import __version__, Cmd, CmdResult, Statement, categorize
from .cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args, with_category
| #
# -*- coding: utf-8 -*-
from .cmd2 import __version__, Cmd, CmdResult, Statement, EmptyStatement, categorize
from .cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args, with_category
| Add EmptyStatement exception to default imports | Add EmptyStatement exception to default imports
| Python | mit | python-cmd2/cmd2,python-cmd2/cmd2 |
e2126518957d0e3e360af3f80b1657bde9053b23 | capstone/game/players/alphabeta.py | capstone/game/players/alphabeta.py | import random
from ..player import Player
from ..utils import utility
class AlphaBeta(Player):
name = 'Alpha-Beta'
def __init__(self, eval_func=utility, max_depth=1000):
self._eval = eval_func
self._max_depth = max_depth
def __str__(self):
return self.name
def __repr__(self... | import random
import numpy as np
from ..player import Player
from ..utils import utility
class AlphaBeta(Player):
name = 'Alpha-Beta'
def __init__(self, eval_func=utility, max_depth=np.inf):
self._eval = eval_func
self._max_depth = max_depth
def __str__(self):
return self.name
... | Use np.inf for max/min limit values | Use np.inf for max/min limit values
| Python | mit | davidrobles/mlnd-capstone-code |
a17c2ce30f30d0441b1475457b0bc9d04da9f143 | coil/__init__.py | coil/__init__.py | """Coil: A Configuration Library."""
__version__ = "0.2.2"
| """Coil: A Configuration Library."""
__version__ = "0.3.0"
from coil.parser import Parser
def parse_file(file_name):
"""Open and parse a coil file.
Returns the root Struct.
"""
coil = open(file_name)
return Parser(coil, file_name).root()
def parse(string):
"""Parse a coil string.
Retur... | Add helpers for parsing files and strings | Add helpers for parsing files and strings
| Python | mit | tectronics/coil,marineam/coil,kovacsbalu/coil,kovacsbalu/coil,marineam/coil,tectronics/coil |
f664609d579e7b709945756def90092f0814998e | libpb/__init__.py | libpb/__init__.py | """FreeBSD port building infrastructure."""
from __future__ import absolute_import
from . import event
def stop(kill=False, kill_clean=False):
"""Stop building ports and cleanup."""
from os import killpg
from signal import SIGTERM, SIGKILL
from .builder import builders
from .env import cpus, flags
from .... | """FreeBSD port building infrastructure."""
from __future__ import absolute_import
from . import event
def stop(kill=False, kill_clean=False):
"""Stop building ports and cleanup."""
from os import kill, killpg
from signal import SIGTERM, SIGKILL
from .builder import builders
from .env import cpus, flags
... | Send SIGTERM and SIGKILL to child processes. | Send SIGTERM and SIGKILL to child processes.
With the removal of subprocess there was no way to known what were the
subprocesses, however after the introduction of Jobs tracking the PIDs
it is now possible. Use those PIDs.
| Python | bsd-2-clause | DragonSA/portbuilder,DragonSA/portbuilder |
605339144c61c4860f1dc7dec5fc5a0ff959600f | company/forms.py | company/forms.py | from django import forms
from . import models
from pola.forms import (CommitDescriptionMixin,
FormHorizontalMixin, SaveButtonMixin,
ReadOnlyFieldsMixin)
class CompanyForm(ReadOnlyFieldsMixin, SaveButtonMixin, FormHorizontalMixin,
CommitDescriptionMixi... | from django import forms
from . import models
from pola.forms import (CommitDescriptionMixin,
FormHorizontalMixin, SaveButtonMixin,
ReadOnlyFieldsMixin)
class CompanyForm(ReadOnlyFieldsMixin, SaveButtonMixin, FormHorizontalMixin,
CommitDescriptionMixi... | Add 'common_name' to company's form | Add 'common_name' to company's form
| Python | bsd-3-clause | KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend |
559fa4bf1982de6dd4a8943939b535972731bd08 | comrade/core/context_processors.py | comrade/core/context_processors.py | from django.conf import settings
from django.contrib.sites.models import Site
from settings import DeploymentType
def default(request):
context = {}
context['DEPLOYMENT'] = settings.DEPLOYMENT
context['site'] = Site.objects.get_current()
if settings.DEPLOYMENT != DeploymentType.PRODUCTION:
cont... | from django.conf import settings
from django.contrib.sites.models import Site
from settings import DeploymentType
def default(request):
context = {}
context['DEPLOYMENT'] = settings.DEPLOYMENT
context['current_site'] = Site.objects.get_current()
if settings.DEPLOYMENT != DeploymentType.PRODUCTION:
... | Add full base URL for site to default context. | Add full base URL for site to default context.
| Python | mit | bueda/django-comrade |
1b97aa2dae43a8988802ca532a3200f444f85db3 | markups/common.py | markups/common.py | # This file is part of python-markups module
# License: BSD
# Copyright: (C) Dmitry Shachnev, 2012
import os.path
# Some common constants and functions
(LANGUAGE_HOME_PAGE, MODULE_HOME_PAGE, SYNTAX_DOCUMENTATION) = range(3)
CONFIGURATION_DIR = (os.environ.get('XDG_CONFIG_HOME') or
os.path.expanduser('~/.config'))
MA... | # This file is part of python-markups module
# License: BSD
# Copyright: (C) Dmitry Shachnev, 2012
import os.path
# Some common constants and functions
(LANGUAGE_HOME_PAGE, MODULE_HOME_PAGE, SYNTAX_DOCUMENTATION) = range(3)
CONFIGURATION_DIR = (os.environ.get('XDG_CONFIG_HOME') or
os.path.expanduser('~/.config'))
MA... | Add initial support for pygments styles | Add initial support for pygments styles
| Python | bsd-3-clause | retext-project/pymarkups,mitya57/pymarkups |
05cb698d45ce4e33e2f4bfdc38f9633083a284a7 | test_project/project_specific/generic_channel_example.py | test_project/project_specific/generic_channel_example.py | import autocomplete_light
from models import Contact, Address
class MyGenericChannel(autocomplete_light.GenericChannelBase):
def get_querysets(self):
return {
Contact: Contact.objects.all(),
Address: Address.objects.all(),
}
def order_results(self, results):
if... | import autocomplete_light
from models import Contact, Address
class MyGenericChannel(autocomplete_light.GenericChannelBase):
def get_querysets(self):
return {
Contact: Contact.objects.all(),
Address: Address.objects.all(),
}
def order_results(self, results):
if... | Implement query_filter for MyGenericChannel, because it should search by something other than search_name in the case of Address | Implement query_filter for MyGenericChannel, because it should search by something other than search_name in the case of Address
| Python | mit | Eraldo/django-autocomplete-light,spookylukey/django-autocomplete-light,Perkville/django-autocomplete-light,jonashaag/django-autocomplete-light,yourlabs/django-autocomplete-light,shubhamdipt/django-autocomplete-light,Perkville/django-autocomplete-light,Visgean/django-autocomplete-light,dsanders11/django-autocomplete-lig... |
d8c75104acb68ca648c5a3b30d6791775272e5c1 | authentic2/idp/idp_openid/admin.py | authentic2/idp/idp_openid/admin.py | # -*- coding: utf-8 -*-
# vim: set ts=4 sw=4 : */
from django.contrib import admin
from models import TrustedRoot, Association, Nonce
admin.site.register(TrustedRoot)
admin.site.register(Association)
admin.site.register(Nonce)
| # -*- coding: utf-8 -*-
from django.contrib import admin
from models import TrustedRoot, Association, Nonce
admin.site.register(TrustedRoot)
admin.site.register(Association)
admin.site.register(Nonce)
| Remove vim instruction in prologue. | [idp/idp_openid] Remove vim instruction in prologue.
| Python | agpl-3.0 | incuna/authentic,incuna/authentic,adieu/authentic2,incuna/authentic,adieu/authentic2,BryceLohr/authentic,BryceLohr/authentic,incuna/authentic,BryceLohr/authentic,pu239ppy/authentic2,BryceLohr/authentic,pu239ppy/authentic2,pu239ppy/authentic2,adieu/authentic2,adieu/authentic2,incuna/authentic,pu239ppy/authentic2 |
0ad7be235135303cb9d902df2a89b17da8aac918 | syntacticframes_project/syntacticframes/migrations/0012_auto_20150220_1836.py | syntacticframes_project/syntacticframes/migrations/0012_auto_20150220_1836.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from distutils.version import LooseVersion
from django.db import models, migrations
def set_position_value_for_levin_classes(apps, schema_editor):
i = 0
LevinClass = apps.get_model('syntacticframes', 'LevinClass')
levin_class_list = sorted(L... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from distutils.version import LooseVersion
from django.db import models, migrations
def set_position_value_for_levin_classes(apps, schema_editor):
i = 0
LevinClass = apps.get_model('syntacticframes', 'LevinClass')
levin_class_list = sorted(L... | Make the 0012 migration reversible | Make the 0012 migration reversible
| Python | mit | aymara/verbenet-editor,aymara/verbenet-editor,aymara/verbenet-editor |
f6dd7d0ca966856325adc50f4c5ca2cc48dda0a5 | cogbot/cog_bot_server_state.py | cogbot/cog_bot_server_state.py | import json
import logging
import typing
from datetime import datetime
import discord
from cogbot.types import ServerId, ChannelId
log = logging.getLogger(__name__)
class CogBotServerState:
def __init__(self, bot, server: discord.Server, log_channel: ChannelId = None):
self.bot = bot
self.serv... | import json
import logging
import typing
from datetime import datetime
import discord
from cogbot.types import ServerId, ChannelId
log = logging.getLogger(__name__)
class CogBotServerState:
def __init__(self, bot, server: discord.Server, log_channel: ChannelId = None):
self.bot = bot
self.serv... | Fix mod log optional channel | Fix mod log optional channel
| Python | mit | Arcensoth/cogbot |
67c671260858cc2c3d3041188cebda63cac1c4eb | prequ/__init__.py | prequ/__init__.py | import pkg_resources
try:
__version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound:
__version__ = None
| import pkg_resources
try:
__version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound: # pragma: no cover
__version__ = None
| Add "no cover" pragma to version setting code | Add "no cover" pragma to version setting code
| Python | bsd-2-clause | suutari-ai/prequ,suutari/prequ,suutari/prequ |
6171b8111359cc54a4af2c3444ce0e0e2db5ba80 | froide/helper/context_processors.py | froide/helper/context_processors.py | from django.conf import settings
def froide(request):
return {"froide": settings.FROIDE_CONFIG}
def site_settings(request):
return {"SITE_NAME": settings.SITE_NAME,
"SITE_URL": settings.SITE_URL,
"FROIDE_DRYRUN": settings.FROIDE_DRYRUN,
"FROIDE_DRYRUN_DOMAIN": settings.FROI... | from django.conf import settings
def froide(request):
return {"froide": settings.FROIDE_CONFIG}
def site_settings(request):
return {"SITE_NAME": settings.SITE_NAME,
"SITE_URL": settings.SITE_URL,
"FROIDE_DRYRUN": settings.FROIDE_DRYRUN,
"FROIDE_DRYRUN_DOMAIN": settings.FROI... | Add Froide Dry Run Domain and Language Code to context_processor | Add Froide Dry Run Domain and Language Code to context_processor | Python | mit | okfse/froide,ryankanno/froide,fin/froide,LilithWittmann/froide,okfse/froide,fin/froide,ryankanno/froide,LilithWittmann/froide,catcosmo/froide,CodeforHawaii/froide,CodeforHawaii/froide,stefanw/froide,catcosmo/froide,ryankanno/froide,catcosmo/froide,catcosmo/froide,okfse/froide,fin/froide,ryankanno/froide,stefanw/froide,... |
50451c69d337228c2016851258ff7249bf906440 | profiling/plot.py | profiling/plot.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import re
import numpy as np
import matplotlib.pyplot as plt
csv_files = glob.glob('*.csv')
fig = plt.figure()
ax = fig.add_subplot(111)
colors = iter(plt.cm.rainbow(np.linspace(0,1,len(csv_files))))
p = re.compile(r'profiling_(.*?)_(.*?)\.csv')
ms_to_s ... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import re
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
if len(sys.argv) == 1:
print('Usage: plot.py path/to/build/profiling')
sys.exit(0)
csv_files = glob.glob(os.path.join(sys.argv[1], '*.csv'))
fig = plt.figure()
ax = ... | Use path given as argument | Use path given as argument
| Python | bsd-3-clause | nbigaouette/sorting,nbigaouette/sorting,nbigaouette/sorting,nbigaouette/sorting |
d8ce56feada64d287306d7f439ec12a42acda0d6 | bot.py | bot.py | #!/usr/bin/env python3
# -*- coding: utf8 -*-
import tweepy
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
userid = str(input("Please input ... | #!/usr/bin/env python3
# -*- coding: utf8 -*-
import tweepy
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
def getdata():
userid = str(i... | Make it more complex ((( | Make it more complex (((
| Python | mit | zhangyubaka/tweepy_favbot |
f511af4fc89a170914a86de1704e8e842ffd6b6d | test/test_configuration.py | test/test_configuration.py | #!/usr/bin/env python
"""Test coordinate classes."""
import sys
try:
import unittest2 as unittest # Python 2.6
except ImportError:
import unittest
import heatmap as hm
class Tests(unittest.TestCase):
# To remove Python 3's
# "DeprecationWarning: Please use assertRaisesRegex instead"
if sys.ve... | #!/usr/bin/env python
"""Test coordinate classes."""
import sys
try:
import unittest2 as unittest # Python 2.6
except ImportError:
import unittest
ROOT_DIR = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0]
sys.path.append(ROOT_DIR)
import heatmap as hm
class Tests(unittest.TestCase):
# T... | Update sys.path to import heatmap | Update sys.path to import heatmap
| Python | agpl-3.0 | hugovk/heatmap,hugovk/heatmap,sethoscope/heatmap,sethoscope/heatmap |
a24faf712d8dfba0f6ac9fc295807552dca37ae9 | custom/inddex/reports/utils.py | custom/inddex/reports/utils.py | from corehq.apps.reports.datatables import DataTablesColumn, DataTablesHeader
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.standard import CustomProjectReport, DatespanMixin
class MultiTabularReport(DatespanMixin, CustomProjectReport, GenericTabularReport):
report_template... | from itertools import chain
from corehq.apps.reports.datatables import DataTablesColumn, DataTablesHeader
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.standard import CustomProjectReport, DatespanMixin
class MultiTabularReport(DatespanMixin, CustomProjectReport, GenericTabula... | Move export to a background process | Move export to a background process
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq |
46c33ca68c1124fb06c4ba62306cb00ba61d7e5c | tests/__init__.py | tests/__init__.py | from flexmock import flexmock
from flask.ext.storage import MockStorage
from flask_uploads import init
class TestCase(object):
added_objects = []
committed_objects = []
created_objects = []
deleted_objects = []
def setup_method(self, method, resizer=None):
init(db_mock, MockStorage, resiz... | from flexmock import flexmock
from flask.ext.storage import MockStorage
from flask_uploads import init
class TestCase(object):
added_objects = []
committed_objects = []
created_objects = []
deleted_objects = []
def setup_method(self, method, resizer=None):
init(db_mock, MockStorage, resiz... | Add metadata.tables to mock db. | Add metadata.tables to mock db.
| Python | mit | FelixLoether/flask-uploads,FelixLoether/flask-image-upload-thing |
24b78a4d510606563106da24d568d5fb79ddca2b | IPython/__main__.py | IPython/__main__.py | # encoding: utf-8
"""Terminal-based IPython entry point.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012, IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with th... | # encoding: utf-8
"""Terminal-based IPython entry point.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012, IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with th... | Use new entry point for python -m IPython | Use new entry point for python -m IPython
| Python | bsd-3-clause | ipython/ipython,ipython/ipython |
8c8b668ba3684c3e756bf9fccafbd1bd8e1a7cfe | mediapipe/__init__.py | mediapipe/__init__.py | """Copyright 2019 - 2020 The MediaPipe Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | # Copyright 2019 - 2022 The MediaPipe Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Fix comment for `mediapipe` license. | Fix comment for `mediapipe` license.
The `"""` comment indicates a public docstring for the module, and will end up in the generated docs. By using a "private" comment (`#`) we will not document the license as part of the API.
The Apache license is noted in the footer of generated docs, and this is sufficient.
Piper... | Python | apache-2.0 | google/mediapipe,google/mediapipe,google/mediapipe,google/mediapipe,google/mediapipe,google/mediapipe,google/mediapipe,google/mediapipe |
189847ffdca0264ddd6248faa9974ba35eaea373 | tests/test_aur.py | tests/test_aur.py | # MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
from flaky import flaky
import pytest
pytestmark = pytest.mark.asyncio
@flaky(max_runs=5)
async def test_aur(get_version):
assert await get_version("asciidoc-fake", {"aur": None}) == "1.0-1"
@flaky(max_runs=5)
async def test_aur_strip... | # MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
from flaky import flaky
import pytest
pytestmark = pytest.mark.asyncio
@flaky
async def test_aur(get_version):
assert await get_version("asciidoc-fake", {"aur": None}) == "1.0-1"
@flaky
async def test_aur_strip_release(get_version):
... | Revert "make AUR tests more flaky" | Revert "make AUR tests more flaky"
This reverts commit 61df628bd8bc97acbed40a4af67b124c47584f5f.
It doesn't help :-(
| Python | mit | lilydjwg/nvchecker |
6d22cc47174139b56fad7d94696b08d9830a7ea4 | lettuce_webdriver/tests/__init__.py | lettuce_webdriver/tests/__init__.py | from __future__ import print_function
import os
from contextlib import contextmanager
from selenium import webdriver
from aloe import around, world
here = os.path.dirname(__file__)
html_pages = os.path.join(here, 'html_pages')
@around.each_feature
@contextmanager
def with_browser(feature):
world.browser = web... | from __future__ import print_function
import os
from contextlib import contextmanager
from selenium import webdriver
from aloe import around, world
here = os.path.dirname(__file__)
html_pages = os.path.join(here, 'html_pages')
@around.each_feature
@contextmanager
def with_browser(feature):
world.browser = web... | Print scenario/step names on failure | Print scenario/step names on failure
| Python | mit | koterpillar/aloe_webdriver,infoxchange/aloe_webdriver,infoxchange/aloe_webdriver,aloetesting/aloe_webdriver,aloetesting/aloe_webdriver,aloetesting/aloe_webdriver,koterpillar/aloe_webdriver |
73c1900a05fa3e4f68224f4e0d5dce2c08687254 | opwen_email_server/backend/email_sender.py | opwen_email_server/backend/email_sender.py | from typing import Tuple
from opwen_email_server import azure_constants as constants
from opwen_email_server import config
from opwen_email_server.services.queue import AzureQueue
from opwen_email_server.services.sendgrid import SendgridEmailSender
QUEUE = AzureQueue(account=config.QUEUES_ACCOUNT, key=config.QUEUES_K... | from typing import Tuple
from opwen_email_server import azure_constants as constants
from opwen_email_server import config
from opwen_email_server.services.queue import AzureQueue
from opwen_email_server.services.sendgrid import SendgridEmailSender
QUEUE = AzureQueue(account=config.QUEUES_ACCOUNT, key=config.QUEUES_K... | Add attachment support to email sender CLI | Add attachment support to email sender CLI
| Python | apache-2.0 | ascoderu/opwen-cloudserver,ascoderu/opwen-cloudserver |
dcb1fc943ec4fe39bd752b1015ba11f6d8145c27 | modules/status.py | modules/status.py | import discord
from modules.botModule import BotModule
from modules.help import *
import time
import datetime
class Status(BotModule):
name = 'status'
description = 'Allow for the assignment and removal of roles.'
help_text = 'Usage: `!status` shows information about this instance of scubot.'... | import discord
from modules.botModule import BotModule
from modules.help import *
import time
import datetime
class Status(BotModule):
name = 'status'
description = 'Allow for the assignment and removal of roles.'
help_text = 'Usage: `!status` shows information about this instance of scubot.'... | Fix uptime and uptime timing | Fix uptime and uptime timing
| Python | mit | suclearnub/scubot |
a9e80e81fe2e6ad1325047cb3045ab12640f984f | cla_backend/apps/cla_eventlog/management/commands/find_and_delete_old_cases.py | cla_backend/apps/cla_eventlog/management/commands/find_and_delete_old_cases.py | from django.core.management.base import BaseCommand
from dateutil.relativedelta import relativedelta
from legalaid.models import Case
from cla_butler.tasks import DeleteOldData
class FindAndDeleteCasesUsingCreationTime(DeleteOldData):
def get_eligible_cases(self):
self._setup()
two_years = self.n... | from django.core.management.base import BaseCommand
from dateutil.relativedelta import relativedelta
from legalaid.models import Case
from cla_butler.tasks import DeleteOldData
class FindAndDeleteCasesUsingCreationTime(DeleteOldData):
def get_eligible_cases(self):
self._setup()
two_years = self.n... | Refactor code so we can use command in tests | Refactor code so we can use command in tests | Python | mit | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend |
01cd080395533b9e8d53f4c203ef6be185d97ebc | dbaas/integrations/iaas/manager.py | dbaas/integrations/iaas/manager.py | from dbaas_cloudstack.provider import CloudStackProvider
from pre_provisioned.pre_provisioned_provider import PreProvisionedProvider
import logging
LOG = logging.getLogger(__name__)
class IaaSManager():
@classmethod
def destroy_instance(cls, database, *args, **kwargs):
plan = database.plan
... | from dbaas_cloudstack.provider import CloudStackProvider
from pre_provisioned.pre_provisioned_provider import PreProvisionedProvider
from integrations.monitoring.manager import MonitoringManager
import logging
LOG = logging.getLogger(__name__)
class IaaSManager():
@classmethod
def destroy_instance(cls, ... | Add call to monitoring app | Add call to monitoring app
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service |
2313424f811c59563090e77966d906dd3eb7f127 | tools/buildbot.py | tools/buildbot.py | import os
import sys
def usage():
print '%s all -- build all bsp' % os.path.basename(sys.argv[0])
print '%s clean -- clean all bsp' % os.path.basename(sys.argv[0])
print '%s project -- update all prject files' % os.path.basename(sys.argv[0])
BSP_ROOT = '../bsp'
if len(sys.argv) != 2:
usage()
sys.e... | import os
import sys
def usage():
print '%s all -- build all bsp' % os.path.basename(sys.argv[0])
print '%s clean -- clean all bsp' % os.path.basename(sys.argv[0])
print '%s project -- update all prject files' % os.path.basename(sys.argv[0])
BSP_ROOT = '../bsp'
if len(sys.argv) != 2:
usage()
sys.e... | Add better way to generate MDK project file. | [tools] Add better way to generate MDK project file.
| Python | apache-2.0 | RT-Thread/rt-thread,FlyLu/rt-thread,weiyuliang/rt-thread,ArdaFu/rt-thread,weiyuliang/rt-thread,geniusgogo/rt-thread,weety/rt-thread,igou/rt-thread,weiyuliang/rt-thread,hezlog/rt-thread,armink/rt-thread,wolfgangz2013/rt-thread,armink/rt-thread,ArdaFu/rt-thread,hezlog/rt-thread,AubrCool/rt-thread,geniusgogo/rt-thread,yon... |
155822548be11161aefdb0d93d5ec86095ab3624 | rt.py | rt.py | import queue
import threading
def loop(queue, actor):
while True:
message = queue.get()
actor.behavior(message)
class Actor(object):
def __init__(self):
pass
def _start_loop(self):
self.queue = queue.Queue()
self.dispatcher = threading.Thread(
... | import queue
import threading
def indiviual_loop(queue, actor):
while True:
message = queue.get()
actor.behavior(message)
def global_loop(queue):
while True:
actor, message = queue.get()
actor.behavior(message)
class EventLoop(object):
loop = None
def __init__... | Refactor to allow different event loops | Refactor to allow different event loops | Python | mit | waltermoreira/tartpy |
db43b3b3079842fb2baf6d181ef39374acf0053c | .gitlab/linters/check-makefiles.py | .gitlab/linters/check-makefiles.py | #!/usr/bin/env python3
"""
Warn for use of `--interactive` inside Makefiles (#11468).
Encourage the use of `$(TEST_HC_OPTS_INTERACTIVE)` instead of
`$(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0`. It's too easy to
forget one of those flags when adding a new test.
"""
from linter import run_linters, RegexpLinter... | #!/usr/bin/env python3
"""
Linters for testsuite makefiles
"""
from linter import run_linters, RegexpLinter
"""
Warn for use of `--interactive` inside Makefiles (#11468).
Encourage the use of `$(TEST_HC_OPTS_INTERACTIVE)` instead of
`$(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0`. It's too easy to
forget one o... | Add linter to catch unquoted use of $(TEST_HC) | linters: Add linter to catch unquoted use of $(TEST_HC)
This is a common bug that creeps into Makefiles (e.g. see T12674).
| Python | bsd-3-clause | sdiehl/ghc,sdiehl/ghc,sdiehl/ghc,sdiehl/ghc,sdiehl/ghc,sdiehl/ghc,sdiehl/ghc |
dc1a7bc4d674fd6e7235222612f1d147112d77db | src/nodeconductor_assembly_waldur/packages/migrations/0002_openstack_packages.py | src/nodeconductor_assembly_waldur/packages/migrations/0002_openstack_packages.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import nodeconductor.core.fields
class Migration(migrations.Migration):
dependencies = [
('openstack', '0022_volume_device'),
('structure', '0037_remove_customer_billing_backend_id'),
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import nodeconductor.core.fields
class Migration(migrations.Migration):
dependencies = [
('openstack', '0022_volume_device'),
('structure', '0037_remove_customer_billing_backend_id'),
... | Remove useless default from migration | Remove useless default from migration
- wal-26
| Python | mit | opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind |
3dbc981e62c2d153913557b62083f60888fa7e83 | ynr/apps/ynr_refactoring/management/commands/ynr_refactoring_remove_legacy_IDs.py | ynr/apps/ynr_refactoring/management/commands/ynr_refactoring_remove_legacy_IDs.py | import json
from django.core.management.base import BaseCommand
from django.db import transaction
from people.models import Person
from candidates.views.version_data import get_change_metadata
from popolo.models import Identifier
class Command(BaseCommand):
def handle(self, *args, **options):
schemes =... | import json
from django.core.management.base import BaseCommand
from django.db import transaction
from people.models import Person
from candidates.views.version_data import get_change_metadata
from popolo.models import Identifier
class Command(BaseCommand):
def handle(self, *args, **options):
schemes =... | Remove IDs for all candidates, not just Zac | Remove IDs for all candidates, not just Zac
| Python | agpl-3.0 | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative |
e5f4dc01e94694bf9bfcae3ecd6eca34a33a24eb | openquake/__init__.py | openquake/__init__.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2010-2016 GEM Foundation
#
# OpenQuake 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 3 of the Licen... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2010-2016 GEM Foundation
#
# OpenQuake 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 3 of the Licen... | Make the openquake namespace compatible with old setuptools | Make the openquake namespace compatible with old setuptools
| Python | agpl-3.0 | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine |
5a69162e82c2c6031587448b975f5867c94873ed | pyramid_es/dotdict.py | pyramid_es/dotdict.py | class DotDict(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def __init__(self, d={}):
for key, value in d.items():
if hasattr(value, 'keys'):
value = DotDict(value)
if isinstance(value, list):
... | class DotDict(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def __init__(self, d={}):
for key, value in d.items():
if hasattr(value, 'keys'):
value = DotDict(value)
if isinstance(value, list):
... | Make DotDict repr() use class name so that it doesn't print misleading results if subclassed | Make DotDict repr() use class name so that it doesn't print misleading results if subclassed
| Python | mit | storborg/pyramid_es |
9a240f0efab9be036fe39f9b2b63cc399e5f8134 | registration/admin.py | registration/admin.py | from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfile, RegistrationAdmin)
| from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
raw_id_fields = ['user']
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfil... | Use raw_id_fields for the relation from RegistrationProfile to User, for sites which have huge numbers of users. | Use raw_id_fields for the relation from RegistrationProfile to User, for sites which have huge numbers of users.
| Python | bsd-3-clause | dinie/django-registration,Avenza/django-registration,FundedByMe/django-registration,dinie/django-registration,FundedByMe/django-registration |
f4500e6422f1c6af8e9ce7d2d79d81e7479f0b7f | Instanssi/admin_programme/forms.py | Instanssi/admin_programme/forms.py | # -*- coding: utf-8 -*-
from django import forms
from uni_form.helper import FormHelper
from uni_form.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.ext_programme.models import ProgrammeEvent
class ProgrammeEventForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(Program... | # -*- coding: utf-8 -*-
from django import forms
from uni_form.helper import FormHelper
from uni_form.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.ext_programme.models import ProgrammeEvent
class ProgrammeEventForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(Program... | Fix form to reflect model change | admin_programme: Fix form to reflect model change
| Python | mit | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org |
71cffcb8a8ec7e36dc389a5aa6dc2cc9769a9e97 | distutils/tests/test_ccompiler.py | distutils/tests/test_ccompiler.py | import os
import sys
import platform
import textwrap
import sysconfig
import pytest
from distutils import ccompiler
def _make_strs(paths):
"""
Convert paths to strings for legacy compatibility.
"""
if sys.version_info > (3, 8) and platform.system() != "Windows":
return paths
return list(... | import os
import sys
import platform
import textwrap
import sysconfig
import pytest
from distutils import ccompiler
def _make_strs(paths):
"""
Convert paths to strings for legacy compatibility.
"""
if sys.version_info > (3, 8) and platform.system() != "Windows":
return paths
return list(... | Extend the test to compile a second time after setting include dirs again. | Extend the test to compile a second time after setting include dirs again.
| Python | mit | pypa/setuptools,pypa/setuptools,pypa/setuptools |
08489ea2c1596a067b482878ff4450db43c08612 | conf.py | conf.py | # -*- coding: utf-8 -*-
#
# on_rtd is whether we are on readthedocs.org
import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme... | # -*- coding: utf-8 -*-
#
# on_rtd is whether we are on readthedocs.org
import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme... | Add custom CSS style to FIWARE doc | Add custom CSS style to FIWARE doc
Change-Id: I74293d488e0cd762ad023b94879ee618a4016110
| Python | apache-2.0 | Kurento/doc-kurento,SanMi86/doc-kurento,SanMi86/doc-kurento,SanMi86/doc-kurento,Kurento/doc-kurento,Kurento/doc-kurento,SanMi86/doc-kurento |
0fbc02b40f4414d96686d879aa9f7611e8fbb85d | singlet/config.py | singlet/config.py | # vim: fdm=indent
# author: Fabio Zanini
# date: 02/08/17
# content: Support module for filenames related to the Google Sheet APIs.
# Modules
import os
import yaml
# Globals
config_filename = os.getenv(
'SINGLET_CONFIG_FILENAME',
os.getenv('HOME') + '/.singlet/config.yml')
with open(confi... | # vim: fdm=indent
# author: Fabio Zanini
# date: 02/08/17
# content: Support module for filenames related to the Google Sheet APIs.
# Modules
import os
import yaml
# Globals
config_filename = os.getenv(
'SINGLET_CONFIG_FILENAME',
os.getenv('HOME') + '/.singlet/config.yml')
with open(confi... | Remove function to reset _once_warnings (messy) | Remove function to reset _once_warnings (messy)
| Python | mit | iosonofabio/singlet,iosonofabio/singlet |
ed7d0c5f8b64185f9fc612b44e4182b12a0fa62e | yunity/users/factories.py | yunity/users/factories.py | from django.contrib.auth import get_user_model
from factory import DjangoModelFactory, CREATE_STRATEGY, LazyAttribute, PostGeneration, SubFactory
from yunity.walls.factories import Wall
from yunity.utils.tests.fake import faker
class User(DjangoModelFactory):
class Meta:
model = get_user_model()
... | from django.contrib.auth import get_user_model
from factory import DjangoModelFactory, CREATE_STRATEGY, LazyAttribute, PostGeneration, SubFactory
from yunity.walls.factories import Wall
from yunity.utils.tests.fake import faker
class User(DjangoModelFactory):
class Meta:
model = get_user_model()
... | Comment about display_name == password | Comment about display_name == password
| Python | agpl-3.0 | yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend |
aed9b3066f9d796e5c89e38d833c87e130a421c3 | auth0/v2/blacklists.py | auth0/v2/blacklists.py | from .rest import RestClient
class Blacklists(object):
def __init__(self, domain, jwt_token):
url = 'https://%s/api/v2/blacklists/tokens' % domain
self.client = RestClient(endpoint=url, jwt=jwt_token)
def get(self, aud=None):
params = {
'aud': aud
}
retur... | from .rest import RestClient
class Blacklists(object):
def __init__(self, domain, jwt_token):
self.url = 'https://%s/api/v2/blacklists/tokens' % domain
self.client = RestClient(jwt=jwt_token)
def get(self, aud=None):
params = {
'aud': aud
}
return self.cli... | Fix Blacklists usage of RestClient | Fix Blacklists usage of RestClient
| Python | mit | auth0/auth0-python,auth0/auth0-python |
e49163ceecc5da949fe01281a87b56be513784d5 | abbr/languages/pt_br/dictionary.py | abbr/languages/pt_br/dictionary.py | # Copyright 2016 Adler Brediks Medrado
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # Copyright 2016 Adler Brediks Medrado
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Add new words to wordlist | Add new words to wordlist
| Python | apache-2.0 | adlermedrado/abbr |
92e5ff34737feef0d196e25b97dbc817b502a59d | demo.py | demo.py | from FbFeed import NewsFeed
username = raw_input('Enter your email id registered with facebook : ')
password = raw_input('Enter your Password : ')
print('Creating new session on Firefox..')
fb = NewsFeed(username,password)
print('Logging into your facebook account')
fb.login()
#Add people to group
print('Add people ... | from FbFeed import NewsFeed
import getpass
username = raw_input('Enter your email id registered with facebook : ')
password = getpass.getpass(prompt='Enter your Password : ',stream=None)
print('Creating new session on Firefox..')
fb = NewsFeed(username,password)
print('Logging into your facebook account')
fb.login()
... | Hide password in terminal input | Hide password in terminal input
| Python | mit | ashishpahwa7/Fb-Feedirator |
deeaed14e40b9deca39c46ec7879f775606898c0 | Instanssi/dblog/handlers.py | Instanssi/dblog/handlers.py | # -*- coding: utf-8 -*-
from logging import Handler
from datetime import datetime
class DBLogHandler(Handler, object):
def __init__(self):
super(DBLogHandler, self).__init__()
def emit(self, record):
from models import DBLogEntry as _LogEntry
entry = _LogEntry()
... | # -*- coding: utf-8 -*-
from logging import Handler
from datetime import datetime
class DBLogHandler(Handler, object):
def __init__(self):
super(DBLogHandler, self).__init__()
def emit(self, record):
from models import DBLogEntry as _LogEntry
entry = _LogEntry()
... | Handle optional field saving with exceptions, save module name. | dblog: Handle optional field saving with exceptions, save module name.
| Python | mit | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org |
407a032acb307e5f936437aec4975ef69133d0c5 | DisplayAdapter/testing/test_display_adapter/test_display_driver/test_display_drivers.py | DisplayAdapter/testing/test_display_adapter/test_display_driver/test_display_drivers.py | """
This module contains the testing framework for the display driver functionality, and is responsible for testing whether
the pi can correctly and sufficiently connect to the display.
"""
from mock import patch
from display_adapter.display_driver.display_drivers import DisplayDriver
class TestDisplayDriver(object):... | """
This module contains the testing framework for the display driver functionality, and is responsible for testing whether
the pi can correctly and sufficiently connect to the display.
"""
from mock import patch
from datetime import datetime
from display_adapter.display_driver.display_drivers import minutify, Display... | Test functionality has been added. Paired by Richard and Michael. | Test functionality has been added. Paired by Richard and Michael.
The functionality for the minutify function has now been tested; and the tests work (Support 231)
| Python | mit | CO600GOL/Game_of_life,CO600GOL/Game_of_life,CO600GOL/Game_of_life |
61d7c9e99398874745d11720cd8d985bdc3d7514 | demoapp/views.py | demoapp/views.py | from demoapp.forms import DemoLoginForm
from django.shortcuts import render_to_response
from django.shortcuts import redirect
from demoapp import app_settings
from demoapp.utils import get_salt
def login_view(request):
if request.method == 'POST':
form = DemoLoginForm(request.POST)
if form.is_vali... | from demoapp.forms import DemoLoginForm
from django.shortcuts import render
from django.shortcuts import redirect
from demoapp import app_settings
from demoapp.utils import get_salt
def login_view(request):
if request.method == 'POST':
form = DemoLoginForm(request.POST)
if form.is_valid():
... | Add context to login view | Add context to login view
| Python | unlicense | dboczek/django-demo,dboczek/django-demo |
fc3408e0d8336ca2324b272dbb4aa0e69914a27c | build_chrome_webapp.py | build_chrome_webapp.py | import os.path
from shutil import copyfile
try:
from jinja2 import Template
except:
print "Could not import Jinja2, run 'easy_install Jinja2'"
exit()
output_dir = os.path.join('./', 'chrome_webstore')
if not os.path.exists(output_dir):
os.makedirs(output_dir)
def add_background_script():
copyfile... | import os.path
from shutil import copyfile
from shutil import copytree
from shutil import rmtree
try:
from jinja2 import Template
except:
print "Could not import Jinja2, run 'easy_install Jinja2'"
exit()
output_dir = os.path.join('./', 'chrome_webstore')
if os.path.exists(output_dir):
rmtree(output_di... | Copy static dirs as well | Copy static dirs as well
| Python | mit | youtify/youtify,youtify/youtify,youtify/youtify |
df1617a7518f66d87470f948e057e4d7d7d8f026 | driller/tasks.py | driller/tasks.py | import redis
from celery import Celery
from .driller import Driller
app = Celery('tasks', broker='amqp://guest@localhost//', backend='redis://localhost')
redis_pool = redis.ConnectionPool(host='localhost', port=6379, db=1)
@app.task
def drill(binary, input, fuzz_bitmap, qemu_dir):
redis_inst = redis.Redis(connec... | import redis
from celery import Celery
from .driller import Driller
import config
backend_url = "redis://%s:%d" % (config.REDIS_HOST, config.REDIS_PORT)
app = Celery('tasks', broker=config.BROKER_URL, backend=backend_url)
redis_pool = redis.ConnectionPool(host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.REDI... | Connect to Celery using config options | Connect to Celery using config options
| Python | bsd-2-clause | shellphish/driller |
a85d148eb00f83052a97d66da8ff9dd79b40f172 | .ycm_extra_conf.py | .ycm_extra_conf.py | import os
def FlagsForFile(filename, **kwargs):
flags = ['-std=c++14', '-I/usr/local/include']
proj_root = os.path.dirname(os.path.abspath(__file__))
libcanon_include = ''.join(['-I', proj_root, '/deps/libcanon/include'])
proj_include = ''.join(['-I', proj_root, '/drudge'])
flags.extend([libcanon... | import os
import subprocess
def FlagsForFile(filename, **kwargs):
flags = ['-std=c++14', '-I/usr/local/include']
proj_root = os.path.dirname(os.path.abspath(__file__))
libcanon_include = ''.join(['-I', proj_root, '/deps/libcanon/include'])
python_include = subprocess.run(
["pkg-config", '--cf... | Add Python inclusion path to YCM config | Add Python inclusion path to YCM config
In the script, the path is read from the result from pkg-config. So it
should work in most places.
| Python | mit | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge |
238da6f5cb5409409f54980f4ce018fda897a766 | API/chat/models.py | API/chat/models.py | from django.db import models
class Channel(models.Model):
def __str__(self):
return self.name
name = models.CharField(max_length=20, unique=True)
class Message(models.Model):
def __str__(self):
return self.text
def to_dict(self):
serializable_fields = ('text', 'datetime_sta... | from django.db import models
class Channel(models.Model):
def __str__(self):
return self.name
name = models.CharField(max_length=20, unique=True)
class Message(models.Model):
def __str__(self):
return self.text
def to_dict(self):
serializable_fields = ('text', 'datetime_sta... | Add message_type field into message model | Add message_type field into message model
| Python | mit | dionyziz/ting,gtklocker/ting,dionyziz/ting,gtklocker/ting,gtklocker/ting,dionyziz/ting,mbalamat/ting,mbalamat/ting,gtklocker/ting,dionyziz/ting,mbalamat/ting,mbalamat/ting |
7d898ec04733d25c1df33c8faf151f2b42a69ec9 | base/components/people/constants.py | base/components/people/constants.py | from model_utils import Choices
from ohashi.constants import OTHER
BLOOD_TYPE = Choices('A', 'B', 'O', 'AB')
CLASSIFICATIONS = Choices(
(1, 'major', 'Major Unit'),
(2, 'minor', 'Minor Unit'),
(4, 'temporary', 'Temporary Unit'),
(5, 'subunit', 'Sub-Unit'),
(7, 'supergroup', 'Supergroup'),
('S... | from model_utils import Choices
from ohashi.constants import OTHER
BLOOD_TYPE = Choices('A', 'B', 'O', 'AB')
CLASSIFICATIONS = Choices(
(1, 'major', 'Major Unit'),
(2, 'minor', 'Minor Unit'),
(4, 'temporary', 'Temporary Unit'),
(5, 'subunit', 'Sub-Unit'),
(7, 'supergroup', 'Supergroup'),
('S... | Add Satoumi as a classification. | Add Satoumi as a classification.
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web |
f828ac9ee5082a9a0b5e215c4c814e7f35db11b6 | planetstack/core/models/__init__.py | planetstack/core/models/__init__.py | from .plcorebase import PlCoreBase
from .planetstack import PlanetStack
from .project import Project
from .singletonmodel import SingletonModel
from .service import Service
from .service import ServiceAttribute
from .tag import Tag
from .role import Role
from .site import Site,Deployment, DeploymentRole, DeploymentPriv... | from .plcorebase import PlCoreBase
from .planetstack import PlanetStack
from .project import Project
from .singletonmodel import SingletonModel
from .service import Service
from .service import ServiceAttribute
from .tag import Tag
from .role import Role
from .site import Site,Deployment, DeploymentRole, DeploymentPriv... | Add credentials module to core list | Add credentials module to core list
| Python | apache-2.0 | wathsalav/xos,wathsalav/xos,wathsalav/xos,wathsalav/xos |
644660b6c41f029f271a0b8866387f358f8fdf54 | frappe/patches/v4_0/enable_scheduler_in_system_settings.py | frappe/patches/v4_0/enable_scheduler_in_system_settings.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils.scheduler import disable_scheduler, enable_scheduler
def execute():
frappe.reload_doc("core", "doctype", "system_settings")
if frappe.db.get_... | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils.scheduler import disable_scheduler, enable_scheduler
from frappe.utils import cint
def execute():
frappe.reload_doc("core", "doctype", "system... | Fix in enable scheduler patch | Fix in enable scheduler patch
| Python | mit | BhupeshGupta/frappe,letzerp/framework,saurabh6790/frappe,rmehta/frappe,elba7r/builder,suyashphadtare/sajil-frappe,rohitw1991/frappe,saguas/frappe,indictranstech/tele-frappe,nerevu/frappe,indictranstech/omnitech-frappe,vCentre/vFRP-6233,gangadharkadam/saloon_frappe,aboganas/frappe,indictranstech/phr-frappe,gangadharkada... |
fd79823893b9b83a184c2bcd0fbe32fbb51619c9 | src/server/convert.py | src/server/convert.py | # midi-beeper-orchestra - program to create an orchestra from PC speakers
# Copyright (C) 2015 The Underscores
# 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 3 of the Lice... | # midi-beeper-orchestra - program to create an orchestra from PC speakers
# Copyright (C) 2015 The Underscores
# 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 3 of the Lice... | Remove comment containing incorrect conversion function. | Remove comment containing incorrect conversion function.
| Python | agpl-3.0 | TheUnderscores/midi-beeper-orchestra |
d81a1ba12add244cb246efeae5c292a6d995c9b8 | deadlinks.py | deadlinks.py | from operator import itemgetter
from itertools import chain
import os
import yaml
import requests
yaml.load_all
directory = "_companies"
flat = chain.from_iterable
def link_status_company(filename):
(name, _) = filename.rsplit(".", 1);
print("==== {name} ====".format(name=name))
docs = filter(None, ya... | from operator import itemgetter
from itertools import chain
import os
import yaml
import requests
yaml.load_all
directory = "_companies"
flat = chain.from_iterable
def link_status_company(filename):
(name, _) = filename.rsplit(".", 1);
print("==== {name} ====".format(name=name))
docs = filter(None, ya... | Add timeout to dead links script | Add timeout to dead links script
| Python | apache-2.0 | Stockholm-AI/stockholm-ai,Stockholm-AI/stockholm-ai,Stockholm-AI/stockholm-ai,Stockholm-AI/stockholm-ai,Stockholm-AI/stockholm-ai |
96b9c25268e98e9464d8b068aa12de113ad1c66f | joby/spiders/data_science_jobs.py | joby/spiders/data_science_jobs.py | # -*- coding: utf-8 -*-
import scrapy
class DataScienceJobsSpider(scrapy.Spider):
name = "data-science-jobs"
allowed_domains = ["www.data-science-jobs.com"]
start_urls = (
'http://www.data-science-jobs.com/',
)
def parse(self, response):
pass
| # -*- coding: utf-8 -*-
from logging import getLogger
from scrapy.spiders import Rule, CrawlSpider
from scrapy.linkextractors import LinkExtractor
class DataScienceJobsSpider(CrawlSpider):
log = getLogger(__name__)
name = 'data-science-jobs'
allowed_domains = ['www.data-science-jobs.com', 'fonts.googleap... | Add more rules for test purposes. | Add more rules for test purposes.
| Python | mit | cyberbikepunk/job-spiders |
0692cc324d3759703ee52e117ac19e75d82df6a6 | tests/config/tests.py | tests/config/tests.py | from raven.conf import load
from unittest2 import TestCase
class LoadTest(TestCase):
def test_basic(self):
dsn = 'https://foo:bar@sentry.local/1'
res = {}
load(dsn, res)
self.assertEquals(res, {
'SENTRY_PROJECT': '1',
'SENTRY_SERVERS': ['https://sentry.local... | import logging
import mock
from raven.conf import load, setup_logging
from unittest2 import TestCase
class LoadTest(TestCase):
def test_basic(self):
dsn = 'https://foo:bar@sentry.local/1'
res = {}
load(dsn, res)
self.assertEquals(res, {
'SENTRY_PROJECT': '1',
... | Add basic coverage for the setup_logging method | Add basic coverage for the setup_logging method
| Python | bsd-3-clause | inspirehep/raven-python,jmagnusson/raven-python,Goldmund-Wyldebeast-Wunderliebe/raven-python,akalipetis/raven-python,inspirehep/raven-python,nikolas/raven-python,hzy/raven-python,smarkets/raven-python,beniwohli/apm-agent-python,icereval/raven-python,jmagnusson/raven-python,percipient/raven-python,dirtycoder/opbeat_pyth... |
1ec2779f5e4470c6ed19b56d16185c6174ab520c | tests/test_readers.py | tests/test_readers.py | # coding: utf-8
try:
import unittest2
except ImportError, e:
import unittest as unittest2
import datetime
import os
from pelican import readers
CUR_DIR = os.path.dirname(__file__)
CONTENT_PATH = os.path.join(CUR_DIR, 'content')
def _filename(*args):
return os.path.join(CONTENT_PATH, *args)
class RstRe... | # coding: utf-8
try:
import unittest2 as unittest
except ImportError, e:
import unittest
import datetime
import os
from pelican import readers
CUR_DIR = os.path.dirname(__file__)
CONTENT_PATH = os.path.join(CUR_DIR, 'content')
def _filename(*args):
return os.path.join(CONTENT_PATH, *args)
class RstRe... | Make the readers tests a bit more verbose. | Make the readers tests a bit more verbose.
| Python | agpl-3.0 | 11craft/pelican,51itclub/pelican,simonjj/pelican,sunzhongwei/pelican,goerz/pelican,51itclub/pelican,Rogdham/pelican,lucasplus/pelican,gymglish/pelican,sunzhongwei/pelican,sunzhongwei/pelican,koobs/pelican,UdeskDeveloper/pelican,ingwinlu/pelican,kennethlyn/pelican,karlcow/pelican,zackw/pelican,alexras/pelican,HyperGroup... |
f3ea9820a96536e74e6f74f13387140c97ea9f2e | backgroundworker.py | backgroundworker.py | import sys
import os
sys.path.insert(0, "../financialScraper")
import pandas as pd
from financialScraper import getqf
from sqlalchemy import create_engine
running = True
# engine = create_engine(os.environ.get('DATABASE_URL'))
engine = create_engine('postgres://fkwfcpvbchmxps:VCmxue5WFWCOOHt56aqOm4FD_Z@ec2-54-83-205... | import sys
import os
sys.path.insert(0, "../financialScraper")
import pandas as pd
from financialScraper import getqf
from sqlalchemy import create_engine
running = True
# engine = create_engine(os.environ.get('DATABASE_URL'))
engine = create_engine('postgres://fkwfcpvbchmxps:VCmxue5WFWCOOHt56aqOm4FD_Z@ec2-54-83-20... | Add engine connection, and close engine connection to worker dyno | Add engine connection, and close engine connection to worker dyno
| Python | mit | caseymacphee/green_quote,caseymacphee/green_quote |
8868cb556851d3caf227281873d619ec3ddc726a | matador/commands/deploy_ticket.py | matador/commands/deploy_ticket.py | #!/usr/bin/env python
from .command import Command
from matador import utils
class DeployTicket(Command):
def _add_arguments(self, parser):
parser.add_argument(
'-e', '--environment',
type=str,
required=True,
help='Agresso environment name')
def _execu... | #!/usr/bin/env python
from .command import Command
from matador import utils
class DeployTicket(Command):
def _add_arguments(self, parser):
parser.prog = 'matador deploy-ticket'
parser.add_argument(
'-e', '--environment',
type=str,
required=True,
he... | Add program name to parser | Add program name to parser
| Python | mit | Empiria/matador |
8f82336aed62a18b2c6f824fcf0e6b1a1d00b8d3 | tests/test_astroid.py | tests/test_astroid.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import re
import astroid
from . import tools, test_mark_tokens
class TestAstroid(test_mark_tokens.TestMarkTokens):
is_astroid_test = True
module = astroid
nodes_classes = astroid.ALL_NODE_CLASSES
context_classes = [
(astr... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import astroid
from astroid.node_classes import NodeNG
from . import tools, test_mark_tokens
class TestAstroid(test_mark_tokens.TestMarkTokens):
is_astroid_test = True
module = astroid
nodes_classes = NodeNG
context_classes = ... | Use NodeNG instead of astroid.ALL_NODE_CLASSES | Use NodeNG instead of astroid.ALL_NODE_CLASSES
| Python | apache-2.0 | gristlabs/asttokens |
48075a16190bbcc3d260dfa242a5553b129de8a8 | tests/test_see.py | tests/test_see.py | #!/usr/bin/env python
# encoding: utf-8
"""
Unit tests for see.py
"""
from __future__ import print_function, unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
import see
class TestSee(unittest.TestCase):
def test_line_width(self):
# Arrange
default_wi... | #!/usr/bin/env python
# encoding: utf-8
"""
Unit tests for see.py
"""
from __future__ import print_function, unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
import see
class TestSee(unittest.TestCase):... | Update tests to import see | Update tests to import see
| Python | bsd-3-clause | araile/see |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.