code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyr... | Ban3/Limnoria | plugins/Misc/plugin.py | Python | bsd-3-clause | 27,456 |
"""
Tests for `clusterclienttest` module.
"""
#import pytest
#from clusterclienttest import clusterclienttest
class TestClusterclienttest(object):
@classmethod
def setup_class(cls):
pass
def test_something(self):
pass
@classmethod
def teardown_class(cls):
pass
| RayCrafter/clusterclienttest | test/test_clusterclienttest.py | Python | bsd-3-clause | 311 |
import holoviews as hv
import geoviews as gv
import dask.dataframe as dd
from holoviews.operation.datashader import datashade, aggregate, shade
from bokeh.models import WMTSTileSource
renderer = hv.renderer('bokeh')
# Load data
usecols = ['tpep_pickup_datetime', 'dropoff_x', 'dropoff_y']
ddf = dd.read_csv('../data/n... | ioam/scipy-2017-holoviews-tutorial | solutions/apps/periodic_app.py | Python | bsd-3-clause | 1,047 |
#!/usr/bin/env python
# encoding: utf-8
## stdlib imports
import os
from glob import glob
## 3rd party
from . import pkgconf
from . import envmunge
from . import features as featmod
from . import util
## waf imports
import waflib.Logs as msg
import waflib.Context as context
# NOT from the waf book. The waf book ex... | hwaf/hwaf | py-hwaftools/orch/waffuncs.py | Python | bsd-3-clause | 4,382 |
from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin
from smartmin.views import SmartCRUDL, SmartFormView, SmartListView, SmartReadView
from django import forms
from django.conf import settings
from django.http import HttpResponseRedirect, JsonResponse
from django.utils.translation import gettext_lazy as _
fro... | rapidpro/casepro | casepro/contacts/views.py | Python | bsd-3-clause | 5,104 |
"""
Structs transformer
"""
import logging
from collections import OrderedDict
from model.struct import Struct
from transformers.common_producer import InterfaceProducerCommon
class StructsProducer(InterfaceProducerCommon):
"""
Structs transformer
"""
def __init__(self, struct_class, enum_names, st... | smartdevicelink/sdl_ios | generator/transformers/structs_producer.py | Python | bsd-3-clause | 1,726 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07.
# 2019, SMART Health IT.
import os
import io
import unittest
import json
from . import researchelementdefinition
from .fhirdate import FHIRDate
class ResearchElementDefinitionTests(unittest.TestCase):
def ins... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/researchelementdefinition_tests.py | Python | bsd-3-clause | 1,910 |
#!/usr/bin/env python3
"""
C declarations, CPP macros, and C functions for f2py2e.
Only required declarations/macros/functions will be used.
Copyright 1999,2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the Num... | mhvk/numpy | numpy/f2py/cfuncs.py | Python | bsd-3-clause | 48,940 |
"""
For internal use only.
"""
import re
from typing import Callable, Iterable, Type, TypeVar, cast
from prompt_toolkit.formatted_text import to_formatted_text
from prompt_toolkit.formatted_text.utils import fragment_list_to_text
from prompt_toolkit.mouse_events import MouseEvent, MouseEventType
__all__ = [
"has_... | jonathanslenders/ptpython | ptpython/utils.py | Python | bsd-3-clause | 5,634 |
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''A container for timeline-based events and traces and can handle importing
raw event data from different sources. This model closely resembles that in t... | ChromiumWebApps/chromium | tools/telemetry/telemetry/core/timeline/model.py | Python | bsd-3-clause | 7,997 |
'''
Test ACS columns
'''
from tasks.util import shell
# TODO clean this up in a more general init script
try:
shell('createdb test')
except:
pass
from nose.tools import with_setup
from tasks.us.census.lodes import WorkplaceAreaCharacteristicsColumns
from tests.util import runtask, setup, teardown
@with_... | CartoDB/bigmetadata | tests/us/census/test_lodes.py | Python | bsd-3-clause | 423 |
#!/usr/bin/env python
from __future__ import print_function
import errno
import json
import os
import re
import shutil
import string
import sys
import requests
CONFIG_FILE = 'scripts.conf'
EXTENSIONS = ['avi', 'm4v', 'mkv', 'mp4']
SUB_EXTENSIONS = ['idx', 'sub', 'srt']
PATTERN = re.compile('^(.*)(\d{4})\.(.*)', re.I... | h4ck3rm1k3/states-2 | sabnzbd/scripts/movie-mover.py | Python | bsd-3-clause | 5,436 |
# -*- coding: utf-8 -*-
from aero.__version__ import __version_info__
__author__ = 'nickl-'
from .base import CommandProcessor as CommandProcessor
class InstallCommand(CommandProcessor):
from .base import coroutine
package = ''
adapter = ''
def wiring(self):
self.out = self.write()
... | Aeronautics/aero | aero/commands/install.py | Python | bsd-3-clause | 1,362 |
import xmpp
import urllib, urllib2
import xmlrpclib
from sso.services import BaseService
from django.conf import settings
class JabberService(BaseService):
settings = { 'require_user': True,
'require_password': True,
'provide_login': False,
'use_auth_username': ... | nikdoof/test-auth | app/sso/services/jabber/__init__.py | Python | bsd-3-clause | 7,262 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['PolyTrend'] , ['Seasonal_DayOfWeek'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_PolyTrend_Seasonal_DayOfWeek_NoAR.py | Python | bsd-3-clause | 171 |
import time
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Auth import Auth
from PLC.Sessions import Session, Sessions
from PLC.Nodes import Node, Nodes
from PLC.Persons import Person, Persons
class GetSession(Method):
"""
Returns a new session key if a user or node authenti... | dreibh/planetlab-lxc-plcapi | PLC/Methods/GetSession.py | Python | bsd-3-clause | 1,423 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
kargs = {}
kargs['name'] = 'PLoSPy'
kargs['version'] = ''
kargs['author'] = 'Georg R Walther'
kargs['author_email'] = 'contact@georg.io'
kargs['packages'] = ['plospy']
kargs['package_dir'] = {'plospy': 'plospy'}
kargs['url'... | waltherg/PLoSPy | setup.py | Python | bsd-3-clause | 555 |
# -*- coding: utf-8 -*-
"""
werkzeug.wrappers
~~~~~~~~~~~~~~~~~
The wrappers are simple request and response objects which you can
subclass to do whatever you want them to do. The request object contains
the information transmitted by the client (webbrowser) and the response
object contains al... | mrdon/flask | werkzeug/wrappers.py | Python | bsd-3-clause | 76,207 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2017-03-22.
# 2017, SMART Health IT.
from . import domainresource
class ValueSet(domainresource.DomainResource):
""" A set of codes drawn from one or more code systems.
... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/valueset.py | Python | bsd-3-clause | 21,281 |
from discuss.discuss.settings import *
##########################################################################
#
# Server settings
#
##########################################################################
ALLOWED_HOSTS = ["localhost"]
WSGI_APPLICATION = 'discuss.discuss.wsgi_production.application'
#########... | siggame/discuss | discuss/discuss/production.py | Python | bsd-3-clause | 642 |
#!/usr/bin/env python
# Copyright (c) 2017-2020, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice... | ledatelescope/bifrost | testbench/your_first_block.py | Python | bsd-3-clause | 3,507 |
"""
raven.utils.serializer
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from raven.utils.serializer.base import Serializer
from raven.utils.serializer.manager import register, transform
| alex/raven | raven/utils/serializer/__init__.py | Python | bsd-3-clause | 287 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("RandomForestRegressor" , "RandomReg_10" , "mysql")
| antoinecarme/sklearn2sql_heroku | tests/regression/RandomReg_10/ws_RandomReg_10_RandomForestRegressor_mysql_code_gen.py | Python | bsd-3-clause | 140 |
#!/usr/bin/python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper for invoking the BFD loader
A simple script to invoke the bfd loader instead of gold.
This script is in a filename "ld... | endlessm/chromium-browser | native_client/src/trusted/service_runtime/linux/ld_bfd.py | Python | bsd-3-clause | 2,039 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Identifier) on 2016-06-23.
# 2016, SMART Health IT.
from . import element
class Identifier(element.Element):
""" An identifier intended for computation.
A technical identifier - id... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_1_0_6/models/identifier.py | Python | bsd-3-clause | 2,304 |
from django.conf.urls.defaults import patterns, url, include
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, 'show_indexes': True }),
url(r'^admi... | centrumholdings/cthulhubot | tests/example_project/urls.py | Python | bsd-3-clause | 507 |
import tests.periodicities.period_test as per
per.buildModel((7 , 'T' , 1600));
| antoinecarme/pyaf | tests/periodicities/Minute/Cycle_Minute_1600_T_7.py | Python | bsd-3-clause | 82 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
IRC bot...
"""
import threading
import src.utilities as util
import src.settings
import src.irc.botObject
class BotDispatcher(threading.Thread):
"""
The BotDispatcher object handles the delegation of the various bots on
the various specified servers.
... | Tehnix/PyIRCb | src/irc/botDispatcher.py | Python | bsd-3-clause | 2,303 |
from django.core.management.base import NoArgsCommand
from mypage.widgets.conf import settings
class LockedCommand(NoArgsCommand):
help = 'helper command that locks iteslf and kills predecessors'
cachelock = settings.MYPAGE_COMMAND_CACHELOCK
cachelock_timeout = settings.MYPAGE_COMMAND_CACHELOCK_TIMEOUT
... | ella/mypage | mypage/widgets/management/commands/__init__.py | Python | bsd-3-clause | 1,936 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Page.template'
db.delete_column(u'cms_page', 'template')
def backwards(self, orm):
... | aladdinwang/django-cms | cms/migrations/0049_auto__del_field_page_template.py | Python | bsd-3-clause | 15,791 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_admin_conf_vars', '0004_configurationvariable_description'),
]
operations = [
migrations.AlterField(
mode... | maoaiz/django-admin-conf-vars | django_admin_conf_vars/migrations/0005_auto_20180725_1624.py | Python | bsd-3-clause | 756 |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... | zasdfgbnm/qutip | qutip/about.py | Python | bsd-3-clause | 3,318 |
# Django settings for cms project.
import os
PROJECT_DIR = os.path.dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
CACHE_BACKEND = 'locmem:///'
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql'#'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgres... | jjanssen/django-cms-patches | example/settings.py | Python | bsd-3-clause | 7,563 |
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
import peak
import datetime
from nagare import presentation, security, ajax, i18n
from nagare.i18... | Net-ng/kansha | kansha/card_addons/due_date/view.py | Python | bsd-3-clause | 2,112 |
"""
sentry.testutils.cases
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
__all__ = (
'TestCase', 'TransactionTestCase', 'APITestCase', 'AuthProviderTestCase',
'RuleTest... | zenefits/sentry | src/sentry/testutils/cases.py | Python | bsd-3-clause | 14,473 |
#emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyNIfTI package for the
# copyright and license terms.
#
### ### ### ### ### ### #... | yarikoptic/NiPy-OLD | nipy/io/imageformats/compat.py | Python | bsd-3-clause | 7,618 |
from math import isnan
from nose.tools import eq_
from js_helper import _do_real_test_raw, _do_test_raw, _do_test_scope, _get_var
def test_assignment_with_pollution():
"""
Access a bunch of identifiers, but do not write to them. Accessing
undefined globals should not create scoped objects.
"""
a... | kmaglione/amo-validator | tests/test_js_operators.py | Python | bsd-3-clause | 7,066 |
from django.core.exceptions import ValidationError
from cyder.base.tests import ModelTestMixin
from cyder.cydns.address_record.models import AddressRecord
from cyder.cydns.cname.models import CNAME
from cyder.cydns.domain.models import Domain
from cyder.cydns.nameserver.models import Nameserver
from cyder.cydns.soa.mo... | zeeman/cyder | cyder/cydns/domain/tests/basic_tests.py | Python | bsd-3-clause | 7,274 |
"""empty message
Revision ID: 4fe34588268f
Revises: 26dba2ff3e74
Create Date: 2014-12-09 01:41:24.333058
"""
# revision identifiers, used by Alembic.
revision = '4fe34588268f'
down_revision = '26dba2ff3e74'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | sandeep6189/Pmp-Webapp | migrations/versions/4fe34588268f_.py | Python | bsd-3-clause | 506 |
#!/usr/bin/env vpython
# Copyright 2021 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.
"""Unittests for xcode_util.py."""
import logging
import mock
import os
import unittest
import test_runner_errors
import test_runner_... | ric2b/Vivaldi-browser | chromium/ios/build/bots/scripts/xcode_util_test.py | Python | bsd-3-clause | 20,961 |
# -*- coding: Latin-1 -*-
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See License.txt for complete terms.
# file object -> CybOX File Object mappings
file_object_mappings = {'file_format': 'file_format',
'type': 'type',
'file_name': 'file_name',
... | MAECProject/pefile-to-maec | pefile_to_maec/mappings/file_object.py | Python | bsd-3-clause | 586 |
from conda_env.print_env import print_env
import os
import textwrap
import unittest
class EnvironmentAndAliasesTestCase(unittest.TestCase):
ENVIRONMENT = [
{'PATH' : ['mypath1', 'mypath2']},
{'PATH' : ['mypath3']},
{'ANY_LIST_REALLY' : ['something1', 'something2']},
{'SINGLE_VAR' ... | ESSS/conda-env | tests/test_print_env.py | Python | bsd-3-clause | 4,520 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django import test
from django.core.exceptions import ValidationError
from yepes.validators import (
CharSetValidator,
ColorValidator,
FormulaValidator,
IdentifierValidator,
PhoneNumberValidator,
PostalCodeValidator,
Rest... | samuelmaudo/yepes | tests/validators/tests.py | Python | bsd-3-clause | 13,740 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from getpass import getpass
from datetime import datetime
import pprint
from docopt import docopt
import requests
from .spelling import spellchecker
from .dispatch import dispatch
from .utils import login, validate_usernam... | oubiga/respect | respect/main.py | Python | bsd-3-clause | 2,305 |
#!/usr/local/bin/python
# ----------------------------------------------------------------------
# MR-MPI = MapReduce-MPI library
# http://www.cs.sandia.gov/~sjplimp/mapreduce.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2009) Sandia Corporation. Under the terms of Co... | ravikanthreddy89/MR-MPI | examples/rmat.py | Python | bsd-3-clause | 4,953 |
# encoding: utf-8
from __future__ import absolute_import
from unittest import TestCase
from mikoto.markdown import render_markdown
from mikoto.libs.text import get_mentions_from_text
class TestUtils(TestCase):
def test_mentioned_people_from_text(self):
text1 = "@xingben OK"
text2 = "OK @xingben"... | qingfeng/mikoto | tests/test_utils.py | Python | bsd-3-clause | 1,469 |
#!/usr/bin/env python3
"""
Testing Client for flasktex.
"""
__license__ = 'BSD-3'
__docformat__ = 'reStructuredText'
import os
import urllib.request
def ft_checkalive(url:str):
"""
Check whether given server is alive.
"""
resp = None
try:
resp = urllib.request.urlopen(url+'/ping').read... | hosiet/flasktex | src/client.py | Python | bsd-3-clause | 2,633 |
import re
import pytest
from cerberus import errors, Validator, SchemaError
from cerberus.base import DocumentError
from cerberus.tests.conftest import sample_schema
def assert_exception(exception, document={}, schema=None, validator=None, msg=None):
"""
Tests whether a specific exception is raised. Optiona... | funkyfuture/cerberus | cerberus/tests/__init__.py | Python | isc | 4,450 |
# Copyright (C) 2001-2005 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | liyongyue/dnsspider | dns/opcode.py | Python | isc | 2,603 |
#### 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 = Intangible()
result.template = "object/draft_schematic/clothing/shared_clothing_backpack_field_03_quest.iff"
resu... | obi-two/Rebelion | data/scripts/templates/object/draft_schematic/clothing/shared_clothing_backpack_field_03_quest.py | Python | mit | 470 |
# -*- coding: utf-8 -*-
'''
General documentation architecture:
Home
Index
- Getting started
Getting started to concise
Layers
- Preprocessing
Genomic Sequence Preprocessing
RNA Structure Preprocessing
Spline-position Preprocessing
- Data
Encode
Attract
Losses
Metrics
Eval metrics
Optimizer... | gagneurlab/concise | docs/autogen.py | Python | mit | 12,495 |
# coding: utf-8
from sqlalchemy import and_
from sqlalchemy import bindparam
from sqlalchemy import Computed
from sqlalchemy import exc
from sqlalchemy import except_
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import Identity
from sqlalchemy import Index
from sqlalchemy import Integer... | monetate/sqlalchemy | test/dialect/oracle/test_compiler.py | Python | mit | 57,768 |
#! /usr/bin/env python
"""
This program plots the average electronic energy during a NAMD simulatons
averaged over several initial conditions.
It plots both the SH and SE population based energies.
Example:
plot_average_energy.py -p . -nstates 26 -nconds 6
Note that the number of states is the same as given in the ... | SCM-NV/qmworks-namd | scripts/pyxaid/plot_average_energy.py | Python | mit | 3,318 |
from sunshine import create_app
app = create_app()
if __name__ == "__main__":
import sys
try:
port = int(sys.argv[1])
except (IndexError, ValueError):
port = 5000
app.run(debug=True, port=port)
| datamade/illinois-sunshine | runserver.py | Python | mit | 228 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
PACKAGEDIR = os.path.abspath(os.path.dirname(__file__))
import matplotlib
matplotlib.use('TkAgg')
from .version import __version__
from .keparray import *
from .kepbls import *
from .kepclean import *
from .kepclip import *
... | gully/PyKE | pyke/__init__.py | Python | mit | 1,296 |
import threading
class Statistics_Response:
pass # empty class
class Statistics:
def __init__(self, upmeasure, downmeasure, connecter, httpdl,
ratelimiter, rerequest_lastfailed, fdatflag):
self.upmeasure = upmeasure
self.downmeasure = downmeasure
self.connecter = ... | jakesyl/BitTornado | BitTornado/Client/Statistics.py | Python | mit | 6,510 |
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class FoursquareAccount(ProviderAccount):
def get_profile_url(self):
return "https://foursquare.com/user/" + self.account.extra_data.get("id")
def get_avatar_url... | pennersr/django-allauth | allauth/socialaccount/providers/foursquare/provider.py | Python | mit | 967 |
import pygame
import numpy as np
BLACK = 0, 0, 0
class World:
def __init__(self, settings):
res = settings.gameRes
self.walls = []
#4 walls
self.walls.append(Line([0, 0], [0, res]))
self.walls.append(Line([res, 0], [res, res]))
self.walls.append(Line([0, 0], [res,... | Muff1nz/PygameDeepRLAgent | PygameDeepRLAgent/A3CBootcampGame/ShootingGrounds/world.py | Python | mit | 1,167 |
#!/usr/bin/env python
#coding: utf-8
class Solution:
# @param prices, a list of integer
# @return an integer
def maxProfit(self, prices):#
if not prices: return 0
n = len(prices)
min_p = prices[0]
max_profict = 0
for i in range(1, n):
if prices[i] < min_... | wh-acmer/minixalpha-acm | LeetCode/Python/best_time_to_buy_and_sell_stock.py | Python | mit | 708 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
class Res:
def __init__(self, res_file):
''' Res Class
Parameters
----------
res_file : str
Path to .res or .rei file from PEST
Attributes
----------
df : Pandas ... | aleaf/pest_tools | res.py | Python | mit | 16,441 |
from django import forms
from stager.jira.models import *
from django.utils.functional import lazy
def type_choices():
return [(type.key, type.name) for type in JiraType.objects.filter(allowed=True)]
class JiraTicketForm(forms.Form):
def __init__(self, *args, **kwargs):
super(JiraTicketForm, self).__... | timbroder/ai-stager | stager/jira/forms.py | Python | mit | 771 |
import unittest
import numpy as np
from pgmpy.models import MarkovModel
from pgmpy.inference.mplp import Mplp
from pgmpy.factors import Factor
from pgmpy.readwrite import UAIReader
class TestMplp(unittest.TestCase):
def setUp(self):
reader_file = UAIReader('pgmpy/tests/test_readwrite/testdata/grid4x4_wit... | palashahuja/pgmpy | pgmpy/tests/test_inference/test_Mplp.py | Python | mit | 4,901 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2015 Roberto Alsina and others.
# 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 t... | immanetize/nikola | nikola/plugins/task/sources.py | Python | mit | 3,426 |
"""This Q-Learning neural network agent is still a work in progress and is not complete yet."""
import random
from agents import Agent
from keras.layers import Dense
from keras.models import Sequential, model_from_json
from keras.optimizers import RMSprop, SGD
from util import info, opponent, color_name, numpify, best_... | andysalerno/reversi_ai | agents/q_learning_agent.py | Python | mit | 8,477 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------
# File: modules/module_graph.py
# Created: 2015-02-07
# Purpose: Create graphs from generated results
#
# Copyright
# --------------------------------------------------------... | Ever-Never/smalisca | smalisca/modules/module_graph.py | Python | mit | 13,577 |
from unittest import TestCase
import plotly.io as pio
import subprocess
import os
from distutils.version import LooseVersion
import requests
import time
import psutil
import pytest
import plotly.graph_objects as go
# Fixtures
# --------
from plotly.io._orca import find_open_port, which, orca_env
@pytest.fixture()
d... | plotly/python-api | packages/python/plotly/plotly/tests/test_orca/test_orca_server.py | Python | mit | 5,402 |
import math
import random
from hokuyolx import HokuyoLX
# Dimensions of the playing field
WORLD_X = 3000
WORLD_Y = 2000
INT_MAX = 99999990
mark_r = 40
landmarks = [[WORLD_X/2, 0.0], [WORLD_X+mark_r, WORLD_Y], [-mark_r, WORLD_Y]] # position of 4 landmarks in (x, y) format.
# Noises
distance_noise = 5.0 # Noise par... | SkRobo/Eurobot-2017 | HighLevel/localisation/ParticleFilter.py | Python | mit | 8,791 |
"""
Definition of models.
"""
from django.db import models
from django import forms;
# Create your models here.
class Artist(models.Model):
name = models.CharField(max_length=50);
year_formed = models.PositiveIntegerField();
class ArtistForm(forms.ModelForm):
class Meta:
model = Artist;
f... | MicrosoftLearning/Django | Demos/MusicStore/app/models.py | Python | mit | 582 |
"""Tellstick device discovery."""
import socket
import threading
from datetime import timedelta
DISCOVERY_PORT = 30303
DISCOVERY_ADDRESS = '<broadcast>'
DISCOVERY_PAYLOAD = b"D"
DISCOVERY_TIMEOUT = timedelta(seconds=5)
class Tellstick(object):
"""Base class to discover Tellstick devices."""
def __init__(se... | sfam/netdisco | netdisco/tellstick.py | Python | mit | 1,815 |
#
# FileIO.py
#
# Description: All FILE utilities goes here
#
import os
def readFile(filePath):
"""
Reads the file file_path and returns the data or appropriate error
"""
error, response = None, {}
try:
with open(filePath, 'rb') as dataFile:
response['raw'] = dataFile.read()
... | akstealthay/anoy | app/utils/FileIO.py | Python | mit | 406 |
# -*- coding: utf-8 -*-
import random
import itertools
from .misc.lolcat import lolcat
TOPIC_SERVICE_DISCOVERY = 0x1 << 0
TOPIC_AUTOMATIC_DECTECTION = 0x1 << 1
TOPIC_MONITORING = 0x1 << 2
TOPIC_METROLOGY = 0x1 << 3
TOPIC_CONFIGURATION_AUTOMATION = 0x1 << 4
TOPIC_SYSTEM_COMPLIANCE = 0x1 << 5
TOPIC_GENERIC = 0x1 << 6 ... | naparuba/opsbro | opsbro/topic.py | Python | mit | 4,562 |
#!/usr/bin/env python
import time
import sys
import logging
import argparse
from socketIO_client import SocketIO
from messenger import Messenger
logger = logging.getLogger('get_status')
logging.basicConfig(level=logging.DEBUG)
APPKEY = '5697113d4407a3cd028abead'
#TOPIC = 'yunba_smart_plug'
#ALIAS = 'plc_0'
class St... | yunbademo/yunba-smartoffice | tests/get_status.py | Python | mit | 1,501 |
__author__ = 'jyrkila'
| mniemela/kirppu | kirppu/app/checkout/__init__.py | Python | mit | 23 |
from __future__ import division
from collections import deque
class MovingAverage(object):
def __init__(self, size):
"""
Initialize your data structure here.
:type size: int
"""
self.queue = deque(maxlen=size)
def next(self, val):
"""
:type val: int
... | keon/algorithms | algorithms/queues/moving_average.py | Python | mit | 749 |
'''
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2016, Telestax Inc and individual contributors
* by the @authors tag.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; ei... | RestComm/restcomm-sdk-python | Restcomm_Python_SDk/Test/CreateLocalServer/createServer.py | Python | mit | 1,604 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
"""
Support for the KDE4 libraries and msgfmt
"""
import os, sys, re
from waflib import Options, TaskGen, Task, Utils
from waflib.TaskGen import feature, after_method
@feature('msgfmt')
def apply_msgfmt(self):
"""
Process all languages to creat... | tommo/gii | support/waf/waflib/Tools/kde4.py | Python | mit | 2,732 |
# Performs network checks
from subprocess import Popen, PIPE
from includes.output import *
class FirewallChecks:
# Constructor
def __init__(self, uuid = None):
# if uuid == None then check the host
self.uuid = uuid
def checkIpfwRule(self, permission, fromIP, toIP, toPort, direction):
... | tredly/tredly | tests/testobjects/firewallchecks.py | Python | mit | 2,018 |
# encoding=utf-8
import sqlalchemy
from sqlalchemy.engine import create_engine
from sqlalchemy.pool import SingletonThreadPool
from terroroftinytown.tracker.model import Session, Base
class Database(object):
def __init__(self, path, delete_everything=False):
if path.startswith('sqlite:'):
sel... | hugovk/terroroftinytown | terroroftinytown/tracker/database.py | Python | mit | 992 |
from .lasso import Lasso
from .ridge import Ridge
| rafaeltg/pydl | pydl/models/linear/__init__.py | Python | mit | 50 |
#### 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 = Intangible()
result.template = "object/draft_schematic/space/booster/shared_fast_charge_fuel_cell_mk1.iff"
result... | obi-two/Rebelion | data/scripts/templates/object/draft_schematic/space/booster/shared_fast_charge_fuel_cell_mk1.py | Python | mit | 468 |
from django.db import models
from versatileimagefield.fields import VersatileImageField
from versatileimagefield.placeholder import OnStoragePlaceholderImage
class VersatileImagePostProcessorTestModel(models.Model):
"""A model for testing VersatileImageFields."""
image = VersatileImageField(
upload_... | respondcreate/django-versatileimagefield | tests/post_processor/models.py | Python | mit | 559 |
# -*- coding: utf-8-*-
import imaplib
import email
import re
from dateutil import parser
WORDS = ["EMAIL", "INBOX"]
def getSender(email):
"""
Returns the best-guess sender of an email.
Arguments:
email -- the email whose sender is desired
Returns:
Sender of the email.
... | brad999/nikita | client/modules/Gmail.py | Python | mit | 3,834 |
from .modutil import (
submodules,
submodule_tree,
submodule_leaf_tree,
)
__all__ = [
"submodules",
"submodule_tree",
"submodule_leaf_tree",
]
| sejust/pykit | modutil/__init__.py | Python | mit | 168 |
import socket
s = socket.socket()
host = socket.gethostname()
port = 1234
s.bind((host, port))
s.listen(5)
while True:
c, addr = s.accept()
print "Get coonect from", addr
c.send('Thanks your coonecting')
c.close() | cheenwe/cheenwe.github.io | study/python/8_get_web_page.py | Python | mit | 220 |
#### 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 = Intangible()
result.template = "object/draft_schematic/clothing/shared_clothing_wke_hood_s01.iff"
result.attribut... | obi-two/Rebelion | data/scripts/templates/object/draft_schematic/clothing/shared_clothing_wke_hood_s01.py | Python | mit | 459 |
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from smart_manager.models import SmartManagerObject
@receiver(pre_delete, sender=SmartManagerObject, dispatch_uid='delete_model_obj_on_smart_manager_object_delete')
def delete_model_obj_on_smart_manager_object_delete(sender, instanc... | ambitioninc/django-smart-manager | smart_manager/signal_handlers.py | Python | mit | 858 |
#!/usr/bin/env python
# encoding: utf-8
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2009-2011 by the RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of thi... | faribas/RMG-Py | rmgpy/molecule/draw.py | Python | mit | 68,395 |
import pytest
import demistomock as demisto
PARAMS = {'url': 'https://test.com', 'integrationKey': 'mock_key'}
@pytest.fixture(autouse=True)
def set_params(mocker):
mocker.patch.object(demisto, 'params', return_value=PARAMS)
def test_submit_new_event_command(requests_mock):
from ILert import submit_new_eve... | demisto/content | Packs/ILert/Integrations/ILert/ILert_test.py | Python | mit | 1,276 |
from .resource import Resource
from collections import Iterator
import copy
try:
# python 2
from urllib import quote
except ImportError:
# python 3
from urllib.parse import quote
class Pages(Iterator):
def __init__(self, opts, url, path, params):
if isinstance(path, list):
pag... | helloworldC2/VirtualRobot | porc/pages.py | Python | mit | 2,872 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
@pytest.fixture
def Alignment():
from .. alignment import Alignment
return Alignment
def test_default(Alignment):
al = Alignment()
assert dict(al) == {}
def test_round_trip(Alignment):
args = {'horizontal':... | Darthkpo/xtt | openpyxl/styles/tests/test_alignments.py | Python | mit | 671 |
#!/usr/bin/python3
# mari von steinkirch @2013
# steinkirch at gmail
'''
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twenty-nine.
A leap year occurs on any year evenly divisi... | bt3gl/Python-and-Algorithms-and-Data-Structures | First_edition_2014/other_resources/Project-Euler/019-counting_sundays.py | Python | mit | 1,794 |
# Generated by Django 2.2.1 on 2019-05-08 23:41
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("private_sharing", "0022_auto_20190507_1843"),
("public_data", "0002_auto_20171213_1947"),
]
operations = [
... | OpenHumans/open-humans | public_data/migrations/0003_auto_20190508_2341.py | Python | mit | 834 |
# Time: O(nlogn), n is the number of total emails,
# and the max length ofemail is 320, p.s. {64}@{255}
# Space: O(n)
# Given a list accounts, each element accounts[i] is a list of strings,
# where the first element accounts[i][0] is a name,
# and the rest of the elements are emails representing emai... | kamyu104/LeetCode | Python/accounts-merge.py | Python | mit | 3,714 |
from pprint import pformat
import os
import sys
from difflib import SequenceMatcher
from .. import logs, types, const
from ..conf import settings
from ..corrector import get_corrected_commands
from ..exceptions import EmptyCommand
from ..ui import select_command
from ..utils import get_alias, get_all_executables
def ... | SimenB/thefuck | thefuck/entrypoints/fix_command.py | Python | mit | 1,556 |
#### 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 = Intangible()
result.template = "object/draft_schematic/food/shared_dish_thakitillo.iff"
result.attribute_template... | obi-two/Rebelion | data/scripts/templates/object/draft_schematic/food/shared_dish_thakitillo.py | Python | mit | 449 |
from .message import Message
from .message_thread import MessageThread
from .user import User, OKCupydUser
| IvanMalison/okcupyd | okcupyd/db/model/__init__.py | Python | mit | 107 |
# -*- encoding: utf-8 -*-
from . import FixtureTest
class HealthcareTest(FixtureTest):
def test_blood_donation(self):
import dsl
z, x, y = (16, 11205, 26166)
self.generate_fixtures(
# https://www.openstreetmap.org/way/227712531
dsl.way(227712531, dsl.tile_box(z, ... | mapzen/vector-datasource | integration-test/1596-junk-healthcare-values.py | Python | mit | 10,521 |
""" Discord API snake bot """
"""
MIT License
Copyright (c) 2016 AnonymousDapper
Permission is hereby granted
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, su... | SpoopySaitama/snake | snake.py | Python | mit | 18,353 |
# -*- coding: utf-8 -*-
from iktomi import web
from iktomi.web.filters import *
from iktomi.templates import jinja2, Template
from environment import Environment
import cfg
import handlers as h
static = static_files(cfg.STATIC)
media = static_files(cfg.MEDIA, '/media/')
template = Template(cfg.TEMPLATES, jinja2.TEMPL... | Lehych/iktomi | examples/filefield/app.py | Python | mit | 657 |
#### 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 = Intangible()
result.template = "object/draft_schematic/vehicle/component/shared_structural_reinforcement_heavy.iff... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/vehicle/component/shared_structural_reinforcement_heavy.py | Python | mit | 477 |