commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
7ba77209687ae1bb1344cc09e3539f7e21bfe599 | Improve test of csvstack --filenames. | tests/test_utilities/test_csvstack.py | tests/test_utilities/test_csvstack.py | #!/usr/bin/env python
import sys
import StringIO
import unittest
from csvkit import CSVKitReader
from csvkit.utilities.stack import CSVStack
class TestCSVStack(unittest.TestCase):
def test_explicit_grouping(self):
# stack two CSV files
args = ["--groups", "asd,sdf", "-n", "foo", "examples/dummy.c... | #!/usr/bin/env python
import sys
import StringIO
import unittest
from csvkit import CSVKitReader
from csvkit.utilities.stack import CSVStack
class TestCSVStack(unittest.TestCase):
def test_explicit_grouping(self):
# stack two CSV files
args = ["--groups", "asd,sdf", "-n", "foo", "examples/dummy.c... | Python | 0 |
2f2114b47618ef6435543c05d941d3191ef44d5c | refactor Valuation functions | FinSymPy/Valuation.py | FinSymPy/Valuation.py |
def terminal_value(
terminal_cash_flow=0.,
long_term_discount_rate=.01,
long_term_growth_rate=0.):
return (1 + long_term_growth_rate) * terminal_cash_flow / (long_term_discount_rate - long_term_growth_rate)
def present_value(amount=0., discount_rate=0., nb_periods=0.):
return amount ... | from sympy.matrices import Determinant, Matrix
def terminal_value(
cash_flows=Matrix([0.]),
long_term_discount_rate=0.,
long_term_growth_rate=0.):
m, n = cash_flows.shape
if m == 1:
filter_vector = Matrix((n - 1) * [0] + [1])
tv = Determinant(cash_flows * filter_vector)... | Python | 0.000069 |
6ff7389f85485b8aa2848aa0e7420569c0c06f37 | Update pluginLoader. | src/gopher/agent/plugin.py | src/gopher/agent/plugin.py | #
# Copyright (c) 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | #
# Copyright (c) 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | Python | 0 |
b38497b06d52f230f9688e59a107349b4867810e | fix -- output to stdout, not to stderr as by default.. | src/helpers/main_helper.py | src/helpers/main_helper.py | import logging
import os
import sys
from synthesis.smt_logic import Logic
from synthesis.solvers import Z3_Smt_NonInteractive_ViaFiles, Z3_Smt_Interactive
from third_party.ansistrm import ColorizingStreamHandler
from translation2uct.ltl2automaton import Ltl2UCW
def get_root_dir() -> str:
#make paths independent ... | import logging
import os
from synthesis.smt_logic import Logic
from synthesis.solvers import Z3_Smt_NonInteractive_ViaFiles, Z3_Smt_Interactive
from third_party.ansistrm import ColorizingStreamHandler
from translation2uct.ltl2automaton import Ltl2UCW
def get_root_dir() -> str:
#make paths independent of current ... | Python | 0 |
60f3c4e1bbd25d781cfba5993aac647d937c64c9 | add BillSource to public interface | opencivicdata/models/__init__.py | opencivicdata/models/__init__.py | # flake8: NOQA
from .jurisdiction import Jurisdiction, JurisdictionSession
from .division import Division
from .people_orgs import (
Organization, OrganizationIdentifier, OrganizationName, OrganizationContactDetail,
OrganizationLink, OrganizationSource,
Person, PersonIdentifier, PersonName, PersonContactDet... | # flake8: NOQA
from .jurisdiction import Jurisdiction, JurisdictionSession
from .division import Division
from .people_orgs import (
Organization, OrganizationIdentifier, OrganizationName, OrganizationContactDetail,
OrganizationLink, OrganizationSource,
Person, PersonIdentifier, PersonName, PersonContactDet... | Python | 0 |
5232597d574f7089f592aac0a5f25efd1ff7763a | Update test_blt.py. | openrcv/test/formats/test_blt.py | openrcv/test/formats/test_blt.py |
from textwrap import dedent
from openrcv.formats.blt import BLTFileWriter
from openrcv.models import BallotsResource, ContestInput
from openrcv.streams import StringResource
from openrcv.utiltest.helpers import UnitCase
class BLTFileWriterTest(UnitCase):
def test(self):
contest = ContestInput()
... |
from textwrap import dedent
from openrcv.formats.blt import BLTFileWriter
from openrcv.models import BallotsResource, ContestInput
from openrcv.utils import StringInfo
from openrcv.utiltest.helpers import UnitCase
class BLTFileWriterTest(UnitCase):
def test(self):
contest = ContestInput()
conte... | Python | 0 |
ff63f077fe68ae18b409598a3860d0abbc7442e3 | fix num_topics property | orangecontrib/text/topics/hdp.py | orangecontrib/text/topics/hdp.py | from gensim import models
from .topics import GensimWrapper
class HdpModel(models.HdpModel):
def __init__(self, corpus, id2word, **kwargs):
# disable fitting during initialization
_update = self.update
self.update = lambda x: x
super().__init__(corpus, id2word, **kwargs)
s... | from gensim import models
from .topics import GensimWrapper
class HdpModel(models.HdpModel):
def __init__(self, corpus, id2word, **kwargs):
# disable fitting during initialization
_update = self.update
self.update = lambda x: x
super().__init__(corpus, id2word, **kwargs)
s... | Python | 0.000004 |
3a247b72ba39bb2f49099905c435127aea424fe0 | Remove unused variable | lib/backend_common/tests/conftest.py | lib/backend_common/tests/conftest.py | """Configure a mock application to run queries against"""
import pytest
from flask_login import current_user
from flask import jsonify
from backend_common import create_app, auth, auth0, mocks
from os.path import join, dirname
@pytest.fixture(scope='module')
def app():
"""
Build an app with an authenticated ... | """Configure a mock application to run queries against"""
import pytest
from flask_login import current_user
from flask import jsonify
from backend_common import create_app, auth, auth0, mocks
from os.path import join, dirname
FAKE_CLIENT_SECRETS = """
{
"web": {
"auth_uri": "https://auth.mozilla.auth0.co... | Python | 0.000015 |
6cd9af9d1c2f6b7e366c4bcc0b7c7422d4f776be | Add device events hook to app engine app. | src/appengine/main.py | src/appengine/main.py | import json
import logging
import os
import random
import string
import sys
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp.util import login_required
from google.appengine.ext import db
from google.appengine.e... | import json
import logging
import os
import random
import string
import sys
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp.util import login_required
from google.appengine.ext import db
from google.appengine.e... | Python | 0 |
f10797b4b39c262fdb8a250386f7c61e7922005a | Check for CLI updates (from private pip by default) | src/azure/cli/main.py | src/azure/cli/main.py | import os
import sys
from datetime import datetime, timedelta
from ._argparse import ArgumentParser
from ._logging import configure_logging, logger
from ._session import Session
from ._output import OutputProducer
from azure.cli.extensions import event_dispatcher
from azure.cli.utils.update_checker import check_for_... | import os
import sys
from ._argparse import ArgumentParser
from ._logging import configure_logging, logger
from ._session import Session
from ._output import OutputProducer
from azure.cli.extensions import event_dispatcher
# CONFIG provides external configuration options
CONFIG = Session()
# SESSION provides read-w... | Python | 0 |
66608b724112680075d6e41edda7e631da69301e | add stop_id test | ott/otp_client/tests/tests_ti.py | ott/otp_client/tests/tests_ti.py | import os
import unittest
from ott.otp_client.transit_index.routes import Routes
from ott.otp_client.transit_index.stops import Stops
def get_db():
from gtfsdb import api, util
from ott.utils import file_utils
dir = file_utils.get_module_dir(Routes)
gtfs_file = os.path.join(dir, '..', 'tests', 'data'... | import os
import unittest
from ott.otp_client.transit_index.routes import Routes
from ott.otp_client.transit_index.stops import Stops
def get_db():
from gtfsdb import api, util
from ott.utils import file_utils
dir = file_utils.get_module_dir(Routes)
gtfs_file = os.path.join(dir, '..', 'tests', 'data'... | Python | 0.000001 |
b9848aba428c1c7c99a1fef64ff56b940abb9eb9 | Remove num option from fetch_recent tweets | ditto/twitter/management/commands/fetch_twitter_tweets.py | ditto/twitter/management/commands/fetch_twitter_tweets.py | # coding: utf-8
import argparse
from django.core.management.base import BaseCommand, CommandError
from ...fetch import FetchTweets
class Command(BaseCommand):
"""fetches tweets from Twitter.
Fetch recent tweets since the last fetch, from all accounts:
./manage.py fetch_twitter_tweets --recent
Fetc... | # coding: utf-8
import argparse
from django.core.management.base import BaseCommand, CommandError
from ...fetch import FetchTweets
class Command(BaseCommand):
"""fetches tweets from Twitter.
Fetch recent tweets since the last fetch, from all accounts:
./manage.py fetch_twitter_tweets --recent
Fetc... | Python | 0.000025 |
2c6a495351de52fe1de0b36d73f22e777ef3d08c | fix sqlalchemy url with sqlite prefix | wsgi/todopyramid/todopyramid/__init__.py | wsgi/todopyramid/todopyramid/__init__.py | import os
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from .models import (
DBSession,
Base,
)
from .views import get_user
def get_db_session(request):
"""return thread-local DB session"""
return DBSession
def main(global_config, **settings):
""" This f... | import os
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from .models import (
DBSession,
Base,
)
from .views import get_user
def get_db_session(request):
"""return thread-local DB session"""
return DBSession
def main(global_config, **settings):
""" This f... | Python | 0.001027 |
926df1bc4dee9fc613f0fb31bb8c579943008645 | Update plot_label_propagation_digits.py (#22725) | examples/semi_supervised/plot_label_propagation_digits.py | examples/semi_supervised/plot_label_propagation_digits.py | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | Python | 0 |
ebddb1005d3eda45f11eef08d83c271a657443b2 | Add functional tests for volume set size | functional/tests/volume/v1/test_volume.py | functional/tests/volume/v1/test_volume.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Python | 0.000005 |
3284f18168ce274516dc51293376571f5dfada18 | copy the hasher from FrozenPhoneNumber | phonenumber_field/phonenumber.py | phonenumber_field/phonenumber.py | #-*- coding: utf-8 -*-
import phonenumbers
from django.core import validators
from phonenumbers.phonenumberutil import NumberParseException
from django.conf import settings
class PhoneNumber(phonenumbers.phonenumber.PhoneNumber):
"""
A extended version of phonenumbers.phonenumber.PhoneNumber that provides som... | #-*- coding: utf-8 -*-
import phonenumbers
from django.core import validators
from phonenumbers.phonenumberutil import NumberParseException
from django.conf import settings
class PhoneNumber(phonenumbers.phonenumber.PhoneNumber):
"""
A extended version of phonenumbers.phonenumber.PhoneNumber that provides som... | Python | 0 |
4b7e6d7df8a447873bc57adfedfb6013b915190c | Fix Node.namespace_uri for py3 | cio/node.py | cio/node.py | # coding=utf-8
from __future__ import unicode_literals
from .environment import env
from .utils.formatters import ContentFormatter
from .utils.uri import URI
import six
empty = object()
class Node(object):
_formatter = ContentFormatter()
def __init__(self, uri, content=None, **meta):
self.env = en... | # coding=utf-8
from __future__ import unicode_literals
from .environment import env
from .utils.formatters import ContentFormatter
from .utils.uri import URI
import six
empty = object()
class Node(object):
_formatter = ContentFormatter()
def __init__(self, uri, content=None, **meta):
self.env = en... | Python | 0.000765 |
3a42b4458f85d8f2640c34fce79c9a99a79f5323 | Revert "add second db connection to coastdat" | calc_renpass_gis/scenario_reader/db.py | calc_renpass_gis/scenario_reader/db.py | # -*- coding: utf-8 -*-
from sqlalchemy import (Column, Float, ForeignKey, Integer, MetaData, String,
Table, join, create_engine, ForeignKeyConstraint,
Boolean, DateTime, Sequence)
from sqlalchemy.orm import sessionmaker, relationship, configure_mappers
# from sqlalchemy.... | # -*- coding: utf-8 -*-
from sqlalchemy import (Column, Float, ForeignKey, Integer, MetaData, String,
Table, join, create_engine, ForeignKeyConstraint,
Boolean, DateTime, Sequence)
from sqlalchemy.orm import sessionmaker, relationship, configure_mappers
# from sqlalchemy.... | Python | 0 |
14a7d5305a3e5dfc73834cb6164def4c0706e740 | Fix : cmdline GET output | cli/client.py | cli/client.py | # -*- coding: utf-8 -*-
# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.
from __future__ import absolute_import
import zmq
from elevator.constants import *
from .errors import *
from .message import Request, ResponseHeader, Response
class Client(object):
def __init__(self, *a... | # -*- coding: utf-8 -*-
# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.
from __future__ import absolute_import
import zmq
from elevator.constants import *
from .errors import *
from .message import Request, ResponseHeader, Response
class Client(object):
def __init__(self, *a... | Python | 0.000002 |
900b37fee45db789b413d55b497d87992c3dab00 | Remove Welcome! Flash | bakery/gitauth/views.py | bakery/gitauth/views.py | # coding: utf-8
# Copyright 2013 The Font Bakery Authors. 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 re... | # coding: utf-8
# Copyright 2013 The Font Bakery Authors. 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 re... | Python | 0.000008 |
49152781ecbfb4f51707e6e54641301038eba80f | set varchar length | king/DataPoint.py | king/DataPoint.py | from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, PickleType, Boolean, String, DateTime
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime
engine = create_engine('mysql+pymysql://ucb_268_measure:ucb_268_measure@data.c... | from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, PickleType, Boolean, String, DateTime
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime
engine = create_engine('mysql+pymysql://ucb_268_measure:ucb_268_measure@data.c... | Python | 0.000068 |
93db3543a576ccde905fc77d7c3ad825f6a100a1 | change threshold | misc_scripts/compare_bounds.py | misc_scripts/compare_bounds.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, re
from fontTools.ttLib import TTFont
from fontTools.pens.boundsPen import BoundsPen, ControlBoundsPen
class ConcordanceInfo(object):
def __init__(self):
self.glyphs = 0
self.concordant_glyphs = 0
self.maxdiff = 0
self.... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, re
from fontTools.ttLib import TTFont
from fontTools.pens.boundsPen import BoundsPen, ControlBoundsPen
class ConcordanceInfo(object):
def __init__(self):
self.glyphs = 0
self.concordant_glyphs = 0
self.maxdiff = 0
self.... | Python | 0.000001 |
df88bc165e0a505b07c84aea4a29bf3c048895ac | replace OSError with FileNotFoundError when appropriate | dwi/hdf5.py | dwi/hdf5.py | """Support for HDF5 files."""
from collections import OrderedDict
import numpy as np
import h5py
from dwi.types import Path
DEFAULT_DSETNAME = 'default'
DEFAULT_DSETPARAMS = dict(
compression='gzip', # Smaller, compatible.
# compression='lzf', # Faster.
shuffle=True, # Rearrange bytes for better comp... | """Support for HDF5 files."""
from collections import OrderedDict
import numpy as np
import h5py
import dwi.util
DEFAULT_DSETNAME = 'default'
DEFAULT_DSETPARAMS = dict(
compression='gzip', # Smaller, compatible.
# compression='lzf', # Faster.
shuffle=True, # Rearrange bytes for better compression.
... | Python | 0.000039 |
5d1f9d3eaa27c0abf555fe3c79e9c11f9f7167ae | Fix redundant warning about 'file_name' config value. | foliant/pandoc.py | foliant/pandoc.py | """Wrapper around Pandoc. Used by builder."""
from __future__ import print_function
import subprocess
from . import gitutils
PANDOC_PATH = "pandoc"
FROM_PARAMS = "-f markdown_strict+simple_tables+multiline_tables+grid_tables+pipe_tables+table_captions+fenced_code_blocks+line_blocks+definition_lists+all_symbols_escap... | """Wrapper around Pandoc. Used by builder."""
from __future__ import print_function
import subprocess
from . import gitutils
PANDOC_PATH = "pandoc"
FROM_PARAMS = "-f markdown_strict+simple_tables+multiline_tables+grid_tables+pipe_tables+table_captions+fenced_code_blocks+line_blocks+definition_lists+all_symbols_escap... | Python | 0 |
a324051e28d359a1591dff48fa4bbb32c3caf44a | add loaders __doc__ | src/loaders/__init__.py | src/loaders/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018 shmilee
'''
This is the subpackage ``loaders`` of gdpy3.
It contains two kinds of loaders.
1. ``RawLoader``, get by :func:`get_rawloader`.
``RawLoader`` has attributes
:attr:`base.BaseRawLoader.path``,
:attr:`base.BaseRawLoader.filenames`
and methods
:meth:... | # -*- coding: utf-8 -*-
# Copyright (c) 2018 shmilee
import os
from ..glogger import getGLogger
from . import base
__all__ = ['get_rawloader', 'is_rawloader', 'get_pckloader', 'is_pckloader']
log = getGLogger('L')
rawloader_names = ['DirRawLoader', 'TarRawLoader', 'SftpRawLoader']
pckloader_names = ['CachePckLoader... | Python | 0.000002 |
bfe6c752aa2a95cc28109f4819cf6a9e88e7ee4b | remove unnecessary comments | stores/views.py | stores/views.py | from newt.views import JSONRestView
from common.response import json_response
from django.conf import settings
import json
store_adapter = __import__(settings.NEWT_CONFIG['ADAPTERS']['STORES'], globals(), locals(), ['adapter'], -1)
import logging
logger = logging.getLogger(__name__)
class StoresRootView(JSONRestVi... | from newt.views import JSONRestView
from common.response import json_response
from django.conf import settings
import json
store_adapter = __import__(settings.NEWT_CONFIG['ADAPTERS']['STORES'], globals(), locals(), ['adapter'], -1)
import logging
logger = logging.getLogger(__name__)
class StoresRootView(JSONRestVi... | Python | 0 |
d97bb53f74c11b654f506f7e14342e7b3582a4c4 | Fix duplicate test method names. | eliot/tests/test_api.py | eliot/tests/test_api.py | """
Tests for the public API exposed by L{eliot}.
"""
from __future__ import unicode_literals
from unittest import TestCase
from .._output import Logger
import eliot
class PublicAPITests(TestCase):
"""
Tests for the public API.
"""
def test_addDestination(self):
"""
L{eliot.addDesti... | """
Tests for the public API exposed by L{eliot}.
"""
from __future__ import unicode_literals
from unittest import TestCase
from .._output import Logger
import eliot
class PublicAPITests(TestCase):
"""
Tests for the public API.
"""
def test_addDestination(self):
"""
L{eliot.addDesti... | Python | 0.000013 |
be0b85f50b8cd4f7323d5c6def5c388c7a8fad36 | fix webhook | webhooks.py | webhooks.py | from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import os
import shutil
from episode import GitRepo, Episode
WORK_DIR = "repo"
class WebHookHandler(BaseHTTPRequestHandler):
def do_POST(self):
event_type = self.headers.get('X-Github-Event')
if event_type != 'push':
... | from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import os
import shutil
from episode import GitRepo, Episode
WORK_DIR = "repo"
class WebHookHandler(BaseHTTPRequestHandler):
def do_POST(self):
event_type = self.headers.get('X-Github-Event')
if event_type != 'push':
... | Python | 0.000017 |
4787c9e1b895b5ce0bdd0fedeb537a971fab5933 | add management command to benchmark get_direct_ccz | corehq/apps/app_manager/management/commands/benchmark_direct_ccz.py | corehq/apps/app_manager/management/commands/benchmark_direct_ccz.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import json
from django.core.management import BaseCommand
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.management.commands.benchmark_build_times import Timer
f... | Python | 0.000001 | |
db356499cf079ec9284baf16817d3c3054d8688d | Add source_added tests | tests/integration/states/test_chocolatey.py | tests/integration/states/test_chocolatey.py | # -*- coding: utf-8 -*-
"""
Tests for the Chocolatey State
"""
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
import salt.utils.platform
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.helpers imp... | # -*- coding: utf-8 -*-
"""
Tests for the Chocolatey State
"""
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
import salt.utils.platform
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.helpers imp... | Python | 0.000001 |
585317f3a03f55f6487a98446d4a9279f91714d2 | Add a test of the linearity of scalar multiplication | tests/test_vector2_scalar_multiplication.py | tests/test_vector2_scalar_multiplication.py | import pytest # type: ignore
from hypothesis import given
from hypothesis.strategies import floats
from utils import vectors
from ppb_vector import Vector2
@pytest.mark.parametrize("x, y, expected", [
(Vector2(6, 1), 0, Vector2(0, 0)),
(Vector2(6, 1), 2, Vector2(12, 2)),
(Vector2(0, 0), 3, Vector2(0, 0))... | import pytest # type: ignore
from hypothesis import given
from hypothesis.strategies import floats
from utils import vectors
from ppb_vector import Vector2
@pytest.mark.parametrize("x, y, expected", [
(Vector2(6, 1), 0, Vector2(0, 0)),
(Vector2(6, 1), 2, Vector2(12, 2)),
(Vector2(0, 0), 3, Vector2(0, 0))... | Python | 0.002828 |
cecbb5951ef806c5b4b7b6894c05e4d086730fb0 | order fy descending (newest on top) | base_ordered/ordered.py | base_ordered/ordered.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
#
# This program is free softw... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
#
# This program is free softw... | Python | 0 |
2fedc43c50bd933924046b6f79633687a452116a | bump version | src/mrfitty/__init__.py | src/mrfitty/__init__.py | __version__ = '0.12.0'
| __version__ = '0.11.0'
| Python | 0 |
f48601ceacbf9d05412aa5f45b6d4f9bb46d266e | update the script for GMC | utilities/scripts/correct_momentum_conservation.py | utilities/scripts/correct_momentum_conservation.py | #!/usr/bin/env python
import sys
from numpy import *
from os import path
def parse_data(data_line):
data = data_line.split()
data = list(map(int, data[:2])) + list(map(float, data[2:]))
return(data)
OSCAR_file_path = str(sys.argv[1])
OSCAR_file = open(OSCAR_file_path, 'r')
output_file = open('OSCAR_w_G... | #!/usr/bin/env python3
import sys
from numpy import *
from os import path
def parse_data(data_line):
data = data_line.split()
data = list(map(int, data[:2])) + list(map(float, data[2:]))
return(data)
OSCAR_file_path = str(sys.argv[1])
OSCAR_file = open(OSCAR_file_path, 'r')
output_file = open('OSCAR_w_... | Python | 0 |
f5e2e7cbb494fc111efcf4abd5c744091e9ee8aa | Fix function name error | module/submodules/graphs.py | module/submodules/graphs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
import time
from shinken.log import logger
from .metamodule import MetaModule
class GraphsMetaModule(MetaModule):
_functions = ['get_graph_uris']
_custom_log = "You should configure the module 'graphite' in your broker and the mo... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
import time
from shinken.log import logger
from .metamodule import MetaModule
class GraphsMetaModule(MetaModule):
_functions = ['get_graph_uris']
_custom_log = "You should configure the module 'graphite' in your broker and the mo... | Python | 0.002384 |
e69542c01959e7cf874c6ca1ae5c94d0c9a0ba1f | Fix tarball URL's for htslib (#5993) | var/spack/repos/builtin/packages/htslib/package.py | var/spack/repos/builtin/packages/htslib/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 |
1a2c69e95eb02010f0a72aebe2554be58db63f42 | Generate name from German title if possible | ckanext/switzerland/dcat/harvesters.py | ckanext/switzerland/dcat/harvesters.py | from ckanext.dcat.harvesters.rdf import DCATRDFHarvester
import logging
log = logging.getLogger(__name__)
class SwissDCATRDFHarvester(DCATRDFHarvester):
def info(self):
return {
'name': 'dcat_ch_rdf',
'title': 'DCAT-AP Switzerland RDF Harvester',
'description': 'Harves... | # flake8: noqa
import json
import ckan.plugins as p
import ckan.model as model
from ckanext.harvest.model import HarvestObject
from ckanext.dcat.parsers import RDFParserException, RDFParser
from ckanext.dcat.interfaces import IDCATRDFHarvester
from ckanext.dcat.harvesters.rdf import DCATRDFHarvester
import logging... | Python | 1 |
7f29770766a30bf821689960189e95526eee6bdc | print python version if using file directly, not as import | getDataRemotely.py | getDataRemotely.py | import sys
from dictAsFile_wrapper import *
def run():
hashtableName = 'hashtable.pkl'
data = {}
# use different import based on python version number:
if (sys.version_info > (3, 0)):
# python 3:
if __name__ == '__main__':
print('python 3')
import urllib.reques... | import sys
from dictAsFile_wrapper import *
def run():
hashtableName = 'hashtable.pkl'
data = {}
# use different import based on python version number:
if (sys.version_info > (3, 0)):
# python 3:
print('python 3')
import urllib.request
url = 'https://raw.githubuser... | Python | 0.000001 |
9c218079f00e9b3c7285cd94dcc7836531f722a5 | Install RMPISNOW wrapper in prefix.bin for r-snow (#16479) | var/spack/repos/builtin/packages/r-snow/package.py | var/spack/repos/builtin/packages/r-snow/package.py | # Copyright 2013-2020 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 RSnow(RPackage):
"""Support for simple parallel computing in R."""
homepage = "https:... | # Copyright 2013-2020 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 RSnow(RPackage):
"""Support for simple parallel computing in R."""
homepage = "https:... | Python | 0 |
f42744558b989f8122f67d24bf65c8514eb516cb | Use better names for generated IR files. | runac/__init__.py | runac/__init__.py | from . import tokenizer, ast, blocks, ti, specialize, codegen
from util import Error
import sys, os, subprocess, tempfile
BASE = os.path.dirname(__path__[0])
CORE_DIR = os.path.join(BASE, 'core')
TRIPLES = {
'darwin': 'x86_64-apple-darwin11.0.0',
'linux2': 'x86_64-pc-linux-gnu',
}
def tokenize(f):
return tokenize... | from . import tokenizer, ast, blocks, ti, specialize, codegen
from util import Error
import sys, os, subprocess, tempfile
BASE = os.path.dirname(__path__[0])
CORE_DIR = os.path.join(BASE, 'core')
TRIPLES = {
'darwin': 'x86_64-apple-darwin11.0.0',
'linux2': 'x86_64-pc-linux-gnu',
}
def tokenize(f):
return tokenize... | Python | 0 |
a328a1974b985eda47191748e28a69d1e521f070 | 实现FREEBUF的AJAX页面爬取的几种小爬虫-json库解析-科学方法 | freebufspider2.py | freebufspider2.py | import requests
from bs4 import BeautifulSoup
import json
for i in range(1, 20):
url = 'http://www.freebuf.com/www.freebuf.com?action=ajax_wenku&year=all&score=all&type=all&tech=0&keyword=&page=' + str(
i)
r = requests.get(url)
data = json.loads(r.text)#使用json库解析,科学的做法
soup = BeautifulSoup(data... | import requests
from bs4 import BeautifulSoup
import json
for i in range(1, 20):
url = 'http://www.freebuf.com/www.freebuf.com?action=ajax_wenku&year=all&score=all&type=all&tech=0&keyword=&page=' + str(
i)
r = requests.get(url)
data = json.loads(r.text)
soup = BeautifulSoup(data['cont'])
fo... | Python | 0 |
cd9e8c1595e0e987e2ec0067c9532a9778e64ea3 | Update test_plugin.py | logstash_plugin/tests/test_plugin.py | logstash_plugin/tests/test_plugin.py | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | Python | 0.000003 |
74a182a13bae5dde3e2b4fe604a839e5ec05e771 | load palette hoohah | cooperhewitt/swatchbook/palettes/__init__.py | cooperhewitt/swatchbook/palettes/__init__.py | def palettes():
return [
'css3',
'css4'
]
def load_palette(reference):
if not reference in palettes():
raise Exception, "Invalid palette"
# Please figure out the hoo-hah to make dynamic
# loading work (20140623/straup)
if reference == 'css3':
import css3
... | # I blame, Guido
| Python | 0.000002 |
ff99ed308edd661db7b692cb92eb3c6465843204 | Add JSON parser | pande_gas/utils/molecule_net/__init__.py | pande_gas/utils/molecule_net/__init__.py | """
Utilities for MoleculeNet.
"""
import json
import re
import xml.etree.cElementTree as et
class PcbaJsonParser(object):
"""
Parser for PubChemBioAssay JSON.
Parameters
----------
filename : str
Filename.
"""
def __init__(self, filename):
self.tree = json.load(filename)
... | """
Utilities for MoleculeNet.
"""
import re
import xml.etree.cElementTree as et
class PcbaXmlParser(object):
"""
Parser for PubChem BioAssay XML.
Parameters
----------
filename : str
Filename.
"""
def __init__(self, filename):
self.tree = et.parse(filename)
self.r... | Python | 0.000084 |
220983a4cf75f4e27f5491812de9ff04f4104510 | fix butter_bandpass | code/python/seizures/preprocessing/preprocessing.py | code/python/seizures/preprocessing/preprocessing.py | import scipy.signal as signal
def preprocess_multichannel_data(matrix,fs):
"""
:param matrix: multichannel EEG data
:param fs: sampling frequency
:return: data without mains, electrical artefacts etc
authors: Lea and Vincent
"""
n_channel,m= matrix.shape
for i in range(n_channel):
... | import scipy.signal as signal
def preprocess_multichannel_data(matrix,fs):
"""
:param matrix: multichannel EEG data
:param fs: sampling frequency
:return: data without mains, electrical artefacts etc
authors: Lea and Vincent
"""
n_channel,m= matrix.shape
for i in range(n_channel):
... | Python | 0.000004 |
4a4e56a0909d8e89d82462c846f365b0849b3cb4 | add missing import | generator/aidl.py | generator/aidl.py | #!/usr/bin/python
from eclipse2buck.generator.base_target import BaseTarget
from eclipse2buck.decorator import target
from eclipse2buck.util import util
from eclipse2buck import config
import os
class AIDL(BaseTarget):
"""
generated all aidl targets
"""
aidl_path_list = []
def __init__(self, root,... | #!/usr/bin/python
from eclipse2buck.generator.base_target import BaseTarget
from eclipse2buck.decorator import target
from eclipse2buck.util import util
from eclipse2buck import config
class AIDL(BaseTarget):
"""
generated all aidl targets
"""
aidl_path_list = []
def __init__(self, root, name):
... | Python | 0.000042 |
6cf322bbce2bfd4088cc4c5af96cd72cad86ea95 | Add aspect as a parameter of Displayer init. | manifold/infrastructure/displayer.py | manifold/infrastructure/displayer.py | import math
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.metrics import confusion_matrix
class Displayer(object):
def __init__(self, **kwargs):
self.aspect = kwargs.pop('aspect', (20, -40))
self.parameters = ', '.join(['%s: %s' % (k, str(... | import math
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.metrics import confusion_matrix
class Displayer(object):
def __init__(self, **kwargs):
self.items = []
self.parameters = ', '.join(['%s: %s' % (k, str(v)) for k, v in kwargs.items()... | Python | 0 |
da54f60def189953b9ebbd754200103668e00042 | Handle full result sets. | marshmallow_pagination/paginators.py | marshmallow_pagination/paginators.py | # -*- coding: utf-8 -*-
import abc
import math
import six
import sqlalchemy as sa
from marshmallow_sqlalchemy.convert import ModelConverter
from marshmallow_pagination import pages
converter = ModelConverter()
def convert_value(row, attr):
field = converter._get_field_class_for_property(attr.property)
valu... | # -*- coding: utf-8 -*-
import abc
import math
import six
import sqlalchemy as sa
from marshmallow_sqlalchemy.convert import ModelConverter
from marshmallow_pagination import pages
converter = ModelConverter()
def convert_value(row, attr):
field = converter._get_field_class_for_property(attr.property)
valu... | Python | 0 |
9105326cdb6ad7a6d4d23504ef36beb6303eaf65 | make offset_date type unaware | custom/opm/opm_reports/tests/case_reports.py | custom/opm/opm_reports/tests/case_reports.py | from collections import defaultdict
from datetime import datetime, date
from unittest import TestCase
from jsonobject import (JsonObject, DictProperty, DateTimeProperty,
StringProperty, IntegerProperty, BooleanProperty)
from casexml.apps.case.models import CommCareCase
from custom.opm.opm_reports.reports import S... | from collections import defaultdict
from datetime import datetime, date
from unittest import TestCase
from jsonobject import (JsonObject, DictProperty, DateTimeProperty,
StringProperty, IntegerProperty, BooleanProperty)
from casexml.apps.case.models import CommCareCase
from custom.opm.opm_reports.reports import S... | Python | 0.000047 |
ba4396f1868dad9a637ddd3cbf9e935fa8d93cf0 | print Exception error | git_downloader.py | git_downloader.py | #!/usr/bin/env python
#
import sys, os, argparse, logging, fnmatch, urllib, posixpath, urlparse, socket
from github import Github
def main(args, loglevel):
logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel)
socket.setdefaulttimeout(args.timeout)
g = Github()
with open(args.... | #!/usr/bin/env python
#
import sys, os, argparse, logging, fnmatch, urllib, posixpath, urlparse, socket
from github import Github
def main(args, loglevel):
logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel)
socket.setdefaulttimeout(args.timeout)
g = Github()
with open(args.... | Python | 0.999548 |
cadf61287b9b68af5b734b4ab2fefd9c758cfc26 | Update skiptest | data_importer/tests/test_generic_importer.py | data_importer/tests/test_generic_importer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import mock
import os
import django
from django.test import TestCase
from unittest import skipIf
from data_importer.importers.generic import GenericImporter
from data_importer.readers.xls_reader import XLSReader
from data_importer.readers.xlsx_reader import XLSXReader
from ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import mock
import os
import django
from django.test import TestCase
from unittest import skipIf
from data_importer.importers.generic import GenericImporter
from data_importer.readers.xls_reader import XLSReader
from data_importer.readers.xlsx_reader import XLSXReader
from ... | Python | 0.000001 |
6e7a20675cd66d9ca7d4a286958404198369dece | Validate ReplicationTopology data | dbaas/physical/forms/replication_topology.py | dbaas/physical/forms/replication_topology.py | # -*- coding: utf-8 -*-
from django import forms
from django.forms.widgets import SelectMultiple
#from django.forms.widgets import CheckboxSelectMultiple
from ..models import ReplicationTopology, Parameter, DatabaseInfraParameter
class ReplicationTopologyForm(forms.ModelForm):
class Meta:
model = Replica... | from django import forms
from django.forms.widgets import SelectMultiple
#from django.forms.widgets import CheckboxSelectMultiple
from ..models import ReplicationTopology, Parameter
class ReplicationTopologyForm(forms.ModelForm):
class Meta:
model = ReplicationTopology
def __init__(self, *args, **kw... | Python | 0.000001 |
1820001e6ec6960014b5e9cf23eb7a2f8b90c213 | Remove a broken test case from decorators_test | dm_control/mujoco/testing/decorators_test.py | dm_control/mujoco/testing/decorators_test.py | # Copyright 2017 The dm_control 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 agreed to i... | # Copyright 2017 The dm_control 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 agreed to i... | Python | 0.000015 |
b58d296373ed4ba75d0e6409e332e70abea76086 | add more axes labels | data/boada/analysis_all/redshifts/redshift_stats.py | data/boada/analysis_all/redshifts/redshift_stats.py | import pandas as pd
import pylab as pyl
from glob import glob
files = glob('*.csv')
for f in files:
results = pd.read_csv(f)
# good redshifts
try:
q0 = pyl.append(q0, results[results.Q == 0].r.values)
q1 = pyl.append(q1, results[results.Q == 1].r.values)
x = ~pyl.isnan(results.fibe... | import pandas as pd
import pylab as pyl
from glob import glob
files = glob('*.csv')
for f in files:
results = pd.read_csv(f)
# good redshifts
try:
q0 = pyl.append(q0, results[results.Q == 0].r.values)
q1 = pyl.append(q1, results[results.Q == 1].r.values)
x = ~pyl.isnan(results.fibe... | Python | 0 |
b8399e48872271ccac6431d9f875238ff509a03a | Increment number of JS files in test_js_load | InvenTree/InvenTree/test_views.py | InvenTree/InvenTree/test_views.py | """
Unit tests for the main web views
"""
import re
import os
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
class ViewTests(TestCase):
""" Tests for various top-level views """
username = 'test_user'
password = 'test_pass'
def setUp... | """
Unit tests for the main web views
"""
import re
import os
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
class ViewTests(TestCase):
""" Tests for various top-level views """
username = 'test_user'
password = 'test_pass'
def setUp... | Python | 0.000003 |
83b6e177fccaef7d62682c25a0e82f29bcba01e6 | Remove autofilling "GSSAPI" mechanism in hue.ini | desktop/core/src/desktop/lib/mapr_config_changer.py | desktop/core/src/desktop/lib/mapr_config_changer.py | import re
import os
MAPR_SECURITY = "MAPR-SECURITY"
SECURE = "secure"
SECURITY_ENABLED = 'security_enabled'
MECHANISM = 'mechanism'
MAPR_CLUSTERS_CONF_PATH = "/opt/mapr/conf/mapr-clusters.conf"
templates = {
MECHANISM: 'none',
SECURITY_ENABLED: 'false'
}
def read_values_from_mapr_clusters_conf():
if not os.pa... | import re
import os
GSSAPI = "GSSAPI"
MAPR_SECURITY = "MAPR-SECURITY"
KERBEROS_ENABLE = "kerberosEnable"
SECURE = "secure"
SECURITY_ENABLED = 'security_enabled'
MECHANISM = 'mechanism'
MAPR_CLUSTERS_CONF_PATH = "/opt/mapr/conf/mapr-clusters.conf"
templates = {
MECHANISM: 'none',
SECURITY_ENABLED: 'false'
}
def ... | Python | 0 |
13bf2bcbbfd079c75b84a993a86086493d2e6dee | Cleaned up output #2 | django_postgres/management/commands/sync_pgviews.py | django_postgres/management/commands/sync_pgviews.py | """Syncronise SQL Views.
"""
from django.core.management.base import BaseCommand
from django.db import models
from django_postgres.view import create_views
class Command(BaseCommand):
args = '<appname appname ...>'
help = 'Creates and Updates all SQL Views'
def handle(self, *args, **options):
""... | """Syncronise SQL Views.
"""
from django.core.management.base import BaseCommand
from django.db import models
from django_postgres.view import create_views
class Command(BaseCommand):
args = '<appname appname ...>'
help = 'Creates and Updates all SQL Views'
def handle(self, *args, **options):
""... | Python | 0.998498 |
a44d2a9239e755b9e5726521b11aca9734b89180 | Fix crashing when Authorization is not set | ereuse_devicehub/resources/account/domain.py | ereuse_devicehub/resources/account/domain.py | import base64
from bson.objectid import ObjectId
from ereuse_devicehub.exceptions import WrongCredentials, BasicError, StandardError
from ereuse_devicehub.resources.account.role import Role
from ereuse_devicehub.resources.account.settings import AccountSettings
from ereuse_devicehub.resources.domain import Domain, Res... | import base64
from bson.objectid import ObjectId
from ereuse_devicehub.exceptions import WrongCredentials, BasicError, StandardError
from ereuse_devicehub.resources.account.role import Role
from ereuse_devicehub.resources.account.settings import AccountSettings
from ereuse_devicehub.resources.domain import Domain, Res... | Python | 0.000004 |
dba78b02daa5674769cccf56b867f5266d6ec0f1 | Add voluptuous to locative (#3254) | homeassistant/components/device_tracker/locative.py | homeassistant/components/device_tracker/locative.py | """
Support for the Locative platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.locative/
"""
import logging
from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY, STATE_NOT_HOME
from homeassistant.components.http import HomeAss... | """
Support for the Locative platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.locative/
"""
import logging
from homeassistant.components.device_tracker import DOMAIN
from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY, STATE... | Python | 0.00002 |
06277ea30094ff6669537f2365b6ad9f5a19642b | Update laundry.py | fxcmminer_v1.1/fxcmminer/cleaning/laundry.py | fxcmminer_v1.1/fxcmminer/cleaning/laundry.py | from event import CleanedDataEvent
class DataCleaner(object):
"""
The DataCleaner class is the process of correcting
(or removing) corrupt or inaccurate records from a record set
and refers to identifying incomplete, incorrect, inaccurate
or irrelevant parts of the data and then replacing,
modi... | from event import CleanedDataEvent
class DataCleaner(object):
"""
Basic data cleaning
"""
def __init__(self, events_queue):
"""
"""
self.events_queue = events_queue
def _remove_duplicates(self, data):
"""
Drop any duplicates in the Datetime Index
"""... | Python | 0.000001 |
4844ba065d86fdce3f01b7b191ecc6a4ef43661e | Add autoclass directives to Visualization/__init__.py. This will enable Visualization module methods to appear in function reference. | OpenPNM/Visualization/__init__.py | OpenPNM/Visualization/__init__.py | r"""
*******************************************************************************
:mod:`OpenPNM.Visualization`: Network Visualization
*******************************************************************************
.. module:: OpenPNM.Visualization
Contents
--------
tbd
.. note::
n/a
Classes
-------
.. auto... | r"""
*******************************************************************************
:mod:`OpenPNM.Visualization`: Network Visualization
*******************************************************************************
.. module:: OpenPNM.Visualization
Contents
--------
tbd
.. note::
n/a
Import
------
>>> import ... | Python | 0.000034 |
6e6ccc8566fe90323d900fd0ebd38f45ad4d0b63 | Update TipCalculator.py | PracticePrograms/TipCalculator.py | PracticePrograms/TipCalculator.py | '''
Author : DORIAN JAVA BROWN
Version : N/A
Copyright : All Rights Reserve; You may use, distribute and modify this code.
Description : This program provides the user with options on how much tip the customer should leave the waiter/waitress
'''
import os
total = 21.49
def cls():
os.system('cls' i... | '''
Author : DORIAN JAVA BROWN
Version : N/A
Copyright : All Rights Reserve; You may use, distribute and modify this code.
Description : This program provides the user with options on how much tip the customer should leave the waiter/waitress
'''
import os
total = 21.49
def cls():
os.system('cls' i... | Python | 0 |
953ce15f2a3b2ffdc0e27d95afbe4f8cda2cdbfd | set default behavior to add datacenters | SoftLayer/CLI/image/datacenter.py | SoftLayer/CLI/image/datacenter.py | """Edit details of an image."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifier')
@click.option('--add/--remove', default=True,
help="To add or remove Datac... | """Edit details of an image."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifier')
@click.option('--add/--remove',
default=False,
help="To add ... | Python | 0 |
1c31d23dd95fb4ca8a5daaf37aaa7d75472f1d24 | fix run time error: list indices must be integers not str (#611) | src/harness/reference_models/pre_iap_filtering/pre_iap_filtering.py | src/harness/reference_models/pre_iap_filtering/pre_iap_filtering.py | # Copyright 2018 SAS Project Authors. 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 requ... | # Copyright 2018 SAS Project Authors. 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 requ... | Python | 0.000014 |
cdd28cba2c6299e18b5d5221f8d10b8649c1faed | Use numpy | tests/chainer_tests/functions_tests/array_tests/test_expand_dims.py | tests/chainer_tests/functions_tests/array_tests/test_expand_dims.py | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'in_shape': (3, 2), 'out_shape': (1, 3, 2), 'axis': 0},
{'in_shape': (3, 2), 'out_shape':... | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'in_shape': (3, 2), 'out_shape': (1, 3, 2), 'axis': 0},
{'in_shape': (3, 2), 'out_shape':... | Python | 0.00006 |
d1fa13bdf3ca7d1c4eabdaace5758d6b031ef909 | Set up the download url, which I forgot about. | exampleSettings/urls.py | exampleSettings/urls.py | from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'post.views.list', name='home'),
(r'... | from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'post.views.list', name='home'),
(r'... | Python | 0 |
5b1eefb315cd9094de8c8827e0f3a8c0eeefe95a | delete view: make sure item is closed before it is removed from storage | bepasty/views/delete.py | bepasty/views/delete.py | # Copyright: 2014 Dennis Schmalacker <github@progde.de>
# License: BSD 2-clause, see LICENSE for details.
import errno
from flask import current_app, redirect, url_for, render_template, abort
from flask.views import MethodView
from werkzeug.exceptions import NotFound
from . import blueprint
from ..utils.permissions ... | # Copyright: 2014 Dennis Schmalacker <github@progde.de>
# License: BSD 2-clause, see LICENSE for details.
import errno
from flask import current_app, redirect, url_for, render_template, abort
from flask.views import MethodView
from werkzeug.exceptions import NotFound
from . import blueprint
from ..utils.permissions ... | Python | 0 |
aa5259efac8f7fbe8e2afd263198feaaa45fc4c3 | Change test for running on Tingbot | tingbot/platform_specific/__init__.py | tingbot/platform_specific/__init__.py | import platform, os
def is_tingbot():
"""
Return True if running as a tingbot.
"""
# TB_RUN_ON_LCD is an environment variable set by tbprocessd when running tingbot apps.
return 'TB_RUN_ON_LCD' in os.environ
if platform.system() == 'Darwin':
from osx import fixup_env, create_main_surface, regi... | import platform
def is_tingbot():
"""return True if running as a tingbot. We can update this function to be more smart in future"""
return platform.machine().startswith('armv71')
if platform.system() == 'Darwin':
from osx import fixup_env, create_main_surface, register_button_callback
elif is_tingbot():
... | Python | 0 |
6f0676877f5c23c0e6d04422cb8365e16958eb82 | document potential for streaming | camerav4.py | camerav4.py | import picamera
from picamera import PiCamera
import time
from datetime import datetime
import os.path
from subprocess32 import Popen
print "\nSecurity Camera Logger v3 | Ben Broce & William Hampton\n\n"
print "Streams video to vids/vidstream.h264 | Captures to pics/[timestamp].jpg"
print "Ctrl-C quits.\n\n"
stream =... | import picamera
from picamera import PiCamera
import time
from datetime import datetime
import os.path
from subprocess32 import Popen
print "\nSecurity Camera Logger v3 | Ben Broce & William Hampton\n\n"
print "Streams video to vids/vidstream.h264 | Captures to pics/[timestamp].jpg"
print "Ctrl-C quits.\n\n"
stream =... | Python | 0 |
37e2813d2b972100e7a562fe99cde72c99f5a544 | Add handler to create token when a user is created | popit/signals/handlers.py | popit/signals/handlers.py | from django.db.models.signals import pre_delete
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.contrib.auth.models import User
from popit.models import Person
from popit.models import Organization
from popit.models import Membership
from popit.models import Post
from pop... | # TODO: Implement for each
from django.db.models.signals import pre_delete
from django.db.models.signals import post_save
from django.dispatch import receiver
from popit.models import Person
from popit.models import Organization
from popit.models import Membership
from popit.models import Post
from popit.serializers im... | Python | 0 |
48a30aade7e606e671db44e8ee69092c0e67b363 | Complete lc051_n_queens.py | lc051_n_queens.py | lc051_n_queens.py | """Leetcode 51. N-Queens.
Hard.
URL: https://leetcode.com/problems/n-queens/
The n-queens puzzle is the problem of placing n queens on an nxn chessboard
such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board confi... | """Leetcode 51. N-Queens.
Hard.
URL: https://leetcode.com/problems/n-queens/
The n-queens puzzle is the problem of placing n queens on an nxn chessboard
such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board confi... | Python | 0.99916 |
16c1ae09e0288036aae87eb4337c24b23b1e6638 | Clean up some unused imports and comments | classify.py | classify.py | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.ensemble import RandomForestRegressor
from sklearn.pipeline import Pipeline
import numpy as np
import json
import sys
from analyze import Analyzer # for some train data labelling
def main(argv):
group = argv[0] if len(argv) > 0 else "id"
... | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.neighbors import KNeighborsRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.pipeline import Pipeline
import numpy as np
import json
import sys
import time
from analyze import Analyzer # for some train data labelling
def m... | Python | 0 |
4f3d1e90ec4af618ada415f53ddd9eec42bafb38 | Indent with 4 spaces, not 3 | wafer/talks/tests/test_wafer_basic_talks.py | wafer/talks/tests/test_wafer_basic_talks.py | # This tests the very basic talk stuff, to ensure some levels of sanity
def test_add_talk():
"""Create a user and add a talk to it"""
from django.contrib.auth.models import User
from wafer.talks.models import Talks
user = User.objects.create_user('john', 'best@wafer.test', 'johnpassword')
talk = ... | # This tests the very basic talk stuff, to ensure some levels of sanity
def test_add_talk():
"""Create a user and add a talk to it"""
from django.contrib.auth.models import User
from wafer.talks.models import Talks
user = User.objects.create_user('john', 'best@wafer.test', 'johnpassword')
talk = Talks... | Python | 0.998158 |
82f648557d3c14568811038a63d766d3d84a9b79 | Fix dataverse upload bug | waterbutler/providers/dataverse/provider.py | waterbutler/providers/dataverse/provider.py | import asyncio
import http
import tempfile
import xmltodict
from waterbutler.core import streams
from waterbutler.core import provider
from waterbutler.core import exceptions
from waterbutler.providers.dataverse import settings
from waterbutler.providers.dataverse.metadata import DataverseDatasetMetadata
from waterbu... | import asyncio
import http
import tempfile
import xmltodict
from waterbutler.core import streams
from waterbutler.core import provider
from waterbutler.core import exceptions
from waterbutler.providers.dataverse import settings
from waterbutler.providers.dataverse.metadata import DataverseDatasetMetadata
from waterbu... | Python | 0.000001 |
7b0a6d27389f8e4abde77b2ed76dac795c33cfab | Use url_for | demo/app.py | demo/app.py | import flask
from flask import request
from markupsafe import Markup
import diffhtml
app = flask.Flask('Diff-HTML Demo')
DEFAULT_A = """
I am the very model of a modern Major-General,
I've information vegetable, animal, and mineral,
I know the kings of England, and I quote the fights historical,
From Marathon to ... | import flask
from flask import request
from markupsafe import Markup
import diffhtml
app = flask.Flask('Diff-HTML Demo')
DEFAULT_A = """
I am the very model of a modern Major-General,
I've information vegetable, animal, and mineral,
I know the kings of England, and I quote the fights historical,
From Marathon to ... | Python | 0.000354 |
dd249ca665f21f574d9ff992e0cd3e78433c7fa7 | Use printf-style String Formatting for output | sanic/response.py | sanic/response.py | import ujson
STATUS_CODES = {
200: b'OK',
400: b'Bad Request',
401: b'Unauthorized',
402: b'Payment Required',
403: b'Forbidden',
404: b'Not Found',
405: b'Method Not Allowed',
500: b'Internal Server Error',
501: b'Not Implemented',
502: b'Bad Gateway',
503: b'S... | import ujson
STATUS_CODES = {
200: 'OK',
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unav... | Python | 0.000006 |
68b2e1cb5a914d408761229bd27677e80967f5ff | Remove unused import. | hashbrown/management/commands/switches.py | hashbrown/management/commands/switches.py | from django.core.management.base import BaseCommand
from django.utils.six.moves import input
from hashbrown.models import Switch
from hashbrown.utils import SETTINGS_KEY, is_active, get_defaults
class Command(BaseCommand):
help = 'Creates / deletes feature switches in the database'
def add_arguments(self, p... | from optparse import make_option
from django.core.management.base import BaseCommand
from django.utils.six.moves import input
from hashbrown.models import Switch
from hashbrown.utils import SETTINGS_KEY, is_active, get_defaults
class Command(BaseCommand):
help = 'Creates / deletes feature switches in the databa... | Python | 0 |
ac85a3ce64ea815fd3530085c085e384cf8269fb | Use pydeconz interface controls for button platform (#74654) | homeassistant/components/deconz/button.py | homeassistant/components/deconz/button.py | """Support for deCONZ buttons."""
from __future__ import annotations
from dataclasses import dataclass
from pydeconz.models.event import EventType
from pydeconz.models.scene import Scene as PydeconzScene
from homeassistant.components.button import (
DOMAIN,
ButtonEntity,
ButtonEntityDescription,
)
from ... | """Support for deCONZ buttons."""
from __future__ import annotations
from dataclasses import dataclass
from pydeconz.models.event import EventType
from pydeconz.models.scene import Scene as PydeconzScene
from homeassistant.components.button import (
DOMAIN,
ButtonEntity,
ButtonEntityDescription,
)
from ... | Python | 0 |
9b529f2ba00c4ee76b571ef1c27faada89e4bc29 | Add full compatibility functions. | alchy/_compat.py | alchy/_compat.py | #pylint: skip-file
'''Python 2/3 compatibility
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
Borrowed from https://github.com/mitsuhiko/flask/blob/master/flask/_compat.py
'''
import sys
PY2 = sys.version_info[0] ==... | #pylint: skip-file
'''Python 2/3 compatibility
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
Borrowed from https://github.com/mitsuhiko/flask/blob/master/flask/_compat.py
'''
import sys
PY2 = sys.version_info[0] ==... | Python | 0 |
114d7bc6b45d18f528a7ed5c12e1938e35efb93c | Update hash_db_password.py | bin/hash_db_password.py | bin/hash_db_password.py | import sys
from werkzeug.security import generate_password_hash
from flask_appbuilder.security.models import User
try:
from app import app, db
except:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
if len(sys.argv) < 2:
print "Without typical app structure use parameter t... | import sys
from werkzeug.security import generate_password_hash
from flask_appbuilder.security.models import User
try:
from app import app, db
except:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
if len(sys.argv) < 2:
print "Without typical app structure use parameter t... | Python | 0.000071 |
3224a95d79f6e3166e235f4cfc857a48d1b17c52 | Revise docstring: memoization | alg_fibonacci.py | alg_fibonacci.py | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get the nth number of Fibonacci series, Fn, by recursion.
-... | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get the nth number of Fibonacci series, Fn, by recursion.
-... | Python | 0.998763 |
858e84f336f76a1e65b730834ad8ffb346ee6b0f | fix logger singleton to work with pyjd | examples/mail/Logger.py | examples/mail/Logger.py | from pyjamas.ui.Grid import Grid
_logger = None
class LoggerCls(Grid):
def __init__(self):
Grid.__init__(self)
self.targets=[]
self.targets.append("app")
#self.targets.append("ui")
self.resize(len(self.targets)+1, 2)
self.setBorderWidth("1px")
self.counte... | from pyjamas.ui.Grid import Grid
_logger = None
class Logger(Grid):
def __new__(cls):
global _logger
# make sure there is only one instance of this class
if _logger:
return _logger
_logger = Grid.__new__(cls)
return _logger
def __init__(self, target="", mes... | Python | 0.000007 |
f10dcd822f72e86d0eb0071acf7d38e81cfe32da | Add a blank line | examples/mnist/mnist.py | examples/mnist/mnist.py | import logging
import qnd
import tensorflow as tf
logging.getLogger().setLevel(logging.INFO)
qnd.add_flag("use_eval_input_fn", action="store_true")
qnd.add_flag("use_model_fn_ops", action="store_true")
def read_file(filename_queue):
_, serialized = tf.TFRecordReader().read(filename_queue)
scalar_feature ... | import logging
import qnd
import tensorflow as tf
logging.getLogger().setLevel(logging.INFO)
qnd.add_flag("use_eval_input_fn", action="store_true")
qnd.add_flag("use_model_fn_ops", action="store_true")
def read_file(filename_queue):
_, serialized = tf.TFRecordReader().read(filename_queue)
scalar_feature ... | Python | 1 |
35d6d780bddf72ab5ff216a7603bd89f980c8deb | Bump version | libgrabsite/__init__.py | libgrabsite/__init__.py | __version__ = '0.4.1'
| __version__ = '0.4.0'
| Python | 0 |
e511da2cb7b73891f26b93e684d9fba80042f3cd | fix syntax | bin/redis_app_update.py | bin/redis_app_update.py | import json
import sys
import redis
r_server = redis.StrictRedis('127.0.0.1', db=2)
app_key = "apps"
app_info = json.loads(r_server.get(app_key))
app_name = sys.argv[1]
app_port = sys.argv[2]
app_namespace = sys.argv[3]
app_service_name = sys.argv[4]
check = False
for app in app_info:
if app["name"] == app_name:... | import json
import sys
import redis
r_server = redis.StrictRedis('127.0.0.1', db=2)
app_key = "apps"
app_info = json.loads(r_server.get(app_key))
app_name = sys.argv[1]
app_port = sys.argv[2]
app_namespace = sys.argv[3]
app_service_name = sys.argv[4]
check = False
for app in app_info:
if app["name"] == app_name:... | Python | 0.000023 |
47dff0bd0c7d4be641268845d70d08228a621108 | Make players moving more smoothly, add ability for recursion | Lesson5/MazeGame/Maze.py | Lesson5/MazeGame/Maze.py | import time
class Maze(object):
def __init__(self, map, mx, my):
self.map = []
self.width = 0
self.mx = mx
self.my = my
for y in range(0, len(map)):
s = map[y]
self.width = max(self.width, len(s))
ls = list(s)
if len(ls)>0:
... | import time
class Maze(object):
def __init__(self, map, mx, my):
self.map = []
self.width = 0
self.mx = mx
self.my = my
for y in range(0, len(map)):
s = map[y]
self.width = max(self.width, len(s))
ls = list(s)
if len(ls)>0:
... | Python | 0.000001 |
0d68fbaef300c53db407f6296c00e493e4b040bf | use xdg-email by default, fallback to xdg-open + mailto uri | plyer/platforms/linux/email.py | plyer/platforms/linux/email.py | import subprocess
from urllib import quote
from plyer.facades import Email
class LinuxEmail(Email):
def _send(self, **kwargs):
recipient = kwargs.get('recipient')
subject = kwargs.get('subject')
text = kwargs.get('text')
create_chooser = kwargs.get('create_chooser')
uri = "... | import subprocess
from urllib import quote
from plyer.facades import Email
class LinuxEmail(Email):
def _send(self, **kwargs):
recipient = kwargs.get('recipient')
subject = kwargs.get('subject')
text = kwargs.get('text')
create_chooser = kwargs.get('create_chooser')
uri = "... | Python | 0 |
447a7c56401dce19f5bdd412e5f66ba40180b665 | refactor take_catty_corner to use parse_analysis | OnStage/computer_dais.py | OnStage/computer_dais.py | from player_chair import Player
class Computer(Player):
name = 'computer'
def choose(self, board):
options = self.get_legal_moves(board)
win_chance = self.take_win_chances(options, board)
center = self.take_the_center(options)
catty_corner = self.take_catty_corner(options, boa... | from player_chair import Player
class Computer(Player):
name = 'computer'
def choose(self, board):
options = self.get_legal_moves(board)
win_chance = self.take_win_chances(options, board)
center = self.take_the_center(options)
catty_corner = self.take_catty_corner(options, boa... | Python | 0.000018 |
8fb201b866c0eabc99c370cf3ccc993d2de06264 | Update version 0.10.1 | src/iteration_utilities/__init__.py | src/iteration_utilities/__init__.py | # Licensed under Apache License Version 2.0 - see LICENSE
"""Utilities based on Pythons iterators and generators."""
from ._iteration_utilities import *
from ._convenience import *
from ._recipes import *
from ._additional_recipes import *
from ._classes import *
__version__ = '0.10.1'
| # Licensed under Apache License Version 2.0 - see LICENSE
"""Utilities based on Pythons iterators and generators."""
from ._iteration_utilities import *
from ._convenience import *
from ._recipes import *
from ._additional_recipes import *
from ._classes import *
__version__ = '0.10.0'
| Python | 0.000001 |
ffa551d8e4519005791f42bb2862f0411c54ced3 | Update projectfiles_unchanged script | projectfiles_unchanged.py | projectfiles_unchanged.py | #!/usr/bin/env python3
#
# This script is used on Linux, OS X and Windows.
# Python 3 required.
# Returns 0 if project files are unchanged and 1 else.
#
# Script version: 3
import os
import glob
import hashlib
import sys
matches = []
tmp_file = "projectfiles.md5.tmp"
exlude_dirs = set(['.git', 'docs'])
def get_subdi... | # version: 2
import os
import glob
import hashlib
import sys
matches = []
exlude_dirs = set(['.git', 'docs'])
def get_subdirs(path):
return set([name for name in os.listdir(path)
if os.path.isdir(os.path.join(path, name))])
def find_in(path):
# print(path)
out = []
out += glob.glob(path + "/... | Python | 0.000001 |
bbe43817fdb7d60b5f9cfbcda858fadd4ad88304 | Update create_img_item.py | Logic/create_img_item.py | Logic/create_img_item.py | import tkinter as tk
from PIL import ImageTk
from PIL import Image
from urllib.request import urlopen
import io
import base64
class CardImage:
def __init__(self):
self.Heart_Suit = list()
self.Diamond_Suit = list()
self.Club_Suit = list()
self.Spade_Suit = list()
... | import tkinter as tk
from PIL import ImageTk
from PIL import Image
class CardImage:
def __init__(self):
self.Heart_Suit = list()
self.Diamond_Suit = list()
self.Club_Suit = list()
self.Spade_Suit = list()
# Store created image items into list - Heart
for... | Python | 0.000003 |
4e62d7d9514449be5afc5a27b15726a254077e89 | Remove dangling argument | MachineSettingsAction.py | MachineSettingsAction.py | from cura.MachineAction import MachineAction
import cura.Settings.CuraContainerRegistry
from UM.i18n import i18nCatalog
from UM.Settings.DefinitionContainer import DefinitionContainer
from UM.Application import Application
from PyQt5.QtCore import pyqtSlot, QObject
catalog = i18nCatalog("cura")
class MachineSetti... | from cura.MachineAction import MachineAction
import cura.Settings.CuraContainerRegistry
from UM.i18n import i18nCatalog
from UM.Settings.DefinitionContainer import DefinitionContainer
from UM.Application import Application
from PyQt5.QtCore import pyqtSlot, QObject
catalog = i18nCatalog("cura")
class MachineSetti... | Python | 0.000021 |
2e071c0e37fac657955de70fb7193b3e46ba2aef | Update subscribe_speakers_to_talks.py | p3/management/commands/subscribe_speakers_to_talks.py | p3/management/commands/subscribe_speakers_to_talks.py | # -*- coding: UTF-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth import get_user_model
from conference import models as cmodels
from hcomments import models as hmodels
info = get_user_model().objects.get(email='info@pycon.it')
class Command(BaseCommand):
def handl... | # -*- coding: UTF-8 -*-
from django.core.management.base import BaseCommand, CommandError
from conference import models as cmodels
from hcomments import models as hmodels
class Command(BaseCommand):
def handle(self, *args, **options):
try:
conf = args[0]
except IndexError:
r... | Python | 0 |
069100c9f4a117c76403567fd3862f0139d701bb | converted power plot into plotnine | power_ranker/web/power_plot.py | power_ranker/web/power_plot.py | #!/usr/bin/env python
"""Create box-plot of power rankings vs points scored"""
import logging
from pathlib import Path
import pandas as pd
from plotnine import *
import warnings
__author__ = 'Ryne Carbone'
logger = logging.getLogger(__name__)
def get_team_scores(df_schedule, team, week):
"""Get all scores for a... | #!/usr/bin/env python
"""Create boxplot of power rankings vs points scored"""
import logging
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
__author__ = 'Ryne Carbone'
logger = logging.getLogger(__name__)
#_____________________________________
def make_power_plot(teams, year, week):
... | Python | 0.999989 |
50266b417208f562e7fe430d5ab2906b56c323ca | remove alpha bleeding debug | PyTexturePacker/Utils.py | PyTexturePacker/Utils.py | # -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
Huang Quanyong (wo1fSea)
quanyongh@foxmail.com
Date:
2016/10/19
Description:
Utils.py
----------------------------------------------------------------------------"""
SUPPORTED_IMAGE_FORMAT = ... | # -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
Huang Quanyong (wo1fSea)
quanyongh@foxmail.com
Date:
2016/10/19
Description:
Utils.py
----------------------------------------------------------------------------"""
SUPPORTED_IMAGE_FORMAT = ... | Python | 0 |
ea245f90cf0fb18cc0894d4b959ce7c3a75cf0c5 | align librispeech | SCT/benchmark_aligner.py | SCT/benchmark_aligner.py | import sys
import shutil, os
sys.path.insert(0, os.path.expanduser('~/Montreal-Forced-Aligner'))
import time
import logging
import platform
import csv
import statistics
from datetime import datetime
from aligner.command_line.train_and_align import align_corpus, align_corpus_no_dict
corpus_dir = '/media/share/dataset... | import sys
import shutil, os
sys.path.insert(0, os.path.expanduser('~/Montreal-Forced-Aligner'))
import time
import logging
import platform
import csv
import statistics
from datetime import datetime
from aligner.command_line.train_and_align import align_corpus, align_corpus_no_dict
#corpus_dir = '/media/share/datase... | Python | 0.998401 |
843121f8c0e4c0f2a533540633c62060bb676ea1 | remove unnecessary dependency | _unittests/ut_xmlhelper/test_xml_iterator.py | _unittests/ut_xmlhelper/test_xml_iterator.py | #-*- coding: utf-8 -*-
"""
@brief test log(time=20s)
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if p... | #-*- coding: utf-8 -*-
"""
@brief test log(time=20s)
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if p... | Python | 0.000413 |
35c5fd2606682827e43f707400d726f84f41104a | Fix for issue 11. | abusehelper/core/opts.py | abusehelper/core/opts.py | import os
import sys
import inspect
from optparse import OptionParser
from ConfigParser import SafeConfigParser
def long_name(key):
return key.replace("_", "-").lower()
def action_and_type(default):
if isinstance(default, bool):
if default:
return "store_false", None
return "store_... | import os
import sys
import inspect
from optparse import OptionParser
from ConfigParser import SafeConfigParser
def long_name(key):
return key.replace("_", "-").lower()
def action_and_type(default):
if isinstance(default, bool):
if default:
return "store_false", None
return "store_... | Python | 0 |
78dd9bb220a8e1a03b51b801e023e4401a351892 | Support animated pngs | gif_split/views.py | gif_split/views.py | import os
import posixpath
from cStringIO import StringIO
import logging
import requests
from PIL import Image, ImageSequence
from paste.httpheaders import CONTENT_DISPOSITION
from pyramid.response import FileIter, FileResponse
from pyramid.view import view_config
from pyramid_duh import argify
LOG = logging.getLogg... | import os
import posixpath
from cStringIO import StringIO
import logging
import requests
from PIL import Image, ImageSequence
from paste.httpheaders import CONTENT_DISPOSITION
from pyramid.response import FileIter, FileResponse
from pyramid.view import view_config
from pyramid_duh import argify
LOG = logging.getLogg... | Python | 0 |
eafe5c77a05d0f6d24bfb61c2be3a7d46c411b25 | add new projections. | examples/plot_tissot.py | examples/plot_tissot.py | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import __version__ as basemap_version
# Tissot's Indicatrix (http://en.wikipedia.org/wiki/Tissot's_Indicatrix).
# These diagrams illustrate the distortion inherent in all map projections.
# In confor... | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import __version__ as basemap_version
# Tissot's Indicatrix (http://en.wikipedia.org/wiki/Tissot's_Indicatrix).
# These diagrams illustrate the distortion inherent in all map projections.
# In confor... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.