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 |
|---|---|---|---|---|---|---|---|---|
624e06ba22d762466453fa59a53e1f729654655e | Increment version to 1.0.1 | rapidpro/flows | expressions/python/setup.py | expressions/python/setup.py | from setuptools import setup, find_packages
def _is_requirement(line):
"""Returns whether the line is a valid package requirement."""
line = line.strip()
return line and not (line.startswith("-r") or line.startswith("#"))
def _read_requirements(filename):
"""Returns a list of package requirements re... | from setuptools import setup, find_packages
def _is_requirement(line):
"""Returns whether the line is a valid package requirement."""
line = line.strip()
return line and not (line.startswith("-r") or line.startswith("#"))
def _read_requirements(filename):
"""Returns a list of package requirements re... | bsd-3-clause | Python |
02511646e3e20f62e766eff3294c265d98d13cba | Add unit test for the mgt tap interface | openstack/akanda-rug,markmcclain/astara,stackforge/akanda-rug,dreamhost/akanda-rug,stackforge/akanda-rug,openstack/akanda-rug | akanda/rug/test/unit/test_main.py | akanda/rug/test/unit/test_main.py | import mock
import signal
import unittest2 as unittest
from akanda.rug import main
@mock.patch('akanda.rug.main.cfg')
@mock.patch('akanda.rug.main.quantum_api')
@mock.patch('akanda.rug.main.multiprocessing')
@mock.patch('akanda.rug.main.notifications')
@mock.patch('akanda.rug.main.scheduler')
@mock.patch('akanda.rug... | import mock
import signal
import unittest2 as unittest
from akanda.rug import main
class TestMain(unittest.TestCase):
def test_shuffle_notifications(self):
queue = mock.Mock()
queue.get.side_effect = [
('9306bbd8-f3cc-11e2-bd68-080027e60b25', 'message'),
KeyboardInterrupt... | apache-2.0 | Python |
106d56e734140d006a083965e55560a55e21e428 | Return a list of lists | ambidextrousTx/RNLTK | NGrams.py | NGrams.py | def generate_ngrams(text, n):
''' Generates all possible n-grams of a
piece of text
>>> text = 'this is a random piece'
>>> n = 2
>>> generate_ngrams(text, n)
this is
is a
a random
random piece
'''
text_array = text.split(' ')
ngram_list = []
for i in range(0, len(te... | def generate_ngrams(text, n):
''' Generates all possible n-grams of a
piece of text
>>> text = 'this is a random piece'
>>> n = 2
>>> generate_ngrams(text, n)
this is
is a
a random
random piece
'''
text_array = text.split(' ')
for i in range(0, len(text_array) - n + 1):
... | bsd-2-clause | Python |
d6a4be56d606632b1d4f9c465f974f9778e7c438 | Update speed_change_video.py | McGillX/edx_data_research,andyzsf/edx_data_research,andyzsf/edx_data_research,McGillX/edx_data_research,McGillX/edx_data_research | reporting_scripts/speed_change_video.py | reporting_scripts/speed_change_video.py | '''
This module gets all the events per user while watching videos.
Since we will need to sort a very large number of documents, you should create a separate collection to
aggregate all required documents in one collection and then extract results from the new collection.
Command to run on the mongo shell to create ... | '''
This module gets all the events per user while watching videos. Since we will
need to sort a very large number of documents, user should create a separate
collection to aggregate all required documents in one collection and then
extract results from the new collection
Command to run on the mongo shell to creare ne... | mit | Python |
710ce9af01f6fa2c8bab3e296725a61cbb011b15 | allow adding of images from the add vehicle page. | sitture/trade-motors,sitture/trade-motors,sitture/trade-motors,sitture/trade-motors,sitture/trade-motors | src/vehicles/admin.py | src/vehicles/admin.py | from django.contrib import admin
from vehicles.models import Category, Vehicle, VehicleMake, VehicleImage
# Register your models here.
class VehicleCategoryAdmin(admin.ModelAdmin):
list_display = [
'__unicode__',
'category_display_order',
'show_on_home_page'
]
prepopulated_fields =... | from django.contrib import admin
from vehicles.models import Category, Vehicle, VehicleMake, VehicleImage
# Register your models here.
class VehicleCategoryAdmin(admin.ModelAdmin):
list_display = [
'__unicode__',
'category_display_order',
'show_on_home_page'
]
prepopulated_fields =... | mit | Python |
80b863bdea7a1f5eb83628b340443901c685c2fd | support latest muffin | klen/muffin-jinja2,klen/muffin-jinja2 | tests/test_muffin_jinja2.py | tests/test_muffin_jinja2.py | import muffin
import pytest
import jinja2
@pytest.fixture(scope='session')
def app():
from muffin_jinja2 import Plugin as Jinja2
app = muffin.Application(name='jinja2', jinja2_template_folders=['tests'])
jinja2 = Jinja2(app)
assert jinja2.cfg.template_folders == ['tests']
@jinja2.context_process... | import muffin
import pytest
import jinja2
@pytest.fixture(scope='session')
def app():
from muffin_jinja2 import Plugin as Jinja2
app = muffin.Application('jinja2', jinja2_template_folders=['tests'])
jinja2 = Jinja2(app)
assert jinja2.cfg.template_folders == ['tests']
@jinja2.context_processor
... | mit | Python |
1038eb17a3f7966434547c7ff77c0586cc421685 | add correct URL | fabianvf/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi | scrapi/harvesters/wash_state_u.py | scrapi/harvesters/wash_state_u.py | '''
Harvester for the Washington State University Research Exchange for the SHARE project
Example API call: http://research.wsulibs.wsu.edu:8080/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class WashuHarvester(OAIHarvester):
... | '''
Harvester for the Washington State University Research Exchange for the SHARE project
Example API call: http://research.wsulibs.wsu.edu:8080/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class WashuHarvester(OAIHarvester):
... | apache-2.0 | Python |
1157fb15f938aae8cfc10392fe816d691c3b41e7 | Use the remote getter call only on objects with an object_type. | Doist/todoist-python | todoist/managers/generic.py | todoist/managers/generic.py | # -*- coding: utf-8 -*-
class Manager(object):
# should be re-defined in a subclass
state_name = None
object_type = None
def __init__(self, api):
self.api = api
# shortcuts
@property
def state(self):
return self.api.state
@property
def queue(self):
return... | # -*- coding: utf-8 -*-
class Manager(object):
# should be re-defined in a subclass
state_name = None
object_type = None
def __init__(self, api):
self.api = api
# shortcuts
@property
def state(self):
return self.api.state
@property
def queue(self):
return... | mit | Python |
9aab2873d94c2f12bf795ccfae8228df8b99525d | Update exception handling; Add note | TomBaxter/osf.io,mfraezz/osf.io,cwisecarver/osf.io,mattclark/osf.io,binoculars/osf.io,caseyrollins/osf.io,adlius/osf.io,felliott/osf.io,erinspace/osf.io,mattclark/osf.io,CenterForOpenScience/osf.io,adlius/osf.io,caseyrollins/osf.io,baylee-d/osf.io,pattisdr/osf.io,TomBaxter/osf.io,aaxelb/osf.io,mfraezz/osf.io,TomBaxter/... | scripts/fix_keen_preprint_keys.py | scripts/fix_keen_preprint_keys.py | import logging
import sys
import django
from django.db import transaction
django.setup()
from osf.models import Node
from scripts import utils as script_utils
from website import settings
from website.app import init_app
from keen import scoped_keys
logger = logging.getLogger(__name__)
logging.basicConfig(level=logg... | import logging
import sys
import django
from django.db import transaction
django.setup()
from osf.models import Node
from scripts import utils as script_utils
from website import settings
from website.app import init_app
from keen import scoped_keys
logger = logging.getLogger(__name__)
logging.basicConfig(level=logg... | apache-2.0 | Python |
4e38e50092ed4381b9624247b4d62c18206a81ce | exclude contest | nthuoj/NTHUOJ_web,henryyang42/NTHUOJ_web,nthuoj/NTHUOJ_web,bruce3557/NTHUOJ_web,henryyang42/NTHUOJ_web,bruce3557/NTHUOJ_web,bbiiggppiigg/NTHUOJ_web,bbiiggppiigg/NTHUOJ_web,geniusgordon/NTHUOJ_web,Changron/NTHUOJ_web,geniusgordon/NTHUOJ_web,geniusgordon/NTHUOJ_web,Changron/NTHUOJ_web,Changron/NTHUOJ_web,henryyang42/NTHU... | status/status_info.py | status/status_info.py | from datetime import datetime
from django.db.models import Q
from contest.contest_info import get_running_contests, get_freeze_time_datetime
from contest.models import Contest
from problem.models import Problem, Submission, SubmissionDetail
from users.models import User
from utils.user_info import validate_user, has_c... | from contest.contest_info import get_running_contests
from problem.models import Submission, SubmissionDetail
from users.models import User
from utils.user_info import validate_user
def regroup_submission(submissions):
submission_groups = []
for submission in submissions:
submission_groups.append({
... | mit | Python |
78e6fea854db08bfabc7c8349f4bc998ace5bcac | work around strange behaviour of _("") | CanonicalLtd/subiquity,CanonicalLtd/subiquity | subiquitycore/i18n.py | subiquitycore/i18n.py | # Copyright 2017 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | # Copyright 2017 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | agpl-3.0 | Python |
20fc402d5a63b041e0b4a3b49a0c204b7c1b6548 | Set default tempurl value to 0 when field is empty. | bkawula/django-swiftbrowser,bkawula/django-swiftbrowser,bkawula/django-swiftbrowser,bkawula/django-swiftbrowser | swiftbrowser/forms.py | swiftbrowser/forms.py | """ Forms for swiftbrowser.browser """
# -*- coding: utf-8 -*-
#pylint:disable=R0924
from django import forms
from django.conf import settings
class CreateContainerForm(forms.Form):
""" Simple form for container creation """
containername = forms.CharField(max_length=100)
class PseudoFolderForm(forms.Form):... | """ Forms for swiftbrowser.browser """
# -*- coding: utf-8 -*-
#pylint:disable=R0924
from django import forms
from django.conf import settings
#from utils import get_keystone_tenants
class CreateContainerForm(forms.Form):
""" Simple form for container creation """
containername = forms.CharField(max_length=10... | apache-2.0 | Python |
46ac5ce0f451f503973c13aa0ad49455aaa8a309 | encrypt issue:AES key must be either 16, 24, or 32 bytes long | wingjay/jianshi,wingjay/jianshi,wingjay/jianshi | server/server/util/safetyutils.py | server/server/util/safetyutils.py | import time
import base64
import json
import struct
from Crypto.Cipher import AES
from werkzeug.security import generate_password_hash, check_password_hash
SECURE_HASH_METHOD = 'pbkdf2:sha1:1111'
default_key = 'XjYpwIiYLbaOsU69HXUjlGRMCut88zQG'
AUTH_TOKEN_ENCRYPT_KEY = '8G7Zg3kjhsdv23bjdalj82nh'
SYNC_TOKEN_ENCRYPT_KE... | import time
import base64
import json
import struct
from Crypto.Cipher import AES
from werkzeug.security import generate_password_hash, check_password_hash
SECURE_HASH_METHOD = 'pbkdf2:sha1:1111'
default_key = 'XjYpwIiYLbaOsU69HXUjlGRMCut88zQG'
AUTH_TOKEN_ENCRYPT_KEY = '8G7Zg3kjhsdv23bjdalj82nh'
SYNC_TOKEN_ENCRYPT_KE... | apache-2.0 | Python |
7464fcbbe9f540dde4a7f6c5eca68e3d17d2779e | clean up ec2 response init | whummer/moto,heddle317/moto,gjtempleton/moto,Brett55/moto,Affirm/moto,ludia/moto,Affirm/moto,ImmobilienScout24/moto,whummer/moto,Brett55/moto,kefo/moto,whummer/moto,dbfr3qs/moto,spulec/moto,dbfr3qs/moto,okomestudio/moto,rocky4570/moto,mrucci/moto,jszwedko/moto,rocky4570/moto,Brett55/moto,andresriancho/moto,okomestudio/... | moto/ec2/responses/__init__.py | moto/ec2/responses/__init__.py | from urlparse import parse_qs
from moto.ec2.utils import camelcase_to_underscores, method_namess_from_class
from .amazon_dev_pay import AmazonDevPay
from .amis import AmisResponse
from .availability_zones_and_regions import AvailabilityZonesAndRegions
from .customer_gateways import CustomerGateways
from .dhcp_options... | from urlparse import parse_qs
from moto.ec2.utils import camelcase_to_underscores, method_namess_from_class
from .amazon_dev_pay import AmazonDevPay
from .amis import AmisResponse
from .availability_zones_and_regions import AvailabilityZonesAndRegions
from .customer_gateways import CustomerGateways
from .dhcp_options... | apache-2.0 | Python |
aaaa20be61e96daf61e397fdf54dfaf6bec461e8 | Use new property format for WorldcatData | mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation | falcom/api/worldcat/data.py | falcom/api/worldcat/data.py | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from ..common import ReadOnlyDataStructure
class WorldcatData (ReadOnlyDataStructure):
auto_properties = ("title",)
def __iter__ (... | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from ..common import ReadOnlyDataStructure
class WorldcatData (ReadOnlyDataStructure):
@property
def title (self):
return s... | bsd-3-clause | Python |
317a928eb61b9446bb1d3d1ecc39e69b373ac9c2 | FIX removed sparse_encode_parallel | potash/scikit-learn,xuewei4d/scikit-learn,massmutual/scikit-learn,ilyes14/scikit-learn,justincassidy/scikit-learn,hitszxp/scikit-learn,imaculate/scikit-learn,TomDLT/scikit-learn,plissonf/scikit-learn,RomainBrault/scikit-learn,treycausey/scikit-learn,arjoly/scikit-learn,hsuantien/scikit-learn,meduz/scikit-learn,0asa/sci... | sklearn/decomposition/__init__.py | sklearn/decomposition/__init__.py | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, ProjectedGradientNMF
from .pca import PCA, RandomizedPCA, ProbabilisticPC... | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, ProjectedGradientNMF
from .pca import PCA, RandomizedPCA, ProbabilisticPC... | bsd-3-clause | Python |
ebb2d4051652bc9c07f979d932a37d624f15848e | fix imports in ensembles | scikit-multilearn/scikit-multilearn | skmultilearn/ensemble/__init__.py | skmultilearn/ensemble/__init__.py | from rakeld import RakelD
from rakelo import RakelO
from fixed import FixedLabelPartitionClassifier, LabelSpacePartitioningClassifier
from partition import LabelSpacePartitioningClassifier | bsd-2-clause | Python | |
72c89099892323508fc091049ece54a403ec2cef | Fix error in parsetxtxy.py | BiRG/Omics-Dashboard,BiRG/Omics-Dashboard,BiRG/Omics-Dashboard,BiRG/Omics-Dashboard,BiRG/Omics-Dashboard | compute-images/text-parser/src/textparsers.py | compute-images/text-parser/src/textparsers.py | import numpy as np
import h5py
# value is a list
# converts anything numeric into a float
def processMetadataValue(value):
if len(value) < 2:
return ''
try:
return float(value[1])
except ValueError:
return value[1]
# a fuction to parse txtXY files
# will parse files with or witho... | import numpy as np
import h5py
# value is a list
# converts anything numeric into a float
def processMetadataValue(value):
if len(value) < 2:
return ''
try:
return float(value[1])
except ValueError:
return value[1]
# a fuction to parse txtXY files
# will parse files with or witho... | mit | Python |
fc30a817644f1849219ec7cd412bf802917a7c22 | Complete lc290_word_pattern.py | bowen0701/algorithms_data_structures | lc290_word_pattern.py | lc290_word_pattern.py | """Leetcode 290. Word Pattern
Easy
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between a
letter in pattern and a non-empty word in str.
Example 1:
Input: pattern = "abba", str = "dog cat cat dog"
Output: true
Example 2:
Inpu... | """Leetcode 290. Word Pattern
Easy
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between a
letter in pattern and a non-empty word in str.
Example 1:
Input: pattern = "abba", str = "dog cat cat dog"
Output: true
Example 2:
Inpu... | bsd-2-clause | Python |
6f0dd0768c93e9965f7a6c20891667b6f20890a4 | fix syntax error | sunlightlabs/django-locksmith,sunlightlabs/django-locksmith,sunlightlabs/django-locksmith | locksmith/mongoauth/management/commands/apireport.py | locksmith/mongoauth/management/commands/apireport.py | import datetime
from urlparse import urljoin
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from locksmith.common import apicall
class Command(BaseCommand):
help = "Push a given day's logs up to the analytics hub"
args = '[date:YYYY-MM-DD]'
requires_model... | import datetime
from urlparse import urljoin
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from locksmith.common import apicall
class Command(BaseCommand):
help = "Push a given day's logs up to the analytics hub"
args = '[date:YYYY-MM-DD]'
requires_model... | bsd-3-clause | Python |
05899d40f9e6bfcb4131db28da44f64d959ab32d | change file paths | eltonlaw/impyute | impyute/utils/loggers.py | impyute/utils/loggers.py | """Print input/output multiple times"""
from impyute.datasets import random_normal
def print_io(fn, loops=1, **kwargs):
""" Prints out input data and output data
PARAMETERS
---------
fn: Function
loops: # of Loops
**kwargs: Arguments for random_normal function
RETURNS
------
n/a
... | """Print input/output multiple times"""
from impyute.datasets import random_int
def print_io(fn, loops=1, **kwargs):
""" Prints out input data and output data
PARAMETERS
---------
fn: Function
loops: # of Loops
**kwargs: Arguments for random_int function
RETURNS
------
n/a
""... | mit | Python |
0ff547915fc9de3d5edb80cc31a0f561453f3687 | Check for syslog. Doesn't exist on Windows | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/returners/syslog_return.py | salt/returners/syslog_return.py | '''
Return data to the host operating system's syslog facility
Required python modules: syslog, json
The syslog returner simply reuses the operating system's syslog
facility to log return data
'''
# Import python libs
import syslog
import json
try:
import syslog
HAS_SYSLOG = True
except ImportError:
HAS_... | '''
Return data to the host operating system's syslog facility
Required python modules: syslog, json
The syslog returner simply reuses the operating system's syslog
facility to log return data
'''
# Import python libs
import syslog
import json
def __virtual__():
return 'syslog'
def returner(ret):
'''
... | apache-2.0 | Python |
045bc7f3ee2b4b193cef97fbddbc46ed806c59f7 | fix offset | yiplee/ltc-huobi,yiplee/ltc-huobi,yiplee/ltc-huobi | ltc/models.py | ltc/models.py | from django.db import models
# Create your models here.
from django.db import models
import datetime
class Record(models.Model):
price = models.DecimalField('the price of ltc',max_digits=6,decimal_places=2)
timestamp = models.IntegerField('date of record')
class Meta:
get_latest_by = 'times... | from django.db import models
# Create your models here.
from django.db import models
import datetime
class Record(models.Model):
price = models.DecimalField('the price of ltc',max_digits=6,decimal_places=2)
timestamp = models.IntegerField('date of record')
class Meta:
get_latest_by = 'times... | mit | Python |
716c3ddbf01020fea4d75a3c3305cbb9408a5a92 | Bump version to 0.7dev | tekton/happybase,wfxiang08/happybase,TAKEALOT/happybase,rickysaltzer/happybase,georgesuperman/happybase | happybase/_version.py | happybase/_version.py | """
HappyBase version module.
This module defines the package version for use in __init__.py and
setup.py.
"""
__version__ = '0.7dev'
| """
HappyBase version module.
This module defines the package version for use in __init__.py and
setup.py.
"""
__version__ = '0.6'
| apache-2.0 | Python |
f5ed9ba1bd5f1dcf9f2e93b83716bcd6e66f12eb | Fix time-sensitivity (< 0.002 second execution) in output format. | Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons | test/scons-time/func/format-gnuplot.py | test/scons-time/func/format-gnuplot.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit | Python |
791d378d1c5cb2e9729877bc70261b9354bdb590 | Transpose and Transpose180 for all Pillow versions | python-pillow/pillow-perf,python-pillow/pillow-perf | testsuite/cases/pillow_rotate_right.py | testsuite/cases/pillow_rotate_right.py | # coding: utf-8
from __future__ import print_function, unicode_literals, absolute_import
from PIL import Image
from .base import rpartial
from .pillow import PillowTestCase
class RotateRightCase(PillowTestCase):
def handle_args(self, name, transposition):
self.name = name
self.transposition = t... | # coding: utf-8
from __future__ import print_function, unicode_literals, absolute_import
from PIL import Image
from .base import rpartial
from .pillow import PillowTestCase
class RotateRightCase(PillowTestCase):
def handle_args(self, name, transposition):
self.name = name
self.transposition = t... | mit | Python |
c6023873e68b47b4a450e8af84cd46f2c873c00d | Check table access with EXISTS query | agdsn/hades,agdsn/hades,agdsn/hades,agdsn/hades,agdsn/hades | src/hades/common/check_db.py | src/hades/common/check_db.py | import logging
import sys
import os
import pwd
import contextlib
from sqlalchemy import exists, null, select
from sqlalchemy.exc import DBAPIError
from hades.common.cli import ArgumentParser, parser as common_parser
from . import db
from hades.config.loader import load_config
logger = logging.getLogger(__package__)
... | import logging
import sys
import os
import pwd
import contextlib
from sqlalchemy import func, select
from sqlalchemy.exc import DBAPIError
from hades.common.cli import ArgumentParser, parser as common_parser
from . import db
from hades.config.loader import load_config
logger = logging.getLogger(__package__)
@conte... | mit | Python |
6f6510623c7250ebea78afbd3d6eab1bfe467ada | Update heap.py (#726) | TheAlgorithms/Python | data_structures/heap/heap.py | data_structures/heap/heap.py | #!/usr/bin/python
from __future__ import print_function, division
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
#This heap class start from here.
class Heap:
def __init__(self): #Default constructor of heap class.
self.h = []
self.currsize = 0
def leftChild(s... | #!/usr/bin/python
from __future__ import print_function, division
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
class Heap:
def __init__(self):
self.h = []
self.currsize = 0
def leftChild(self,i):
if 2*i+1 < self.currsize:
return 2*i+1
return None
de... | mit | Python |
0fed2195601aa5e4b9e9ef28733b48550e654389 | fix entropy example doc, fix figure syntax | jwiggins/scikit-image,vighneshbirodkar/scikit-image,pratapvardhan/scikit-image,WarrenWeckesser/scikits-image,Hiyorimi/scikit-image,ofgulban/scikit-image,rjeli/scikit-image,paalge/scikit-image,jwiggins/scikit-image,WarrenWeckesser/scikits-image,blink1073/scikit-image,vighneshbirodkar/scikit-image,vighneshbirodkar/scikit... | doc/examples/plot_entropy.py | doc/examples/plot_entropy.py | """
=======
Entropy
=======
In information theory, information entropy is the log-base-2 of the number of
possible outcomes for a message.
For an image, local entropy is related to the complexity contained in a given
neighborhood, typically defined by a structuring element. A large number of
various gray levels has a... | """
=======
Entropy
=======
In information theory, information entropy is the log-base-2 of the number of
possible outcomes for a message.
For an image, local entropy is related to the complexity contained in a given
neighborhood, typically defined by a structuring element. A large number of
various gray levels has a... | bsd-3-clause | Python |
20df58bb9e605ecc53848ade31a3acb98118f00b | Add attribute display to clip extraction script. | HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper | scripts/extract_clips_from_hdf5_file.py | scripts/extract_clips_from_hdf5_file.py | from pathlib import Path
import wave
import h5py
DIR_PATH = Path('/Users/harold/Desktop/Clips')
INPUT_FILE_PATH = DIR_PATH / 'Clips.h5'
CLIP_COUNT = 5
def main():
with h5py.File(INPUT_FILE_PATH, 'r') as file_:
clip_group = file_['clips']
for i, clip_id in enumerate(clip_group):
... | from pathlib import Path
import wave
import h5py
DIR_PATH = Path('/Users/harold/Desktop/Clips')
INPUT_FILE_PATH = DIR_PATH / 'Clips.h5'
CLIP_COUNT = 5
def main():
with h5py.File(INPUT_FILE_PATH, 'r') as file_:
clip_group = file_['clips']
for i, clip_id in enumerate(clip_group):
... | mit | Python |
cfd0f3ca66ddabbe522d8e0f6a1750e20cfa6ea9 | improve improve | benzkji/django-layout,benzkji/django-layout,benzkji/django-layout,benzkji/django-layout,benzkji/django-layout | apps/project_name/cms_toolbars.py | apps/project_name/cms_toolbars.py | from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_pool import toolbar_pool
from djangocms_misc.alternate_toolbar.cms_toolbars import AlternateBasicToolbar
toolbar_pool.unregister(AlternateBasicToolbar)
@toolbar_pool.register
class CustomToolbar(AlternateBasicTo... | from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_pool import toolbar_pool
from djangocms_misc.alternate_toolbar.cms_toolbars import AlternateBasicToolbar
toolbar_pool.unregister(AlternateBasicToolbar)
@toolbar_pool.register
class CustomToolbar(AlternateBasicTo... | mit | Python |
c279dedeadb729b3ccccbf05f7c4a4dd34a4e6a7 | Add summary in l10n_ch_credit_control_payment_slip_report | BT-csanchez/l10n-switzerland,BT-ojossen/l10n-switzerland,CompassionCH/l10n-switzerland,michl/l10n-switzerland,CompassionCH/l10n-switzerland,open-net-sarl/l10n-switzerland,eLBati/l10n-switzerland,cyp-opennet/ons_cyp_github,BT-ojossen/l10n-switzerland,BT-fgarbely/l10n-switzerland,cyp-opennet/ons_cyp_github,BT-fgarbely/l1... | l10n_ch_credit_control_payment_slip_report/__openerp__.py | l10n_ch_credit_control_payment_slip_report/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville. Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publis... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville. Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publis... | agpl-3.0 | Python |
9ac980f06c9269503955e73892bc062b01690127 | Use new team name format | openhealthcare/opal-research,openhealthcare/opal-research,openhealthcare/opal-research | research/teams.py | research/teams.py | """
Research study teams!
"""
from opal.models import Team
from research.models import ResearchStudy
def get_study_teams(user):
"""
Given a USER, return a list of study teams that this user can see.
If USER is not authenticated, just return []
"""
# Go through study roles, getting those fo... | """
Research study teams!
"""
from opal.models import Team
from research.models import ResearchStudy
def get_study_teams(user):
"""
Given a USER, return a list of study teams that this user can see.
If USER is not authenticated, just return []
"""
# Go through study roles, getting those fo... | agpl-3.0 | Python |
4e55c0f40c0fc265038220dbabde6284e9289166 | Fix calling to fileExtension. | matejd11/birthdayNotify | personDb.py | personDb.py | import pickle
class PersonDb(object):
def __init__(self, dbName, autoload = True):
self.dbName = dbName
self.db = None
if autoload:
self.setup()
def setup(self):
self.db = PersonDb.load(self.dbName)
self.getGroups()
def getGroups(self):
tmp = s... | import pickle
class PersonDb(object):
def __init__(self, dbName, autoload = True):
self.dbName = dbName
self.db = None
if autoload:
self.setup()
def setup(self):
self.db = PersonDb.load(self.dbName)
self.getGroups()
def getGroups(self):
tmp = s... | mit | Python |
73856ac73abd9dc68909a67077c016d003888cdd | Add site guarding for ProgramCertRecord data migration | edx/credentials,edx/credentials,edx/credentials,edx/credentials | credentials/apps/records/migrations/0006_auto_20180718_1256.py | credentials/apps/records/migrations/0006_auto_20180718_1256.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-07-17 20:02
from __future__ import unicode_literals
from django.db import migrations
from credentials.apps.catalog.models import Program
from credentials.apps.records.models import ProgramCertRecord
def seed_program_cert_records(apps, schema_editor):
... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-07-17 20:02
from __future__ import unicode_literals
from django.db import migrations
from credentials.apps.catalog.models import Program
from credentials.apps.records.models import ProgramCertRecord
def seed_program_cert_records(apps, schema_editor):
... | agpl-3.0 | Python |
e059b3c3fa61fd18a07b9b702d83b64348375ca1 | fix travis test | frappe/frappe,manassolanki/frappe,ESS-LLP/frappe,yashodhank/frappe,ESS-LLP/frappe,saurabh6790/frappe,manassolanki/frappe,manassolanki/frappe,StrellaGroup/frappe,frappe/frappe,mhbu50/frappe,RicardoJohann/frappe,neilLasrado/frappe,adityahase/frappe,tundebabzy/frappe,manassolanki/frappe,chdecultot/frappe,adityahase/frappe... | frappe/tests/test_form_load.py | frappe/tests/test_form_load.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
from frappe.desk.form.load import getdoctype, getdoc
from frappe.core.page.permission_manager.permission_manager import update, reset
from frappe.permissio... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
from frappe.desk.form.load import getdoctype, getdoc
from frappe.core.page.permission_manager.permission_manager import update, reset
from frappe.permissio... | mit | Python |
8524ebba333a9cd25ae3128fa6a74281f173dd41 | Update cli argument to only pass relavent arguments | MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug | hug/development_runner.py | hug/development_runner.py | """hug/development_runner.py
Contains logic to enable execution of hug APIS locally from the command line for development use
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), t... | """hug/development_runner.py
Contains logic to enable execution of hug APIS locally from the command line for development use
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), t... | mit | Python |
3dba5b958bdad7a1ab1b388a1f4af8b1b12c43e4 | Bump to version 0.9. | eliteraspberries/hipshot | hipshot/hipshot.py | hipshot/hipshot.py | #!/usr/bin/env python
'''Hipshot converts a video file or series of photographs into
a single image simulating a long-exposure photograph.
'''
__author__ = 'Mansour Moufid'
__copyright__ = 'Copyright 2013-2015, Mansour Moufid'
__license__ = 'ISC'
__version__ = '0.9'
__email__ = 'mansourmoufid@gmail.com'
__status__ =... | #!/usr/bin/env python
'''Hipshot converts a video file or series of photographs into
a single image simulating a long-exposure photograph.
'''
__author__ = 'Mansour Moufid'
__copyright__ = 'Copyright 2013-2015, Mansour Moufid'
__license__ = 'ISC'
__version__ = '0.8'
__email__ = 'mansourmoufid@gmail.com'
__status__ =... | isc | Python |
20ab45f824e192650dd73c2d80ce74feecffc329 | Update time field to drop dateutil dependency | hugollm/lie2me,hugollm/lie2me | lie2me/fields/time.py | lie2me/fields/time.py | from ..field import Field
from ..parsers import parse_time
class Time(Field):
timezone = None
min = None
max = None
messages = {
'type': 'Invalid time.',
'naive': 'Requires timezone information.',
'aware': 'Must not have timezone information.',
'min': 'Must not come b... | from dateutil.parser import parse
from ..field import Field
class Time(Field):
timezone = None
min = None
max = None
messages = {
'type': 'Invalid time.',
'naive': 'Requires timezone information.',
'aware': 'Must not have timezone information.',
'min': 'Must not come ... | mit | Python |
6bd1ce3eec9812d81a764bb253ea1732efa84fbf | Rename argument | mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-inter... | problems/alphanumeric-string-sort/alphanumeric-string-sort.py | problems/alphanumeric-string-sort/alphanumeric-string-sort.py | def alphanum_sort(alphanum_string):
char_string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0246813579"
return ''.join(sorted(alphanum_string, key=char_string.index))
print(alphanum_sort("Sorting0123456789")) # ginortS0246813579
print(alphanum_sort("foobar1237348421")) # abf... | def alphanum_sort(string):
char_string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0246813579"
return ''.join(sorted(string, key=char_string.index))
print(alphanum_sort("Sorting0123456789")) # ginortS0246813579
print(alphanum_sort("foobar1237348421")) # abfoor2244811337
prin... | mit | Python |
6e024ecb4b0a3c57405f957768b9239cdcd57b49 | fix typo | AmeBel/opencog,AmeBel/opencog,ruiting/opencog,ruiting/opencog,inflector/opencog,andre-senna/opencog,yantrabuddhi/opencog,misgeatgit/opencog,andre-senna/opencog,andre-senna/opencog,misgeatgit/opencog,AmeBel/opencog,inflector/opencog,andre-senna/opencog,inflector/opencog,ruiting/opencog,inflector/opencog,andre-senna/open... | opencog/eva/src/face_atomic.py | opencog/eva/src/face_atomic.py | #
# face_atomic.py - Send face data to the cogserver/atomspace.
# Copyright (C) 2015 Linas Vepstas
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3 as
# published by the Free Software Foundation and including the exceptions
# at h... | #
# face_atomic.py - Send face data to the cogserver/atomspace.
# Copyright (C) 2015 Linas Vepstas
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3 as
# published by the Free Software Foundation and including the exceptions
# at h... | agpl-3.0 | Python |
c7aea8b6037ccb27163defa0ef48f1dc0599c9c2 | Bump version | thombashi/DateTimeRange | datetimerange/__version__.py | datetimerange/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.3.7"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.3.6"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
bfe29ccdd5f038b3cb1f6105b9051dbedefde823 | Add threading to cufflinks | dgaston/ddb-ngsflow,dgaston/ddbio-ngsflow | ddb_ngsflow/rna/cufflinks.py | ddb_ngsflow/rna/cufflinks.py | """
.. module:: cufflinks
:platform: Unix, OSX
:synopsis: A module of methods for working with the cufflinks RNA-Seq programs
into additional formats.
.. moduleauthor:: Daniel Gaston <daniel.gaston@dal.ca>
"""
import os
from ddb_ngsflow import pipeline
def cufflinks(job, config, name, input_bam):
"""... | """
.. module:: cufflinks
:platform: Unix, OSX
:synopsis: A module of methods for working with the cufflinks RNA-Seq programs
into additional formats.
.. moduleauthor:: Daniel Gaston <daniel.gaston@dal.ca>
"""
import os
from ddb_ngsflow import pipeline
def cufflinks(job, config, name, input_bam):
"""... | mit | Python |
74c2ff1fc16f12cd481d22d68e46322ff9b07260 | Fix missing imports in tournamentcontrol.competition.tasks | goodtune/vitriolic,goodtune/vitriolic,goodtune/vitriolic,goodtune/vitriolic | tournamentcontrol/competition/tasks.py | tournamentcontrol/competition/tasks.py | from celery import shared_task
from tournamentcontrol.competition.models import Match, Stage
from tournamentcontrol.competition.utils import generate_scorecards
@shared_task
def generate_pdf_scorecards(
match_pks, templates, extra_context, stage_pk=None, **kwargs
):
matches = Match.objects.filter(pk__in=matc... | from celery import shared_task
from tournamentcontrol.competition.utils import generate_scorecards
@shared_task
def generate_pdf_scorecards(
match_pks, templates, extra_context, stage_pk=None, **kwargs
):
matches = Match.objects.filter(pk__in=match_pks)
stage = None
if stage_pk is not None:
s... | bsd-3-clause | Python |
b50c72ad6200cc9f96e1b9eda03fba5d2d4999b9 | Change doc setting for release. | HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper | vesper/external_urls.py | vesper/external_urls.py | """
Functions that return external URLs, for example for the Vesper documentation.
"""
import vesper.version as vesper_version
_USE_LATEST_DOCUMENTATION_VERSION = False
"""Set this `True` during development, `False` for release."""
def _create_documentation_url():
if _USE_LATEST_DOCUMENTATION_VERSION:
... | """
Functions that return external URLs, for example for the Vesper documentation.
"""
import vesper.version as vesper_version
_USE_LATEST_DOCUMENTATION_VERSION = True
"""Set this `True` during development, `False` for release."""
def _create_documentation_url():
if _USE_LATEST_DOCUMENTATION_VERSION:
... | mit | Python |
86696a5450efa4b53be7b458c804cfa1d2117571 | add env judge | rli9/slam,rli9/slam,rli9/slam,rli9/slam | src/car_control_manual/scratch/connect_to_host.py | src/car_control_manual/scratch/connect_to_host.py | # -*- encoding: utf-8 -*-
from __future__ import print_function
__author__ = 'Simon Zheng'
"""Transfer command data from scratch to linux host
"""
import socket
class Server(object):
def __init__(self, host='', port=50007):
self.host = host
self.port = port
self.s = socket.socket(socket... | # -*- encoding: utf-8 -*-
from __future__ import print_function
__author__ = 'Simon Zheng'
"""Transfer command data from scratch to linux host
"""
import socket
class Server(object):
def __init__(self, host='', port=50007):
self.host = host
self.port = port
self.s = socket.socket(socket... | mit | Python |
2c49a968a9263bbaa93c03938c8ce4545da890b4 | Fix test (bad assert) | tjwei/jedi,WoLpH/jedi,dwillmer/jedi,WoLpH/jedi,tjwei/jedi,dwillmer/jedi,flurischt/jedi,jonashaag/jedi,mfussenegger/jedi,jonashaag/jedi,flurischt/jedi,mfussenegger/jedi | test/test_compiled.py | test/test_compiled.py | """
Test compiled module
"""
import os
import platform
import sys
import jedi
from .helpers import cwd_at
@cwd_at('test/extensions')
def test_completions():
if platform.architecture()[0] == '64bit':
package_name = "compiled%s%s" % sys.version_info[:2]
sys.path.insert(0, os.getcwd())
if os... | """
Test compiled module
"""
import os
import platform
import sys
import jedi
from .helpers import cwd_at
@cwd_at('test/extensions')
def test_completions():
if platform.architecture()[0] == '64bit':
package_name = "compiled%s%s" % sys.version_info[:2]
sys.path.insert(0, os.getcwd())
if os... | mit | Python |
c8e7f2be1905e9f440027d7480f58a4571a88731 | check for lsst.log | johnnygreco/hugs | hugs_pipe/__init__.py | hugs_pipe/__init__.py | try:
import lsst.log
Log = lsst.log.Log()
Log.setLevel(lsst.log.ERROR)
except ImportError:
pass
from . import imtools
from . import stats
from . import synths
from . import cattools
from .parser import parse_args
from .synths import SynthFactory
from .stats import get_clipped_sig_task
from .run import ... | import lsst.log
Log = lsst.log.Log()
Log.setLevel(lsst.log.ERROR)
from . import imtools
from . import stats
from . import synths
from . import cattools
from .parser import parse_args
from .synths import SynthFactory
from .stats import get_clipped_sig_task
from .run import run
from .primitives import *
from .viewer imp... | mit | Python |
58eaa192cd8cdbcc560524ccfbeddf3f712d3aca | Update P3_lucky.py added docstring and wrapped in main() function | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | pythontutorials/books/AutomateTheBoringStuff/Ch11/P3_lucky.py | pythontutorials/books/AutomateTheBoringStuff/Ch11/P3_lucky.py | #! python3
"""Lucky
Opens top Google search results for given query.
"""
def main():
import requests, sys, webbrowser, bs4, time
print("Googling...") # display text while downloading the Google page
res = requests.get("http://google.com/search?q=" + ' '.join(sys.argv[1:]))
res.raise_for_status()
... | #! python3
# lucky.py - Opens several Google search results.
import requests, sys, webbrowser, bs4, time
print("Googling...") # display text while downloading the Google page
res = requests.get("http://google.com/search?q=" + ' '.join(sys.argv[1:]))
res.raise_for_status()
# Retrieve top search result links.
soup = ... | mit | Python |
dc7527b6105020bf146801a74a2ebe7530c7fbcf | Bump to v1.0.0rc0 | justinsalamon/scaper | scaper/version.py | scaper/version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Version info"""
short_version = '1.0rc0'
version = '1.0.0rc0'
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Version info"""
short_version = '0.2'
version = '0.2.1'
| bsd-3-clause | Python |
e2bda659477564955fba23eff20f0c5bb7e18212 | fix setuptools version (#28141) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-blessings/package.py | var/spack/repos/builtin/packages/py-blessings/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyBlessings(PythonPackage):
"""A nicer, kinder way to write to the terminal """
homepa... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyBlessings(PythonPackage):
"""A nicer, kinder way to write to the terminal """
homepa... | lgpl-2.1 | Python |
e0f75b6fc34340a31462979f1add6f42cd7c794f | add version 2.0-0 to r-colorspace (#20864) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-colorspace/package.py | var/spack/repos/builtin/packages/r-colorspace/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RColorspace(RPackage):
"""A Toolbox for Manipulating and Assessing Colors and Palettes
... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RColorspace(RPackage):
"""Carries out mapping between assorted color spaces including RGB,... | lgpl-2.1 | Python |
20a056fbd580581cde1d98915cf54db972569bc9 | fix scan | SiLab-Bonn/pyBAR | host/pybar/scans/calibrate_pulser_dac_correction.py | host/pybar/scans/calibrate_pulser_dac_correction.py | import logging
import numpy as np
import tables as tb
from pybar.run_manager import RunManager
from pybar.scans.scan_threshold import ThresholdScan
from pybar.analysis.analyze_raw_data import AnalyzeRawData
class PulserDacCorrectionCalibration(ThresholdScan):
_scan_id = "pulser_dac_correction_calibration... | from scan.scan import ScanBase
from daq.readout import open_raw_data_file
from analysis.analyze_raw_data import AnalyzeRawData
from scan_threshold import ThresholdScan
import numpy as np
import tables as tb
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - [%(levelna... | bsd-3-clause | Python |
1315785a20e2ebfaf6872bc686f255b1110e95fb | fix / -> // | Nic30/hwtLib,Nic30/hwtLib | hwtLib/amba/axi_comp/cache/ramTransactional_test.py | hwtLib/amba/axi_comp/cache/ramTransactional_test.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.hdl.constants import NOP
from hwt.simulator.simTestCase import SimTestCase
from hwtLib.amba.axi_comp.cache.ramTransactional import RamTransactional
from hwtSimApi.constants import CLK_PERIOD
class RamTransactionalTC(SimTestCase):
@classmethod
def setUp... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.hdl.constants import NOP
from hwt.simulator.simTestCase import SimTestCase
from hwtLib.amba.axi_comp.cache.ramTransactional import RamTransactional
from hwtSimApi.constants import CLK_PERIOD
class RamTransactionalTC(SimTestCase):
@classmethod
def setUp... | mit | Python |
829ea860972b271d6d9e6b2db2601774568c4ed4 | make the tests a little more DRY | fancystats/nhlstats | tests/models_tests.py | tests/models_tests.py | """
Model Tests
-----------
These tests focus on the storage models themselves
"""
import unittest
from peewee import SqliteDatabase
from nhlstats.models import db_proxy, League, Season, SeasonType
db_proxy.initialize(SqliteDatabase(':memory:'))
class ModelTestCase(unittest.TestCase):
MODELS = []
def ... | """
Model Tests
-----------
These tests focus on the storage models themselves
"""
import unittest
from peewee import SqliteDatabase
from nhlstats.models import db_proxy, League, Season, SeasonType
db_proxy.initialize(SqliteDatabase(':memory:'))
class ModelTestCase(unittest.TestCase):
MODELS = []
def ... | mit | Python |
157caa93e7b2beca15ff02954b3461f67afb69c0 | Implement non-Nesterov momentum update. | google/trax,google/trax | trax/optimizers/momentum.py | trax/optimizers/momentum.py | # coding=utf-8
# Copyright 2020 The Trax 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 or a... | # coding=utf-8
# Copyright 2020 The Trax 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 or a... | apache-2.0 | Python |
392a98d5fcf3cf9a800ba57ac6755df40f347f77 | Kill whitespace | hyunchel/redis-dump-load,p/redis-dump-load,hyunchel/redis-dump-load,p/redis-dump-load | tests/redisdl_test.py | tests/redisdl_test.py | import redisdl
import unittest
import json
import os.path
class RedisdlTest(unittest.TestCase):
def test_roundtrip(self):
path = os.path.join(os.path.dirname(__file__), 'fixtures', 'dump.json')
with open(path) as f:
dump = f.read()
redisdl.loads(dump)
redump = redisdl.... | import redisdl
import unittest
import json
import os.path
class RedisdlTest(unittest.TestCase):
def test_roundtrip(self):
path = os.path.join(os.path.dirname(__file__), 'fixtures', 'dump.json')
with open(path) as f:
dump = f.read()
redisdl.loads(dump)
r... | bsd-2-clause | Python |
6892cde9917382bf06f90799235f42f55d82d52b | Fix print statements | thread/django-lightweight-queue,thread/django-lightweight-queue | django_lightweight_queue/management/commands/queue_configuration.py | django_lightweight_queue/management/commands/queue_configuration.py | from django.core.management.base import BaseCommand
from ... import app_settings
from ...utils import get_backend, load_extra_config
from ...cron_scheduler import get_cron_config
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--config', action='store', default=None,
... | from django.core.management.base import BaseCommand
from ... import app_settings
from ...utils import get_backend, load_extra_config
from ...cron_scheduler import get_cron_config
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--config', action='store', default=None,
... | bsd-3-clause | Python |
79b96e33eae28e90c7ffdfabb0dfe4132ddc59f7 | Add tests for the debug functionality | helgi/python-command | tests/test_command.py | tests/test_command.py | from __future__ import print_function
import sys
import os
from os.path import realpath, dirname
try:
import command
except ImportError:
print('Unable to import command. Is it installed?')
sys.exit(1)
try:
import py.test
except ImportError:
print('Unable to import py.test. Is py.test installed?'... | from __future__ import print_function
import sys
import os
from os.path import realpath, dirname
try:
import command
except ImportError:
print('Unable to import command. Is it installed?')
sys.exit(1)
try:
import py.test
except ImportError:
print('Unable to import py.test. Is py.test installed?'... | mit | Python |
e30c39fe78cb8d3fe8379f032b66f7719b2e99c5 | fix non-passing tests for logging on pytest > 3.3.0 | drewja/flask,drewja/flask,fkazimierczak/flask,drewja/flask,fkazimierczak/flask,mitsuhiko/flask,pallets/flask,fkazimierczak/flask,mitsuhiko/flask,pallets/flask,pallets/flask | tests/test_logging.py | tests/test_logging.py | import logging
import sys
import pytest
from flask._compat import StringIO
from flask.logging import default_handler, has_level_handler, \
wsgi_errors_stream
@pytest.fixture(autouse=True)
def reset_logging(monkeypatch):
root_handlers = logging.root.handlers[:]
root_level = logging.root.level
logger... | import logging
import sys
import pytest
from flask._compat import StringIO
from flask.logging import default_handler, has_level_handler, \
wsgi_errors_stream
@pytest.fixture(autouse=True)
def reset_logging(monkeypatch):
root_handlers = logging.root.handlers[:]
root_level = logging.root.level
logger... | bsd-3-clause | Python |
666d5ca196f59bcdc85fc8ab4193200e8c61fb4a | Use more conventional strategy naming | hugovk/coveragepy,nedbat/coveragepy,hugovk/coveragepy,hugovk/coveragepy,hugovk/coveragepy,nedbat/coveragepy,nedbat/coveragepy,nedbat/coveragepy,hugovk/coveragepy,nedbat/coveragepy | tests/test_numbits.py | tests/test_numbits.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for coverage.numbits"""
from hypothesis import given, settings
from hypothesis.strategies import sets, integers
from coverage import env
from coverage.nu... | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for coverage.numbits"""
from hypothesis import given, settings
from hypothesis.strategies import sets, integers
from coverage import env
from coverage.nu... | apache-2.0 | Python |
a5b553e109c2e28d42ff420d01293973015cfea0 | update tests with new resume template filenames | cstrelioff/resumepy,cstrelioff/resumepy | tests/test_process.py | tests/test_process.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 Christopher C. Strelioff <chris.strelioff@gmail.com>
#
# Distributed under terms of the MIT license.
"""test_process.py
Test (non-command line) methods in the process.py module.
"""
import unittest
import os
import tempfile
import ... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 Christopher C. Strelioff <chris.strelioff@gmail.com>
#
# Distributed under terms of the MIT license.
"""test_process.py
Test (non-command line) methods in the process.py module.
"""
import unittest
import os
import tempfile
import ... | mit | Python |
ca028ee4ecebfd557426f04033a6150b0e32c1d6 | test modifying the identity column | moskytw/mosql,uranusjr/mosql | tests/test_result2.py | tests/test_result2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
from mosql.result2 import Model
class PostgreSQL(Model):
getconn = classmethod(lambda cls: psycopg2.connect(database='mosky'))
putconn = classmethod(lambda cls, conn: None)
class Person(PostgreSQL):
clauses = dict(table='person')
arrange_b... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
from mosql.result2 import Model
class PostgreSQL(Model):
getconn = classmethod(lambda cls: psycopg2.connect(database='mosky'))
putconn = classmethod(lambda cls, conn: None)
class Person(PostgreSQL):
clauses = dict(table='person')
arrange_b... | mit | Python |
2838b226d9abe08b4470b6b3f41f6392860fc061 | Remove tests referencing .dirent (no longer exists). | benhoyt/scandir,benhoyt/scandir | tests/test_scandir.py | tests/test_scandir.py | """Tests for scandir.scandir()."""
import os
import sys
import unittest
import scandir
test_path = os.path.join(os.path.dirname(__file__), 'dir')
class TestScandir(unittest.TestCase):
def test_basic(self):
entries = sorted(scandir.scandir(test_path), key=lambda e: e.name)
self.assertEqual([(e.na... | """Tests for scandir.scandir()."""
import os
import sys
import unittest
import scandir
test_path = os.path.join(os.path.dirname(__file__), 'dir')
class TestScandir(unittest.TestCase):
def test_basic(self):
entries = sorted(scandir.scandir(test_path), key=lambda e: e.name)
self.assertEqual([(e.na... | bsd-3-clause | Python |
b0e101f523fd853392e65b1b30204a56e3ec34ec | Update access token variable names | nestauk/inet | tests/test_twitter.py | tests/test_twitter.py | # -*- coding: utf-8 -*-
import pytest
import tweepy
import vcr
from secrets import TWITTER_ACCESS, TWITTER_SECRET
from secrets import TWITTER_CONSUMER_ACCESS, TWITTER_CONSUMER_SECRET
class TestTweepyIntegration():
"""Test class to ensure tweepy functionality works as expected"""
# Class level client to use a... | # -*- coding: utf-8 -*-
import pytest
import tweepy
import vcr
from secrets import TWITTER_ACCESS, TWITTER_SECRET
from secrets import CONSUMER_KEY, CONSUMER_SECRET
class TestTweepyIntegration():
"""Test class to ensure tweepy functionality works as expected"""
# Class level client to use across tests
aut... | mit | Python |
1480f3bb57ee8bbbb782ffd544ea5de6460915cc | Complete iter sol | bowen0701/algorithms_data_structures | lc0144_binary_tree_preorder_traversal.py | lc0144_binary_tree_preorder_traversal.py | """Leetcode 144. Binary Tree Preorder Traversal
Medium
URL: https://leetcode.com/problems/binary-tree-preorder-traversal/
Given a binary tree, return the preorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [1,2,3]
Follow up: Recursive solution is trivial, could... | """Leetcode 144. Binary Tree Preorder Traversal
Medium
URL: https://leetcode.com/problems/binary-tree-preorder-traversal/
Given a binary tree, return the preorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [1,2,3]
Follow up: Recursive solution is trivial, could... | bsd-2-clause | Python |
5680fed2ecc9a234204887fc0b144f5ba45d2441 | change package version | aiscenblue/flask-blueprint | flask_blueprint/__init__.py | flask_blueprint/__init__.py | from .package_extractor import PackageExtractor
"""
Description:: Initialize the blueprints inside in the root folder
and sub folder
Requirements:: all directories and sub directories must consist of __init__.py
to be considered as a package.
files are ignored if its not end with .py or __.py
... | from .package_extractor import PackageExtractor
"""
Description:: Initialize the blueprints inside in the root folder
and sub folder
Requirements:: all directories and sub directories must consist of __init__.py
to be considered as a package.
files are ignored if its not end with .py or __.py
... | mit | Python |
d192bbc2f4e0d9d34c10b559a1007ebefd0ae7bc | Fix bug with input number validation | kalyons11/kevin,kalyons11/kevin | kevin/playground/read.py | kevin/playground/read.py | """Quick script to read inputs.
"""
if __name__ == '__main__':
# Read the number of inputs
num_inputs = int(input("How many inputs? "))
assert num_inputs >= 3, "At least 3 please."
print("Enter your {} inputs in the following form: inp1 inp2 ... inp{}".format(
num_inputs, num_inputs))
a = l... | """Quick script to read inputs.
"""
if __name__ == '__main__':
# Read the number of inputs
num_inputs = int(input("How many inputs? "))
assert num_inputs > 3, "At least 3 please."
print("Enter your {} inputs in the following form: inp1 inp2 ... inp{}".format(
num_inputs, num_inputs))
a = li... | mit | Python |
f3b7db9730e3492190b80b5f0b3e4ce5c03b3a7c | Remove paste unusable sections | PetukhovVictor/compiler,PetukhovVictor/compiler | src/Compiler/ASM/Core/compiler.py | src/Compiler/ASM/Core/compiler.py | from .code import Code
from .commands import Commands
from .environment import Environment
from .labels import Labels
from .registers import Registers
from .types import Types
from .vars import Vars
from .config import *
class Compiler:
entry_point_label = '_main'
exit_interrupt = 0x80
def __init__(self)... | from .code import Code
from .commands import Commands
from .environment import Environment
from .labels import Labels
from .registers import Registers
from .types import Types
from .vars import Vars
from .config import *
class Compiler:
entry_point_label = '_main'
exit_interrupt = 0x80
def __init__(self)... | mit | Python |
8c2a5884d85c9c66fd1ef5a0aa14d3a26e017042 | Remove useless -r option | alephobjects/Cura,alephobjects/Cura,alephobjects/Cura | Cura/cura.py | Cura/cura.py | #!/usr/bin/python
"""
This page is in the table of contents.
==Overview==
===Introduction===
Cura is a AGPL tool chain to generate a GCode path for 3D printing. Older versions of Cura where based on Skeinforge.
Versions up from 13.05 are based on a C++ engine called CuraEngine.
"""
__copyright__ = "Copyright (C) 2013 D... | #!/usr/bin/python
"""
This page is in the table of contents.
==Overview==
===Introduction===
Cura is a AGPL tool chain to generate a GCode path for 3D printing. Older versions of Cura where based on Skeinforge.
Versions up from 13.05 are based on a C++ engine called CuraEngine.
"""
__copyright__ = "Copyright (C) 2013 D... | agpl-3.0 | Python |
8ddd199d24b0d1fc601d5918487eab83c1ba69c3 | make an evil sys.path manipulation a little less evil. | knipknap/exscript,knipknap/exscript,maximumG/exscript,maximumG/exscript | src/Exscript/external/__init__.py | src/Exscript/external/__init__.py | import os, sys
sys.path.append(os.path.dirname(__file__))
| import os, sys
sys.path.insert(0, os.path.dirname(__file__))
| mit | Python |
b372e2c172f63dfe0cb10fdb3ca9f134d911d0f8 | update enthought.util.guisupport proxy | enthought/etsproxy | enthought/util/guisupport.py | enthought/util/guisupport.py | # proxy module
from pyface.util.guisupport import *
| # proxy module
from traits.util.guisupport import *
| bsd-3-clause | Python |
f796a824783a14f47361c37216aff1da5dfdb4b3 | add accept_none option for reader | morgenst/PyAnalysisTools,morgenst/PyAnalysisTools,morgenst/PyAnalysisTools | PyAnalysisTools/base/YAMLHandle.py | PyAnalysisTools/base/YAMLHandle.py | import sys
import yaml
from . import _logger
class YAMLLoader(object):
def __init__(self, **kwargs):
kwargs.setdefault('log_level', 'warning')
for k, v in kwargs.iteritems():
setattr(self, k, v)
@staticmethod
def read_yaml(file_name, accept_none=False):
if accept_none ... | import sys
import yaml
from . import _logger
class YAMLLoader(object):
def __init__(self, **kwargs):
kwargs.setdefault('log_level', 'warning')
for k, v in kwargs.iteritems():
setattr(self, k, v)
@staticmethod
def read_yaml(file_name):
try:
_logger.debug("Tr... | mit | Python |
c8aeb5fd4cdb1288dcb3ab2aa600c9ca2a11d855 | Update find-duplicate-subtrees.py | tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/Le... | Python/find-duplicate-subtrees.py | Python/find-duplicate-subtrees.py | # Time: O(n)
# Space: O(n)
# Given a binary tree, return all duplicate subtrees.
# For each kind of duplicate subtrees, you only need to return the root node of any one of them.
#
# Two trees are duplicate if they have the same structure with same node values.
#
# Example 1:
# 1
# / \
# 2 3
# ... | # Time: O(n * h)
# Space: O(n * h)
# Given a binary tree, return all duplicate subtrees.
# For each kind of duplicate subtrees, you only need to return the root node of any one of them.
#
# Two trees are duplicate if they have the same structure with same node values.
#
# Example 1:
# 1
# / \
# ... | mit | Python |
84976c47bbdc2f64fa85383f17186cd76b2afe0b | Split field to allow for simpler extension | python-odin/odin | odin/contrib/pint/fields.py | odin/contrib/pint/fields.py | # -*- coding: utf-8 -*-
from pint.unit import DimensionalityError
import six
from odin import exceptions
from odin.contrib.pint.units import registry
from odin.fields import Field
from odin.validators import EMPTY_VALUES
__all__ = ('FloatField',)
class PintField(Field):
def __init__(self, units, **kwargs):
... | # -*- coding: utf-8 -*-
from pint.unit import DimensionalityError
import six
from odin import exceptions
from odin.contrib.pint.units import registry
from odin.fields import Field
from odin.validators import EMPTY_VALUES
__all__ = ('FloatQField',)
class FloatQField(Field):
default_error_messages = {
'inv... | bsd-3-clause | Python |
e3f5a32d104ec736f38de681e23d634aa1b78187 | Update static.py | cnbeining/onedrivecmd | onedrivecmd/utils/static.py | onedrivecmd/utils/static.py | #!/usr/bin/env python
# coding:utf-8
# Author: Beining --<i@cnbeining.com>
# Purpose: Static varibles for onedrivecmd
# Created: 09/24/2016
global VER, redirect_uri, client_secret, client_id, api_base_url, scopes, discovery_uri, auth_server_url, auth_token_url
VER = 'OnedriveCMD V0.1.7'
# If you are not sure wheth... | #!/usr/bin/env python
# coding:utf-8
# Author: Beining --<i@cnbeining.com>
# Purpose: Static varibles for onedrivecmd
# Created: 09/24/2016
global VER, redirect_uri, client_secret, client_id, api_base_url, scopes, discovery_uri, auth_server_url, auth_token_url
VER = 'OnedriveCMD V0.1.6.2-dev'
# If you are not sure... | agpl-3.0 | Python |
68f8274b2692b43ae6668611d6d57f99b03ad7b8 | update title and theme | feltnerm/blog | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Mark Feltner'
SITENAME = "mark feltner's weblog"
EMAIL = 'mark@feltner.me'
SITEURL = ''
DESCRIPTION = '''Write an awesome description for your new site here. You can
edit this line in _config.yml. It will appear in your d... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Mark Feltner'
SITENAME = "Mark Feltner's Blog"
EMAIL = 'mark@feltner.me'
SITEURL = ''
DESCRIPTION = '''Write an awesome description for your new site here. You can
edit this line in _config.yml. It will appear in your doc... | mit | Python |
0b3309b3fe5c2c2e34512e9007795490e48a3a7c | add siteurl and turn on document relative urls to fix home link | akersten/alex-ink | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Alex Kersten'
SITENAME = 'alex ink'
SITEURL = 'http://alex.ink'
PATH = 'content'
STATIC_PATHS = ['static']
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Alex Kersten'
SITENAME = 'alex ink'
#SITENAME = '<img src="static/logo.png" style="margin-top:0;width:50%;height:50%;" alt="alex ink" />'
SITEURL = ''
PATH = 'content'
STATIC_PATHS = ['static']
TIMEZONE = 'America/Chica... | mit | Python |
eee608198ad81b67a72c11653f67c6394ff70221 | Update version to 0.1.0 | gunthercox/mathparse | mathparse/__init__.py | mathparse/__init__.py | """
mathparse is a library for solving mathematical equations contained in strings
"""
__version__ = '0.1.0'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/mathparse'
| """
mathparse is a library for solving mathematical equations contained in strings
"""
__version__ = '0.0.2'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/mathparse'
| mit | Python |
79852bc25c1e95f64d4c2c49984a53caabb258c7 | Undo change to comma in time | hashbangstudio/Data-Plotting-Test-Data | genRandomTemperatureData.py | genRandomTemperatureData.py | #!/usr/bin/env python
#import the needed modules
import sys
from datetime import datetime, time, timedelta
from random import randint
if __name__ == "__main__":
numOfRecsToGenerate = 0
minTemp = 0
maxTemp = 0
timeStep = 0
minNumOfArgs = 5
numOfArgs = len(sys.argv) - 1
if numOfArgs == min... | #!/usr/bin/env python
#import the needed modules
import sys
from datetime import datetime, time, timedelta
from random import randint
if __name__ == "__main__":
numOfRecsToGenerate = 0
minTemp = 0
maxTemp = 0
timeStep = 0
minNumOfArgs = 5
numOfArgs = len(sys.argv) - 1
if numOfArgs == min... | bsd-3-clause | Python |
2e71bdf36115d7f3e6779d7bed6819f19327e4e2 | Add serializer | lrgar/spgen,lrgar/spgen,lrgar/spgen | spgen/generators/template_serializer.py | spgen/generators/template_serializer.py | #
# template_serializer.py
#
# Copyright (c) 2013 Luis Garcia.
# This source file is subject to terms of the MIT License. (See accompanying file LICENSE)
#
"""
Template serializer library.
Based in Brevé, http://breve.twisty-industries.com/
"""
import itertools
class TagBase:
def __init__(self):
self._children = ... | #
# template_serializer.py
#
# Copyright (c) 2013 Luis Garcia.
# This source file is subject to terms of the MIT License. (See accompanying file LICENSE)
#
"""
Template serializer library.
Based in Brevé, http://breve.twisty-industries.com/
"""
import itertools
class TagBase:
def __init__(self):
self._children = ... | mit | Python |
1b4cdef91116359cefe7c940bfe00012404c032c | simplify status_code code | cobrateam/splinter,bmcculley/splinter,bmcculley/splinter,cobrateam/splinter,cobrateam/splinter,bmcculley/splinter | splinter/request_handler/status_code.py | splinter/request_handler/status_code.py | # -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
class StatusCode(object):
def __init__(self, status_code, reason):
#: A message for the response (example: Success)
... | # -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
class StatusCode(object):
http_errors = (400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
412, 413, ... | bsd-3-clause | Python |
fe0956c8c1278fbadd3d660d86d0c490a1bcee9b | Bump version | genestack/python-client | genestack_client/version.py | genestack_client/version.py | __version__ = '0.15.0a1'
| __version__ = '0.14.0'
| mit | Python |
c24503f1ece5995ce97d5003e6921dbc1510080a | fix migrations for a clean installation | unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/rhizome | datapoints/migrations/0003_add_earth_location.py | datapoints/migrations/0003_add_earth_location.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('datapoints', '0002_indicator_json_fields'),
]
operations = [
migrations.RunSQL('''
INSERT I... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('datapoints', '0002_indicator_json_fields'),
]
operations = [
migrations.RunSQL('''
INSERT I... | agpl-3.0 | Python |
28bcbaa6ecb8459ae5a0634ed6bb6debb7c1c695 | Add module-level docstring to in-process kernel example. | ipython/ipython,ipython/ipython | docs/examples/frontend/inprocess_qtconsole.py | docs/examples/frontend/inprocess_qtconsole.py | """ A simple example of using the Qt console with an in-process kernel.
We shall see how to create the frontend widget, create an in-process kernel,
push Python objects into the kernel's namespace, and execute code in the
kernel, both directly and via the frontend widget.
"""
from IPython.inprocess.ipkernel import In... | from IPython.inprocess.ipkernel import InProcessKernel
from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget
from IPython.frontend.qt.inprocess_kernelmanager import QtInProcessKernelManager
from IPython.lib import guisupport
def main():
app = guisupport.get_app_qt4()
# Create a kernel... | bsd-3-clause | Python |
ac1556a1b47c0ebd75f2dee425a67aa011abc64c | make functions to get the default rollover and click sounds | tobspr/panda3d,chandler14362/panda3d,mgracer48/panda3d,chandler14362/panda3d,hj3938/panda3d,matthiascy/panda3d,cc272309126/panda3d,brakhane/panda3d,matthiascy/panda3d,cc272309126/panda3d,mgracer48/panda3d,tobspr/panda3d,cc272309126/panda3d,jjkoletar/panda3d,jjkoletar/panda3d,mgracer48/panda3d,jjkoletar/panda3d,ee08b397... | direct/src/gui/GuiGlobals.py | direct/src/gui/GuiGlobals.py | # GuiGlobals.py : global info for the gui package
from ShowBaseGlobal import *
import GuiManager
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(),
base.render2d.node())
font = None
panel = None
drawOrder = 100
def getDefaultFont():
global font
if font == ... | # GuiGlobals.py : global info for the gui package
from ShowBaseGlobal import *
import GuiManager
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(),
base.render2d.node())
font = None
panel = None
drawOrder = 100
def getDefaultFont():
global font
if font == ... | bsd-3-clause | Python |
ec59489d1d276f97c64ca4d70cf1b107540938be | fix double jeopardy size | FSI-HochschuleTrier/hacker-jeopardy,FSI-HochschuleTrier/hacker-jeopardy | de/hochschuletrier/jpy/overlays/DoubleOverlay.py | de/hochschuletrier/jpy/overlays/DoubleOverlay.py | __author__ = 'georg'
from de.hochschuletrier.jpy.Constants import Constants, Fonts
from de.hochschuletrier.jpy.overlays.Overlay import Overlay
from Tkinter import Label, StringVar
class DoubleOverlay(Overlay):
def __init__(self, *args, **kwargs):
Overlay.__init__(self, *args, **kwargs)
self.label ... | __author__ = 'georg'
from de.hochschuletrier.jpy.Constants import Constants, Fonts
from de.hochschuletrier.jpy.overlays.Overlay import Overlay
from Tkinter import Label, StringVar
class DoubleOverlay(Overlay):
def __init__(self, *args, **kwargs):
Overlay.__init__(self, *args, **kwargs)
self.label ... | mit | Python |
e325ec1e450bf0cbe3f8c5f92c7aca7ebe4936db | replace deprecated session.save in place of sess.add() | guillaume-philippon/aquilon,stdweird/aquilon,quattor/aquilon,guillaume-philippon/aquilon,quattor/aquilon,stdweird/aquilon,guillaume-philippon/aquilon,stdweird/aquilon,quattor/aquilon | lib/python2.5/aquilon/server/commands/add_vendor.py | lib/python2.5/aquilon/server/commands/add_vendor.py | # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
#
# Copyright (C) 2009 Contributor
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the EU DataGrid Software License. You should
# have received a copy of the license with... | # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
#
# Copyright (C) 2009 Contributor
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the EU DataGrid Software License. You should
# have received a copy of the license with... | apache-2.0 | Python |
c29a24cf48ab954f53842d7b37315444060a4a89 | Add node docstring. as per #24 | vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks | globaleaks/handlers/node.py | globaleaks/handlers/node.py | # -*- coding: UTF-8
# node
# ****
# :copyright: 2012 Hermes No Profit Association - GlobaLeaks Project
# :author: Claudio Agosti <vecna@globaleaks.org>, Arturo Filastò <art@globaleaks.org>
# :license: see LICENSE
#
from twisted.internet.defer import inlineCallbacks
from globaleaks.rest import answers
from g... | # -*- coding: UTF-8
# node
# ****
# :copyright: 2012 Hermes No Profit Association - GlobaLeaks Project
# :author: Claudio Agosti <vecna@globaleaks.org>, Arturo Filastò <art@globaleaks.org>
# :license: see LICENSE
#
from twisted.internet.defer import inlineCallbacks
from globaleaks.rest import answers
from g... | agpl-3.0 | Python |
f636f7b7d1dfc61a9c1f3eba1a1d43d84b7463ed | fix not the same graph problem | ZhuiFengChaseWind/Self-Driving_Car_Capstone,ZhuiFengChaseWind/Self-Driving_Car_Capstone,ZhuiFengChaseWind/Self-Driving_Car_Capstone | ros/src/tl_detector/light_classification/tl_classifier.py | ros/src/tl_detector/light_classification/tl_classifier.py | from styx_msgs.msg import TrafficLight
from keras.models import load_model
from keras.models import model_from_yaml
import numpy as np
import cv2
import numpy as py
import tensorflow as tf
class TLClassifier(object):
def __init__(self):
#TODO load classifier
self.graph = tf.get_default_graph()
... | from styx_msgs.msg import TrafficLight
from keras.models import load_model
import cv2
import numpy as py
class TLClassifier(object):
def __init__(self):
#TODO load classifier
self.model = load_model("light_classification/models/sim_tl_model.h5")
def get_classification(self, image):
... | mit | Python |
d35c203f068cb9a522d9824df4296203d6f298e4 | Include debug_toolbars urls when running in DEBUG mode | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/urls.py | mygpo/urls.py | import os.path
from django.urls import include, path, register_converter, re_path
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
# This URLs should be always be served, even during maintenance mode
urlpatterns = static(settings.STATIC_URL, document_root=se... | import os.path
from django.urls import include, path, register_converter, re_path
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
# This URLs should be always be served, even during maintenance mode
urlpatterns = static(settings.STATIC_URL, document_root=se... | agpl-3.0 | Python |
7714cfcbec8621fc39232e158c6969c697b584c9 | fix geoip_update command for django 1.10 | futurecolors/django-geoip | django_geoip/management/commands/geoip_update.py | django_geoip/management/commands/geoip_update.py | # -*- coding: utf-8 -*-
import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from ..ipgeobase import IpGeobase
class Command(BaseCommand):
help = 'Updates django-geoip data stored in db'
def add_arguments(self, parser):
parser.add_argument('--clear',
... | # -*- coding: utf-8 -*-
import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from ..ipgeobase import IpGeobase
class Command(BaseCommand):
help = 'Updates django-geoip data stored in db'
option_list = BaseCommand.option_list + (
make_option('--clear',
... | mit | Python |
6cb215211bff754f531126ac44df03e761b3d7fc | Use data provider in PD incident tests. | BlasiusVonSzerencsi/pagerduty-events-api | pagerduty_events_api/tests/test_pagerduty_incident.py | pagerduty_events_api/tests/test_pagerduty_incident.py | from ddt import ddt, data, unpack
from unittest import TestCase
from unittest.mock import patch
from pagerduty_events_api import PagerdutyIncident
@ddt
class TestPagerdutyIncident(TestCase):
def setUp(self):
super().setUp()
self.__subject = PagerdutyIncident('my_service_key', 'my_incident_key')
... | from unittest import TestCase
from unittest.mock import patch
from pagerduty_events_api import PagerdutyIncident
class TestPagerdutyIncident(TestCase):
def setUp(self):
super().setUp()
self.__subject = PagerdutyIncident('my_service_key', 'my_incident_key')
def test_get_service_key_should_ret... | mit | Python |
ae4d19204975c6c98f6cd84230a021df636f0cc0 | Tag nickname readonly for logged in users, it will be replaced on post either way | jokey2k/ShockGsite,jokey2k/ShockGsite | shoutbox/views.py | shoutbox/views.py | from django.http import HttpResponse
from django.template import RequestContext, Context, loader
from django.shortcuts import redirect, render
from django.db import transaction
from djangobb_forum.util import render_to
from shoutbox.models import ShoutboxEntry
from shoutbox.forms import ShoutboxPostForm
def recent_e... | from django.http import HttpResponse
from django.template import RequestContext, Context, loader
from django.shortcuts import redirect, render
from django.db import transaction
from djangobb_forum.util import render_to
from shoutbox.models import ShoutboxEntry
from shoutbox.forms import ShoutboxPostForm
def recent_e... | bsd-3-clause | Python |
1d792c9edac5e8fce7dbc3656feecf945cdeacc4 | Make it work without X-server | toslunar/chainerrl,toslunar/chainerrl | plot_scores.py | plot_scores.py | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import argparse
import os
import matplotlib
matplotlib.use('Agg') # Needed to run without X-server... | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import argparse
import os
import matplotlib.pyplot as plt
import pandas as pd
def main():
par... | mit | Python |
bd1a54f55abcccf3d7b0cd0160811d2e350e922c | update connector.py | Interoute/Libcloud-and-VDC | connection.py | connection.py | #import of libcloud libraries
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
#create a driver for VDC
VDCDriver=get_driver(Provider.CLOUDSTACK)
#set VDC connection details
vdc_apikey= 'INSERT YOUR VDC ACCOUNT API KEY HERE'
vdc_secretkey= 'INSERT YOUR VDC ACCOUNT SECRET K... | #import of libcloud libraries
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
#create a driver for VDC
VDCDriver=get_driver(Provider.CLOUDSTACK)
#set VDC connection details
vdc_apikey= '61C08D-OJFE4bur88saOa9z_gZSFOCixiaVcqGzSkQcdTPnHyRePyibeR2KeADvH1Jo6T8aUhVwTMVT5KCuArA... | apache-2.0 | Python |
62419ac14942d235495f8c34a3af0af610f2f2b6 | fix some simulated init that was wrong | abinashk-inf/AstroBox,madhuni/AstroBox,madhuni/AstroBox,abinashk-inf/AstroBox,abinashk-inf/AstroBox,AstroPrint/AstroBox,abinashk-inf/AstroBox,AstroPrint/AstroBox,AstroPrint/AstroBox,madhuni/AstroBox,madhuni/AstroBox | src/astroprint/network/mac_dev.py | src/astroprint/network/mac_dev.py | # coding=utf-8
__author__ = "Daniel Arroyo <daniel@astroprint.com>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import logging
from astroprint.network import NetworkManager as NetworkManagerBase
class MacDevNetworkManager(NetworkManagerBase):
def __init__(self):
self.na... | # coding=utf-8
__author__ = "Daniel Arroyo <daniel@astroprint.com>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import logging
from astroprint.network import NetworkManager as NetworkManagerBase
class MacDevNetworkManager(NetworkManagerBase):
def getActiveConnections(self... | agpl-3.0 | Python |
8bdf971c3ddbe6f106e788b5a2effebad6c30ec5 | Add drf_yasg module for dev env | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin | geotrek/settings/env_dev.py | geotrek/settings/env_dev.py | #
# Django Development
# ..........................
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
#
# Developper additions
# ..........................
INSTALLED_APPS = (
'django_extensions',
'debug_toolbar',
'drf_yasg',
) + INSTALLED_APPS
INTERNAL_IPS = type(str('c'), (... | #
# Django Development
# ..........................
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
#
# Developper additions
# ..........................
INSTALLED_APPS = (
'django_extensions',
'debug_toolbar',
) + INSTALLED_APPS
INTERNAL_IPS = type(str('c'), (), {'__contains_... | bsd-2-clause | Python |
dbfe5fcb87762d68580756d6466bc61fa8ab4a56 | Enhance get_stain_matrix to take any desired number of vectors | DigitalSlideArchive/HistomicsTK,DigitalSlideArchive/HistomicsTK | histomicstk/preprocessing/color_deconvolution/utils.py | histomicstk/preprocessing/color_deconvolution/utils.py | import numpy
from .stain_color_map import stain_color_map
def get_stain_vector(args, index):
"""Get the stain corresponding to args.stain_$index and
args.stain_$index_vector. If the former is not "custom", the
latter must be None.
"""
args = vars(args)
stain = args['stain_' + str(index)]
... | import numpy
from .stain_color_map import stain_color_map
def get_stain_vector(args, index):
"""Get the stain corresponding to args.stain_$index and
args.stain_$index_vector. If the former is not "custom", the
latter must be None.
"""
args = vars(args)
stain = args['stain_' + str(index)]
... | apache-2.0 | Python |
a54ceba3926c708104c2d2a8a07d97dbb0cc4043 | Add missing import in pexpect | Calysto/metakernel | metakernel/pexpect.py | metakernel/pexpect.py | # Convenience imports from pexpect
from __future__ import absolute_import
from pexpect import spawn, which, EOF, TIMEOUT
| # Convenience imports from pexpect
from __future__ import absolute_import
from pexpect import which, EOF, TIMEOUT
| bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.