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 |
|---|---|---|---|---|---|---|---|---|
73aa6990f75b6152cf983a59a81e7966fcba4a32 | Add __all__ to __init.py__ | jackstanek/BotBot,jackstanek/BotBot | botbot/__init__.py | botbot/__init__.py | __version__ = '0.0.1'
__all__ = ["checker", "problems"]
| __version__ = '0.0.1'
| mit | Python |
fe88f37559e93c9357f116ff51324a2201c68b82 | Change stringly type to classly typed - preparation for DirectoryController | caio2k/RIDE,robotframework/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,fingeronthebutton/RIDE,caio2k/RIDE,fingeronthebutton/RIDE | src/robotide/ui/images.py | src/robotide/ui/images.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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... | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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... | apache-2.0 | Python |
30b9073d68b07003b89641ca5764305b8a7b1250 | fix not existing UnsupportedOSError | Widukind/dlstats,mmalter/dlstats,MichelJuillard/dlstats,MichelJuillard/dlstats,MichelJuillard/dlstats,Widukind/dlstats,mmalter/dlstats,mmalter/dlstats | dlstats/configuration.py | dlstats/configuration.py | import configobj
import validate
import os
def _get_filename():
"""Return the configuration file path."""
appname = 'dlstats'
if os.name == 'posix':
if "HOME" in os.environ:
if os.path.isfile(os.environ["HOME"]+'/.'+appname+'/main.conf'):
return os.environ["HOME"]+'/.'+a... | import configobj
import validate
import os
def _get_filename():
"""Return the configuration file path."""
appname = 'dlstats'
if os.name == 'posix':
if "HOME" in os.environ:
if os.path.isfile(os.environ["HOME"]+'/.'+appname+'/main.conf'):
return os.environ["HOME"]+'/.'+a... | agpl-3.0 | Python |
a4cd7bf2979f489a2b010936ed31803d79eba7c1 | Bump version for development | wikimedia/operations-debs-python-kafka,mumrah/kafka-python,scrapinghub/kafka-python,mumrah/kafka-python,Aloomaio/kafka-python,scrapinghub/kafka-python,Aloomaio/kafka-python,dpkp/kafka-python,wikimedia/operations-debs-python-kafka,ohmu/kafka-python,DataDog/kafka-python,ohmu/kafka-python,Yelp/kafka-python,dpkp/kafka-pyth... | kafka/version.py | kafka/version.py | __version__ = '1.2.6.dev'
| __version__ = '1.2.5'
| apache-2.0 | Python |
1062b6b1a82e0916f81a1544b0df92dbd03d6185 | update event handler test py file | GoogleCloudPlatform/fourkeys,GoogleCloudPlatform/fourkeys,GoogleCloudPlatform/fourkeys | terraform/modules/fourkeys-images/files/event_handler/event_handler_test.py | terraform/modules/fourkeys-images/files/event_handler/event_handler_test.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 |
d5f5033d0700f90625089e1a84112b19acf4912c | Improve search query performance | SCUEvals/scuevals-api,SCUEvals/scuevals-api | scuevals_api/resources/search.py | scuevals_api/resources/search.py | from flask_jwt_extended import jwt_required, get_jwt_identity
from flask_restful import Resource
from marshmallow import fields
from sqlalchemy import func
from sqlalchemy.orm import subqueryload
from scuevals_api.models import Role, Course, Department, School, Professor
from scuevals_api.roles import role_required
fr... | from flask_jwt_extended import jwt_required, get_jwt_identity
from flask_restful import Resource
from marshmallow import fields
from sqlalchemy import func
from sqlalchemy.orm import subqueryload
from scuevals_api.models import Role, Course, Department, School, Professor
from scuevals_api.roles import role_required
fr... | agpl-3.0 | Python |
c5970991ed2d3285e6a3ef9badb6e73756ff876b | Fix `assert_called` usage for Python 3.5 build | prkumar/uplink | tests/test_session.py | tests/test_session.py | # Local imports
from uplink import session
def test_base_url(uplink_builder_mock):
# Setup
uplink_builder_mock.base_url = "https://api.github.com"
sess = session.Session(uplink_builder_mock)
# Run & Verify
assert uplink_builder_mock.base_url == sess.base_url
def test_headers(uplink_builder_mock... | # Local imports
from uplink import session
def test_base_url(uplink_builder_mock):
# Setup
uplink_builder_mock.base_url = "https://api.github.com"
sess = session.Session(uplink_builder_mock)
# Run & Verify
assert uplink_builder_mock.base_url == sess.base_url
def test_headers(uplink_builder_mock... | mit | Python |
df71bbfd2d33ef76393fcd03355eefce023f9897 | replace deprecated get_model | iivvoo/resturo | resturo/models.py | resturo/models.py | from django.db import models
from django.conf import settings
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
class ModelResolver(object):
def __call__(self, name):
model_path = getattr(self, name)
try:
app_label, model_class_name = model_path.spl... | from django.db import models
from django.conf import settings
from django.db.models import get_model
from django.core.exceptions import ImproperlyConfigured
class ModelResolver(object):
def __call__(self, name):
model_path = getattr(self, name)
try:
app_label, model_class_name = mode... | isc | Python |
56716020f42ddd1abaed1d387f1ab76c4bd9ff73 | add unit test for reset method | anchore/anchore-engine,anchore/anchore-engine,anchore/anchore-engine | tests/unit/anchore_engine/services/policy_engine/engine/policy/test_gate.py | tests/unit/anchore_engine/services/policy_engine/engine/policy/test_gate.py | import pytest
from anchore_engine.services.policy_engine.engine.policy.gates import (
PackageCheckGate,
BaseTrigger,
)
from anchore_engine.services.policy_engine.engine.policy.gates.dockerfile import (
EffectiveUserTrigger,
)
from anchore_engine.services.policy_engine.engine.policy.gates.npms import (
... | import pytest
from anchore_engine.services.policy_engine.engine.policy.gates import PackageCheckGate
from anchore_engine.services.policy_engine.engine.policy.gates.dockerfile import (
EffectiveUserTrigger,
)
from anchore_engine.services.policy_engine.engine.policy.gates.npms import (
PkgMatchTrigger,
)
from an... | apache-2.0 | Python |
216bbaf8cdcf37acba56b9045a4c9967869d195f | make test_tracker safe to run in parallel | dsanders11/easypost-python,EasyPost/easypost-python | tests/test_tracker.py | tests/test_tracker.py | # Unit tests related to 'Trackers' (https://www.easypost.com/docs/api#tracking).
import datetime
import random
import easypost
def test_tracker_values():
for code, status in (
('EZ1000000001', 'pre_transit'),
('EZ2000000002', 'in_transit'),
('EZ3000000003', 'out_for_delivery'),
... | # Unit tests related to 'Trackers' (https://www.easypost.com/docs/api#tracking).
import easypost
def test_tracker():
# Create a tracker and then retrieve it. We assert on created and retrieved tracker's values.
tracker = easypost.Tracker.create(
tracking_code="EZ2000000002",
carrier="USPS"
... | mit | Python |
ad1ce131d37deb179314f00e23eca9bfcbad0be4 | add pre_dispatcher command | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | command_line/spot_counts_per_image.py | command_line/spot_counts_per_image.py | from __future__ import division
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export BOOST_ADAPTBX_FPE_DEFAULT=1
from dials.util.options import OptionParser
from dials.util.options import flatten_reflections, flatten_datablocks
from dials.algorithms.peak_finding import per_image_analysis
import iotbx.phil
phil_scope = iotbx.phi... | from dials.util.options import OptionParser
from dials.util.options import flatten_reflections, flatten_datablocks
from dials.algorithms.peak_finding import per_image_analysis
import iotbx.phil
phil_scope = iotbx.phil.parse("""\
plot=None
.type = path
individual_plots=False
.type = bool
id = None
.type = int(val... | bsd-3-clause | Python |
937fcb43d43c81dcdb6f65344022e68bedcdb324 | Remove zip archive after extraction | jakelever/kindred,jakelever/kindred | kindred/utils.py | kindred/utils.py |
import os
import zipfile
import hashlib
import requests
import logging
import traceback
import time
def _calcSHA256(filename):
return hashlib.sha256(open(filename, 'rb').read()).hexdigest()
def _findDir(name, path):
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
if name in dirs:
return os... |
import os
import zipfile
import hashlib
import requests
import logging
import traceback
import time
def _calcSHA256(filename):
return hashlib.sha256(open(filename, 'rb').read()).hexdigest()
def _findDir(name, path):
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
if name in dirs:
return os... | mit | Python |
37b00c5fb5afead3e793ee2677b4a910e90a4510 | split up into functions and handle token expiration | benediktg/wallabag-migration | post-articles.py | post-articles.py | #!/usr/bin/env python3
import requests
import configparser
import csv
import sys
counter = 0
def main(args):
config = configparser.ConfigParser()
config.read('credentials.ini')
hostname, payload = extractCreds(config)
token = getToken(hostname, payload)
fp = open(args[1], newline='')
reader... | #!/usr/bin/env python3
import requests
import configparser
import csv
import sys
counter = 0
def printf(text):
print(text, end='', flush=True)
def main(args):
c = configparser.ConfigParser()
c.read('credentials.ini')
c = c.defaults()
hostname = c['host']
username = c['username']
passw... | mit | Python |
e97b62425a8024ffcf447d1706aabebd5644a5ca | Update test_unicode.py | mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext | tests/test_unicode.py | tests/test_unicode.py | # coding: utf-8
import sys
import pytest
import jupytext
from .utils import list_all_notebooks
try:
unicode # Python 2
except NameError:
unicode = str # Python 3
@pytest.mark.parametrize('nb_file', list_all_notebooks('.ipynb') +
list_all_notebooks('.Rmd'))
def test_notebook_conte... | # coding: utf-8
import sys
import pytest
import jupytext
from .utils import list_all_notebooks
try:
unicode # Python 2
except NameError:
unicode = str # Python 3
@pytest.mark.parametrize('nb_file', list_all_notebooks('.ipynb') +
list_all_notebooks('.Rmd'))
def test_notebook_conte... | mit | Python |
141acf950ee9ffc211028bf96cab31a68fffcbe3 | Add a way to show local scorecards #9 | antoinecarme/sklearn_explain | tests/gen_makefile.py | tests/gen_makefile.py | import os
import glob
subdirs = ["tests/protoyping"] + glob.glob("tests/skl_datasets/*") + glob.glob("tests/skl_datasets_reg/*") + glob.glob("tests/issues/*") + glob.glob("tests/score_card/*")
build_tests = ['sample', 'tests_issues', 'iris', 'boston']
all_target = "";
build_target = "";
for subdir1 in subdirs:
... | import os
import glob
subdirs = ["tests/protoyping"] + glob.glob("tests/skl_datasets/*") + glob.glob("tests/skl_datasets_reg/*") + glob.glob("tests/issues/*")
build_tests = ['sample', 'tests_issues', 'iris', 'boston']
all_target = "";
build_target = "";
for subdir1 in subdirs:
test_target = "";
for filen... | bsd-3-clause | Python |
4ad76ef7e5193d0b88df24ca4b6f6f9cb58c3e3d | Add __init__.py | dkalashnik/tempest,afaheem88/tempest,pandeyop/tempest,neerja28/Tempest,flyingfish007/tempest,zsoltdudas/lis-tempest,Vaidyanath/tempest,openstack/tempest,jamielennox/tempest,ntymtsiv/tempest,dkalashnik/tempest,vedujoshi/os_tempest,nunogt/tempest,jamielennox/tempest,pandeyop/tempest,cloudbase/lis-tempest,itskewpie/tempes... | kong/__init__.py | kong/__init__.py | # Copyright 2011 OpenStack 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 ... | apache-2.0 | Python | |
3412b0db76f77a4772cf76c7794fbe61b58f5a25 | Select correct for vote detection | muffins-on-dope/bakery,muffins-on-dope/bakery,muffins-on-dope/bakery | bakery/views.py | bakery/views.py | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.views.generic import ListView, TemplateView, RedirectView
from django.contrib import auth
from bakery.cookies.models import Cookie
from bakery.socialize.models import Vote
class HomeView(ListView):
model = Cookie
template_name ... | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.views.generic import ListView, TemplateView, RedirectView
from django.contrib import auth
from bakery.cookies.models import Cookie
from bakery.socialize.models import Vote
class HomeView(ListView):
model = Cookie
template_name ... | bsd-3-clause | Python |
d635fc9129bc4ccfd5384be6958ae1c14e9916ec | Add persona merging to translation merge script | okfde/eucopyright,okfde/eucopyright,okfde/eucopyright | scripts/merge_translations.py | scripts/merge_translations.py | import sys
import yaml
def persona(old, new, overwrite_language):
old_t = old['translations']
new_t = new['translations']
for key in old_t:
if key in new_t and overwrite_language in new_t[key]:
old_t[key][overwrite_language] = new_t[key][overwrite_language]
def questions(old, new, ... | import sys
import yaml
def main(base_file, new_file, overwrite_language):
old = yaml.load(file(base_file).read())
new = yaml.load(file(new_file).read())
assert len(overwrite_language) == 2
for o, n in zip(old, new):
if overwrite_language in n['text']:
o['text'][overwrite_languag... | mit | Python |
59891c76620bcc0630f0d56bfac94040c8651233 | remove create key hook | openstates/openstates.org,openstates/openstates.org,openstates/openstates.org,openstates/openstates.org | profiles/apps.py | profiles/apps.py | from django.apps import AppConfig
def create_profile(sender, instance, **kwargs):
from profiles.models import Profile
Profile.objects.get_or_create(user=instance)
class ProfilesConfig(AppConfig):
name = "profiles"
def ready(self):
from django.db.models.signals import post_save
from... | from django.apps import AppConfig
def create_key_for_verified_user(sender, **kwargs):
from simplekeys.models import Key, Tier
email = kwargs["email_address"]
try:
Key.objects.get(email=email.email)
except Key.DoesNotExist:
Key.objects.create(
tier=Tier.objects.get(slug="de... | mit | Python |
a3525ca5e11b37a1bc76b2bebd84cf0d3b93a0c2 | fix lightsource hotkeys | campagnola/acq4,campagnola/acq4,meganbkratz/acq4,campagnola/acq4,meganbkratz/acq4,acq4/acq4,acq4/acq4,acq4/acq4,meganbkratz/acq4,campagnola/acq4,pbmanis/acq4,pbmanis/acq4,meganbkratz/acq4,pbmanis/acq4,pbmanis/acq4,acq4/acq4 | acq4/devices/LightSource/LightSource.py | acq4/devices/LightSource/LightSource.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from acq4.devices.Device import *
from acq4.util import Qt
import acq4.util.Mutex as Mutex
from collections import OrderedDict
class LightSource(Device):
"""Device tracking the state and properties of multiple illumination sources.
"""
# emitte... | # -*- coding: utf-8 -*-
from __future__ import print_function
from acq4.devices.Device import *
from acq4.util import Qt
import acq4.util.Mutex as Mutex
from collections import OrderedDict
class LightSource(Device):
"""Device tracking the state and properties of multiple illumination sources.
"""
# emitte... | mit | Python |
3a783f91a3cbb7e126af3f84969f92eb00a9a13d | Update dependency bazelbuild/bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google 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,... | # Copyright 2019 Google 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,... | apache-2.0 | Python |
50e8cddf423e48c2b8a7c6d38e10ff9a634e198a | add some better checkingto do_put | longaccess/longaccess-client,longaccess/longaccess-client,longaccess/longaccess-client | lacli/command.py | lacli/command.py | import os
import cmd
import glob
from lacli.upload import pool_upload
class LaCommand(cmd.Cmd):
""" Our LA command line interface"""
prompt='lacli> '
def __init__(self, tokens, *args, **kwargs):
cmd.Cmd.__init__(self, *args, **kwargs)
self.tokens=tokens
def do_tvmconf(self, line):
... | import os
import cmd
import glob
from lacli.upload import pool_upload
class LaCommand(cmd.Cmd):
""" Our LA command line interface"""
prompt='lacli> '
def __init__(self, tokens, *args, **kwargs):
cmd.Cmd.__init__(self, *args, **kwargs)
self.tokens=tokens
def do_tvmconf(self, line):
... | apache-2.0 | Python |
03a78a509c0213f8f95223a7926a1bce547f05fe | Initialize parent_pid in the Proc class init. | wglass/rotterdam | rotterdam/proc.py | rotterdam/proc.py | import logging
import os
import signal
from setproctitle import setproctitle
class Proc(object):
signal_map = {}
def __init__(self):
self.logger = logging.getLogger(self.__module__)
self.pid = None
self.parent_pid = None
@property
def name(self):
return self.__clas... | import logging
import os
import signal
from setproctitle import setproctitle
class Proc(object):
signal_map = {}
def __init__(self):
self.logger = logging.getLogger(self.__module__)
self.pid = None
@property
def name(self):
return self.__class__.__name__.lower()
def s... | mit | Python |
27768a69784f267af822b6b763a5c526285c7ba2 | print out evaluation data. | yashsavani/rechorder | predictor.py | predictor.py | #!/usr/bin/python
import util
import chordKMeans
import sys
import random
import numpy as np
np.set_printoptions(formatter={'float': lambda x: '%.2f\t'%x})
# part 1
if len(sys.argv) == 1:
midiFileName = 'default.mid'
else:
midiFileName = sys.argv[1]
barLists = util.getNGramBarList(midiFileName)
for x in barLis... | #!/usr/bin/python
import util
import chordKMeans
import sys
import random
import numpy as np
np.set_printoptions(formatter={'float': lambda x: '%.2f\t'%x})
# part 1
if len(sys.argv) == 1:
midiFileName = 'default.mid'
else:
midiFileName = sys.argv[1]
barLists = util.getNGramBarList(midiFileName)
for x in barLis... | mit | Python |
3f6b85b912c8819b362db5b37533c0810d7ce45d | Add tests for Varsh rule 8.7.2 (4) | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | tests/nuclear_test.py | tests/nuclear_test.py | """Tests for special utilities related to nuclear problems."""
import pytest
from sympy import Symbol, simplify, latex, symbols, KroneckerDelta
from drudge import NuclearBogoliubovDrudge, Range
from drudge.nuclear import JOf, TildeOf, MOf, NOf, LOf, PiOf, TOf, CG
@pytest.fixture(scope='module')
def nuclear(spark_ct... | """Tests for special utilities related to nuclear problems."""
import pytest
from sympy import Symbol, simplify, latex
from drudge import NuclearBogoliubovDrudge
from drudge.nuclear import JOf, TildeOf, MOf, NOf, LOf, PiOf, TOf
@pytest.fixture(scope='module')
def nuclear(spark_ctx):
"""Set up the drudge to test... | mit | Python |
ee6224bce1336bd0cf812033737a1a8c61c6323d | Update pydocs feature clean up (owner of the feature/application) (Lead: Kunal) | css-iter/org.csstudio.iter,ControlSystemStudio/org.csstudio.iter,ControlSystemStudio/org.csstudio.iter,ControlSystemStudio/org.csstudio.iter,ControlSystemStudio/org.csstudio.iter,ControlSystemStudio/org.csstudio.iter,ControlSystemStudio/org.csstudio.iter,css-iter/org.csstudio.iter,css-iter/org.csstudio.iter,css-iter/or... | build/org.csstudio.validation.scripts/check_feature.py | build/org.csstudio.validation.scripts/check_feature.py | '''
Created on Sep 17, 2014
A simple script which scans all feature.xml files under the directory it was invoked from to ensure
1. that none of them explicitly define JRE container
2. All features have a provider
3. All features have a description or description URL
4. No features have required plugins, tycho should ... | '''
Created on Sep 17, 2014
A simple script which scans all feature.xml files under the directory it was invoked from to ensure that none of them explicitly define JRE container
@author: Kunal Shroff
'''
import os.path
import sys
import xml.etree.ElementTree as ET
defaultDesc = "[Enter Feature Description here.]"... | epl-1.0 | Python |
1f418a7b6aa2f7879e32dc6857a3cb376485f1fc | Disable schema version update until FCS | csm-aut/csm,csm-aut/csm,csm-aut/csm,csm-aut/csm | csmserver/schema/base.py | csmserver/schema/base.py | # =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sour... | # =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sour... | apache-2.0 | Python |
b3b7161bc15bdc9f37a3bdd0cebce139ba1ba70a | use current directory | peterorum/functal,peterorum/functal,peterorum/functal,peterorum/functal,peterorum/functal | titles/fill-titles.py | titles/fill-titles.py | #!/usr/bin/python3
# add a title to any functal without one
import os
#import re
#import sys
# import json
#import random
#import collections
import time
import subprocess
from pprint import pprint
# pp = pprint.PrettyPrinter(indent=4)
import pymongo
client = pymongo.MongoClient(os.getenv('mongo_functal'))
db_topi... | #!/usr/bin/python3
# add a title to any functal without one
import os
#import re
#import sys
# import json
#import random
#import collections
import time
import subprocess
from pprint import pprint
# pp = pprint.PrettyPrinter(indent=4)
import pymongo
client = pymongo.MongoClient(os.getenv('mongo_functal'))
db_topi... | mit | Python |
235de58b16995b610ec06c28e6340e81fbc46b7b | Remove unused import | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | custom/ewsghana/forms.py | custom/ewsghana/forms.py | from corehq.apps.reminders.forms import BroadcastForm
from corehq.apps.reminders.models import (RECIPIENT_USER_GROUP,
RECIPIENT_LOCATION)
from crispy_forms import layout as crispy
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _, ugettext... | from corehq import toggles
from corehq.apps.reminders.forms import BroadcastForm
from corehq.apps.reminders.models import (RECIPIENT_USER_GROUP,
RECIPIENT_LOCATION)
from crispy_forms import layout as crispy
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation imp... | bsd-3-clause | Python |
86fea752c68ff5786556f5555ca580f2d0a9de85 | fix bug with debug handling | longaccess/longaccess-client,longaccess/longaccess-client,longaccess/longaccess-client | latvm/session.py | latvm/session.py | from latvm.tvm import MyTvm
from boto import config as boto_config
from boto.exception import NoAuthHandlerFound
class NoCredentialsException(Exception): pass
class UploadSession(object):
def __init__(self, uid=None, secs=3600, bucket='lastage', retries=0, debug=0):
self.uid=uid
self.secs=3600
... | from latvm.tvm import MyTvm
from boto import config as boto_config
from boto.exception import NoAuthHandlerFound
class NoCredentialsException(Exception): pass
class UploadSession(object):
def __init__(self, uid=None, secs=3600, bucket='lastage', retries=0, debug=0):
self.uid=uid
self.secs=3600
... | apache-2.0 | Python |
ce6a3a3833d498fa32a5317fd95e206cad9d5a83 | Add importing from __future__ & revise main() | bowen0701/algorithms_data_structures | alg_gcd.py | alg_gcd.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def gcd(m, n):
"""Greatest Common Divisor (GCD) by Euclid's Algorithm.
Time complexity: O(m%n).
"""
while n != 0:
m, n = n, m % n
return m
def main():
print('gcd(4, 2): {}'.f... | def gcd(m, n):
"""Greatest Common Divisor (GCD) by Euclid's Algorithm.
Time complexity: O(m%n).
"""
while n != 0:
m, n = n, m % n
return m
def main():
print(gcd(4, 2))
print(gcd(2, 4))
print(gcd(10, 4))
print(gcd(4, 10))
print(gcd(10, 1))
print(gcd(1, 10))
if _... | bsd-2-clause | Python |
6357d5e9e255b14ceb5f2905d4782837e4761738 | Revise gcd algorithm | bowen0701/algorithms_data_structures | alg_gcd.py | alg_gcd.py | def gcd(m, n):
"""Greatest Common Divisor (GCD) by Euclid's Algorithm.
Time complexity: O(m%n).
"""
while n != 0:
m, n = n, m % n
return m
def main():
print(gcd(4, 2))
print(gcd(2, 4))
print(gcd(10, 4))
print(gcd(4, 10))
print(gcd(10, 1))
print(gcd(1, 10))
if _... | def compute_gcd(m, n):
"""Compute the greatest common divisor (GCD) by Euclid's Algorithm.
Time complexity: O(m%n).
"""
while m % n != 0:
old_m = m
old_n = n
m = old_n
n = old_m % old_n
return n
| bsd-2-clause | Python |
c52b92c4f977bbb7eede968fad98113a5fe6c441 | Bump gtk-sharp to a newer build | BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild,mono/bockbuild | packages/gtk-sharp-2.12-release.py | packages/gtk-sharp-2.12-release.py | class GtkSharp212ReleasePackage (Package):
def __init__ (self):
Package.__init__ (self, 'gtk-sharp', '2.12.21', sources = ['http://files.xamarin.com/~duncan/gtk-sharp-2.12.21.tar.gz'])
# self.configure = './bootstrap-2.12 --prefix="%{prefix}"'
self.make = 'make CSC=gmcs'
GtkSharp212ReleasePackage ()
| class GtkSharp212ReleasePackage (Package):
def __init__ (self):
Package.__init__ (self, 'gtk-sharp', '2.12.12', sources = ['http://files.xamarin.com/~alan/gtk-sharp-2.12.12.tar.gz'])
# self.configure = './bootstrap-2.12 --prefix="%{prefix}"'
self.make = 'make CSC=gmcs'
GtkSharp212ReleasePackage ()
| mit | Python |
0b45ec48955f73a0e88422660af82ff6fd89333b | Use Tuesday branch on Tuesdays | DrDos0016/z2,DrDos0016/z2,DrDos0016/z2 | tools/crons/newwoz.py | tools/crons/newwoz.py | import os
import django
from datetime import datetime
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings")
django.setup()
from museum_site.wozzt_queue import WoZZT_Queue # noqa: E402
def main():
now = datetime.now()
if now.weekday() == 1: # Tuesday
entry = WoZZT_Queue.objects.filt... | import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings")
django.setup()
print("NEW WOZZT TEST")
from museum_site.wozzt_queue import WoZZT_Queue # noqa: E402
def main():
entry = WoZZT_Queue.objects.all().order_by("-priority", "id")[0]
entry.send_tweet()
entry.delete_... | mit | Python |
ed89c92ac56e89648bf965ea3aa8963e840e3a5c | Fix the unit test :) | StarbotDiscord/Starbot,dhinakg/BitSTAR,StarbotDiscord/Starbot,dhinakg/BitSTAR | tests/test_excuses.py | tests/test_excuses.py | # Copyright 2017 Starbot Discord Project
#
# 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 Starbot Discord Project
#
# 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 |
38749a0033c2acc6c9fd8971749c68f93cb9c0db | Add virtualenv.create function to enable easy virtualenv creation | ionelmc/virtualenv,ionelmc/virtualenv,ionelmc/virtualenv | virtualenv/__init__.py | virtualenv/__init__.py | from __future__ import absolute_import, division, print_function
from virtualenv.__about__ import (
__author__, __copyright__, __email__, __license__, __summary__, __title__,
__uri__, __version__
)
from virtualenv.core import create
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__aut... | from __future__ import absolute_import, division, print_function
from virtualenv.__about__ import (
__author__, __copyright__, __email__, __license__, __summary__, __title__,
__uri__, __version__
)
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license... | mit | Python |
65a3c3c28a673e1924441fbf42f172aba410921b | use print and catch keyboard interrupt | gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty | dusty/commands/client.py | dusty/commands/client.py | import subprocess
import logging
def call_command_from_client(shell_args, env=None):
print "Running command: {}".format(' '.join(shell_args))
try:
subprocess.call(shell_args, env=env)
except KeyboardInterrupt:
print "KeyboardInterrupt; terminating"
pass
| import subprocess
import logging
def call_command_from_client(shell_args, env=None):
logging.info("Running command: {}".format(' '.join(shell_args)))
subprocess.call(shell_args, env=env)
| mit | Python |
67ee63136e69d0c326be81e1ace72168af3dc2b3 | update try to nocaptcha packages | ninjaotoko/dynaform,ninjaotoko/dynaform,ninjaotoko/dynaform | dynaform/forms/fields.py | dynaform/forms/fields.py | # *-* coding:utf-8 *-*
import json
from django import forms
from dynaform.forms import widgets as custom_widgets
# Try importing ReCaptchaField
try:
import ReCaptchaField
except ImportError:
try:
from captcha.fields import ReCaptchaField
except ImportError:
try:
from nocaptcha_... | # *-* coding:utf-8 *-*
import json
from django import forms
from dynaform.forms import widgets as custom_widgets
# Try importing ReCaptchaField
try:
import ReCaptchaField
except ImportError:
try:
from captcha.fields import ReCaptchaField
except ImportError:
print 'ReCaptchaField was not loa... | bsd-3-clause | Python |
69573b07009f09eebba551db7d151f56660029b0 | Update time_selfies.py | aspuru-guzik-group/selfies | tests/time_selfies.py | tests/time_selfies.py | import os
import random
import time
from rdkit.Chem import Kekulize, MolFromSmiles, MolToSmiles
import selfies as sf
from selfies.encoder import _parse_smiles
from selfies.kekulize import kekulize_parser
def time_roundtrip(file_path: str, sample_size: int = -1):
"""Tests the amount of time it takes to encode an... | import os
import random
import time
from rdkit.Chem import Kekulize, MolFromSmiles, MolToSmiles
import selfies as sf
from selfies.encoder import _parse_smiles
from selfies.kekulize import kekulize_parser
def time_roundtrip(file_path: str, sample_size: int = -1):
"""Tests the amount of time it takes to encode an... | apache-2.0 | Python |
7508d48b12c88b37247ceeac9d3e15eb6c1fbfaa | Refactor and simplify parser | CivicKnowledge/metatab,CivicKnowledge/metatab,CivicKnowledge/metatab-py,Metatab/metatab,Metatab/metatab,CivicKnowledge/metatab-py | metatab/_meta.py | metatab/_meta.py | __version__ = '0.0.9'
__author__ = 'eric@civicknowledge.com' | __version__ = '0.0.8'
__author__ = 'eric@civicknowledge.com' | bsd-3-clause | Python |
20f9bbab583dea200a38da2578fbb9bc7bafaf92 | add 'dask_client_create()' to pyxrf.api package | NSLS-II/PyXRF,NSLS-II-HXN/PyXRF,NSLS-II-HXN/PyXRF | pyxrf/api.py | pyxrf/api.py | from .model.fileio import (stitch_fitted_results, spec_to_hdf, create_movie, # noqa: F401
combine_data_to_recon, h5file_for_recon, export_to_view, # noqa: F401
make_hdf_stitched) # noqa: F401
from .model.load_data_from_db import make_hdf, export1d # noqa: F401
... | from .model.fileio import (stitch_fitted_results, spec_to_hdf, create_movie, # noqa: F401
combine_data_to_recon, h5file_for_recon, export_to_view, # noqa: F401
make_hdf_stitched) # noqa: F401
from .model.load_data_from_db import make_hdf, export1d # noqa: F401
... | bsd-3-clause | Python |
2c17eac88106749344281686e7f83929d5883120 | add test for Pathhelper | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | server/Mars/Lib/PathHelper.py | server/Mars/Lib/PathHelper.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python |
2c50903030c8a00ce253acfd5ce3353f89ea039a | Update embed function | explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc | thinc/layers/embed.py | thinc/layers/embed.py | from typing import Callable, Tuple, Optional
from ..model import Model
from ..config import registry
from ..types import Array2d
from ..initializers import uniform_init
from ..util import get_width
InT = Array2d
OutT = Array2d
@registry.layers("Embed.v0")
def Embed(
nO: Optional[int] = None,
nV: int = 1,
... | from typing import Callable, Tuple, Optional
from ..model import Model
from ..config import registry
from ..types import Array2d
from ..initializers import uniform_init
from ..util import get_width
InT = Array2d
OutT = Array2d
@registry.layers("Embed.v0")
def Embed(
nO: Optional[int] = None,
nV: int = 1,
... | mit | Python |
1d356aa98af97894cb4c16e32d83bc3c774c840a | Bump up the version to 2.1 | mpi-sws-rse/thingflow-python,mpi-sws-rse/thingflow-python | thingflow/__init__.py | thingflow/__init__.py | # Copyright 2016 by MPI-SWS and Data-Ken Research.
# Licensed under the Apache 2.0 License.
"""
This is the main package for antevents. Directly within this package you fill
find the following module:
* `base` - the core abstractions and classes of the system.
The rest of the functionality is in sub-packages:
* `a... | # Copyright 2016 by MPI-SWS and Data-Ken Research.
# Licensed under the Apache 2.0 License.
"""
This is the main package for antevents. Directly within this package you fill
find the following module:
* `base` - the core abstractions and classes of the system.
The rest of the functionality is in sub-packages:
* `a... | apache-2.0 | Python |
0f47282af3845eafabb36f3cfa41557aef2445ed | Bump version to 1.2.7 | open-io/oio-swift,open-io/oio-swift | oioswift/__init__.py | oioswift/__init__.py | __version__ = '1.2.7'
| __version__ = '1.2.4'
| apache-2.0 | Python |
6d9dbc7e99ff8dabd26bc8ee323bce4bee3c5fb4 | bump version | matthiask/feincms-elephantblog,joshuajonah/feincms-elephantblog,sbaechler/feincms-elephantblog,michaelkuty/feincms-elephantblog,joshuajonah/feincms-elephantblog,sbaechler/feincms-elephantblog,matthiask/feincms-elephantblog,michaelkuty/feincms-elephantblog,joshuajonah/feincms-elephantblog,feincms/feincms-elephantblog,mi... | elephantblog/__init__.py | elephantblog/__init__.py | from __future__ import absolute_import, unicode_literals
VERSION = (0, 3, 3)
__version__ = '.'.join(map(str, VERSION))
| from __future__ import absolute_import, unicode_literals
VERSION = (0, 3, 2)
__version__ = '.'.join(map(str, VERSION))
| bsd-3-clause | Python |
a7a68a5f7e4825888ae1ec166afc00df6fc72b0e | Fix docstring | darkfeline/mir.anidb | mir/anidb/api.py | mir/anidb/api.py | # Copyright (C) 2016, 2017 Allen Li
#
# 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 w... | # Copyright (C) 2016, 2017 Allen Li
#
# 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 w... | apache-2.0 | Python |
df35c2bd6a5a78469870f5bc5ca822b197451b9d | Update test.py | HuimingCheng/AutoGrading,Hubert51/AutoGrading,Hubert51/AutoGrading,HuimingCheng/AutoGrading,Hubert51/AutoGrading,Hubert51/AutoGrading,HuimingCheng/AutoGrading,HuimingCheng/AutoGrading,Hubert51/AutoGrading,HuimingCheng/AutoGrading | learning/test.py | learning/test.py | import cv2
| print(120)
| mit | Python |
c58ddb58e6c35142eba077f86654d2a69a04504a | Fix astrobin_apps_notifications tests | astrobin/astrobin,astrobin/astrobin,astrobin/astrobin,astrobin/astrobin | astrobin_apps_notifications/tests.py | astrobin_apps_notifications/tests.py | # Django
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
# This app
from astrobin_apps_notifications.utils import *
from astrobin_apps_notifications.templatetags.astrobin_apps_notifications_tags import *
class NotificationsTest(TestCase):
... | # Django
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
# This app
from astrobin_apps_notifications.utils import *
from astrobin_apps_notifications.templatetags.astrobin_apps_notifications_tags import *
class NotificationsTest(TestCase):
... | agpl-3.0 | Python |
1eb4d00e005f22ae452ce9d36b9fce69fa9b96f7 | Drop extra trailing slash from notices_url | astrobin/astrobin,astrobin/astrobin,astrobin/astrobin,astrobin/astrobin | astrobin_apps_notifications/utils.py | astrobin_apps_notifications/utils.py | # Python
import simplejson
import urllib2
# Django
from django.conf import settings
from django.template.loader import render_to_string
# Third party
from gadjo.requestprovider.signals import get_request
from notification import models as notification
from persistent_messages.models import Message
import persistent_m... | # Python
import simplejson
import urllib2
# Django
from django.conf import settings
from django.template.loader import render_to_string
# Third party
from gadjo.requestprovider.signals import get_request
from notification import models as notification
from persistent_messages.models import Message
import persistent_m... | agpl-3.0 | Python |
3d813e9960a44bfacd94551b95caf489b85ea3bb | Fix typo in upgrade script | exocad/exotrac,dafrito/trac-mirror,dokipen/trac,dokipen/trac,dokipen/trac,exocad/exotrac,exocad/exotrac,dafrito/trac-mirror,moreati/trac-gitsvn,moreati/trac-gitsvn,dafrito/trac-mirror,exocad/exotrac,moreati/trac-gitsvn,dafrito/trac-mirror,moreati/trac-gitsvn | trac/upgrades/db11.py | trac/upgrades/db11.py | import os.path
import shutil
sql = """
-- Remove empty values from the milestone list
DELETE FROM milestone WHERE COALESCE(name,'')='';
-- Add a description column to the version table, and remove unnamed versions
CREATE TEMP TABLE version_old AS SELECT * FROM version;
DROP TABLE version;
CREATE TABLE version (
... | import os.path
import shutil
sql = """
-- Remove empty values from the milestone list
DELETE FROM milestone WHERE COALESCE(name,'')='';
-- Add a description column to the version table, and remove unnamed versions
CREATE TEMP TABLE version_old AS SELECT * FROM version;
DROP TABLE version;
CREATE TABLE version (
... | bsd-3-clause | Python |
36f5789686f16e463f76843664c654465c52d406 | add comment disabling tasks | praekelt/ummeli,praekelt/ummeli,praekelt/ummeli | ummeli/vlive/tasks.py | ummeli/vlive/tasks.py | from celery.task import task
from celery.task.sets import TaskSet
from vumiclient.client import Client
from django.conf import settings
from django.core.mail import send_mail, EmailMessage
from jmboarticles.models import Article
@task(ignore_result=True)
def send_password_reset(msisdn, new_password):
message = '... | from celery.task import task
from celery.task.sets import TaskSet
from vumiclient.client import Client
from django.conf import settings
from django.core.mail import send_mail, EmailMessage
@task(ignore_result=True)
def send_password_reset(msisdn, new_password):
message = 'Ummeli on YAL :) Your new password is: %s... | bsd-3-clause | Python |
e521b16844efc2853c0db9014098cb3e37f6eb04 | Add missing returns to the array API sorting functions | jakirkham/numpy,numpy/numpy,mhvk/numpy,seberg/numpy,pdebuyl/numpy,numpy/numpy,numpy/numpy,jakirkham/numpy,anntzer/numpy,charris/numpy,simongibbons/numpy,endolith/numpy,simongibbons/numpy,mhvk/numpy,seberg/numpy,mattip/numpy,mattip/numpy,jakirkham/numpy,mhvk/numpy,charris/numpy,seberg/numpy,simongibbons/numpy,pdebuyl/nu... | numpy/_array_api/_sorting_functions.py | numpy/_array_api/_sorting_functions.py | def argsort(x, /, *, axis=-1, descending=False, stable=True):
from .. import argsort
from .. import flip
# Note: this keyword argument is different, and the default is different.
kind = 'stable' if stable else 'quicksort'
res = argsort(x, axis=axis, kind=kind)
if descending:
res = flip(r... | def argsort(x, /, *, axis=-1, descending=False, stable=True):
from .. import argsort
from .. import flip
# Note: this keyword argument is different, and the default is different.
kind = 'stable' if stable else 'quicksort'
res = argsort(x, axis=axis, kind=kind)
if descending:
res = flip(r... | bsd-3-clause | Python |
f6715a47447a3fd22d62d6f9309d1d9a156b5a85 | Bump version. | albfan/pudb,amigrave/pudb,albfan/pudb,amigrave/pudb | pudb/__init__.py | pudb/__init__.py | VERSION = "0.92.6"
CURRENT_DEBUGGER = [None]
def set_trace():
if CURRENT_DEBUGGER[0] is None:
from pudb.debugger import Debugger
dbg = Debugger()
CURRENT_DEBUGGER[0] = dbg
import sys
dbg.set_trace(sys._getframe().f_back)
def post_mortem(t):
p = Debugger()
p.r... | VERSION = "0.92.5"
CURRENT_DEBUGGER = [None]
def set_trace():
if CURRENT_DEBUGGER[0] is None:
from pudb.debugger import Debugger
dbg = Debugger()
CURRENT_DEBUGGER[0] = dbg
import sys
dbg.set_trace(sys._getframe().f_back)
def post_mortem(t):
p = Debugger()
p.r... | mit | Python |
12d71e50d335f8a095e3049af333112204d45775 | Remove unused import from singleton | dqnykamp/sympy,dqnykamp/sympy,sahmed95/sympy,VaibhavAgarwalVA/sympy,jerli/sympy,Vishluck/sympy,cccfran/sympy,aktech/sympy,sahmed95/sympy,sampadsaha5/sympy,wanglongqi/sympy,chaffra/sympy,chaffra/sympy,ga7g08/sympy,debugger22/sympy,beni55/sympy,abhiii5459/sympy,mcdaniel67/sympy,Davidjohnwilson/sympy,wyom/sympy,aktech/sym... | sympy/core/singleton.py | sympy/core/singleton.py | """Singleton mechanism"""
from core import BasicMeta, Registry
from sympify import sympify
class SingletonRegistry(Registry):
"""
A map between singleton classes and the corresponding instances.
E.g. S.Exp == C.Exp()
"""
__slots__ = []
__call__ = staticmethod(sympify)
def __repr__(self):... | """Singleton mechanism"""
from core import BasicMeta, Registry
from sympify import sympify
from basic import Basic
class SingletonRegistry(Registry):
"""
A map between singleton classes and the corresponding instances.
E.g. S.Exp == C.Exp()
"""
__slots__ = []
__call__ = staticmethod(sympify)
... | bsd-3-clause | Python |
8846f410ffdc707e648d6786dd31247f0412eccf | Update version.py | scieloorg/packtools,scieloorg/packtools,scieloorg/packtools | packtools/version.py | packtools/version.py | """Single source to the version across setup.py and the whole project.
"""
from __future__ import unicode_literals
__version__ = '2.10.2'
| """Single source to the version across setup.py and the whole project.
"""
from __future__ import unicode_literals
__version__ = '2.10.0'
| bsd-2-clause | Python |
f57511df7de901f3694fa4225af458e192975299 | Fix PdfDict: __getattr__, not __getattribute__ | ajmarks/gymnast,ajmarks/gymnast | pdf_parser/pdf_types/compound_types.py | pdf_parser/pdf_types/compound_types.py | from .common import PdfType
class PdfArray(PdfType, list):
def __init__(self, *args, **kwargs):
PdfType.__init__(self)
list.__init__(self, *args, **kwargs)
class PdfDict(PdfType, dict):
def __init__(self, *args, **kwargs):
PdfType.__init__(self)
dict.__init__(self, *args, **kwa... | from .common import PdfType
class PdfArray(PdfType, list):
def __init__(self, *args, **kwargs):
PdfType.__init__(self)
list.__init__(self, *args, **kwargs)
class PdfDict(PdfType, dict):
def __init__(self, *args, **kwargs):
PdfType.__init__(self)
dict.__init__(self, *args, **kwa... | mit | Python |
e8fdc11c227c47ed2d26ce5516bad305a63c64d9 | update migration for django 2 compatibility | okfn/foundation,okfn/website,okfn/foundation,okfn/website,okfn/website,okfn/foundation,okfn/website,okfn/foundation | aldryn_video/migrations/0001_initial.py | aldryn_video/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('cms', '0015_auto_20160421_0000'),
('contenttypes', '0001_initial'),
]
operations = [
migrati... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('cms', '0015_auto_20160421_0000'),
('contenttypes', '0001_initial'),
]
operations = [
migrati... | mit | Python |
3cb6a475008dfa4eacb1f25175737dbf0754eee2 | Fix error when logging removal of soft-deleted project | opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind | src/waldur_mastermind/support/log.py | src/waldur_mastermind/support/log.py | from waldur_core.logging.loggers import EventLogger, event_logger
from waldur_core.structure.models import Project
from waldur_core.structure.permissions import _get_project
from . import models
def get_issue_scopes(issue):
result = set()
if issue.resource:
project = _get_project(issue.resource)
... | from waldur_core.logging.loggers import EventLogger, event_logger
from waldur_core.structure.models import Project
from waldur_core.structure.permissions import _get_project
from . import models
def get_issue_scopes(issue):
result = set()
if issue.resource:
project = _get_project(issue.resource)
... | mit | Python |
070b532b041cec627b9823e8030c3e8d974e18c4 | prepare 1.6.0 | naphatkrit/easyci | easyci/__init__.py | easyci/__init__.py | __version__ = '1.6.0'
| __version__ = '1.5.0'
| mit | Python |
ae5591de01e00a018c302d4eb5afd1831fbd0812 | add phone number | dropbox-dashbpard/error-detect-of-log,dropbox-dashbpard/error-detect-of-log | ed/kernel_panic.py | ed/kernel_panic.py | from utils import detect_string, gen_hashcode, jsonify_headers
KERNEL_PANIC = [
r"(kernel BUG at[^\n]+)",
r"(spinlock bad magic)",
r"(Unable to handle kernel[^\n]+)",
r"(modem subsystem failure reason:.*Could not turn on the UNIV_STMR ustmr_qtimer_off_counter)",
r"(\w+ subsystem failure reason:[^\... | from utils import detect_string, gen_hashcode, jsonify_headers
import time
KERNEL_PANIC = [
r"(kernel BUG at[^\n]+)",
r"(spinlock bad magic)",
r"(Unable to handle kernel[^\n]+)",
r"(modem subsystem failure reason:.*Could not turn on the UNIV_STMR ustmr_qtimer_off_counter)",
r"(\w+ subsystem failur... | mit | Python |
63f996ae03cf3991d12070c20fe57e4cf4e8213d | bump version | timxx/gitc,timxx/gitc | qgitc/version.py | qgitc/version.py | # -*- coding: utf-8 -*-
VERSION_MAJOR = 3
VERSION_MINOR = 0
VERSION_PATCH = 1
VERSION = "{}.{}.{}".format(VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH)
| # -*- coding: utf-8 -*-
VERSION_MAJOR = 3
VERSION_MINOR = 0
VERSION_PATCH = 0
VERSION = "{}.{}.{}".format(VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH)
| apache-2.0 | Python |
b532e7e1c8e5fe1fa705e9fd438134ac1001d771 | Refactor estimator module | raviqqe/tensorflow-qnd,raviqqe/tensorflow-qnd | qnd/estimator.py | qnd/estimator.py | import functools
import inspect
import typing
import tensorflow as tf
import tensorflow.contrib.learn as learn
from . import util
from .config import def_config
def def_estimator(distributed=False):
config = def_config(distributed)
@util.func_scope
def estimator(model_fn, model_dir):
return tf.... | import functools
import inspect
import tensorflow as tf
import tensorflow.contrib.learn as learn
from . import util
from .config import def_config
def def_estimator(distributed=False):
config = def_config(distributed)
@util.func_scope
def estimator(model_fn, model_dir):
return tf.contrib.learn.... | unlicense | Python |
9c5bd21ae44f81255815ce0d184c4e1319e8f415 | Add GUI imports to qtui/__init__.py | metamarcdw/metamarket,IIIIIHIIIII/metamarket | qtui/__init__.py | qtui/__init__.py | from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from metamarket_qt import *
from view_ident_dialog import *
from view_offer_dialog import *
from view_market_dialog import *
from view_chanmsg_dialog import *
from import_market_dialog import *
from send_chanmsg_dialog import *
from a... | mit | Python | |
e1e6624b97455fe73cce951a7a934464a16d8197 | Update to utils to cope with either python 3 or 2 type strings. | TyMaszWeb/django-template-finder | templatefinder/utils.py | templatefinder/utils.py | import fnmatch
import logging
import os
from django.conf import settings
from django.utils.importlib import import_module
try:
from django.utils.six import string_types
except ImportError:
string_types = (basestring,)
__all__ = ('find_all_templates', 'flatten_template_loaders')
LOGGER = logging.getLogger('... | import fnmatch
import logging
import os
from django.conf import settings
from django.utils.importlib import import_module
__all__ = ('find_all_templates', 'flatten_template_loaders')
LOGGER = logging.getLogger('templatefinder')
def flatten_template_loaders(templates):
"""
Given a collection of template l... | bsd-2-clause | Python |
8f5f162938d449c58cd8b6d6d379c38c7da7ae23 | Fix upgrade to schema version 21 for PostgreSQL databases. Closes #5593. | pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac | trac/upgrades/db21.py | trac/upgrades/db21.py |
def do_upgrade(env, ver, cursor):
"""Upgrade the reports to better handle the new workflow capabilities"""
db = env.get_db_cnx()
owner = db.concat('owner', "' *'")
cursor.execute('SELECT id, query, description FROM report')
reports = cursor.fetchall()
for report, query, description in reports:
... |
def do_upgrade(env, ver, cursor):
"""Upgrade the reports to better handle the new workflow capabilities"""
db = env.get_db_cnx()
owner = db.concat('owner', "' *'")
reports = list(cursor.execute('SELECT id, query, description FROM report'))
for report, query, description in reports:
# All st... | bsd-3-clause | Python |
0db5c9b2cc9bed0f43931030269db19862c03ae5 | Remove support for writing config options. This also solves Issue 60 | liuyi1112/rst2pdf,pombreda/rst2pdf,pombreda/rst2pdf,rst2pdf/rst2pdf,liuyi1112/rst2pdf,rst2pdf/rst2pdf | rst2pdf/config.py | rst2pdf/config.py | # -*- coding: utf-8 -*-
# Singleton config object
import ConfigParser
import os
from simplejson import dumps, loads
cfdir=os.path.join(os.path.expanduser('~'),'.rst2pdf')
cfname=os.path.join(cfdir,'config')
def getValue(section,key,default=None):
section=section.lower()
key=key.lower()
try:
return loads(c... | # -*- coding: utf-8 -*-
# Singleton config object
import ConfigParser
import os
from simplejson import dumps, loads
cfdir=os.path.join(os.path.expanduser('~'),'.rst2pdf')
cfname=os.path.join(cfdir,'config')
def getValue(section,key,default=None):
section=section.lower()
key=key.lower()
try:
return loads(c... | mit | Python |
b7de4f92e72092cd8d83e0cbcf20be67a086bbe2 | refactor out common constructor code | davegoopot/ee-balance-checker,davegoopot/ee-balance-checker | ee_balance_test.py | ee_balance_test.py | import unittest
from ee_balance import *
class EEUnitTests(unittest.TestCase):
def setUp(self):
config = ""
with open("secret.auth","r") as f:
config = f.read()
self.eecon = EEConnector.construct_from_config(config)
def test_fetch_login_page(self):
... | import configparser
import unittest
from ee_balance import *
class EEUnitTests(unittest.TestCase):
def setUp(self):
config = configparser.ConfigParser()
config.read('secret.auth')
self.eecon = EEConnector(username=config['auth']['username'], password=config['auth']['password'])
... | agpl-3.0 | Python |
7b23f3956a5a05f6659684499e848a8c96270b53 | bump version to 0.4.0.b1 | jepegit/cellpy,jepegit/cellpy | cellpy/_version.py | cellpy/_version.py | version_info = (0, 4, 0, "b1")
__version__ = ".".join(map(str, version_info))
| version_info = (0, 4, 0, "a5")
__version__ = ".".join(map(str, version_info))
| mit | Python |
78f5006bd5182317200d3396481cd4afd9e95417 | Fix typo in forms.py. | ulule/django-linguist | linguist/forms.py | linguist/forms.py | # -*- coding: utf-8 -*_
from django import forms
from django.forms.models import BaseInlineFormSet
from .utils.i18n import get_language
__all__ = [
'TranslationModelFormMixin',
'TranslationModelForm',
]
class TranslationModelFormMixin(object):
language = None
def __init__(self, *args, **kwargs):
... | # -*- coding: utf-8 -*_
from django import forms
from django.forms.models import BaseInlineFormSet
from .utils.i18n import get_language
__all__ = [
'TranslationModelFormMixin',
'TranslationModelForm',
]
class TranslationModelFormMixin(object):
language = None
def __init__(self, *args, **kwargs):
... | mit | Python |
d6b8156d18a358b594ecf8efe4c6f9de26e4af16 | allow more tolerance | rlowrance/mlpack,rlowrance/mlpack | random_sample.py | random_sample.py | import numpy as np
import unittest
import pdb
def rand(d):
'''Generate random np.array sample of size d drawn uniformly from [0,1]'''
while True:
result = np.random.rand(d)
yield result
def randn(d, mean, var):
'''Generate random np.array sample of size d drawn from N(mean, var) '''
... | import numpy as np
import unittest
import pdb
def rand(d):
'''Generate random np.array sample of size d drawn uniformly from [0,1]'''
while True:
result = np.random.rand(d)
yield result
def randn(d, mean, var):
'''Generate random np.array sample of size d drawn from N(mean, var) '''
... | mit | Python |
ec15cfe29eb4f99725315d54c97d99d81e3b3ccc | Enable Config instantiation from kwargs only | oleiade/Elevator | elevator/config.py | elevator/config.py | # -*- coding: utf-8 -*-
# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.
from ConfigParser import ConfigParser
from utils.snippets import items_to_dict
class Config(dict):
"""
Unix shells like environment class. Implements add,
get, load, flush methods. Handles lists of... | # -*- coding: utf-8 -*-
# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.
from ConfigParser import ConfigParser
from utils.snippets import items_to_dict
class Config(dict):
"""
Unix shells like environment class. Implements add,
get, load, flush methods. Handles lists of... | mit | Python |
eb5ea3eaa830482471ede267a57902c093b8a6d6 | Update : add some output server runner | oleiade/Elevator | elevator/server.py | elevator/server.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import zmq
import leveldb
import threading
from database import Backend, Frontend
def run():
backend = Backend('test')
frontend = Frontend('tcp://127.0.0.1:4141')
poll = zmq.Poller()
poll.register(backend.socket, zmq.POLLIN)
poll.register(... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import zmq
import leveldb
import threading
from database import Backend, Frontend
def run():
backend = Backend('test')
frontend = Frontend('tcp://127.0.0.1:4141')
poll = zmq.Poller()
poll.register(backend.socket, zmq.POLLIN)
poll.register(frontend.so... | mit | Python |
debbfdbcf66d8ba015a878a19a8ddcb1531fcbf9 | check github acc v.2 | DTailor/trolly,DTailor/trolly | trolly/faver/views.py | trolly/faver/views.py | from django.shortcuts import render_to_response
from django.http import HttpResponse
from .models import GeoLocation, StopTime, StationStop
from django.core import serializers
import json
from .utils import get_normalized_time
def index(request):
stations = serializers.serialize(
'json', GeoLocation.objec... | from django.shortcuts import render_to_response
from django.http import HttpResponse
from .models import GeoLocation, StopTime, StationStop
from django.core import serializers
from .utils import get_normalized_time
import json
def index(request):
stations = serializers.serialize(
'json', GeoLocation.objec... | mit | Python |
fa1909f13414dd8106f7624f264945957b5308df | fix building in python 2 | jaimeMF/pyucl | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown h... | # -*- coding: utf-8 -*-
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(... | unlicense | Python |
2e88589c8da300cf06616b0e77978f86a665bac5 | Bump version to 1.3.0 | dmulholland/syntex,dmulholland/syntex | monk/__init__.py | monk/__init__.py | # ------------------------------------------------------------------------------
# Monk: a lightweight, markdownish markup language.
#
# Author: Darren Mulholland <darren@mulholland.xyz>
# License: Public Domain
# ------------------------------------------------------------------------------
# Package version number.
... | # ------------------------------------------------------------------------------
# Monk: a lightweight, markdownish markup language.
#
# Author: Darren Mulholland <darren@mulholland.xyz>
# License: Public Domain
# ------------------------------------------------------------------------------
# Package version number.
... | unlicense | Python |
0ce7e598bf4ca6bcae1ca874c5f20081182e91f9 | test stop service | iottly/iottly-device-agent-py,iottly/iottly-device-agent-py | iottly-device-agent-py/main.py | iottly-device-agent-py/main.py | """
Copyright 2015 Stefano Terna
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... | """
Copyright 2015 Stefano Terna
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... | apache-2.0 | Python |
9e394259cdb61eb34cf9f170f161083e18c2b981 | Bump version to 0.0.8 | portfoliome/pgawedge | pgawedge/_version.py | pgawedge/_version.py | version_info = (0, 0, 8)
__version__ = '.'.join(map(str, version_info))
| version_info = (0, 0, 7)
__version__ = '.'.join(map(str, version_info))
| mit | Python |
d19da9627ca84b6627347647e7829e43e39a1576 | add function includes() | plepe/pgmapcss,plepe/pgmapcss | pgmapcss/includes.py | pgmapcss/includes.py | _includes = {}
def register_includes(inc):
global _includes
_includes = dict(list(_includes.items()) + list(inc.items()))
def include_text():
global _includes
ret = ''
for name, function in _includes.items():
ret += function
return ret
def includes():
global _includes
print(_... | includes = {}
def register_includes(inc):
global includes
includes = dict(list(includes.items()) + list(inc.items()))
def include_text():
global includes
ret = ''
for name, function in includes.items():
ret += function
return ret
| agpl-3.0 | Python |
b8ffb619a26e27f1376bf8a39e752cdf2eb3afac | Make copyright year consistent with license | astropy/astropy-helpers,dpshelio/astropy-helpers,dpshelio/astropy-helpers,astropy/astropy-helpers,Cadair/astropy-helpers,Cadair/astropy-helpers | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
project = 'astropy-helpers'
copyright = '2014, The Astropy Developers'
author = 'The Astropy Developers'
# We need to get the version number from the package
import sys # noqa
sys.path.insert(0, '..')
import astropy_helpers # noqa
version = astropy_helpers.__version__
release = astropy_helpe... | # -*- coding: utf-8 -*-
project = 'astropy-helpers'
copyright = '2019, The Astropy Developers'
author = 'The Astropy Developers'
# We need to get the version number from the package
import sys # noqa
sys.path.insert(0, '..')
import astropy_helpers # noqa
version = astropy_helpers.__version__
release = astropy_helpe... | bsd-3-clause | Python |
143233cf237a9f8e45718f4860e8b4ec5c4e1a6c | Make regtab a class attribute | mossberg/spym,mossberg/spym | registers.py | registers.py | class Registers(object):
regtab = {
'v0': 2, 'v1': 3,
'a0': 4, 'a1': 5, 'a2': 6, 'a3': 7,
't0': 8, 't1': 9, 't2': 10, 't3': 11, 't4': 12, 't5': 13, 't6': 14, 't7': 15,
's0': 16, 's1': 17, 's2': 18, 's3': 19, 's4': 20, 's5': 21, 's6': 22, 's7': 23,
't8': 24, 't9': 25,
... | class Registers(object):
def __init__(self):
self.registers = [0 for _ in xrange(32)]
self.regtab = {
'v0': 2, 'v1': 3,
'a0': 4, 'a1': 5, 'a2': 6, 'a3': 7,
't0': 8, 't1': 9, 't2': 10, 't3': 11, 't4': 12, 't5': 13, 't6': 14, 't7': 15,
's0': 16, 's1': 17... | mit | Python |
4f26f73d7206d052307ac8ceaf6fef6b472d8162 | move pikelangprogram parser to init | groteworld/pikalang,grotewold/pikalang | pikalang/__init__.py | pikalang/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pikalang module.
A brainfuck derivative based off the vocabulary of Pikachu from Pokemon.
Copyright (c) 2019 Blake Grotewold
"""
import sys
import os
from pikalang.parser import PikalangParser
MAX_LOCATIONS = 20
class PikalangProgram:
def __init__(self, source)... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pikalang module.
A brainfuck derivative based off the vocabulary of Pikachu from Pokemon.
Copyright (c) 2019 Blake Grotewold
"""
import sys
import os
from pikalang.parser import PikalangParser
MAX_LOCATIONS = 20
class PikalangProgram:
def __init__(self, source)... | mit | Python |
9dd39bf0ea32f51bac3e614f28ce69276c8955d4 | add max_content_length to default_settings | datagovuk/ckanext-archiver,ckan/ckanext-archiver,datagovuk/ckanext-archiver,DanePubliczneGovPl/ckanext-archiver,datagovuk/ckanext-archiver,ckan/ckanext-archiver,DanePubliczneGovPl/ckanext-archiver,DanePubliczneGovPl/ckanext-archiver,ckan/ckanext-archiver | ckanext/archiver/default_settings.py | ckanext/archiver/default_settings.py | # path to ckan config file
CKAN_CONFIG = '/home/okfn/pyenv/src/ckan/ckan.ini'
# directory to save downloaded files to
ARCHIVE_DIR = '/tmp/archive'
# Use this user name when requesting data from ckan
ARCHIVE_USER = u'okfn_maintenance'
# Max content-length of archived files, larger files will be ignored
MAX_CONTENT_LE... | # path to ckan config file
CKAN_CONFIG = '/home/okfn/pyenv/src/ckan/ckan.ini'
# directory to save downloaded files to
ARCHIVE_DIR = '/tmp/archive'
# Use this user name when requesting data from ckan
ARCHIVE_USER = u'okfn_maintenance'
| mit | Python |
64172679bd860119f1ecb8960542160bd7b8670e | Kill eventlet after successful registration | royragsdale/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF | picoCTF-web/tests/load/registration.py | picoCTF-web/tests/load/registration.py | """Register various types of users and store their login credentials."""
import random
import uuid
from locust import HttpLocust, TaskSet, task
from locust.exception import StopLocust
from demographics_generator import get_affiliation, get_country_code, get_user_type, get_username, get_password, get_email, get_demogr... | """Register various types of users and store their login credentials."""
import random
import uuid
from locust import HttpLocust, TaskSet, task
from demographics_generator import get_affiliation, get_country_code, get_user_type, get_username, get_password, get_email, get_demographics
MONGO_HOST = "127.0.0.1"
MONGO_... | mit | Python |
94e054b0d8b72cdc61a5b45b89010e183c2888b7 | Fix for PEP8 | danielkoster/argosd | argosd/argosd.py | argosd/argosd.py | import sys
import logging
import signal
from queue import PriorityQueue
from peewee import *
from argosd import settings
from argosd.scheduling import TaskScheduler, TaskRunner
from argosd.models import Show, Episode
from argosd.api.app import Api
class ArgosD:
"""Main ArgosD class. Starts all runners and proce... | import sys
import logging
import signal
from queue import PriorityQueue
from peewee import *
from argosd import settings
from argosd.scheduling import TaskScheduler, TaskRunner
from argosd.models import Show, Episode
from argosd.api.app import Api
class ArgosD:
"""Main ArgosD class. Starts all runners and proce... | mit | Python |
03bef8e094032c2f8a10236166e67ed69f8fcbd2 | Fix missing closing quotes in translate help message | thomasleese/smartbot-old,tomleese/smartbot,Muzer/smartbot,Cyanogenoid/smartbot | plugins/translate.py | plugins/translate.py | import sys
import re
from textblob import TextBlob
class Plugin:
matcher = re.compile(r'translate (?:from ([^ ]+) )?(?:to ([^ ]+) )?(.*)')
def on_command(self, bot, msg, stdin, stdout, reply):
match = self.matcher.match(msg["message"])
if not match:
return
from_lang = ma... | import sys
import re
from textblob import TextBlob
class Plugin:
matcher = re.compile(r'translate (?:from ([^ ]+) )?(?:to ([^ ]+) )?(.*)')
def on_command(self, bot, msg, stdin, stdout, reply):
match = self.matcher.match(msg["message"])
if not match:
return
from_lang = ma... | mit | Python |
c455c68661af2e14cdfa44bbd2fbde81dd065c8e | improve multidownload header | keatonb/PTFViewer | multidownload.py | multidownload.py | #!/usr/bin/python
"""
Script to download Palomar Transient Factory light curves for a list of targets
for visualization with PTFViewer: https://github.com/keatonb/PTFViewer
input csv file should have format:
targetname,rad,decd
where rad and decd are the RA and Dec in decimal degrees.
WARNING: Downloads data for near... | #!/usr/bin/python
"""
Script to download Palomar Transient Factory light curves for a list of targets
for visualization with PTFViewer: https://github.com/keatonb/PTFViewer
input csv file should have format:
targetname,rad,decd
where rad and decd are the RA and Dec in decimal degrees.
WARNING: Downloads data for near... | mit | Python |
e424a285eb7d326bae8b2a7948778c323d0c29e2 | Add BondViewSet | bsmukasa/bond_analytics | bond_analytics_project/bondapi/views.py | bond_analytics_project/bondapi/views.py | from django.shortcuts import render
from rest_framework.viewsets import ModelViewSet
from models import Bond
from serializers import BondSerializer
class BondViewSet(ModelViewSet):
serializer_class = BondSerializer
queryset = Bond.objects.all()
| from django.shortcuts import render
# Create your views here.
| mit | Python |
ec71948a3f1789d374b6f477ff50ad3ae3405285 | Make string check python 2 and 3 compatible. | ui/django-post_office,jrief/django-post_office,RafRaf/django-post_office,ekohl/django-post_office,fapelhanz/django-post_office,JostCrow/django-post_office,yprez/django-post_office,ui/django-post_office | post_office/admin.py | post_office/admin.py | from django.contrib import admin
from django.forms.widgets import TextInput
from django.utils.text import Truncator
from six import string_types
from .fields import CommaSeparatedEmailField
from .models import Email, Log, EmailTemplate, STATUS
def get_message_preview(instance):
return (u'{0}...'.format(instance.... | from django.contrib import admin
from django.forms.widgets import TextInput
from django.utils.text import Truncator
from .fields import CommaSeparatedEmailField
from .models import Email, Log, EmailTemplate, STATUS
def get_message_preview(instance):
return (u'{0}...'.format(instance.message[:25]) if len(instance... | mit | Python |
40c16f7acbbbe68e7a038b6eebb81a84bdc7b729 | Relocate pipelines. | ondergetekende/logshipper,Kami/logshipper | logshipper/cmd.py | logshipper/cmd.py | # Copyright 2014 Koert van der Veer
# 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 requir... | # Copyright 2014 Koert van der Veer
# 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 requir... | apache-2.0 | Python |
c159f9986dfd45a864561cb1ff7936e6b4a272de | bump version 2.0.3 | predicthq/sdk-py | predicthq/version.py | predicthq/version.py | __version__ = "2.0.3"
| __version__ = "2.0.2"
| mit | Python |
65c62108e257c6e82ed6ff24ea9884cee900c1c6 | read users from a csv file | alan412/WR_RFID_RaspberryPi,alan412/WR_RFID_RaspberryPi,alan412/WR_RFID_RaspberryPi,alan412/WR_RFID_RaspberryPi | rfid_test.py | rfid_test.py | from keyboard_alike import reader
import datetime
from phant import Phant
tags = {'0009909662' : 'Philip Smith',
'0004406858' : 'Joshua Smith',
'0009909876' : 'Abigail Smith',
'0003567797' : 'Linda Whipker'}
p = Phant('yAYZ9aJ98Kiyz4XNm5NW', 'location', 'id', 'name', 'time', private_key='4Wqom4... | from keyboard_alike import reader
import datetime
from phant import Phant
tags = {'0009909662' : 'Philip Smith',
'0004406858' : 'Joshua Smith',
'0009909876' : 'Abigail Smith',
'0004304910' : 'Dad'}
p = Phant('yAYZ9aJ98Kiyz4XNm5NW', 'location', 'id', 'name', 'time', private_key='4Wqom46m9niK2k8p... | mit | Python |
18cd40db2dd18deb9db529ff7c28fc5e2d095658 | Add strict mode to schema | vberlier/nbtlib | nbtlib/schema.py | nbtlib/schema.py |
"""This module defines tools for creating tag schemas.
Exported items:
schema -- Helper function to define compound schemas
CompoundSchema -- `Compound` subclass that enforces a tag schema
"""
__all__ = ['schema', 'CompoundSchema']
from itertools import chain
from .tag import Compou... |
"""This module defines tools for creating tag schemas.
Exported items:
schema -- Helper function to define compound schemas
CompoundSchema -- `Compound` subclass that enforces a tag schema
"""
__all__ = ['schema', 'CompoundSchema']
from itertools import chain
from .tag import Compou... | mit | Python |
3e66d926499b91d13c84d155c2ed30a603a2b1b3 | fix for iodp_samples_magic | lfairchild/PmagPy,Caoimhinmg/PmagPy,lfairchild/PmagPy,Caoimhinmg/PmagPy,lfairchild/PmagPy,Caoimhinmg/PmagPy | programs/__init__.py | programs/__init__.py | #!/usr/bin/env pythonw
import sys
from os import path
command = path.split(sys.argv[0])[-1]
from program_envs import prog_env
mpl_env = prog_env.get(command[:-3])
import matplotlib
if mpl_env:
matplotlib.use(mpl_env)
else:
matplotlib.use("TKAgg")
import generic_magic
import sio_magic
import cit_magic
import... | import sys
from os import path
command = path.split(sys.argv[0])[-1]
from program_envs import prog_env
mpl_env = prog_env.get(command[:-3])
import matplotlib
if mpl_env:
matplotlib.use(mpl_env)
else:
matplotlib.use("TKAgg")
import generic_magic
import sio_magic
import cit_magic
import _2g_bin_magic
import hu... | bsd-3-clause | Python |
df9d927f0da9a6d3591e08219ebeaf8f0a274376 | add feature for whether token contains at least one number #11 | markbaas/usaddress,yl2695/usaddress,frankleng/usaddress,cubgs53/usaddress,ahlusar1989/probablepeople | usaddress/__init__.py | usaddress/__init__.py | import os
import string
import pycrfsuite
import re
TAGGER = pycrfsuite.Tagger()
TAGGER.open(os.path.split(os.path.abspath(__file__))[0]
+ '/usaddr.crfsuite')
def parse(address_string) :
re_tokens = re.compile(r"""
\b[^\s]+(?=\b) # 'F-H ' -> ['F-H']
|
[^\w\s](?=\s) # [', '] -> [... | import os
import string
import pycrfsuite
import re
TAGGER = pycrfsuite.Tagger()
TAGGER.open(os.path.split(os.path.abspath(__file__))[0]
+ '/usaddr.crfsuite')
def parse(address_string) :
re_tokens = re.compile(r"""
\b[^\s]+(?=\b) # 'F-H ' -> ['F-H']
|
[^\w\s](?=\s) # [', '] -> [... | mit | Python |
eaf51e8054d5b3848fc30d3e132bcbb19866db65 | add more robust auth plugin | fkmclane/web.py | web/auth.py | web/auth.py | import base64
import web
class AuthError(web.HTTPError):
def __init__(self, scheme, realm, code=401, message=None, headers=None, status_message=None):
super.__init__(code, message, headers, status_message)
self.scheme = scheme
self.realm = realm
if self.headers is None:
... | import base64
import web
class AuthMixIn:
scheme = 'None'
def authorized(self, auth):
return True
def authenticate(self):
auth_headers = web.HTTPHeaders()
auth_headers.set('WWW-Authenticate', self.scheme)
raise web.HTTPError(401, headers=auth_headers)
def respond(se... | mit | Python |
e860f1adfcae859fcfbb56dd6cf2c90dcac8d968 | Fix resolution size | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | csunplugged/at_a_distance/settings.py | csunplugged/at_a_distance/settings.py | """Settings for the at a distance application."""
AT_A_DISTANCE_INTRODUCTION_FILENAME = 'introduction.md'
AT_A_DISTANCE_SLIDES_TEMPLATE_BASE_PATH = 'at_a_distance/lesson-slides'
AT_A_DISTANCE_SLIDE_RESOLUTION_HEIGHT = "1080"
AT_A_DISTANCE_SLIDE_RESOLUTION_WIDTH = "1920"
# Settings computed from above settings
AT_A_D... | """Settings for the at a distance application."""
AT_A_DISTANCE_INTRODUCTION_FILENAME = 'introduction.md'
AT_A_DISTANCE_SLIDES_TEMPLATE_BASE_PATH = 'at_a_distance/lesson-slides'
AT_A_DISTANCE_SLIDE_RESOLUTION_HEIGHT = "1080"
AT_A_DISTANCE_SLIDE_RESOLUTION_WIDTH = "1920"
# Settings computed from above settings
AT_A_D... | mit | Python |
44b84e2a082eab34aaac97ffa5ecfc449db7e3c7 | update secondary latency collector | couchbase/cbagent,mikewied/cbagent | cbagent/collectors/secondary_latency.py | cbagent/collectors/secondary_latency.py | from cbagent.collectors import Collector
import os.path
class SecondaryLatencyStats(Collector):
COLLECTOR = "secondaryscan_latency"
def _get_secondaryscan_latency(self):
stats = {}
if os.path.isfile(self.secondary_statsfile):
with open(self.secondary_statsfile, 'rb') as fh:
... | from cbagent.collectors import Collector
import os.path
class SecondaryLatencyStats(Collector):
COLLECTOR = "secondaryscan_latency"
def _get_secondaryscan_latency(self):
stats = {}
if os.path.isfile(self.secondary_statsfile):
with open(self.secondary_statsfile, 'rb') as fh:
... | apache-2.0 | Python |
4bff7a161fb5de20efef0f514c3bdf42cd37f857 | Fix error with starting server as a non-daemon | cadyyan/mcserver-tools,cadyyan/mcserver-tools | mcserver/start.py | mcserver/start.py | """
Utlities for starting the server
"""
import daemon
import lockfile.pidlockfile
import os
import os.path
import subprocess
from mcserver import base, reflection
def start_server(path, is_daemon = False, uid = None, gid = None):
"""
Start the server. Optionally start it as a daemon.
"""
base._validate_server_... | """
Utlities for starting the server
"""
import daemon
import lockfile.pidlockfile
import os
import os.path
import subprocess
from mcserver import base, reflection
def start_server(path, is_daemon = False, uid = None, gid = None):
"""
Start the server. Optionally start it as a daemon.
"""
base._validate_server_... | mit | Python |
deca2df30576b59450ac00a9800042d7cb97d6a9 | update capture/color workarounds | xflr6/dmengine | run-tests.py | run-tests.py | #!/usr/bin/env python
# run-tests.py
import sys
import pytest
ARGS = [
#'--exitfirst',
#'--pdb',
]
if 'idlelib' in sys.modules or 'thonny' in sys.modules:
ARGS.extend(['--capture=sys', '--color=no'])
elif sys.version_info[0] == 2 and 'win_unicode_console' in sys.modules:
ARGS.append('--capture=sys')... | #!/usr/bin/env python
# run-tests.py
import sys
import platform
import pytest
ARGS = [
#'--exitfirst',
#'--pdb',
]
if 'idlelib' in sys.modules:
ARGS.append('--color=no')
if platform.system().lower() == 'windows':
ARGS.append('--capture=sys')
pytest.main(ARGS + sys.argv[1:])
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.