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 |
|---|---|---|---|---|---|---|
from compiler import *
####################################################################################################################
# Each party record contains the following fields:
# 1) Party id: used for referencing parties in other files.
# The prefix p_ is automatically added before each party id.
#... | Sw4T/Warband-Development | mb_warband_module_system_1166/Module_system 1.166/module_parties.py | Python | mit | 34,291 | 0.065207 |
__author__ = 'Thomas Rueckstiess and Tom Schaul'
from pybrain.rl.environments.cartpole.nonmarkovpole import NonMarkovPoleEnvironment
from pybrain.rl.tasks import EpisodicTask
from cartpole import CartPoleEnvironment
from scipy import pi, dot, array
class BalanceTask(EpisodicTask):
""" The task of balancing some ... | daanwierstra/pybrain | pybrain/rl/environments/cartpole/balancetask.py | Python | bsd-3-clause | 4,061 | 0.008126 |
import os
import sys
import math
import time
import json
from rpc_client import RPC_Client
ROOT = os.path.dirname(os.path.realpath(sys.argv[0]))
DBPATH = os.path.join(ROOT, 'build.json')
MAXGAS = hex(int(math.pi*1e6))
def get_db():
with open(DBPATH) as dbfile:
return json.load(dbfile)
def save_db(db):
... | kustomzone/augur-core | pyrpctools/__init__.py | Python | gpl-3.0 | 1,125 | 0.008 |
#!/usr/bin/python
"""
Halo mass function and halo bias model.
"""
import numpy as np
import scipy.integrate
import pylab as P
#om = 0.3
#h = 0.7
#gamma = 0.55
class HaloModel(object):
def __init__(self, pkfile, om=0.272, h=0.728, gamma=0.55, ampfac=1.):
"""
Initialise HaloModel class.
... | philbull/ghost | halomodel.py | Python | mit | 6,878 | 0.00916 |
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
print(myPath)
sys.path.insert(0, myPath + '/../SATSolver')
from unittest import TestCase
from SATSolver.individual import Factory
class TestFactory(TestCase):
"""
Test class for Factory
"""
def test_create(self):
factory ... | Imperium-Software/resolver | tests/test_factory.py | Python | mit | 511 | 0.009785 |
import uuid
import factory.fuzzy
from .. import models, enums
from moneyed import Money
from utils.factories import FuzzyMoney
class WalletFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.Wallet
owner_id = factory.Sequence(lambda n: str(uuid.uuid4()))
balance = Money(0, 'SEK... | uppsaladatavetare/foobar-api | src/wallet/tests/factories.py | Python | mit | 926 | 0 |
from datetime import datetime
from collections import namedtuple
BASE_URL = 'http://conworkshop.com/'
class User(namedtuple('User', 'uid name gender bio country karma')):
@property
def link(self):
'''Return a URL in a string to the user's profile page on CWS.'''
return ''.join([BASE_URL, 'view... | xylophonw/cwspy | cwspy/data.py | Python | mit | 1,465 | 0.005461 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | les69/calvin-base | calvin/runtime/south/plugins/storage/twistedimpl/securedht/dht_server.py | Python | apache-2.0 | 9,399 | 0.002873 |
#try to support many flavours of lapack
import autoinstall_lib as atl
from waflib import Logs
import os.path as osp
def options(ctx):
atl.add_lib_option("pmc",ctx,install=False)
def configure(ctx):
ctx.env.has_pmc = False
#pmc_config_path = ctx.find_program("pmc-config",path_list=[ctx.options.pmc_prefix+"... | ClaudioNahmad/Servicio-Social | Parametros/CosmoMC/prerrequisitos/plc-2.0/waf_tools/pmclib.py | Python | gpl-3.0 | 653 | 0.047473 |
from wagtail.wagtailcore.blocks import RichTextBlock, CharBlock, ListBlock, \
StructBlock
class CollapseEntryBlock(StructBlock):
title = CharBlock()
content = RichTextBlock()
class Meta:
form_template = 'common/block_forms/collapse_entry.html'
template = 'common/blocks/collapse_entry... | baylee-d/cos.io | common/blocks/collapsebox.py | Python | apache-2.0 | 705 | 0 |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from collections import defaultdict
from glob import glob
import os
import time
from xml.etree.ElementTree import ElementTree
# project
from checks import AgentCheck
class Skip(Exception):
"""
R... | WPMedia/dd-agent | checks.d/jenkins.py | Python | bsd-3-clause | 8,601 | 0.002558 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from decimal import Decimal
from unittest import skipIf
from django import test
from django import VERSION as DJANGO_VERSION
from django.utils import timezone
from django.utils import translation
from yepes.contrib.registry... | samuelmaudo/yepes | tests/modelmixins/tests.py | Python | bsd-3-clause | 44,994 | 0.000622 |
import re
import string
import random
__author__ = 'schitic'
def tokenGenerator(size=16, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
def validateEmail(email):
if len(email) > 3:
if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3... | omg-insa/server | api/utils.py | Python | bsd-3-clause | 372 | 0.021505 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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... | jamielennox/tempest | tempest/auth.py | Python | apache-2.0 | 24,953 | 0.00004 |
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2018 Justin Kufro <jkufro@andrew.cmu.edu> #
# Copyright 2018 Ivan Minno <iminno@andrew.cmu.edu> ... | Vagab0nd/SiCKRAGE | lib3/github/Path.py | Python | gpl-3.0 | 3,820 | 0.007068 |
# Copyright 2014-2017 by Akira Yoshiyama <akirayoshiyama@gmail.com>.
# 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... | yosshy/osclient2 | osclient2/neutron/v2/lb/vip.py | Python | apache-2.0 | 4,709 | 0 |
import datetime
import time
from django.utils.timezone import utc
from django.core.servers.basehttp import FileWrapper
from django.http import HttpResponse
from django import forms, http
import signal
import shutil
from uuid import uuid4
import ntpath
import json
import glob
import os
from StringIO import StringIO
fr... | markusmichel/Tworpus-Client | session/views.py | Python | apache-2.0 | 9,915 | 0.001614 |
#
# 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
# "License"); you may not... | bhardesty/qpid-dispatch | tests/system_tests_fallback_dest.py | Python | apache-2.0 | 29,872 | 0.003214 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from driver27.models import Driver, Team, Seat
import sys
if sys.version_info < (3, 0):
try:
import unicodecsv as csv
except ImportError:
import csv
else:
import csv
class Command(BaseCommand):
h... | SRJ9/django-driver27 | driver27/management/commands/export_seats_for_csv.py | Python | mit | 1,566 | 0.001916 |
#!/usr/bin/python
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# gen_dxgi_format_table.py:
# Code generation for DXGI format map.
from datetime import date
import sys
sys.path.append('../..')
i... | ecoal95/angle | src/libANGLE/renderer/d3d/d3d11/gen_dxgi_format_table.py | Python | bsd-3-clause | 3,280 | 0.006402 |
# -*- coding: utf-8 -*-
import os
import kobo.cli
import kobo.admin
class Start_Worker_Task(kobo.cli.Command):
"""create a worker task module in the current directory"""
enabled = True
def options(self):
self.parser.usage = "%%prog %s [options] <task_name>" % self.normalized_name
self.... | pombredanne/https-git.fedorahosted.org-git-kobo | kobo/admin/commands/cmd_start_worker_task.py | Python | lgpl-2.1 | 815 | 0.002454 |
from node.models import *
from django.forms import ModelForm
from django.forms.formsets import BaseFormSet
from django.forms.models import modelformset_factory
from .cdmsportalfunc import *
from django.core.exceptions import ValidationError
from django import forms
class MoleculeForm(ModelForm):
class Meta:
... | cpe/VAMDC-VALD | nodes/jpl/node/forms.py | Python | gpl-3.0 | 2,202 | 0.011807 |
#!/usr/bin/env python3
import os
import re
import subprocess
import sys
import threading
import time
import urllib
from subprocess import Popen, PIPE
sys.path.append("..")
from check_with_sitemap import CheckWithSitemap
DEFAULT_JAVA_PATH = 'java'
class CheckWithSiteMapVpro(CheckWithSitemap):
"""
This specia... | npo-poms/scripts | python/vpro/check_with_sitemap_vpro.py | Python | gpl-2.0 | 6,894 | 0.004787 |
"""Support for Z-Wave sensors."""
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, DOMAIN, SensorEntity
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
... | jawilson/home-assistant | homeassistant/components/zwave/sensor.py | Python | apache-2.0 | 3,679 | 0.000815 |
#!/usr/bin/python
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
Print = PETSc.Sys.Print
# from MatrixOperations import *
from dolfin import *
import numpy as np
import matplotlib.pylab as plt
import scipy.sparse as sps
import scipy.sparse.linalg as slinalg
import os
import scipy.io
i... | wathen/PhD | MHD/FEniCS/ShiftCurlCurl/saddle.py | Python | mit | 5,740 | 0.022997 |
#!/usr/bin/env python
import pyemma
import numpy as np
import mdtraj
import time
import os
# Source directory
source_directory = '/cbio/jclab/projects/fah/fah-data/munged3/no-solvent/11401' # Src ensembler
################################################################################
# Load reference topology
####... | jchodera/MSMs | jchodera/src-11401/pyemma/cluster.py | Python | gpl-2.0 | 3,309 | 0.012088 |
#-*- coding: utf-8 -*-
from PIL import Image, ImageChops, ImageDraw
from django.contrib.auth.models import User
from filer.models.foldermodels import Folder
from filer.models.clipboardmodels import Clipboard, ClipboardItem
def create_superuser():
superuser = User.objects.create_superuser('admin',
... | croepha/django-filer | filer/tests/helpers.py | Python | mit | 1,697 | 0.007661 |
import json
import random
import time
import traceback
from optparse import make_option
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db import connection
from aggregator.converters.random_cnv import RandomDataConverter
from aggregator.management.comma... | dipapaspyros/bdo_platform | aggregator/management/commands/compare_mongo_postgres_joins.py | Python | mit | 13,096 | 0.003894 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import pickle
import random
import bisect
import operator
import functools
import itertools
from math import log
from .common_surnames import d as common_surnames
from .lookuptable import chrevlookup, pinyintrie, surnamerev
for py in tuple(chrevlookup.keys()):... | gumblex/tg-chatdig | vendor/chinesename.py | Python | mit | 6,353 | 0.008223 |
import unittest
from pyltc.plugins.simnet import SimNetPlugin
class TestNetSim(unittest.TestCase):
def test_configure_default(self):
netsim = SimNetPlugin()
self.assertEqual([], netsim._args.upload)
self.assertEqual([], netsim._args.download)
self.assertEqual('lo', netsim._args.i... | yassen-itlabs/py-linux-traffic-control | tests/plugins_tests/test_netsim.py | Python | mit | 2,138 | 0.003742 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "maiziblog2.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| llinmeng/PythonStudy | maiziedu/3-Pycharm-Study/maiziblog2/manage.py | Python | mit | 253 | 0 |
from distutils.core import setup
from distutils.extension import Extension
from distutils import util
from Pyrex.Distutils import build_ext
import os.path
# Hack to get around build_ext's inability to handle multiple
# libraries in its --libraries= argument.
libs = []
if util.get_platform() == 'win32':
libs = [ "wp... | timwu/pypcap | src/setup.py | Python | bsd-3-clause | 673 | 0.026746 |
from datetime import datetime
from flask import current_app
from flask.cli import with_appcontext
from invenio_db import db
from hepdata.cli import fix
from hepdata.ext.elasticsearch.api import index_record_ids, push_data_keywords
from hepdata.modules.submission.models import HEPSubmission, DataSubmission
from hepdat... | HEPData/hepdata3 | fixes/missing_record_ids.py | Python | gpl-2.0 | 2,910 | 0.002062 |
#!/usr/bin/env python
"""
This activity will calculate the ratio between CPU request and Memory request by (job ID, task index, event type).
These fields are optional and could be null.
"""
# It will connect to DataStoreClient
from sciwonc.dataflow.DataStoreClient import DataStoreClient
import ConfigDB_TaskEvent_0
imp... | elainenaomi/sciwonc-dataflow-examples | sbbd2016/experiments/4-mongodb-rp-3sh/9_workflow_full_10files_primary_3sh_noannot_with_proj_9s/calculateratio_0/CalculateRatioCpuMemory_0.py | Python | gpl-3.0 | 3,196 | 0.003129 |
"""A zigzag path, a sequence of points."""
import collections
from .defuzz import Defuzzer
from .euclid import collinear, Point, Line, Segment, Bounds, EmptyBounds
from .postulates import adjacent_pairs, triples
class Path:
def __init__(self, points):
self.points = tuple(points)
def __repr__(self):... | nedbat/zellij | zellij/path.py | Python | apache-2.0 | 8,958 | 0.001563 |
# BaseThought.py
# This file is part of Labyrinth
#
# Copyright (C) 2006 - Don Scorgie <DonScorgie@Blueyonder.co.uk>
#
# Labyrinth 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 2 of the Licens... | Boquete/activity-labyrinth | src/BaseThought.py | Python | gpl-2.0 | 13,410 | 0.03997 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
"""
Sync's doctype and docfields from txt files to database
perms will get synced only if none exist
"""
import frappe
import os
from frappe.modules.import_file ... | bohlian/frappe | frappe/model/sync.py | Python | mit | 2,605 | 0.0238 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class perl_WWW_RobotRules(test.test):
"""
Autotest module for testing basic functionality
of perl_WWW_RobotRules
@author Hariharan T.S. <harihare@in.ibm.com> ... | rajashreer7/autotest-client-tests | linux-tools/perl_WWW_RobotRules/perl_WWW_RobotRules.py | Python | gpl-2.0 | 1,298 | 0.005393 |
from django.contrib import admin
from .models import File, Link
from .forms import FileForm
class FileAdmin(admin.ModelAdmin):
list_display = ('id', 'md5', 'file', 'size')
list_per_page = 100
list_display_links = ('md5',)
form = FileForm
class LinkAdmin(admin.ModelAdmin):
list_display = ('id', ... | chaos-soft/chocola | files/admin.py | Python | mit | 479 | 0 |
__all__ = [
"beast"
, "human"
]
| sushengyang/Data-Science-45min-Intros | python-oop/life/__init__.py | Python | unlicense | 57 | 0.035088 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# Ansible 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 of the Li... | hkariti/ansible | lib/ansible/modules/network/vyos/vyos_banner.py | Python | gpl-3.0 | 5,186 | 0.001928 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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 of the License, or
# (at your option) any later version.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/ocil_2_0/QuestionResultsType.py | Python | gpl-3.0 | 1,472 | 0.003397 |
import sys
import traceback
def Die(Msg):
print >> sys.stderr
print >> sys.stderr
traceback.print_stack()
s = ""
for i in range(0, len(sys.argv)):
if i > 0:
s += " "
s += sys.argv[i]
print >> sys.stderr, s
print >> sys.stderr, "**ERROR**", Msg
print >> sys.stderr
print >> sys.stderr
sys.exit(1)
prin... | nioo-knaw/hydra | uparse_scripts/die.py | Python | mit | 446 | 0.042601 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-27 15:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lots_admin', '0021_auto_20160927_0941'),
]
operations = [
migrations.AlterFie... | datamade/large-lots | lots_admin/migrations/0022_auto_20160927_1051.py | Python | mit | 462 | 0 |
# -*- coding: utf-8 -*-
"""
Network Plugin
Network usage and connections
"""
import os, netifaces, psutil, time
from pkm import utils, SHAREDIR
from pkm.decorators import never_raise, threaded_method
from pkm.plugin import BasePlugin, BaseConfig
from pkm.filters import register_filter
NAME = 'Network'
DEFAULT_IGNORES ... | mjs7231/pkmeter | pkm/plugins/network.py | Python | bsd-3-clause | 2,803 | 0.004638 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
f... | globaltoken/globaltoken | test/functional/test_runner.py | Python | mit | 23,006 | 0.003043 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# Developped with python 2.7.3
import os
import sys
import tools
import json
print("The frame :")
name = raw_input("-> name of the framework ?")
kmin = float(raw_input("-> Minimum boundary ?"))
kmax = float(raw_input("-> Maximum boundary ?"))
precision = float(raw_input("-> ... | tchaly-bethmaure/Emotes | script/script_tools/framework_file_generator.py | Python | gpl-2.0 | 1,143 | 0.013123 |
import json
from collections import (
Counter,
defaultdict as deft
)
from copy import deepcopy as cp
# from cPickle import (
# dump as to_pickle,
# load as from_pickle
# )
from StringIO import StringIO
from TfIdfMatrix import TfIdfMatrix
from Tools import from_csv
class CategoryTree:
de... | JordiCarreraVentura/spellchecker | lib/CategoryTree.py | Python | gpl-3.0 | 7,145 | 0.004479 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... | mganeva/mantid | Framework/PythonInterface/test/python/plugins/algorithms/AbinsBasicTest.py | Python | gpl-3.0 | 10,112 | 0.003362 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
datadir = os.path.dirname(__file__)
with op... | westurner/provis | setup.py | Python | bsd-3-clause | 2,041 | 0.00294 |
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 | 0.022312 |
# -*- coding: utf-8 -*-
import kivy
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.properties import ObjectProperty
from kivy.uix.popup import Popup
from pos_system import POS, Item
from db import Database
from buttonex import ButtonEx
from ... | iamthekyt/POS-System | src/controller.py | Python | gpl-3.0 | 5,417 | 0.006464 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adopteitor_core', '0010_ipn'),
]
operations = [
migrations.AlterModelOptions(
name='ipn',
options={'... | smarbos/adopteitor-server | adopteitor_core/migrations/0011_auto_20170221_2157.py | Python | mit | 368 | 0 |
# -*- coding: utf-8 -*-
"""Parser for McAfee Anti-Virus Logs.
McAfee AV uses 4 logs to track when scans were run, when virus databases were
updated, and when files match the virus database."""
from plaso.events import text_events
from plaso.lib import errors
from plaso.lib import timelib
from plaso.parsers import man... | ostree/plaso | plaso/parsers/mcafeeav.py | Python | apache-2.0 | 5,046 | 0.005747 |
from .main import HnsccVisitAdmin, HnsccOffStudyAdmin
from .enrollment_admin import EnrollmentAdmin
from .contemporary_admin import ContemporaryAdmin
# from .historical_admin import HistoricalAdmin
from .hnscc_off_study_model_admin import HnsccOffStudyModelAdmin
| botswana-harvard/bhp065_project | bhp065/apps/hnscc_subject/admin/__init__.py | Python | gpl-2.0 | 263 | 0 |
import datetime
import os
import pickle
import pngcanvas
import jinja2
import random
import re
import sys
import webapp2
import zlib
from google.appengine.api import memcache
from google.appengine.api import users
from google.appengine.ext import db
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystem... | flagxor/rainbowforth | iconforth/iconforth.py | Python | gpl-3.0 | 17,696 | 0.010793 |
# requires:
# pip install discord.py
# pip install asyncio
# pip install bs4
# pip install imgurpython
# pip install youtube-dl
# pip install chatterbot
# put this (view raw) in the base directory for windows:
# https://github.com/Just-Some-Bots/MusicBot/blob/ea5e0daebd384ec8a14c9a585da399934e2a6252/libopus-0.x64.dll... | TuDatTr/OkBot | main.py | Python | apache-2.0 | 10,102 | 0.001292 |
"""
Shelhamer E. et al "`Fully Convolutional Networks for Semantic Segmentation
<https://arxiv.org/abs/1605.06211>`_"
"""
import tensorflow as tf
from . import TFModel, VGG16
from .layers import conv_block
class FCN(TFModel):
""" Base Fully convolutional network (FCN) """
@classmethod
def default_config(... | analysiscenter/dataset | batchflow/models/tf/fcn.py | Python | apache-2.0 | 9,221 | 0.002061 |
import re
import os
import struct
import sys
import numbers
from collections import namedtuple, defaultdict
def int_or_float(s):
# return number, trying to maintain int format
if s.isdigit():
return int(s, 10)
else:
return float(s)
DBCSignal = namedtuple(
"DBCSignal", ["name", "start_bit", "size", "i... | vntarasov/openpilot | opendbc/can/dbc.py | Python | mit | 8,588 | 0.009432 |
import os, re, requests
from bs4 import BeautifulSoup
from totalimpact.providers import provider
from totalimpact.providers.provider import Provider, ProviderContentMalformedError, ProviderRateLimitError
import logging
logger = logging.getLogger('ti.providers.linkedin')
class Linkedin(Provider):
example_id = ... | Impactstory/total-impact-core | totalimpact/providers/linkedin.py | Python | mit | 2,365 | 0.017336 |
"""Charm Helpers saltstack - declare the state of your machines.
This helper enables you to declare your machine state, rather than
program it procedurally (and have to test each change to your procedures).
Your install hook can be as simple as:
{{{
from charmhelpers.contrib.saltstack import (
install_salt_suppor... | Ubuntu-Solutions-Engineering/glance-simplestreams-sync-charm | hooks/charmhelpers/contrib/saltstack/__init__.py | Python | agpl-3.0 | 2,778 | 0 |
"""Tests of email marketing signal handlers."""
import logging
import ddt
from django.test import TestCase
from mock import patch
from student.tests.factories import UserFactory
from openedx.features.enterprise_support.tests.factories import EnterpriseCustomerFactory, EnterpriseCustomerUserFactory
log = logging.getLo... | BehavioralInsightsTeam/edx-platform | openedx/features/enterprise_support/tests/test_signals.py | Python | agpl-3.0 | 1,328 | 0.000753 |
"""Module that reads binary Plink files."""
# This file is part of pyplink.
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Louis-Philippe Lemieux Perreault
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
... | mkelcb/knet | knet/com/io/pyplink.py | Python | mit | 18,683 | 0.000054 |
# Copyright (c) 2013 eGauge Systems LLC
# 4730 Walnut St, Suite 110
# Boulder, CO 80301
# voice: 720-545-9767
# email: davidm@egauge.net
#
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | thecardcheat/egauge-api-examples | python/eGauge.py | Python | mit | 5,735 | 0.013426 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Course.riw_style'
db.add_column(u'core_course', 'riw_styl... | mupi/tecsaladeaula | core/migrations/0039_auto__add_field_course_riw_style.py | Python | agpl-3.0 | 19,646 | 0.007839 |
from hypothesis import given
from hypothesis.strategies import text
from cv2stuff.hypothesis_code import encode, decode
@given(text())
def test_decode_inverts_encode(s):
assert decode(encode(s)) == s
| jskksj/cv2stuff | cv2stuff/tests/test_hypothesis_code.py | Python | isc | 206 | 0 |
# -*- coding: utf-8 -*-
# This file is part of addfips.
# http://github.com/fitnr/addfips
# Licensed under the GPL-v3.0 license:
# http://opensource.org/licenses/GPL-3.0
# Copyright (c) 2016, fitnr <fitnr@fakeisthenewreal>
# pylint: disable=missing-docstring,invalid-name
import csv
import io
import subprocess
import sy... | fitnr/addfips | tests/test_cli.py | Python | gpl-3.0 | 3,471 | 0.000576 |
# Copyright 2017 Starbot Discord Project
#
# 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 applica... | dhinakg/BitSTAR | api/database/table.py | Python | apache-2.0 | 1,329 | 0.004515 |
# concord module
| douglasdecouto/py-concord | ConcordAlarm.indigoPlugin/Contents/Server Plugin/concord/__init__.py | Python | bsd-3-clause | 17 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__VERSION__ = ""
# EOF
| samjy/acmeclient | acmeclient/__init__.py | Python | mit | 73 | 0 |
from django.db import models
from django.utils import timezone
from videolibrary.models import SourceVideo
# Create your models here.
# TODO consider whether this is needed anymore
class RequestedSign(models.Model):
short_description = models.CharField(max_length=100)
description = models.TextField()
dat... | nasfarley88/thebslparlour | bslparloursite/tgbot/models.py | Python | cc0-1.0 | 651 | 0.00768 |
import os
import pickle
import csv
import pandas as pd
import math
from functools import lru_cache, reduce
from collections import defaultdict
USE_ROME_SLICING_DATASET = False # Rome slicing dataset is not ready yet
if USE_ROME_SLICING_DATASET:
OGR_ROME_FILE = "rome_slicing_dataset/ogr_rome_mapping.csv"
ROM... | StartupsPoleEmploi/labonneboite | labonneboite/common/load_data.py | Python | agpl-3.0 | 8,478 | 0.003303 |
# Copyright 2022 The Scenic Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | google-research/scenic | scenic/common_lib/video_utils.py | Python | apache-2.0 | 1,353 | 0.007391 |
from serial import Serial
class Hardware(object):
def __init__(self, port, debug=False):
self.debug = debug
self.port = Serial(port, timeout=0.01)
self.resetConnection()
def resetConnection(self):
print 'Establishing connection...'
repeatCount = 0
while True:
if repeatCount == 100:
print 'Mo... | zr40/scc | lib/hardware.py | Python | mit | 3,587 | 0.02983 |
# -*- coding: utf-8 -*-
# Copyright 2015 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
#
# Unle... | ekarlso/partizan | tests/functional/fixtures/database.py | Python | apache-2.0 | 2,371 | 0 |
import datetime
try:
import urlparse
except (ImportError):
import urllib.parse as urlparse
import calendar
import pytz
import re
from maicroft.util import Util
from maicroft.activity_metrics_proc import process_metrics
from maicroft.activity_metrics_proc import process_submission_metrics
from maicroft.subreddi... | thundergolfer/mAIcroft | maicroft/social_info_extraction.py | Python | mit | 15,272 | 0.000262 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | vthorsteinsson/tensor2tensor | tensor2tensor/models/bytenet_test.py | Python | apache-2.0 | 1,719 | 0.004072 |
#!/usr/bin/env python
import roslib; roslib.load_manifest('ar_slam_base')
import rospy
from std_msgs.msg import Float64,Float32
from sensor_msgs.msg import JointState
from geometry_msgs.msg import PointStamped
import tf
import numpy
import message_filters
from ar_slam_base.mapping_kf import *
from ar_track_alvar_msg... | cedricpradalier/vrep_ros_ws | src/ar_slam_base/nodes/rover_mapping.py | Python | bsd-3-clause | 6,109 | 0.014241 |
#!/usr/bin/env python3
'''
kicad-footprint-generator 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 of the License, or
(at your option) any later version.
kicad-footprint-generator is distribut... | SchrodingersGat/kicad-footprint-generator | scripts/Connector/Connector_JST/conn_jst_VH_tht_side-stabilizer.py | Python | gpl-3.0 | 12,829 | 0.027983 |
"""
Linux kernel system control from Python.
"""
| kdart/pycopia | core/pycopia/OS/Linux/sysctl.py | Python | apache-2.0 | 52 | 0.019231 |
""" Object module for pypass
This module contains the objects from and to which the json is
generated/read.
"""
#-*- coding: utf-8 -*-
# Copyright (c) 2011 Pierre-Yves Chibon <pingou AT pingoured DOT fr>
# Copyright (c) 2011 Johan Cwiklinski <johan AT x-tnd DOT be>
#
# This file is part of pypass.
#
# pypass is free s... | pypingou/pypass | pypass/pypobj.py | Python | gpl-3.0 | 4,872 | 0.003079 |
from django.contrib import admin
from .models import Friend
class FriendAdmin(admin.ModelAdmin):
list_display = ('full_name', 'profile_image')
def profile_image(self, obj):
return '<img src="%s" width="50" heith="50">' % obj.photo
profile_image.allow_tags = True
admin.site.register(Friend, Frie... | damianpv/exercise | home/admin.py | Python | gpl-2.0 | 328 | 0.009146 |
import numpy
import six
from chainer.dataset import dataset_mixin
class SubDataset(dataset_mixin.DatasetMixin):
"""Subset of a base dataset.
SubDataset defines a subset of a given base dataset. The subset is defined
as an interval of indexes, optionally with a given permutation.
If ``order`` is gi... | kikusu/chainer | chainer/datasets/sub_dataset.py | Python | mit | 7,241 | 0 |
import theano
import theano.tensor as T
import numpy as np
from learn_theano.utils.download_all_datasets import get_dataset
import cPickle
import time
def one_zero_loss(prediction_labels, labels):
return T.mean(T.neq(prediction_labels, labels))
def negative_log_likelihood_loss(prediction_probailities, labels):... | consciousnesss/learn_theano | learn_theano/deeplearning_tutorials/test_0_logistic_regression.py | Python | apache-2.0 | 4,748 | 0.004212 |
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# 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 co... | austinharris/gem5-riscv | src/mem/slicc/symbols/Transition.py | Python | bsd-3-clause | 2,750 | 0.004 |
# -*- coding: utf-8 -*-
from datetime import date
from urllib import quote_plus
from openerp import models, fields, api, exceptions
class ApplicationRejectedReason(models.Model):
_name = 'offers.application.rejected'
name = fields.Char(required=True)
description = fields.Text(required=True)
class Appl... | KamilWo/bestja | addons/bestja_offers/models/application.py | Python | agpl-3.0 | 8,916 | 0.000786 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
编程练习:使用二分查找算法求一个任意非负数的平方根(近似值即可)
"""
while True:
x = input("请输入一个非负数:")
try:
x = int(x)
if x < 0:
print(x, " 不是一个非负数")
else:
break
except ValueError:
print(x, " 不符合要求")
epsilon = 0.0001
num_guesses = ... | felix9064/python | Demo/demo/demo003.py | Python | mit | 721 | 0 |
# Copyright (C) 2021 FUJITSU
# 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 a... | stackforge/tacker | samples/mgmt_driver/kubernetes_mgmt.py | Python | apache-2.0 | 147,274 | 0.000109 |
from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from forms import LoginForm, EditForm
from models import User, ROLE_USER, ROLE_ADMIN
from datetime import datetime
@lm.user... | hmdavis/flask-mega-tutorial | app/views.py | Python | bsd-3-clause | 4,940 | 0.018421 |
import unittest
from django.core.urlresolvers import resolve, reverse, NoReverseMatch
from pulp.server.webservices.urls import handler404
def assert_url_match(expected_url, url_name, *args, **kwargs):
"""
Generate a url given args and kwargs and pass it through Django's reverse and
resolve f... | ulif/pulp | server/test/unit/server/webservices/test_urls.py | Python | gpl-2.0 | 33,452 | 0.001196 |
# -*- coding: utf-8 -*-
"""
Demonstrates a way to put multiple axes around a single plot.
(This will eventually become a built-in feature of PlotItem)
"""
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui, QtWidgets
impo... | mylxiaoyi/mypyqtgraph-qt5 | examples/MultiplePlotAxes.py | Python | mit | 1,925 | 0.016623 |
"""
A parser filter for namespace support. Placed externally to the parser
for efficiency reasons.
$Id: namespace.py,v 1.1 2005/10/05 20:19:37 eytanadar Exp $
"""
import string
import xmlapp
# --- ParserFilter
class ParserFilter(xmlapp.Application):
"A generic parser filter class."
def __ini... | carvalhomb/tsmells | guess/src/Lib/xml/parsers/xmlproc/namespace.py | Python | gpl-2.0 | 5,187 | 0.022556 |
import mock
class MockTest(mock.Mock):
def test_fun1(self, p1, p2):
pass
m = MockTest()
m.test_fun1(1, 2)
m.test_fun1.assert_called_with(1, 2) | peter-wangxu/python_play | test/mock_test/MockChild.py | Python | apache-2.0 | 160 | 0.00625 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
from nose.tools import assert_almost_equal, eq_
import mapnik
from .utilities import execution_path, run_all
def setup():
# All of the paths used are relative, if we run the tests
# from another ... | mapnik/python-mapnik | test/python_tests/topojson_plugin_test.py | Python | lgpl-2.1 | 3,919 | 0.000511 |
# -*- coding: utf-8 -*-
'''
Much Movies HD XBMC Addon
Copyright (C) 2014 lambda
This program 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 of the License, or
(... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/plugin.video.muchmovies.hd/default.py | Python | gpl-2.0 | 51,620 | 0.010965 |
#
# Simple BCF config script
# No error checking
#
import requests
import json
import sys
requests.packages.urllib3.disable_warnings()
class Controller(object):
"""
controller version 4.x
"""
def __init__(self, controller_ip, access_token):
self.bcf_path = '/api/v1/data/controller/applica... | bigswitch/sample-scripts | bcf/controller_bcf.py | Python | mit | 7,886 | 0.006848 |
from django.conf import settings
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation
from django.utils.functional import cached_property
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_ops = 'GIST_GEOMETRY_OPS'
geom_index_ops_nd = 'GIST_GEOMETRY_OPS_ND... | edisonlz/fruit | web_project/base/site-packages/django/contrib/gis/db/backends/postgis/creation.py | Python | apache-2.0 | 4,498 | 0.001779 |
# Copyright (C) 2013 Red Hat, Inc.
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | zultron/virt-manager | tests/capabilities.py | Python | gpl-2.0 | 11,259 | 0.002487 |
import json
import logging
from typing import List, Optional
from uuid import uuid4
from django import http
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from django.db.utils import OperationalError
from django.views.decorators.http import requ... | specify/specify7 | specifyweb/workbench/views.py | Python | gpl-2.0 | 37,610 | 0.002154 |
import unittest
import os.path
from contextlib import contextmanager
from streamlink.plugin.plugin import UserInputRequester
from tests.mock import MagicMock, patch
from streamlink import Streamlink, PluginError
from streamlink_cli.console import ConsoleUserInputRequester
import streamlink_cli.console
from tests.plug... | back-to/streamlink | tests/test_plugins_input.py | Python | bsd-2-clause | 2,652 | 0.001131 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.