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 |
|---|---|---|---|---|---|---|---|---|
e6eca8a6f199413d17c4f817c3a1593b2a1bdaae | make other exceptions inherit MailboxError | icgood/pymap,icgood/pymap | pymap/exceptions.py | pymap/exceptions.py | # Copyright (c) 2014 Ian C. Good
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | # Copyright (c) 2014 Ian C. Good
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | mit | Python |
1d1f4ab922ec9bc7c33f4b36ebe13ee1dba4f199 | BUMP 0.11.1 fix a bug that broke connection pooling in 2.5 | ShaneHarvey/mongo-python-driver,inspectlabs/mongo-python-driver,WingGao/mongo-python-driver,macdiesel/mongo-python-driver,bq-xiao/mongo-python-driver,llvtt/mongo-python-driver,pigate/mongo-python-driver,marcosleonefilho/hoop-pymongo,reedobrien/mongo-python-driver,mher/pymongo,jameslittle/mongo-python-driver,ramnes/mong... | pymongo/__init__.py | pymongo/__init__.py | # Copyright 2009 10gen, 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, soft... | # Copyright 2009 10gen, 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, soft... | apache-2.0 | Python |
50b4ed55323bd54b6152f4c5793923930fc246e3 | Bump version to v1.2.0. | kivy/pyobjus,kivy/pyobjus,kivy/pyobjus | pyobjus/__init__.py | pyobjus/__init__.py | __version__ = '1.2.0'
from .pyobjus import *
| __version__ = '1.1.0'
from .pyobjus import *
| mit | Python |
0369019c108a0d9f311dbfd6af8542dfd2d24296 | Index view returns all tables meta and a truncated matrix | jussiarpalahti/rematrix,jussiarpalahti/rematrix,jussiarpalahti/rematrix,jussiarpalahti/rematrix | server/statapp/views.py | server/statapp/views.py | from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.conf import settings
from pathlib import Path
import mimetypes
import opendata.px_reader as px
def get_px(path, data=False, meta=False, sample=False):
root = Path(settings.DATA_ROOT)
doc = Path(path)
px_doc ... | from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.conf import settings
from pathlib import Path
import mimetypes
import opendata.px_reader as px
def get_px(path, data=False, meta=False):
root = Path(settings.DATA_ROOT)
doc = Path(path)
px_doc = px.Px(str(ro... | mpl-2.0 | Python |
bdf8f32358bad87fe69efe9e709a743b77fc793f | change Grammar to use an OrderedDict | dpranke/glop | analyzer.py | analyzer.py | from collections import OrderedDict
class Grammar(object):
def __init__(self, rules, start):
self.rules = rules
self.start = start
class Analyzer(object):
def __init__(self, ast):
self.ast = ast
def analyze(self):
rules = OrderedDict()
for n in self.ast:
... | class Grammar(object):
def __init__(self, rules, start='grammar'):
self.rules = rules
self.start = start
class Analyzer(object):
def __init__(self, ast):
self.ast = ast
def analyze(self):
rules = {}
for n in self.ast:
assert n[0] == 'rule'
r... | apache-2.0 | Python |
5c494c2752a332edb0b646ae31b888b301081390 | Fix unclosed file warning | Geoion/Tornado-MySQL,aio-libs/aiomysql,pulsar314/Tornado-MySQL,mosquito/Tornado-MySQL,PyMySQL/Tornado-MySQL | tornado_mysql/tests/base.py | tornado_mysql/tests/base.py | import os
import json
import tornado_mysql
import unittest
from tornado import gen
from tornado.testing import AsyncTestCase, gen_test
class PyMySQLTestCase(AsyncTestCase):
# You can specify your test environment creating a file named
# "databases.json" or editing the `databases` variable below.
fname =... | import os
import json
import tornado_mysql
import unittest
from tornado import gen
from tornado.testing import AsyncTestCase, gen_test
class PyMySQLTestCase(AsyncTestCase):
# You can specify your test environment creating a file named
# "databases.json" or editing the `databases` variable below.
fname =... | mit | Python |
4b6572964970bc72630f9b9cbe64f8a235ebeb1f | verify the URL is set | ajoubert-mitre/geoq,jdaigneau/geoq,meilinger/geoq,ngageoint/geoq,ajoubert-mitre/geoq,jdaigneau/geoq,ngageoint/geoq,stephenrjones/geoq,stephenrjones/geoq,khazhyk/geoq,meilinger/geoq,khazhyk/geoq,stephenrjones/geoq,ngageoint/geoq,jdaigneau/geoq,ngageoint/geoq,ajoubert-mitre/geoq,Pkthunder/geoq,Pkthunder/geoq,Pkthunder/ge... | geoq/core/templatetags/geoserver_job_link.py | geoq/core/templatetags/geoserver_job_link.py | # -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django import template
from django.conf import settings
register = template.Library(... | # -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django import template
from django.conf import settings
register = template.Library(... | mit | Python |
87ab24a151a0f7d13c63f560d919c561fa441a8f | Fix replay data, last action only if it's an action on that tick | matuu/tota,fisadev/tota,dmoisset/tota | tota/drawers/json_replay.py | tota/drawers/json_replay.py | import json
from os import path
from tota.game import Drawer
class JsonReplayDrawer(Drawer):
def __init__(self, replay_dir):
self.replay_dir = replay_dir
def draw(self, game):
"""Draw the world with 'ascii'-art ."""
things_data = []
tick_data = {
't': game.world.t... | import json
from os import path
from tota.game import Drawer
class JsonReplayDrawer(Drawer):
def __init__(self, replay_dir):
self.replay_dir = replay_dir
def draw(self, game):
"""Draw the world with 'ascii'-art ."""
things_data = []
tick_data = {
't': game.world.t... | mit | Python |
585cd4ba2ffb24d5dca369788bc1c823ef3d91bd | remove yield | ioiogoo/scrapy-monitor,ioiogoo/scrapy-monitor | visiter/visiter/monitor/statscol.py | visiter/visiter/monitor/statscol.py | # *-* coding:utf-8 *-*
'''
@author: ioiogoo
@date: 2016/12/25 16:50
'''
import redis
from .settings import STATS_KEYS
import time
import requests
r = redis.Redis(host='localhost', port=6379, db=0)
Time = lambda: time.strftime('%Y-%m-%d %H:%M:%S')
class StatcollectorMiddleware(object):
def __init__(self):
... | # *-* coding:utf-8 *-*
'''
@author: ioiogoo
@date: 2016/12/25 16:50
'''
import redis
from .settings import STATS_KEYS
import time
import requests
r = redis.Redis(host='localhost', port=6379, db=0)
Time = lambda: time.strftime('%Y-%m-%d %H:%M:%S')
class StatcollectorMiddleware(object):
def __init__(self):
... | mit | Python |
93075d5cea2e1b9fd22da34cfbf60647615dd41c | Reduce roku poll rate by 5s (#63952) | mezz64/home-assistant,nkgilley/home-assistant,GenericStudent/home-assistant,nkgilley/home-assistant,mezz64/home-assistant,toddeye/home-assistant,rohitranjan1991/home-assistant,w1ll1am23/home-assistant,toddeye/home-assistant,rohitranjan1991/home-assistant,rohitranjan1991/home-assistant,w1ll1am23/home-assistant,GenericSt... | homeassistant/components/roku/coordinator.py | homeassistant/components/roku/coordinator.py | """Coordinator for Roku."""
from __future__ import annotations
from datetime import datetime, timedelta
import logging
from rokuecp import Roku, RokuError
from rokuecp.models import Device
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homea... | """Coordinator for Roku."""
from __future__ import annotations
from datetime import datetime, timedelta
import logging
from rokuecp import Roku, RokuError
from rokuecp.models import Device
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homea... | apache-2.0 | Python |
e6c8300f57849a7ebcae411169383d275fd3610b | fix another view error | urbanairship/django-mithril,urbanairship/django-mithril | mithril/views.py | mithril/views.py | from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect
from mithril.forms import WhitelistForm
from mithril.middleware import WhitelistMiddleware
class WhitelistEditor(object):
template = 'mithril/whitelist_edit.html'
form_class =... | from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect
from mithril.forms import WhitelistForm
from mithril.middleware import WhitelistMiddleware
class WhitelistEditor(object):
template = 'mithril/whitelist_edit.html'
form_class =... | bsd-3-clause | Python |
1aa7de02d47544c8033ee3b7e8385f44518a239e | Implement .values_list() on QuerySet | onyb/reobject,onyb/reobject | reobject/query.py | reobject/query.py | from reobject.utils import cmp
class QuerySet(list):
def __init__(self, *args, **kwargs):
super(QuerySet, self).__init__(*args, **kwargs)
def count(self):
return len(self)
def delete(self):
for item in self:
item.delete()
def exists(self):
return bool(self... | from reobject.utils import cmp
class QuerySet(list):
def __init__(self, *args, **kwargs):
super(QuerySet, self).__init__(*args, **kwargs)
def count(self):
return len(self)
def delete(self):
for item in self:
item.delete()
def exists(self):
return bool(self... | apache-2.0 | Python |
4c5a061d129e2243c7e4f4dd68d37cd777a4c4a5 | remove pdb from test initiator | goshippo/shippo-python-client | shippo/test/__init__.py | shippo/test/__init__.py | import os
import unittest
def all():
path = os.path.dirname(os.path.realpath(__file__))
return unittest.defaultTestLoader.discover(path)
def integration():
path = os.path.dirname(os.path.realpath(__file__))
return unittest.defaultTestLoader.discover(
os.path.join(path, "integration")
)
| import os
import unittest
def all():
try:
path = os.path.dirname(os.path.realpath(__file__))
return unittest.defaultTestLoader.discover(path)
except Exception as err:
import pdb; pdb.set_trace()
print err
def integration():
path = os.path.dirname(os.path.realpath(__file__... | mit | Python |
a8def5451a1e8d655c3c3969a70a6ba6e8e98407 | fix typo in _compat | gw0/myhdl,jck/myhdl,jmgc/myhdl-numeric,jck/myhdl,myhdl/myhdl,gw0/myhdl,josyb/myhdl,jmgc/myhdl-numeric,hgomersall/myhdl,j-marjanovic/myhdl,gw0/myhdl,josyb/myhdl,juhasch/myhdl,cfelton/myhdl,hgomersall/myhdl,j-marjanovic/myhdl,juhasch/myhdl,jandecaluwe/myhdl,myhdl/myhdl,hgomersall/myhdl,jck/myhdl,jmgc/myhdl-numeric,j-marj... | myhdl/_compat.py | myhdl/_compat.py | import sys
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str, unicode)
integer_types = (int,)
long = int
import builtins
else:
string_types = (str,)
integer_types = (int, long)
long = long
import __builtin__ as builtins
| import sys
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str, unicode)
integer_types = (int,)
long = int
import builtins
else:
str_types = (str,)
integer_types = (int, long)
long = long
import __builtin__ as builtins
| lgpl-2.1 | Python |
099712644e49ab0a548141c2df38c002f11f2315 | remove _mark_area, overlap subplot should be allowed in order to get more flexibility | arraystream/simpleplotly | simpleplotly/subplot.py | simpleplotly/subplot.py | # -*- coding: utf-8 -*-
import itertools
from collections import namedtuple
class SubPlotSpec(namedtuple('SubPlotSpec', ['r', 'c', 'rs', 'cs'])):
@property
def row_end(self):
return self.r + self.rs
@property
def col_end(self):
return self.c + self.cs
@property
def location(... | # -*- coding: utf-8 -*-
import itertools
from collections import namedtuple
class SubPlotSpec(namedtuple('SubPlotSpec', ['r', 'c', 'rs', 'cs'])):
@property
def row_end(self):
return self.r + self.rs
@property
def col_end(self):
return self.c + self.cs
@property
def location(... | mit | Python |
7ff945c2f20a112e62baed9ed781c1448ed59f6a | Update version string. | unt-libraries/django-name,unt-libraries/django-name,unt-libraries/django-name | name/__init__.py | name/__init__.py | __title__ = 'Django Name'
__version__ = '4.0.0'
| __title__ = 'Django Name'
__version__ = '3.0.0'
| bsd-3-clause | Python |
b067be5cfb64e49547d81e58a994f985b8fa7ef1 | Update version | dfunckt/django-rules,ticosax/django-rules,dfunckt/django-rules,ticosax/django-rules,ticosax/django-rules,dfunckt/django-rules | rules/__init__.py | rules/__init__.py | from .permissions import add_perm, has_perm, perm_exists, remove_perm, set_perm # noqa
from .predicates import ( # noqa
Predicate,
always_allow,
always_deny,
always_false,
always_true,
is_active,
is_authenticated,
is_group_member,
is_staff,
is_superuser,
predicate,
)
from .... | from .permissions import add_perm, has_perm, perm_exists, remove_perm, set_perm # noqa
from .predicates import ( # noqa
Predicate,
always_allow,
always_deny,
always_false,
always_true,
is_active,
is_authenticated,
is_group_member,
is_staff,
is_superuser,
predicate,
)
from .... | mit | Python |
7a97d196ad3c8f1e23fc702155821fac2f3a59a0 | Update version.py | beeva-fernandocerezal/rasa_nlu,RasaHQ/rasa_nlu,PHLF/rasa_nlu,RasaHQ/rasa_nlu,PHLF/rasa_nlu,RasaHQ/rasa_nlu,beeva-fernandocerezal/rasa_nlu | rasa_nlu/version.py | rasa_nlu/version.py | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
__version__ = '0.9.0a3'
| from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
__version__ = '0.9.0a2'
| apache-2.0 | Python |
447fb3c857b89bdaced3c05a620a5162b6a7bc63 | Remove a comment | intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre | chroma-agent/chroma_agent/action_plugins/manage_conf_params.py | chroma-agent/chroma_agent/action_plugins/manage_conf_params.py | #
# ========================================================
# Copyright (c) 2012 Whamcloud, Inc. All rights reserved.
# ========================================================
import simplejson as json
from chroma_agent.shell import try_run
from chroma_agent.plugins import ActionPlugin
def set_conf_param(args):
... | #
# ========================================================
# Copyright (c) 2012 Whamcloud, Inc. All rights reserved.
# ========================================================
import simplejson as json
from chroma_agent.shell import try_run
from chroma_agent.plugins import ActionPlugin
def set_conf_param(args):
... | mit | Python |
80a9a5534cc4b746e2d966d57247e692c3e3958e | Fix counter bug | jambus/wechat-analysis | classes/analysiscomponents/wechatAnalysisCounter.py | classes/analysiscomponents/wechatAnalysisCounter.py | from functools import reduce
from collections import Counter
from classes.wechatAnalysisInterface import WechatAnalysisInterface
from classes.analysiscomponents.wechatCommonAnalysiser import WechatCommonAnalysiser
from classes.wechatMessageType import WechatMessageType
class WechatAnalysisCounter(WechatCommonAnalysis... | from functools import reduce
from collections import Counter
from classes.wechatAnalysisInterface import WechatAnalysisInterface
from classes.analysiscomponents.wechatCommonAnalysiser import WechatCommonAnalysiser
from classes.wechatMessageType import WechatMessageType
class WechatAnalysisCounter(WechatCommonAnalysis... | apache-2.0 | Python |
ba428afb83d889d112d4f6c96fc0eb16949141cb | use python path for newsblur container in disk usage sanity checker | samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur | utils/monitor_disk_usage.py | utils/monitor_disk_usage.py | #!/usr/local/bin/python3
import sys
sys.path.append('/srv/newsblur')
import subprocess
import requests
from newsblur_web import settings
import socket
def main():
df = subprocess.Popen(["df", "/"], stdout=subprocess.PIPE)
output = df.communicate()[0]
device, size, used, available, percent, mountpoint = ou... | #!/srv/newsblur/venv/newsblur3/bin/python
import sys
sys.path.append('/srv/newsblur')
import subprocess
import requests
from newsblur_web import settings
import socket
def main():
df = subprocess.Popen(["df", "/"], stdout=subprocess.PIPE)
output = df.communicate()[0]
device, size, used, available, percen... | mit | Python |
605a1807113c460cc3b5cdc36803c4c919bbddae | Extend Integration test DeepMatcher to compare datetime | yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend | yunity/utils/test.py | yunity/utils/test.py | from importlib import import_module
from json import dumps as dump_json
from json import loads as load_json
from django.utils.datetime_safe import datetime
from pkg_resources import resource_string
from django.test import RequestFactory
class DeepMatcher(object):
ANY_INT = 'AnyInt'
ANY_STRING = 'AnyString'
... | from importlib import import_module
from json import dumps as dump_json
from json import loads as load_json
from pkg_resources import resource_string
from django.test import RequestFactory
class DeepMatcher(object):
ANY_INT = 'AnyInt'
ANY_STRING = 'AnyString'
@classmethod
def _fuzzy_match_dicts(cls,... | agpl-3.0 | Python |
f333d4ffac00977114325f78e5d698422032e00e | Update integration test | gmwils/cihui | scripts/test_features.py | scripts/test_features.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Geoff Wilson <gmwils@gmail.com>
from cihui import app
from cihui.data import account, wordlist
from selenium import webdriver
from threading import Thread
import os
import tornado.ioloop
import unittest
class Server(Thread):
def __init__(self, a... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Geoff Wilson <gmwils@gmail.com>
from cihui import app, data
from selenium import webdriver
from threading import Thread
import os
import sys
import tornado.ioloop
import unittest
class Server(Thread):
def __init__(self, app):
self.app = ... | mit | Python |
2dd2adc7e684352fd525579ccde7d8234793c7bd | Change Pact repr | vmalloc/pact | pact/pact.py | pact/pact.py | from .utils import EdgeTriggered
from .base import PactBase
from .group import PactGroup
class Pact(PactBase):
def __init__(self, msg):
self.msg = msg
super(Pact, self).__init__()
self._until = []
def until(self, predicate, *args, **kwargs):
"""Adds a callback criterion for t... | from .utils import EdgeTriggered
from .base import PactBase
from .group import PactGroup
class Pact(PactBase):
def __init__(self, msg):
self.msg = msg
super(Pact, self).__init__()
self._until = []
def until(self, predicate, *args, **kwargs):
"""Adds a callback criterion for t... | bsd-3-clause | Python |
682ae24b66653353106587e1461e679ad25d1e04 | Fix server error if user profile location is empty | mikkqu/rc-chrysalis,mikkqu/rc-chrysalis,mikkqu/rc-chrysalis | scapp/profiles.py | scapp/profiles.py | from flask import json, session
from . import mongo
from . import models
def init_from_me(d):
profile = {}
# default fields
profile["name"] = '{first_name} {last_name}'.format(**d)
profile["image"] = d["image"]
profile["interests"] = d["interests"]
profile["batch_id"] = d["batch_id"]
profi... | from flask import json, session
from . import mongo
from . import models
def init_from_me(d):
profile = {}
# default fields
profile["name"] = '{first_name} {last_name}'.format(**d)
profile["image"] = d["image"]
profile["interests"] = d["interests"]
profile["batch_id"] = d["batch_id"]
profi... | bsd-2-clause | Python |
b7f7883fb78cc57cbcf0e6dcfce1a7a69dba50a9 | Increment to v0.3.1 | jrocketfingers/sanic,channelcat/sanic,ai0/sanic,ashleysommer/sanic,r0fls/sanic,lixxu/sanic,Tim-Erwin/sanic,lixxu/sanic,ashleysommer/sanic,yunstanford/sanic,ai0/sanic,yunstanford/sanic,ashleysommer/sanic,jrocketfingers/sanic,lixxu/sanic,Tim-Erwin/sanic,lixxu/sanic,yunstanford/sanic,r0fls/sanic,channelcat/sanic,channelca... | sanic/__init__.py | sanic/__init__.py | from .sanic import Sanic
from .blueprints import Blueprint
__version__ = '0.3.1'
__all__ = ['Sanic', 'Blueprint']
| from .sanic import Sanic
from .blueprints import Blueprint
__version__ = '0.3.0'
__all__ = ['Sanic', 'Blueprint']
| mit | Python |
43967a3d1353043bbc71bc3bcc9f02bcc548e48f | Fix syntax error in urls.py | bertrandvidal/stuff,bertrandvidal/stuff,bertrandvidal/stuff,bertrandvidal/stuff | djangoprojects/django_rest_framework/tutorial/tutorial/urls.py | djangoprojects/django_rest_framework/tutorial/tutorial/urls.py | """tutorial URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | """tutorial URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | unlicense | Python |
8a1967e04fc9028a35d771534875ff546500a5cc | Add support for WATSON_DIR in the fuzzer | TailorDev/Watson,TailorDev/Watson,yloiseau/Watson | scripts/fuzzer.py | scripts/fuzzer.py | import arrow
import random
import os
import sys
from watson import Watson
if not os.environ.get('WATSON_DIR'):
sys.exit(
"This script will corrupt Watson's data, please set the WATSON_DIR "
"environment variable to safely use it for development purpose."
)
watson = Watson(config_dir=os.enviro... | import arrow
import random
from watson import Watson
watson = Watson(frames=None, current=None)
projects = [
("apollo11", ["reactor", "module", "wheels", "steering", "brakes"]),
("hubble", ["lens", "camera", "transmission"]),
("voyager1", ["probe", "generators", "sensors", "antenna"]),
("voyager2", [... | mit | Python |
32def5f720b5ffb858f604dc360f66fa2a1b946a | Replace 'write' method with '__str__' | piotrekw/pirx | pirx/base.py | pirx/base.py | import collections
class Settings(object):
def __init__(self):
self._settings = collections.OrderedDict()
def __setattr__(self, name, value):
if name.startswith('_'):
super(Settings, self).__setattr__(name, value)
else:
self._settings[name] = value
def __s... | import collections
class Settings(object):
def __init__(self):
self._settings = collections.OrderedDict()
def __setattr__(self, name, value):
if name.startswith('_'):
super(Settings, self).__setattr__(name, value)
else:
self._settings[name] = value
def _se... | mit | Python |
0e2e374f0783389f4b7f8ede56c1113542924f51 | Update analysis.py | mikelambson/tcid,mikelambson/tcid,mikelambson/tcid,mikelambson/tcid | site/models/analysis.py | site/models/analysis.py | import datetime, re;
from sqlalchemy.orm import validates;
from server import DB, FlaskServer;
class Analysis(DB.Model):
id = DB.Column(DB.Integer, primary_key=True, autoincrement=True);
order_id = DB.relationship(DB.Integer, foreign_keys="order.id", lazy='dynamic');
lateral_id = DB.relationship(DB.Integer, foreig... | import datetime, re;
from sqlalchemy.orm import validates;
from server import DB, FlaskServer;
class Analysis(DB.Model):
id = DB.Column(DB.Integer, primary_key=True, autoincrement=True);
order_id = DB.relationship(DB.Integer, foreign_keys="order.id", lazy='dynamic');
lateral_id = DB.relationship(DB.Integer, foreig... | bsd-3-clause | Python |
62e32c356fc86bcd855d2931974b9df17856809e | Rename test to match preferred naming convention for macOS. | jaraco/keyring | tests/backends/test_macOS.py | tests/backends/test_macOS.py | import pytest
import keyring
from keyring.testing.backend import BackendBasicTests
from keyring.backends import macOS
@pytest.mark.skipif(
not keyring.backends.macOS.Keyring.viable,
reason="macOS backend not viable",
)
class Test_macOSKeychain(BackendBasicTests):
def init_keyring(self):
return ma... | import pytest
import keyring
from keyring.testing.backend import BackendBasicTests
from keyring.backends import macOS
@pytest.mark.skipif(
not keyring.backends.macOS.Keyring.viable,
reason="macOS backend not viable",
)
class TestOSXKeychain(BackendBasicTests):
def init_keyring(self):
return macOS... | mit | Python |
5bf19a9d84f3478eab79b6b24206cba6d4c4be96 | Fix AstroPy: Missing Markupsafe (#6630) | krafczyk/spack,tmerrick1/spack,matthiasdiener/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,iulian787/spack,mfherbst/spack,iulian787/spack,krafczyk/spack,EmreAtes/spack,iulian787/spack,matthiasdiener/spack,matthiasdiener/spack,matthiasdiener/spack,LLNL/spack,LLNL/spack,tmerrick1/spack,iulian787/spack,LLNL/sp... | var/spack/repos/builtin/packages/py-astropy/package.py | var/spack/repos/builtin/packages/py-astropy/package.py | ##############################################################################
# Copyright (c) 2013-2017, 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-2017, 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 |
7f2742ecd4ca3362e4b40f618247e9211be18b40 | add version 8.13 to r-forecast (#20974) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-forecast/package.py | var/spack/repos/builtin/packages/r-forecast/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 RForecast(RPackage):
"""Forecasting Functions for Time Series and Linear Models
Metho... | # 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 RForecast(RPackage):
"""Methods and tools for displaying and analysing univariate time
... | lgpl-2.1 | Python |
5abf70d48d2ca15e7cb99cca6775701ad432f837 | add version 0.1.22 to r-ggdendro (#20991) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-ggdendro/package.py | var/spack/repos/builtin/packages/r-ggdendro/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 RGgdendro(RPackage):
"""Create Dendrograms and Tree Diagrams Using 'ggplot2'
This is ... | # 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 RGgdendro(RPackage):
"""This is a set of tools for dendrograms and tree plots using
'g... | lgpl-2.1 | Python |
204e4227088a56a1cd21d06167ff3e15e204ca1b | Update merge_string_checker.py | amaozhao/algorithms,keon/algorithms | strings/merge_string_checker.py | strings/merge_string_checker.py | """
At a job interview, you are challenged to write an algorithm to check if a given string, s, can be formed from two other strings, part1 and part2.
The restriction is that the characters in part1 and part2 are in the same order as in s.
The interviewer gives you the following example and tells you to figure out the ... | """
At a job interview, you are challenged to write an algorithm to check if a given string, s, can be formed from two other strings, part1 and part2.
The restriction is that the characters in part1 and part2 are in the same order as in s.
The interviewer gives you the following example and tells you to figure out the ... | mit | Python |
07fd1d8fa6b4c1d4a9d7db80e40cafbde4afda22 | Fix problem with lazy translation | shirlei/helios-server,shirlei/helios-server,shirlei/helios-server,shirlei/helios-server,shirlei/helios-server | server_ui/glue.py | server_ui/glue.py | """
Glue some events together
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils.translation import ugettext as _
import helios.views, helios.signals
import views
def vote_cast_send_message(user, voter, election, cast_vote, **kwargs)... | """
Glue some events together
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils.translation import ugettext as _
import helios.views, helios.signals
import views
def vote_cast_send_message(user, voter, election, cast_vote, **kwargs)... | apache-2.0 | Python |
2994659f823f8ec79166e248b04f28f673aaf0cc | remove task functions | diox/olympia,bqbn/addons-server,wagnerand/addons-server,bqbn/addons-server,mozilla/olympia,diox/olympia,psiinon/addons-server,mozilla/addons-server,psiinon/addons-server,wagnerand/addons-server,mozilla/olympia,eviljeff/olympia,diox/olympia,diox/olympia,mozilla/olympia,mozilla/addons-server,wagnerand/addons-server,evilj... | src/olympia/reviewers/tasks.py | src/olympia/reviewers/tasks.py | import olympia.core.logger
from olympia.activity.models import ActivityLog, CommentLog, VersionLog
from olympia.addons.models import Addon
from olympia.amo.celery import task
from olympia.amo.decorators import use_primary_db
from olympia.reviewers.models import AutoApprovalSummary
from olympia.versions.models import V... | import olympia.core.logger
from olympia.activity.models import ActivityLog, CommentLog, VersionLog
from olympia.addons.models import Addon
from olympia.amo.celery import task
from olympia.amo.decorators import use_primary_db
from olympia.reviewers.models import AutoApprovalSummary
from olympia.versions.models import V... | bsd-3-clause | Python |
d26b9d22363f9763f959332d07445a2a4e7c221c | Rewrite Vimeo to use the new scope selection system | foauth/foauth.org,foauth/foauth.org,foauth/oauth-proxy,foauth/foauth.org | services/vimeo.py | services/vimeo.py | import foauth.providers
class Vimeo(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://vimeo.com/'
docs_url = 'http://developer.vimeo.com/apis/advanced'
category = 'Videos'
# URLs to interact with the API
request_token_url = 'https://vimeo.com/oauth/request_tok... | import foauth.providers
class Vimeo(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://vimeo.com/'
docs_url = 'http://developer.vimeo.com/apis/advanced'
category = 'Videos'
# URLs to interact with the API
request_token_url = 'https://vimeo.com/oauth/request_tok... | bsd-3-clause | Python |
82ca5ed324536d985bacd5b9908435a599800ca6 | remove print message (#1106) | pingcap/docs,pingcap/docs,pingcap/docs | scripts/upload.py | scripts/upload.py | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
import sys
import os
from qiniu import Auth, put_file, etag, urlsafe_base64_encode
import qiniu.config
from qiniu.compat import is_py2, is_py3
ACCESS_KEY = os.getenv('QINIU_ACCESS_KEY')
SECRET_KEY = os.getenv('QINIU_SECRET_KEY')
BUCKET_NAME = os.getenv('QINIU_BUCKET_NAME'... | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
import sys
import os
from qiniu import Auth, put_file, etag, urlsafe_base64_encode
import qiniu.config
from qiniu.compat import is_py2, is_py3
ACCESS_KEY = os.getenv('QINIU_ACCESS_KEY')
SECRET_KEY = os.getenv('QINIU_SECRET_KEY')
BUCKET_NAME = os.getenv('QINIU_BUCKET_NAME'... | apache-2.0 | Python |
00bd00f882bc9ab317a24f25b1fc51fe1781f453 | Bump version 0.1.8 | oddt/oddt,mkukielka/oddt,mkukielka/oddt,oddt/oddt | oddt/__init__.py | oddt/__init__.py | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | bsd-3-clause | Python |
92865f69561ed2da7981d2318733fd19aa95dd85 | Remove unused imports | getnikola/plugins,getnikola/plugins,getnikola/plugins | v7/meta_template/meta_template.py | v7/meta_template/meta_template.py | # -*- coding: utf-8 -*-
# Copyright © 2016 Manuel Kaufmann
# 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, mod... | # -*- coding: utf-8 -*-
# Copyright © 2016 Manuel Kaufmann
# 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, mod... | mit | Python |
b77af515bc31726377dc9b484c15c61d4454c0a4 | Fix presubmit.py exit code. | wi-ed/wi | presubmit.py | presubmit.py | #!/usr/bin/env python
# Copyright 2014 Marc-Antoine Ruel. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import os
import subprocess
import sys
import time
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def call(cmd, ... | #!/usr/bin/env python
# Copyright 2014 Marc-Antoine Ruel. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import os
import subprocess
import sys
import time
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def call(cmd, ... | apache-2.0 | Python |
1da7a1f03a3fd98b8d14eab542c090b98089676d | Add peek value | constanthatz/data-structures | priorityq.py | priorityq.py | #!/usr/bin/env python
from __future__ import print_function
class Element(object):
''' Create data element with default value and next pointer. '''
def __init__(self, value, ahead=None, behind=None, priority=0):
''' Value and next pointer default to none. '''
self.val = value
self.ahea... | #!/usr/bin/env python
from __future__ import print_function
class Element(object):
''' Create data element with default value and next pointer. '''
def __init__(self, value, ahead=None, behind=None, priority=0):
''' Value and next pointer default to none. '''
self.val = value
self.ahea... | mit | Python |
612c393ec4d964fb933ebf5b8f957ae573ae65ba | Check git_push matches without specifying a branch | nvbn/thefuck,mlk/thefuck,mlk/thefuck,nvbn/thefuck,SimenB/thefuck,Clpsplug/thefuck,scorphus/thefuck,scorphus/thefuck,SimenB/thefuck,Clpsplug/thefuck | tests/rules/test_git_push.py | tests/rules/test_git_push.py | import pytest
from thefuck.rules.git_push import match, get_new_command
from tests.utils import Command
@pytest.fixture
def stderr():
return '''fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
'''
... | import pytest
from thefuck.rules.git_push import match, get_new_command
from tests.utils import Command
@pytest.fixture
def stderr():
return '''fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
'''
... | mit | Python |
e621b9f03b19e38dc6754dd1a4cb7b172e4891e7 | Fix the extended test search | liip/html2kirby,liip/html2kirby | tests/test_extended_tests.py | tests/test_extended_tests.py | import pytest
import glob
import os
from html2kirby import HTML2Kirby
files = []
path = os.path.dirname(os.path.abspath(__file__))
extended_tests_path = os.path.join(path, "extended_tests/*.html")
for f in glob.glob(extended_tests_path):
html = f
txt = f.replace(".html", ".txt")
files.append((html, tx... | import pytest
import glob
from html2kirby import HTML2Kirby
files = []
for f in glob.glob("extended_tests/*.html"):
html = f
txt = f.replace(".html", ".txt")
files.append((html, txt))
@pytest.mark.parametrize("html,kirby", files)
def test_file(html, kirby):
formatter = HTML2Kirby()
with open(... | mit | Python |
603aacd06b99326d7dbab28e750b34589c51fa05 | Add unit test for database scenario call | SUSE/smdba,SUSE/smdba | tests/test_postgresqlgate.py | tests/test_postgresqlgate.py | # coding: utf-8
"""
Unit tests for the base gate.
"""
from unittest.mock import MagicMock, mock_open, patch
import smdba.postgresqlgate
class TestPgGt:
"""
Test suite for base gate.
"""
@patch("os.path.exists", MagicMock(side_effect=[True, False, False]))
@patch("smdba.postgresqlgate.open", new_ca... | # coding: utf-8
"""
Unit tests for the base gate.
"""
from unittest.mock import MagicMock, mock_open, patch
import smdba.postgresqlgate
class TestPgGt:
"""
Test suite for base gate.
"""
@patch("os.path.exists", MagicMock(side_effect=[True, False, False]))
@patch("smdba.postgresqlgate.open", new_ca... | mit | Python |
9a64815cd3bc4063701b68e2472bdf45a931c870 | Test larger ystart. | ihuston/pyflation,ihuston/pyflation | tests/test_saveallresults.py | tests/test_saveallresults.py | '''
Created on 22 Oct 2010
@author: ith
'''
import tables
import numpy as np
import sys
def main():
ystart = np.zeros((4,500))
callingparams = {
'datetime': '20101022173354',
'dxsav': 0.0,
'eps': 1e-10,
'potential_func': 'msqphisq',
'solver... | '''
Created on 22 Oct 2010
@author: ith
'''
import tables
import numpy as np
import sys
def main():
ystart = np.zeros((4,100))
callingparams = {
'datetime': '20101022173354',
'dxsav': 0.0,
'eps': 1e-10,
'potential_func': 'msqphisq',
'solver... | bsd-3-clause | Python |
cf16d00f53bafd8bef4d3cbb9263b11c6df6c32c | Remove the working directory if no errors are detected | columbia/neongoby,grievejia/neonGobyPort,wujingyue/neongoby,wujingyue/neongoby,columbia/neongoby,wujingyue/neongoby,grievejia/neonGobyPort,columbia/neongoby,columbia/neongoby | tools/dynaa_csmith_driver.py | tools/dynaa_csmith_driver.py | #!/usr/bin/env python
import argparse
import os
import sys
import re
import multiprocessing
# TODO: don't hardcode the path
CSMITH_HOME = '/home/jingyue/Research/csmith-2.1.0'
def run_neongoby_offline(run_id):
print >> sys.stderr, 'Run %d' % run_id
working_dir = '%s/csmith-%d' % (workspace, run_id)
os.sy... | #!/usr/bin/env python
import argparse
import os
import sys
import re
import multiprocessing
# TODO: don't hardcode the path
CSMITH_HOME = '/home/jingyue/Research/csmith-2.1.0'
def run_neongoby_offline(run_id):
print >> sys.stderr, 'Run %d' % run_id
working_dir = '%s/csmith-%d' % (workspace, run_id)
os.sy... | bsd-3-clause | Python |
2a0b1d070996bfb3d950d4fae70b264ddabc7d2f | Add function for getting installed plugins | lises/sheldon | sheldon/config.py | sheldon/config.py | # -*- coding: utf-8 -*-
"""
@author: Seva Zhidkov
@contact: zhidkovseva@gmail.com
@license: The MIT license
Copyright (C) 2015
"""
import os
class Config:
def __init__(self, prefix='SHELDON_'):
"""
Load config from environment variables.
:param prefix: string, all needed environment va... | # -*- coding: utf-8 -*-
"""
@author: Seva Zhidkov
@contact: zhidkovseva@gmail.com
@license: The MIT license
Copyright (C) 2015
"""
import os
class Config:
def __init__(self, prefix='SHELDON_'):
"""
Load config from environment variables.
:param prefix: string, all needed environment va... | mit | Python |
880bdf91ab005032fb43ef7a4dc427056cf2d1d2 | Add missing authorship + license info to NMF topics example | wanggang3333/scikit-learn,akionakamura/scikit-learn,jseabold/scikit-learn,olologin/scikit-learn,ltiao/scikit-learn,jm-begon/scikit-learn,ZENGXH/scikit-learn,ephes/scikit-learn,idlead/scikit-learn,smartscheduling/scikit-learn-categorical-tree,yask123/scikit-learn,MartinDelzant/scikit-learn,alvarofierroclavero/scikit-lea... | examples/applications/topics_extraction_with_nmf.py | examples/applications/topics_extraction_with_nmf.py | """
========================================================
Topics extraction with Non-Negative Matrix Factorization
========================================================
This is a proof of concept application of Non Negative Matrix
Factorization of the term frequency matrix of a corpus of documents so
as to extra... | """
========================================================
Topics extraction with Non-Negative Matrix Factorization
========================================================
This is a proof of concept application of Non Negative Matrix
Factorization of the term frequency matrix of a corpus of documents so
as to extra... | bsd-3-clause | Python |
2f8ae4d29bd95c298209a0cb93b5354c00186d6b | Fix and speedup pure-Python fallback for C filter. | daniorerio/trackpy,daniorerio/trackpy | trackpy/C_fallback_python.py | trackpy/C_fallback_python.py | try:
from _Cfilters import nullify_secondary_maxima
except ImportError:
import numpy as np
# Because of the way C imports work, nullify_secondary_maxima
# is *called*, as in nullify_secondary_maxima().
# For the pure Python variant, we do not want to call the function,
# so we make nullify_secon... | try:
from _Cfilters import nullify_secondary_maxima
except ImportError:
import numpy as np
# Because of the way C imports work, nullify_secondary_maxima
# is *called*, as in nullify_secondary_maxima().
# For the pure Python variant, we do not want to call the function,
# so we make nullify_secon... | bsd-3-clause | Python |
3cd4d03cb2de99da4a2a4592f3541074335ad6e9 | handle tempita templated Cython source files, *.pyx.in | ofgulban/scikit-image,ajaybhat/scikit-image,vighneshbirodkar/scikit-image,paalge/scikit-image,rjeli/scikit-image,vighneshbirodkar/scikit-image,paalge/scikit-image,ofgulban/scikit-image,pratapvardhan/scikit-image,ofgulban/scikit-image,ajaybhat/scikit-image,Hiyorimi/scikit-image,paalge/scikit-image,pratapvardhan/scikit-i... | skimage/_build.py | skimage/_build.py | import sys
import os
import hashlib
import subprocess
# WindowsError is not defined on unix systems
try:
WindowsError
except NameError:
class WindowsError(Exception):
pass
def cython(pyx_files, working_path=''):
"""Use Cython to convert the given files to C.
Parameters
----------
pyx... | import sys
import os
import hashlib
import subprocess
# WindowsError is not defined on unix systems
try:
WindowsError
except NameError:
class WindowsError(Exception):
pass
def cython(pyx_files, working_path=''):
"""Use Cython to convert the given files to C.
Parameters
----------
pyx... | bsd-3-clause | Python |
ff7afdaa579d4a83b9aa00693cc63bba6cdd8178 | make imports work for python 2.7 | jdoepfert/roipoly.py | roipoly/__init__.py | roipoly/__init__.py | from .roipoly import RoiPoly
from .roipoly import roipoly # compatibility for old versions
__version__ = '0.1.0'
| from roipoly.roipoly import RoiPoly
from roipoly.roipoly import roipoly # compatibility for old versions
__version__ = '0.1.0'
| apache-2.0 | Python |
c706984d0861c62d0365b7b1d0aa298369ff23ba | Fix bad date format | GoogleCloudPlatform/covid-19-open-data,GoogleCloudPlatform/covid-19-open-data | src/pipelines/epidemiology/es_authority.py | src/pipelines/epidemiology/es_authority.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
15bddd3f508d7596f85e91479082881a45b191b0 | fix tests | hobson/pug,hobson/pug,hobson/pug,hobson/pug | pug/tests.py | pug/tests.py | #!/usr/bin/env python
"""
Uses the unittest module to test this app with `manage.py test`.
"""
# from django.test import TestCase
from unittest import TestCase, main
import doctest
import pug.nlp.util
class NLPDocTest(TestCase):
def test_module(self, module=None):
if module is not None:
fail... | #!/usr/bin/env python
"""
Uses the unittest module to test this app with `manage.py test`.
"""
# from django.test import TestCase
from unittest import TestCase, main
import doctest
import pug.nlp.util
# import pug.invest.util
# class PuffinTest(TestCase):
# from puffin_lsa import PuffinLSA
# from examples imp... | mit | Python |
22491e86c09cb5c796ff8bfffc3fa2e35ae3167f | Support for secret key | hackerspace-ntnu/website,hackerspace-ntnu/website,hackerspace-ntnu/website | rpi/get_hostname.py | rpi/get_hostname.py | import requests
import uuid
import json
import os
RPI_SERVER = 'http://localhost:8000'
RPI_SECRET_KEY = 'topkeklol'
def get_mac():
mac_addr = hex(uuid.getnode()).replace('0x', '')
return ':'.join(mac_addr[i: i + 2] for i in range(0, 11, 2))
def get_hostname():
url = RPI_SERVER + '/rpi/api/'
client ... | import requests
import uuid
RPI_SERVER = 'http://localhost:8000'
def get_mac():
mac_addr = hex(uuid.getnode()).replace('0x', '')
return ':'.join(mac_addr[i: i + 2] for i in range(0, 11, 2))
def get_hostname():
url = RPI_SERVER + '/rpi/lifesign'
client = requests.session()
client.get(RPI_SERVER ... | mit | Python |
b6bfe82d337c9290834c474c4c411ccef5c009e5 | Bump to 0.1.1 | alexmojaki/snoop,alexmojaki/snoop | snoop/__init__.py | snoop/__init__.py | '''
PySnooper - Never use print for debugging again
Usage:
import snoop
@snoop.snoop()
def your_function(x):
...
A log will be written to stderr showing the lines executed and variables
changed in the decorated function.
For more information, see https://github.com/cool-RR/PySnooper
'''
from .... | '''
PySnooper - Never use print for debugging again
Usage:
import snoop
@snoop.snoop()
def your_function(x):
...
A log will be written to stderr showing the lines executed and variables
changed in the decorated function.
For more information, see https://github.com/cool-RR/PySnooper
'''
from .... | mit | Python |
947094e0ee847b5b077b398f3083feb6362e1c3b | bump version. | nickhand/runtests,nickhand/runtests,rainwoodman/runtests,rainwoodman/runtests,rainwoodman/mpi4py_test,rainwoodman/mpi4py_test | runtests/version.py | runtests/version.py | __version__ = "0.0.14"
| __version__ = "0.0.13"
| bsd-2-clause | Python |
4dbce8644253c6be4161366e7f8ef38a93d92095 | update docs of domaindescriptions package | michaellaier/pymor,michaellaier/pymor,michaellaier/pymor,michaellaier/pymor | src/pymor/domaindescriptions/interfaces.py | src/pymor/domaindescriptions/interfaces.py | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
from pymor.core.interfaces import ImmutableInter... | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
from pymor.core.interfaces import ImmutableInter... | bsd-2-clause | Python |
844f56cddd1917dd841b0abc589296106a204b2b | Set build status to queued | dropbox/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,wfxiang08/changes | changes/api/build_retry.py | changes/api/build_retry.py | from flask import Response
from sqlalchemy.orm import joinedload, subqueryload_all
from datetime import datetime
from changes.api.base import APIView
from changes.config import db, queue
from changes.constants import Cause, Status
from changes.models import Build
class BuildRetryAPIView(APIView):
def post(self,... | from flask import Response, current_app
from sqlalchemy.orm import joinedload, subqueryload_all
from datetime import datetime
from changes.api.base import APIView
from changes.config import db, queue
from changes.constants import Cause
from changes.models import Build
class BuildRetryAPIView(APIView):
def post(... | apache-2.0 | Python |
9090d605671b1d13800b057547ea2b6980dd3386 | Add __iter__ function. | Ezibenroc/PyRoaringBitMap,Ezibenroc/PyRoaringBitMap | pyroaring.py | pyroaring.py | import ctypes
import time
libroaring = ctypes.CDLL('libroaring.so')
class BitMap:
__BASE_TYPE__ = ctypes.c_uint32
def __init__(self, values=None):
if values is None:
self.__obj__ = libroaring.roaring_bitmap_create()
elif isinstance(values, BitMap):
self.__obj__ = libroa... | import ctypes
import time
libroaring = ctypes.CDLL('libroaring.so')
class BitMap:
def __init__(self, values=None):
if values is None:
self.__obj__ = libroaring.roaring_bitmap_create()
elif isinstance(values, BitMap):
self.__obj__ = libroaring.roaring_bitmap_copy(values.__o... | mit | Python |
5410769b403843fed7d3ffc2e0bd1556c0819185 | write show method and start message | IanDCarroll/xox | source/display.py | source/display.py | class Display():
def __init__(self):
self.start = "Welcome"
def show(self, text):
return text
| mit | Python | |
e59eff68cd77b07dd104a08f27ace2345cee3ab1 | extend unit tests | svenkreiss/databench,svenkreiss/databench,svenkreiss/databench,svenkreiss/databench | databench/tests/standalone/test_standalone.py | databench/tests/standalone/test_standalone.py | from __future__ import division
import databench
from databench.testing import AnalysisTest
import math
import random
import tornado.testing
class DummyPi(databench.Analysis):
@databench.on
def connected(self):
yield self.data.init({'samples': 100000})
@databench.on
def run(self):
"... | from __future__ import division
import databench
from databench.testing import AnalysisTest
import math
import random
import tornado.testing
class DummyPi(databench.Analysis):
@databench.on
def connected(self):
yield self.data.init({'samples': 100000})
@databench.on
def run(self):
"... | mit | Python |
cef249edef4100b8a3c009fa05febbc66c3fe5df | Add default path to config | seecloud/spamostack | spamostack/spamostack.py | spamostack/spamostack.py | import argparse
from collections import OrderedDict
import json
import logger
import logging
from session import Session
from simulator import Simulator
from cache import Cache
from client_factory import ClientFactory
from keeper import Keeper
parser = argparse.ArgumentParser()
parser.add_argument('--pipe', dest='pi... | import argparse
from collections import OrderedDict
import json
import logger
import logging
from session import Session
from simulator import Simulator
from cache import Cache
from client_factory import ClientFactory
from keeper import Keeper
parser = argparse.ArgumentParser()
parser.add_argument('--pipe', dest='pi... | apache-2.0 | Python |
0003ef7fe3d59c4bda034dee334d45b6d7a2622d | Add test of storing float | utgwkk/tiny-python-vm | pyvm_test.py | pyvm_test.py | import pyvm
import unittest
class PyVMTest(unittest.TestCase):
def setUp(self):
self.vm = pyvm.PythonVM()
def test_load_const_num(self):
self.assertEqual(
10,
self.vm.eval('10')
)
def test_load_const_num_float(self):
self.assertEqual(
10... | import pyvm
import unittest
class PyVMTest(unittest.TestCase):
def setUp(self):
self.vm = pyvm.PythonVM()
def test_load_const_num(self):
self.assertEqual(
10,
self.vm.eval('10')
)
def test_load_const_str(self):
self.assertEqual(
"hoge",
... | mit | Python |
bb888acab753b0e8bf09b50e59712b8a5d013c12 | fix for room names | thepug/Speeqe,thepug/Speeqe | speeqeweb/urls.py | speeqeweb/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
urlpatterns = patterns('',
(r'^avatar-service/', include('speeqeweb.avatars.urls')),
(r'^join/validate/username/','speeqeweb.speeqe.views.validate_username'),
(r'^join/validate/email/','speeqeweb.speeqe.views.validate_email'),
... | from django.conf.urls.defaults import *
from django.conf import settings
urlpatterns = patterns('',
(r'^avatar-service/', include('speeqeweb.avatars.urls')),
(r'^join/validate/username/','speeqeweb.speeqe.views.validate_username'),
(r'^join/validate/email/','speeqeweb.speeqe.views.validate_email'),
... | agpl-3.0 | Python |
e870258c063f452fea5157c3c07ff65d40ca91ae | Update __init__.py | Tendrl/commons,rishubhjain/commons,r0h4n/commons | tendrl/commons/objects/file/__init__.py | tendrl/commons/objects/file/__init__.py | from tendrl.commons.etcdobj import EtcdObj
from tendrl.commons import objects
class File(objects.BaseObject):
internal = True
def __init__(self, data=None, file_path=None,
*args, **kwargs):
self._defs = {}
super(File, self).__init__(*args, **kwargs)
self.data = data
... | from tendrl.commons.etcdobj import EtcdObj
from tendrl.commons import objects
class File(objects.BaseObject):
def __init__(self, data=None, file_path=None,
*args, **kwargs):
super(File, self).__init__(*args, **kwargs)
self.data = data
self.file_path = file_path
sel... | lgpl-2.1 | Python |
984254c22b790576ae7464e8e75fe826b4a766af | make finding module logs a bit easier | getnamo/UnrealEnginePython,getnamo/UnrealEnginePython,getnamo/UnrealEnginePython,getnamo/UnrealEnginePython,getnamo/UnrealEnginePython | Content/Scripts/upymodule_importer.py | Content/Scripts/upymodule_importer.py | #Imports upymodule.json modules and resolves dependencies
#example test
#import upymodule_importer as upym
#upym.parseJson("D:/Users/Admin/Documents/GitHub/tensorflow-ue4-mnist-example/Plugins/tensorflow-ue4/Content/Scripts/upymodule.json")
import upypip as pip
import sys
import unreal_engine as ue
import json
impor... | #Imports upymodule.json modules and resolves dependencies
#example test
#import upymodule_importer as upym
#upym.parseJson("D:/Users/Admin/Documents/GitHub/tensorflow-ue4-mnist-example/Plugins/tensorflow-ue4/Content/Scripts/upymodule.json")
import upypip as pip
import sys
import unreal_engine as ue
import json
impor... | mit | Python |
9a4107b5fdc46ab10943ec9b8424b866d6c4b7ea | Add os.path.join to dest_path | persandstrom/python-verisure | verisure/devices/smartcam.py | verisure/devices/smartcam.py | """
Smartcam device
"""
import os
from .overview import Overview
OVERVIEW_URL = '/overview/camera'
CAPTURE_URL = '/picturelog/camera/{}/capture.cmd'
IMAGES_URL = '/picturelog/seriespage/0'
DOWNLOAD_URL = '/camera/{}/image/{}.jpg'
class Smartcam(object):
""" Smartcam device
Args:
session (verisure.s... | """
Smartcam device
"""
from .overview import Overview
OVERVIEW_URL = '/overview/camera'
CAPTURE_URL = '/picturelog/camera/{}/capture.cmd'
IMAGES_URL = '/picturelog/seriespage/0'
DOWNLOAD_URL = '/camera/{}/image/{}.jpg'
class Smartcam(object):
""" Smartcam device
Args:
session (verisure.session): C... | mit | Python |
36529fff111d6da299f3af2b1035b88e92a5872a | Read heroku port | alphagov/notifications-functional-tests,alphagov/notifications-functional-tests | sms_inbox.py | sms_inbox.py | import os
from flask import Flask, request, jsonify
from flask.ext.cache import Cache
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
@app.route('/', methods=['GET'])
def get_nessage():
result = cache.get('sms')
if result:
cache.clear()
return jsonify({
'... | import os
from flask import Flask, request, jsonify
from flask.ext.cache import Cache
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
@app.route('/', methods=['GET'])
def get_nessage():
result = cache.get('sms')
if result:
cache.clear()
return jsonify({
'... | mit | Python |
e11eccb24ed2d5c675beab40fe78db76d324b4ee | Update urls.py | gridcell/jserr | jserr/urls.py | jserr/urls.py | from django.conf.urls import url
import jserr.views
urlpatterns = [
url(r"^log/$", jserr.views.log, name="log_js_error"),
]
| from django.conf.urls import url
urlpatterns = ["",
url(r"^log/$", "jserr.views.log", name="log_js_error"),
]
| bsd-2-clause | Python |
556d73ed6ee186343a5b9eca9f16472715cedcd7 | update docs | mylokin/schematec | schematec/schema.py | schematec/schema.py | from __future__ import absolute_import
import schematec.abc
class Schema(object):
'''
Unbound validators is appliyed first.
Converters is appliyed second in orderder they defined
Bound validators is appliyed third.
'''
def __init__(self, **descriptors):
self.descriptors = descriptors... | from __future__ import absolute_import
import schematec.abc
class Schema(object):
'''
Converters is appliyed first in orderder they defined
Validators is appliyed second.
'''
def __init__(self, **descriptors):
self.descriptors = descriptors
def __call__(self, data):
result =... | mit | Python |
ef639a000efc5d80ca7475b0e7be59412f834203 | Bump to v2.0.7 | Ritiek/Spotify-Downloader | spotdl/version.py | spotdl/version.py | __version__ = "2.0.7"
| __version__ = "2.0.6"
| mit | Python |
3f8c9505c3363a1bc439d40852cdeabcb6f1af27 | Fix numpy deprecation | bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adv... | 2019/aoc2019/day16.py | 2019/aoc2019/day16.py | import math
from typing import List, TextIO
import numpy # type: ignore
def read_input(data: TextIO) -> List[int]:
line = next(data).strip()
return [int(c) for c in line]
def simulate(numbers: List[int]) -> str:
numbers = numpy.array(numbers)
pattern = numpy.array([0, 1, 0, -1], dtype=numpy.int32... | import math
from typing import List, TextIO
import numpy # type: ignore
def read_input(data: TextIO) -> List[int]:
line = next(data).strip()
return [int(c) for c in line]
def simulate(numbers: List[int]) -> str:
numbers = numpy.array(numbers)
pattern = numpy.array([0, 1, 0, -1], dtype=numpy.int)
... | mit | Python |
7e6911c4cc748373b9f4464b456b2cd2a0e5bf4d | Fix PEP8 | ddico/account-analytic,acsone/account-analytic | stock_analytic/models/stock.py | stock_analytic/models/stock.py | # -*- coding: utf-8 -*-
# © 2013 Julius Network Solutions
# © 2015 Clear Corp
# © 2016 Andhitia Rama <andhitia.r@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models, api
class StockMove(models.Model):
_inherit = "stock.move"
account_analytic_id ... | # -*- coding: utf-8 -*-
# © 2013 Julius Network Solutions
# © 2015 Clear Corp
# © 2016 Andhitia Rama <andhitia.r@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models, api
class StockMove(models.Model):
_inherit = "stock.move"
account_analytic_id ... | agpl-3.0 | Python |
dd85b08519e5b85a29fa61f1024402e57c035578 | fix HundredGoalNoteList api | mozillazg/chendian-plus,mozillazg/chendian-plus,mozillazg/chendian-plus | chendian/api/book/views.py | chendian/api/book/views.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from rest_framework.generics import (
ListAPIView, ListCreateAPIView, RetrieveUpdateDestroyAPIView
)
from api._base import OnlyFieldsModelViewMixin, ExcludeFieldsModelViewMixin
from api.qq.serial... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from rest_framework.generics import (
ListAPIView, ListCreateAPIView, RetrieveUpdateDestroyAPIView
)
from api._base import OnlyFieldsModelViewMixin, ExcludeFieldsModelViewMixin
from api.qq.serial... | mit | Python |
2bcfe2ffe0dbf4ebd8ac790073dc4590945974be | Update version number to 0.2 | piotrekw/pirx | pirx/__init__.py | pirx/__init__.py | from pirx.base import Settings
from pirx.checks import host, arg
from pirx.utils import setting, path
__version__ = '0.2'
| from pirx.base import Settings
from pirx.checks import host, arg
from pirx.utils import setting, path
__version__ = '0.1'
| mit | Python |
b909aa692b3566bbba4d5c26cac4769497384648 | Convert to ubyte dtype explicitly | bennlich/scikit-image,newville/scikit-image,ClinicalGraphics/scikit-image,paalge/scikit-image,dpshelio/scikit-image,emon10005/scikit-image,jwiggins/scikit-image,pratapvardhan/scikit-image,almarklein/scikit-image,almarklein/scikit-image,Midafi/scikit-image,almarklein/scikit-image,robintw/scikit-image,SamHames/scikit-ima... | doc/examples/plot_circular_hough_transform.py | doc/examples/plot_circular_hough_transform.py | """
========================
Circular Hough Transform
========================
The Hough transform in its simplest form is a `method to detect
straight lines <http://en.wikipedia.org/wiki/Hough_transform>`__
but it can also be used to detect circles.
In the following example, the Hough transform is used to detect
coi... | """
========================
Circular Hough Transform
========================
The Hough transform in its simplest form is a `method to detect
straight lines <http://en.wikipedia.org/wiki/Hough_transform>`__
but it can also be used to detect circles.
In the following example, the Hough transform is used to detect
coi... | bsd-3-clause | Python |
984becbf16aef4440da67f3f65ffd56e7e9d82af | fix namespace | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | scripts/cvtmysql.py | scripts/cvtmysql.py | #!/usr/bin/python
from mint.config import MintConfig
from conary import dbstore
from conary.lib import util
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
sys.excepthook = util.genExcepthook()
srcDb = dbstore.connect("/srv/mint/data/db", "sqlite")
destDb = dbstore.connect("/home/smg/tmp/db", "sqlite")
#dest... | #!/usr/bin/python
from config import MintConfig
from conary import dbstore
from conary.lib import util
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
sys.excepthook = util.genExcepthook()
srcDb = dbstore.connect("/srv/mint/data/db", "sqlite")
destDb = dbstore.connect("mintauth:mintpass@localhost.localdomain... | apache-2.0 | Python |
9ff48dd4bff605ad1521c8ebaffc18432a155d8d | Update to prims 1.10 version | FlipperPA/wagtailcodeblock,FlipperPA/wagtailcodeblock,FlipperPA/wagtailcodeblock | wagtailcodeblock/settings.py | wagtailcodeblock/settings.py | from django.conf import settings
def get_language_choices():
"""
Default list of language choices, if not overridden by Django.
"""
DEFAULT_LANGUAGES = (
('bash', 'Bash/Shell'),
('css', 'CSS'),
('diff', 'diff'),
('http', 'HTML'),
('javascript', 'Java... | from django.conf import settings
def get_language_choices():
"""
Default list of language choices, if not overridden by Django.
"""
DEFAULT_LANGUAGES = (
('bash', 'Bash/Shell'),
('css', 'CSS'),
('diff', 'diff'),
('http', 'HTML'),
('javascript', 'Java... | bsd-3-clause | Python |
430e9ef5d8dff954506479b00e39840e66bc3ad1 | Add MirParser tests with read_auto=False | HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata | pyuvdata/uvdata/tests/test_mir_parser.py | pyuvdata/uvdata/tests/test_mir_parser.py | # -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2020 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Tests for MirParser class.
Performs a series of tests on the MirParser, which is the python-based reader for MIR
data in pyuvdata. Tests in this module are specific to the way that MI... | # -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2020 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Tests for MirParser class.
Performs a series of tests on the MirParser, which is the python-based reader for MIR
data in pyuvdata. Tests in this module are specific to the way that MI... | bsd-2-clause | Python |
abe05ce85b10ef37066d946d60029e19ff6c0307 | Add tests for it. | peak6/st2,StackStorm/st2,nzlosh/st2,tonybaloney/st2,peak6/st2,StackStorm/st2,StackStorm/st2,nzlosh/st2,Plexxi/st2,lakshmi-kannan/st2,tonybaloney/st2,Plexxi/st2,lakshmi-kannan/st2,nzlosh/st2,StackStorm/st2,nzlosh/st2,lakshmi-kannan/st2,peak6/st2,Plexxi/st2,Plexxi/st2,tonybaloney/st2 | st2common/tests/unit/test_db_model_uids.py | st2common/tests/unit/test_db_model_uids.py | # contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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 ... | # contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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 ... | apache-2.0 | Python |
45396dd2ed3bc7ab9ac6f9b5a5f51179b629abb7 | Fix extraction (Closes #10633) | longman694/youtube-dl,rrooij/youtube-dl,stannynuytkens/youtube-dl,epitron/youtube-dl,ozburo/youtube-dl,Tithen-Firion/youtube-dl,dstftw/youtube-dl,nyuszika7h/youtube-dl,phihag/youtube-dl,Tatsh/youtube-dl,pim89/youtube-dl,malept/youtube-dl,TRox1972/youtube-dl,gkoelln/youtube-dl,malept/youtube-dl,luceatnobis/youtube-dl,vi... | youtube_dl/extractor/nhk.py | youtube_dl/extractor/nhk.py | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import ExtractorError
class NhkVodIE(InfoExtractor):
_VALID_URL = r'https?://www3\.nhk\.or\.jp/nhkworld/en/vod/(?P<id>[^/]+/[^/?#&]+)'
_TEST = {
# Videos available only for a limited period of time. Visit
#... | from __future__ import unicode_literals
from .common import InfoExtractor
class NhkVodIE(InfoExtractor):
_VALID_URL = r'https?://www3\.nhk\.or\.jp/nhkworld/en/vod/(?P<id>.+?)\.html'
_TEST = {
# Videos available only for a limited period of time. Visit
# http://www3.nhk.or.jp/nhkworld/en/vod/ ... | unlicense | Python |
4646958917c0a0924c989698c178f849c5c94635 | Improve the backend detection | trhd/meson,MathieuDuponchelle/meson,MathieuDuponchelle/meson,pexip/meson,becm/meson,pexip/meson,mesonbuild/meson,aaronp24/meson,aaronp24/meson,wberrier/meson,ernestask/meson,aaronp24/meson,thiblahute/meson,fmuellner/meson,ernestask/meson,wberrier/meson,wberrier/meson,rhd/meson,jeandet/meson,thiblahute/meson,jpakkane/me... | run_tests.py | run_tests.py | #!/usr/bin/env python3
# Copyright 2012-2017 The Meson development team
# 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... | #!/usr/bin/env python3
# Copyright 2012-2017 The Meson development team
# 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... | apache-2.0 | Python |
0f06e618c8b5a85728233dc143e8192697381edc | test with config | lfzyx/ButterSalt,lfzyx/ButterSalt | tests/Salt_rest_cherrypy_api.py | tests/Salt_rest_cherrypy_api.py | import requests
from config import config
url = config['test'].SALT_API
username = config['test'].SALT_USERNAME
password = config['test'].SALT_PASSWORD
session = requests.Session()
# /
print(session.get(url + '/').json())
# /LOGIN
print(session.get(url + '/login').json())
print(session.post(url + '/login', json={
... | import requests
url = 'http://192.168.1.71:8000'
session = requests.Session()
# /
print(session.get(url + '/').json())
# /LOGIN
print(session.get(url + '/login').json())
print(session.post(url + '/login', json={
'username': 'test',
'password': 'test',
'eauth': 'pam',
}).json())
# /MINIONS
print(sessio... | mit | Python |
d918b135b464c42f3929cdad935a595c1d88cf45 | Fix citation2latex for Python 3 | ipython/ipython,ipython/ipython | IPython/nbconvert/filters/citation.py | IPython/nbconvert/filters/citation.py | """Citation handling for LaTeX output."""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---... | """Citation handling for LaTeX output."""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---... | bsd-3-clause | Python |
b2578e3e5fbda07064935e2a4e097025e853912c | Remove comments in test_simulation.py | Minhmo/tardis,Tobychev/tardis,kaushik94/tardis,Tobychev/tardis,Tobychev/tardis,Minhmo/tardis,kaushik94/tardis,orbitfold/tardis,kaushik94/tardis,orbitfold/tardis,Minhmo/tardis,orbitfold/tardis,orbitfold/tardis,kaushik94/tardis | tardis/simulation/tests/test_simulation.py | tardis/simulation/tests/test_simulation.py | import numpy.testing as npt
import h5py
import pytest
from tardis.io import config_reader
from tardis.model import Radial1DModel
from tardis.simulation import Simulation
@pytest.fixture
def tardis_config(kurucz_atomic_data, tardis_config_verysimple):
return config_reader.Configuration.from_config_dict(
t... | import numpy.testing as npt
import h5py
import pytest
from tardis.io import config_reader
from tardis.model import Radial1DModel
from tardis.simulation import Simulation
''' I don't get the purpose of this test. It looks like it's trying to do unit
tests for the Simulation module but what i see happening is a full t... | bsd-3-clause | Python |
8a0948c52d9e1d9f7eea0dcddec92ba3e362dc1a | Change path structure. Code should now work under utils directory. | changzheng1993/project-kappa,giancarloescobar/project-kappa,giancarloescobar/project-kappa,imranyousuf/project-kappa,berkeley-stat159/project-kappa,noelpimentel/project-kappa,berkeley-stat159/project-kappa,imranyousuf/project-kappa,changzheng1993/project-kappa,noelpimentel/project-kappa | code/utils/loading_data.py | code/utils/loading_data.py | import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
import os
def cond_file(subject, run, cond):
""" Opens a condition txt for a subject and one of their runs. """
sub_path = os.path.realpath('../../data/ds105/'+subject)
sub_path_cond= os.path.join(sub_path,'model/model0... | import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
import os
def cond_file(subject, run, cond):
""" Opens a condition txt for a subject and one of their runs. """
sub_path = os.path.realpath('ds105/'+subject)
sub_path_cond= os.path.join(sub_path,'model/model001/onsets',... | bsd-3-clause | Python |
eaa96a76101a1b15de3f96b0ede3d62fc5def6f5 | Add testcase for .mkdir(). | pramasoul/micropython,emfcamp/micropython,matthewelse/micropython,matthewelse/micropython,misterdanb/micropython,AriZuu/micropython,dmazzella/micropython,cwyark/micropython,mpalomer/micropython,TDAbboud/micropython,swegener/micropython,toolmacher/micropython,tobbad/micropython,matthewelse/micropython,pramasoul/micropyt... | tests/extmod/vfs_fat_ramdisk.py | tests/extmod/vfs_fat_ramdisk.py | import sys
import uos
try:
uos.VfsFat
except AttributeError:
print("SKIP")
sys.exit()
class RAMFS:
SEC_SIZE = 512
def __init__(self, blocks):
self.data = bytearray(blocks * self.SEC_SIZE)
def readblocks(self, n, buf):
#print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))... | import sys
import uos
try:
uos.VfsFat
except AttributeError:
print("SKIP")
sys.exit()
class RAMFS:
SEC_SIZE = 512
def __init__(self, blocks):
self.data = bytearray(blocks * self.SEC_SIZE)
def readblocks(self, n, buf):
#print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))... | mit | Python |
5adb4cd2d0b58c08aab03bd05792f8a2f7215dce | add dependence map test | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | tests/laser/smt/independece_solver_test.py | tests/laser/smt/independece_solver_test.py | from mythril.laser.smt.independence_solver import _get_expr_variables, DependenceBucket, DependenceMap
import z3
def test_get_expr_variables():
# Arrange
x = z3.Bool('x')
y = z3.BitVec('y', 256)
z = z3.BitVec('z', 256)
b = z3.BitVec('b', 256)
expression = z3.If(x, y, z + b)
# Act
vari... | from mythril.laser.smt.independence_solver import _get_expr_variables, DependenceBucket, DependenceMap
import z3
def test_get_expr_variables():
# Arrange
x = z3.Bool('x')
y = z3.Int('y')
z = z3.Int('z')
b = z3.Int('b')
expression = z3.If(x, y, z + b)
# Act
variables = _get_expr_variab... | mit | Python |
c4d64672c8c72ca928b354e9cfd35a7d40dbb78f | Change to path, made relative | neurodata/ndmg | MROCPdjangoForm/ocpipeline/mrpaths.py | MROCPdjangoForm/ocpipeline/mrpaths.py | #
# Code to load project paths
#
import os, sys
MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.." ))
MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" )
MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" )
sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MRCAP_PATH ]
| #
# Code to load project paths
#
import os, sys
MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "/Users/dmhembere44/MR-connectome" ))
MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" )
MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" )
sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MR... | apache-2.0 | Python |
8e07a99274d9683b16ab3970cd433c980eebf63f | Use correct type hints for slack events | jreese/edi | edi/core.py | edi/core.py | # Copyright 2016 John Reese
# Licensed under the MIT license
import logging
from typing import Set, Type
from aioslack import Slack, Event
log = logging.getLogger(__name__)
class Unit:
ENABLED = True
def __init__(self, slack: Slack) -> None:
self.slack = slack
def __str__(self) -> str:
... | # Copyright 2016 John Reese
# Licensed under the MIT license
import logging
from attr import dataclass
from typing import Set, Type
from aioslack import Slack
log = logging.getLogger(__name__)
@dataclass
class Message:
"""Base class for all Slack RTM messages."""
type: str
class Unit:
ENABLED = Tru... | mit | Python |
4743604ad8cc1e49d6b5613927efd00f8849433c | Bump version for release | uogbuji/amara3-xml,uogbuji/amara3-xml | pylib/version.py | pylib/version.py | #http://legacy.python.org/dev/peps/pep-0440/
version_info = ('3', '0', '0')
| #http://legacy.python.org/dev/peps/pep-0440/
version_info = ('3', '0', '0rc1')
| apache-2.0 | Python |
9d46e371664404f0b07a1ecb48af5b289a87de64 | Fix note about ``SETMAN_AUTH_PERMITTED`` setting. | playpauseandstop/setman | setman/frameworks/django_setman/views.py | setman/frameworks/django_setman/views.py | from random import randint
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.conf import settings as django_settings
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, render
from django.template import RequestContext
from django.... | from random import randint
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.conf import settings as django_settings
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, render
from django.template import RequestContext
from django.... | bsd-3-clause | Python |
cba5a3d4928a3ee2e7672ca4a3f766a789d83acf | Add x, y arguments and docstring | olgabot/cupcake | cupcake/smush/plot.py | cupcake/smush/plot.py | """
User-facing interface for plotting all dimensionality reduction algorithms
"""
def smushplot(data, smusher='PCA', x=1, y=2, n_components=2, marker='o',
marker_order=None, text=False, text_order=None, linewidth=1,
linewidth_order=None, edgecolor='k', edgecolor_order=None,
s... | """
User-facing interface for plotting all dimensionality reduction algorithms
"""
def smushplot(data, smusher='pca', n_components=2, marker='o', marker_order=None,
text=False, text_order=None, linewidth=1, linewidth_order=None,
edgecolor='k', edgecolor_order=None, smusher_kws=None,
... | bsd-3-clause | Python |
66ba9aa2172fbed67b67a06acb331d449d32a33c | Remove unused fixture from orderer | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | tests/services/shop/conftest.py | tests/services/shop/conftest.py | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import pytest
from byceps.services.shop.cart.models import Cart
from byceps.services.shop.sequence import service as sequence_service
from byceps.services.shop.shop import service as shop_service
from testfixtures.sho... | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import pytest
from byceps.services.shop.cart.models import Cart
from byceps.services.shop.sequence import service as sequence_service
from byceps.services.shop.shop import service as shop_service
from testfixtures.sho... | bsd-3-clause | Python |
c61347fd8efa8f763001f87c0b70a211825e7434 | allow recipe component to be cooked if abstractBaseClass is set (CNY-2957) | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary | conary/build/inforecipe.py | conary/build/inforecipe.py | #
# Copyright (c) 2005-2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/perma... | #
# Copyright (c) 2005-2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/perma... | apache-2.0 | Python |
ee94dbd3447b477e9964631ef67327f184629f61 | Put jasmine test on same level as other selenium tests | ZeitOnline/zeit.content.image,cutoffthetop/zeit.content.image,cutoffthetop/zeit.content.image,ZeitOnline/zeit.content.image | src/zeit/content/image/browser/tests/test_variant.py | src/zeit/content/image/browser/tests/test_variant.py | from zeit.content.image.testing import create_image_group_with_master_image
import gocept.jasmine.jasmine
import json
import requests
import transaction
import zeit.cms.checkout.interfaces
import zeit.cms.testing
import zeit.content.image.testing
class VariantJsonAPI(zeit.cms.testing.FunctionalTestCase):
layer =... | from zeit.content.image.testing import create_image_group_with_master_image
import gocept.jasmine.jasmine
import json
import requests
import transaction
import zeit.cms.checkout.interfaces
import zeit.cms.testing
import zeit.content.image.testing
class VariantJsonAPI(zeit.cms.testing.FunctionalTestCase):
layer =... | bsd-3-clause | Python |
d296ed0f569c27b72e39e68970318f9c679e1eb5 | update system encoding | antoine-tran/Wikisearch-example | python/search.py | python/search.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interface to ElasticSearch for serving search requests
#
# Tuan Tran (ttran@l3s.de)
#
import sys
reload(sys)
sys.setdefaultencoding('utf-8') # Set system's default encoding to utf-8
from sys import argv
from conn import connect,close as es_close
QUERY = { "query":{ "m... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interface to ElasticSearch for serving search requests
#
# Tuan Tran (ttran@l3s.de)
#
import sys
reload(sys
sys.setdefaultencoding('utf-8')) # Set system's default encoding to utf-8
from sys import argv
from conn import connect,close as es_close
QUERY = { "query":{ "m... | apache-2.0 | Python |
71cf9841a86e33ce3ff4c1cdc9436d94d2101e7d | fix for circle integration | nschloe/quadpy | quadpy/circle.py | quadpy/circle.py | # -*- coding: utf-8 -*-
#
import numpy
from . import helpers
def show(scheme, show_axes=False):
from matplotlib import pyplot as plt
ax = plt.gca()
# change default range so that new disks will work
plt.axis('equal')
ax.set_xlim((-1.5, 1.5))
ax.set_ylim((-1.5, 1.5))
if not show_axes:
... | # -*- coding: utf-8 -*-
#
import numpy
from . import helpers
def show(scheme, show_axes=False):
from matplotlib import pyplot as plt
ax = plt.gca()
# change default range so that new disks will work
plt.axis('equal')
ax.set_xlim((-1.5, 1.5))
ax.set_ylim((-1.5, 1.5))
if not show_axes:
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.