code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
"""Indexer objects for computing start/end window bounds for rolling operations"""
from __future__ import annotations
from datetime import timedelta
import numpy as np
from pandas._libs.window.indexers import calculate_variable_window_bounds
from pandas.util._decorators import Appender
from pandas.core.dtypes.commo... | pandas-dev/pandas | pandas/core/indexers/objects.py | Python | bsd-3-clause | 12,816 |
# Copyright 2017 The Cobalt 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 required by applicable ... | youtube/cobalt | cobalt/bindings/path_generator.py | Python | bsd-3-clause | 7,751 |
# Authors: Lukas Breuer <l.breuer@fz-juelich.de>
# Juergen Dammers <j.dammers@fz-juelich.de>
# Denis A. Engeman <denis.engemann@gemail.com>
#
# License: BSD (3-clause)
import math
import numpy as np
from ..utils import logger, verbose, check_random_state, random_permutation
@verbose
def infomax(d... | jniediek/mne-python | mne/preprocessing/infomax_.py | Python | bsd-3-clause | 11,854 |
from django.conf.urls import url
from . import views
urlpatterns = [ # pylint:disable=invalid-name
url(r'^status$', views.Control.as_view()),
url(r'^status/(?P<group>([0-9]))$', views.Control.as_view()),
url(r'^control/(?P<command>([a-z_-]+))/(?P<group>([0-9]))$',
views.Control.as_view()),
url... | ojarva/home-info-display | homedisplay/control_milight/urls.py | Python | bsd-3-clause | 663 |
# -*- coding: utf-8 -*-
"""
All known information on metadata is exposed in ``gmusicapi.protocol.metadata.md_expectations``.
This holds a mapping of *name* to *Expectation*, where *Expectation* has
the following fields:
*name*
key name in the song dictionary (equal to the *name* keying ``md_expectations``).
*type... | nvbn/Unofficial-Google-Music-API | gmusicapi/protocol/metadata.py | Python | bsd-3-clause | 8,707 |
from base import CppBase
class DynamicLib(CppBase):
pass
| daVinci1980/antebuild | internals/specs/cpp/dynlib.py | Python | bsd-3-clause | 63 |
# -*- coding: utf-8 -*-
import api, api.sx as sx, api.flt as flt, points, rssg
from api.bottle import *
from config import config
CONFIG = ''
def allstart():
ip=request.headers.get('X-Real-Ip') or request.environ.get('REMOTE_ADDR')
local.r = sx.mydict(ua=request.headers.get('User-Agent'),ip=ip,kuk=sx.mydict(... | 6vasia/ii-base | iitpl/__init__.py | Python | bsd-3-clause | 3,786 |
from setuptools import setup
def setup_package():
# PyPi doesn't accept markdown as HTML output for long_description
# Pypandoc is only required for uploading the metadata to PyPi and not installing it by the user
# Try to covert Mardown to RST file for long_description
try:
import pypandoc
... | FloBay/PyOmics | setup.py | Python | bsd-3-clause | 1,788 |
from django.contrib.auth.middleware import RemoteUserMiddleware
from django.conf import settings
import os
#This middleware adds header REMOTE_USER with current REMOTE_USER from settings to every request.
#This is required when running app with uwsgi locally (with runserver this is unnecessary)
#In production, when FA... | futurice/schedule | schedulesite/middleware.py | Python | bsd-3-clause | 659 |
from seleniumhelpers import SeleniumTestCase
from seleniumhelpers import get_default_timeout
from seleniumhelpers import get_setting_with_envfallback
| espenak/django_seleniumhelpers | seleniumhelpers/__init__.py | Python | bsd-3-clause | 150 |
# Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.
""" JIT
The JIT module provides *experimental* support to to JIT (just in time) compile C++ code and call it during the
simulation. Compiled C++ code will execute... | joaander/hoomd-blue | hoomd/jit/__init__.py | Python | bsd-3-clause | 703 |
"""
alters the ColanderAlchemy generated schema to add additional display options including:
- Removing the top level title (ColanderAlchemy outputs a schema with a name at the top of every form).
- Removing items not on the specified page (based on attributes on schema nodes).
- Allowing form elements to be requir... | jcu-eresearch/TDH-rich-data-capture | jcudc24provisioning/controllers/ca_schema_scripts.py | Python | bsd-3-clause | 11,701 |
from django.contrib.contenttypes.models import ContentType
from lfs.core.utils import import_symbol
from lfs.criteria.models import Criterion
import logging
logger = logging.getLogger(__name__)
# DEPRECATED 0.8
def is_valid(request, object, product=None):
"""
Returns True if the given object is valid. This ... | diefenbach/django-lfs | lfs/criteria/utils.py | Python | bsd-3-clause | 3,002 |
import unittest
import sys
import os
sys.path.append('bin')
from umdinst import wrap
class TestRunProgram(unittest.TestCase):
def setUp(self):
self.tempfilename = 'emptyfile' # This is in createfile.sh
self.failIf(os.path.exists(self.tempfilename))
# Find the "touch" program
if os.path.exists('... | lorin/umdinst | test/testrunprogram.py | Python | bsd-3-clause | 1,972 |
import numpy as np
import math
def get_patches(mat, patch_size=(4,4)):
if mat.ndim == 1:
dim = math.sqrt(mat.shape[0])
mat.reshape((dim, dim))
mat_rows = mat.shape[0]
mat_cols = mat.shape[1]
patches = None
for i in xrange(mat_rows / patch_size[0]):
for j in xrange(mat_cols... | caglar/Arcade-Universe | arcade_universe/tests/patches_matrix.py | Python | bsd-3-clause | 858 |
# Print the version splitted in three components
import sys
verfile = sys.argv[1]
f = open(verfile)
version = f.read()
l = [a[0] for a in version.split('.') if a[0] in '0123456789']
# If no revision, '0' is added
if len(l) == 2:
l.append('0')
for i in l:
print i,
f.close()
| cpcloud/PyTables | mswindows/get_pytables_version.py | Python | bsd-3-clause | 300 |
# Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.
R"""DEM pair potentials.
"""
import hoomd
import hoomd.md
import hoomd.md.nlist as nl
from math import sqrt
import json
from hoomd.dem import _dem
from hoomd.de... | joaander/hoomd-blue | hoomd/dem/pair.py | Python | bsd-3-clause | 15,876 |
from setuptools import setup
setup(
name='uganda_common',
version='0.1',
license="BSD",
install_requires = ["rapidsms"],
description='A suite of utility functions for Uganda RSMS deployments.',
long_description='',
author='UNICEF Uganda T4D',
author_email='mossplix@gmail.com',
ur... | unicefuganda/edtrac | edtrac_project/rapidsms_uganda_common/setup.py | Python | bsd-3-clause | 845 |
# -*- coding: utf-8 -*-
import unittest
from eduid_webapp.email.helpers import EmailMsg
class MessagesTests(unittest.TestCase):
def test_messages(self):
""""""
self.assertEqual(EmailMsg.missing.value, 'emails.missing')
self.assertEqual(EmailMsg.dupe.value, 'emails.duplicated')
se... | SUNET/eduid-webapp | src/eduid_webapp/email/tests/test_msgs.py | Python | bsd-3-clause | 1,493 |
# -*- coding: utf-8 -*-
import logging
import threading
from midas.compat import HTTPError
from midas.compat import Queue
from midas.crunchbase_company import CompanyList
import midas.scripts
class FetchCrunchbaseCompanies(midas.scripts.MDCommand):
"""
Crawl the companies information from crunchbase.com an... | fuzzy-id/midas | midas/scripts/fetch_crunchbase_companies.py | Python | bsd-3-clause | 2,306 |
# Copyright (c) 2012-2013 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... | lokeshjindal15/gem5_transform | configs/common/Simulation.py | Python | bsd-3-clause | 21,327 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..base import MRTrix3Base
def test_MRTrix3Base_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault... | mick-d/nipype | nipype/interfaces/mrtrix3/tests/test_auto_MRTrix3Base.py | Python | bsd-3-clause | 620 |
# Copyright 2014 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... | flgiordano/netcash | +/google-cloud-sdk/lib/surface/bigquery/__init__.py | Python | bsd-3-clause | 2,500 |
import time
from copy import deepcopy
from decorator import decorator
from collections import Iterable
import inspect
import ethereum.blocks
from ethereum.utils import (is_numeric, is_string, int_to_big_endian, big_endian_to_int,
encode_hex, decode_hex, sha3, zpad)
import ethereum.slogging a... | heikoheiko/pyethapp | pyethapp/jsonrpc.py | Python | bsd-3-clause | 41,771 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
from devpi_common.request import new_requests_session
from devpi_slack import __version__
def devpiserver_indexconfig_defaults():
return {"slack_icon": None, "slack_hook": None, "slack_user": None}
def devpiserver_on_upload... | innoteq/devpi-slack | devpi_slack/main.py | Python | bsd-3-clause | 1,761 |
from tempfile import gettempdir
from os.path import join
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DEBUG = False
TEMPLATE_DEBUG = DEBUG
DISABLE_CACHE_TEMPLATE = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': join(gettempdir(), 'ella... | ella/ella-newman | test_newman/settings/config.py | Python | bsd-3-clause | 1,071 |
"""Seqan Doc Links for Trac.
Version 0.1.
Copyright (C) 2010 Manuel Holtgrewe
Install by copying this file into the plugins directory of your trac
work directory. In your trac.ini, you can use something like this
(the following also shows the defaults).
[seqan_doc_links]
prefix = seqan
base_url = http://www.... | h-2/seqan | misc/trac_plugins/DocLinks/doc_links/macro.py | Python | bsd-3-clause | 7,207 |
####
#### Setup gross testing environment.
####
#import time
from behave_core.environment import start_browser, define_target, quit_browser
from behave import *
## Run this before anything else.
def before_all(context):
#pass
start_browser(context)
define_target(context)
#time.sleep(10)
## Do thi... | berkeleybop/behave_core | tests/environment.py | Python | bsd-3-clause | 411 |
#!/usr/bin/env conda-execute
# conda execute
# env:
# - python 2.7.*
# - conda-smithy
# - pygithub 1.*
# - six
# - conda-build
# channels:
# - conda-forge
# run_with: python
from __future__ import print_function
import argparse
import collections
import os
import six
from github import Github
import github
im... | conda-forge/conda-forge.github.io | scripts/update_teams.py | Python | bsd-3-clause | 4,482 |
server_module = 'txtemplates.echo'
backend_options = [{}]
backend_ids = ['default']
full_server_options = [({}, {})]
full_server_ids = ['default']
# vim: set ft=python sw=4 et spell spelllang=en:
| mdrohmann/txtemplates | tests/echo/conftest.py | Python | bsd-3-clause | 199 |
#
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pyasn1.sf.net/license.html
#
from pyasn1.type import univ
from pyasn1.codec.ber import decoder
from pyasn1.compat.octets import oct2int
from pyasn1 import error
class BooleanDecoder(decoder.AbstractSim... | filippog/pyasn1 | pyasn1/codec/cer/decoder.py | Python | bsd-3-clause | 1,400 |
#
# Collective Knowledge (individual environment - setup)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
##############################################################################
# setup envir... | ctuning/ck-env | soft/plugin.openme.ctuning/customize.py | Python | bsd-3-clause | 2,895 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import date
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http import Http404
import pytest
from millionmilestogether.models import Child, Image
import millionmilestogether.... | dominicrodger/millionmilestogether | tests/viewtests/images/test_detail.py | Python | bsd-3-clause | 3,901 |
#!/usr/bin/python
'''
This file contains all custom Jinja2 filters.
Following the template below, new filters can be added here
and will be automatically registered.
'''
import flask
import jinja2
from jinja2 import Markup
# If the filter is to return HTML code and you don't want it autmatically
# escaped, return t... | demitri/DtU_api | dtu-api/dtu_api/jinja_filters.py | Python | bsd-3-clause | 901 |
from simulation import *
| krassowski/basic-particle-simulator | simulator/__init__.py | Python | bsd-3-clause | 25 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | oesteban/niworkflows | niworkflows/utils/tests/test_misc.py | Python | bsd-3-clause | 2,459 |
#!/usr/bin/env python
"""Runs the testing protocol for a given dataset, model, and NMS methods.
Can either run as a single process or distributed using celery."""
import celery
from nyc3dcars import SESSION, Photo, Model
import scores
import logging
import argparse
from detect import detect
from geo_rescore im... | kmatzen/nyc3dcars-toolkit | test.py | Python | bsd-3-clause | 1,777 |
import warnings
import numpy as np
from scipy import linalg
import links
import families
# Function for fast WLS
def wls(X, y, w, method='cholesky'):
"""
Computes WLS regression of y on X with weights w.
Can use Cholesky or QR decomposition.
The 'cholesky' method is extremely fast as it dire... | awblocker/glm | lib/glm/glm.py | Python | bsd-3-clause | 11,500 |
from PHPUnitKit.tests import unittest
from PHPUnitKit.plugin import is_valid_php_version_file_version
class TestIsValidPhpVersionFileVersion(unittest.TestCase):
def test_invalid_values(self):
self.assertFalse(is_valid_php_version_file_version(''))
self.assertFalse(is_valid_php_version_file_versi... | gerardroche/sublime-phpunit | tests/test_is_valid_php_version_file_version.py | Python | bsd-3-clause | 3,218 |
from __future__ import division
from time import sleep, time
from threading import Event
from collections import deque
from RPi import GPIO
from w1thermsensor import W1ThermSensor
from .devices import GPIODeviceError, GPIODevice, GPIOThread
class InputDeviceError(GPIODeviceError):
pass
class InputDevice(GPIO... | agiledata/python-gpiozero | gpiozero/input_devices.py | Python | bsd-3-clause | 5,990 |
#!/usr/bin/env python
# Copyright 2017 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.
"""Writes a .json file with the per-apk details for an incremental install."""
import argparse
import json
import os
import sys
sys.... | youtube/cobalt | build/android/incremental_install/write_installer_json.py | Python | bsd-3-clause | 2,202 |
from __future__ import annotations
import procrunner
def test_run(dials_data, tmp_path):
procrunner.run(
(
"dials.plot_reflections",
dials_data("centroid_test_data") / "experiments.json",
dials_data("centroid_test_data") / "integrated.refl",
"scan_range=0,5... | dials/dials | tests/test_plot_reflections.py | Python | bsd-3-clause | 445 |
"""
series.py
:copyright: (c) 2014-2015 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
This shows how to use **SeriesReader** to get the data in various ways
But you can use them with **Reader** class as well
"""
import os
from pyexcel.ext import ods3
from pyexcel import SeriesReader
fro... | lordakshaya/pyexcel | examples/example_usage_of_internal_apis/simple_usage/series.py | Python | bsd-3-clause | 2,753 |
"""
Plugin for probing ftp
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = " FTP Probing "
def run(PluginInfo):
resource = get_resources("FtpProbeMethods")
# No previous output
return plugin_helper.CommandDump("Test Command", "Output", resou... | owtf/owtf | owtf/plugins/network/active/ftp@PTES-001.py | Python | bsd-3-clause | 341 |
# -*- coding: utf-8 -*-
"""
Dynamic factor model.
Author: Chad Fulton
License: BSD-3
"""
from collections import OrderedDict
from warnings import warn
import numpy as np
import pandas as pd
from scipy.linalg import cho_factor, cho_solve, LinAlgError
from statsmodels.tools.data import _is_using_pandas
from statsmodel... | jseabold/statsmodels | statsmodels/tsa/statespace/dynamic_factor_mq.py | Python | bsd-3-clause | 186,145 |
import inspect
import sys
import types
from copy import deepcopy
import pickle as pypickle
try:
import cPickle as cpickle
except ImportError:
cpickle = None
if sys.version_info < (2, 6): # pragma: no cover
# cPickle is broken in Python <= 2.5.
# It unsafely and incorrectly uses relative instead of a... | frac/celery | celery/utils/serialization.py | Python | bsd-3-clause | 4,836 |
# -*- coding: utf-8 -*-
"""Factories to help in tests."""
from factory import PostGenerationMethodCall, Sequence
from factory.alchemy import SQLAlchemyModelFactory
from chamberlain.database import db
from chamberlain.user.models import User
class BaseFactory(SQLAlchemyModelFactory):
"""Base factory."""
clas... | sean-abbott/chamberlain | tests/factories.py | Python | bsd-3-clause | 769 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pyActLearn documentation build configuration file, created by
# sphinx-quickstart on Mon Nov 14 10:34:33 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... | TinghuiWang/pyActLearn | docs/conf.py | Python | bsd-3-clause | 10,278 |
#!/usr/bin/env python
import sys
import textwrap
names = sorted(sys.modules.keys())
name_text = ', '.join(names)
print textwrap.fill(name_text)
| talapus/Ophidian | Academia/Modules/list_all_installed_modules.py | Python | bsd-3-clause | 147 |
"""
function for filtering
"""
import numpy as np
def hamilton_filter(data, h, *args):
r"""
This function applies "Hamilton filter" to the data
http://econweb.ucsd.edu/~jhamilto/hp.pdf
Parameters
----------
data : arrray or dataframe
h : integer
Time hor... | oyamad/QuantEcon.py | quantecon/filter.py | Python | bsd-3-clause | 1,768 |
# _*_ coding: utf-8 _*_
from django.conf.urls import patterns, url # , include
# views
from .views import UserListView, UserCreateView, UserUpdateView, \
UserDeleteView, UserActiveUpdateView, PersonListView
from .views import MenuListView, MenuCreateView, MenuUpdateView, \
MenuDeleteView, MenuUpdateActiveVie... | tiposaurio/venton | apps/sad/urls.py | Python | bsd-3-clause | 4,159 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.template import Library
from ..models import Counter
register = Library()
@register.assignment_tag
def counter_for_object(name, obj, default=0):
"""Returns the counter value for the given name and instance."""
try:
return Counter.objects.get... | natural/django-objectcounters | objectcounters/templatetags/counter_tags.py | Python | bsd-3-clause | 398 |
"""SCons.Tool.sgiar
Tool-specific initialization for SGI ar (library archive). If CC
exists, static libraries should be built with it, so the prelinker has
a chance to resolve C++ template instantiations.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the gen... | looooo/pivy | scons/scons-local-1.2.0.d20090919/SCons/Tool/sgiar.py | Python | isc | 2,570 |
import ast
import os
class Parser(object):
"""
Find all *.py files inside `repo_path` and parse its into ast nodes.
If file has syntax errors SyntaxError object will be returned except
ast node.
"""
def __init__(self, repo_path):
if not os.path.isabs(repo_path):
raise Val... | beni55/djangolint | project/lint/parsers.py | Python | isc | 1,186 |
#!coding: utf-8
from sqlalchemy import CheckConstraint
from sqlalchemy import Column
from sqlalchemy import column
from sqlalchemy import ForeignKey
from sqlalchemy import Index
from sqlalchemy import inspect
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import schema
from sqlalchemy i... | zzzeek/sqlalchemy | test/sql/test_quote.py | Python | mit | 33,906 |
# coding: utf-8
import json
import sys
import codecs
python3 = False
if sys.version_info[0] == 3: #Python 3
python3 = True
if not python3:
reload(sys)
sys.setdefaultencoding("utf-8")
input = raw_input
def parseHTML(file_path):
fo = codecs.open(file_path, encoding='utf-8', mode='r+')
origina... | gordon-zhao/Chrome_bookmarks_to_json | src/python/html2json.py | Python | mit | 4,599 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Filename: .py
| zeroonegit/python | runoob/basic_tutorial/template.py | Python | mit | 64 |
from lcs.strategies.subsumption import does_subsume
def add_classifier(child, population, new_list, theta_exp: int) -> None:
"""
Looks for subsuming / similar classifiers in the population of classifiers
and those created in the current ALP run (`new_list`).
If a similar classifier was found it's qua... | ParrotPrediction/pyalcs | lcs/strategies/anticipatory_learning_process.py | Python | mit | 1,363 |
from __future__ import absolute_import
import six
import copy
from six.moves import zip
from . import backend as K
from .utils.generic_utils import serialize_keras_object
from .utils.generic_utils import deserialize_keras_object
if K.backend() == 'tensorflow':
import tensorflow as tf
def clip_norm(g, c, n):
... | ryfeus/lambda-packs | Keras_tensorflow_nightly/source2.7/keras/optimizers.py | Python | mit | 25,887 |
import re
from argparse import ArgumentParser, ArgumentTypeError
from flexget import options
from flexget.event import event
from flexget.terminal import TerminalTable, console, table_parser
from flexget.utils.database import Session
from . import db
def do_cli(manager, options):
"""Handle regexp-list cli"""
... | Flexget/Flexget | flexget/components/managed_lists/lists/regexp_list/cli.py | Python | mit | 4,835 |
from __future__ import print_function
import math, time
from twisted.protocols import basic
class CollectingLineReceiver(basic.LineReceiver):
def __init__(self):
self.lines = []
self.lineReceived = self.lines.append
def deliver(proto, chunks):
map(proto.dataReceived, chunks)
def benchmark(c... | EricMuller/mywebmarks-backend | requirements/twisted/Twisted-17.1.0/docs/core/benchmarks/linereceiver.py | Python | mit | 1,374 |
# -*- coding: utf-8 -*-
from .common import *
class ReferenceDescriptorTest(TestCase):
def setUp(self):
self.reference_descriptor = ReferenceDescriptor.objects.create(
content_type=ContentType.objects.get_for_model(Model))
self.client = JSONClient()
def test_reference_descriptor... | vlfedotov/django-business-logic | tests/rest/test_reference.py | Python | mit | 4,996 |
import os, sys
from setuptools import setup
setup(
name='reddit_comment_scraper',
version='2.0.5',
description='A simple Reddit-scraping script',
url='https://github.com/jfarmer/reddit_comment_scraper',
author='Jesse Farmer',
author_email='jesse@20bits.com',
license='MIT',
packages=['r... | chrisswk/reddit_comment_scraper | setup.py | Python | mit | 1,062 |
from openpyxl.styles.colors import Color
import pytest
@pytest.mark.parametrize("value", ['00FFFFFF', 'efefef'])
def test_argb(value):
from ..colors import aRGB_REGEX
assert aRGB_REGEX.match(value) is not None
class TestColor:
def test_ctor(self):
c = Color()
assert c.value == "00000000... | Darthkpo/xtt | openpyxl/styles/tests/test_colors.py | Python | mit | 1,719 |
# coding: utf-8
from flask import render_template, Blueprint, redirect, request, url_for
from ..forms import SigninForm, SignupForm
from ..utils.account import signin_user, signout_user
from ..utils.permissions import VisitorPermission, UserPermission
from ..models import db, User
bp = Blueprint('account', __name__)
... | hustlzp/Flask-Boost | flask_boost/project/application/controllers/account.py | Python | mit | 1,215 |
# Copyright (c) 2015-2017 Cisco Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | kireledan/molecule | test/unit/lint/test_yamllint.py | Python | mit | 4,973 |
import datetime
from dateutil.relativedelta import relativedelta
from decimal import Decimal
import factory
from factory.fuzzy import FuzzyDate, FuzzyInteger
import random
from django.contrib.auth import models as auth
from django.contrib.auth.hashers import make_password
from timepiece.contracts import models as con... | dannybrowne86/django-timepiece | timepiece/tests/factories.py | Python | mit | 6,805 |
from direct.directnotify import DirectNotifyGlobal
import random
MAX_PLAYERS_PER_HOLE = 4
GOLF_BALL_RADIUS = 0.25
GOLF_BALL_VOLUME = 4.0 / 3.0 * 3.14159 * GOLF_BALL_RADIUS ** 3
GOLF_BALL_MASS = 0.5
GOLF_BALL_DENSITY = GOLF_BALL_MASS / GOLF_BALL_VOLUME
GRASS_SURFACE = 0
BALL_SURFACE = 1
HARD_SURFACE = 2
HOLE_SURFACE = 3... | ToontownUprising/src | toontown/golf/GolfGlobals.py | Python | mit | 12,858 |
import cStringIO
class Page(object):
def __init__(self):
self.Nests = {'': {}}
self.buffer = cStringIO.StringIO()
| James226/BrowserConfigurationUtility | cache/Page.py | Python | mit | 135 |
from typing import Union, Iterator, Tuple
from ...tokens import Doc, Span
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]:
"""
Detect base noun phrases from a dependency parse. Works on both Doc and Span.
""... | honnibal/spaCy | spacy/lang/tr/syntax_iterators.py | Python | mit | 1,853 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
def serialize_ip_network_group(group):
"""Serialize group to... | mvidalgarcia/indico | indico/modules/networks/util.py | Python | mit | 506 |
import re
from .bing import search as bing_search
TWITTER_LINK = re.compile('<a .*?href="http://twitter.com/(\w+)"')
def discover_twitter_users_via_bing(entity):
r = bing_search(entity['name'])
handles = []
for item in r['d']['results'][0]['Web'][:10]:
page = requests.get(item['Url']).text
... | NUinfolab/context | context/services/__init__.py | Python | mit | 681 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import base64
import simplejson as json
from cookielib import Cookie
from werkzeug.utils import parse_cookie
from tests import SecurityTest
def get_cookies(rv):
cookies = {}
for value in rv.headers.get_all("Set-Cookie"):
cookies.update(... | 100grams/flask-security | tests/functional_tests.py | Python | mit | 9,642 |
"""
Copyright (c) 2016, John Deutscher
Description: Sample Python script for Azure Media Indexer V2
License: MIT (see LICENSE.txt file for details)
Documentation : https://azure.microsoft.com/en-us/documentation/articles/media-services-process-content-with-indexer2/
"""
import os
import json
import amspy
import time
im... | johndeu/amspy | amspy/examples/analytics/indexer_v2/indexer_v2.py | Python | mit | 14,879 |
countries_info_list = [
{
"name": {
"common": "Afghanistan",
"official": "Islamic Republic of Afghanistan",
"native": {
"common": "\u0627\u0641\u063a\u0627\u0646\u0633\u062a\u0627\u0646",
"official": "\u062f \u0627\u0641\u063a\u0627\u0646\u... | Impactstory/total-impact-webapp | totalimpactwebapp/countries_info.py | Python | mit | 322,120 |
"""
Tests of role and membership calculations.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django.test import TestCase
from ..constants import role_kinds
from ..models import Classroom
from ..models import Facility
from ..models import ... | lyw07/kolibri | kolibri/core/auth/test/test_roles_and_membership.py | Python | mit | 10,992 |
#!/usr/bin/python35
def add(x, y):
return x + y
def dec(x, y):
return x - y
def div(x, y):
if y == 0:
return 0
return x / y
def mult(x, y):
return x * y
if __name__ == '__main__':
print('Module: Calc')
| JShadowMan/package | python/module/calc/calc.py | Python | mit | 239 |
import argparse
import sys
import os
from annotated_set import loadData
from data_structures import CanonicalDerivation
from canonical_parser import CanonicalParser
from derivation_tree import DerivationTree
from conversion.ghkm2tib import ghkm2tib
#from lib.amr.dag import Dag
class ExtractorCanSem:
def __init_... | GullyAPCBurns/bolinas | extractor_cansem/extractor_cansem.py | Python | mit | 3,342 |
from django.contrib import admin
from helpcenter import models
class ArticleAdmin(admin.ModelAdmin):
""" Admin for the Article model """
date_hierarchy = 'time_published'
fieldsets = (
(None, {
'fields': ('category', 'title', 'body')
}),
('Publishing Options', {
... | smalls12/django_helpcenter | helpcenter/admin.py | Python | mit | 883 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.stanza.error import Error
from sleekxmpp.stanza.stream_error import StreamError
from sleekxmpp.stanza.iq import Iq
from sleekxmp... | destroy/SleekXMPP-gevent | sleekxmpp/stanza/__init__.py | Python | mit | 399 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
ORANGE_HTML_STYLE = "'color:#EF9700;font-size:48px;padding: 60px; text-align:center;padding-left: 70px'>"
GREEN_HTML_STYLE = "'color:#1DB846;font-size:48px;padding: 60px; text-align:center;padding-left: 70px'>"
GREY_HTML_STYLE =... | VirusTotal/content | Packs/MajorBreachesInvestigationandResponse/Scripts/RapidBreachResponseEradicationTasksCountWidget/RapidBreachResponseEradicationTasksCountWidget.py | Python | mit | 978 |
from binascii import unhexlify
from pprint import pprint
from xor import xor
def get_possible_keys(ciphertext):
key_len = len(ciphertext) // 2
# Generate list of potential keys
possible_keys = []
for i in range(256):
hex_num = hex(i).split('x')[1].zfill(2)
possible_keys.append(hex_num... | reider-roque/crypto-challenges | cryptopals/set-1-basics/chal-4/single_byte_xor_cipher.py | Python | mit | 5,192 |
from flask import Blueprint, render_template,request, redirect, url_for, jsonify
from flask.ext.login import login_required, current_user
from app.models.tracks import Track,Layer
from app import db
user = Blueprint('user', __name__, url_prefix='/user')
@user.route('/<username>')
def findUser(username): #better way ... | davidlee1435/MusicWebs | app/routes/user.py | Python | mit | 448 |
import magics
__all__ = ['by_version', 'by_magic']
_fallback = {
'EXTENDED_ARG': None,
'hasfree': [],
}
class dis(object):
def __init__(self, version, module):
self._version = version
from __builtin__ import __import__
self._module = __import__('decompyle.%s' % module, globals... | devyn/unholy | decompyle/decompyle/dis_files.py | Python | mit | 1,163 |
klein = raw_input()
gross = raw_input()
zahl = []
if gross[0] == '0':
zahl.append((1,0))
else:
zahl.append((0,1))
for i in range(1,len(gross)):
if gross[i] == '0':
zahl.append((zahl[i - 1][0] + 1, zahl[i - 1][1]))
else:
zahl.append((zahl[i - 1][0], zahl[i - 1][1] + 1))
plus = 0
for i in range(len(klein)):... | clarammdantas/Online-Jugde-Problems | online_judge_solutions/python.py | Python | mit | 531 |
# -*- coding:utf-8 -*-
from flask import Flask
app = Flask(__name__)
app.config.from_object('config') # 告诉 Flask 去读取,并使用config.py配置参数
| hhstore/learning-notes | python/src/project/py27/flask_base/flask_online_calculator/server/base.py | Python | mit | 165 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/particle/shared_particle_geyser_center.iff"
result.attribute_template_i... | anhstudios/swganh | data/scripts/templates/object/static/particle/shared_particle_geyser_center.py | Python | mit | 451 |
# Natural Language Toolkit: Parsers
#
# Copyright (C) 2001 University of Pennsylvania
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Steven Bird <sb@ldc.upenn.edu>
# Scott Currie <sccurrie@seas.upenn.edu>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id: __init__... | ronaldahmed/robot-navigation | neural-navigation-with-lstm/MARCO/nltk/parser/__init__.py | Python | mit | 52,728 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/weapon/shared_wpn_rss_imperial_cannon.iff"
result.a... | anhstudios/swganh | data/scripts/templates/object/tangible/ship/components/weapon/shared_wpn_rss_imperial_cannon.py | Python | mit | 491 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_shear_mite_broodling.iff"
result.attribute_template_id = 9
re... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_shear_mite_broodling.py | Python | mit | 444 |
"""Module for building new datasets or reading it from files. Upper layer of data (sequence) management."""
# pylint: disable=too-many-arguments, too-many-locals
import gzip
import math
import os
import pickle
import random
import sys
from collections import defaultdict
import numpy as np
from Bio import SeqIO
from Bi... | mkopar/Virus-classification-theano | VirClass/load.py | Python | mit | 29,948 |
# -*- encoding: utf-8 -*-
# Module iaskelmrec
from numpy import *
def iaskelmrec(f, B=None):
from iabinary import iabinary
from iaintersec import iaintersec
from iadil import iadil
from iaunion import iaunion
from iasecross import iasecross
if B is None:
B = iasecross(None)
y = ia... | mariecpereira/IA369Z | deliver/ia870/iaskelmrec.py | Python | mit | 482 |
from django.db import models
class Creatable(models.Model):
name = models.CharField(max_length=100)
related = models.ManyToManyField('self', blank=True)
def __unicode__(self):
return self.name
| spookylukey/django-autocomplete-light | test_project/ajax_create/models.py | Python | mit | 216 |
import numpy as np
import load_data
from generative_alg import *
from keras.utils.generic_utils import Progbar
from load_data import load_word_indices
from keras.preprocessing.sequence import pad_sequences
import pandas as pa
import augment
def test_points(premises, labels, noises, gtest, cmodel, hypo_len):
p = P... | jstarc/deep_reasoning | visualize.py | Python | mit | 3,189 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Textfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "bar.unselected"
_path_str = "bar.unselected.textfont"
_valid_props = {"color"}
# colo... | plotly/python-api | packages/python/plotly/plotly/graph_objs/bar/unselected/_textfont.py | Python | mit | 5,177 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-24 19:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('speakers', '0021_auto_20170524_2024'),
]
operations = [
migrations.AlterFie... | benabraham/cz.pycon.org-2017 | pyconcz_2017/speakers/migrations/0022_auto_20170524_2115.py | Python | mit | 566 |
"""
Copyright 2016 Rasmus Larsen
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE.txt file for details.
"""
import sys
import time
from sacred import Experiment
from core.ALEEmulator import ALEEmulator
from dqn.Agent import Agent
from dqn.DoubleDQN import DoubleDQN
e... | rlrs/deep-rl | run_double.py | Python | mit | 1,928 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/compute/v2017_03_30/models/virtual_machine_agent_instance_view.py | Python | mit | 1,705 |
#from models import Host, IPaddr
from models import Host, HostGroup
from django.contrib import admin
class HostAdmin(admin.ModelAdmin):
list_display = ['vendor',
'sn',
'product',
'cpu_model',
'cpu_num',
'cpu_vendor',
'memory_part_number',
'memory_manufacture... | henry-zhang/Cmdb_Puppet | cmdb/hostinfo/admin.py | Python | epl-1.0 | 836 |
# -*- coding: utf-8 -*-
#
# Copyright © 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | beav/pulp | server/test/unit/test_migration_0005.py | Python | gpl-2.0 | 2,511 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.