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 |
|---|---|---|---|---|---|---|---|---|
eeca48a9d61748151c3060a2ef6524b72cfe7e38 | Discard unusable elements | taspinar/twitterscraper | twitterscraper/tweet.py | twitterscraper/tweet.py | from datetime import datetime
from bs4 import BeautifulSoup
from coala_utils.decorators import generate_ordering
@generate_ordering('timestamp', 'id', 'text', 'user')
class Tweet:
def __init__(self, user, id, timestamp, fullname, text):
self.user = user
self.id = id
self.timestamp = times... | from datetime import datetime
from bs4 import BeautifulSoup
from coala_utils.decorators import generate_ordering
@generate_ordering('timestamp', 'id', 'text', 'user')
class Tweet:
def __init__(self, user, id, timestamp, fullname, text):
self.user = user
self.id = id
self.timestamp = times... | mit | Python |
cdb59817fdb1f52327b17338ff16fc06b71b7d70 | remove logs | abak/pacbackup,abak/pacbackup | pacbackup.py | pacbackup.py | #!/usr/bin/python
import argparse
import pyalpm
from pycman import config
import os
# import pygit2
from version import __version__
"""
This module is a part of PacBackup. It backs up the package list along with a scipt
allowing easy recovery.
"""
def sanitize_path(path):
return os.path.abspath(os.path.expan... | #!/usr/bin/python
import argparse
import pyalpm
from pycman import config
import os
# import pygit2
from version import __version__
"""
This module is a part of PacBackup. It backs up the package list along with a scipt
allowing easy recovery.
"""
def sanitize_path(path):
return os.path.abspath(os.path.expan... | bsd-3-clause | Python |
1e7a2ace1f6f1ef44086ea6c5ddee339695aeae8 | Remove redundant sesson variable | jcfr/pydas,midasplatform/pydas | pydas/session.py | pydas/session.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
#
# Library: pydas
#
# Copyright 2010 Kitware, Inc., 28 Corporate Dr., Clifton Park, NY 12065, USA.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
#
# Library: pydas
#
# Copyright 2010 Kitware, Inc., 28 Corporate Dr., Clifton Park, NY 12065, USA.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# ... | apache-2.0 | Python |
0e10912c1837ed2fd0fbf510373ccde2cb4fbf9e | Add JSON serialization functions | cn04/smalltwo | smalltwo.py | smalltwo.py | import math
import json
import operator
def euclideanDistance(firstPoint, secondPoint, length):
#Calculate the distance between firstPoint and secondPoint, which are arrays of size length.
distance = 0
for i in xrange(length):
paramDifference = firstPoint[i] - secondPoint[i]
distance += pow(paramDifference, 2)... | import math
import operator
def euclideanDistance(firstPoint, secondPoint, length):
#Calculate the distance between firstPoint and secondPoint, which are arrays of size length.
distance = 0
for i in xrange(length):
paramDifference = firstPoint[i] - secondPoint[i]
distance += pow(paramDifference, 2)
return mat... | cc0-1.0 | Python |
49bf7617d0a7de0304c93bd65ed3dfcec2cddebd | Test round() with second arg. | deshipu/micropython,pfalcon/micropython,adafruit/circuitpython,HenrikSolver/micropython,dmazzella/micropython,mhoffma/micropython,puuu/micropython,Peetz0r/micropython-esp32,pozetroninc/micropython,adafruit/circuitpython,torwag/micropython,tralamazza/micropython,adafruit/circuitpython,trezor/micropython,ryannathans/micr... | tests/float/builtin_float_round.py | tests/float/builtin_float_round.py | # test round() with floats
# check basic cases
tests = [
[0.0], [1.0], [0.1], [-0.1], [123.4], [123.6], [-123.4], [-123.6],
[1.234567, 5], [1.23456, 1], [1.23456, 0], [1234.56, -2]
]
for t in tests:
print(round(*t))
# check .5 cases
for i in range(11):
print(round((i - 5) / 2))
# test second arg
for ... | # test round() with floats
# check basic cases
tests = [
[0.0], [1.0], [0.1], [-0.1], [123.4], [123.6], [-123.4], [-123.6],
[1.234567, 5], [1.23456, 1], [1.23456, 0], [1234.56, -2]
]
for t in tests:
print(round(*t))
# check .5 cases
for i in range(11):
print(round((i - 5) / 2))
# test second arg
# TO... | mit | Python |
38f79cfec8f7e9b3399f865287c84ba626b40661 | Fix UnicodeEncodeError | blekinge/github_cloner | github_mirror.py | github_mirror.py | #!/usr/bin/env python
# See http://stackoverflow.com/questions/3581031/backup-mirror-github-repositories/13917251#13917251
# You can find the latest version of this script at
# https://gist.github.com/4319265
import os
import sys
import json
import urllib
import subprocess
__version__ = '0.2'
__author__ = 'Marius Gedm... | #!/usr/bin/env python
# See http://stackoverflow.com/questions/3581031/backup-mirror-github-repositories/13917251#13917251
# You can find the latest version of this script at
# https://gist.github.com/4319265
import os
import sys
import json
import urllib
import subprocess
__version__ = '0.2'
__author__ = 'Marius Gedm... | bsd-3-clause | Python |
71f58ff83f8ee5f3e3769cc304310e2b7e0651b3 | Update losses_test.py | tensorflow/gan,tensorflow/gan | tensorflow_gan/examples/esrgan/losses_test.py | tensorflow_gan/examples/esrgan/losses_test.py | # coding=utf-8
# Copyright 2021 The TensorFlow GAN Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | # coding=utf-8
# Copyright 2021 The TensorFlow GAN Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 | Python |
4d8efd1d64880f2435012419427298c87314e0dc | Update python models to match db nullables. | AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,vladan-m/ggrc-core,jmakov/ggrc-core,hasanalom/ggrc-core,hyperNURb/ggrc-core,plamut/ggrc-core,uskudnik/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,uskudnik/ggrc-core,jmakov/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/... | src/ggrc/models/request.py | src/ggrc/models/request.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
from ggrc import db
from sqlalchemy.ext.declarative import declared_attr
from .mi... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
from ggrc import db
from .mixins import deferred, Base, Described, Slugged
class... | apache-2.0 | Python |
65cbf6e74de241524866558852ec08c328b36289 | Add auto pip install | sourcelair-blueprints/braintree-rest-framework,sourcelair-blueprints/braintree-rest-framework | braintree_api/manage.py | braintree_api/manage.py | #!/usr/bin/env python
import os
import subprocess
import sys
# HACK: Install dependencies if not already installed
PIP_LOG = 'pip.install.log'
if not os.path.exists(PIP_LOG):
with open(PIP_LOG, 'wb') as LOG_FILE:
subprocess.check_call(
['pip', 'install', '-r', '../requirements.txt'],
... | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "braintree_api.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mit | Python |
78bd841f4ba579532931cc2aa6447c614433894c | Bump version (again?) | uogbuji/amara3-iri | pylib/version.py | pylib/version.py | version_info = ('3', '0', '0')
| version_info = ('3', '0', '0rc1')
| apache-2.0 | Python |
6d428f0493eb564bd22c52a9e465d836f5bc0d92 | remove listen port from config | bcicen/uptime,bcicen/uptime,bcicen/uptime | uptime/sample_config.py | uptime/sample_config.py | __version__ = '0.1'
class Config(object):
#SLACK_URL = ''
DEBUG = True
ETCD_HOST = 'localhost'
ETCD_PORT = 4001
| __version__ = '0.1'
class Config(object):
#SLACK_URL = ''
DEBUG = True
LISTEN_PORT = 5005
ETCD_HOST = 'localhost'
ETCD_PORT = 4001
| mit | Python |
6b5733539fea14cb5bcb3800979ca9660397249a | Fix seg fault caused by having DB open twice. | vertexproject/synapse,vertexproject/synapse,vertexproject/synapse | synapse/tests/test_tools_backup.py | synapse/tests/test_tools_backup.py | import os
import synapse.lib.scope as s_scope
import synapse.tests.utils as s_t_utils
import synapse.tools.backup as s_backup
class BackupTest(s_t_utils.SynTest):
def dirset(self, sdir, skipfns):
ret = set()
for fdir, _, fns in os.walk(sdir):
for fn in fns:
if fn in s... | import unittest
raise unittest.SkipTest()
import os
import synapse.lib.scope as s_scope
import synapse.tests.utils as s_t_utils
import synapse.tools.backup as s_backup
class BackupTest(s_t_utils.SynTest):
def dirset(self, sdir, skipfns):
ret = set()
for fdir, _, fns in os.walk(sdir):
... | apache-2.0 | Python |
96f685acafe65206bba0478175507a930e313455 | Throw an exception for unsupported filenames | znerol/py-idlk | idlk/__init__.py | idlk/__init__.py | """
A lock filename generator for idlk files used by a well known DTP suite.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import sys
import unicodedata
from idlk import base41
if sys.version_info[0] == 3:
_get_byte = lambda c: c
else:... | """
A lock filename generator for idlk files used by a well known DTP suite.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import sys
import unicodedata
from idlk import base41
if sys.version_info[0] == 3:
_get_byte = lambda c: c
else:... | mit | Python |
3bfcc28aee9c945537ac39c8b0c2a5ab5bb51b99 | Add UserProfile to Django admin | project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app | src/icp/apps/user/admin.py | src/icp/apps/user/admin.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.contrib import admin
from apps.user.models import UserProfile
admin.site.register(UserProfile)
| # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
| apache-2.0 | Python |
a22fbcd5b3504070a000b49ed8eb6cd706e35165 | Update secret.py | toms3t/Propalyzer,toms3t/Propalyzer,toms3t/Propalyzer | propalyzer_site/propalyzer_app/secret.py | propalyzer_site/propalyzer_app/secret.py | class Secret():
ZWSID = ''
GMAPS_API_KEY = ''
| class Secret():
ZWSID = ''
GMAPS_API_KEY = ''
| mit | Python |
4a1ca7f3f846a2b5b1a8725658547cb4b1e2e654 | Update data.py | jseabold/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,bashtage/statsmodels,jseabold/statsmodels,josef-pkt/statsmodels,jseabold/statsmodels,statsmodels/statsmodels,jseabold/statsmodels,bashtage/statsmodels,statsmodels/statsmodels,bashtage/statsmodels,statsmodels/statsmodels,josef-pkt/statsmodels,statsmodels/st... | statsmodels/datasets/statecrime/data.py | statsmodels/datasets/statecrime/data.py | """Statewide Crime Data"""
from statsmodels.datasets import utils as du
__docformat__ = 'restructuredtext'
COPYRIGHT = """Public domain."""
TITLE = """Statewide Crime Data 2009"""
SOURCE = """
All data is for 2009 and was obtained from the American Statistical Abstracts except as indicated below.
"""
DE... | """Statewide Crime Data"""
from statsmodels.datasets import utils as du
__docformat__ = 'restructuredtext'
COPYRIGHT = """Public domain."""
TITLE = """Statewide Crime Data 2009"""
SOURCE = """
All data is for 2009 and was obtained from the American Statistical Abstracts except as indicated below.
"""
DE... | bsd-3-clause | Python |
e593306092292f72009e13bafe1cbb83f85d7937 | Fix messages in NDEx client | jmuhlich/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,johnbachman/belpy,johnbachman/indra,sorgerlab/indra,johnbachman/indra,bgyori/indra,johnbachman/belpy,sorgerlab/indra,pvtodorov/indra,sorgerlab/indra,johnbachman/indra,jmuhlich/indra,jmuhlich/indra,sorgerlab/belpy,... | indra/bel/ndex_client.py | indra/bel/ndex_client.py | import requests
import json
import time
ndex_base_url = 'http://services.bigmech.ndexbio.org'
def send_request(url_suffix, params):
res = requests.post(ndex_base_url + url_suffix, data=json.dumps(params))
res_json = get_result(res)
return res_json
def get_result(res):
status = res.status_code
if ... | import requests
import json
import time
ndex_base_url = 'http://services.bigmech.ndexbio.org'
def send_request(url_suffix, params):
res = requests.post(ndex_base_url + url_suffix, data=json.dumps(params))
res_json = get_result(res)
return res_json
def get_result(res):
status = res.status_code
if ... | bsd-2-clause | Python |
edaa494b05307d99ab5113c6f0ec5aa00a1e7d86 | Add state.sls runner | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/runners/state.py | salt/runners/state.py | '''
Execute overstate functions
'''
# Import salt libs
import salt.overstate
import salt.output
def over(env='base', os_fn=None):
'''
Execute an overstate sequence to orchestrate the executing of states
over a group of systems
'''
stage_num = 0
overstate = salt.overstate.OverState(__opts__, e... | '''
Execute overstate functions
'''
# Import salt libs
import salt.overstate
import salt.output
def over(env='base', os_fn=None):
'''
Execute an overstate sequence to orchestrate the executing of states
over a group of systems
'''
stage_num = 0
overstate = salt.overstate.OverState(__opts__, e... | apache-2.0 | Python |
daa5cce5d9059201b46aa6b08ecf3a1e222b0a0e | Add delete method to DummyRedis. | ericrasmussen/pyramid_redis_sessions | pyramid_redis_sessions/tests/__init__.py | pyramid_redis_sessions/tests/__init__.py | # -*- coding: utf-8 -*-
from ..compat import cPickle
class DummySession(object):
def __init__(self, key, redis, timeout=300, serialize=cPickle.dumps):
self.session_id = key
self.redis = redis
self.timeout = timeout
self.serialize = serialize
self.working_dict = {}
def... | # -*- coding: utf-8 -*-
from ..compat import cPickle
class DummySession(object):
def __init__(self, key, redis, timeout=300, serialize=cPickle.dumps):
self.session_id = key
self.redis = redis
self.timeout = timeout
self.serialize = serialize
self.working_dict = {}
def... | bsd-2-clause | Python |
d4537513153e5b7cab91e344abdd32cbacb17e8c | Bump TF version dependency from 2.1 to 2.2. | tensorflow/probability,tensorflow/probability | tensorflow_probability/__init__.py | tensorflow_probability/__init__.py | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | apache-2.0 | Python |
8a4051ccd846a5a967db7de112b38fa5367bc224 | Tweak item lookup a bit with raw sql. Add some comments comparing db queries. | nullpuppy/ouchallenge,nullpuppy/ouchallenge | ouchallenge/itemPrices/views.py | ouchallenge/itemPrices/views.py | from itemPrices.models import ItemSale
from django.db import connection
from django.db.models import Count
from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
NOT_FOUND_JSON_RESPONSE = {
'status': 404,
'content... | from itemPrices.models import ItemSale
from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from django.db.models import Count
class ItemPriceService(APIView):
"""
"""
def get(self, request):
# need ... | mit | Python |
b38284f4cad9f719e18b7fd8c3c4ff92de7938d8 | remove improper de version | happyleavesaoc/aoc-mgz | mgz/summary/dataset.py | mgz/summary/dataset.py | """Determine dataset."""
import mgz
from mgz.util import Version
def get_dataset_data(header):
"""Get dataset."""
if header.version == Version.DE:
return {
'id': 100,
'name': 'Definitive Edition',
'version': None
}
sample = header.initial.players[0].att... | """Determine dataset."""
import mgz
from mgz.util import Version
def get_dataset_data(header):
"""Get dataset."""
if header.version == Version.DE:
return {
'id': 100,
'name': 'Definitive Edition',
'version': header.game_version[4:]
}
sample = header.ini... | mit | Python |
1a7baf789b4a035dae2290c9730459e17094979c | Fix #174, Fix pywin32 DLL load on Win 8.1 | wheeler-microfluidics/microdrop | microdrop/microdrop.py | microdrop/microdrop.py | #!/usr/bin/env python
"""
Copyright 2011 Ryan Fobel
This file is part of Microdrop.
Microdrop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Foundation, either version 3 of the License, or
(at your option) any later version.
Microdrop is d... | #!/usr/bin/env python
"""
Copyright 2011 Ryan Fobel
This file is part of Microdrop.
Microdrop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Foundation, either version 3 of the License, or
(at your option) any later version.
Microdrop is d... | bsd-3-clause | Python |
e57c2cefa9e8403aa9a2f27d791604a179c8b998 | Handle the case where the user exits the panel | gsingh93/sublime-quick-file-open | quickfileopen.py | quickfileopen.py | import sublime
import sublime_plugin
class QuickFileOpenCommand(sublime_plugin.WindowCommand):
def run(self):
settings = sublime.load_settings('QuickFileOpen.sublime-settings')
files = settings.get('files')
if type(files) == list:
self.window.show_quick_panel(files, self.on_don... | import sublime
import sublime_plugin
class QuickFileOpenCommand(sublime_plugin.WindowCommand):
def run(self):
settings = sublime.load_settings('QuickFileOpen.sublime-settings')
files = settings.get('files')
if type(files) == list:
self.window.show_quick_panel(files, self.on_don... | mit | Python |
11cb258403b56db07da32364c75479105a22a00f | change model str method to unicode to match database | allen-garvey/block-quote-django | quotes/models.py | quotes/models.py | from django.db import models
from django.utils.encoding import force_bytes
# Create your models here.
class Author(models.Model):
author_last = models.CharField(max_length=200, blank=True, null=True)
author_first = models.CharField(max_length=200)
author_middle = models.CharField(max_length=200, blank=True... | from django.db import models
# Create your models here.
class Author(models.Model):
author_last = models.CharField(max_length=200, blank=True, null=True)
author_first = models.CharField(max_length=200)
author_middle = models.CharField(max_length=200, blank=True, null=True)
def __str__(self):
st... | mit | Python |
4926081992cbe2ecf2dfb3f75617e1200809d601 | Work for non-ndarray input | luispedro/milk,pombredanne/milk,pombredanne/milk,luispedro/milk,luispedro/milk,pombredanne/milk | milk/supervised/knn.py | milk/supervised/knn.py | # -*- coding: utf-8 -*-
# Copyright (C) 2008, Luís Pedro Coelho <lpc@cmu.edu>
#
# 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... | # -*- coding: utf-8 -*-
# Copyright (C) 2008, Luís Pedro Coelho <lpc@cmu.edu>
#
# 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... | mit | Python |
ec7314b9717acb0adc5e3f670c4c363096facaf5 | bump version | tanzaho/python-goose,jetruby/python-goose,jetruby/python-goose,jetruby/python-goose,tanzaho/python-goose,cronycle/python-goose,cronycle/python-goose,tanzaho/python-goose,cronycle/python-goose | goose/version.py | goose/version.py | # -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | # -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | apache-2.0 | Python |
e6087342a3cbf024b55bca087d5a32cf03846d98 | Add config doc for wtmp beacon | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/beacons/wtmp.py | salt/beacons/wtmp.py | # -*- coding: utf-8 -*-
'''
Beacon to fire events at login of users as registered in the wtmp file
.. code-block:: yaml
beacons:
wtmp: {}
'''
# Import python libs
import os
import struct
__virtualname__ = 'wtmp'
WTMP = '/var/log/wtmp'
FMT = '<hI32s4s32s256siili4l20s'
FIELDS = [
'type',
... | # -*- coding: utf-8 -*-
'''
Beacon to fire events at login of users as registered in the wtmp file
'''
# Import python libs
import os
import struct
__virtualname__ = 'wtmp'
WTMP = '/var/log/wtmp'
FMT = '<hI32s4s32s256siili4l20s'
FIELDS = [
'type',
'PID',
'line',
'inittab',
... | apache-2.0 | Python |
3931d0aaf63c1b9b58df6363ac5a9f53374f84b5 | Use CastObservationToFloat32 | toslunar/chainerrl,toslunar/chainerrl | tests/wrappers_tests/test_cast_observation.py | tests/wrappers_tests/test_cast_observation.py | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import unittest
from chainer import testing
import gym
imp... | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import unittest
from chainer import testing
import gym
imp... | mit | Python |
d6d78aee3c67518b1c6d4b2264d3bdc7663e66d1 | fix get_mongo_cursor utility | aorzh/django-graphos,aorzh/django-graphos,agiliq/django-graphos,agiliq/django-graphos,vpistis/django-graphos,agiliq/django-graphos,vpistis/django-graphos,sheepeatingtaz/django-graphos,vivek8943/django-graphos,vivek8943/django-graphos,sheepeatingtaz/django-graphos,sheepeatingtaz/django-graphos,vivek8943/django-graphos,v... | graphos/utils.py | graphos/utils.py | import random
import string
import pymongo
DEFAULT_HEIGHT = 400
DEFAULT_WIDTH = 800
DB_HOST = ["localhost"]
DB_PORT = 27017
def get_random_string():
random_letter = lambda: random.choice(string.ascii_letters)
random_string = "".join([random_letter()
for el in range(10)])
r... | import random
import string
import pymongo
DEFAULT_HEIGHT = 400
DEFAULT_WIDTH = 800
DB_HOST = ["localhost"]
DB_PORT = 27017
def get_random_string():
random_letter = lambda: random.choice(string.ascii_letters)
random_string = "".join([random_letter()
for el in range(10)])
r... | bsd-2-clause | Python |
b872ca89b5fde172a65d20db9bcf85cb98e034fb | Fix of error raising on save with USE_TZ=False | pinax/django-stripe-payments | pinax/stripe/utils.py | pinax/stripe/utils.py | from __future__ import unicode_literals
import datetime
import decimal
from django.utils import timezone
from django.conf import settings
def convert_tstamp(response, field_name=None):
tz = timezone.utc if settings.USE_TZ else None
if field_name and response.get(field_name):
return datetime.datetim... | from __future__ import unicode_literals
import datetime
import decimal
from django.utils import timezone
def convert_tstamp(response, field_name=None):
if field_name and response.get(field_name):
return datetime.datetime.fromtimestamp(
response[field_name],
timezone.utc
)... | mit | Python |
0a6b7186ba811a889846eb0c2fe53ca4a3464135 | Augmente le countdown de la tâche d'invalidation automatique. | dezede/dezede,dezede/dezede,dezede/dezede,dezede/dezede | libretto/signals.py | libretto/signals.py | # coding: utf-8
from __future__ import unicode_literals
from celery_haystack.signals import CelerySignalProcessor
from django.contrib.admin.models import LogEntry
from django.contrib.sessions.models import Session
from reversion.models import Version, Revision
from .tasks import auto_invalidate
class CeleryAutoInval... | # coding: utf-8
from __future__ import unicode_literals
from celery_haystack.signals import CelerySignalProcessor
from django.contrib.admin.models import LogEntry
from django.contrib.sessions.models import Session
from reversion.models import Version, Revision
from .tasks import auto_invalidate
class CeleryAutoInval... | bsd-3-clause | Python |
a0f872463b79aee9c07675fbc6a04bb044efae66 | fix typo | SonyCSL/CSLAIER,SonyCSL/CSLAIER,SonyCSL/CSLAIER,SonyCSL/CSLAIER | src/common/strings.py | src/common/strings.py | EPOCH_FILE_UNDER_TRAINING_ERROR = 'Selected epoch is currently under training. Could not use for inspection. Please wait for a while.' | EPOCH_FILE_UNDER_TRAINING_ERROR = 'Selected epoch is currently under training. Could no use for inspection. Please wait for a while.' | mit | Python |
8a8621c509f8015ded37d21240345af68615fbb2 | Add specific code_filepath whene generating a snippet | TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snip... | tools/automation/twiml-generator/generator.py | tools/automation/twiml-generator/generator.py | #!/usr/bin/env python
# coding: utf-8
from twiml_generator import TwimlCodeGenerator, load_language_spec
from pathlib import Path
from lxml.etree import XMLSyntaxError
import argparse
LANGUAGES_VERSIONS = {
'python': '6.x',
'java': '7.x',
'csharp': '5.x',
'node': '3.x',
'php': '5.x'
}
def genera... | #!/usr/bin/env python
# coding: utf-8
from twiml_generator import TwimlCodeGenerator, load_language_spec
from pathlib import Path
from lxml.etree import XMLSyntaxError
import argparse
LANGUAGES_VERSIONS = {
'python': '6.x',
'java': '7.x',
'csharp': '5.x',
'node': '3.x',
'php': '5.x'
}
def genera... | mit | Python |
d5ad324355e0abdf0a6bdcb41e1f07224742b537 | Remove needless import of sys module | TheUnderscores/card-fight-thingy | src/main.py | src/main.py | #!/usr/bin/env python3
# card-fight-thingy - Simplistic battle card game... thingy
#
# The MIT License (MIT)
#
# Copyright (c) 2015 The Underscores
#
# 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 S... | #!/usr/bin/env python3
# card-fight-thingy - Simplistic battle card game... thingy
#
# The MIT License (MIT)
#
# Copyright (c) 2015 The Underscores
#
# 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 S... | mit | Python |
d9b0e2058b2a14270d25694a31cc001276aad261 | Move django imports to after sys path change | Instanssi/KompomaattiBot | src/main.py | src/main.py | # -*- coding: utf-8 -*-
import os
import sys
import django
import irc3
# Attempt to find configuration
try:
import config
except ImportError:
print("Config module not found! Remember to rename config.py-dist to config.py!")
exit()
# Django environment
sys.path.append(config.DJANGO_ROOT)
os.environ['DJANG... | # -*- coding: utf-8 -*-
import os
import sys
import django
import irc3
from .django_integration import django_log_add, django_log_cleanup
# Attempt to find configuration
try:
import config
except ImportError:
print("Config module not found! Remember to rename config.py-dist to config.py!")
exit()
# Djang... | mit | Python |
fde109f767b89e1d1518e1f7f9c8485b719a5fa2 | add tests for pos_debt_notebook_sync | it-projects-llc/pos-addons,it-projects-llc/pos-addons,it-projects-llc/pos-addons | pos_debt_notebook_sync/tests/__init__.py | pos_debt_notebook_sync/tests/__init__.py | # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_debt_sync
| # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_debt_sync
| mit | Python |
7fcdb8bcea741bcfce6f6fad9bbee0e043b20091 | Remove failure test | ihmeuw/vivarium | ceam_tests/test_util.py | ceam_tests/test_util.py | # ~/ceam/tests/test_util.py
from unittest import TestCase
from datetime import timedelta
try:
from unittest.mock import Mock
except ImportError:
# python2
from mock import Mock
import numpy as np
import pandas as pd
from ceam.engine import SimulationModule
from ceam.util import from_yearly, to_yearly, ra... | # ~/ceam/tests/test_util.py
from unittest import TestCase
from datetime import timedelta
try:
from unittest.mock import Mock
except ImportError:
# python2
from mock import Mock
import numpy as np
import pandas as pd
from ceam.engine import SimulationModule
from ceam.util import from_yearly, to_yearly, ra... | bsd-3-clause | Python |
6e59f5a4429aa4972f81e21515d8f5c26bf5c2b6 | store return value for later evaluation | sassoftware/mirrorball,sassoftware/mirrorball | scripts/rhelorder.py | scripts/rhelorder.py | #!/usr/bin/python
import os
import sys
import time
import tempfile
sys.path.insert(0, os.environ['HOME'] + '/hg/conary')
sys.path.insert(0, os.environ['HOME'] + '/hg/rhnmirror')
sys.path.insert(0, os.environ['HOME'] + '/hg/rbuilder-5.5/rpath-xmllib')
sys.path.insert(0, os.environ['HOME'] + '/hg/rbuilder-5.5/rpath-cap... | #!/usr/bin/python
import os
import sys
import time
import tempfile
sys.path.insert(0, os.environ['HOME'] + '/hg/conary')
sys.path.insert(0, os.environ['HOME'] + '/hg/rhnmirror')
sys.path.insert(0, os.environ['HOME'] + '/hg/rbuilder-5.5/rpath-xmllib')
sys.path.insert(0, os.environ['HOME'] + '/hg/rbuilder-5.5/rpath-cap... | apache-2.0 | Python |
6edb4afee4d09e479aaf6ccda5cea7dbb05879a0 | Fix small bug on permissions check of wiki pages for anonymous users | astronaut1712/taiga-back,crr0004/taiga-back,dayatz/taiga-back,Zaneh-/bearded-tribble-back,19kestier/taiga-back,taigaio/taiga-back,astronaut1712/taiga-back,dycodedev/taiga-back,Tigerwhit4/taiga-back,gauravjns/taiga-back,gauravjns/taiga-back,astagi/taiga-back,forging2012/taiga-back,crr0004/taiga-back,rajiteh/taiga-back,W... | taiga/projects/wiki/permissions.py | taiga/projects/wiki/permissions.py | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... | agpl-3.0 | Python |
c72497c3c9a39ee0a8408d62c66758a465377166 | upgrade pip | minggli/chatbot,minggli/chatbot | chatbot/nlp/__init__.py | chatbot/nlp/__init__.py | import pip
import pkg_resources
def ifninstall(pkg_name):
"""pip install language models used by spacy."""
egg = '#egg='
installed_pkg = [i.project_name for i in pkg_resources.working_set]
egg_name = (egg in pkg_name) and pkg_name.split(egg)[1].replace('_', '-')
if pkg_name and egg_name not in ins... | import pip
def ifninstall(pkg_name):
"""pip install language models used by spacy."""
egg = '#egg='
installed_pkg = [i.project_name for i in pip.get_installed_distributions()]
egg_name = (egg in pkg_name) and pkg_name.split(egg)[1].replace('_', '-')
if pkg_name and egg_name not in installed_pkg:
... | mit | Python |
67c559b527ae1d0adf44f84043c7fef3725940e0 | Fix tests for taken_time templatetag | philgyford/django-ditto,philgyford/django-ditto,philgyford/django-ditto | ditto/flickr/tests/test_templatetags.py | ditto/flickr/tests/test_templatetags.py | from django.test import TestCase
from freezegun import freeze_time
from ...ditto.templatetags.ditto import display_time
from ...ditto.utils import datetime_now
from ..templatetags import flickr
class TakenTimeTestCase(TestCase):
@freeze_time("2015-08-14 13:34:56", tz_offset=-8)
def setUp(self):
sel... | from django.test import TestCase
from freezegun import freeze_time
from ...ditto.templatetags.ditto import display_time
from ...ditto.utils import datetime_now
from ..templatetags import flickr
class TakenTimeTestCase(TestCase):
@freeze_time("2015-08-14 13:34:56", tz_offset=-8)
def setUp(self):
sel... | mit | Python |
2ad62db9369f8529a02571134eef494e4d537244 | Fix last time expected migration | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | migrations/006_add_last_time_expected.py | migrations/006_add_last_time_expected.py | """
Add last time we expected to get data to buckets - max age expected
data types at the time of writing this
"journey",
"monitoring",
"realtime",
"channels",
"customer-satisfaction",
"failures",
"services",
"volumetrics",
"annotations",
"volumes",
"application",
"test... | """
Add last time we expected to get data to buckets - max age expected
data types at the time of writing this
"journey",
"monitoring",
"realtime",
"channels",
"customer-satisfaction",
"failures",
"services",
"volumetrics",
"annotations",
"volumes",
"application",
"test... | mit | Python |
4c77313f8073763a2536b2fb96c6872649eee980 | Test that not only numbers work | obiwanus/django-qurl | tests/tests.py | tests/tests.py | from __future__ import unicode_literals
import os
import pytest
from django.template import Template, Context, TemplateSyntaxError
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
def test_append():
out = Template(
"{% load qurl %}"
"{% qurl '/testurl/?a=1&b=3' a+=2 a-=1 %}"
).r... | from __future__ import unicode_literals
import os
import pytest
from django.template import Template, Context, TemplateSyntaxError
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
def test_append():
out = Template(
"{% load qurl %}"
"{% qurl '/testurl/?a=1&b=3' a+=2 a-=1 %}"
).r... | mit | Python |
99356433529c6cf88edcf135f3a8c67e19f3b9f3 | add comment for failed test | MichelJuillard/dlstats,Widukind/dlstats,mmalter/dlstats,Widukind/dlstats,MichelJuillard/dlstats,MichelJuillard/dlstats,mmalter/dlstats,mmalter/dlstats | dlstats/tests/fetchers/test_eurostat.py | dlstats/tests/fetchers/test_eurostat.py | import unittest
from unittest.mock import MagicMock
from dlstats.fetchers import eurostat
from ..base import RESOURCES_DIR
"""
class EurostatTestCase(unittest.TestCase):
def setUp(self):
eurostat.BulkSeries.bulk_update_elastic = MagicMock(return_value=True)
self.eurostat = eurostat.Eurostat()... | import unittest
from unittest.mock import MagicMock
from dlstats.fetchers import eurostat
from ..base import RESOURCES_DIR
class EurostatTestCase(unittest.TestCase):
def setUp(self):
eurostat.BulkSeries.bulk_update_elastic = MagicMock(return_value=True)
self.eurostat = eurostat.Eurostat()
... | agpl-3.0 | Python |
5bdfb968d6a05fcb727866bee063f996232bf9b8 | Make import compatible with python 2.6 | vesln/robber.py | tests/matchers/test_called.py | tests/matchers/test_called.py | from unittest import TestCase
from mock import Mock
from robber import expect
from robber.matchers.called import Called
class TestCalled(TestCase):
def test_matches(self):
mock = Mock()
mock()
expect(Called(mock).matches()) == True
def test_failure_message(self):
mock = Mock... | from unittest.case import TestCase
from mock import Mock
from robber import expect
from robber.matchers.called import Called
class TestCalled(TestCase):
def test_matches(self):
mock = Mock()
mock()
expect(Called(mock).matches()) == True
def test_failure_message(self):
mock =... | mit | Python |
836736d1a3514d681103a9e00dd240b68ba903c4 | Bump version to 0.10 | flav-io/flavio,flav-io/flavio | flavio/_version.py | flavio/_version.py | __version__='0.10.0'
| __version__='0.9.0'
| mit | Python |
07d717e00830398db76c521f171e49a574ea8823 | Update tests.py | saadsahibjan/treetojson | tests/tests.py | tests/tests.py | # coding=UTF-8
import unittest
import treetojson
class TreeToJsonTests(unittest.TestCase):
def test_list(self):
result = {u'SENTENCE': [{u'NN': u'Everyone'}, {u'VBZ': u'knows'}, {u'DT': u'an'}, {u'NN': u'Elephant'}, {u'VBZ': u'is'}, {u'JJR': u'larger'}, {u'IN': u'than'}, {u'DT': u'a'}, {u'NN': u'Dog'}]}
... | # coding=UTF-8
import unittest
import treetojson
class TreeToJsonTests(unittest.TestCase):
def test_list(self):
result = "{u'SENTENCE': [{u'NN': u'Everyone'}, {u'VBZ': u'knows'}, {u'DT': u'an'}, {u'NN': u'Elephant'}, {u'VBZ': u'is'}, {u'JJR': u'larger'}, {u'IN': u'than'}, {u'DT': u'a'}, {u'NN': u'Dog'}]}... | mit | Python |
9bdc4605df93fa39cae10a92108a4d98a5965b03 | Fix for http://code.google.com/p/pyglet/issues/detail?id=26 | regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations | tests/scene2d/SPRITE_MODEL.py | tests/scene2d/SPRITE_MODEL.py | #!/usr/bin/env python
'''Testing the sprite model.
This test should just run without failing.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from pyglet.window import Window
from pyglet.image import Image
from pyglet.scene2d import Sprite, Image2d
class SpriteModelTest(unittest.TestCa... | #!/usr/bin/env python
'''Testing the sprite model.
This test should just run without failing.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from pyglet.scene2d import Sprite
class SpriteModelTest(unittest.TestCase):
def setUp(self):
self.s = Sprite(10, 10, 10, 10, None)
... | bsd-3-clause | Python |
d5e6d23f3e330840ff7b1c30bd405aebab907a09 | Update tests.py | bardia-heydarinejad/Graph,bardia-heydarinejad/Graph,bardia73/Graph,bardia73/Graph | chat/tests.py | chat/tests.py | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests .
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
... | from django.test import TestCase
# Create your tests here.
| mit | Python |
a8c7308ec244be7048da003e3694dd0902406222 | Refactor created date for News by using the localization to format it | rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport | ureport/news/models.py | ureport/news/models.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from dash.categories.models import Category
from dash.orgs.models import Org
from smartmin.models import SmartModel
from django.db import models
from django.utils.translation import ugettext_lazy as _
from djang... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from dash.categories.models import Category
from dash.orgs.models import Org
from smartmin.models import SmartModel
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Ne... | agpl-3.0 | Python |
a1a387e2b7592000affe79e5510c566424e8f759 | Fix full_alias in preview | smtchahal/url-shortener,smtchahal/url-shortener,smtchahal/url-shortener | url_shortener/views.py | url_shortener/views.py | from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from django.http import (HttpResponseRedirect,
HttpResponsePermanentRedirect)
from .misc import id_to_alias
from .forms import URLShortenerForm
from .models import Link
def index(request):
... | from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from django.http import (HttpResponseRedirect,
HttpResponsePermanentRedirect)
from .misc import id_to_alias
from .forms import URLShortenerForm
from .models import Link
def index(request):
... | mit | Python |
57f1709b269969487945c3ea49d65acf8a9fed95 | Fix noop conversion to new interface | wilbertom/fileconversions | fileconversions/conversions/no_op.py | fileconversions/conversions/no_op.py | from .conversion import Conversion
class NoOp(Conversion):
def __call__(self, source_path):
pass
| from .conversion import Conversion
class NoOp(Conversion):
def run(self):
pass | mit | Python |
26e1fab2d1ec574d21cab7a3001f7fb5d37f9b08 | fix lint errors | Caleydo/caleydo_server,phovea/phovea_server,phovea/phovea_server,Caleydo/caleydo_server,phovea/phovea_server,phovea/phovea_server | tests/test_custom_encoders.py | tests/test_custom_encoders.py | from phovea_server.util import to_json
class TestCustomEncoders:
# def test_sets(self):
# assert jsonify(set()) == []
def test_nan_values(self):
test_var = float('nan')
test_result = to_json(dict(myNum=test_var))
assert test_result == {"myNum": None}
| from phovea_server.util import jsonify
class TestCustomEncoders:
# def test_sets(self):
# assert jsonify(set()) == []
def test_nan_values(self):
test_var = float('nan')
test_result = to_json(dict(myNum=test_var))
assert test_result == {"myNum": None}
| bsd-3-clause | Python |
abb4d5ee50494181b3e2c949aecaa2745005b70b | Remove unstable check in generators list test | craft-ai/craft-ai-client-python,craft-ai/craft-ai-client-python | tests/test_list_generators.py | tests/test_list_generators.py | import unittest
import craftai
from . import settings
from .data import valid_data
class TestListGenerators(unittest.TestCase):
"""Checks that the client succeeds when getting an agent with OK input"""
@classmethod
def setUpClass(cls):
cls.client = craftai.Client(settings.CRAFT_CFG)
cls.n_generators = ... | import unittest
import craftai
from . import settings
from .data import valid_data
class TestListGenerators(unittest.TestCase):
"""Checks that the client succeeds when getting an agent with OK input"""
@classmethod
def setUpClass(cls):
cls.client = craftai.Client(settings.CRAFT_CFG)
cls.n_generators = ... | bsd-3-clause | Python |
d3b8b948dac6ccce68ccf21311397ce6792fddc6 | Add tests for vagrant guest OS | DevBlend/DevBlend,DevBlend/zenias,byteknacker/fcc-python-vagrant,DevBlend/DevBlend,DevBlend/zenias,DevBlend/zenias,byteknacker/fcc-python-vagrant,DevBlend/DevBlend,DevBlend/zenias,DevBlend/zenias,DevBlend/DevBlend,DevBlend/DevBlend,DevBlend/zenias,DevBlend/DevBlend | tests/test_modules/os_test.py | tests/test_modules/os_test.py | from subprocess import call, check_output
class TestOs:
""" Contains test methods to test
if the vagrant OS got installed properly """
def uname_kernel(self):
""" returns output of uname -s """
output = check_output(["uname", "-s"]).decode("utf-8").lstrip().rstrip()
return out... | from subprocess import call, check_output
class TestOs:
""" Contains test methods to test
if the vagrant OS got installed properly """
| bsd-3-clause | Python |
3adb517634413f216a44219ac252601b8bb19ae5 | reduce even further the number of threads | Proteogenomics/trackhub-creator,Proteogenomics/trackhub-creator | tests/test_parallel_module.py | tests/test_parallel_module.py | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 13-09-2017 13:10
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Unit tests for the parallelization module
"""
import unittest
# App imports
import config_manager
from parallel.models import C... | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 13-09-2017 13:10
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Unit tests for the parallelization module
"""
import unittest
# App imports
import config_manager
from parallel.models import C... | apache-2.0 | Python |
fa99d2cf1d6035b1404f9350f0ce1012cc13c074 | Update version to 0.3.1 | jimporter/doppel,jimporter/doppel | doppel/version.py | doppel/version.py | version = '0.3.1'
| version = '0.4.0.dev0'
| bsd-3-clause | Python |
d36ddcb1abb030e39ee39ee3dada2b07ba915a19 | Fix syntax | swift-lang/swift-e-lab,Parsl/parsl,swift-lang/swift-e-lab,Parsl/parsl,Parsl/parsl,Parsl/parsl | parsl/tests/test_threads/test_immediate_error.py | parsl/tests/test_threads/test_immediate_error.py | import parsl
import pytest
from parsl import App
from parsl.dataflow.dflow import DataFlowKernel
from parsl.tests.configs.local_threads import config
config['globals']['lazyErrors'] = False
parsl.clear()
dfk = DataFlowKernel(config=config)
@App('python', dfk)
def divide(a, b):
return a / b
@pytest.mark.local
de... | import parsl
import pytest
from parsl import App
from parsl.dataflow.dflow import DataFlowKernel
from parsl.tests.configs.local_threads import config
config['globals']['lazyErrors'] = False
parsl.clear()
dfk = DataFlowKernel(config=config)
@App('python', dfk)
def divide(a, b):
return a / b
@pytest.mark.local
de... | apache-2.0 | Python |
b1a5937b29dea4b1e17ab0a66cb6add144d1ba8d | Set version to v7.0.2 | explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc | thinc/about.py | thinc/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = "thinc"
__version__ = "7.0.2"
__summary__ = "Practical Machine Learning for NLP"
__uri__ = "https://github.com/explosion/thinc"
__au... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = "thinc"
__version__ = "7.0.2.dev0"
__summary__ = "Practical Machine Learning for NLP"
__uri__ = "https://github.com/explosion/thinc"... | mit | Python |
026352925f60238ab7185733d51176b948c8ac8e | Set version to 8.0.0rc5 | explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc | thinc/about.py | thinc/about.py | __version__ = "8.0.0rc5"
__release__ = True
| __version__ = "8.0.0rc4"
__release__ = True
| mit | Python |
83fdf3051786806486f4ff9e4b05616603f7211a | Revert "Set version to v8.0.0.dev0" | explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc | thinc/about.py | thinc/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = "thinc"
__version__ = "7.4.0.dev2"
__summary__ = "Practical Machine Learning for NLP"
__uri__ = "https://github.com/explosion/thinc"... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = "thinc"
__version__ = "8.0.0.dev0"
__summary__ = "Practical Machine Learning for NLP"
__uri__ = "https://github.com/explosion/thinc"... | mit | Python |
629f54b469eb6c97a4567bf6572137b4f3132eb6 | Use optimized relu layer | explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc | thinc/neural/_classes/relu.py | thinc/neural/_classes/relu.py | from .affine import Affine
from ... import describe
from ...describe import Dimension, Synapses, Biases
class ReLu(Affine):
def predict(self, input__BI):
output__BO = Affine.predict(self, input__BI)
output__BO = self.ops.xp.ascontiguousarray(output__BO, dtype='float32')
self.ops.relu(outpu... | from .affine import Affine
from ... import describe
from ...describe import Dimension, Synapses, Biases
class ReLu(Affine):
def predict(self, input__BI):
output__BO = Affine.predict(self, input__BI)
output__BO *= output__BO > 0
return output__BO
def begin_update(self, input__BI, drop=... | mit | Python |
6f5dbc0fc82bd19496084c4f4078b4a5f1af1396 | fix exception | upconsulting/IsisCB,upconsulting/IsisCB,upconsulting/IsisCB,upconsulting/IsisCB | isiscb/curation/templatetags/attribute_tags.py | isiscb/curation/templatetags/attribute_tags.py | from django import template
from isisdata.models import *
import logging
register = template.Library()
logger = logging.getLogger(__name__)
@register.filter()
def get_dates(obj):
attrs = Authority.objects.get(pk=obj['id']).attributes.all()
if not attrs:
return None
return [a for a in attrs if _g... | from django import template
from isisdata.models import *
register = template.Library()
@register.filter()
def get_dates(obj):
attrs = Authority.objects.get(pk=obj['id']).attributes.all()
if not attrs:
return None
return [a for a in attrs if a.value and type(a.value.get_child_class()) in [DateTim... | mit | Python |
1126c0e795d94e004fae03edda3e299b2d3b764c | Attach user with List and Item | ajoyoommen/zerrenda,ajoyoommen/zerrenda | todo/models.py | todo/models.py | from django.contrib.auth.models import User
from django.db import models
from django.utils.text import slugify
from common.models import DeleteSafeTimeStampedMixin
class List(DeleteSafeTimeStampedMixin):
name = models.CharField(max_length=50)
slug = models.CharField(max_length=50, editable=False)
author ... | from django.db import models
from django.utils.text import slugify
from common.models import TimeStampedModel
class List(TimeStampedModel):
name = models.CharField(max_length=50)
slug = models.CharField(max_length=50, editable=False)
def __unicode__(self):
return self.name
def save(self, *a... | mit | Python |
88de70381ac0f2505349006d62850f7378a909d7 | remove patXML import | yngcan/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor | couch_patent/couch_patent.py | couch_patent/couch_patent.py | #!/usr/bin/env python
import sys
import couchdb
attrs = ['country', 'patent', 'kind', 'date_grant', 'pat_type', \
'date_app', 'country_app', 'patent_app', 'code_app', \
'clm_num', 'classes', 'abstract', 'invention_title', \
'asg_list', 'cit_list', 'rel_list', \
'inv_list', 'law_lis... | #!/usr/bin/env python
import sys
import couchdb
sys.path.append('../lib')
from patXML import *
attrs = ['country', 'patent', 'kind', 'date_grant', 'pat_type', \
'date_app', 'country_app', 'patent_app', 'code_app', \
'clm_num', 'classes', 'abstract', 'invention_title', \
'asg_list', 'cit_li... | bsd-2-clause | Python |
f1c6d64b01ba90371c142bbba21a086085a9045a | format code | zhengxiaowai/design-patterns | creational/factory_method.py | creational/factory_method.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
class Pizza(object):
""" Pizza 抽象类 """
def __init__(self):
self.name = self.getPizzaName()
def prepare(self):
print('准备...')
def bake(self):
print('烘焙...')
def cut(sel... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
class Pizza(object):
""" Pizza 抽象类 """
def __init__(self):
self.name = self.getPizzaName()
def prepare(self):
print('准备...')
def bake(self):
print('烘焙...')
def cut(self... | mit | Python |
2358a6838510a6ffd7f84e3aababf7543322f3e1 | Remove unnecessary code. | matthiask/feincms2-content,joshuajonah/feincms,joshuajonah/feincms,hgrimelid/feincms,michaelkuty/feincms,nickburlett/feincms,michaelkuty/feincms,feincms/feincms,matthiask/django-content-editor,nickburlett/feincms,hgrimelid/feincms,feincms/feincms,pjdelport/feincms,matthiask/feincms2-content,joshuajonah/feincms,nickburl... | feincms/module/extensions/changedate.py | feincms/module/extensions/changedate.py | # ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
"""
Track the modification date for pages.
"""
import os
from email.utils import parsedate_tz, mktime_tz
from django.db import models
from django.db.mod... | # ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
"""
Track the modification date for pages.
"""
import os
from email.utils import parsedate_tz, mktime_tz
from django.db import models
from django.db.mod... | bsd-3-clause | Python |
fad145eab62feeb066edda0b8359b2b9ab2e11cb | Use the 'ascendant' dts-method to avoid retimestamping | flumotion-mirror/flumotion-fragmented-streaming,flumotion-mirror/flumotion-fragmented-streaming | flumotion/component/muxers/fmp4/fmp4.py | flumotion/component/muxers/fmp4/fmp4.py | # -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Pub... | # -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Pub... | lgpl-2.1 | Python |
a214bc136ac7a3610619f3b6af86e2c3bb4f084c | save figures | eggplantbren/TwinPeaks3,eggplantbren/TwinPeaks3,eggplantbren/TwinPeaks3 | Paper/figures/sweep.py | Paper/figures/sweep.py | """
Experimenting with some animations to provide intuition about
the TwinPeaks algorithm.
\pi(X1, X2) ~ Uniform([0, 1]^2)
Constraint on X1X2 < const
const decreases.
"""
import numpy as np
import matplotlib.pyplot as plt
def deriv(state):
return (state - state*np.log(state))/np.log(state)
# Let x=X1, y=X2|X1
x = n... | """
Experimenting with some animations to provide intuition about
the TwinPeaks algorithm.
\pi(X1, X2) ~ Uniform([0, 1]^2)
Constraint on X1X2 < const
const decreases.
"""
import numpy as np
import matplotlib.pyplot as plt
def deriv(state):
return (state - state*np.log(state))/np.log(state)
# Let x=X1, y=X2|X1
x = n... | mit | Python |
2af1e66ae23a5569ac0557d0aec7c1cab2d80824 | Update ThUZirconCalculator.py | patrickboehnke/ThUZirconCalculator | ThUZirconCalculator.py | ThUZirconCalculator.py | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 28 19:51:54 2015
@author: Patrick Boehnke
If you use this code please cite:
Boehnke, P., Barboni, M., & Bell, E. A. (2016). Zircon U/Th Model Ages in the Presence of Melt Heterogeneity. Quaternary Geochronology, Submitted.
For comments please contact: pboehnke @ gmail ... | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 28 19:51:54 2015
@author: Patrick Boehnke
If you use this code please cite:
Boehnke, P., Barboni, M., & Bell, E. A. (2016). Zircon U/Th Model Ages in the Presence of Melt Heterogeneity. Quaternary Geochronology, Submitted.
For comments please contact: pboehnke @ gmail ... | mit | Python |
5a6a96435b7cf45cbbc5f2b81a7be84cd986b456 | Use absolute import for main entry point. | itziakos/haas,sjagoe/haas,scalative/haas,sjagoe/haas,itziakos/haas,scalative/haas | haas/__main__.py | haas/__main__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013-2014 Simon Jagoe
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the 3-clause BSD license. See the LICENSE.txt file for details.
import sys # pragma: no cover
from haas.main import main # pragma: no cover
if __name__ == '__... | # -*- coding: utf-8 -*-
# Copyright (c) 2013-2014 Simon Jagoe
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the 3-clause BSD license. See the LICENSE.txt file for details.
import sys # pragma: no cover
from .main import main # pragma: no cover
if __name__ == '__main... | bsd-3-clause | Python |
315319f3dd369bff9b1f99af61cc5d13c3e5b1aa | Fix module path for SysLogHandler. | armab/st2,lakshmi-kannan/st2,pixelrebel/st2,tonybaloney/st2,peak6/st2,StackStorm/st2,StackStorm/st2,punalpatel/st2,alfasin/st2,lakshmi-kannan/st2,alfasin/st2,armab/st2,armab/st2,grengojbo/st2,jtopjian/st2,tonybaloney/st2,emedvedev/st2,dennybaa/st2,dennybaa/st2,peak6/st2,grengojbo/st2,pinterb/st2,tonybaloney/st2,nzlosh/... | st2common/st2common/log.py | st2common/st2common/log.py | import datetime
import logging
import logging.config
import logging.handlers
import os
import six
import sys
import traceback
from oslo.config import cfg
logging.AUDIT = logging.CRITICAL + 10
logging.addLevelName(logging.AUDIT, 'AUDIT')
class FormatNamedFileHandler(logging.FileHandler):
def __init__(self, filen... | import datetime
import logging
import logging.config
import os
import six
import sys
import traceback
from oslo.config import cfg
logging.AUDIT = logging.CRITICAL + 10
logging.addLevelName(logging.AUDIT, 'AUDIT')
class FormatNamedFileHandler(logging.FileHandler):
def __init__(self, filename, mode='a', encoding=... | apache-2.0 | Python |
89fe842884b5d4e5f0f9d347d2db71959ec90c6f | remove unused function and its web.py dependency | mark-in/securedrop-prov-upstream,mark-in/securedrop-prov-upstream,mark-in/securedrop-prov-upstream,mark-in/securedrop-prov-upstream | modules/deaddrop/files/deaddrop/store.py | modules/deaddrop/files/deaddrop/store.py | # -*- coding: utf-8 -*-
import os
import re
import config
VALIDATE_FILENAME = re.compile("^(reply-)?[a-f0-9-]+(_msg|_doc|)\.gpg$").match
def verify(p):
if not os.path.isabs(config.STORE_DIR):
raise Exception("config.STORE_DIR(%s) is not absolute" % (
config.STORE_DIR, ))
if os... | # -*- coding: utf-8 -*-
import os
import re
import web
import config
# taken from store.urls mapping
VALIDATE_FILENAME = re.compile("^(reply-)?[0-9]+\.[0-9]+(?:_msg|_doc\.zip|)\.gpg$").match
def verify(p):
if not os.path.isabs(config.STORE_DIR):
raise Exception("config.STORE_DIR(%s) is not absolute" % (
... | agpl-3.0 | Python |
06e69c5a5df3e2ac4a2a7975f91b1985c5d45020 | add assert method in the test code | hyoo/kb_sdk_homology,hyoo/kb_sdk_homology | test/HomologySearch_server_test.py | test/HomologySearch_server_test.py | import unittest
import os
import json
import time
from os import environ
from ConfigParser import ConfigParser
from pprint import pprint
from biokbase.workspace.client import Workspace as workspaceService
from HomologySearch.HomologySearchImpl import HomologySearch
class HomologySearchTest(unittest.TestCase):
... | import unittest
import os
import json
import time
from os import environ
from ConfigParser import ConfigParser
from pprint import pprint
from biokbase.workspace.client import Workspace as workspaceService
from HomologySearch.HomologySearchImpl import HomologySearch
class HomologySearchTest(unittest.TestCase):
... | mit | Python |
08f72b888064d9f373b33b9d70614e6be70e470e | Add breathing to controller | illumenati/duwamish-lighthouse,tipsqueal/duwamish-lighthouse,illumenati/duwamish-lighthouse,YonasBerhe/duwamish-lighthouse,tipsqueal/duwamish-lighthouse | controller.py | controller.py | import bottle
import breathe
class Controller():
def __init__(self, app):
self.app = app
self.app.route('/data', ['POST'], self.data_route)
self._data = {
'temperature': 0.0,
'salinity': 0.0,
'oxygen': 0.0
}
self.breather = breathe.Breat... | import bottle
class Controller():
def __init__(self, app):
self.app = app
self.app.route('/data', ['POST'], self.data_route)
self._data = {
'temperature': 0.0,
'salinity': 0.0,
'oxygen': 0.0
}
def data_route(self):
"""
Looki... | mit | Python |
a01e7d789edfb724024e158c4bf6b2c251dda351 | fix missing StatusCache entry in __init__ | ddsc/ddsc-core,ddsc/ddsc-core | ddsc_core/models/__init__.py | ddsc_core/models/__init__.py | from ddsc_core.models.alarms import Alarm
from ddsc_core.models.alarms import Alarm_Active
from ddsc_core.models.alarms import Alarm_Item
from ddsc_core.models.aquo import Compartment
from ddsc_core.models.aquo import MeasuringDevice
from ddsc_core.models.aquo import MeasuringMethod
from ddsc_core.models.aquo import P... | from ddsc_core.models.alarms import Alarm
from ddsc_core.models.alarms import Alarm_Active
from ddsc_core.models.alarms import Alarm_Item
from ddsc_core.models.aquo import Compartment
from ddsc_core.models.aquo import MeasuringDevice
from ddsc_core.models.aquo import MeasuringMethod
from ddsc_core.models.aquo import P... | mit | Python |
bdd9b4cd2aec952cfd3284c8e471d1c274510e28 | Update GooIm.py | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/hoster/GooIm.py | module/plugins/hoster/GooIm.py | # -*- coding: utf-8 -*-
#
# Test links:
# https://goo.im/devs/liquidsmooth/3.x/codina/Nightly/LS-KK-v3.2-2014-08-01-codina.zip
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class GooIm(SimpleHoster):
__name__ = "GooIm"
__type__ = "hoster"
__version__ = "0.03"
... | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class GooIm(SimpleHoster):
__name__ = "GooIm"
__type__ = "hoster"
__version__ = "0.02"
__pattern__ = r'http://(?:www\.)?goo\.im/.+'
__description__ = """Goo.im hoster plugin"""
_... | agpl-3.0 | Python |
85b3203ef0f44926b00acc7f5d431cfa7a168732 | Allow override vm_host (e.g. aws, openstack, etc...) from command-line. | elkingtonmcb/cloudbiolinux,joemphilips/cloudbiolinux,chapmanb/cloudbiolinux,kdaily/cloudbiolinux,joemphilips/cloudbiolinux,averagehat/cloudbiolinux,lpantano/cloudbiolinux,heuermh/cloudbiolinux,elkingtonmcb/cloudbiolinux,AICIDNN/cloudbiolinux,heuermh/cloudbiolinux,pjotrp/cloudbiolinux,chapmanb/cloudbiolinux,pjotrp/cloud... | cloudbio/deploy/main.py | cloudbio/deploy/main.py | from argparse import ArgumentParser
import yaml
from cloudbio.deploy import deploy, DEFAULT_CLOUDBIOLINUX_FLAVOR, DEFAULT_CLOUDBIOLINUX_TARGET
DESC = "Creates an on-demand cloud instance, sets up applications, and transfer files to it."
## Properties that may be specified as args or in settings file,
## argument tak... | from argparse import ArgumentParser
import yaml
from cloudbio.deploy import deploy, DEFAULT_CLOUDBIOLINUX_FLAVOR, DEFAULT_CLOUDBIOLINUX_TARGET
DESC = "Creates an on-demand cloud instance, sets up applications, and transfer files to it."
## Properties that may be specified as args or in settings file,
## argument tak... | mit | Python |
c513d589a6ae528ce7dbec1501f89cd3f4a6425d | change last histogram to use non uniform custom sized bins | rs2/bokeh,aiguofer/bokeh,stonebig/bokeh,schoolie/bokeh,schoolie/bokeh,philippjfr/bokeh,phobson/bokeh,stonebig/bokeh,Karel-van-de-Plassche/bokeh,justacec/bokeh,jakirkham/bokeh,justacec/bokeh,Karel-van-de-Plassche/bokeh,ptitjano/bokeh,draperjames/bokeh,justacec/bokeh,dennisobrien/bokeh,clairetang6/bokeh,ericmjl/bokeh,azj... | examples/charts/file/histogram_multi.py | examples/charts/file/histogram_multi.py |
from bokeh.charts import Histogram, defaults, vplot, hplot, show, output_file
from bokeh.sampledata.autompg import autompg as df
defaults.plot_width = 400
defaults.plot_height = 350
# input options
hist = Histogram(df['mpg'], title="df['mpg']")
hist2 = Histogram(df, 'displ', title="df, 'displ'")
hist3 = Histogram(d... |
from bokeh.charts import Histogram, defaults, vplot, hplot, show, output_file
from bokeh.sampledata.autompg import autompg as df
defaults.plot_width = 400
defaults.plot_height = 350
# input options
hist = Histogram(df['mpg'], title="df['mpg']")
hist2 = Histogram(df, 'displ', title="df, 'displ'")
hist3 = Histogram(d... | bsd-3-clause | Python |
46f17ca452714257e4cbc4e118eac2b5d411588e | Fix wildly dumb derp | Heufneutje/txircd,ElementalAlchemist/txircd | txircd/modules/core/channel_statuses.py | txircd/modules/core/channel_statuses.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class StatusReport(ModuleData):
implements(IPlugin, IModuleData)
name = "ChannelStatusReport"
core = True
def actions(self):
return [ ("channelstatuses", 1, self.statuses) ]
... | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class StatusReport(ModuleData):
implements(IPlugin, IModuleData)
name = "ChannelStatusReport"
core = True
def actions(self):
return [ ("channelstatuses", 1, self.statuses) ]
... | bsd-3-clause | Python |
b5c1842325375709e6b86e72fa503f29ca9fa4fc | Bump version | thombashi/DateTimeRange | datetimerange/__version__.py | datetimerange/__version__.py | __author__ = "Tsuyoshi Hombashi"
__copyright__ = f"Copyright 2016, {__author__}"
__license__ = "MIT License"
__version__ = "1.1.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| __author__ = "Tsuyoshi Hombashi"
__copyright__ = f"Copyright 2016, {__author__}"
__license__ = "MIT License"
__version__ = "1.0.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
afcda62f222a6b401dfe1c552e4a4bb89c0c5252 | Update MarySpeech.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/MarySpeech.py | service/MarySpeech.py | mouth = Runtime.createAndStart("MarySpeech", "MarySpeech")
mouth.speakBlocking("Hello world")
mouth.speakBlocking("I speak English. More voices are available, but they need to be installed")
mouth.speakBlocking("Echo echo echo")
mouth.speakBlocking("What should I use")
| # start the service
maryspeech = Runtime.start("maryspeech","MarySpeech") | apache-2.0 | Python |
51fc87a8e0ba57cdf404509000317716ae9e4de7 | fix pep8 | praekelt/ummeli,praekelt/ummeli,praekelt/ummeli | ummeli/opportunities/forms.py | ummeli/opportunities/forms.py | from django import forms
from ummeli.opportunities.models import TomTomMicroTaskResponse
from ummeli.vlive.utils import get_lat_lon
class TomTomMicroTaskResponseForm(forms.ModelForm):
tel_1 = forms.CharField(required=False)
tel_2 = forms.CharField(required=False)
fax = forms.CharField(required=False)
... | from django import forms
from ummeli.opportunities.models import TomTomMicroTaskResponse
from ummeli.vlive.utils import get_lat_lon
class TomTomMicroTaskResponseForm(forms.ModelForm):
tel_1 = forms.CharField(required=False)
tel_2 = forms.CharField(required=False)
fax = forms.CharField(required=False)
... | bsd-3-clause | Python |
e84d6dc5be2e2ac2d95b81e4df18bc0ad939916a | Split into new branch for development of the main site | JonathanPeterCole/Tech-Support-Site,JonathanPeterCole/Tech-Support-Site | __init__.py | __init__.py | import os
from flask import Flask, redirect, request, render_template
from flask_mail import Mail, Message
app = Flask (__name__)
ALLOWED_EXTENSIONS = set(['txt', 'png', 'jpg', 'jpeg'])
mail = Mail(app)
@app.route("/")
def index():
return render_template('index.html.j2')
if __name__ == "__main__":
app.run()
| import os
from flask import Flask, redirect, request, render_template
from flask_mail import Mail, Message
app = Flask (__name__)
ALLOWED_EXTENSIONS = set(['txt', 'png', 'jpg', 'jpeg'])
mail = Mail(app)
@app.route("/")
def index():
return render_template('in-development.html.j2')
if __name__ == "__main__":
a... | mit | Python |
d2aba134bb0a40534b00d74fdb10aa00e76a8ddb | Rewrite __init__. | pyos/dg | __init__.py | __init__.py | import sys
import marshal
import os.path
if not hasattr(sys, 'implementation'):
if sys.hexversion >= 0x03020000:
# 3.2 is supported, although it lacks `sys.implementation`.
# We'll use `platform` instead.
import platform
tag = platform.python_implementation().lower() + '-32'
e... | import sys
import marshal
import os.path
if not hasattr(sys, 'implementation'):
raise ImportError('Python version is too old. 3.3. is required.')
_tag = sys.implementation.cache_tag
if _tag is None:
raise ImportError('Module caching is disabled. Failed to locate the bundle.')
_bundle = os.path.join(__path_... | mit | Python |
ff756e63b59400cb9b2298c230dc043dbc347c03 | Add this root as path to resolve imports within this project. | drowse314-dev-ymat/lexical-knowledge-base-for-japanese-civil-law,drowse314-dev-ymat/lexical-knowledge-base-for-japanese-civil-law | __init__.py | __init__.py | # encoding: utf-8
import os
import sys
if __name__ != '__main__':
sys.path.append(
os.path.abspath(os.path.dirname(__file__))
)
| mit | Python | |
915982ad445b488810f81bf8978bdbed5e93657d | Fix format index in conference | IndiciumSRL/wirecurly | wirecurly/dialplan/applications/conference.py | wirecurly/dialplan/applications/conference.py | from wirecurly.dialplan.applications import ApplicationBase
class Conference(ApplicationBase):
"""The conference application"""
def __init__(self, conf_name, profile='default'):
super(Conference, self).__init__('conference')
self.conf_name = conf_name
self.profile = profile
self.pin = None
@property
def d... | from wirecurly.dialplan.applications import ApplicationBase
class Conference(ApplicationBase):
"""The conference application"""
def __init__(self, conf_name, profile='default'):
super(Conference, self).__init__('conference')
self.conf_name = conf_name
self.profile = profile
self.pin = None
@property
def d... | mpl-2.0 | Python |
af9a5a489a9602b53bc053f18ad3800ea7481143 | switch order of verify/write | TomConlin/dipper,monarch-initiative/dipper,TomConlin/dipper,monarch-initiative/dipper,monarch-initiative/dipper | __init__.py | __init__.py | #first-pass with dipper
#this will eventually control the processing of data sources
__author__ = 'nlw'
import config
from sources.HPOAnnotations import HPOAnnotations
from sources.ZFIN import ZFIN
from sources.OMIM import OMIM
from sources.BioGrid import BioGrid
from sources.MGI import MGI
from sources.Panther import... | #first-pass with dipper
#this will eventually control the processing of data sources
__author__ = 'nlw'
import config
from sources.HPOAnnotations import HPOAnnotations
from sources.ZFIN import ZFIN
from sources.OMIM import OMIM
from sources.BioGrid import BioGrid
from sources.MGI import MGI
from sources.Panther import... | bsd-3-clause | Python |
12d4124f24564421febd1ebd95abf0657d91b4ba | bump version | vmalloc/json_rest | json_rest/__version__.py | json_rest/__version__.py | __version__ = "0.1.4"
| __version__ = "0.1.3"
| bsd-3-clause | Python |
18f3646f5af10cb8b607528c7544658e51c4042e | update main script | transcranial/jupyter-themer,transcranial/jupyter-notebook-css | jupythemer/jupythemer.py | jupythemer/jupythemer.py | from __future__ import print_function
import jupyter
import os
import sys
import argparse
current_dir = os.path.dirname(os.path.realpath(__file__))
jupyter_dir = os.path.dirname(jupyter.__file__)
custom_css_filepath = jupyter_dir + '/notebook/static/custom/custom.css'
def write_to_css(content):
try:
wit... | from __future__ import print_function
import jupyter
import os
import sys
import argparse
current_dir = os.path.dirname(os.path.realpath(__file__))
jupyter_dir = os.path.dirname(jupyter.__file__)
custom_css_filepath = jupyter_dir + '/notebook/static/custom/custom.css'
def write_to_css(content):
try:
wit... | mit | Python |
c4932a5313ff09dcdb6b1f02f25b7fc75ae43634 | use another eventlet pattern | xiayuu/kademlia,xiayuu/kademlia | kademlia/socketserver.py | kademlia/socketserver.py | #!/usr/bin/env python
# encoding: utf-8
from rpcudp.rpcserver import RPCServer, rpccall, rpccall_n
from protocol import KServer
from utils import delay_run
from hashlib import sha1
import eventlet
class SocketServer(KServer):
def __init__(self, addr, peer=None, port=None):
super(SocketServer, self).__init... | #!/usr/bin/env python
# encoding: utf-8
from rpcudp.rpcserver import RPCServer, rpccall, rpccall_n
from protocol import KServer
from utils import delay_run
from hashlib import sha1
import eventlet
class SocketServer(KServer):
def __init__(self, addr, peer=None, port=None):
super(SocketServer, self).__init... | apache-2.0 | Python |
9f707e305e69a3afbee0cf47268734f8fb010cad | connect the server to the database | franckinux/my-own-little-business,franckinux/my-own-little-business,franckinux/my-own-little-business,franckinux/my-own-little-business | my-own-little-business/main.py | my-own-little-business/main.py | #!/usr/bin/env python3
import argparse
import configparser
import os
import sys
from aiohttp import web
from aiohttp_jinja2 import setup as jinja_setup
from aiopg.sa import create_engine
from jinja2 import FileSystemLoader
import sqlalchemy as sa
from sqlalchemy.engine.url import URL
from routes import... | #!/usr/bin/env python3
import argparse
import configparser
import sys
from aiohttp import web
from aiohttp_jinja2 import setup as jinja_setup
from jinja2 import FileSystemLoader
from routes import setup_routes
from utils import read_configuration_file
from view import handler
def start_app(config):
... | agpl-3.0 | Python |
610fa1e517619dba37b499cd09a52acc836b0e58 | Rename kafka_topic to topic | napalm-automation/napalm-logs,napalm-automation/napalm-logs | napalm_logs/transport/kafka.py | napalm_logs/transport/kafka.py | # -*- coding: utf-8 -*-
'''
Kafka transport for napalm-logs.
'''
from __future__ import absolute_import
from __future__ import unicode_literals
# Import stdlib
import logging
# Import third party libs
try:
import kafka
HAS_KAFKA = True
except ImportError as err:
HAS_KAFKA = False
# Import napalm-logs pkg... | # -*- coding: utf-8 -*-
'''
Kafka transport for napalm-logs.
'''
from __future__ import absolute_import
from __future__ import unicode_literals
# Import stdlib
import logging
# Import third party libs
try:
import kafka
HAS_KAFKA = True
except ImportError as err:
HAS_KAFKA = False
# Import napalm-logs pkg... | apache-2.0 | Python |
30609236e703123c464c2e3927417ae677f37c4e | Remove run_hook from list of imported commands. | dontnod/nimp | nimp/base_commands/__init__.py | nimp/base_commands/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014-2019 Dontnod Entertainment
# 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,... | # -*- coding: utf-8 -*-
# Copyright (c) 2014-2019 Dontnod Entertainment
# 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,... | mit | Python |
54c5bafff2ab010a673cc2fd33f7c4992f0b905d | remove netius | vulhub/vulhub,vulhub/vulhub,vulhub/vulhub,vulhub/vulhub,vulhub/vulhub,vulhub/vulhub,vulhub/vulhub,vulhub/vulhub | django/CVE-2017-12794/app.py | django/CVE-2017-12794/app.py | #!/usr/bin/env python3
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", __name__)
import sys
import dj_database_url
from django.conf.urls import url
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
SECRET_KEY = '__secret_key__'
ALLOWED_HOSTS = ['*']
ROOT_URLCONF = __name__
TEMPLATES = [{
... | #!/usr/bin/env python3
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", __name__)
import sys
import netius.servers
import dj_database_url
from django.conf.urls import url
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
SECRET_KEY = '__secret_key__'
ALLOWED_HOSTS = ['*']
ROOT_URLCONF = __na... | mit | Python |
bfaaf47663d8ef199c405bdbb6281e7c971e12ae | Bump version | 5monkeys/django-enumfield | django_enumfield/__init__.py | django_enumfield/__init__.py | VERSION = (2, 0, 0, "beta", 1)
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
assert version[3] in ("alpha", "beta", "rc", "final")
# Now build the two parts of the version number:... | VERSION = (1, 6, 0, "beta", 3)
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
assert version[3] in ("alpha", "beta", "rc", "final")
# Now build the two parts of the version number:... | mit | Python |
4880b3ef9c78fcf69a0278d5b6a9ccd4648493f5 | define better import of version | ParticulateSolutions/django-paydirekt | django_paydirekt/settings.py | django_paydirekt/settings.py | from django.conf import settings
from django_paydirekt.__init__ import __version__
DJANGO_PAYDIREKT_VERSION = __version__
PAYDIREKT_API_SECRET = getattr(settings, 'PAYDIREKT_API_SECRET', False)
PAYDIREKT_API_KEY = getattr(settings, 'PAYDIREKT_API_KEY', False)
PAYDIREKT_API_URL = getattr(settings, 'PAYDIREKT_API_URL... | from __init__ import __version__
from django.conf import settings
DJANGO_PAYDIREKT_VERSION = __version__
PAYDIREKT_API_SECRET = getattr(settings, 'PAYDIREKT_API_SECRET', False)
PAYDIREKT_API_KEY = getattr(settings, 'PAYDIREKT_API_KEY', False)
PAYDIREKT_API_URL = getattr(settings, 'PAYDIREKT_API_URL', 'https://api.pa... | mit | Python |
1cff28b9612c156363ed87cdde1718ee83b65776 | Make ResaleApartmentSerializer return Decoration.name on decoration field. | Dybov/real_estate_agency,Dybov/real_estate_agency,Dybov/real_estate_agency | real_estate_agency/resale/serializers.py | real_estate_agency/resale/serializers.py | from rest_framework import serializers
from .models import ResaleApartment, ResaleApartmentImage
class ResaleApartmentImageSerializer(serializers.ModelSerializer):
class Meta:
model = ResaleApartmentImage
fields = '__all__'
class ResaleApartmentSerializer(serializers.ModelSerializer):
# ima... | from rest_framework import serializers
from .models import ResaleApartment, ResaleApartmentImage
class ResaleApartmentImageSerializer(serializers.ModelSerializer):
class Meta:
model = ResaleApartmentImage
fields = '__all__'
class ResaleApartmentSerializer(serializers.ModelSerializer):
# ima... | mit | Python |
73eea61ca017d9d26ab6e5ee19706241c9ffadc1 | Update shortest-distance-from-all-buildings.py | githubutilities/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,jaredkoontz/leetcode,jaredkoontz/leetcode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,jaredkoontz/leetcode,jaredkoontz/leetco... | Python/shortest-distance-from-all-buildings.py | Python/shortest-distance-from-all-buildings.py | # Time: O(k * m * n), k is the number of the buildings
# Space: O(m * n)
class Solution(object):
def shortestDistance(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
def bfs(grid, dists, cnts, x, y):
dist, m, n = 0, len(grid), len(grid[0])
... | # Time: O(k * m * n), k is the number of the buildings
# Space: O(m * n)
class Solution(object):
def shortestDistance(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
def bfs(grid, dists, cnts, x, y):
dist, m, n = 0, len(grid), len(grid[0])
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.