commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
e7697ef66fcb6559691ffe28d8e54917cd4f632a | Add pydoc documentation for OzException. | clalancette/oz,mgagne/oz,clalancette/oz,nullr0ute/oz,moofrank/oz,ndonegan/oz,NeilBryant/oz,moofrank/oz,cernops/oz,NeilBryant/oz,cernops/oz,imcleod/oz,nullr0ute/oz,imcleod/oz,mgagne/oz,ndonegan/oz | oz/OzException.py | oz/OzException.py | # Copyright (C) 2011 Chris Lalancette <clalance@redhat.com>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation;
# version 2.1 of the License.
# This library is distributed in the hope that... | # Copyright (C) 2011 Chris Lalancette <clalance@redhat.com>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation;
# version 2.1 of the License.
# This library is distributed in the hope that... | lgpl-2.1 | Python |
59633d5c958883ebf1a738ad1b8cd36480043dbf | fix missing -lrt for Centos6, issue: #7552 (#7597) | mfherbst/spack,iulian787/spack,mfherbst/spack,tmerrick1/spack,mfherbst/spack,krafczyk/spack,tmerrick1/spack,LLNL/spack,matthiasdiener/spack,iulian787/spack,krafczyk/spack,LLNL/spack,LLNL/spack,matthiasdiener/spack,matthiasdiener/spack,krafczyk/spack,LLNL/spack,tmerrick1/spack,krafczyk/spack,tmerrick1/spack,iulian787/sp... | var/spack/repos/builtin/packages/lz4/package.py | var/spack/repos/builtin/packages/lz4/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
427d8a011ef59eb1b932c836178e10756488b235 | Bump to version 0.63.0 | nerevu/riko,nerevu/riko | riko/__init__.py | riko/__init__.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | mit | Python |
1c642b2d86e787f9665c6a263dfea4a9c44d9753 | Bump to version 0.52.1 | nerevu/riko,nerevu/riko | riko/__init__.py | riko/__init__.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | mit | Python |
04c8a7d2771a739fb5a266fe597c857a2e77064c | Bump version number. | JelleZijlstra/cython,slonik-az/cython,hhsprings/cython,scoder/cython,cython/cython,hickford/cython,fperez/cython,hickford/cython,fperez/cython,scoder/cython,roxyboy/cython,acrispin/cython,encukou/cython,acrispin/cython,rguillebert/CythonCTypesBackend,hhsprings/cython,dahebolangkuan/cython,hpfem/cython,hickford/cython,a... | Cython/Compiler/Version.py | Cython/Compiler/Version.py | version = '0.9.8'
| version = '0.9.6.14'
| apache-2.0 | Python |
8db4b291559c9f90f65bf4839bd8a2401de66b11 | add --ignore-missing-wmv | gdesmott/politube,gdesmott/politube | videos_tools/management/commands/todo_videos.py | videos_tools/management/commands/todo_videos.py | from django.core.management.base import BaseCommand
from optparse import make_option
from videos_tools.models import Video
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--mms',
action='store_true',
dest='mms',
default=False,
help... | from django.core.management.base import BaseCommand
from optparse import make_option
from videos_tools.models import Video
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--mms',
action='store_true',
dest='mms',
default=False,
help... | agpl-3.0 | Python |
bf127bc7ffeb8ec5c9c572dd5c9a10ed4b982069 | fix bug for wiki_handler tester. | bukun/TorCMS,bukun/TorCMS,bukun/TorCMS,bukun/TorCMS,bukun/TorCMS | tester/test_handlers/test_wiki_handler.py | tester/test_handlers/test_wiki_handler.py | # -*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
'''
Test Post handler
'''
from tornado.testing import AsyncHTTPSTestCase, gen_test
from application import app
class TestWikiHandler(AsyncHTTPSTestCase):
def get_app(self):
return app
def test_to_add(self):
response = self.fetch('/wiki/ToAdd')... | # -*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
'''
Test Post handler
'''
from tornado.testing import AsyncHTTPSTestCase, gen_test
from application import app
class TestWikiHandler(AsyncHTTPSTestCase):
def get_app(self):
return app
def test_to_add(self):
response = self.fetch('/wiki/ToAdd')... | mit | Python |
a2e0026a0738a5bf05b88ba2cc96fd5aab6e1b32 | add test of copy function | paulscherrerinstitute/pcaspy,paulscherrerinstitute/pcaspy,paulscherrerinstitute/pcaspy | test/gddTest.py | test/gddTest.py | from pcaspy import cas
import numpy
import unittest
class TestGDD(unittest.TestCase):
def setUp(self):
self.s = cas.gdd()
def test_copy(self):
d = cas.gdd()
d.put([1,2,3,4])
self.s.put(d)
self.assertEqual(self.s.get(), [1,2,3,4])
def test_string(self):
se... | from pcaspy import cas
import numpy
import unittest
class TestGDD(unittest.TestCase):
def setUp(self):
self.s = cas.gdd()
def test_string(self):
self.s.put("sdcsd")
self.assertEqual(self.s.get(), "sdcsd")
def test_numeric(self):
self.s.put(12)
self.assertEqual(se... | bsd-3-clause | Python |
12a1b6ad0300d3cadde29d17b6ed77db51c060b3 | Create a str() to work on both python 2.7 and 3 | schwa/punic | punic/config_init.py | punic/config_init.py | from __future__ import division, absolute_import, print_function
__all__ = ['config_init']
import yaml
from pathlib2 import Path
from prompt_toolkit.contrib.completers import WordCompleter
from prompt_toolkit import prompt
from prompt_toolkit.auto_suggest import (AutoSuggest, Suggestion)
import six
import sys
from .... | from __future__ import division, absolute_import, print_function
__all__ = ['config_init']
import yaml
from pathlib2 import Path
from prompt_toolkit.contrib.completers import WordCompleter
from prompt_toolkit import prompt
from prompt_toolkit.auto_suggest import (AutoSuggest, Suggestion)
import six
import sys
from .... | mit | Python |
b3f5262aad1c68e51bd21c2c537b0306808ea2f5 | Handle signals for shutdown. | Matir/pwnableweb,Matir/pwnableweb,Matir/pwnableweb,Matir/pwnableweb | pwnableapp/client.py | pwnableapp/client.py | import os
import signal
import sys
import threading
import time
import xvfbwrapper
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
class VulnerableClient(object):
"""Run a Chrome client to simulate XSS, XSRF, etc.
Runs Chrome inside XVFB. Only need to override run().
"""... | import os
import sys
import threading
import time
import xvfbwrapper
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
class VulnerableClient(object):
"""Run a Chrome client to simulate XSS, XSRF, etc.
Runs Chrome inside XVFB. Only need to override run().
"""
def __init... | apache-2.0 | Python |
b42433ce268e302af74e0b91045dacda1e08f073 | make line from passfile configurable | moosbaue/pyUtils | py_openssl_crypto.py | py_openssl_crypto.py | """python frontend to open ssl en- decryption by josef@moosbauer.net
input parameters
inp string to en- decrypt
alg string algorithm to be used, defaults to des3
passFile string salt file, defaults to ~/.ssh/id_dsa
line int line to be used from passfile, default... | """python frontend to open ssl en- decryption by josef@moosbauer.net
input parameters
inp string to en- decrypt
alg algorithm to be used, defaults to des3
passFile salt file, 2nd line used, defaults to ~/.ssh/id_dsa
output parameter
on ok
ret[0] en-... | unlicense | Python |
2fd6a683ec8557bdf27a3470c63d795c8fd31c46 | Use "typing.FrozenSet" and specify generic parameters | laughingman7743/PyAthena | pyathena/__init__.py | pyathena/__init__.py | # -*- coding: utf-8 -*-
import datetime
from typing import Type, FrozenSet
from pyathena.error import * # noqa
__version__: str = "1.11.2"
# Globals https://www.python.org/dev/peps/pep-0249/#globals
apilevel: str = "2.0"
threadsafety: int = 3
paramstyle: str = "pyformat"
class DBAPITypeObject(FrozenSet[str]):
... | # -*- coding: utf-8 -*-
import datetime
from typing import Type
from pyathena.error import * # noqa
__version__: str = "1.11.2"
# Globals https://www.python.org/dev/peps/pep-0249/#globals
apilevel: str = "2.0"
threadsafety: int = 3
paramstyle: str = "pyformat"
class DBAPITypeObject(frozenset):
"""Type Objects... | mit | Python |
fa2b501c844d82c1c56307d0f23ce9956b48c465 | update unittests for psda | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | tests/test_pecanstreet_dataset_adapter.py | tests/test_pecanstreet_dataset_adapter.py | import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter
import unittest
class PecanStreetDatasetAdapterTestCase(unittest.TestCase):
def setUp(self):
db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
self.psda = PecanStreetDatasetAdapter(db_u... | import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter
import unittest
class PecanStreetDatasetAdapterTestCase(unittest.TestCase):
def setUp(self):
db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
self.psda = PecanStreetDatasetAdapter(db_u... | mit | Python |
9d6312bebe10404813ed6b7936de359fe21bae6e | Add support for the "Slow down cowboy" error raised when more than 200 requests are made in a 15 minute interval | authmillenon/pycomicvine | pycomicvine/error.py | pycomicvine/error.py | class InvalidResourceError(Exception):
pass
class InvalidAPIKeyError(Exception):
pass
class ObjectNotFoundError(Exception):
pass
class ErrorInURLFormatError(Exception):
pass
class JSONError(Exception):
pass
class FilterError(Exception):
pass
class SubscriberOnlyError(Exception):
pass
... | class InvalidResourceError(Exception):
pass
class InvalidAPIKeyError(Exception):
pass
class ObjectNotFoundError(Exception):
pass
class ErrorInURLFormatError(Exception):
pass
class JSONError(Exception):
pass
class FilterError(Exception):
pass
class SubscriberOnlyError(Exception):
pass
... | mit | Python |
8fc01978a89954dbac3fa97b645fbec13b3d38e2 | Improve docs. | tallakahath/pymatgen,fraricci/pymatgen,gVallverdu/pymatgen,gVallverdu/pymatgen,vorwerkc/pymatgen,davidwaroquiers/pymatgen,tallakahath/pymatgen,xhqu1981/pymatgen,gmatteo/pymatgen,tallakahath/pymatgen,mbkumar/pymatgen,nisse3000/pymatgen,aykol/pymatgen,montoyjh/pymatgen,ndardenne/pymatgen,dongsenfo/pymatgen,dongsenfo/pyma... | pymatgen/__init__.py | pymatgen/__init__.py | __author__ = ", ".join(["Shyue Ping Ong", "Anubhav Jain", "Geoffroy Hautier",
"William Davidson Richard", "Stephen Dacek",
"Michael Kocher", "Dan Gunter", "Shreyas Cholia",
"Vincent L Chevrier", "Rickard Armiento"])
__date__ = "May 12 2013"
__versi... | __author__ = ", ".join(["Shyue Ping Ong", "Anubhav Jain", "Geoffroy Hautier",
"William Davidson Richard", "Stephen Dacek",
"Michael Kocher", "Dan Gunter", "Shreyas Cholia",
"Vincent L Chevrier", "Rickard Armiento"])
__date__ = "May 12 2013"
__versi... | mit | Python |
d396cda426dcc9d2c3da76d2194bb5e94d42fc90 | improve module docstring | paolodragone/PyMzn | pymzn/mzn/process.py | pymzn/mzn/process.py | """\
This package provides utilities for running synchronous external processes.
"""
import os
import subprocess
from time import monotonic as _time
__all__ = ['run_process']
class CompletedProcessWrapper:
def __init__(self, proc, start_time, end_time):
self._proc = proc
self.start_time = sta... | """process.py
This package provides utilities for running synchronous external processes.
"""
import os
import subprocess
from time import monotonic as _time
__all__ = ['run_process']
class CompletedProcessWrapper:
def __init__(self, proc, start_time, end_time):
self._proc = proc
self.start_... | mit | Python |
18b62174d8fd48691a78f23b0a9f806eb7eb01f7 | Update test again after better aggregation | johnbachman/indra,bgyori/indra,johnbachman/belpy,sorgerlab/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,bgyori/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/belpy | indra/tests/test_tas.py | indra/tests/test_tas.py | from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total number of statements about human genes
assert... | from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total number of statements about human genes
assert... | bsd-2-clause | Python |
fe7739f60a4d7c8424c1cc2de4e94b11d27720ed | remove the unused max_workers. | chango/inferno,oldmantaiter/inferno,pombredanne/inferno | inferno/lib/settings.py | inferno/lib/settings.py | import os
import yaml
def guess_settings():
for settings_file in (
os.path.expanduser('~/.inferno'),
'/etc/inferno/settings.yaml'):
if os.path.exists(settings_file):
return settings_file
return ''
defaults = {
'log_config': '/etc/inferno/log.ini',
'settings_file':... | import os
import yaml
def guess_settings():
for settings_file in (
os.path.expanduser('~/.inferno'),
'/etc/inferno/settings.yaml'):
if os.path.exists(settings_file):
return settings_file
return ''
defaults = {
'log_config': '/etc/inferno/log.ini',
'settings_file':... | mit | Python |
5b80fa8625e4cc603da920df33a56284cb052e46 | add test for data=True | Unidata/netcdf4-python,Unidata/netcdf4-python,Unidata/netcdf4-python | test/tst_cdl.py | test/tst_cdl.py | import unittest
import netCDF4
import os
test_ncdump="""netcdf ubyte {
dimensions:
d = 2 ;
variables:
byte ub(d) ;
ub:_Unsigned = "true" ;
byte sb(d) ;
// global attributes:
:_Format = "classic" ;
}
"""
test_ncdump2="""netcdf ubyte {
dimensions:
d = 2 ;
variables:
byte ub(d) ;
ub:_Unsigned = "true" ;
byte... | import unittest
import netCDF4
import os
test_ncdump="""netcdf ubyte {
dimensions:
d = 2 ;
variables:
byte ub(d) ;
ub:_Unsigned = "true" ;
byte sb(d) ;
// global attributes:
:_Format = "classic" ;
}
"""
class Test_CDL(unittest.TestCase):
"""
Test import/export of CDL
"""
def setUp(self):
... | mit | Python |
2053ed34b97cc028bf3327293b017e05455eb77b | update test_server example | mylokin/servy | test_server2.py | test_server2.py | from __future__ import absolute_import
import wsgiref.simple_server
import servy.server
class Parser(servy.server.Container):
@classmethod
def parse_details(cls, data):
return data.get('details')
class Echo(servy.server.Container):
parser = Parser()
shit = 1
pu = ''
@classmethod... | from __future__ import absolute_import
import wsgiref.simple_server
import servy.server
class Parser(servy.server.Service):
@classmethod
def parse_details(cls, data):
return data.get('details')
class Echo(servy.server.Service):
parser = Parser()
shit = 1
pu = ''
@classmethod
... | mit | Python |
5c997331a68ceef35769de1c54c49d1203764e90 | Add possibility of multiple consecutive vowels. | cranndarach/namegen | namegen.py | namegen.py | #!/usr/bin/env python3
import random as rd
import wordutils
def generate(clusters, vowels, stop_len=9, min_len=1, vowel_mod=6):
name = ""
# name += rd.choice(vowels) if check(10) else none
# if rd.randrange(10) == 9:
# name = rd.choice(vowels)
# name += rd.choice(clusters)
# else:
... | #!/usr/bin/env python3
import random as rd
import wordutils
namefile = "names.csv"
with open(namefile, "r") as f:
names = [name[:-1] for name in f.readlines()]
vowels = ['a', 'e', 'i', 'o', 'u', 'y']
clusters = wordutils.clusters(names, vowels)
def generate(clusters, vowels, max_len=9):
if rd.randrange(10) ... | mit | Python |
1e8959468166ec2da514b325a85de7116e3f5c41 | fix typos of salt.utils in modules.win_disk | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/win_disk.py | salt/modules/win_disk.py | '''
Module for gathering disk information on Windows
:depends: - win32api Python module
'''
# Import python libs
import ctypes
import string
# Import salt libs
import salt.utils
try:
import win32api
except ImportError:
pass
def __virtual__():
'''
Only works on Windows systems
'''
if salt.... | '''
Module for gathering disk information on Windows
:depends: - win32api Python module
'''
# Import python libs
import ctypes
import string
# Import salt libs
import salt.util
try:
import win32api
except ImportError:
pass
def __virtual__():
'''
Only works on Windows systems
'''
if salt.u... | apache-2.0 | Python |
05d4cfbb2ec1ac857df6b836cc828df46cac7737 | delete only if package is at top | JangXa/tutorpgdp | package.py | package.py | import os
import sys
for root, dirs, files in os.walk(os.path.dirname(os.path.abspath(__file__))):
for name in files:
if name.endswith((".java")):
file = open(name, "r")
lines = file.readlines()
file.close()
file = open(name, "w")
i = ... | import os
import sys
for root, dirs, files in os.walk(os.path.dirname(os.path.abspath(__file__))):
for name in files:
if name.endswith((".java")):
file = open(name, "r")
lines = file.readlines()
file.close()
file = open(name, "w")
i = ... | mit | Python |
3e93c96ece8af010185e1fe1188dd2df569d4528 | replace unicode call with force_text | rubendura/django-rest-framework,James1345/django-rest-framework,ajaali/django-rest-framework,paolopaolopaolo/django-rest-framework,ebsaral/django-rest-framework,linovia/django-rest-framework,d0ugal/django-rest-framework,ajaali/django-rest-framework,cheif/django-rest-framework,wedaly/django-rest-framework,iheitlager/dja... | rest_framework/utils/formatting.py | rest_framework/utils/formatting.py | """
Utility functions to return a formatted name and description for a given view.
"""
from __future__ import unicode_literals
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.encoding import force_text
from rest_framework.compat import apply_markdown
import re
de... | """
Utility functions to return a formatted name and description for a given view.
"""
from __future__ import unicode_literals
from django.utils.html import escape
from django.utils.safestring import mark_safe
from rest_framework.compat import apply_markdown
import re
def remove_trailing_string(content, trailing):
... | bsd-2-clause | Python |
104311538615bba56f5221c226546c5b33b0490e | Fix page title. | hforge/hforge | skins.py | skins.py | # -*- coding: UTF-8 -*-
# Copyright (C) 2008 Matthieu France <matthieu.france@itaapy.com>
#
# 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
# License, or (at your ... | # -*- coding: UTF-8 -*-
# Copyright (C) 2008 Matthieu France <matthieu.france@itaapy.com>
#
# 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
# License, or (at your ... | agpl-3.0 | Python |
b349479a49aab440b2f38fc6e45b3df4bf7a1aa7 | Add another testcase for __new__/__init__ interaction. | MrSurly/micropython-esp32,trezor/micropython,adafruit/micropython,micropython/micropython-esp32,AriZuu/micropython,lowRISC/micropython,selste/micropython,dmazzella/micropython,tralamazza/micropython,trezor/micropython,kerneltask/micropython,pramasoul/micropython,blazewicz/micropython,micropython/micropython-esp32,trala... | tests/basics/class_new.py | tests/basics/class_new.py | try:
# If we don't expose object.__new__ (small ports), there's
# nothing to test.
object.__new__
except AttributeError:
print("SKIP")
raise SystemExit
class A:
def __new__(cls):
print("A.__new__")
return super(cls, A).__new__(cls)
def __init__(self):
print("A.__ini... | try:
# If we don't expose object.__new__ (small ports), there's
# nothing to test.
object.__new__
except AttributeError:
print("SKIP")
raise SystemExit
class A:
def __new__(cls):
print("A.__new__")
return super(cls, A).__new__(cls)
def __init__(self):
print("A.__ini... | mit | Python |
e5f39c84046037495cde35622d16339c7014479a | read database credentials from k8s secret | deis/workflow,deis/workflow,deis/workflow | rootfs/templates/confd_settings.py | rootfs/templates/confd_settings.py | import os
# security keys and auth tokens
with open('/var/run/secrets/api/builder/auth/builder-key') as f:
BUILDER_KEY = f.read().strip()
with open('/var/run/secrets/api/django/secret-key') as f:
SECRET_KEY = f.read().strip()
with open('/var/run/secrets/deis/database/creds/user') as f:
DATABASES['default... | import os
# security keys and auth tokens
with open('/var/run/secrets/api/builder/auth/builder-key') as f:
BUILDER_KEY = f.read().strip()
with open('/var/run/secrets/api/django/secret-key') as f:
SECRET_KEY = f.read().strip()
# scheduler settings
SCHEDULER_MODULE = 'scheduler'
SCHEDULER_URL = "https://{}:{}"... | mit | Python |
7bc7b4c674caec1b5687f78127b40a98e193777e | Add a check for msgpack on ARM issue, temp help for #1240 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/payload.py | salt/payload.py | '''
Many aspects of the salt payload need to be managed, from the return of
encrypted keys to general payload dynamics and packaging, these happen
in here
'''
from salt._compat import pickle
try:
# Attempt to import msgpack
import msgpack
# There is a serialization issue on ARM and potentially other platf... | '''
Many aspects of the salt payload need to be managed, from the return of
encrypted keys to general payload dynamics and packaging, these happen
in here
'''
from salt._compat import pickle
try:
# Attempt to import msgpack
import msgpack
except ImportError:
# Fall back to msgpack_pure
import msgpack_... | apache-2.0 | Python |
718a9b7ea71b933f4be470bdda2f4bfc35e7921d | Fix for leap years | svkampen/James | plugins/ageme.py | plugins/ageme.py | """
Age Calculator
"""
from .util.decorators import command, initializer
import datetime
import time
import re
@command('ageme')
def insult(bot, nick, target, chan, arg):
""" Find exact age """
if not arg:
return bot.msg(chan, insult.__doc__.strip())
prec = '16'
args = arg.split()
if le... | """
Age Calculator
"""
from .util.decorators import command, initializer
import datetime
import time
import re
@command('ageme')
def insult(bot, nick, target, chan, arg):
""" Find exact age """
if not arg:
return bot.msg(chan, insult.__doc__.strip())
prec = '16'
args = arg.split()
if le... | mit | Python |
b252c0bcb9cde2c9071b46135fea0435f7bdfe1f | fix database name | rmehlinger/Bonisagus,rmehlinger/Bonisagus | Core/character_manager.py | Core/character_manager.py | import os
from bson import ObjectId
from gunicorn.six import urlparse
from django.conf import settings
import pymongo
from Core.models import Magus
__author__ = 'Richard'
MONGO_URL = os.environ.get('MONGOHQ_URL')
print(MONGO_URL)
if MONGO_URL:
# Get a connection
client = pymongo.MongoClient(MONGO_URL)
db... | import os
from bson import ObjectId
from gunicorn.six import urlparse
from django.conf import settings
import pymongo
from Core.models import Magus
__author__ = 'Richard'
MONGO_URL = os.environ.get('MONGOHQ_URL')
print(MONGO_URL)
if MONGO_URL:
# Get a connection
client = pymongo.MongoClient(MONGO_URL)
db... | mit | Python |
e1614571a1ddd228b4f113f97e8d243ae2023324 | use progressReporter from progressbar module | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | tests/misc/progressbar.py | tests/misc/progressbar.py | #!/usr/bin/env python
# Tai Sakuma <tai.sakuma@gmail.com>
from __future__ import print_function
import sys
import time, random
import uuid
import alphatwirl
##__________________________________________________________________||
class Task(object):
def __init__(self, name):
self.name = name
def __call_... | #!/usr/bin/env python
# Tai Sakuma <tai.sakuma@gmail.com>
from __future__ import print_function
import sys
import time, random
import uuid
import alphatwirl
##__________________________________________________________________||
class Task(object):
def __init__(self, name):
self.name = name
def __call_... | bsd-3-clause | Python |
973641c7d68f4b1505541a06ec46901b412ab56b | Test LICQ condition of constraint gradient | JakobGM/robotarm-optimization | tests/test_constraints.py | tests/test_constraints.py | import unittest
import numpy as np
from constraints import (generate_constraints_function,
generate_constraint_gradients_function, )
from robot_arm import RobotArm
class TestConstraintFunctions(unittest.TestCase):
def setUp(self):
self.lengths = (3, 2, 2,)
self.destinati... | import unittest
import numpy as np
from constraints import (generate_constraints_function,
generate_constraint_gradients_function, )
from robot_arm import RobotArm
class TestConstraintFunctions(unittest.TestCase):
def setUp(self):
self.lengths = (3, 2, 2,)
self.destinati... | mit | Python |
2cf7142a11886f6099aa94ab8dba776c37f9510c | fix chart test | aumayr/beancount-web,yagebu/fava,beancount/fava,beancount/fava,yagebu/fava,beancount/fava,aumayr/beancount-web,yagebu/fava,yagebu/fava,aumayr/beancount-web,beancount/fava,beancount/fava,yagebu/fava,aumayr/beancount-web | tests/test_core_charts.py | tests/test_core_charts.py | import datetime
from beancount.core.number import D
from flask import g
from fava.application import app
from fava.util.date import Interval
def test_linechart_data(example_ledger):
with app.test_request_context('/'):
g.conversion = 'units'
data = example_ledger.charts.linechart(
'As... | import datetime
from beancount.core.number import D
from flask import g
from fava.application import app
from fava.util.date import Interval
def test_linechart_data(example_ledger):
with app.test_request_context('/'):
g.conversion = 'units'
data = example_ledger.charts.linechart(
'As... | mit | Python |
ce963ebf74cf5571531242f5c5cb800eef590909 | Make notebook testing multithreaded | julienchastang/unidata-python-workshop,Unidata/unidata-python-workshop,julienchastang/unidata-python-workshop | run_notebooks.py | run_notebooks.py | #!/usr/bin/env python
import subprocess
import os.path
NOTEBOOKS_DIR = 'notebooks'
SKIP_NOTEBOOKS = [os.path.join('Bonus','What to do when things go wrong.ipynb'),
os.path.join('python-awips',
'NEXRAD3_Storm_Total_Accumulation.ipynb')]
def run_notebook(notebook):
... | #!/usr/bin/env python
import subprocess
import os.path
NOTEBOOKS_DIR = 'notebooks'
SKIP_NOTEBOOKS = [os.path.join('Bonus','What to do when things go wrong.ipynb'),
os.path.join('python-awips',
'NEXRAD3_Storm_Total_Accumulation.ipynb')]
def run_notebook(notebook):
... | mit | Python |
8338722d453838aca05608a88f0e7e87bbb8513a | update pecan street adapter tests | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | tests/test_pecan_class.py | tests/test_pecan_class.py | import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter
import unittest
class PecanStreetDatasetAdapterTestCase(unittest.TestCase):
def setUp(self):
db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
self.psda = PecanStreetDatasetAdapter(db_u... | import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter as pecan
import unittest
class PecanStreetDatasetAdapterTestCase(unittest.TestCase):
def setUp(self):
db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
self.p = pecan(db_url)
def t... | mit | Python |
5214b32ee3e2a84a98d41e2dcab06e28b744e3c5 | Print request URL when package fails | platformio/platformio-core,platformio/platformio-core,platformio/platformio | tests/test_pkgmanifest.py | tests/test_pkgmanifest.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 | Python |
7cb5e0745f8145edab4589b32e06f1931ff703a2 | Update for new credo | markstory/lint-review,markstory/lint-review,markstory/lint-review | tests/tools/test_credo.py | tests/tools/test_credo.py | from __future__ import absolute_import
from lintreview.review import Comment, Problems
from lintreview.tools.credo import Credo
from unittest import TestCase
from tests import root_dir, requires_image
class TestCredo(TestCase):
fixtures = [
'tests/fixtures/credo/no_errors.ex',
'tests/fixtures/cre... | from __future__ import absolute_import
from lintreview.review import Comment, Problems
from lintreview.tools.credo import Credo
from unittest import TestCase
from tests import root_dir, requires_image
class TestCredo(TestCase):
fixtures = [
'tests/fixtures/credo/no_errors.ex',
'tests/fixtures/cre... | mit | Python |
bc7e9cbeeb50a7bb108d3c9abe12ba94aec7904e | fix string substitution | thismachinechills/pyscreencapture,bradparks/pyscreencapture | screencapture.py | screencapture.py | from datetime import datetime
from subprocess import getstatusoutput
import click
from get_window_id import gen_window_ids, options, user_options_str
@click.command()
@click.option('-t', '--title', default=None, help="Title of window from APPLICATION_NAME to capture.")
@click.option('-f', '--filename', default=None... | from datetime import datetime
from subprocess import getstatusoutput
import click
from get_window_id import gen_window_ids, options, user_options_str
@click.command()
@click.option('-t', '--title', default=None, help="Title of window from APPLICATION_NAME to capture.")
@click.option('-f', '--filename', default=None... | agpl-3.0 | Python |
be560d115758a370887aae7638d087218b1da34a | Make sure that search config points to the proper servers | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | search/config.py | search/config.py | #ES_SERVER = "http://localhost:9200"
#API_HOST = "http://localhost:5001"
ES_SERVER = "http://ec2-54-77-69-243.eu-west-1.compute.amazonaws.com:9200"
API_HOST = "http://pmg-cms.demo4sa.org" | ES_SERVER = "http://localhost:9200"
API_HOST = "http://localhost:5001" | apache-2.0 | Python |
3c90597e4f561abedfe41c6dc3932f6249807df2 | enable context aware commits (#98) | googleapis/java-container,googleapis/java-container,googleapis/java-container | synth.py | synth.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python |
e0d9ef3870a04bb3e097f7352be9b5da9ba46ba4 | Update numc.py | konemshad/ML,mahesh-9/ML | ml/numc.py | ml/numc.py | #from .GLM.lr import checkfit
import numpy as np
class nx:
"""a class for custom methods in numpy"""
def __init__(self,ob):
if not isinstance(ob,np.ndarray):
raise("expected np.array object")
else:
self.ob=ob
def add_col(self,col_no,val=np.inf):
"""this method returns an numpy.ndarray
which consists of... | #from .GLM.lr import checkfit
import numpy as np
class nx:
"""a class for custom methods in numpy"""
def __init__(self,ob):
if not isinstance(ob,np.ndarray):
raise("expected np.array object")
else:
self.ob=ob
def add_col(self,col_no,val=np.inf):
"""this method returns an numpy.ndarray
which consists of... | mit | Python |
942907c8a30bb7b588530219da6f96b8e2e1fc17 | Add test for homepage & change assertion for the 12 tilesets we have now | scottx611x/refinery-higlass-docker,scottx611x/refinery-higlass-docker,scottx611x/refinery-higlass-docker | tests.py | tests.py | import json
import os
import requests
import subprocess
import sys
import time
import unittest
class CommandlineTest(unittest.TestCase):
def setUp(self):
command = "docker port container-{STAMP}{SUFFIX} | " \
"perl -pne 's/.*://'".format(**os.environ)
os.environ['PORT'] = subprocess.c... | import json
import os
import requests
import subprocess
import time
import unittest
class CommandlineTest(unittest.TestCase):
def setUp(self):
command = "docker port container-{STAMP}{SUFFIX} | perl -pne 's/.*://'".format(
**os.environ)
os.environ['PORT'] = subprocess.check_output(
... | mit | Python |
fa3768a0c5fbb5509ffef8bb1da6401ff8cff076 | Add spacing for readability | CubicComet/exercism-python-solutions | series/series.py | series/series.py | def slices(s, n):
m = len(s)
if n > m:
raise ValueError("Slice cannot be larger than the string")
if n < 1:
raise ValueError("Slices must have a positive non-zero length")
return [list(map(int, s[i:i+n])) for i in range(m-n+1)]
| def slices(s, n):
m = len(s)
if n > m:
raise ValueError("Slice cannot be larger than the string")
if n < 1:
raise ValueError("Slices must have a positive non-zero length")
return [list(map(int, s[i:i+n])) for i in range(m-n+1)]
| agpl-3.0 | Python |
9d91871b9805ba19d478f7d2304a252d5ee8a58e | add pyvmaze to path | maxgraser/seriesly,maxgraser/seriesly,maxgraser/seriesly | seriesly/main.py | seriesly/main.py | import logging
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
# Force sys.path to have our own directory first, in case we want to import
# from it.
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/pytvmaze"))
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
# Mu... | import logging
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
# Force sys.path to have our own directory first, in case we want to import
# from it.
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
# Must set this env var *before* importing any part of Django
# import django.db... | agpl-3.0 | Python |
2644e8904de282dc455f69716dfb0556e9a59478 | Remove extraneous import statements. | ask/celery,cbrepo/celery,WoLpH/celery,cbrepo/celery,WoLpH/celery,frac/celery,ask/celery,mitsuhiko/celery,mitsuhiko/celery,frac/celery | celery/datastructures.py | celery/datastructures.py | """
Custom Datastructures
"""
from UserList import UserList
import traceback
class PositionQueue(UserList):
"""A positional queue of a specific length, with slots that are either
filled or unfilled. When all of the positions are filled, the queue
is considered :meth:`full`.
:param length: see :attr... | """
Custom Datastructures
"""
import multiprocessing
from multiprocessing.pool import RUN as POOL_STATE_RUN
import itertools
import threading
import time
import os
import traceback
from UserList import UserList
from celery.timer import TimeoutTimer, TimeoutError
from celery.conf import REAP_TIMEOUT, SEND_CELERY_TASK_... | bsd-3-clause | Python |
c8c9c42f14c742c6fcb180b7a3cc1bab1655ac46 | Improve determination of array shape for constant expressions | ricardog/raster-project,ricardog/raster-project,ricardog/raster-project,ricardog/raster-project,ricardog/raster-project | projections/simpleexpr.py | projections/simpleexpr.py |
import numpy as np
import numpy.ma as ma
import projections.r2py.reval as reval
import projections.r2py.rparser as rparser
class SimpleExpr():
def __init__(self, name, expr):
self.name = name
self.tree = reval.make_inputs(rparser.parse(expr))
lokals = {}
exec(reval.to_py(self.tree, name), lokals)
... |
import numpy as np
import numpy.ma as ma
import projections.r2py.reval as reval
import projections.r2py.rparser as rparser
class SimpleExpr():
def __init__(self, name, expr):
self.name = name
self.tree = reval.make_inputs(rparser.parse(expr))
lokals = {}
exec(reval.to_py(self.tree, name), lokals)
... | apache-2.0 | Python |
91e42da671d6c54a6d14b6928e11bb4776125172 | fix import | PFCM/slack-ml,PFCM/slack-ml,PFCM/slack-ml | msg/msg.py | msg/msg.py | """
This module handles messages.
"""
import logging
import json
import random
from google.appengine.ext import deferred
import data.models
import data.tools
from flask import Flask
import flask
app = Flask(__name__)
USERNAME = "ml" # actually its 'slackbot' but docs say this should work, so do both
POSITIVE_RES... | """
This module handles messages.
"""
import logging
import json
import random
from google.appengine.ext import deferred
import data.models
from flask import Flask
import flask
app = Flask(__name__)
USERNAME = "ml" # actually its 'slackbot' but docs say this should work, so do both
POSITIVE_RESPONSES = [
':y... | mit | Python |
ed6ae0c6592f0d93757aa54c7c0ff512c8efcc85 | Add ability to listen to keypress and call server every 5 seconds with updates | ColdSauce/IsSittingOnButt,ColdSauce/IsSittingOnButt,ColdSauce/IsSittingOnButt,ColdSauce/IsSittingOnButt,ColdSauce/IsSittingOnButt | client/listenKeypress.py | client/listenKeypress.py | import Tkinter as tk
import yaml
import requests
import tty, termios, sys
import thread
import time
yaml_contents = None
def get_yaml_contents():
global yaml_contents
if yaml_contents is None:
with open("config/config.yml", "r") as f:
yaml_contents = yaml.load(f)
return yaml_contents
... | import Tkinter as tk
import yaml
import requests
yaml_contents = None
def get_yaml_contents():
global yaml_contents
if yaml_contents is None:
with open("config/config.yml", "r") as f:
yaml_contents = yaml.load(f)
return yaml_contents
def get_server_ip():
yaml_contents = get_yaml_... | apache-2.0 | Python |
56a75b56b15b1665e12d66aefe961b414cf95acc | add doc | armijnhemel/binaryanalysis | src/maintenance/dumplist.py | src/maintenance/dumplist.py | #!/usr/bin/python
import sys, os, os.path, re
import fnmatch
import sqlite3
import ConfigParser
from optparse import OptionParser
## Binary Analysis Tool
## Copyright 2012 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
This script is to regenerat... | #!/usr/bin/python
import sys, os, os.path, re
import fnmatch
import sqlite3
import ConfigParser
from optparse import OptionParser
## Binary Analysis Tool
## Copyright 2012 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
'''
def main(argv):
confi... | apache-2.0 | Python |
632180274abe4cf91f65cf0e84f817dc7124e293 | Add imports needed for new migration. | eeshangarg/zulip,Galexrt/zulip,shubhamdhama/zulip,punchagan/zulip,Galexrt/zulip,tommyip/zulip,brainwane/zulip,tommyip/zulip,zulip/zulip,brainwane/zulip,punchagan/zulip,eeshangarg/zulip,rht/zulip,timabbott/zulip,rht/zulip,zulip/zulip,andersk/zulip,synicalsyntax/zulip,brainwane/zulip,rht/zulip,eeshangarg/zulip,rishig/zul... | zerver/migrations/0108_fix_default_string_id.py | zerver/migrations/0108_fix_default_string_id.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-24 02:39
from __future__ import unicode_literals
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def fix_realm_string_ids(apps, schema_editor... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-24 02:39
from __future__ import unicode_literals
from django.db import migrations
def fix_realm_string_ids(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEditor) -> None
Realm = apps.get_model('zerver', 'Realm')
if Realm.objects.coun... | apache-2.0 | Python |
067c02e8db8fdd22b107299e6e3a1b0040372774 | Add python version check around use of failfast arg in test runner | chop-dbhi/varify,chop-dbhi/varify,chop-dbhi/varify,chop-dbhi/varify | tests/runner.py | tests/runner.py | import sys
import pstats
import cProfile
import unittest
from django.test.simple import DjangoTestSuiteRunner
class ProfilingTestRunner(DjangoTestSuiteRunner):
def run_suite(self, suite, **kwargs):
stream = open('profiled_tests.txt', 'w')
# failfast keyword was added in Python 2.7 so we need to l... | import pstats
import cProfile
import unittest
from django.test.simple import DjangoTestSuiteRunner
class ProfilingTestRunner(DjangoTestSuiteRunner):
def run_suite(self, suite, **kwargs):
stream = open('profiled_tests.txt', 'w')
runner = unittest.TextTestRunner(verbosity=self.verbosity, failfast=s... | bsd-2-clause | Python |
befa501a7cd3816bf5aba1b565413bbaffaf71b4 | Remove reference to PyMySQL | dabapps/django-db-queue | testsettings.py | testsettings.py | import os
import dj_database_url
DATABASES = {
'default': dj_database_url.parse(os.environ['DATABASE_URL']),
}
INSTALLED_APPS = (
'django_dbq',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.Csr... | import os
import pymysql
import dj_database_url
pymysql.install_as_MySQLdb()
DATABASES = {
'default': dj_database_url.parse(os.environ['DATABASE_URL']),
}
INSTALLED_APPS = (
'django_dbq',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.Common... | bsd-2-clause | Python |
31dd2b72b1754824fa9fef9be9ae68d3bc25f843 | update version | ToFuProject/tofu,ToFuProject/tofu | tofu/version.py | tofu/version.py | # Do not edit, pipeline versioning governed by git tags!
__version__ = '1.5.1-68-gb22c3280'
| # Do not edit, pipeline versioning governed by git tags!
__version__ = '1.5.1-67-g0983db23'
| mit | Python |
f589d0232325ed25b471e438f08c907c5caf5631 | Improve i_batch | johnwlockwood/karl_data,johnwlockwood/iter_karld_tools,johnwlockwood/stream_tap,johnwlockwood/stream_tap | karld/iter_utils.py | karld/iter_utils.py | from functools import partial
from itertools import imap
from itertools import islice
from itertools import izip_longest
from itertools import ifilter
from operator import itemgetter
from operator import is_not
def yield_getter_of(getter_maker, iterator):
"""
Iteratively map iterator over the result of getter... | from functools import partial
from itertools import chain
from itertools import imap
from itertools import islice
from operator import itemgetter
def yield_getter_of(getter_maker, iterator):
"""
Iteratively map iterator over the result of getter_maker.
:param getter_maker: function that returns a getter ... | apache-2.0 | Python |
9e7dda6d9580124588d58a3b1b615b3eb1c79a60 | Update expected hotgym result for topology changes | ywcui1990/nupic,scottpurdy/nupic,marionleborgne/nupic,ywcui1990/nupic,arhik/nupic,neuroidss/nupic,subutai/nupic,EricSB/nupic,EricSB/nupic,pulinagrawal/nupic,rcrowder/nupic,scottpurdy/nupic,vitaly-krugl/nupic,alfonsokim/nupic,rhyolight/nupic,blueburningcoder/nupic,rcrowder/nupic,marionleborgne/nupic,cogmission/nupic,rcr... | tests/integration/nupic/opf/hotgym_regression_test.py | tests/integration/nupic/opf/hotgym_regression_test.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | agpl-3.0 | Python |
1b25d2353121e2b7d24fc42fbd2b857f1131c7a4 | Align comments and actual test case. | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | csharp/ql/integration-tests/all-platforms/dotnet_run/test.py | csharp/ql/integration-tests/all-platforms/dotnet_run/test.py | import os
from create_database_utils import *
def run_codeql_database_create_stdout(args, dbname):
stdout = open(dbname + "file.txt", 'w+')
run_codeql_database_create(args, test_db=dbname, db=None, stdout=stdout, lang="csharp")
stdout.seek(0)
s = stdout.read()
stdout.close()
return s
def check... | import os
from create_database_utils import *
def run_codeql_database_create_stdout(args, dbname):
stdout = open(dbname + "file.txt", 'w+')
run_codeql_database_create(args, test_db=dbname, db=None, stdout=stdout, lang="csharp")
stdout.seek(0)
s = stdout.read()
stdout.close()
return s
def check... | mit | Python |
71a06d460678d3e4ae93320e6c0389fb735e1281 | Handle edge case for finding the first and last lines (#3342) | DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core | datadog_checks_base/datadog_checks/base/utils/agent/debug.py | datadog_checks_base/datadog_checks/base/utils/agent/debug.py | # (C) Datadog, Inc. 2019
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import inspect
import pdb
import sys
class Debugger(pdb.Pdb):
"""Modified debugger that assumes the existence of predefined break points."""
def set_trace(self, frame=None):
"""See https://githu... | # (C) Datadog, Inc. 2019
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import inspect
import pdb
import sys
class Debugger(pdb.Pdb):
"""Modified debugger that assumes the existence of predefined break points."""
def set_trace(self, frame=None):
"""See https://githu... | bsd-3-clause | Python |
faa266d1ed755a072b4614d01c4d288e9cb103ad | remove gmst convert | adrn/streams,adrn/streams | streams/observation/core.py | streams/observation/core.py | # coding: utf-8
""" Convenience functions for observational data """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
from datetime import datetime, timedelta
# Third-party
import numpy as np
import astropy.coordinates as coord
import a... | # coding: utf-8
""" Convenience functions for observational data """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
from datetime import datetime, timedelta
# Third-party
import numpy as np
import astropy.coordinates as coord
import a... | mit | Python |
91ef89371f7ba99346ba982a3fdb7fc2105a9840 | Make UsersResource reusable for LDAP | ioanpocol/superdesk-core,plamut/superdesk-core,akintolga/superdesk-core,ancafarcas/superdesk-core,ancafarcas/superdesk-core,nistormihai/superdesk-core,superdesk/superdesk-core,sivakuna-aap/superdesk-core,superdesk/superdesk-core,mdhaman/superdesk-core,petrjasek/superdesk-core,mdhaman/superdesk-core,mugurrus/superdesk-c... | superdesk/users/__init__.py | superdesk/users/__init__.py | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from .users ... | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from .users ... | agpl-3.0 | Python |
c104a71a0e861acda66dc6eedce63e4c534886d0 | Fix #22 | ebu/PlugIt,ebu/PlugIt | plugit/routes.py | plugit/routes.py | from params import PI_BASE_URL
from views import *
def load_routes(app, actions):
@app.route(PI_BASE_URL + "ping")
def ping():
"""The ping method: Just return the data provided"""
if not check_ip(request):
return
return jsonify(data=request.args.get('data', ''))
@app... | from params import PI_BASE_URL
from views import *
def load_routes(app, actions):
@app.route(PI_BASE_URL + "ping")
def ping():
"""The ping method: Just return the data provided"""
if not check_ip(request):
return
return jsonify(data=request.args.get('data', ''))
@app... | bsd-3-clause | Python |
1c35ccaf64d4132992e286a260738cfc1c126a0b | Remove unneeded print statement | bewing/napalm-base,spotify/napalm,napalm-automation/napalm-base,napalm-automation/napalm,napalm-automation/napalm-base,bewing/napalm-base,spotify/napalm | napalm_base/test/conftest.py | napalm_base/test/conftest.py | """Test fixtures."""
# Python3 support
from __future__ import print_function
from __future__ import unicode_literals
import ast
import json
import os
NAPALM_TEST_MOCK = ast.literal_eval(os.getenv('NAPALM_TEST_MOCK', default="1"))
NAPALM_HOSTNAME = os.getenv('NAPALM_HOSTNAME', default='127.0.0.1')
NAPALM_USERNAME = ... | """Test fixtures."""
# Python3 support
from __future__ import print_function
from __future__ import unicode_literals
import ast
import json
import os
NAPALM_TEST_MOCK = ast.literal_eval(os.getenv('NAPALM_TEST_MOCK', default="1"))
NAPALM_HOSTNAME = os.getenv('NAPALM_HOSTNAME', default='127.0.0.1')
NAPALM_USERNAME = ... | apache-2.0 | Python |
3d6ef1dd56d3911102dd70ece1a14a91243ea321 | Add comments to doc mongodb index instructions | chengdujin/newsman,chengdujin/newsman,chengdujin/newsman | newsman/analyzer/database.py | newsman/analyzer/database.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
database deals with saving, updating and deleting rss items to/from database
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Jul., 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('..')
from config.settings import Collec... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
database deals with saving, updating and deleting rss items to/from database
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Jul., 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('..')
from config.settings import Collec... | agpl-3.0 | Python |
2279aab257ede96c4040c9f2dff4a7664697ed45 | Clean up this test again | ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services | examples/bank/test/test_bank.py | examples/bank/test/test_bank.py | from interface.services.icontainer_agent import ContainerAgentClient
from pyon.net.endpoint import RPCClient
from pyon.public import Container
from pyon.util.int_test import IonIntegrationTestCase
from pyon.util.context import LocalContextMixin
from interface.services.examples.bank.ibank_service import BankServiceClien... | from interface.services.icontainer_agent import ContainerAgentClient
from pyon.net.endpoint import RPCClient
from pyon.public import Container
from pyon.util.int_test import IonIntegrationTestCase
from pyon.util.context import LocalContextMixin
from interface.services.examples.bank.ibank_service import BankServiceClien... | bsd-2-clause | Python |
c0b7f0566380d06d11178969053fbc8d4128e100 | Bump version 1.0.0 -> 1.0.1 | ianchesal/keybase-python,ianchesal/keybase-python | keybase/__init__.py | keybase/__init__.py | '''
.. moduleauthor:: Ian Chesal <ian.chesal@gmail.com>
'''
__version__ = '1.0.1'
__all__ = ['keybase']
| '''
.. moduleauthor:: Ian Chesal <ian.chesal@gmail.com>
'''
__version__ = '1.0.0'
__all__ = ['keybase']
| apache-2.0 | Python |
7d04677afa4759f3fa6f31826d6c9164e2ab4257 | remove debugging sentence from code | tic-ull/portal-del-investigador-cvn,tic-ull/portal-del-investigador-cvn | management/commands/fix_unit_members.py | management/commands/fix_unit_members.py | # -*- encoding: UTF-8 -*-
from cvn.models import ReportMember, ReportDept, ReportArea
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings as st
import os
import unicodecsv
from optparse import make_option
class Command(BaseCommand):
help = u'Fix memberships of depa... | # -*- encoding: UTF-8 -*-
from cvn.models import ReportMember, ReportDept, ReportArea
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings as st
import os
import unicodecsv
from optparse import make_option
class Command(BaseCommand):
help = u'Fix memberships of depa... | agpl-3.0 | Python |
9a8ea07717b594508f961cdc956f1e313f86b5df | Fix migrate.py with named argument | suspectpart/alfachat,suspectpart/alfachat | migrate.py | migrate.py | #!/usr/bin/env python3
from config import users
from models import User
if __name__ == "__main__":
users_migrated = 0
for user_id, values in users.items():
success = User(*values, uuid=user_id).save()
users_migrated += int(success)
print("Migrated {0} users".format(users_migrated))
| #!/usr/bin/env python3
from config import users
from models import User
if __name__ == "__main__":
users_migrated = 0
for user_id, values in users.items():
success = User(*values, user_id).save()
users_migrated += int(success)
print("Migrated {0} users".format(users_migrated))
| mit | Python |
7376800a8da33c4e711fbb0e70e55b63ec19e026 | Remove save method call. Ignore errors during clear outer port association setting. | nii-cloud/dodai-compute,nii-cloud/dodai-compute,nii-cloud/dodai-compute | nova/virt/dodai/ofc_utils.py | nova/virt/dodai/ofc_utils.py | from suds.client import Client
from nova import exception
from nova import db
import logging
logging.getLogger('suds').setLevel(logging.INFO)
def update_for_run_instance(service_url, region_name, server_port1, server_port2, dpid1, dpid2):
# check region name
client = Client(service_url + "?wsdl")
client... | from suds.client import Client
from nova import exception
from nova import db
import logging
logging.getLogger('suds').setLevel(logging.INFO)
def update_for_run_instance(service_url, region_name, server_port1, server_port2, dpid1, dpid2):
# check region name
client = Client(service_url + "?wsdl")
client... | apache-2.0 | Python |
4fec4d9265007f644048811eade72718ed44fa58 | Fix for issue 1423 * no longer rely on global variables for invalidating caches | SofiaReis/django-cms,11craft/django-cms,sznekol/django-cms,vad/django-cms,farhaadila/django-cms,astagi/django-cms,andyzsf/django-cms,chkir/django-cms,farhaadila/django-cms,benzkji/django-cms,bittner/django-cms,360youlun/django-cms,philippze/django-cms,DylannCordel/django-cms,jsma/django-cms,intip/django-cms,leture/djan... | cms/cache/permissions.py | cms/cache/permissions.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.cache import cache
from django.contrib.auth.models import User
PERMISSION_KEYS = [
'can_change', 'can_add', 'can_delete',
'can_change_advanced_settings', 'can_publish',
'can_change_permissions', 'can_move_page',
'can_moderate', ... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.cache import cache
permission_cache_keys = []
all_keys = []
def get_cache_key(user, key):
return "%s:permission:%s:%s" % (
settings.CMS_CACHE_PREFIX, user.username, key)
def get_permission_cache(user, key):
"""
Helper for ... | bsd-3-clause | Python |
25a0b3a36fe0d71f090f98d49291d3977a60b6a2 | Change --cleanonly to --clean | jakelever/pubrunner,jakelever/pubrunner | pubrunner/command_line.py | pubrunner/command_line.py | import pubrunner
import sys
import argparse
import os
import tempfile
import shutil
import logging
import traceback
import pyfiglet
import git
def cloneGithubRepoToTempDir(githubRepo):
tempDir = tempfile.mkdtemp()
git.Repo.clone_from(githubRepo, tempDir)
return tempDir
def main():
parser = argparse.ArgumentParser... | import pubrunner
import sys
import argparse
import os
import tempfile
import shutil
import logging
import traceback
import pyfiglet
import git
def cloneGithubRepoToTempDir(githubRepo):
tempDir = tempfile.mkdtemp()
git.Repo.clone_from(githubRepo, tempDir)
return tempDir
def main():
parser = argparse.ArgumentParser... | mit | Python |
e74cc8fed838a30bfdf3e225f3337488a9e6088c | add comments to heartbeat class | cenkalti/kuyruk,cenkalti/kuyruk | kuyruk/heartbeat.py | kuyruk/heartbeat.py | import sys
import socket
import logging
import threading
from typing import Callable
import amqp
from kuyruk.exceptions import ExcInfoType
logger = logging.getLogger(__name__)
class Heartbeat:
def __init__(self, connection: amqp.Connection, on_error: Callable[[ExcInfoType], None]) -> None:
self._conne... | import sys
import socket
import logging
import threading
from typing import Callable
import amqp
from kuyruk.exceptions import ExcInfoType
logger = logging.getLogger(__name__)
class Heartbeat:
def __init__(self, connection: amqp.Connection, on_error: Callable[[ExcInfoType], None]) -> None:
self._conne... | mit | Python |
b6a9edb5a67944bac13aebf55a19d36ed461f968 | Remove writable bit from BlobCache files | cmusatyalab/opendiamond,cmusatyalab/opendiamond,cmusatyalab/opendiamond,cmusatyalab/opendiamond,cmusatyalab/opendiamond | lib/python/opendiamond/server/blobcache.py | lib/python/opendiamond/server/blobcache.py | #
# The OpenDiamond Platform for Interactive Search
# Version 6
#
# Copyright (c) 2011 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUT... | #
# The OpenDiamond Platform for Interactive Search
# Version 6
#
# Copyright (c) 2011 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUT... | epl-1.0 | Python |
af62d47c943ece3b096ce82ecea286e4485536ab | Update some links to the openquake website | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/engine/__init__.py | openquake/engine/__init__.py | # Copyright (c) 2010-2014, 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 License, or
# (at your option) any later version.
#
# OpenQuake is distri... | # Copyright (c) 2010-2014, 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 License, or
# (at your option) any later version.
#
# OpenQuake is distri... | agpl-3.0 | Python |
88eb8ba2bc7b213790ca28a2b7ec697ad7063caa | Add the debug toolbar to the settings | sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer | settings.py | settings.py | from settings_common import *
DEBUG = TEMPLATE_DEBUG = True
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'daisyproducer_dev'
DATABASE_USER = 'eglic'
DATABASE_PASSWORD = ''
DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp', 'pipeline-20090410')
if DEBUG:
INSTALLED_APPS += ('debug_tool... | from settings_common import *
DEBUG = TEMPLATE_DEBUG = True
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'daisyproducer_dev'
DATABASE_USER = 'eglic'
DATABASE_PASSWORD = ''
DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp', 'pipeline-20090410')
| agpl-3.0 | Python |
19cc1f34fe7c61c91d8edf147bdb79945cc42838 | revert accidental commit | silverlinings/cloud-playground,googlearchive/cloud-playground,silverlinings/cloud-playground,googlearchive/cloud-playground,googlearchive/cloud-playground,silverlinings/cloud-playground,googlearchive/cloud-playground | settings.py | settings.py | """Module containing global playground constants and functions."""
import os
from google.appengine.api import app_identity
from google.appengine.api import backends
# whether or not we're running in the dev_appserver
_DEV_MODE = os.environ['SERVER_SOFTWARE'].startswith('Development/')
# namespace for playground sp... | """Module containing global playground constants and functions."""
import os
from google.appengine.api import app_identity
from google.appengine.api import backends
# whether or not we're running in the dev_appserver
_DEV_MODE = os.environ['SERVER_SOFTWARE'].startswith('Development/')
# namespace for playground sp... | apache-2.0 | Python |
05e19922a5a0f7268ce1a34e25e5deb8e9a2f5d3 | Check for trailing slash in path | rmsare/sfmtools | sfmtools.py | sfmtools.py | """ Utility functions for PhotoScan processing """
import os, sys
import PhotoScan
def align_and_clean_photos(chunk):
ncameras = len(chunk.cameras)
for frame in chunk.frames:
frame.matchPhotos()
chunk.alignCameras()
for camera in chunk.cameras:
if camera.transform is None:
... | """ Utility functions for PhotoScan processing """
import os, sys
import PhotoScan
def align_and_clean_photos(chunk):
ncameras = len(chunk.cameras)
for frame in chunk.frames:
frame.matchPhotos()
chunk.alignCameras()
for camera in chunk.cameras:
if camera.transform is None:
... | mit | Python |
2709afcea4b09157b27acf0bc151bd4c76347ce5 | Add test capturing expectation. Ref #1145. | pypa/setuptools,pypa/setuptools,pypa/setuptools | setuptools/tests/test_bdist_egg.py | setuptools/tests/test_bdist_egg.py | """develop tests
"""
import os
import re
import zipfile
import pytest
from setuptools.dist import Distribution
from . import contexts
SETUP_PY = """\
from setuptools import setup
setup(name='foo', py_modules=['hi'])
"""
@pytest.fixture(scope='function')
def setup_context(tmpdir):
with (tmpdir / 'setup.py').o... | """develop tests
"""
import os
import re
import pytest
from setuptools.dist import Distribution
from . import contexts
SETUP_PY = """\
from setuptools import setup
setup(name='foo', py_modules=['hi'])
"""
@pytest.yield_fixture
def setup_context(tmpdir):
with (tmpdir / 'setup.py').open('w') as f:
f.wr... | mit | Python |
89dfb62e00aa021933101d9941b30f2497baa02e | Fix stencil source path | trilan/stencil | stencil/base.py | stencil/base.py | import os
import optparse
import sys
from .resources import Directory, File, Template
class WrongSource(Exception):
pass
class Stencil(object):
variables = []
def __init__(self):
self.resources = []
self.context = {}
@property
def name(self):
return self.__class__.__na... | import os
import optparse
from .resources import Directory, File, Template
class WrongSource(Exception):
pass
class Stencil(object):
variables = []
def __init__(self):
self.resources = []
self.context = {}
@property
def name(self):
return self.__class__.__name__.lower(... | bsd-2-clause | Python |
b3607fb59fbd5d129b50d959946491e35610d9e4 | use UTF-8 charset for generated HTML | tim-janik/tobin | Report.py | Report.py | # Licensed GNU Affero GPL v3 or later: http://www.gnu.org/licenses/agpl.html
import datetime, Config
from HtmlStmt import * # HTML, HEAD, BODY, etc
import HtmlStmt # for tidy_html
simple_title = '%s - Usage Statistics' % Config.sitename
def _build_report_html (html_elements):
return HTML [
HEAD [
... | # Licensed GNU Affero GPL v3 or later: http://www.gnu.org/licenses/agpl.html
import datetime, Config
from HtmlStmt import * # HTML, HEAD, BODY, etc
import HtmlStmt # for tidy_html
simple_title = '%s - Usage Statistics' % Config.sitename
def _build_report_html (html_elements):
return HTML [
HEAD [
... | agpl-3.0 | Python |
842d74f65463a9f72e9b2e123540d0defdabb70e | set default patch to 8.11 & 8.12 | vingtfranc/LoLAnalyzer | RunAll.py | RunAll.py | # All script can be called at once from here
import multiprocessing
import Networks
import Modes
# Running options
cpu = max(multiprocessing.cpu_count() - 1, 1) # The number of cpu the scripts will use. I always leave 1 free so I can still use my computer
# I recommend to leave at least 1 cpu free so you can still w... | # All script can be called at once from here
import multiprocessing
import Networks
import Modes
# Running options
cpu = max(multiprocessing.cpu_count() - 1, 1) # The number of cpu the scripts will use. I always leave 1 free so I can still use my computer
# I recommend to leave at least 1 cpu free so you can still w... | mit | Python |
ce4c3d65e15487cc78b0c2f9d6fb7c67d770911a | fix the import fallback | jsocol/jingo-minify | jingo_minify/helpers.py | jingo_minify/helpers.py | from django.conf import settings
from jinja2 import Markup
from jingo import register, env
try:
from build import BUILD_ID_CSS, BUILD_ID_JS, BUILD_ID_IMG
except ImportError:
BUILD_ID_CSS = BUILD_ID_JS = BUILD_ID_IMG = 'dev'
def _build_html(items, wrapping):
"""
Wrap `items` in wrapping.
"""
... | from django.conf import settings
from jinja2 import Markup
from jingo import register, env
try:
from build import BUILD_ID_CSS, BUILD_ID_JS, BUILD_ID_IMG
except ImportError:
BUILD_ID_CSS = BUILD_ID_JS = 'dev'
def _build_html(items, wrapping):
"""
Wrap `items` in wrapping.
"""
return Markup("... | bsd-3-clause | Python |
76a4f616f090de320579b50f0888d79ed8183a5c | Add Docker logs method which uses websockets | orchardup/python-orchard,orchardup/python-orchard | orchard/api/docker_client.py | orchard/api/docker_client.py | import docker
import orchard
import websocket
from .utils import request_to_curl_command
import logging
log = logging.getLogger(__name__)
class DockerClient(docker.Client):
def __init__(self, base_url, auth_token, *args, **kwargs):
super(DockerClient, self).__init__(base_url, *args, **kwargs)
se... | import docker
import orchard
import websocket
from .utils import request_to_curl_command
import logging
log = logging.getLogger(__name__)
class DockerClient(docker.Client):
def __init__(self, base_url, auth_token, *args, **kwargs):
super(DockerClient, self).__init__(base_url, *args, **kwargs)
se... | apache-2.0 | Python |
c492102fb23b70802cf5d963dbea6ea920e54063 | Update Song.py | liamks/libpytunes,liamks/pyitunes | pyItunes/Song.py | pyItunes/Song.py | class Song:
"""
Song Attributes:
name (String)
track_id (Integer)
artist (String)
album_artist (String)
composer = None (String)
album = None (String)
genre = None (String)
kind = None (String)
size = None (Integer)
total_time = None (Integer)
track_number = None (Integer)
track_count = None (Integer)
di... | class Song:
"""
Song Attributes:
name (String)
track_id (Integer)
artist (String)
album_artist (String)
composer = None (String)
album = None (String)
genre = None (String)
kind = None (String)
size = None (Integer)
total_time = None (Integer)
track_number = None (Integer)
track_count = None (Integer)
di... | mit | Python |
b6712793106e541464d4c154e13c1718a9fdc604 | Fix touch handler if action is not taken | furbrain/tingbot-python | utils.py | utils.py |
class Struct(object):
def __init__(self, **kwds):
self.__dict__.update(kwds)
class CallbackList(object):
def __init__(self):
self._list = []
def __call__(self):
for callback in self._list:
callback()
def add(self, callback):
self._list.append(callback)
... |
class Struct(object):
def __init__(self, **kwds):
self.__dict__.update(kwds)
class CallbackList(object):
def __init__(self):
self._list = []
def __call__(self):
for callback in self._list:
callback()
def add(self, callback):
self._list.append(callback)
... | bsd-2-clause | Python |
5790ec53597595ef0bce392a695439db5206201d | Update version to install py-s3fs (#22259) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-fsspec/package.py | var/spack/repos/builtin/packages/py-fsspec/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFsspec(PythonPackage):
"""A specification for pythonic filesystems."""
homepage = "... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFsspec(PythonPackage):
"""A specification for pythonic filesystems."""
homepage = "... | lgpl-2.1 | Python |
510d118e01041cfea1a6f4b9f7d961531c5881e5 | add pretty message , have to catch errors more precisely | phil-r/chaos,eukaryote31/chaos,phil-r/chaos,chaosbot/Chaos,eamanu/Chaos,rudehn/chaos,Chaosthebot/Chaos,phil-r/chaos,botchaos/Chaos,mark-i-m/Chaos,eamanu/Chaos,amoffat/Chaos,g19fanatic/chaos,hongaar/chaos,g19fanatic/chaos,hongaar/chaos,eamanu/Chaos,g19fanatic/chaos,mark-i-m/Chaos,rudehn/chaos,Chaosthebot/Chaos,botchaos/... | twitter_api/twitterApi.py | twitter_api/twitterApi.py | #!/usr/bin/env python
import twitter
class Twitter:
def __init__(self):
consumer_key = "WXfZoJi7i8TFmrGOK5Y7dVHon"
consumer_secret = "EE46ezCkgKwy8GaKOFFCuMMoZbwDprnEXjhVMn7vI7cYaTbdcA"
access_key = "867082422885785600-AJ0LdE8vc8uMs21VDv2jrkwkQg9PClG"
access_secret = "qor8vV5kGqQ7... | #!/usr/bin/env python
import twitter
class Twitter:
def __init__(self):
consumer_key = "WXfZoJi7i8TFmrGOK5Y7dVHon"
consumer_secret = "EE46ezCkgKwy8GaKOFFCuMMoZbwDprnEXjhVMn7vI7cYaTbdcA"
access_key = "867082422885785600-AJ0LdE8vc8uMs21VDv2jrkwkQg9PClG"
access_secret = "qor8vV5kGqQ7... | mit | Python |
459b85a1b48cfedec0520a5745394e01054dbeb4 | add f1_score to validation | chinskiy/KDD-99,chinskiy/KDD-99 | utils.py | utils.py | from sklearn.metrics import confusion_matrix, accuracy_score, f1_score
def model_validation(model, X_data_train, X_data_test, Y_data_train, Y_data_test, train=True):
model.fit(X_data_train)
if train:
print('Train: ')
print(confusion_matrix(Y_data_train, model.predict(X_data_train)))
pr... | from sklearn.metrics import confusion_matrix, accuracy_score
def model_validation(model, X_data_train, X_data_test, Y_data_train, Y_data_test, train=True):
model.fit(X_data_train)
if train:
print('Train:')
print(accuracy_score(Y_data_train, model.predict(X_data_train)))
print(confusion... | mit | Python |
3958409dafd36c6f62838b4d9d5338e35e1e345b | Fix switch_to_standby handler in nocrash.py | Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector | nocrash.py | nocrash.py | #!/usr/bin/python
from sh import git
import os
import subprocess as sp
from time import sleep
import sys
# Get environment variables
ChatExchangeU = os.environ.get('ChatExchangeU')
ChatExchangeP = os.environ.get('ChatExchangeP')
if ChatExchangeU is None:
ChatExchangeU = str(input("Username: ")).strip('\r\n')
os... | #!/usr/bin/python
from sh import git
import os
import subprocess as sp
from time import sleep
import sys
# Get environment variables
ChatExchangeU = os.environ.get('ChatExchangeU')
ChatExchangeP = os.environ.get('ChatExchangeP')
if ChatExchangeU is None:
ChatExchangeU = str(input("Username: ")).strip('\r\n')
os... | apache-2.0 | Python |
8e2f9eb7c2bc18c24eea9feb5fde7740208d41ad | remove upgrade flag from nox.session.install, just use latest nox | planetlabs/planet-client-python,planetlabs/planet-client-python | noxfile.py | noxfile.py | import nox
nox.options.stop_on_first_error = True
nox.options.reuse_existing_virtualenvs = False
nox.options.sessions = ['test', 'lint', 'docs', 'install']
source_files = ("planet", "examples", "tests", "setup.py", "noxfile.py")
@nox.session(python=["3.7", "3.8", "3.9"])
def test(session):
# must include -e to... | import nox
nox.options.stop_on_first_error = True
nox.options.reuse_existing_virtualenvs = False
nox.options.sessions = ['test', 'lint', 'docs', 'install']
source_files = ("planet", "examples", "tests", "setup.py", "noxfile.py")
@nox.session(python=["3.7", "3.8", "3.9"])
def test(session):
# must include -e to... | apache-2.0 | Python |
3496d37915a7b92a23f8f133f1e36acb31d5890c | Sort events on news page by date (fix) | peterkuma/tjrapid,peterkuma/tjrapid,peterkuma/tjrapid | ob/news.py | ob/news.py | from __future__ import absolute_import
from news.app import News
from .models import Event
from datetime import date
from django.urls import reverse
from django.utils.translation import get_language
from main.models import Category
import ob.views
class OrienteeringNews(News):
def archive(self, request, *args, **... | from __future__ import absolute_import
from news.app import News
from .models import Event
from datetime import date
from django.urls import reverse
from django.utils.translation import get_language
from main.models import Category
import ob.views
class OrienteeringNews(News):
def archive(self, request, *args, **... | mit | Python |
91f2799c45c940ce34a3522b89a8d07bffbfead4 | raise NotImplementedError when encountering unimplemented operator | utgwkk/tiny-python-vm | pyvm/__init__.py | pyvm/__init__.py | import dis
from collections import deque
class PythonVM:
def __init__(self):
self._stack = deque()
self._globals = {}
self._locals = {}
def push(self, value):
self._stack.pushleft(value)
def pop(self):
return self._stack.popleft()
def eval(self, bytecode):
... | import dis
from collections import deque
class PythonVM:
def __init__(self):
self._stack = deque()
self._globals = {}
self._locals = {}
def push(self, value):
self._stack.pushleft(value)
def pop(self):
return self._stack.popleft()
def eval(self, bytecode):
... | mit | Python |
75107a7b711db207909dcd323aa4752bdf4f14b3 | use avulsion node elevation for calculating new slope, take elevation of shoreline into account while setting slope | mcflugen/avulsion-bmi,katmratliff/avulsion-bmi | rafem/downcut.py | rafem/downcut.py | #! /usr/local/bin/python
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 17 21:22:00 2015
@author: kmratliff
"""
import numpy as np
import math
from avulsion_utils import get_link_lengths
from avulsion_utils import find_new_beach_length
def cut_init(riv_i, riv_j, n, init_cut):
n[riv_i, riv_j] -= init_cut
re... | #! /usr/local/bin/python
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 17 21:22:00 2015
@author: kmratliff
"""
import numpy as np
import math
from avulsion_utils import get_link_lengths
from avulsion_utils import find_new_beach_length
def cut_init(riv_i, riv_j, n, init_cut):
n[riv_i, riv_j] -= init_cut
re... | mit | Python |
1b2990448269f27d330b8df8d860429cf92b2529 | simplify logging config | lrvick/rant,lrvick/rant | rant/__init__.py | rant/__init__.py | import sys
import logging
from argparse import ArgumentParser
from rant.install import Installer
from rant.create import Creator
from rant.build import Builder
from rant.serve import Server
logging.basicConfig(
format='%(message)s',
stream=sys.stdout,
level=logging.INFO
)
def create_parser():
parser... | import sys
import logging
from argparse import ArgumentParser
from rant.install import Installer
from rant.create import Creator
from rant.build import Builder
from rant.serve import Server
root = logging.getLogger()
root.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.INFO)
formatte... | apache-2.0 | Python |
e6486dc4a0628b63fb8787c5bcacdbf8ad1ba2be | fix typo | jluccisano/raspberry-scripts,jluccisano/raspberry-scripts | scripts/relay_control.py | scripts/relay_control.py | #!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
# GPIO/BOARD | Relay IN | Rotors | Zone
# 22/15 | R2 IN2 | 1 | B
# 18/12 | R1 IN2 | 2 | A
# 24/18 | R1 IN3 | 3 | D
# 17/11 | R1 IN4 | 4 | C
# 27/13 | R2 IN1 | 5 | E
relayIO = { "1": 15, "2":... | #!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
# GPIO/BOARD | Relay IN | Rotors | Zone
# 22/15 | R2 IN2 | 1 | B
# 18/12 | R1 IN2 | 2 | A
# 24/18 | R1 IN3 | 3 | D
# 17/11 | R1 IN4 | 4 | C
# 27/13 | R2 IN1 | 5 | E
relayIO = { "1": 15, "2":... | mit | Python |
1b6113b7fd9f368562f233ceb889b7614fa341a0 | Bump version to 0.10.0 | GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm | utils/lit/lit/__init__.py | utils/lit/lit/__init__.py | """'lit' Testing Tool"""
__author__ = 'Daniel Dunbar'
__email__ = 'daniel@minormatter.com'
__versioninfo__ = (0, 10, 0)
__version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev'
__all__ = []
from .main import main
| """'lit' Testing Tool"""
__author__ = 'Daniel Dunbar'
__email__ = 'daniel@minormatter.com'
__versioninfo__ = (0, 8, 0)
__version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev'
__all__ = []
from .main import main
| apache-2.0 | Python |
f7b9ff7d0e34b0f77208cf5d2611dc77669b8ca4 | Print out the buildslaves which failed the command | Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbo... | scripts/run_on_slaves.py | scripts/run_on_slaves.py | #!/usr/bin/env python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run a command on all buildslaves on this machine."""
import os
import socket
import subprocess
import sys
buildbot_path = o... | #!/usr/bin/env python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run a command on all buildslaves on this machine."""
import os
import socket
import subprocess
import sys
buildbot_path = o... | bsd-3-clause | Python |
b04e430fb89e07ab8303a39114c775614b263d0a | add additional color | PixelwarStudio/PyTree | Tree/cli.py | Tree/cli.py | from math import radians
import click
from PIL import Image
import svgwrite
from Tree.core import Tree
def get_format(path):
pos = path.find(".")
if pos == -1:
return False
return path[pos+1:]
@click.command()
@click.option("--length", "-l", help="The start length of tree.", type=float, defaul... | from math import radians
import click
from PIL import Image
import svgwrite
from Tree.core import Tree
def get_format(path):
pos = path.find(".")
if pos == -1:
return False
return path[pos+1:]
@click.command()
@click.option("--length", "-l", help="The start length of tree.", type=float, defaul... | mit | Python |
80084eafeba0b1f1393d4c122296457c2542fcac | Remove exceptions, add return tcc value. | lugovskoy/dts-sample-compile | __init__.py | __init__.py | #! /usr/bin/env python
# coding=utf-8
import os.path
import subprocess
class Task(object):
title = "Compilation of TCC"
version = 1
arguments = [
{"name": "prefix", "type": "text", "title": "Install directory prefix (used for configure script)"},
{"name": "patch", "type": "file", "title":... | #! /usr/bin/env python
# coding=utf-8
import os.path
import subprocess
class Task(object):
title = "Compilation of TCC"
version = 1
arguments = [
{"name": "prefix", "type": "text", "title": "Install directory prefix (used for configure script)"},
{"name": "patch", "type": "file", "title":... | apache-2.0 | Python |
a778bb871f2dbf3f9c6c96b93b915a43761c0b66 | Change argparser indentations. | anerani/fircrelay | __main__.py | __main__.py | import os
import argparse
from .fircrelaybot import FIRCRelayBot
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(
description='File pipe to IRC echobot.'
)
arg_parser.add_argument('-s', '--server', dest="server",
type=str, required=True, help="server a... | import os
import argparse
from .fircrelaybot import FIRCRelayBot
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(
description='File pipe to IRC echobot.'
)
arg_parser.add_argument(
'-s',
'--server',
dest="server",
type=str,
required=True,
... | mit | Python |
84dac979bacfe8be6c97323dcc8c97c5b8833c41 | remove debug flags | scheunemann/KASPAR,scheunemann/KASPAR,scheunemann/KASPAR | Web/site.py | Web/site.py | #!/usr/bin/env python
import os
import sys
import logging
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../robotActionController')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../')))
from Config.config import webConfig, conf... | #!/usr/bin/env python
import os
import sys
import logging
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../robotActionController')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../')))
from Config.config import webConfig, conf... | mit | Python |
fe1cc65b724919099f439cd5d4f2dd73c51fdd12 | Add newline | niun/pyoscope,pklaus/pyoscope | __init__.py | __init__.py | from oscope import *
from rigol import RigolScope
from waverunner import Waverunner
from utils import *
| from oscope import *
from rigol import RigolScope
from waverunner import Waverunner
from utils import * | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.