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 |
|---|---|---|---|---|---|---|---|---|
346bb232062ff3068882cb29fa123779a19e4ea6 | fix stderr comment, clarify stdout vs stderr | uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco | raco/test_style.py | raco/test_style.py | from nose.plugins.skip import SkipTest
import subprocess
import sys
import unittest
def check_output_and_print_stderr(args):
"""Run the specified command. If it does not exit cleanly, print the stderr
of the command to stdout. Note that stderr prints are displayed as tests
run, whereas stdout prints show ... | from nose.plugins.skip import SkipTest
import subprocess
import sys
import unittest
def check_output_and_print_stderr(args):
"""Run the specified command. If it does not exit cleanly, print the stderr
of the command to stderr"""
try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
exce... | bsd-3-clause | Python |
0039eefbfa546f24b3f10031e664341d60e4055c | Use previews in ranger fzf | darthdeus/dotfiles,darthdeus/dotfiles,darthdeus/dotfiles,darthdeus/dotfiles | ranger/commands.py | ranger/commands.py | from ranger.api.commands import Command
class fzf_select(Command):
"""
:fzf_select
Find a file using fzf.
With a prefix argument select only directories.
See: https://github.com/junegunn/fzf
"""
def execute(self):
import subprocess
import os.path
if self.quantifie... | from ranger.api.commands import Command
class fzf_select(Command):
"""
:fzf_select
Find a file using fzf.
With a prefix argument select only directories.
See: https://github.com/junegunn/fzf
"""
def execute(self):
import subprocess
import os.path
if self.quantifie... | mit | Python |
82073a946ff76a07d907cfb0a0cd8885055f36b3 | Bump version | zimeon/rdiffb | rdiffb/__init__.py | rdiffb/__init__.py | """Module config for rdiffb."""
from .rdiffb import *
# This is the one place the version number for rdiffb is stored,
# there is a regex for it in setup.py.
__version__ = '0.3.0'
| """Module config for rdiffb."""
from .rdiffb import *
# This is the one place the version number for rdiffb is stored,
# there is a regex for it in setup.py.
__version__ = '0.2.0'
| apache-2.0 | Python |
370a7b2a31d8e63b14d302f5205298f3cad0eb39 | Allow conversion of named tab for xlsx files | unpingco/csvkit,archaeogeek/csvkit,doganmeh/csvkit,snuggles08/csvkit,nriyer/csvkit,wireservice/csvkit,haginara/csvkit,matterker/csvkit,onyxfish/csvkit,gepuro/csvkit,moradology/csvkit,jpalvarezf/csvkit,elcritch/csvkit,Tabea-K/csvkit,reubano/csvkit,arowla/csvkit,bmispelon/csvkit,barentsen/csvkit,bradparks/csvkit__query_j... | csvkit/convert/xlsx.py | csvkit/convert/xlsx.py | #!/usr/bin/env python
from cStringIO import StringIO
import datetime
from openpyxl.reader.excel import load_workbook
from csvkit import CSVKitWriter
from csvkit.typeinference import NULL_TIME
def normalize_datetime(dt):
if dt.microsecond == 0:
return dt
ms = dt.microsecond
if ms < 1000:
... | #!/usr/bin/env python
from cStringIO import StringIO
import datetime
from openpyxl.reader.excel import load_workbook
from csvkit import CSVKitWriter
from csvkit.typeinference import NULL_TIME
def normalize_datetime(dt):
if dt.microsecond == 0:
return dt
ms = dt.microsecond
if ms < 1000:
... | mit | Python |
f94dc5eb7135bdf51f8ca0c71b6f6f49c2ec3fec | Update version in pip package to 0.1.2 (#23) | qiuminxu/tensorboard,shakedel/tensorboard,shakedel/tensorboard,agrubb/tensorboard,qiuminxu/tensorboard,ioeric/tensorboard,qiuminxu/tensorboard,francoisluus/tensorboard-supervise,tensorflow/tensorboard,francoisluus/tensorboard-supervise,tensorflow/tensorboard,shakedel/tensorboard,francoisluus/tensorboard-supervise,qiumi... | tensorboard/pip_package/setup.py | tensorboard/pip_package/setup.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
64078daac7791af4061bc1de7913d8a76254a4c1 | Rewrite search to use api | Aeronautics/aero | aero/adapters/pip.py | aero/adapters/pip.py | # -*- coding: utf-8 -*-
__author__ = 'nickl-'
from string import strip
from aero.__version__ import __version__
from importlib import import_module
from .base import BaseAdapter
class Pip(BaseAdapter):
"""
Pip adapter.
"""
def search(self, query):
m = import_module('pip.commands.search')
... | # -*- coding: utf-8 -*-
__author__ = 'nickl-'
from string import strip
from aero.__version__ import __version__
from importlib import import_module
from .base import BaseAdapter
class Pip(BaseAdapter):
"""
Pip adapter.
"""
def search(self, query):
response = self.command(['search', query])[0]... | bsd-3-clause | Python |
9ff47d0702e63b93938f882f75887ddf70e06a4c | Fix User.is_active(); recentchanges_userindex uses spaces in usernames. | harej/reports_bot,harej/wikiproject_scripts | reportsbot/user.py | reportsbot/user.py | # -*- coding: utf-8 -*-
from .util import to_wiki_format
__all__ = ["User"]
class User:
"""Represents a user on a particular site.
Users can be part of multiple WikiProjects.
"""
def __init__(self, bot, name):
self._bot = bot
self._name = to_wiki_format(name)
@property
def ... | # -*- coding: utf-8 -*-
from .util import to_sql_format, to_wiki_format
__all__ = ["User"]
class User:
"""Represents a user on a particular site.
Users can be part of multiple WikiProjects.
"""
def __init__(self, bot, name):
self._bot = bot
self._name = to_wiki_format(name)
@pr... | mit | Python |
9a9eb4333285d2582655ead70801c5ab7ed7d43f | add dummy local settings when not found | matiaslindgren/not-enough-bogo,matiaslindgren/not-enough-bogo,matiaslindgren/not-enough-bogo | bogo/bogoapp/settings.py | bogo/bogoapp/settings.py | try:
from bogoapp import local_settings
except ImportError:
local_settings = object()
LOGO = getattr(local_settings, "LOGO", None)
SQL_DRIVER_LIB = getattr(local_settings, "SQL_DRIVER_LIB", None)
DATABASE_PATH = getattr(local_settings, "DATABASE_PATH", None)
SQL_SCHEMA_PATH = getattr(local_settings, "SQL_SCHE... | try:
from bogoapp import local_settings
except ImportError:
pass # probably running ci tests
LOGO = getattr(local_settings, "LOGO", None)
SQL_DRIVER_LIB = getattr(local_settings, "SQL_DRIVER_LIB", None)
DATABASE_PATH = getattr(local_settings, "DATABASE_PATH", None)
SQL_SCHEMA_PATH = getattr(local_settings, "S... | mit | Python |
7e2bd3fd525a3461ef2077ab7bc2e46a3121351f | Cut default RSS caching from 10 to 5 min | theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs | bulbs/feeds/views.py | bulbs/feeds/views.py | from django.template import RequestContext
from django.utils.timezone import now
from django.views.decorators.cache import cache_control
from bulbs.content.views import ContentListView
from bulbs.special_coverage.models import SpecialCoverage
class RSSView(ContentListView):
"""Really simply, this syndicates Cont... | from django.template import RequestContext
from django.utils.timezone import now
from django.views.decorators.cache import cache_control
from bulbs.content.views import ContentListView
from bulbs.special_coverage.models import SpecialCoverage
class RSSView(ContentListView):
"""Really simply, this syndicates Cont... | mit | Python |
b700cf323ff21d8c943df93b277ce7b957f36452 | Refactor example script. | michaelconnor00/gbdxtools,michaelconnor00/gbdxtools | examples/launch_cloud_harness.py | examples/launch_cloud_harness.py | import json
import os
from osgeo import gdal
from gbdxtools import Interface
from gbdx_task_template import TaskTemplate, Task, InputPort, OutputPort
gbdx = Interface()
# data = "s3://receiving-dgcs-tdgplatform-com/054813633050_01_003" # WV02 Image over San Francisco
# aoptask = gbdx.Task("AOP_Strip_Processor", da... | import json
import os
# from osgeo import gdal
from gbdxtools import Interface
from task_template import TaskTemplate, Task, InputPort, OutputPort
gbdx = Interface()
# data = "s3://receiving-dgcs-tdgplatform-com/054813633050_01_003" # WV02 Image over San Francisco
# aoptask = gbdx.Task("AOP_Strip_Processor", data=... | mit | Python |
10701a83c8867225e94b710324e0ed21eeb945a1 | remove debug code | x89/botologist,x89/botologist,moopie/botologist,anlutro/botologist | plugins/pcdb.py | plugins/pcdb.py | import requests
import botologist.plugin
class PCDB:
comments = []
@classmethod
def get_random(cls):
if not cls.comments:
response = requests.get('http://pcdb.lutro.me',
headers={'accept': 'application/json'})
cls.comments = [c['body'] for c in response.json()['comments']]
return cls.comments.pop()... | import requests
import botologist.plugin
class PCDB:
comments = []
@classmethod
def get_random(cls):
if not cls.comments:
print('requesting')
response = requests.get('http://pcdb.lutro.me',
headers={'accept': 'application/json'})
cls.comments = [c['body'] for c in response.json()['comments']]
re... | mit | Python |
1ec10ebd7b2e1bdf4a7af46c45094ed57e8e6d77 | Update __main__.py | rogersprates/word2vec-financial-sentiment | pmi/__main__.py | pmi/__main__.py | from pmi import pmi_daily, pmi_weekly, pmi_odds_daily, pmi_odds_weekly
from pmi_odds import pmi_odds_weekly
def main():
pmi_daily()
pmi_weekly()
pmi_odds_daily()
pmi_odds_weekly()
if __name__ == "__main__":
main()
| from pmi import pmi_weekly
from pmi_odds import pmi_odds_weekly
def main():
pmi_weekly()
pmi_daily()
pmi_odds_daily()
pmi_odds_weekly()
if __name__ == "__main__":
main()
| mit | Python |
f8f3f6427a83871e60871e8fe1d048e29c7c97fc | fix hamilton bugs | opencivicdata/scrapers-ca,opencivicdata/scrapers-ca | ca_on_hamilton/people.py | ca_on_hamilton/people.py | # coding: utf-8
from pupa.scrape import Scraper
from utils import lxmlize, CanadianLegislator as Legislator
import re
COUNCIL_PAGE = 'http://www.hamilton.ca/YourElectedOfficials/WardCouncillors/'
class HamiltonPersonScraper(Scraper):
def get_people(self):
page = lxmlize(COUNCIL_PAGE)
council_node = page... | # coding: utf-8
from pupa.scrape import Scraper
from utils import lxmlize, CanadianLegislator as Legislator
import re
COUNCIL_PAGE = 'http://www.hamilton.ca/YourElectedOfficials/WardCouncillors/'
class HamiltonPersonScraper(Scraper):
def get_people(self):
page = lxmlize(COUNCIL_PAGE)
council_node = page... | mit | Python |
f5e8bfaf5c4f7a2131fbe0ffd0f8d14a316b907e | Add exception for cli command line to run interactively. | schae234/Camoco,schae234/Camoco | camoco/Exceptions.py | camoco/Exceptions.py | # Exception abstract class
class CamocoError(Exception):
pass
class CamocoExistsError(CamocoError):
'''
You tried to create a camoco object which already exists
under the same name,type combination.
'''
def __init__(self,expr,message='',*args):
self.expr = expr
self.mess... | # Exception abstract class
class CamocoError(Exception):
pass
class CamocoExistsError(CamocoError):
'''
You tried to create a camoco object which already exists
under the same name,type combination.
'''
def __init__(self,expr,message='',*args):
self.expr = expr
self.mess... | mit | Python |
23cb20a82cd725df104d39fa12b1a71d4b54d459 | Write audit log to stdout if LOG_FOLDER unconfigured | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | portal/audit.py | portal/audit.py | """AUDIT module
Maintain a log exclusively used for recording auditable events.
Any action deemed an auditable event should make a call to
auditable_event()
Audit data is also persisted in the database *audit* table.
"""
import os
import sys
import logging
from flask import current_app
from .database import db
fr... | """AUDIT module
Maintain a log exclusively used for recording auditable events.
Any action deemed an auditable event should make a call to
auditable_event()
Audit data is also persisted in the database *audit* table.
"""
import os
import sys
import logging
from flask import current_app
from .database import db
fr... | bsd-3-clause | Python |
9ec2eb47260f463750f8c810c04b41a04aa7db4b | add forgotten log handler | simbuerg/benchbuild,simbuerg/benchbuild | pprof/driver.py | pprof/driver.py | #!/usr/bin/env python
# encoding: utf-8
from plumbum import cli
from pprof import *
from sys import stderr
import logging
class PollyProfiling(cli.Application):
""" Frontend for running/building the pprof study framework """
VERSION = "0.9.6"
@cli.switch(["-v", "--verbose"], help="Enable verbose outpu... | #!/usr/bin/env python
# encoding: utf-8
from plumbum import cli
from pprof import *
import logging
class PollyProfiling(cli.Application):
""" Frontend for running/building the pprof study framework """
VERSION = "0.9.6"
@cli.switch(["-v", "--verbose"], help="Enable verbose output")
def verbose(sel... | mit | Python |
718e8c5ebf24e77bb55d34c18d676ff2fd1aedcf | Bump version to 1.0.2 | portfoliome/cenaming | cenaming/_version.py | cenaming/_version.py | version_info = (1, 0, 2)
__version__ = '.'.join(map(str, version_info))
| version_info = (1, 0, 1)
__version__ = '.'.join(map(str, version_info))
| mit | Python |
ff58d9ae580bf759fe1f2d87f304e6d178aa6f9d | Bump @graknlabs_behaviour | graknlabs/grakn,lolski/grakn,lolski/grakn,lolski/grakn,graknlabs/grakn,graknlabs/grakn,graknlabs/grakn,lolski/grakn | dependencies/graknlabs/repositories.bzl | dependencies/graknlabs/repositories.bzl | #
# Copyright (C) 2021 Grakn Labs
#
# 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 option) any later version.
#
# This program is distribut... | #
# Copyright (C) 2021 Grakn Labs
#
# 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 option) any later version.
#
# This program is distribut... | agpl-3.0 | Python |
ec68a7e723494fdf008f0a7b3159fe7c8eb49636 | fix pipeline name for travis | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | test/sphinxext/test_sphinxext.py | test/sphinxext/test_sphinxext.py | import tempfile
import os
from sequana.sphinxext import snakemakerule
from sequana.sphinxext import sequana_pipeline
from sphinx.application import Sphinx
data = """import sys, os
import sphinx
sys.path.insert(0, os.path.abspath('sphinxext'))
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
"sequ... | import tempfile
import os
from sequana.sphinxext import snakemakerule
from sequana.sphinxext import sequana_pipeline
from sphinx.application import Sphinx
data = """import sys, os
import sphinx
sys.path.insert(0, os.path.abspath('sphinxext'))
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
"sequ... | bsd-3-clause | Python |
ca6a9c84db1607f27a15ea98e53d00e52c75e7ce | Bump version to 0.10 | calve/cerberus,dkellner/cerberus,nicolaiarocci/cerberus,funkyfuture/cerberus,pyeve/cerberus,calve/cerberus,dkellner/cerberus,pyeve/cerberus,funkyfuture/cerberus,nicolaiarocci/cerberus,MacHu-GWU/cerberus-sanhe,MacHu-GWU/cerberus-sanhe | cerberus/__init__.py | cerberus/__init__.py | """
Extensible validation for Python dictionaries.
:copyright: 2012-2015 by Nicola Iarocci.
:license: ISC, see LICENSE for more details.
Full documentation is available at http://cerberus.readthedocs.org/
"""
from .cerberus import Validator, ValidationError, SchemaError
__version__ = "0.10"
__all_... | """
Extensible validation for Python dictionaries.
:copyright: 2012-2015 by Nicola Iarocci.
:license: ISC, see LICENSE for more details.
Full documentation is available at http://cerberus.readthedocs.org/
"""
from .cerberus import Validator, ValidationError, SchemaError
__version__ = "0.9.1"
__all... | isc | Python |
130c37035b6eae9cc9172faecdf828509d9fd80e | Bump version | numirias/firefed | firefed/__version__.py | firefed/__version__.py | __title__ = 'firefed'
__version__ = '0.1.14'
__description__ = 'A tool for Firefox profile analysis, data extraction, \
forensics and hardening'
__url__ = 'https://github.com/numirias/firefed'
__author__ = 'numirias'
__author_email__ = 'numirias@users.noreply.github.com'
__license__ = 'MIT'
__keywords__ = 'firefox secu... | __title__ = 'firefed'
__version__ = '0.1.13'
__description__ = 'A tool for Firefox profile analysis, data extraction, \
forensics and hardening'
__url__ = 'https://github.com/numirias/firefed'
__author__ = 'numirias'
__author_email__ = 'numirias@users.noreply.github.com'
__license__ = 'MIT'
__keywords__ = 'firefox secu... | mit | Python |
390ffbea26155832ca8baae3e2a5176a43d936f3 | Update emoji set. | Fillll/reddit2telegram,nsiregar/reddit2telegram,Fillll/reddit2telegram,nsiregar/reddit2telegram | channels/ch_boobs/app.py | channels/ch_boobs/app.py | #encoding:utf-8
import time
from utils import get_url
subreddit = 'boobs'
t_channel = '-1001052042617'
def send_post(submission, r2t):
what, url, ext = get_url(submission)
title = submission.title
link = submission.short_link
text = '{}\n{}'.format(title, link)
if what in ('gif', 'img'):
... | #encoding:utf-8
import time
from utils import get_url
subreddit = 'boobs'
t_channel = '-1001052042617'
def send_post(submission, r2t):
what, url, ext = get_url(submission)
title = submission.title
link = submission.short_link
text = '{}\n{}'.format(title, link)
if what in ('gif', 'img'):
... | mit | Python |
73d12ed0e09c948e0a92cc2f4e14ff61326f38b2 | Fix MySQL tests | rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo | testing/config/settings/mysql.py | testing/config/settings/mysql.py | DEBUG = True
SECRET_KEY = 'this is a not very secret key'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'rdmo',
'USER': 'root',
'PASSWORD': '',
'TEST': {
'CHARSET': 'utf8',
'COLLATION': 'utf8_general_ci',
}
}
}
| DEBUG = True
SECRET_KEY = 'this is a not very secret key'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'rdmo',
'USER': 'root',
'PASSWORD': ''
}
}
| apache-2.0 | Python |
96ecd1b71320b2e2da82dd06dee8f68e5101b8fc | add simple history module | IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet | django_fixmystreet/fixmystreet/admin.py | django_fixmystreet/fixmystreet/admin.py | from django.contrib import admin
from django import forms
from transmeta import canonical_fieldname
from simple_history.admin import SimpleHistoryAdmin
from django_fixmystreet.fixmystreet.models import ReportCategory, Report, ReportMainCategoryClass, FaqEntry, OrganisationEntity
class ReportCategoryClassAdmin(admin.... | from django.contrib import admin
from django import forms
from transmeta import canonical_fieldname
from simple_history.admin import SimpleHistoryAdmin
from django_fixmystreet.fixmystreet.models import ReportCategory, Report, ReportMainCategoryClass, FaqEntry, OrganisationEntity
class ReportCategoryClassAdmin(admin.... | agpl-3.0 | Python |
137c0f94f51d9f2f8cc84344b79ca8ad2c85b547 | Allow calling optimize from fontcrunch directly | googlefonts/fontcrunch,googlefonts/quadopt,googlefonts/quadopt,googlefonts/fontcrunch,moyogo/fontcrunch,moyogo/fontcrunch | fontcrunch/__init__.py | fontcrunch/__init__.py | from .fontcrunch import optimize
| apache-2.0 | Python | |
5232ba997d65cb2bdc52f36096f4be1216c48a4f | Fix UT | RoboCupULaval/StrategyIA,RoboCupULaval/StrategyIA | tests/STA/Tactic/go_kick_test.py | tests/STA/Tactic/go_kick_test.py |
import unittest
from time import sleep
from Util import Pose, Position
from ai.STA.Tactic.go_kick import GoKick, COMMAND_DELAY
from tests.STA.perfect_sim import PerfectSim
A_ROBOT_ID = 1
START_POSE = Pose.from_values(300, 0, 0)
START_BALL_POSITION = START_POSE.position + Position(100, 0)
GOAL_POSE = Pose.from_values... |
import unittest
from time import sleep
from Util import Pose, Position
from ai.STA.Tactic.go_kick import GoKick, COMMAND_DELAY
from tests.STA.perfect_sim import PerfectSim
A_ROBOT_ID = 1
START_POSE = Pose.from_values(300, 0, 0)
START_BALL_POSITION = START_POSE.position + Position(100, 0)
GOAL_POSE = Pose.from_values... | mit | Python |
a0ca9f5394792592658686b2729d1ce6b1497e1d | Add webpack_args argument | mnieber/dodo_commands | extra/webdev_commands/webpack.py | extra/webdev_commands/webpack.py | """Run the webpack command."""
import argparse
from dodo_commands.defaults.commands.standard_commands import DodoCommand
class Command(DodoCommand): # noqa
decorators = ['docker']
def add_arguments_imp(self, parser): # noqa
parser.add_argument(
'--args',
dest="webpack_args",... | """Run the webpack command."""
from dodo_commands.defaults.commands.standard_commands import DodoCommand
class Command(DodoCommand): # noqa
decorators = ['docker']
def handle_imp(self, **kwargs): # noqa
self.runcmd(
["webpack", "--watch-stdin"],
cwd=self.get_config("/WEBPACK... | mit | Python |
82d2c597234b57c05d1dae26920522355101b0df | return list of shares from list_shares function | shish/python-clearskies | clearskies/client.py | clearskies/client.py | from clearskies.unixjsonsocket import UnixJsonSocket
import xdg.BaseDirectory
import os
class ProtocolException(Exception):
pass
class ClearSkies(object):
def __init__(self):
data_dir = xdg.BaseDirectory.save_data_path("clearskies")
control_path = os.path.join(data_dir, "control")
se... | from clearskies.unixjsonsocket import UnixJsonSocket
import xdg.BaseDirectory
import os
class ProtocolException(Exception):
pass
class ClearSkies(object):
def __init__(self):
data_dir = xdg.BaseDirectory.save_data_path("clearskies")
control_path = os.path.join(data_dir, "control")
se... | mit | Python |
964a7be5f03a201305f5ba3165a2dc1257311cf4 | exclude c-extensions on Windows. | shinmorino/quant_sandbox,shinmorino/quant_sandbox,shinmorino/quant_sandbox | python/setup.py | python/setup.py | from setuptools import setup, find_packages, Extension
import numpy
def new_ext(name, srcs) :
ext_includes = [numpy.get_include(), '../libsqaod/include', '../libsqaod', '../libsqaod/eigen']
ext = Extension(name, srcs,
include_dirs=ext_includes,
extra_compile_args = ['-s... | from setuptools import setup, find_packages, Extension
import numpy
def new_ext(name, srcs) :
ext_includes = [numpy.get_include(), '../libsqaod/include', '../libsqaod', '../libsqaod/eigen']
ext = Extension(name, srcs,
include_dirs=ext_includes,
extra_compile_args = ['-s... | bsd-3-clause | Python |
daa22f92807ea593374ce07de7b57650c559cc8f | Add all requirements to setup.py | machenslab/dPCA,machenslab/dPCA | python/setup.py | python/setup.py | from setuptools import setup
from os.path import join, dirname
try:
# obtain long description from README
readme_path = join(dirname(__file__), "README.rst")
with open(readme_path, encoding="utf-8") as f:
README = f.read()
# remove raw html not supported by PyPI
README = "\n".join(R... | from setuptools import setup
from os.path import join, dirname
try:
# obtain long description from README
readme_path = join(dirname(__file__), "README.rst")
with open(readme_path, encoding="utf-8") as f:
README = f.read()
# remove raw html not supported by PyPI
README = "\n".join(R... | mit | Python |
f81f60257c024c8a515aeba34137801e448c42ae | Correct comment | captainwhippet/glowshow | client/glowclient.py | client/glowclient.py | #
# Filename: glowclient.py
# Author: @captainwhippet
# Created: 7 March 2014
#
# Send a command to the server running the glowserver
import pickle, socket
def send_command(host, pattern):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(host)
f = s.makefile('b')
pickle.dump(p... | #
# Filename: glowthread.py
# Author: @captainwhippet
# Created: 7 March 2014
#
# Send a command to the server running the glowserver
import pickle, socket
def send_command(host, pattern):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(host)
f = s.makefile('b')
pickle.dump(p... | mit | Python |
632c95816ba77fcfd636d598346528b780efb4c5 | Disable output buffering. | bamos/python-scripts,bamos/python-scripts | python2.7/mt.py | python2.7/mt.py | #!/usr/bin/env python2
import argparse
import multitail
import sys
# http://stackoverflow.com/questions/107705
class Unbuffered(object):
def __init__(self, stream): self.stream = stream
def write(self, data): self.stream.write(data); self.stream.flush()
def __getattr__(self, attr): return getattr(self.stream, a... | #!/usr/bin/env python2
import argparse
import multitail
parser = argparse.ArgumentParser()
parser.add_argument('files', type=str, nargs='+')
args = parser.parse_args()
for fn, line in multitail.multitail(args.files):
print("{}: {}".format(fn,line.strip()))
| mit | Python |
404eef133bf6f8eeff1d4a40851db07fa8e15546 | Revert "Update version.py" | RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu | rasa/version.py | rasa/version.py | __version__ = "1.3.0"
| __version__ = "1.3.1"
| apache-2.0 | Python |
e61917e18efa3340df1c68ff057732a8a9f77d2b | Remove unused code from hyperion/__init__.py | hyperion-rt/hyperion,hyperion-rt/hyperion,astrofrog/hyperion,bluescarni/hyperion,bluescarni/hyperion,hyperion-rt/hyperion,astrofrog/hyperion | hyperion/__init__.py | hyperion/__init__.py | from __future__ import print_function, division
import os
import glob
import hashlib
from .version import __version__
# Set up the test function
_test_runner = None
def _get_test_runner():
from .testing.helper import TestRunner
return TestRunner(__path__[0])
def test(package=None, test_path=None, args=None,... | from __future__ import print_function, division
import os
import glob
import hashlib
import h5py
from .version import __version__
data_dir = __path__[0] + '/data/'
datafiles = {}
for datafile in glob.glob(os.path.join(data_dir, '*.hdf5')):
f = h5py.File(datafile)
hash = f.attrs['asciimd5'].decode('utf-8')
... | bsd-2-clause | Python |
95d70e79fc6a55b68db824714b6fea678bd619f8 | change uuid namespace to NAMESPACE_OID | WEIZIBIN/PersonalWebsite,WEIZIBIN/PersonalWebsite,WEIZIBIN/PersonalWebsite | flask_website/xiaoice_storage.py | flask_website/xiaoice_storage.py | import uuid
work_xiaoice = {}
free_xiaoice = {}
class Xiaoice():
def __init__(self, weibo):
self._weibo = weibo
def get_weibo(self):
return self._weibo
def send_msg(self, msg):
self._weibo.post_msg_to_xiaoice(msg)
def get_msg(self):
return self._weibo.get_msg_from_x... | import uuid
work_xiaoice={}
free_xiaoice={}
UUID_NAMESPACE_XIAOICE = 'CHAT_XIAOICE'
class Xiaoice():
def __init__(self, weibo):
self._weibo = weibo
def get_weibo(self):
return self._weibo
def send_msg(self, msg):
self._weibo.post_msg_to_xiaoice(msg)
def get_msg(self):
... | mit | Python |
2270dc5f5e59a24e566a2b71c01b30495524aa4c | fix the same damn thing again | flumotion-mirror/flumotion,Flumotion/flumotion,Flumotion/flumotion,timvideos/flumotion,Flumotion/flumotion,flumotion-mirror/flumotion,timvideos/flumotion,timvideos/flumotion,Flumotion/flumotion | flumotion/test/test_pygobject.py | flumotion/test/test_pygobject.py | # vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005 Fluendo, S.L. (www.fluendo.com). All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free Software Foundation.
# This file is... | # vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005 Fluendo, S.L. (www.fluendo.com). All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free Software Foundation.
# This file is... | lgpl-2.1 | Python |
3146b2a567788ea3775acc1b1b3b6810a5b247e7 | Add max_error_len to Github module. | drwahl/i3pystatus,claria/i3pystatus,fmarchenko/i3pystatus,ismaelpuerto/i3pystatus,eBrnd/i3pystatus,teto/i3pystatus,ismaelpuerto/i3pystatus,opatut/i3pystatus,paulollivier/i3pystatus,Arvedui/i3pystatus,juliushaertl/i3pystatus,enkore/i3pystatus,ncoop/i3pystatus,onkelpit/i3pystatus,Elder-of-Ozone/i3pystatus,fmarchenko/i3py... | i3pystatus/github.py | i3pystatus/github.py | from i3pystatus import IntervalModule
import requests
import json
from i3pystatus.core import ConfigError
from i3pystatus.core.util import user_open, internet, require
class Github(IntervalModule):
"""
Check Github for pending notifications.
Requires `requests`
Formatters:
* `{unread}` - ... | from i3pystatus import IntervalModule
import requests
import json
from i3pystatus.core import ConfigError
from i3pystatus.core.util import user_open, internet, require
class Github(IntervalModule):
"""
Check Github for pending notifications.
Requires `requests`
Formatters:
* `{unread}` - ... | mit | Python |
bb23f661d259d1d272a632624ae1ee63df39983f | Update long_words.py | creativcoder/AlgorithmicProblems,creativcoder/AlgorithmicProblems,creativcoder/AlgorithmicProblems,creativcoder/AlgorithmicProblems | codeforces/long_words.py | codeforces/long_words.py | #http://codeforces.com/problemset/problem/71/A
T = int(raw_input())
while(not T == 0):
word = str(raw_input())
if len(word)>10:
print word[0]+str(len(word[1:len(word)-1]))+word[len(word)-1]
else:
print word
T-=1
| http://codeforces.com/problemset/problem/71/A
T = int(raw_input())
while(not T == 0):
word = str(raw_input())
if len(word)>10:
print word[0]+str(len(word[1:len(word)-1]))+word[len(word)-1]
else:
print word
T-=1
| mit | Python |
5da928fd9b08aeb0028b71535413159da18393b4 | Exclude inactive comics from sets editing, effectively throwing them out of the set when saved | datagutten/comics,klette/comics,jodal/comics,datagutten/comics,jodal/comics,klette/comics,jodal/comics,datagutten/comics,jodal/comics,klette/comics,datagutten/comics | comics/sets/forms.py | comics/sets/forms.py | import datetime
from django import forms
from django.template.defaultfilters import slugify
from comics.core.models import Comic
from comics.sets.models import Set
class NewSetForm(forms.ModelForm):
class Meta:
model = Set
fields = ('name',)
def save(self, commit=True):
set = super(N... | import datetime
from django import forms
from django.template.defaultfilters import slugify
from comics.core.models import Comic
from comics.sets.models import Set
class NewSetForm(forms.ModelForm):
class Meta:
model = Set
fields = ('name',)
def save(self, commit=True):
set = super(N... | agpl-3.0 | Python |
a5569ac905e3eb8faac59f2c6b7ec834235fb9e5 | Write file by dumping, not 'open()' | mcinglis/render-jinja | render_jinja.py | render_jinja.py |
# Copyright 2015 Malcolm Inglis <http://minglis.id.au>
#
# render-jinja 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.
#
# re... |
# Copyright 2015 Malcolm Inglis <http://minglis.id.au>
#
# render-jinja 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.
#
# re... | agpl-3.0 | Python |
a317656d37b0d1aa47a4133ce6ddcebec8377c75 | add fallback import for mocking library | siddhantgoel/tornado-sqlalchemy | tests/test_tornado_sqlalchemy.py | tests/test_tornado_sqlalchemy.py | from unittest import TestCase
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
from tornado_sqlalchemy import (declarative_base, MissingFactoryError,
SessionFactory, SessionMixin)
from sqlalchemy import Column, BigInteger, String
database_url = 'p... | from unittest import mock, TestCase
from tornado_sqlalchemy import (declarative_base, MissingFactoryError,
SessionFactory, SessionMixin)
from sqlalchemy import Column, BigInteger, String
database_url = 'postgres://postgres:@localhost/tornado_sqlalchemy'
Base = declarative_base()
c... | mit | Python |
8fc35cbc732ee3f9c21e80d7290ccd905b2817cb | work around different sql math in sqlite vs. mysql | therewillbecode/ichnaea,mozilla/ichnaea,mozilla/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea | ichnaea/map_stats.py | ichnaea/map_stats.py | import csv
from cStringIO import StringIO
from ichnaea.db import Measure
def map_stats_request(request):
session = request.database.session()
query = session.query(Measure.lat, Measure.lon)
rows = StringIO()
csvwriter = csv.writer(rows)
csvwriter.writerow(('lat', 'lon'))
for lat, lon in query... | import csv
from cStringIO import StringIO
from ichnaea.db import Measure
def map_stats_request(request):
session = request.database.session()
query = session.query(Measure.lat / 10000, Measure.lon / 10000)
rows = StringIO()
csvwriter = csv.writer(rows)
csvwriter.writerow(('lat', 'lon'))
for l... | apache-2.0 | Python |
ba374b4b4d5eadf8c3ba7be4e9ac7e544a06ff12 | Change the get_service to name rather then label (#251) | ONSdigital/ras-frontstage,ONSdigital/ras-frontstage,ONSdigital/ras-frontstage | frontstage/cloud/cloudfoundry.py | frontstage/cloud/cloudfoundry.py | import cfenv
class ONSCloudFoundry(object):
def __init__(self):
self._cf_env = cfenv.AppEnv()
@property
def detected(self):
return self._cf_env.app
@property
def redis(self):
return self._cf_env.get_service(name='rm-redis')
| import cfenv
class ONSCloudFoundry(object):
def __init__(self):
self._cf_env = cfenv.AppEnv()
@property
def detected(self):
return self._cf_env.app
@property
def redis(self):
return self._cf_env.get_service(label='elasticache-broker')
| mit | Python |
a8e6c67bda11b4eff18d68db3bd85faf4093b9a9 | make sure base and quote are in uppercase | nilgradisnik/coinprice-indicator | coin/exchanges/wazirx.py | coin/exchanges/wazirx.py | # Wazirx
# https://api.wazirx.com/api/v2/tickers
# By Rishabh Rawat <rishabhrawat.rishu@gmail.com>
from exchange import Exchange, CURRENCY
class Wazirx(Exchange):
name = "Wazirx"
code = "wazirx"
ticker = "https://api.wazirx.com/api/v2/tickers"
discovery = "https://api.wazirx.com/api/v2/market-status"... | # Wazirx
# https://api.wazirx.com/api/v2/tickers
# By Rishabh Rawat <rishabhrawat.rishu@gmail.com>
from exchange import Exchange, CURRENCY
class Wazirx(Exchange):
name = "Wazirx"
code = "wazirx"
ticker = "https://api.wazirx.com/api/v2/tickers"
discovery = "https://api.wazirx.com/api/v2/market-status"... | mit | Python |
0e50da41eb93c54ad6942d6efe6e775c317b526d | Fix JSON as abstract mapping, but support list too | spiral-project/daybed,spiral-project/daybed | daybed/schemas/json.py | daybed/schemas/json.py | from __future__ import absolute_import
import re
import json
from pyramid.i18n import TranslationString as _
import six
from colander import Sequence, null, Invalid, List, Mapping
from .base import registry, TypeField
__all__ = ['JSONField']
def parse_json(node, cstruct):
if cstruct is null:
return cs... | from __future__ import absolute_import
import re
import json
from pyramid.i18n import TranslationString as _
import six
from colander import Sequence, null, Invalid, List, Mapping
from .base import registry, TypeField
__all__ = ['JSONField']
def parse_json(node, cstruct):
if cstruct is null:
return cs... | bsd-3-clause | Python |
a6f0713c39ea9c86cb1bfab3918fc5a450c35d93 | Change log level on reconcile_message() logging. | closeio/nylas,PriviPK/privipk-sync-engine,Eagles2F/sync-engine,Eagles2F/sync-engine,EthanBlackburn/sync-engine,jobscore/sync-engine,EthanBlackburn/sync-engine,Eagles2F/sync-engine,nylas/sync-engine,closeio/nylas,wakermahmud/sync-engine,jobscore/sync-engine,Eagles2F/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,w... | inbox/models/util.py | inbox/models/util.py | from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from inbox.models.message import Message
from inbox.models.thread import Thread
from inbox.models.folder import Folder, FolderItem
from inbox.util.file import Lock
from inbox.log import get_logger
log = get_logger()
def reconcile_message(db_sessio... | from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from inbox.models.message import Message
from inbox.models.thread import Thread
from inbox.models.folder import Folder, FolderItem
from inbox.util.file import Lock
from inbox.log import get_logger
log = get_logger()
def reconcile_message(db_sessio... | agpl-3.0 | Python |
077fcc44f5b3f960b9ae8d246c9815180328e973 | Add response status and content to DiamondashApiErrors. | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/dashboard/client.py | go/dashboard/client.py | import json
import requests
from django.conf import settings
class DiamondashApiError(Exception):
"""
Raised when we something goes wrong while trying to interact with
diamondash api.
"""
def __init__(self, code, content, message):
super(DiamondashApiError, self).__init__(message)
... | import json
import requests
from django.conf import settings
class DiamondashApiError(Exception):
"""
Raised when we something goes wrong while trying to interact with
diamondash api.
"""
class DiamondashApiClient(object):
def make_api_url(self, path):
return '/'.join(
p.str... | bsd-3-clause | Python |
8f8eef878a5753fe7c6adf0871188f9adcf842a3 | Simplify DiamondashApiClient.get_api_auth() | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/dashboard/client.py | go/dashboard/client.py | import json
import requests
from django.conf import settings
class DiamondashApiError(Exception):
"""
Raised when we something goes wrong while trying to interact with
diamondash api.
"""
class DiamondashApiClient(object):
def make_api_url(self, path):
return '/'.join(
p.str... | import json
import requests
from django.conf import settings
class DiamondashApiError(Exception):
"""
Raised when we something goes wrong while trying to interact with
diamondash api.
"""
class DiamondashApiClient(object):
def make_api_url(self, path):
return '/'.join(
p.str... | bsd-3-clause | Python |
3f34777ba55b104b5adc8fc0194e4408f2828a6a | call outmonitor in more command | melmothx/jsonbot,melmothx/jsonbot,melmothx/jsonbot | gozerlib/plugs/more.py | gozerlib/plugs/more.py | # plugs/more.py
#
#
""" access the output cache. """
from gozerlib.commands import cmnds
from gozerlib.examples import examples
def handle_morestatus(bot, ievent):
ievent.reply("%s more entries available" % len(ievent.chan.data.outcache))
cmnds.add('more-status', handle_morestatus, ['USER', 'OPER', 'GUEST'])
ex... | # plugs/more.py
#
#
""" access the output cache. """
from gozerlib.commands import cmnds
from gozerlib.examples import examples
def handle_morestatus(bot, ievent):
ievent.reply("%s more entries available" % len(ievent.chan.data.outcache))
cmnds.add('more-status', handle_morestatus, ['USER', 'OPER', 'GUEST'])
ex... | mit | Python |
85558a8fba824fdef70e26a8cc035f6c1351a450 | test improvements and refactoring | lionleaf/dwitter,lionleaf/dwitter,lionleaf/dwitter | dwitter/tests/dweet/test_dweet_views.py | dwitter/tests/dweet/test_dweet_views.py | from django.test import TransactionTestCase, Client
from django.contrib.auth.models import User
from dwitter.models import Dweet
from dwitter.dweet.views import fullscreen_dweet, blank_dweet
from django.utils import timezone
def wrap_content(content):
return 'function u(t) {\n ' + content + '\n }'
de... | from django.test import TransactionTestCase, Client
from django.contrib.auth.models import User
from dwitter.models import Dweet
from django.utils import timezone
class DweetTestCase(TransactionTestCase):
def setUp(self):
self.client = Client(HTTP_HOST='dweet.example.com')
self.user = User.objects... | apache-2.0 | Python |
96807c87bf17406169c24d07406678fdcf5e7549 | use the default visualization model | manuelli/director,mithrandir123/director,edowson/director,rdeits/director,mitdrc/director,mithrandir123/director,rdeits/director,RussTedrake/director,mitdrc/director,manuelli/director,empireryan/director,gizatt/director,manuelli/director,patmarion/director,openhumanoids/director,mithrandir123/director,RussTedrake/direc... | src/python/ddapp/footstepsdriverpanel.py | src/python/ddapp/footstepsdriverpanel.py | import PythonQt
from PythonQt import QtCore, QtGui
from ddapp import lcmUtils
from ddapp import applogic as app
from ddapp.utime import getUtime
from ddapp import objectmodel as om
from ddapp.timercallback import TimerCallback
import numpy as np
import math
def _makeButton(text, func):
b = QtGui.QPushButton(tex... | import PythonQt
from PythonQt import QtCore, QtGui
from ddapp import lcmUtils
from ddapp import applogic as app
from ddapp.utime import getUtime
from ddapp import objectmodel as om
from ddapp.timercallback import TimerCallback
import numpy as np
import math
def _makeButton(text, func):
b = QtGui.QPushButton(tex... | bsd-3-clause | Python |
cdefedaf5a7f8f2affbb8e691dd3eceb93e1708c | Update organizers.py | pyconca/2017-web,pyconca/2017-web,pyconca/2017-web,pyconca/2017-web | config/organizers.py | config/organizers.py |
ORGANIZERS = {
('Francis Deslauriers', 'https://twitter.com/frdeso_'),
('Myles Braithwaite', 'https://mylesb.ca/'),
('Peter McCormick', 'https://twitter.com/pdmccormick'),
('Terry Yanchynskyy', 'https://github.com/onebit0fme'),
('Ryan Wilson-Perkin', 'https://github.com/ryanwilsonperkin'),
('An... |
ORGANIZERS = {
('Francis Deslauriers', 'https://twitter.com/frdeso_'),
('Myles Braithwaite', 'https://mylesb.ca/'),
('Peter McCormick', 'https://twitter.com/pdmccormick'),
('Terry Yanchynskyy', 'https://github.com/onebit0fme'),
('Ryan Wilson-Perkin', 'https://github.com/ryanwilsonperkin'),
('An... | mit | Python |
e024c2ddc8a94e6c597c9d73d91dc6d0de23c19d | Update aws_security_test.py | mikhailadvani/cis-aws-automation,mikhailadvani/cis-aws-automation | aws_security_test.py | aws_security_test.py | import argparse
import boto3
import unittest
import yaml
from third_party_modules import HTMLTestRunner
from tests.iam import IamAudit
from tests.networking import NetworkingAudit
from tests.log import LoggingAudit
from tests.monitoring import MonitoringAudit
suite = unittest.TestSuite()
parser = argparse.ArgumentPar... | import argparse
import boto3
import unittest
import yaml
from third_party_modules import HTMLTestRunner
from tests.iam import IamAudit
from tests.networking import NetworkingAudit
from tests.log import LoggingAudit
from tests.monitoring import MonitoringAudit
suite = unittest.TestSuite()
parser = argparse.ArgumentPar... | apache-2.0 | Python |
18175d41a9ea136a5c65f503367e633b0c4da6b0 | print success | PepSalehi/boulder,PepSalehi/boulder | backup/some_tests.py | backup/some_tests.py | layer = qgis.utils.iface.activeLayer()
for feature in layer.getFeatures():
numberOfLane = feature['NUMLANE']
lts = feature ['_lts12']
islLTS_1 = feature['_isl_lts1']
islLTS_2 = feature['_isl_lts2']
islLTS_3 = feature['_isl_lts3']
islLTS_4 = feature['_isl_lts4']
if lts ==1 : assert islLTS... | layer = qgis.utils.iface.activeLayer()
for feature in layer.getFeatures():
numberOfLane = feature['NUMLANE']
lts = feature ['_lts12']
islLTS_1 = feature['_isl_lts1']
islLTS_2 = feature['_isl_lts2']
islLTS_3 = feature['_isl_lts3']
islLTS_4 = feature['_isl_lts4']
if lts ==1 : assert islLTS... | mit | Python |
a610e4a053481afc4eb26015aefcde18e9ccb119 | Add definitions and precedence for operators | lnishan/SQLGitHub | components/definition.py | components/definition.py | """Language definitions for SQLGitHub."""
EXIT_TOKENS = [u"exit", u"q"]
COMMAND_TOKENS = [u"select", u"from", u"where", u"group", u"order"]
OPERATOR_TOKENS = [u"interval",
u"binary", u"collate",
u"!",
u"-", u"~",
u"^",
u"*"... | """These are the reserved tokens for SQLGitHub."""
EXIT_TOKENS = [u"exit", u"q"]
COMMAND_TOKENS = [u"select", u"from", u"where", u"group", u"order"]
ALL_TOKENS = EXIT_TOKENS + COMMAND_TOKENS
| mit | Python |
9e09087606f6bd16939a5647a152507e74ae1a37 | update numpy in utils | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | disaggregator/utils.py | disaggregator/utils.py | import appliance
import pandas as pd
import numpy as np
def concatenate_traces(traces, metadata=None, how="strict"):
'''
Given a list of appliance traces, returns a single concatenated
trace. With how="strict" option, must be sampled at the same rate and
consecutive, without overlapping datapoints.
... | import appliance
import pandas
def concatenate_traces(traces, metadata=None, how="strict"):
'''
Given a list of appliance traces, returns a single concatenated
trace. With how="strict" option, must be sampled at the same rate and
consecutive, without overlapping datapoints.
'''
if not metadata:... | mit | Python |
21b4c1da359996d6e7820792e68a3304ae1490fb | Update errors.py | Beanstream-DRWP/beanstream-python | beanstream/errors.py | beanstream/errors.py | '''
Copyright 2012 Upverter Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | '''
Copyright 2012 Upverter Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | apache-2.0 | Python |
a0e133ae5d769c03b121b15de63d23ef3eae975e | Allow unicode in rewrite items | lengtche/beets,tima/beets,Andypsamp/CODjunit,shamangeorge/beets,beetbox/beets,andremiller/beets,PierreRust/beets,jackwilsdon/beets,YetAnotherNerd/beets,ruippeixotog/beets,krig/beets,LordSputnik/beets,randybias/beets,bj-yinyan/beets,ttsda/beets,Dishwishy/beets,untitaker/beets,Freso/beets,marcuskrahl/beets,LordSputnik/be... | beetsplug/rewrite.py | beetsplug/rewrite.py | # This file is part of beets.
# Copyright 2012, Adrian Sampson.
#
# 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, ... | # This file is part of beets.
# Copyright 2012, Adrian Sampson.
#
# 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, ... | mit | Python |
cd7ec0fce4cc73954d2c3769adff0373b9ef62b2 | Update control/passivity.py | python-control/python-control | control/passivity.py | control/passivity.py | '''
Author: Mark Yeatman
Date: May 15, 2022
'''
import numpy as np
try:
import cvxopt as cvx
except ImportError as e:
cvx = None
def is_passive(sys):
'''
Indicates if a linear time invarient system is passive
Constructs a linear matrix inequality and a feasibility optimization
such that i... | '''
Author: Mark Yeatman
Date: May 15, 2022
'''
import numpy as np
try:
import cvxopt as cvx
except ImportError as e:
cvx = None
def is_passive(sys):
'''
Indicates if a linear time invarient system is passive
Constructs a linear matrix inequality and a feasibility optimization
such that i... | bsd-3-clause | Python |
e13761e1bc4d225d377b357b08722eb3cfad6048 | Update package info | TamiaLab/PySkCode | skcode/__init__.py | skcode/__init__.py | """
PySkCode, Python implementation of a full-featured BBCode syntax parser library.
"""
# Package information
__author__ = "Fabien Batteix (@skywodd)"
__copyright__ = "Copyright 2016, TamiaLab"
__credits__ = ["Fabien Batteix", "TamiaLab"]
__license__ = "GPLv3"
__version__ = "1.0.7"
__maintainer__ = "Fabien Batteix"
_... | """
SkCode (Python implementation of BBcode syntax) parser library.
"""
# Package information
__author__ = "Fabien Batteix (@skywodd)"
__copyright__ = "Copyright 2015, TamiaLab"
__credits__ = ["Fabien Batteix", "TamiaLab"]
__license__ = "GPLv3"
__version__ = "1.0.7"
__maintainer__ = "Fabien Batteix"
__email__ = "fabie... | agpl-3.0 | Python |
16292bd16caf38f073a4a1a782798eb9f3c13c1b | fix name of test | Nic30/hwtLib,Nic30/hwtLib | hwtLib/mem/cam_test.py | hwtLib/mem/cam_test.py | import unittest
from hdl_toolkit.bitmask import Bitmask
from hdl_toolkit.hdlObjects.specialValues import Time, NOP
from hdl_toolkit.simulator.agentConnector import valuesToInts
from hdl_toolkit.simulator.shortcuts import simUnitVcd, simPrepare
from hwtLib.mem.cam import Cam
class CamTC(unittest.TestCase):
def t... | import unittest
from hdl_toolkit.bitmask import Bitmask
from hdl_toolkit.hdlObjects.specialValues import Time, NOP
from hdl_toolkit.simulator.agentConnector import valuesToInts
from hdl_toolkit.simulator.shortcuts import simUnitVcd, simPrepare
from hwtLib.mem.cam import Cam
class CamTC(unittest.TestCase):
def t... | mit | Python |
eee725353bee314a999c6c8d9d06959ac9f8b476 | fix edit redirect | tracon/infotv-tracon | infotv_tracon/views.py | infotv_tracon/views.py | from django.contrib.admin.views.decorators import staff_member_required
from django.core.urlresolvers import reverse
from django.conf import settings
from django.shortcuts import redirect
@staff_member_required(login_url=settings.LOGIN_URL)
def infotv_edit_redirect_view(self, event):
return redirect(reverse('info... | from django.contrib.admin.views.decorators import staff_member_required
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
@staff_member_required
def infotv_edit_redirect_view(self, event):
return redirect(reverse('infotv_view', args=(event,)) + '?edit=1')
| mit | Python |
2fd2ff02401339990029cc7270f912db32026230 | allow msg comparison and use repr instead of str | bndl/bndl,bndl/bndl | bndl/net/messages.py | bndl/net/messages.py | _msgtypes = {}
class Field(object):
pass
class MessageType(type):
def __new__(cls, name, parents, dct):
dct['__slots__'] = schema = [k for k, v in dct.items() if isinstance(v, Field)]
for k in schema:
dct.pop(k)
_msgtypes[name] = msgtype = super().__new__(cls, name, paren... | _msgtypes = {}
class Field(object):
pass
class MessageType(type):
def __new__(cls, name, parents, dct):
dct['__slots__'] = schema = [k for k, v in dct.items() if isinstance(v, Field)]
for k in schema:
dct.pop(k)
_msgtypes[name] = msgtype = super().__new__(cls, name, paren... | apache-2.0 | Python |
2f0c68f6a3fb311da9966008c0bb0e74b3e84e1b | increment patch version | qtux/instmatcher | instmatcher/version.py | instmatcher/version.py | # Copyright 2016 Matthias Gazzari
#
# 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 writ... | # Copyright 2016 Matthias Gazzari
#
# 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 writ... | apache-2.0 | Python |
53a79a15e7de62d30beedf90bef23427d554e469 | Bump to 1.1 | benjaoming/django-nyt,benjaoming/django-nyt | django_nyt/__init__.py | django_nyt/__init__.py | _disable_notifications = False
__version__ = "1.1"
default_app_config = "django_nyt.apps.DjangoNytConfig"
def notify(*args, **kwargs):
"""
DEPRECATED - please access django_nyt.utils.notify
"""
from django_nyt.utils import notify
return notify(*args, **kwargs)
| _disable_notifications = False
__version__ = "1.1b2"
default_app_config = "django_nyt.apps.DjangoNytConfig"
def notify(*args, **kwargs):
"""
DEPRECATED - please access django_nyt.utils.notify
"""
from django_nyt.utils import notify
return notify(*args, **kwargs)
| apache-2.0 | Python |
452db2d2a1bc5c5ae06a44e4fff3df6f7e5b804c | add CustomGroupAdmin, PermissionAdmin and UserPermissionListAdmin | sunils34/djangotoolbox,Knotis/djangotoolbox,potatolondon/djangotoolbox-1-4,kavdev/djangotoolbox,brstrat/djangotoolbox | djangotoolbox/admin.py | djangotoolbox/admin.py | from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.contrib.auth.models import User, Group, Permission
from djangotoolbox.auth.models import UserPermissionList
class UserForm(forms.ModelForm):
class Meta:
model = User
f... | from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User, Group
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('username', 'email', 'first_name', 'last_name', 'is_active',
... | bsd-3-clause | Python |
5425e10a39ce66d3c50e730d1e7b7878e8e88eb0 | Allow /dev/urandom for PHP 7 | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/executors/PHP7.py | dmoj/executors/PHP7.py | from .php_executor import PHPExecutor
from dmoj.judgeenv import env
class Executor(PHPExecutor):
name = 'PHP7'
command = env['runtime'].get('php7')
fs = ['.*\.so', '/etc/localtime$', '.*\.ini$', '/dev/urandom$']
initialize = Executor.initialize
| from .php_executor import PHPExecutor
from dmoj.judgeenv import env
class Executor(PHPExecutor):
name = 'PHP7'
command = env['runtime'].get('php7')
fs = ['.*\.so', '/etc/localtime$', '.*\.ini$']
initialize = Executor.initialize
| agpl-3.0 | Python |
c26fd0f22a7c3de3e41f4d20379d877eaab84468 | Use xyz when autodetecting bonds with Open Babel | OpenChemistry/mongochemserver | girder/molecules/molecules/openbabel.py | girder/molecules/molecules/openbabel.py | import json
import requests
from girder.models.setting import Setting
from molecules.avogadro import convert_str as avo_convert_str
from molecules.constants import PluginSettings
from molecules.utilities.has_3d_coords import cjson_has_3d_coords
def openbabel_base_url():
base_url = Setting().get(PluginSettings.OP... | import json
import requests
from girder.models.setting import Setting
from molecules.avogadro import convert_str as avo_convert_str
from molecules.constants import PluginSettings
from molecules.utilities.has_3d_coords import cjson_has_3d_coords
def openbabel_base_url():
base_url = Setting().get(PluginSettings.OP... | bsd-3-clause | Python |
5e966cb38fd60dddf7d7abc7636e39aabfc81783 | increase version to 1.6 | Chris7/cutadapt,marcelm/cutadapt | cutadapt/__init__.py | cutadapt/__init__.py | from __future__ import print_function
import sys
__version__ = '1.6'
def check_importability():
try:
import cutadapt._align
except ImportError as e:
if 'undefined symbol' in str(e):
print("""
ERROR: A required extension module could not be imported because it is
incompatible with your system. A quick fix is ... | from __future__ import print_function
import sys
__version__ = '1.6dev'
def check_importability():
try:
import cutadapt._align
except ImportError as e:
if 'undefined symbol' in str(e):
print("""
ERROR: A required extension module could not be imported because it is
incompatible with your system. A quick fix ... | mit | Python |
3a88ec452327312a1e8d799856782acaa1854fb6 | Add initial code to support non-schemad files | andrewgross/json2parquet | json2parquet/client.py | json2parquet/client.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import pyarrow as pa
import pyarrow.parquet as pq
def ingest_data(data, schema=None):
"""
Takes an array of dictionary objects, and a pyarrow schema with column names and types.
Outputs a pyarrow Batch of the data
"""
if... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import pyarrow as pa
import pyarrow.parquet as pq
def ingest_data(data, schema):
"""
Takes an array of dictionary objects, and a pyarrow schema with column names and types.
Outputs a pyarrow Batch of the data
"""
column_... | mit | Python |
2c16c858f9be1f00065146b09b6cb39f3851081e | Add license | taigaio/taiga-back,coopsource/taiga-back,seanchen/taiga-back,xdevelsistemas/taiga-back-community,gauravjns/taiga-back,CMLL/taiga-back,dycodedev/taiga-back,gam-phon/taiga-back,joshisa/taiga-back,EvgeneOskin/taiga-back,crr0004/taiga-back,forging2012/taiga-back,astagi/taiga-back,astagi/taiga-back,gam-phon/taiga-back,gaura... | taiga/projects/userstories/validators.py | taiga/projects/userstories/validators.py | # Copyright (C) 2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.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 F... | from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from . import models
class UserStoryExistsValidator:
def validate_us_id(self, attrs, source):
value = attrs[source]
if not models.UserStory.objects.filter(pk=value).exists():
msg = _("There... | agpl-3.0 | Python |
60957d5bd4753e3f7e36366d3101d69d23dfb4a0 | Update MinimumJoystick.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/brotherbrown831/MinimumJoystick.py | home/brotherbrown831/MinimumJoystick.py | from org.myrobotlab.service import Joystick
from org.myrobotlab.service import Runtime
from time import sleep
#---------------------------------Create Services----------------------
joystick = Runtime.createAndStart("joystick","Joystick")
#----------------------Connect Peripherals-----------------------------------
jo... | from org.myrobotlab.service import Joystick
from org.myrobotlab.service import Runtime
from time import sleep
#---------------------------------Create Services----------------------
joystick = Runtime.createAndStart("joystick","Joystick")
#----------------------Define callback function for Joystick-----------
def onJ... | apache-2.0 | Python |
43f05bb600a8975c2cb406560acd1f03dc237374 | Use pytest caplog | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/pytests/unit/client/test_netapi.py | tests/pytests/unit/client/test_netapi.py | import logging
import salt.client.netapi
import salt.config
from tests.support.mock import Mock, patch
def test_run_log(caplog):
"""
test salt.client.netapi logs correct message
"""
opts = salt.config.DEFAULT_MASTER_OPTS.copy()
opts["rest_cherrypy"] = {"port": 8000}
mock_process = Mock()
... | import pytest
import salt.client.netapi
import salt.config
from tests.support.helpers import TstSuiteLoggingHandler
from tests.support.mock import Mock, patch
def test_run_log():
"""
test salt.client.netapi logs correct message
"""
opts = salt.config.DEFAULT_MASTER_OPTS.copy()
opts["rest_cherrypy"... | apache-2.0 | Python |
51afb5757ae7715b28df4e8991d1d3cebe9df07c | Remove pdb | michaelkuty/feincms-elephantblog,feincms/feincms-elephantblog,michaelkuty/feincms-elephantblog,matthiask/feincms-elephantblog,sbaechler/feincms-elephantblog,feincms/feincms-elephantblog,matthiask/feincms-elephantblog,sbaechler/feincms-elephantblog,michaelkuty/feincms-elephantblog,matthiask/feincms-elephantblog,sbaechle... | tests/testapp/tests/test_templatetags.py | tests/testapp/tests/test_templatetags.py | # coding: utf-8
from __future__ import absolute_import, unicode_literals
import django
from django.template.loader import render_to_string
from django.test import TransactionTestCase
from django.test.utils import override_settings
from .factories import EntryFactory, create_entries, create_category
class TemplateTag... | # coding: utf-8
from __future__ import absolute_import, unicode_literals
import django
from django.template.loader import render_to_string
from django.test import TransactionTestCase
from django.test.utils import override_settings
from .factories import EntryFactory, create_entries, create_category
class TemplateTag... | bsd-3-clause | Python |
a59a06fbb1e7771a0372ba67dd9ca2af55fa5fb7 | update issuer in supplier invoice | thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons | tko_coexiste_purchase/models/purchase.py | tko_coexiste_purchase/models/purchase.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... | agpl-3.0 | Python |
e0b14d9f1a89b446f78bc6af8eb47dffb3cc1e6a | Revise class name | bowen0701/algorithms_data_structures | lc0046_permutations.py | lc0046_permutations.py | """Leetcode 46. Permutations
Medium
URL: https://leetcode.com/problems/permutations/
Given a collection of distinct integers, return all possible permutations.
Example:
Input: [1,2,3]
Output:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]
"""
class SolutionBacktrack(object):
def _backtrack... | """Leetcode 46. Permutations
Medium
URL: https://leetcode.com/problems/permutations/
Given a collection of distinct integers, return all possible permutations.
Example:
Input: [1,2,3]
Output:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]
"""
class Solution(object):
def _backtrack(self, re... | bsd-2-clause | Python |
ec8d7b035617f9239a0a52be346d8611cf77cb6f | Add few oc wrappers for future resiliency testing | jpopelka/fabric8-analytics-common,tisnik/fabric8-analytics-common,jpopelka/fabric8-analytics-common,tisnik/fabric8-analytics-common,tisnik/fabric8-analytics-common,jpopelka/fabric8-analytics-common | integration-tests/features/src/utils.py | integration-tests/features/src/utils.py | """Unsorted utility functions used in integration tests."""
import requests
import subprocess
def download_file_from_url(url):
"""Download file from the given URL and do basic check of response."""
assert url
response = requests.get(url)
assert response.status_code == 200
assert response.text is n... | """Unsorted utility functions used in integration tests."""
import requests
def download_file_from_url(url):
"""Download file from the given URL and do basic check of response."""
assert url
response = requests.get(url)
assert response.status_code == 200
assert response.text is not None
return... | apache-2.0 | Python |
c77518e19f061c70b9ee9b087ca8f792d3c67021 | Bump the version to 0.1.2 | othieno/geotagx-tool-validator | src/__init__.py | src/__init__.py | # -*- coding: utf-8 -*-
#
# This module is part of the GeoTag-X project validator tool.
#
# Author: Jeremy Othieno (j.othieno@gmail.com)
#
# Copyright (c) 2016-2017 UNITAR/UNOSAT
#
# The MIT License (MIT)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated do... | # -*- coding: utf-8 -*-
#
# This module is part of the GeoTag-X project validator tool.
#
# Author: Jeremy Othieno (j.othieno@gmail.com)
#
# Copyright (c) 2016-2017 UNITAR/UNOSAT
#
# The MIT License (MIT)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated do... | mit | Python |
096d1a64a3829607ae74d57c2acb4a5df4b65023 | swap a .sort() for a sorted() | StoDevX/course-data-tools,StoDevX/course-data-tools | lib/calculate_terms.py | lib/calculate_terms.py | from .flattened import flatten
from datetime import datetime
def year_plus_term(year, term):
return int(str(year) + str(term))
def find_terms_for_year(year):
now = datetime.now()
current_month = now.month
current_year = now.year
all_terms = [1, 2, 3, 4, 5]
limited_terms = [1, 2, 3]
# S... | from .flattened import flatten
from datetime import datetime
def year_plus_term(year, term):
return int(str(year) + str(term))
def find_terms_for_year(year):
now = datetime.now()
current_month = now.month
current_year = now.year
all_terms = [1, 2, 3, 4, 5]
limited_terms = [1, 2, 3]
# S... | mit | Python |
b9996fa9f697c436ae2bf829b440340b9ddceaa7 | Fix type error in `StashMixin` | divmain/GitSavvy,divmain/GitSavvy,divmain/GitSavvy | core/git_mixins/stash.py | core/git_mixins/stash.py | from collections import namedtuple
import re
from GitSavvy.core.git_command import mixin_base
Stash = namedtuple("Stash", ("id", "description"))
class StashMixin(mixin_base):
def get_stashes(self):
"""
Return a list of stashes in the repo.
"""
stdout = self.git("stash", "list")... | from collections import namedtuple
import re
from GitSavvy.core.git_command import mixin_base
Stash = namedtuple("Stash", ("id", "description"))
class StashMixin(mixin_base):
def get_stashes(self):
"""
Return a list of stashes in the repo.
"""
stdout = self.git("stash", "list")... | mit | Python |
fd5711c7acabea1ed304a3e2113b907de556e645 | Set Docker API version in the DockerOperator params | opentrials/opentrials-airflow,opentrials/opentrials-airflow | dags/cochrane_reviews.py | dags/cochrane_reviews.py | from datetime import datetime
from airflow.operators.docker_operator import DockerOperator
from airflow.models import DAG, Variable
import utils.helpers as helpers
import os
args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime.strptime('Dec 1 2016', '%b %d %Y'),
'retries': 1,
}... | from datetime import datetime
from airflow.operators.docker_operator import DockerOperator
from airflow.models import DAG, Variable
import utils.helpers as helpers
import os
args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime.strptime('Dec 1 2016', '%b %d %Y'),
'retries': 1,
}... | mpl-2.0 | Python |
545f45bda1c7f40e4fd70fd7286479d5e1cf3bed | Add optional dtype argument to _get_ang_freq_grid | dask-image/dask-ndfourier | dask_ndfourier/_utils.py | dask_ndfourier/_utils.py | # -*- coding: utf-8 -*-
import collections
import itertools
import numbers
import numpy
import dask.array
from dask_ndfourier import _compat
try:
from itertools import imap
except ImportError:
imap = map
try:
irange = xrange
except NameError:
irange = range
def _get_freq_grid(shape, chunks, dty... | # -*- coding: utf-8 -*-
import collections
import itertools
import numbers
import numpy
import dask.array
from dask_ndfourier import _compat
try:
from itertools import imap
except ImportError:
imap = map
try:
irange = xrange
except NameError:
irange = range
def _get_freq_grid(shape, chunks, dty... | bsd-3-clause | Python |
6d0c99026f8382822d49ad636b06f884f96351eb | Set version to 0.19.2 final | emory-libraries/eulexistdb,emory-libraries/eulexistdb,emory-libraries/eulexistdb | eulexistdb/__init__.py | eulexistdb/__init__.py | # file eulexistdb/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#... | # file eulexistdb/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#... | apache-2.0 | Python |
e125fc909e569a6612bf2f967fffd86ce18f7e08 | Update example url | willmcgugan/rich | examples/downloader.py | examples/downloader.py | """
A rudimentary URL downloader (like wget or curl) to demonstrate Rich progress bars.
"""
import os.path
import sys
from concurrent.futures import as_completed, ThreadPoolExecutor
import signal
from functools import partial
from threading import Event
from typing import Iterable
from urllib.request import urlopen
f... | """
A rudimentary URL downloader (like wget or curl) to demonstrate Rich progress bars.
"""
import os.path
import sys
from concurrent.futures import as_completed, ThreadPoolExecutor
import signal
from functools import partial
from threading import Event
from typing import Iterable
from urllib.request import urlopen
f... | mit | Python |
d21da3716e34576c02cc296cac4844c525fc84a5 | Fix typo | jodal/pyspotify,felix1m/pyspotify,mopidy/pyspotify,jodal/pyspotify,kotamat/pyspotify,jodal/pyspotify,mopidy/pyspotify,kotamat/pyspotify,felix1m/pyspotify,felix1m/pyspotify,kotamat/pyspotify | examples/play_track.py | examples/play_track.py | #!/usr/bin/env python
"""
This is an example of playing music from Spotify using pyspotify.
The example use the :class:`spotify.sink.AlsaSink`, and will thus only work on
systems with an ALSA sound subsystem, which means most Linux systems.
You can either run this file directly without arguments to play a default
tr... | #!/usr/bin/env python
"""
This is an example of playing music from Spotify using pyspotify.
The example use the :class:`spotify.sink.AlsaSink`, and will thus only work on
systems with an ALSA sound subsystem, which means most Linux systems.
You can either run this file directly without arguments to play a default
tr... | apache-2.0 | Python |
ee9532a9b1baa39fa8e674ff3b88b0847177c53a | Make simExample importable. | Tech-XCorp/ultracold-ions,hosseinsadeghi/ultracold-ions,hosseinsadeghi/ultracold-ions,Tech-XCorp/ultracold-ions | examples/simExample.py | examples/simExample.py | import uci.Sim as Sim
import uci.TrapConfiguration as TrapConfig
import numpy as np
def run_simulation():
t = TrapConfig.TrapConfiguration()
t.Bz = 4.5
#V0 in V/m^2
t.kz = 2.0 * 1.167e6
delta = 0.010
t.kx = -(0.5 + delta) * t.kz
t.ky = -(0.5 - delta) * t.kz
t.theta = 0
t.omega = 2.0... | import uci.Sim as Sim
import uci.TrapConfiguration as TrapConfig
import numpy as np
t = TrapConfig.TrapConfiguration()
t.Bz = 4.5
#V0 in V/m^2
t.kz = 2.0 * 1.167e6
delta = 0.010
t.kx = -(0.5 + delta) * t.kz
t.ky = -(0.5 - delta) * t.kz
t.theta = 0
t.omega = 2.0 * np.pi * 43.0e3
fundcharge = 1.602176565e-19
ionMass =... | mit | Python |
65266813c6438eeb67002e17dd4cd70a00e84b5d | Clean the code with autopen8 | daweiwu/meta-iotqa-1,ostroproject/meta-iotqa,ostroproject/meta-iotqa,ostroproject/meta-iotqa,daweiwu/meta-iotqa-1,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/meta-iotqa-1,daweiwu/meta-iotqa-1,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/meta... | meta-iotqa/lib/oeqa/runtime/boottime.py | meta-iotqa/lib/oeqa/runtime/boottime.py | #[PROTEXCAT]
#\License: ALL RIGHTS RESERVED
"""System boot time"""
import os
from oeqa.oetest import oeRuntimeTest
from oeqa.runtime.helper import collect_pnp_log
class BootTimeTest(oeRuntimeTest):
def _setup(self):
(status, output) = self.target.copy_to(
os.path.join(os.path.dirname(__file_... | #[PROTEXCAT]
#\License: ALL RIGHTS RESERVED
"""System boot time"""
import os
from oeqa.oetest import oeRuntimeTest
from oeqa.runtime.helper import collect_pnp_log
class BootTimeTest(oeRuntimeTest):
def _setup(self):
(status,output) = self.target.copy_to(os.path.join(os.path.dirname(__file__), 'files','sy... | mit | Python |
d11596b7511cdc9e6164f46436fdf66661edff3a | change way of columns' redefining | CSchool/SchoolSite,CSchool/SchoolSite,CSchool/SchoolSite,CSchool/SchoolSite | CSchoolSite/userprofile/tables.py | CSchoolSite/userprofile/tables.py | from django_datatables_view.base_datatable_view import BaseDatatableView
from django.utils.translation import ugettext_lazy as _
from userprofile.models import Relationship, User
class PossibleRelativesTable(BaseDatatableView):
max_display_length = 50
# yep, we need to redefine existed column for custom dat... | from django_datatables_view.base_datatable_view import BaseDatatableView
from django.utils.translation import ugettext_lazy as _
from userprofile.models import Relationship, User
class PossibleRelativesTable(BaseDatatableView):
max_display_length = 50
# yep, we need to redefine existed column for custom dat... | apache-2.0 | Python |
cc2685f4242fe1e1c30f82b5319edc62c5acaebb | Bump version | markstory/lint-review,markstory/lint-review,markstory/lint-review | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.2.0'
| __version__ = '2.1.2'
| mit | Python |
0aeb3aad2cd4d3f13f4e99b888fa12f9d6dbaedb | Bump version | markstory/lint-review,markstory/lint-review,markstory/lint-review | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.34.10'
| __version__ = '2.34.9'
| mit | Python |
1906c2dca105eb7ba9c69689a37c9884683d67e8 | Add License | dpnishant/appmon,dpnishant/appmon,dpnishant/appmon,dpnishant/appmon | database/__init__.py | database/__init__.py | ###
# Copyright (c) 2016 eBay Software Foundation.
#
# 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 l... | import dataset, json
from xml.sax.saxutils import escape
def save_to_database(db_path, str_json):
str_json = json.loads(str_json)
db = dataset.connect('sqlite:///%s' % (db_path.replace("'", "_")))
table = db['api_captures']
table.insert(dict(time=str_json['time'],
operation=str_json['txnType'],
artifac... | apache-2.0 | Python |
305340f912bd9b05da425100135c1825c5a738fd | Prepare rel. 0.0.15 | SEMAFORInformatik/femagtools,SEMAFORInformatik/femagtools | femagtools/__init__.py | femagtools/__init__.py | # -*- coding: utf-8 -*-
"""
femagtools
~~~~~~~~~~
Python bindings for FEMAG
:copyright: 2016 Semafor Informatik & Energie AG, Basel
:license: BSD, see LICENSE for more details.
"""
__title__ = 'femagtools'
__version__ = '0.0.15'
__author__ = 'Ronald Tanner'
__license__ = 'BSD'
__copyright__ = 'Cop... | # -*- coding: utf-8 -*-
"""
femagtools
~~~~~~~~~~
Python bindings for FEMAG
:copyright: 2016 Semafor Informatik & Energie AG, Basel
:license: BSD, see LICENSE for more details.
"""
__title__ = 'femagtools'
__version__ = '0.0.14'
__author__ = 'Ronald Tanner'
__license__ = 'BSD'
__copyright__ = 'Cop... | bsd-2-clause | Python |
4d396ccd8364b6635c54be0ef747f019a1d71af6 | Remove unnecessary code from datasift/__init__.py | datasift/datasift-python | datasift/__init__.py | datasift/__init__.py | # -*- coding: utf-8 -*-
"""
The official DataSift API library for Python. This module provides access to
the REST API and also facilitates consuming streams.
Requires Python 2.4+.
To use, 'import datasift' and create a datasift.User object passing in your
username and API key. See the examples folder for reference u... | # -*- coding: utf-8 -*-
"""
The official DataSift API library for Python. This module provides access to
the REST API and also facilitates consuming streams.
Requires Python 2.4+.
To use, 'import datasift' and create a datasift.User object passing in your
username and API key. See the examples folder for reference u... | mit | Python |
47504100712fb29b5380fcaaf2647fb85443c348 | Implement caching | Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner | lot/landmapper/urls.py | lot/landmapper/urls.py | from django.urls import include, re_path, path
from django.views.decorators.cache import cache_page
from landmapper.views import *
urlpatterns = [
# What is difference between re_path and path?
# re_path(r'',
# home, name='landmapper-home'),
path('', home, name="home"),
path('identify/', identi... | from django.urls import include, re_path, path
from landmapper.views import *
urlpatterns = [
# What is difference between re_path and path?
# re_path(r'',
# home, name='landmapper-home'),
path('', home, name="home"),
path('identify/', identify, name="identify"),
# path('/report/', report, ... | bsd-3-clause | Python |
de877d7dc98bc6cb227dbdea51df9a95281f10df | Add version to init | e-koch/FilFinder | fil_finder/__init__.py | fil_finder/__init__.py | # Licensed under an MIT open source license - see LICENSE
__version__ = "1.2.2"
from cores import *
from length import *
from pixel_ident import *
from utilities import *
from width import *
from analysis import Analysis
from filfind_class import fil_finder_2D
| # Licensed under an MIT open source license - see LICENSE
from cores import *
from length import *
from pixel_ident import *
from utilities import *
from width import *
from analysis import Analysis
from filfind_class import fil_finder_2D
| mit | Python |
4d4448e23957cc537a9e2d5c2013e4b19b24f836 | Fix imports for py34 | globocom/dbaas-zabbix,globocom/dbaas-zabbix | dbaas_zabbix/__init__.py | dbaas_zabbix/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from dbaas_zabbix.dbaas_api import DatabaseAsAServiceApi
from dbaas_zabbix.provider_factory import ProviderFactory
def factory_for(**kwargs):
databaseinfra = kwargs['databaseinfra']
del kwargs['databaseinfra']
dbaas_api = DatabaseAsAServiceApi(databaseinfra)
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from dbaas_api import DatabaseAsAServiceApi
from provider_factory import ProviderFactory
def factory_for(**kwargs):
databaseinfra = kwargs['databaseinfra']
del kwargs['databaseinfra']
dbaas_api = DatabaseAsAServiceApi(databaseinfra)
return ProviderFactor... | bsd-3-clause | Python |
6fe4f4bc8b4b564e8111aba162c00aaf7a4fc057 | Make is_local=False | Yancey1989/cloud,gongweibao/cloud,PaddlePaddle/cloud,gongweibao/cloud,PaddlePaddle/cloud,gongweibao/cloud,Yancey1989/cloud,gongweibao/cloud,PaddlePaddle/cloud,PaddlePaddle/cloud,Yancey1989/cloud,Yancey1989/cloud,PaddlePaddle/cloud,gongweibao/cloud,Yancey1989/cloud | demo/fit_a_line/train.py | demo/fit_a_line/train.py | import paddle.v2 as paddle
import pcloud.dataset.uci_housing as uci_housing
def main():
# init
paddle.init()
# network config
x = paddle.layer.data(name='x', type=paddle.data_type.dense_vector(13))
y_predict = paddle.layer.fc(input=x, size=1, act=paddle.activation.Linear())
y = paddle.layer.da... | import paddle.v2 as paddle
import pcloud.dataset.uci_housing as uci_housing
def main():
# init
paddle.init()
# network config
x = paddle.layer.data(name='x', type=paddle.data_type.dense_vector(13))
y_predict = paddle.layer.fc(input=x, size=1, act=paddle.activation.Linear())
y = paddle.layer.da... | apache-2.0 | Python |
860e16f506d0a601540847fe21e617d8f7fbf882 | Add pickle convert to json method | John-Lin/malware,John-Lin/malware | malware/pickle_tool.py | malware/pickle_tool.py | import os
import cPickle as pickle
import simplejson as json
def update_pickle(new_cache):
# print('Updated pickle')
pickle.dump(new_cache, open('url_cache.pkl', 'wb'), 2)
def check_pickle():
# print('Checking in pickle')
if not os.path.isfile('url_cache.pkl'):
malicious_url = {}
pic... | import os
import cPickle as pickle
import simplejson as json
def update_pickle(new_cache):
# print('Updated pickle')
pickle.dump(new_cache, open('url_cache.pkl', 'wb'), 2)
def check_pickle():
# print('Checking in pickle')
if not os.path.isfile('url_cache.pkl'):
malicious_url = {}
pic... | apache-2.0 | Python |
de6fea0ead5a8d2c7ffe65e1bb07249ad6823c69 | bump cifparser version to 0.0.2 | msfrank/cifparser | cifparser/version.py | cifparser/version.py | # Copyright 2015 Michael Frank <msfrank@syntaxjockey.com>
#
# This file is part of cifparser. cifparser is BSD-licensed software;
# for copyright information see the LICENSE file.
__version__ = (0, 0, 2)
def versionstring():
"""
Return the version number as a string.
"""
return "%i.%i.%i" % __version... | # Copyright 2015 Michael Frank <msfrank@syntaxjockey.com>
#
# This file is part of cifparser. cifparser is BSD-licensed software;
# for copyright information see the LICENSE file.
__version__ = (0, 0, 1)
def versionstring():
"""
Return the version number as a string.
"""
return "%i.%i.%i" % __version... | bsd-2-clause | Python |
11cf5c092cb71adb5713c414c585afca3586ff1a | Bump version - v0.2.0 | dealertrack/flake8-diff,miki725/flake8-diff | flake8diff/__init__.py | flake8diff/__init__.py | __version__ = '0.2.0'
__all__ = ['__version__']
| __version__ = '0.1.2'
__all__ = ['__version__']
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.