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 |
|---|---|---|---|---|---|---|---|---|
457feeb07e3ab1f74b40153202e78590bfdd485f | Load in MARC XML files | mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation | falcom/test/test_marc.py | falcom/test/test_marc.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 hamcrest import *
import os
import unittest
import xml.etree.ElementTree as ET
from ..marc import *
from .hamcrest_marc import ComposedA... | # 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 hamcrest import *
import unittest
import xml.etree.ElementTree as ET
from ..marc import *
from .hamcrest_marc import ComposedAssertion, ... | bsd-3-clause | Python |
b4f1598ddf64eee114d0c24a9996c24a22d6179f | Add SQLite version check to pudl.load.sqlite | catalyst-cooperative/pudl,catalyst-cooperative/pudl | src/pudl/load/sqlite.py | src/pudl/load/sqlite.py | """Load PUDL data into an SQLite database."""
import logging
from sqlite3 import Connection as SQLite3Connection
from sqlite3 import sqlite_version
from typing import Dict
import pandas as pd
import sqlalchemy as sa
from packaging import version
from pudl.metadata.classes import Package, Resource
logger = logging.g... | """Load PUDL data into an SQLite database."""
import logging
from sqlite3 import Connection as SQLite3Connection
from typing import Dict
import pandas as pd
import sqlalchemy as sa
from pudl.metadata.classes import Package, Resource
logger = logging.getLogger(__name__)
def dfs_to_sqlite(
dfs: Dict[str, pd.Dat... | mit | Python |
2b08ce1d980ff01c2f0ac258aaba52f2ca758427 | Fix static file 404 error | lockhawksp/beethoven,lockhawksp/beethoven | beethoven/urls.py | beethoven/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from beethoven import settings
urlpatterns = patterns(
'',
url(r'^$', 'beethoven.views.index', name='index'),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('allauth.urls')),
url(r'^', include('cour... | from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(
'',
url(r'^$', 'beethoven.views.index', name='index'),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('allauth.urls')),
url(r'^', include('courses.urls', namespace='courses'))... | mit | Python |
3c20fc2cb92148719e94db3ef9813c1934419e38 | increase coverage, search by comission | proyectosdeley/proyectos_de_ley,proyectosdeley/proyectos_de_ley,proyectosdeley/proyectos_de_ley,proyectosdeley/proyectos_de_ley | proyectos_de_ley/search_advanced/tests/test_views.py | proyectos_de_ley/search_advanced/tests/test_views.py | import json
import os
from django.test import TestCase, Client
from pdl.models import Proyecto
from pdl.models import Seguimientos
class TestSearchAdvancedViews(TestCase):
def setUp(self):
self.maxDiff = None
this_folder = os.path.abspath(os.path.dirname(__file__))
dummy_db_json = os.pa... | from django.test import TestCase, Client
class TestSearchAdvancedViews(TestCase):
def setUp(self):
pass
def test_index(self):
c = Client()
response = c.get('/search-advanced/')
self.assertEqual(200, response.status_code)
def test_index_form_invalid(self):
c = Clie... | mit | Python |
cd9f87ae42408670db6cf08443cac3e5a965cf92 | remove unneeded unload | Redball45/Redball-Cogs | misc/misc.py | misc/misc.py | import discord
from discord.ext import commands
class misc:
"""Misc commands. Some of these commands are only meant to be used with specific discord servers."""
def __init__(self, bot):
self.bot = bot
def _role_from_string(self, server, rolename, roles=None):
if roles is None:
roles = server.roles
role... | import discord
from discord.ext import commands
class misc:
"""Misc commands. Some of these commands are only meant to be used with specific discord servers."""
def __init__(self, bot):
self.bot = bot
def __unload(self):
def _role_from_string(self, server, rolename, roles=None):
if roles is None:
roles ... | mit | Python |
0bdb46ea18ebfcc6598205b90833a65f49b13515 | Update version.py | SuLab/biothings.api,biothings/biothings.api,biothings/biothings.api | biothings/utils/version.py | biothings/utils/version.py | ''' Functions to return versions of things. '''
from subprocess import check_output
from io import StringIO
from context_lib import redirect_stdout
import pip
def get_python_version():
''' Get a list of python packages installed and their versions. '''
so = StringIO()
with redirect_stdout(so):
pip... | ''' Functions to return versions of things. '''
from subprocess import check_output
def get_python_version():
''' Get a list of python packages installed and their versions. '''
try:
return check_output("pip freeze", shell=True).decode('utf-8').strip('\n').split('\n')
except:
return []
def... | apache-2.0 | Python |
ea86ac4f7885e693cf758aeae56062cbe0ba573f | Add more arguments to mpathconf (#1154347) | rvykydal/blivet,dwlehman/blivet,dwlehman/blivet,jkonecny12/blivet,vojtechtrefny/blivet,AdamWill/blivet,rhinstaller/blivet,rhinstaller/blivet,vojtechtrefny/blivet,vpodzime/blivet,AdamWill/blivet,rvykydal/blivet,vpodzime/blivet,jkonecny12/blivet | blivet/devicelibs/mpath.py | blivet/devicelibs/mpath.py |
from .. import util
import logging
log = logging.getLogger("blivet")
def flush_mpaths():
util.run_program(["multipath", "-F"])
check_output = util.capture_output(["multipath", "-ll"]).strip()
if check_output:
log.error("multipath: some devices could not be flushed")
def is_multipath_member(path)... |
from .. import util
import logging
log = logging.getLogger("blivet")
def flush_mpaths():
util.run_program(["multipath", "-F"])
check_output = util.capture_output(["multipath", "-ll"]).strip()
if check_output:
log.error("multipath: some devices could not be flushed")
def is_multipath_member(path)... | lgpl-2.1 | Python |
f54674f247af564f9e32b36762680b5006125519 | Add missing docstrings | Fantomas42/django-livereload,kbussell/django-livereload | livereload/management/commands/runserver.py | livereload/management/commands/runserver.py | """Runserver command with livereload"""
import urllib
from optparse import make_option
from django.conf import settings
if 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
from django.contrib.staticfiles.management.commands.runserver import \
Command as RunserverCommand
else:
from django.core.... | """Runserver command with livereload"""
import urllib
from optparse import make_option
from django.conf import settings
if 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
from django.contrib.staticfiles.management.commands.runserver import \
Command as RunserverCommand
else:
from django.core.... | bsd-3-clause | Python |
06bb339619915f7397d9ad23d728d797cb81845d | bump to version 0.9.13b3 | PaloAltoNetworks/minemeld-core,PaloAltoNetworks/minemeld-core,PaloAltoNetworks/minemeld-core | minemeld/__init__.py | minemeld/__init__.py | """
minemeld
========
MineMeld core engine
"""
__version__ = '0.9.13b3'
| """
minemeld
========
MineMeld core engine
"""
__version__ = '0.9.13b2'
| apache-2.0 | Python |
594c1704055db7d747589a330eae6251c20ca031 | Fix a pointless assertion in the unittests | sulami/nozdormu | nozdormu/tests/tests.py | nozdormu/tests/tests.py | #!/usr/bin/env python3
# coding: utf-8
import sys
import unittest
import nozdormu.main
from nozdormu.batch import BenchBatch
from nozdormu.loader import BenchLoader
from nozdormu.suite import BenchSuite
from nozdormu.runner import BenchRunner
class BatchMock(BenchBatch):
"""Serve as a mock to load a batch from a... | #!/usr/bin/env python3
# coding: utf-8
import sys
import unittest
import nozdormu.main
from nozdormu.batch import BenchBatch
from nozdormu.loader import BenchLoader
from nozdormu.suite import BenchSuite
from nozdormu.runner import BenchRunner
class BatchMock(BenchBatch):
"""Serve as a mock to load a batch from a... | mit | Python |
a92bb034758426af726304e2751600794acd25d9 | Tweak fabfile. | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | fabdefs.py | fabdefs.py | from fabric.api import *
"""
Define the server environments that this app will be deployed to.
Ensure that you have SSH access to the servers for the scripts in 'fabfile.py' to work.
"""
def production():
"""
Env parameters for the production environment.
"""
env.host_string = 'ubuntu@pmg.org.za'
... | from fabric.api import *
"""
Define the server environments that this app will be deployed to.
Ensure that you have SSH access to the servers for the scripts in 'fabfile.py' to work.
"""
def production():
"""
Env parameters for the production environment.
"""
env.host_string = 'ubuntu@new.pmg.org.za... | apache-2.0 | Python |
ae743bfd9d0767f7719c3eb8d7491dda5acd5022 | Bump the version to 0.6.0 | winhamwr/mixpanel-celery,winhamwr/mixpanel-celery,agriffis/mixpanel-celery,agriffis/mixpanel-celery | mixpanel/__init__.py | mixpanel/__init__.py | """Asynchronous event tracking for Mixpanel"""
VERSION = (0, 6, 0, '')
__version__ = ".".join(map(str, VERSION[:-1]))
__release__ = ".".join(map(str, VERSION))
__author__ = "Wes Winham"
__contact__ = "winhamwr@gmail.com"
__homepage__ = "http://winhamwr.github.io/mixpanel-celery/"
__docformat__ = "restructuredtext"
| """Asynchronous event tracking for Mixpanel"""
VERSION = (0, 5, 0, '')
__version__ = ".".join(map(str, VERSION[:-1]))
__release__ = ".".join(map(str, VERSION))
__author__ = "Wes Winham"
__contact__ = "wes@policystat.com"
__homepage__ = "http://github.com/winhamwr/mixpanel-celery/"
__docformat__ = "restructuredtext" | bsd-3-clause | Python |
e7d61cd5b8174829d686fbf2fa0af885a87d08bf | Fix npm fabfile | UrLab/DocHub,UrLab/DocHub,UrLab/beta402,UrLab/DocHub,UrLab/DocHub,UrLab/beta402,UrLab/beta402 | fabfile.py | fabfile.py | from __future__ import with_statement
from fabric.api import run, cd
from fabric.context_managers import prefix
BASE_DIR = "/srv/dochub/source"
ACTIVATE = 'source ../ve/bin/activate'
def deploy():
with cd(BASE_DIR), prefix(ACTIVATE):
run('sudo systemctl stop dochub-gunicorn.socket')
run('sudo sys... | from __future__ import with_statement
from fabric.api import run, cd
from fabric.context_managers import prefix
BASE_DIR = "/srv/dochub/source"
ACTIVATE = 'source ../ve/bin/activate'
def deploy():
with cd(BASE_DIR), prefix(ACTIVATE):
run('sudo systemctl stop dochub-gunicorn.socket')
run('sudo sys... | agpl-3.0 | Python |
690d00e7b8f4021ff43e50a2b41ede50745ee4ae | Add missing installed app for testing | armstrong/armstrong.apps.content,armstrong/armstrong.apps.content | fabfile.py | fabfile.py | from armstrong.dev.tasks import *
settings = {
'DEBUG': True,
'INSTALLED_APPS': (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'armstrong.core.arm_access',
'armstrong.cor... | from armstrong.dev.tasks import *
settings = {
'DEBUG': True,
'INSTALLED_APPS': (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'armstrong.core.arm_access',
'armstrong.cor... | apache-2.0 | Python |
1bfd06e478e11e81a6839b84f8e4c61a322d7954 | Verify incoming messages | martindale/orisi,orisi/orisi,orisi/orisi,martindale/orisi | src/shared/fastproto.py | src/shared/fastproto.py | import json
import requests
import base64
import time
import datetime
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA256
FASTCAST_API_URL = 'http://54.77.58.8?format=json'
headers = {'content-type': 'application/json'}
def decode_data(data):
return base64.... | import json
import requests
import base64
import time
import datetime
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA256
FASTCAST_API_URL = 'http://54.77.58.8?format=json'
headers = {'content-type': 'application/json'}
def decode_data(data):
return base64.... | mit | Python |
6d0fa6dda7613e734ce958f88bc0eaf55cfddf3c | Add persistance class for ConfigSchema. | pixelrebel/st2,Plexxi/st2,emedvedev/st2,lakshmi-kannan/st2,StackStorm/st2,punalpatel/st2,Plexxi/st2,peak6/st2,StackStorm/st2,Plexxi/st2,pixelrebel/st2,StackStorm/st2,Plexxi/st2,punalpatel/st2,nzlosh/st2,emedvedev/st2,peak6/st2,emedvedev/st2,punalpatel/st2,peak6/st2,lakshmi-kannan/st2,tonybaloney/st2,nzlosh/st2,tonybalo... | st2common/st2common/persistence/pack.py | st2common/st2common/persistence/pack.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
faf3253417b3f394650b454a98a9ef26b075968d | Update count_ones.py | keon/algorithms,amaozhao/algorithms | bit/count_ones.py | bit/count_ones.py | """
Write a function that takes an unsigned integer and
returns the number of ’1' bits it has
(also known as the Hamming weight).
For example, the 32-bit integer ’11' has binary
representation 00000000000000000000000000001011,
so the function should return 3.
T(n)- O(k) : k is the number of 1s present in binary re... | """
Write a function that takes an unsigned integer and
returns the number of ’1' bits it has
(also known as the Hamming weight).
For example, the 32-bit integer ’11' has binary
representation 00000000000000000000000000001011,
so the function should return 3.
T(n)- O(log n)
Number of loops is
equal to the number of 1... | mit | Python |
2c2cf11247e672732146f4dea619faf26a5d7a5b | Call this `self` | prophile/jacquard,prophile/jacquard | jacquard/odm/base.py | jacquard/odm/base.py | from . import inflection
class ModelMeta(type):
@property
def storage_name(self):
return inflection.tableize(self.__name__)
class Model(object, metaclass=ModelMeta):
__slots__ = ('pk', '_fields', 'session')
def __init__(self, pk, **fields):
self.pk = pk
self._fields = {}
... | from . import inflection
class ModelMeta(type):
@property
def storage_name(cls):
return inflection.tableize(cls.__name__)
class Model(object, metaclass=ModelMeta):
__slots__ = ('pk', '_fields', 'session')
def __init__(self, pk, **fields):
self.pk = pk
self._fields = {}
... | mit | Python |
bf6f99bae8c8ae8638e96f311a4e05bd5381161e | Use new URL to find streams. | flijloku/livestreamer,sbstp/streamlink,jtsymon/livestreamer,fishscene/streamlink,back-to/streamlink,gtmanfred/livestreamer,wlerin/streamlink,melmorabity/streamlink,javiercantero/streamlink,programming086/livestreamer,Masaz-/livestreamer,Klaudit/livestreamer,chhe/livestreamer,Saturn/livestreamer,Masaz-/livestreamer,chri... | src/livestreamer/plugins/ongamenet.py | src/livestreamer/plugins/ongamenet.py | from livestreamer.compat import str, bytes
from livestreamer.plugins import Plugin, PluginError, NoStreamsError
from livestreamer.stream import RTMPStream
from livestreamer.utils import urlget
import re
class Ongamenet(Plugin):
PlayerURL = "http://dostream.lab.so/stream.php?from=ongamenet"
SWFURL = "http://ww... | from livestreamer.compat import str, bytes
from livestreamer.plugins import Plugin, PluginError, NoStreamsError
from livestreamer.stream import RTMPStream
from livestreamer.utils import urlget
import re
class Ongamenet(Plugin):
PlayerURL = "http://www.tooniland.com/ongame/ognLive.tl"
SWFURL = "http://www.onga... | bsd-2-clause | Python |
ade8514ed204c926e0f1458c83518f5de0014766 | increase default fabric timeout | Lao-liu/mist.io,johnnyWalnut/mist.io,kelonye/mist.io,afivos/mist.io,Lao-liu/mist.io,kelonye/mist.io,zBMNForks/mist.io,zBMNForks/mist.io,Lao-liu/mist.io,DimensionDataCBUSydney/mist.io,johnnyWalnut/mist.io,munkiat/mist.io,munkiat/mist.io,johnnyWalnut/mist.io,DimensionDataCBUSydney/mist.io,afivos/mist.io,munkiat/mist.io,z... | fabfile.py | fabfile.py | from fabric.api import env
env.command_timeout = 200
env.abort_on_prompts = True
env.no_keys = True
env.no_agent = True
env.warn_only = True
env.combine_stderr = True
env.keepalive = 15
| from fabric.api import env
env.command_timeout = 20
env.abort_on_prompts = True
env.no_keys = True
env.no_agent = True
env.warn_only = True
env.combine_stderr = True
env.keepalive = 15
| agpl-3.0 | Python |
3f6942ad382b05398da247d053b9b67d0fbb103a | Move username to a global variable. | MathieuTurcotte/ipupdate | fabfile.py | fabfile.py | # Copyright (c) 2012 Mathieu Turcotte
# Licensed under the MIT license.
from fabric.api import *
from fabric.utils import *
from fabric.colors import *
from fabric.contrib.files import exists
USER="ipupdate"
LOG_DIR="/var/log/ipupdate"
ETC_DIR="/usr/local/etc"
BIN_DIR="/usr/local/bin"
def chown(path):
sudo("chow... | # Copyright (c) 2012 Mathieu Turcotte
# Licensed under the MIT license.
from fabric.api import *
from fabric.utils import *
from fabric.colors import *
from fabric.contrib.files import exists
LOG_DIR="/var/log/ipupdate"
ETC_DIR="/usr/local/etc"
BIN_DIR="/usr/local/bin"
def add_user(username):
with settings(hide(... | mit | Python |
f7e218b72a09615259b4d77e9169f5237a4cae32 | Remove test-only code paths in MixerController | jmarsik/mopidy,vrs01/mopidy,SuperStarPL/mopidy,diandiankan/mopidy,SuperStarPL/mopidy,mokieyue/mopidy,pacificIT/mopidy,vrs01/mopidy,diandiankan/mopidy,jcass77/mopidy,tkem/mopidy,glogiotatidis/mopidy,dbrgn/mopidy,bencevans/mopidy,bencevans/mopidy,SuperStarPL/mopidy,kingosticks/mopidy,swak/mopidy,glogiotatidis/mopidy,Supe... | mopidy/core/mixer.py | mopidy/core/mixer.py | from __future__ import absolute_import, unicode_literals
import logging
logger = logging.getLogger(__name__)
class MixerController(object):
pykka_traversable = True
def __init__(self, mixer):
self._mixer = mixer
self._volume = None
self._mute = False
def get_volume(self):
... | from __future__ import absolute_import, unicode_literals
import logging
logger = logging.getLogger(__name__)
class MixerController(object):
pykka_traversable = True
def __init__(self, mixer):
self._mixer = mixer
self._volume = None
self._mute = False
def get_volume(self):
... | apache-2.0 | Python |
8b58f4c05c6cae65667f54e19c19e93219d511b5 | update to better reflect inconsistent reality | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | nagios/check_hrrr.py | nagios/check_hrrr.py | '''
Check to make sure we have HRRR model data flowing to the IEM archives
'''
import os
import sys
import stat
import datetime
def check():
''' Do the chec please '''
now = datetime.datetime.utcnow()
diff = None
for hr in range(8):
fn = now.strftime(("/mesonet/ARCHIVE/data/%Y/%m/%d/model/hrrr... | '''
Check to make sure we have HRRR model data flowing to the IEM archives
'''
import os
import sys
import stat
import datetime
def check():
''' Do the chec please '''
now = datetime.datetime.utcnow()
diff = None
for hr in range(4):
fn = now.strftime(("/mesonet/ARCHIVE/data/%Y/%m/%d/model/hrrr... | mit | Python |
6635491db878e7bb4005e0fd718a3fdb658ee8d8 | Remove unused field | Eficent/purchase-workflow,Eficent/purchase-workflow | subcontracted_service/models/company.py | subcontracted_service/models/company.py | # -*- coding: utf-8 -*-
# Author: Damien Crier
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api, fields
class ResCompany(models.Model):
_inherit = 'res.company'
subcontracting_service_proc_rule_id = fields.Many2one(
c... | # -*- coding: utf-8 -*-
# Author: Damien Crier
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api, fields
class ResCompany(models.Model):
_inherit = 'res.company'
subcontracting_service_proc_rule_id = fields.Many2one(
c... | agpl-3.0 | Python |
e2760895caf0aa425ec95619cda85a770c98d43a | prepare v.5.0 with breaking api changes | domschl/python-fhem | fhem/setup.py | fhem/setup.py | from setuptools import setup
setup(name='fhem',
version='0.5.0',
description='Python API for FHEM home automation server',
long_description='Uses socket or http(s) communication to set and get states from FHEM home automation server with optional SSL encryption and password support',
classifier... | from setuptools import setup
setup(name='fhem',
version='0.4.4',
description='Python API for FHEM home automation server',
long_description='Uses socket or http(s) communication to set and get states from FHEM home automation server with optional SSL encryption and password support',
classifier... | mit | Python |
5ade56245fe7224aafa29928b24d33c739199e03 | raise for seatgeek API errors | akurihara/impulse,akurihara/impulse | lib/seatgeek_gateway.py | lib/seatgeek_gateway.py | from collections import namedtuple
import datetime
from decimal import Decimal
import json
import requests
SEATGEEK_BASE_URL = 'https://api.seatgeek.com/2/'
SEATGEEK_DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
Event = namedtuple('Event', ['id', 'title', 'datetime_utc', 'lowest_price'])
def get_event_by_id(event_id):
... | from collections import namedtuple
import datetime
from decimal import Decimal
import json
import requests
SEATGEEK_BASE_URL = 'https://api.seatgeek.com/2/'
SEATGEEK_DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
Event = namedtuple('Event', ['id', 'title', 'datetime_utc', 'lowest_price'])
def get_event_by_id(event_id):
... | mit | Python |
95630ff1a3343ed8b0c2cdcba8e5feb599600e40 | Update traits.py | adrianchifor/pygenetics-string-evolver | libs/traits.py | libs/traits.py | from random import randint
import sys
class Trait(object):
value = None
def mutate(self):
raise Exception("Your trait must implement the `mutate` method.")
def copy(self):
instance = self.__class__()
instance.value = self.value
return instance
class IntegerTrait(Trai... | from random import randint
import sys
class Trait(object):
value = None
def mutate(self):
raise Exception("Your trait must implement the `mutate` method.")
def copy(self):
instance = self.__class__()
instance.value = self.value
return instance
class IntegerTrait(Tra... | apache-2.0 | Python |
08a0c5564c4b132c56f5b51027139b19e7577c98 | bump version to 1.2-BETA2 | catap/namebench,jimmsta/namebench-1 | libnamebench/version.py | libnamebench/version.py | VERSION = '1.2-BETA2'
| VERSION = '1.2-BETA1'
| apache-2.0 | Python |
a29393e43a9422c30ff529fd56934bca4c73876a | test geocoder read csv | OpenTransitTools/services | ott/services/tests/tests_geocoder.py | ott/services/tests/tests_geocoder.py | import unittest
import json
from ott.utils.parse import csv_reader
from .tests import call_url, get_url
class TestGeoCoder(unittest.TestCase):
def setUp(self):
here = csv_reader.Csv.get_dirname(__file__)
c = csv_reader.Csv('geocodes.csv', here)
self.test_data = c.open()
c.close()
... | import unittest
from pyramid import testing
import urllib
import contextlib
import json
from .tests import call_url, get_url
class TestGeoCoder(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_zoo(self):
url = get_url('geostr', 'place=zoo')
j =... | mpl-2.0 | Python |
20542c0ebb6d9d3bfe68a0f4adff1bd384c72c3a | Update graph-valid-tree.py | tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,githubutilities/LeetCode,githubutilities/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo... | Python/graph-valid-tree.py | Python/graph-valid-tree.py | # Time: O(|V| + |E|)
# Space: O(|V|)
class Solution:
# @param {integer} n
# @param {integer[][]} edges
# @return {boolean}
def validTree(self, n, edges):
if len(edges) != n - 1:
return False
parent, neighbors = 0, 1
nodes = {}
for i in xrange(n):
... | # Time: O(|V| + |E|)
# Space: O(|V|)
class Solution:
# @param {integer} n
# @param {integer[][]} edges
# @return {boolean}
def validTree(self, n, edges):
if len(edges) != n - 1:
return False
nodes = {}
for i in xrange(n):
nodes[i] = [-1, []]
for... | mit | Python |
5e7513928a742f46ff905f2b665522dcdf773087 | Update integer-to-roman.py | tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/Lee... | Python/integer-to-roman.py | Python/integer-to-roman.py | # Time: O(n)
# Space: O(1)
#
# Given an integer, convert it to a roman numeral.
#
# Input is guaranteed to be within the range from 1 to 3999.
#
class Solution(object):
def intToRoman(self, num):
"""
:type num: int
:rtype: str
"""
numeral_map = {1: "I", 4: "IV", 5: "V", 9:... | # Time: O(n)
# Space: O(1)
#
# Given an integer, convert it to a roman numeral.
#
# Input is guaranteed to be within the range from 1 to 3999.
#
class Solution:
# @return a string
def intToRoman(self, num):
numeral_map = {1: "I", 4: "IV", 5: "V", 9: "IX", 10: "X", 40: "XL", 50: "L", 90: "XC", 100: "... | mit | Python |
ed0a438e21bd969321e58c28182926f44b4cdb90 | Remove check for git metadata directory | RepoReapers/reaper,RepoReapers/reaper,RepoReapers/reaper,RepoReapers/reaper | score_repo.py | score_repo.py | #!/usr/bin/env python3
import argparse
import importlib
import json
import mysql.connector
import os
import sys
def load_attribute_plugins(attributes):
for attribute in attributes:
if attribute['enabled']:
try:
attribute['implementation'] = importlib.import_module("attributes.{... | #!/usr/bin/env python3
import argparse
import importlib
import json
import mysql.connector
import os
import sys
def load_attribute_plugins(attributes):
for attribute in attributes:
if attribute['enabled']:
try:
attribute['implementation'] = importlib.import_module("attributes.{... | apache-2.0 | Python |
47f73929db01e222ac9d78ea742a9ba4017f06fc | Make string first | moustacheminer/MSS-Discord,moustacheminer/MSS-Discord,moustacheminer/MSS-Discord | music/bot.py | music/bot.py | print('Welcome to Moustacheminer Server Services Music Bot')
import json
import traceback
import discord
from os import path
from discord.ext import commands
from discord.ext.commands import errors as commands_errors
with open(path.abspath(path.join(path.dirname(__file__), '..', 'config', 'default.json'))) as f:
... | print('Welcome to Moustacheminer Server Services Music Bot')
import json
import traceback
import discord
from os import path
from discord.ext import commands
from discord.ext.commands import errors as commands_errors
with open(path.abspath(path.join(path.dirname(__file__), '..', 'config', 'default.json'))) as f:
... | mit | Python |
e95574acd4313ce3459e196d98b10bb3e02c9d52 | Remove directory lookup | Enteee/EtherFlows,Enteee/EtherFlows,Enteee/EtherFlows,Enteee/EtherFlows | flowworker/flowworker.py | flowworker/flowworker.py | #! /usr/bin/env python2
# vim: set fenc=utf8 ts=4 sw=4 et :
#
import sys
import os
import shutil
import time
import signal
import struct
from threading import Thread
from Queue import Queue, Empty
from scapy.all import *
#MAC Addr of the flow generator
FLOWGEN_MAC = "b4:be:b1:6b:00:b5"
#Timeout const in seconds
FLOW... | #! /usr/bin/env python2
# vim: set fenc=utf8 ts=4 sw=4 et :
#
import sys
import os
import shutil
import time
import signal
import struct
from threading import Thread
from Queue import Queue, Empty
from scapy.all import *
#MAC Addr of the flow generator
FLOWGEN_MAC = "b4:be:b1:6b:00:b5"
#Timeout const in seconds
FLOW... | apache-2.0 | Python |
1cffba7a4f935e6fd835222f82bf3c8af7c1ad96 | Make datetime in the module timezone aware for django 1.5 | kmike/django-admin-user-stats | admin_user_stats/modules.py | admin_user_stats/modules.py | # -*- coding: utf-8 -*-
from datetime import timedelta
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
try:
from django.utils.timezone import now
except ImportError:
from datetime import datetime
now = datetime.now
from qsstats import QuerySetStats
from a... | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from qsstats import QuerySetStats
from admin_tools.dashboard import modules
class RegistrationChart(modules.DashboardModule):
"""
Dashboard modu... | mit | Python |
f24440ec7df21d6222b90e240d4175d1c1df9dde | Bump version to 3.4.5 | luoliyan/incremental-reading-for-anki,luoliyan/incremental-reading-for-anki | ir/__init__.py | ir/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ir.main
import ir.view
__version__ = '3.4.5'
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ir.main
import ir.view
__version__ = '3.4.3'
| isc | Python |
3e766448bfff4c96e8ca893a25d7d16a557b6557 | Add complete set of fields to fma.Artist | FreeMusicNinja/api.freemusic.ninja | fma/models.py | fma/models.py | from django.db import models
import jsonfield
from model_utils.models import TimeStampedModel
class Artist(TimeStampedModel):
id = models.IntegerField(primary_key=True)
handle = models.CharField(max_length=250, null=True)
url = models.URLField(max_length=2000)
name = models.CharField(max_length=250)
... | from django.db import models
from model_utils.models import TimeStampedModel
class Artist(TimeStampedModel):
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=250)
url = models.URLField(max_length=2000)
website = models.URLField(null=True)
class Meta:
ordering ... | bsd-3-clause | Python |
821f94846f9126c2e56ff175ac8781968476c71f | Remove socialauth traces | agiliq/Dinette,agiliq/Dinette,agiliq/Dinette | forum/urls.py | forum/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^forum/', include('dinette.urls')),
(r'^admin/', include(admin.site.urls)),
)
if settings.DEBUG or getattr(settings, 'SERVE_MEDIA', False):
urlpatt... | from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
(r'^forum/', include('dinette.urls')),
(r'^accounts/', include('socialauth.urls')),
(r'^admin/', include(admin.site.urls)),
)
if settin... | bsd-3-clause | Python |
c64f295ba5424935f894350b3905136bab6a7687 | Update ipc_lista1.15.py | any1m1c/ipc20161 | lista1/ipc_lista1.15.py | lista1/ipc_lista1.15.py | #ipc_lista1.15
#Professor: Jucimar Junior
#Any Mendes Carvalho -
| #ipc_lista1.15
#Professor: Jucimar Junior
| apache-2.0 | Python |
4e995e0e926695c1d479213c3fb52d7e55ae4f44 | Update ipc_lista1.17.py | any1m1c/ipc20161 | lista1/ipc_lista1.17.py | lista1/ipc_lista1.17.py | #ipc_lista1.17
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
import math
#Calculo para verificar quantas latas/galoes de tintas sera necessarias e o valor delas
metros = input("Entre como o tamnho em metros quadrdados da are a ser pintada: ")
MetrosLtas = metros/6
if (MetrosLatas <= 0):
Me... | #ipc_lista1.17
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
import math
#Calculo para verificar quantas latas/galoes de tintas sera necessarias e o valor delas
metros = input("Entre como o tamnho em metros quadrdados da are a ser pintada: ")
MetrosLtas = metros/6
if (MetrosLatas <= 0):
Me... | apache-2.0 | Python |
39f6c120b32d5bb84558c0bfcbb38c8daa98a76a | add docstrings | nullpixel/litecord,nullpixel/litecord | litecord/api/gateway.py | litecord/api/gateway.py | import logging
import random
from aiohttp import web
from ..utils import _err, _json
from ..decorators import auth_route
log = logging.getLogger(__name__)
class GatewayEndpoint:
"""Gateway-related endpoints."""
def __init__(self, server):
self.server = server
self.guild_man = server.guild_ma... | import logging
import random
from aiohttp import web
from ..utils import _err, _json
from ..decorators import auth_route
log = logging.getLogger(__name__)
class GatewayEndpoint:
"""Gateway-related endpoints."""
def __init__(self, server):
self.server = server
self.guild_man = server.guild_ma... | mit | Python |
2642700bc9fcd57c8021acd0230fef2562cd7511 | add blic files | crtarsorg/istinomer-factcheckr,crtarsorg/istinomer-factcheckr,crtarsorg/istinomer-factcheckr,crtarsorg/istinomer-factcheckr | api/app/mod_api/views.py | api/app/mod_api/views.py | from flask import Blueprint, Response, request
from app import mongo_utils
import tldextract
from bson import json_util
from datetime import datetime
mod_api = Blueprint('api', __name__, url_prefix='/api')
@mod_api.route('/entry/submit', methods=['POST'])
def submit_entry():
req = request.json
extracted = t... | from flask import Blueprint, Response, request
from app import mongo_utils
import tldextract
from bson import json_util
from datetime import datetime
mod_api = Blueprint('api', __name__, url_prefix='/api')
@mod_api.route('/entry/submit', methods=['POST'])
def submit_entry():
req = request.json
extracted = t... | cc0-1.0 | Python |
1ea1f4802a1b6cb3fd5e0bb48b392530dae2000e | Increment version. (#643) | magenta/magenta,jesseengel/magenta,jesseengel/magenta,magenta/magenta,adarob/magenta,adarob/magenta | magenta/version.py | magenta/version.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 | Python |
07122a6eb7f50b8c3b82dfeee76172ac74bd105d | Include some docstrings | randomic/aniauth-tdd,randomic/aniauth-tdd | logintokens/backends.py | logintokens/backends.py | from django.contrib.auth import get_user_model
from logintokens.tokens import default_token_generator
USER = get_user_model()
class EmailOnlyAuthenticationBackend:
"""Authenticates by consuming a provided login token.
"""
token_generator = default_token_generator
def authenticate(self, request, t... | from django.contrib.auth import get_user_model
from logintokens.tokens import default_token_generator
USER = get_user_model()
class EmailOnlyAuthenticationBackend:
token_generator = default_token_generator
def authenticate(self, request, token=None, max_age=600):
result = self.token_generator.con... | mit | Python |
421f0829b7751b8a251f6bb2cbbf37dc3e40154d | add 'force' argument for branch deletion (defaults to True) | Infinidat/gitpy | git/branch.py | git/branch.py | # Copyright (c) 2009, Rotem Yaari <vmalloc@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this li... | # Copyright (c) 2009, Rotem Yaari <vmalloc@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this li... | bsd-3-clause | Python |
47d4c270a5ad715361aac9ca15d394bcadeac635 | Bump app version number. | kernelci/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend,joyxu/kernelci-backend | app/handlers/__init__.py | app/handlers/__init__.py | __version__ = "2015.1.5"
__versionfull__ = __version__
| __version__ = "2015.1.4"
__versionfull__ = __version__
| lgpl-2.1 | Python |
bb0abd4dbcd432f097aabcfe68c183b0a3415540 | Bump app version to 2019.10.2 | kernelci/kernelci-backend,kernelci/kernelci-backend | app/handlers/__init__.py | app/handlers/__init__.py | __version__ = "2019.10.2"
__versionfull__ = __version__
| __version__ = "2019.10.1"
__versionfull__ = __version__
| lgpl-2.1 | Python |
d37090cfa92d61d82b6780bb870d559e090a8545 | Fix output | kurgm/gwv | gwv/gwv.py | gwv/gwv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import os
import sys
from gwv.validator import validate
from gwv import version
def open_dump(filename):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
from gwv.validator import validate
from gwv import version
def open_dump(filename):
dump = {}
... | mit | Python |
19ce3d9c3ba36a18d67b0e873f6da3af77b1f189 | fix dependencies in sfepy/terms/extmods/setup.py | BubuLK/sfepy,lokik/sfepy,rc/sfepy,lokik/sfepy,RexFuzzle/sfepy,sfepy/sfepy,BubuLK/sfepy,sfepy/sfepy,lokik/sfepy,RexFuzzle/sfepy,vlukes/sfepy,RexFuzzle/sfepy,rc/sfepy,BubuLK/sfepy,rc/sfepy,vlukes/sfepy,vlukes/sfepy,sfepy/sfepy,RexFuzzle/sfepy,lokik/sfepy | sfepy/terms/extmods/setup.py | sfepy/terms/extmods/setup.py | #!/usr/bin/env python
def configuration(parent_package='', top_path=None):
import os.path as op
import glob
from numpy.distutils.misc_util import Configuration
from sfepy import Config
site_config = Config()
os_flag = {'posix' : 0, 'windows' : 1}
auto_dir = op.dirname(__file__)
auto_... | #!/usr/bin/env python
def configuration(parent_package='', top_path=None):
import os.path as op
import glob
from numpy.distutils.misc_util import Configuration
from sfepy import Config
site_config = Config()
os_flag = {'posix' : 0, 'windows' : 1}
auto_dir = op.dirname(__file__)
auto_... | bsd-3-clause | Python |
ce9acd3a53de50c0976b7a8b2f46b67ca86f56e0 | fix broken add_domain() and add_result() during initialization | jeffkinnison/shadho,jeffkinnison/shadho | shadho/backend/json/model.py | shadho/backend/json/model.py | from shadho.backend.base.model import BaseModel
from shadho.backend.json.domain import Domain
from shadho.backend.json.result import Result
from shadho.backend.utils import InvalidObjectError
import uuid
class Model(BaseModel):
def __init__(self, id=None, priority=None, complexity=None, rank=None,
... | from shadho.backend.base.model import BaseModel
from shadho.backend.json.domain import Domain
from shadho.backend.json.result import Result
import uuid
class Model(BaseModel):
def __init__(self, id=None, priority=None, complexity=None, rank=None,
domains=None, results=None):
self.id = id... | mit | Python |
6f7b7d202199dc1534a77a247da1ad4604c21baa | Build Cython components when loading hub (#1386) | pytorch/fairseq,pytorch/fairseq,pytorch/fairseq | hubconf.py | hubconf.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import functools
from fairseq.hub_utils import BPEHubInterface as bpe # noqa
from fairseq.hub_utils import TokenizerHubInterface as tokenize... | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import functools
from fairseq.hub_utils import BPEHubInterface as bpe # noqa
from fairseq.hub_utils import TokenizerHubInterface as tokenize... | mit | Python |
20d441ba608e902d13f2c75131a9f22d7dbb214f | add phase for request with feedback | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | apps/kiezkasse/phases.py | apps/kiezkasse/phases.py | from django.utils.translation import ugettext_lazy as _
from adhocracy4 import phases
from . import apps
from . import models
from . import views
class RequestPhase(phases.PhaseContent):
app = apps.Config.label
phase = 'submit'
weight = 20
view = views.ProposalListView
name = _('Request phase')... | from django.utils.translation import ugettext_lazy as _
from adhocracy4 import phases
from . import apps
from . import models
from . import views
class RequestPhase(phases.PhaseContent):
app = apps.Config.label
phase = 'submit'
weight = 20
view = views.ProposalListView
name = _('Request phase')... | agpl-3.0 | Python |
d131f296e4a8acf78bae8ebab5ded182aeaf2479 | comment out test_orders temporarily | django-rea/nrp,django-rea/nrp,django-rea/nrp,FreedomCoop/valuenetwork,valnet/valuenetwork,FreedomCoop/valuenetwork,FreedomCoop/valuenetwork,valnet/valuenetwork,FreedomCoop/valuenetwork,django-rea/nrp,valnet/valuenetwork,valnet/valuenetwork | valuenetwork/valueaccounting/tests/__init__.py | valuenetwork/valueaccounting/tests/__init__.py | from valuenetwork.valueaccounting.tests.test_facets import *
from valuenetwork.valueaccounting.tests.test_explosions import *
#todo: temporarily disabled
#from valuenetwork.valueaccounting.tests.test_plan_rand import *
#from valuenetwork.valueaccounting.tests.test_orders import *
from valuenetwork.valueaccounting.tests... | from valuenetwork.valueaccounting.tests.test_facets import *
from valuenetwork.valueaccounting.tests.test_explosions import *
#todo: temporarily disabled
#from valuenetwork.valueaccounting.tests.test_plan_rand import *
from valuenetwork.valueaccounting.tests.test_orders import *
from valuenetwork.valueaccounting.tests.... | agpl-3.0 | Python |
e018d1e3c79e28f14c0304dee11eff43b96c2eae | add precip converter | jaidevd/jarvis | jarvis/converters.py | jarvis/converters.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""
"""
def wnv_snowfall_converter(x):
return [0.001 if _x == 'T' else _x for _x in x]
def wnv_precip_converter(x):
return [0.0001 if _x == 'T' else _... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""
"""
def wnv_snowfall_converter(x):
return [0.001 if _x == 'T' else _x for _x in x]
| bsd-3-clause | Python |
e01c2049f9b8c9b576c889433db14d1b6ae7f796 | Add debug argument to main Pacman __init__ | durden/frappy | frappy/services/pacman.py | frappy/services/pacman.py | """
Wrapper for fictional test service
"""
from frappy.core.api import APICall, DefaultVersion
class Pacman(APICall):
"""
"""
def __init__(self, req_format="json", domain="127.0.0.1:8000",
secure=False, auth=None, api_version=DefaultVersion,
debug=False):
APICal... | """
Wrapper for fictional test service
"""
from frappy.core.api import APICall, DefaultVersion
class Pacman(APICall):
"""
"""
def __init__(self, req_format="json", domain="127.0.0.1:8000",
secure=False, auth=None, api_version=DefaultVersion):
APICall.__init__(self, auth=auth, re... | mit | Python |
ae03591674f4300386331f42d5513f345074703e | Bump version | pombredanne/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,pombredanne/django-bulbs,theonion/django-bulbs | bulbs/__init__.py | bulbs/__init__.py | __version__ = "0.6.23"
| __version__ = "0.6.22"
| mit | Python |
6ecf707b9f2158c5c06edad9ef74e90121062c86 | Update example to use the new (non-functional) API | tensorprob/tensorprob,ibab/tensorprob,ibab/tensorfit | example.py | example.py | import tensorprob as tp
x_data = [1, 2, 3]
with tp.Model() as m:
mu = m.Scalar('mu')
f_normal = m.Scalar('f_normal', lower=0, upper=1)
sigma1 = m.Scalar('sigma1', lower=0)
sigma2 = m.Scalar('sigma2', lower=0)
lamb = m.Scalar('lambda')
f = m.Scalar('f', lower=0, upper=1)
X1 = m.Normal2(mu,... | import tensorprob as tp
with tp.Model() as m:
mu = m.Scalar('mu')
f_normal = m.Scalar('f_normal', lower=0, upper=1)
sigma1 = m.Scalar('sigma1', lower=0)
sigma2 = m.Scalar('sigma2', lower=0)
lamb = m.Scalar('lambda')
f = m.Scalar('f', lower=0, upper=1)
X1 = m.Normal2(mu, f_normal, sigma1, ... | mit | Python |
a149fa52d94b6e028efadecd6094fa896005ad9e | Add configuration file | apache/cloudstack-gcestack | gcecloudstack/__init__.py | gcecloudstack/__init__.py | #!/usr/bin/env python
# encoding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Vers... | #!/usr/bin/env python
# encoding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Vers... | apache-2.0 | Python |
5d7f352ea4d4df638411dc6c64747b406b3b9a08 | Make pagination work better | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | apps/splash/api/views.py | apps/splash/api/views.py | from rest_framework.pagination import PageNumberPagination
from rest_framework.viewsets import ReadOnlyModelViewSet
from apps.splash.api.serializers import SplashEventSerializer
from apps.splash.filters import SplashEventFilter
from apps.splash.models import SplashEvent
class ThirtyItemsPaginator(PageNumberPaginatio... | from rest_framework.viewsets import ReadOnlyModelViewSet
from apps.splash.api.serializers import SplashEventSerializer
from apps.splash.filters import SplashEventFilter
from apps.splash.models import SplashEvent
class SplashEventViewSet(ReadOnlyModelViewSet):
queryset = SplashEvent.objects.all()
serializer_c... | mit | Python |
5f89f76fec415452e6b8734f6d5f6a84c9407ddd | edit split.py | hansroh/aquests,hansroh/aquests | aquests/lib/dnn/split.py | aquests/lib/dnn/split.py | import numpy as np
from sklearn.model_selection import train_test_split
import random
def split (total_xs, total_ys, test_size = 500):
train_xs, test_xs, train_ys, test_ys = train_test_split(total_xs, total_ys, test_size = test_size, random_state = random.randrange (100))
return train_xs, test_xs, train_ys, te... | import numpy as np
from sklearn.model_selection import train_test_split
import random
def split (total_xs, total_ys, test_size = 500):
train_xs, test_xs, train_ys, test_ys = train_test_split(total_xs, total_ys, test_size = test_size, random_state = random.randrange (100))
return train_xs, test_xs, train_ys, te... | mit | Python |
76c0da3292a6b1c2321bf9ebbf6b74adbfac8d23 | Update primes.py | aelk/loga | math/primes.py | math/primes.py | def listPrimes(n):
'''Returns a list of primes below n.'''
numbers = set(range(n, 1, -1))
primes = []
while numbers:
p = numbers.pop()
primes.append(p)
# Remove each multiple of p from numbers:
numbers.difference_update(set(range(p * 2, n + 1, p)))
return primes
| def genPrimes(n):
'''Returns a list of primes below n.'''
numbers = set(range(n, 1, -1))
primes = []
while numbers:
p = numbers.pop()
primes.append(p)
# Remove each multiple of p from numbers:
numbers.difference_update(set(range(p * 2, n + 1, p)))
return primes
| mit | Python |
a8a648980ab99b424b68d11d362a5c50931b4302 | Update _parse_desc function to return values of type 'int' | ssut/py-nyaa | nyaa/nyaa.py | nyaa/nyaa.py | # -*- coding: utf-8 -*-
import requests
import xmltodict
from datetime import datetime
from .constants import URL_NYAA, FORMAT_DATETIME, RE_DESC
from .constants import SortBy
from .constants import NyaaResult
_agent = requests.Session()
def search(keyword='', offset=1, order='-date'):
sort = order.replace('-', ''... | # -*- coding: utf-8 -*-
import requests
import xmltodict
from datetime import datetime
from .constants import URL_NYAA, FORMAT_DATETIME, RE_DESC
from .constants import SortBy
from .constants import NyaaResult
_agent = requests.Session()
def search(keyword='', offset=1, order='-date'):
sort = order.replace('-', ''... | mit | Python |
c2a07e3e53651f8679aacc23ad665822115c5928 | Update for working rfid reader. Test code | harlanhaskins/DrinkTouchClient-2.0,stevenmirabito/DrinkTouchClient-2.0 | ibutton.py | ibutton.py | import serial
class iButton(object):
def __init__(self, ibutton_address, rfid_address, debug=False):
# self.ibutton_serial = serial.Serial(ibutton_address)
self.rfid_serial = serial.Serial(rfid_address)
self.debug = debug
def read(self):
if self.debug:
with open("i... | import serial
class iButton(object):
def __init__(self, ibutton_address, rfid_address, debug=False):
# self.ibutton_serial = serial.Serial(ibutton_address)
self.rfid_serial = serial.Serial(rfid_address)
self.debug = debug
def read(self):
if self.debug:
with open("i... | mit | Python |
47273357ac7bd646e8a9326c87688191eb8a1a89 | Revert python mybot to random bot | yangle/HaliteIO,yangle/HaliteIO,HaliteChallenge/Halite,HaliteChallenge/Halite-II,yangle/HaliteIO,lanyudhy/Halite-II,HaliteChallenge/Halite,HaliteChallenge/Halite-II,HaliteChallenge/Halite,HaliteChallenge/Halite-II,yangle/HaliteIO,HaliteChallenge/Halite,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge... | airesources/Python/MyBot.py | airesources/Python/MyBot.py | from hlt import *
from networking import *
playerTag, gameMap = getInit()
sendInit("PythonBot"+str(playerTag))
while True:
moves = []
gameMap = getFrame()
for y in range(0, len(gameMap.contents)):
for x in range(0, len(gameMap.contents[y])):
site = gameMap.contents[y][x]
if site.owner == playerTag:
mo... | from hlt import *
from networking import *
playerTag, gameMap = getInit()
sendInit("BasicBot"+str(playerTag))
while True:
moves = []
gameMap = getFrame()
for y in range(0, len(gameMap.contents)):
for x in range(0, len(gameMap.contents[y])):
site = gameMap.contents[y][x]
if site.owner == playerTag:
dir... | mit | Python |
d965f66d219bffd01ad44fd3e982c30293df68aa | Bump version to 0.3.1. | czpython/aldryn-newsblog,czpython/aldryn-newsblog,czpython/aldryn-newsblog,czpython/aldryn-newsblog | aldryn_newsblog/__init__.py | aldryn_newsblog/__init__.py | __version__ = '0.3.1'
| __version__ = '0.3.0'
| bsd-3-clause | Python |
7f8599e46737be5958203ef70baa47257ebf6cab | Fix typo! | Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend | alignak_backend/__init__.py | alignak_backend/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alignak REST backend
"""
VERSION = (0, 1, 4)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
__copyright__ = "(c) 2015 - Alignak team"
__license__ = "License GNU AGPL version 3"
__releasenotes__ = """
Alignak Backend
"""
__doc_url__ = "https://git... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alignak REST backend
"""
VERSION = (0, 1 ,4)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
__copyright__ = "(c) 2015 - Alignak team"
__license__ = "License GNU AGPL version 3"
__releasenotes__ = """
Alignak Backend
"""
__doc_url__ = "https://git... | agpl-3.0 | Python |
afa45d8a3bbf2145f7d79623a42fcdf711828af6 | Fix start time of audio files | XENON1T/pax,XENON1T/pax | pax/plugins/io/Music.py | pax/plugins/io/Music.py | from scipy.io.wavfile import write
import numpy as np
import math
from pax import plugin
class WavOutput(plugin.OutputPlugin):
"""Convert sum waveforms of event and dataset to WAV file
If we don't find dark matter, at least we'll have contemporary music.
"""
def startup(self):
self.filename... | from scipy.io.wavfile import write
import numpy as np
import math
from pax import plugin
class WavOutput(plugin.OutputPlugin):
"""Convert sum waveforms of event and dataset to WAV file
If we don't find dark matter, at least we'll have contemporary music.
"""
def startup(self):
self.filename... | bsd-3-clause | Python |
ba290ce9a12c21bcd575836c49f7e065467add18 | Change findbugs modifications from presubmit error->warning | hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,anirudhSK/chromium,mohamed--abdel-maksoud/chromium.src,PeterWangIntel/chromium-crosswalk,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,TheTypoMaster/chromium-crosswalk,Chilledheart/chromium,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,Jonekee... | build/android/PRESUBMIT.py | build/android/PRESUBMIT.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for android buildbot.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API b... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for android buildbot.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API b... | bsd-3-clause | Python |
35eceaf748ca415a58f7230fcb4d6a2aa9379f05 | Add a special PLACEHOLDER value | cecedille1/PDF_generator | pdf_generator/medias.py | pdf_generator/medias.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Medias locator
==============
Medias locator returns a path on the file system from the *src* of an img tag.
.. data:: PLACEHOLDER
A special object that indicates to the renderer to use a placeholder
instead of a media.
"""
from __future__ import absolute_i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Medias locator
==============
"""
from __future__ import absolute_import
import os.path
class PathMediasLocator(object):
"""
Returns medias relatively to the root directory *base*.
"""
def __init__(self, base):
self.base = base
def __ca... | mit | Python |
15a0767f3ae74b7ef4536d86f057477b5859bc42 | Fix typo | maxgoedjen/canis | canis/siriusxm.py | canis/siriusxm.py | import requests
class Channel(object):
def __init__(self, name, identifier):
self.name = name
self.identifier = identifier
class Song(object):
def __init__(self, title, artist):
self.title = title
self.artist = artist
def get_channel_list():
r = requests.get('https://www.siriusxm.com/channellineup/')
p... | class Channel(object):
def __init__(self, name, identifier):
self.name = name
self.identifier = identifier
class Song(object):
def __init__(self, title, artist);
self.title = title
self.artist = artist
def get_channel_list():
pass
def get_currently_playing(channel_identifier):
pass
if __name__ == '__m... | mit | Python |
68b2f7d1d805e0dddf868fc21d8d34db7e80f254 | update version | zestedesavoir/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown,Situphen/Python-ZMarkdown,Situphen/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown,Situphen/Python-ZMarkdown | markdown/__version__.py | markdown/__version__.py | #
# markdown/__version__.py
#
# version_info should conform to PEP 386
# (major, minor, micro, alpha/beta/rc/final, #)
# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
# (1, 2, 0, 'beta', 2) => "1.2b2"
version_info = (2, 4, 1, 'zds', 11)
def _get_version():
" Returns a PEP 386-compliant version number from version_info. "
... | #
# markdown/__version__.py
#
# version_info should conform to PEP 386
# (major, minor, micro, alpha/beta/rc/final, #)
# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
# (1, 2, 0, 'beta', 2) => "1.2b2"
version_info = (2, 4, 1, 'zds', 10)
def _get_version():
" Returns a PEP 386-compliant version number from version_info. "
... | bsd-3-clause | Python |
7870a87ca8d3d69751fa05681fe194f18b805eae | Update some libraries. | mwaaas/django-waffle-session,festicket/django-waffle,safarijv/django-waffle,rodgomes/django-waffle,rlr/django-waffle,VladimirFilonov/django-waffle,rlr/django-waffle,rsalmaso/django-waffle,JeLoueMonCampingCar/django-waffle,ilanbm/django-waffle,VladimirFilonov/django-waffle,groovecoder/django-waffle,hwkns/django-waffle,f... | fabfile.py | fabfile.py | """
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a settings.py file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
automatically.
"""
import functools
import os
from fabric.api import local as _local
NAME = os.p... | """
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a settings.py file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
automatically.
"""
import functools
import os
from fabric.api import local as _local
NAME = os.p... | bsd-3-clause | Python |
9e11922dbd35c37a0b091dfbaeb115ca022fa02c | update fabfile so the tests can run properly | armstrong/armstrong.apps.images,armstrong/armstrong.apps.images,armstrong/armstrong.apps.images | fabfile.py | fabfile.py | import os.path
from armstrong.dev.tasks import *
settings = {
'DEBUG': True,
'INSTALLED_APPS': (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
... | import os.path
from armstrong.dev.tasks import *
settings = {
'DEBUG': True,
'INSTALLED_APPS': (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
... | apache-2.0 | Python |
194b169c893301fad02d0f1b8b4ed8159d6cdf0d | define required SECRET_KEY so tests can start | BetterWorks/django-anonymizer | anonymizer/test_settings.py | anonymizer/test_settings.py | DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3'
},
}
INSTALLED_APPS = [
'anonymizer',
'anonymizer.tests',
]
SECRET_KEY = 'foo bar baz'
|
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3'
},
}
INSTALLED_APPS = [
'anonymizer',
'anonymizer.tests',
]
| mit | Python |
e3aedc92ba6b421bd37e1849086fc09a462caf19 | bump version (#559) | tburgin/santa,google/santa,tburgin/santa,google/santa,russellhancox/santa,google/santa,tburgin/santa,russellhancox/santa,russellhancox/santa | version.bzl | version.bzl | """The version for all Santa components."""
SANTA_VERSION = "2021.6"
| """The version for all Santa components."""
SANTA_VERSION = "2021.5"
| apache-2.0 | Python |
a220aa08071b18edf314a1cfc200cc90c19b3ced | Order blobs in the playlist API by lowest position first | GISAElkartea/amv2,GISAElkartea/amv2,GISAElkartea/amv2 | antxetamedia/blobs/views.py | antxetamedia/blobs/views.py | from django.http import JsonResponse
from django.views.generic import ListView
from .models import Blob
class PodcastBlobList(ListView):
model = Blob
def get_queryset(self):
qs = super(PodcastBlobList, self).get_queryset()
qs = qs.filter(content_type__app_label=self.kwargs['app_label'],
... | from django.http import JsonResponse
from django.views.generic import ListView
from .models import Blob
class PodcastBlobList(ListView):
model = Blob
def get_queryset(self):
qs = super(PodcastBlobList, self).get_queryset()
qs = qs.filter(content_type__app_label=self.kwargs['app_label'],
... | agpl-3.0 | Python |
ae27da9f308c8f5c40f3b0a36778a4e45d911cbc | Fix typo [skip ci] | globality-corp/microcosm-pubsub,globality-corp/microcosm-pubsub | microcosm_pubsub/chain/statements/switch.py | microcosm_pubsub/chain/statements/switch.py | """
switch("foo").case("bar").then(
...
).case("baz").then(
...
).otherwise(
...
)
"""
from microcosm_pubsub.chain import Chain
from microcosm_pubsub.chain.statements.case import CaseStatement
class SwitchStatement:
"""
Switch on one or more cases.
"""
def __init__(self, key):
se... | """
switch("foo").case("bar").then(
...
).case("baz").then(
...
).otherwise(
...
)
"""
from microcosm_pubsub.chain import Chain
from microcosm_pubsub.chain.statements.case import CaseStatement
class SwitchStatement:
"""
Switch on one more cases.
"""
def __init__(self, key):
self.... | apache-2.0 | Python |
2a7014b9fce734ff840477ad98775644eb54c944 | Make loglevel case-independent | hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem | netsecus/__init__.py | netsecus/__init__.py | from __future__ import unicode_literals
import argparse
import getpass
import logging
import threading
from passlib.hash import pbkdf2_sha256
from .config import Config
from . import mail_handler
from . import korrekturserver
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-c",... | from __future__ import unicode_literals
import argparse
import getpass
import logging
import threading
from passlib.hash import pbkdf2_sha256
from .config import Config
from . import mail_handler
from . import korrekturserver
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-c",... | mit | Python |
2a8fa1e2a6f73d8f84008968e13378494b8a2e78 | Update the settings file | EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat | halaqat/settings/shaha.py | halaqat/settings/shaha.py | from .base_settings import *
import dj_database_url
import os
ALLOWED_HOSTS = ['shaha-halaqat.herokuapp.com', '0.0.0.0']
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
STATIC_... | from .base_settings import *
import dj_database_url
import os
ALLOWED_HOSTS = ['shaha-halaqat.herokuapp.com', '0.0.0.0']
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/... | mit | Python |
4ec7e3cf2b953f287cb5327605e8011e9b933489 | Bump version | uogbuji/amara3-xml,uogbuji/amara3-xml | lib/version.py | lib/version.py | #http://legacy.python.org/dev/peps/pep-0440/
version_info = ('3', '0', '0a10')
| #http://legacy.python.org/dev/peps/pep-0440/
version_info = ('3', '0', '0a9')
| apache-2.0 | Python |
31b1d474354d2fcef860d610d12b6533b4fb39f0 | exit after execution | Abukamel/newrelic_ops | bin/new_relic.py | bin/new_relic.py | #!/usr/bin/env python
import begin
import sys
import logging
import salt.config
import salt.client
from newrelic_ops import newrelic as newrelic
@begin.start(auto_convert=True)
@begin.logging
def main(install=False, key=''):
if not install:
logging.error('Try -h/--help option for usage info!')
sys... | #!/usr/bin/env python
import begin
import sys
import logging
import salt.config
import salt.client
from newrelic_ops import newrelic as newrelic
@begin.start(auto_convert=True)
@begin.logging
def main(install=False, key=''):
if not install:
logging.error('Try -h/--help option for usage info!')
sys... | mit | Python |
86efe6ad1d9e03ddfde9e735355bb1e535ede945 | Replace python2 syntax with six.add_metaclass decorator in tokenize/api.py | nltk/nltk,nltk/nltk,nltk/nltk | nltk/tokenize/api.py | nltk/tokenize/api.py | # Natural Language Toolkit: Tokenizer Interface
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Tokenizer Interface
"""
from abc import ABCMeta, abstractmethod
fro... | # Natural Language Toolkit: Tokenizer Interface
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Tokenizer Interface
"""
from abc import ABCMeta, abstractmethod
fr... | apache-2.0 | Python |
0b09dce0dbae9b7847224a260043e4be052ea0ae | remove debug on scheduler bin | mining/mining,mining/mining,avelino/mining,seagoat/mining,AndrzejR/mining,chrisdamba/mining,AndrzejR/mining,mlgruby/mining,jgabriellima/mining,chrisdamba/mining,mlgruby/mining,seagoat/mining,avelino/mining,mlgruby/mining,jgabriellima/mining | bin/scheduler.py | bin/scheduler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
from os import sys, path
import time
import schedule
from bottle.ext.mongo import MongoPlugin
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from bin.mining import run
from utils import conf, log_it
def ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
from os import sys, path
import time
import schedule
from bottle.ext.mongo import MongoPlugin
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from bin.mining import run
from utils import conf, log_it
def ... | mit | Python |
e38e2a90d279a7ea9539af6010c8a61c2c74d01c | rename function | ed-g/transitfeed_web,ed-g/transitfeed_web | transitfeed_web/run_transitfeed_web_server.py | transitfeed_web/run_transitfeed_web_server.py | #!/usr/bin/env python2
import sys
import os
import transitfeed
import time # for testing
import StringIO #write GTFS directly to network.
import hexdump
import requests
from flask import Flask
import util # Actually, transitfeed_web.util
def find_and_import_feedvalidator_script():
# The transitfeed library inst... | #!/usr/bin/env python2
import sys
import os
import transitfeed
import time # for testing
import StringIO #write GTFS directly to network.
import hexdump
import requests
from flask import Flask
import util # Actually, transitfeed_web.util
def find_and_load_feedvalidator():
# The transitfeed library installs feed... | apache-2.0 | Python |
6a9524502ebf3c04dede24fb937baec5c48342ef | Use a more realistic context to render pages for search | j00bar/django-widgy,j00bar/django-widgy,j00bar/django-widgy | widgy/contrib/widgy_mezzanine/search_indexes.py | widgy/contrib/widgy_mezzanine/search_indexes.py | from haystack import indexes
from widgy.contrib.widgy_mezzanine import get_widgypage_model
from widgy.templatetags.widgy_tags import render_root
from widgy.utils import html_to_plaintext
from .signals import widgypage_pre_index
WidgyPage = get_widgypage_model()
class PageIndex(indexes.SearchIndex, indexes.Indexabl... | from haystack import indexes
from widgy.contrib.widgy_mezzanine import get_widgypage_model
from widgy.templatetags.widgy_tags import render_root
from widgy.utils import html_to_plaintext
from .signals import widgypage_pre_index
WidgyPage = get_widgypage_model()
class PageIndex(indexes.SearchIndex, indexes.Indexabl... | apache-2.0 | Python |
b12f869f169cd44c8dba633c4707d1a60b092893 | Update the next version to 4.4.0 | dmsurti/mayavi,dmsurti/mayavi,alexandreleroux/mayavi,alexandreleroux/mayavi,liulion/mayavi,liulion/mayavi | mayavi/__init__.py | mayavi/__init__.py | # Author: Prabhu Ramachandran, Gael Varoquaux
# Copyright (c) 2004-2014, Enthought, Inc.
# License: BSD Style.
""" A tool for easy and interactive visualization of data.
Part of the Mayavi project of the Enthought Tool Suite.
"""
__version__ = '4.4.0'
__requires__ = [
'apptools',
'traits',
'traitsui',... | # Author: Prabhu Ramachandran, Gael Varoquaux
# Copyright (c) 2004-2014, Enthought, Inc.
# License: BSD Style.
""" A tool for easy and interactive visualization of data.
Part of the Mayavi project of the Enthought Tool Suite.
"""
__version__ = '5.0.0'
__requires__ = [
'apptools',
'traits',
'traitsui',... | bsd-3-clause | Python |
8f892e3922da66a752bf81de58749fc779bf52b8 | Use FakeName instead of a custom KeywordName. | jonashaag/jedi,flurischt/jedi,mfussenegger/jedi,dwillmer/jedi,jonashaag/jedi,WoLpH/jedi,flurischt/jedi,tjwei/jedi,dwillmer/jedi,mfussenegger/jedi,tjwei/jedi,WoLpH/jedi | jedi/api/keywords.py | jedi/api/keywords.py | import pydoc
import keyword
from jedi.parser.representation import NamePart
from jedi._compatibility import is_py3
from jedi import common
from jedi.evaluate import compiled
from jedi.evaluate.helpers import FakeName
try:
from pydoc_data import topics as pydoc_topics
except ImportError:
# Python 2.6
impor... | import pydoc
import keyword
from jedi.parser.representation import NamePart
from jedi._compatibility import is_py3
from jedi import common
from jedi.evaluate import compiled
from jedi.evaluate.helpers import FakeSubModule
try:
from pydoc_data import topics as pydoc_topics
except ImportError:
# Python 2.6
... | mit | Python |
c40ab6175e0cb6b562965b11187c1127e9da752d | store term vectors for text; use field type text instead of string to avoid ES complaints | osma/annif,osma/annif,osma/annif | load_corpus.py | load_corpus.py | #!/usr/bin/env python
from elasticsearch import Elasticsearch
from elasticsearch.client import IndicesClient
import os
es = Elasticsearch()
index = IndicesClient(es)
if index.exists('yso'):
index.delete('yso')
indexconf = {
'mappings': {
'concept': {
'properties': {
'labe... | #!/usr/bin/env python
from elasticsearch import Elasticsearch
from elasticsearch.client import IndicesClient
import os
es = Elasticsearch()
index = IndicesClient(es)
if index.exists('yso'):
index.delete('yso')
indexconf = {
'mappings': {
'concept': {
'properties': {
'labe... | cc0-1.0 | Python |
9ec87f52810e791f9284b6f823d9b09035a7b230 | Add pragma: no cover to untestable section of formatter.py | WesleyAC/lemonscript-transpiler,WesleyAC/lemonscript-transpiler,WesleyAC/lemonscript-transpiler | objects/formatter.py | objects/formatter.py | import subprocess
import os
class Formatter(object):
def __init__(self, input_text, style=None): # style=None is a pretty good description of me tbh
self.text = input_text
if style == None:
self.style = "{BasedOnStyle: Google, ColumnLimit: 0}"
else:
self.style = styl... | import subprocess
import os
class Formatter(object):
def __init__(self, input_text, style=None): # style=None is a pretty good description of me tbh
self.text = input_text
if style == None:
self.style = "{BasedOnStyle: Google, ColumnLimit: 0}"
else:
self.style = styl... | mit | Python |
9aca943c558c5e43b8f9671c636c21a773d3e22d | Update PartitionList_001.py | cc13ny/Allin,Chasego/codi,Chasego/codi,Chasego/codirit,Chasego/codirit,Chasego/codirit,Chasego/cod,Chasego/cod,cc13ny/algo,Chasego/cod,Chasego/cod,Chasego/codi,cc13ny/algo,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/cod,Chasego/codirit,Chasego/codirit,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/algo,cc13ny/Allin,cc1... | leetcode/086-Partition-List/PartitionList_001.py | leetcode/086-Partition-List/PartitionList_001.py | #@author: cchen
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @param {integer} x
# @return {ListNode}
def partition(self, head, x):
if head == None or head.next ==... | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @param {integer} x
# @return {ListNode}
def partition(self, head, x):
if head == None or head.next == None:
... | mit | Python |
f67afe3c185d9affc5c996137c961ae36216ac60 | fix statement | SiLab-Bonn/basil,MarcoVogt/basil,SiLab-Bonn/basil | host/tests/test_SimTlu.py | host/tests/test_SimTlu.py | #
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
import unittest
from basil.dut import Dut
from basil.utils.sim.utils import cocotb_compile_and... | #
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
import unittest
from basil.dut import Dut
from basil.utils.sim.utils import cocotb_compile_and... | bsd-3-clause | Python |
60ebbb4b4ec448221cffec6f725330525b307684 | add helper function to make an object identity | kbase/probabilistic_annotation,kbase/probabilistic_annotation,kbase/probabilistic_annotation,kbase/probabilistic_annotation,kbase/probabilistic_annotation | lib/biokbase/probabilistic_annotation/Helpers.py | lib/biokbase/probabilistic_annotation/Helpers.py | #! /usr/bin/python
import os
import sys
import time
from biokbase.probabilistic_annotation.DataParser import getConfig, readConfig
from biokbase.auth import kb_config
from ConfigParser import ConfigParser
DefaultURL = 'https://kbase.us/services/probabilistic_annotation/'
''' Get the current URL for the service. '''
... | #! /usr/bin/python
import os
import sys
import time
from biokbase.probabilistic_annotation.DataParser import getConfig, readConfig
from biokbase.auth import kb_config
from ConfigParser import ConfigParser
DefaultURL = 'https://kbase.us/services/probabilistic_annotation/'
''' Get the current URL for the service. '''
... | mit | Python |
79680b2af2879c3f2adeadda830d87c073f51684 | Update registration to store both full class name as well as name_space.name | python-odin/odin | odin/registration.py | odin/registration.py | # -*- coding: utf-8 -*-
from odin.exceptions import RegistrationException
class ResourceCache(object):
# Use the Borg pattern to share state between all instances. Details at
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531.
__shared_state = dict(
resources={}
)
def __init_... | # -*- coding: utf-8 -*-
class ResourceCache(object):
# Use the Borg pattern to share state between all instances. Details at
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531.
__shared_state = dict(
resources={}
)
def __init__(self):
self.__dict__ = self.__shared_sta... | bsd-3-clause | Python |
0ac939ce5b6dbe229aa82571fe4e02713f57566e | Make translate print to stdout instead of calling reply | tomleese/smartbot,Muzer/smartbot,Cyanogenoid/smartbot,thomasleese/smartbot-old | plugins/translate.py | plugins/translate.py | import sys
import re
from textblob import TextBlob
class Plugin:
matcher = re.compile(r'translate (?:from ([^ ]+) )?(?:to ([^ ]+) )?(.*)')
def on_command(self, bot, msg, stdin, stdout, reply):
match = self.matcher.match(msg["message"])
if not match:
return
from_lang = ma... | import sys
import re
from textblob import TextBlob
class Plugin:
matcher = re.compile(r'translate (?:from ([^ ]+) )?(?:to ([^ ]+) )?(.*)')
def on_command(self, bot, msg, stdin, stdout, reply):
match = self.matcher.match(msg["message"])
if not match:
return
from_lang = ma... | mit | Python |
e571318b29f7e9d05003f66a91d82047e7713b68 | Add a docstring at the top of Tools/ssl/make_ssl_data.py | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Tools/ssl/make_ssl_data.py | Tools/ssl/make_ssl_data.py | #! /usr/bin/env python3
"""
This script should be called *manually* when we want to upgrade SSLError
`library` and `reason` mnemnonics to a more recent OpenSSL version.
It takes two arguments:
- the path to the OpenSSL include files' directory
(e.g. openssl-1.0.1-beta3/include/openssl/)
- the path to the C file to ... | #! /usr/bin/env python3
import datetime
import os
import re
import sys
def parse_error_codes(h_file, prefix):
pat = re.compile(r"#define\W+(%s([\w]+))\W+(\d+)\b" % re.escape(prefix))
codes = []
with open(h_file, "r", encoding="latin1") as f:
for line in f:
match = pat.search(line)
... | mit | Python |
9b9e791bfc3688498cab4fabd1e31966a6ee476b | fix instance get_instance_status | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/physical/service/instance.py | dbaas/physical/service/instance.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from django_services import service
from ..models import Instance
from drivers import factory_for
from django_services.service import checkpermission
LOG = logging.getLogger(__name__)
class InstanceService(service.CRUDSer... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from django_services import service
from ..models import Instance
from drivers import factory
from django_services.service import checkpermission
LOG = logging.getLogger(__name__)
class InstanceService(service.CRUDService... | bsd-3-clause | Python |
e495b0ab60de26bab331d9882bb5d52b33d8fac4 | Rename repository method for clarity | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | backdrop/core/repository.py | backdrop/core/repository.py | from backdrop.core.bucket import BucketConfig
from backdrop.core.user import UserConfig
class _Repository(object):
def __init__(self, db, model_cls, collection_name, id_field):
self.db = db
self.model_cls = model_cls
self.collection_name = collection_name
self.id_field = id_field
... | from backdrop.core.bucket import BucketConfig
from backdrop.core.user import UserConfig
class _Repository(object):
def __init__(self, db, model_cls, collection_name, id_field):
self.db = db
self.model_cls = model_cls
self.collection_name = collection_name
self.id_field = id_field
... | mit | Python |
ef7bddfbe660b07eb2f1434a6f155056c5e7f96d | Update twice.py | kazunobusunamura/robosys-task2 | mypkg/twice.py | mypkg/twice.py | #!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
n = 0
def cb(message):
global n
n = message.data*2
if __name__ == '__main__':
rospy.init_node('twice')
sub = rospy.Subscriber('count_up', Int32, cb)
pub = rospy.Publisher('twice', Int32, queue_size=1)
rate = ro... | #!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
def cb(message):
rospy.loginfo(message.data*2)
if __name__ == '__main__':
rospy.init_node('twice')
sub = rospy.Subscriber('count_up', Int32, cb)
rospy.spin() | bsd-2-clause | Python |
edf08b9928558688c2402d1c144f04777f4b4bc5 | Add caching feature to API lookup requests | jaykwon/giantanswers | gb/helpers.py | gb/helpers.py | """Helpers to facilitate API interaction."""
from functools import wraps
from datetime import datetime
# Spoken strings come to us as words, not numbers.
NUM_WORD_INT = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
'six': 6,
'seven': 7,
'eight': 8,
'nine': ... | """Helpers to facilitate API interaction."""
# Spoken strings come to us as words, not numbers.
NUM_WORD_INT = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
'six': 6,
'seven': 7,
'eight': 8,
'nine': 9
}
# The same thing as NUM_WORD_INT, but already stringi... | mit | Python |
4a63ce65eee91af8f2866bb2433c52f37afbd2ad | Use Schema base from new location | tecnologiaenegocios/tn.plonestyledpage | src/tn/plonestyledpage/styled_page.py | src/tn/plonestyledpage/styled_page.py | from cssutils.css import CSSRule
from five import grok
from plone.app.textfield import RichText
from plone.dexterity import content
from plone.directives import form
from plone.supermodel import model
from tn.plonestyledpage import _
from tn.ploneformwidget.sourcecode import SourceCodeFieldWidget
from zope.keyreference... | from cssutils.css import CSSRule
from five import grok
from plone.app.textfield import RichText
from plone.dexterity import content
from plone.directives import form
from tn.plonestyledpage import _
from tn.ploneformwidget.sourcecode import SourceCodeFieldWidget
from zope.keyreference.interfaces import IKeyReference
fr... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.