code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""
Django settings for youtube project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
f... | shiminsh/youtube_analytics | youtube/youtube/settings.py | Python | mit | 2,602 |
from coffin.contrib.syndication.feeds import Feed as OldFeed
class TestOldFeed(OldFeed):
title = 'Foo'
link = '/'
def items(self):
return [1,2,3]
def item_link(self, item):
return '/item'
title_template = 'feeds_app/feed_title.html'
description_template = 'feed... | akx/coffin | tests/res/apps/feeds_app/feeds.py | Python | bsd-3-clause | 782 |
from datetime import datetime
thesis_map = {
'mappings': {
'thesis': {
'properties': {
'abstract': {'type': 'string'},
'advisor': {'type': 'string', 'index': 'not_analyzed'},
'author': {'type': 'string', 'index': 'not_analyzed'},
... | mitlib-tdm/pit | pit/es.py | Python | apache-2.0 | 2,159 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from tekton import router
from gaecookie.decorator import no_csrf
from categoria_app import facade
from routes.categorias.admin import new, edit
def delete(_handler, categoria_id):
... | renzon/fatec-script | backend/appengine/routes/categorias/admin/home.py | Python | mit | 1,148 |
# -*- coding: utf-8 -*-
"""
updown.fields
~~~~~~~~~~~~~
Fields needed for the updown ratings
:copyright: 2011, weluse (http://weluse.de)
:author: 2011, Daniel Banck <dbanck@weluse.de>
:license: BSD, see LICENSE for more details.
"""
from django.db.models import IntegerField, PositiveIntegerField
from django.conf impo... | snahor/django-updown | updown/fields.py | Python | bsd-3-clause | 8,184 |
# -*- coding: utf-8 -*-
import inspect
import random
import numpy as np
from django.contrib import messages
from django.views.generic import RedirectView
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.contrib.auth.mixins import UserPassesTestMixin
class RunAct... | math-a3k/django-ai | django_ai/base/views.py | Python | lgpl-3.0 | 2,787 |
def summary_ranges(nums):
res = []
l = len(nums)
if l == 1:
return [str(nums[0])]
i = 0
while i < l:
start = nums[i]
while i + 1 < l and nums[i + 1] - nums[i] == 1:
i += 1
if nums[i] != start:
res.append(str(start) + "->" + str(nums[i]))
... | marcosfede/algorithms | array/summary_ranges/summary_ranges.py | Python | gpl-3.0 | 542 |
class Solution(object):
def findRadius(self, houses, heaters):
"""
:type houses: List[int]
:type heaters: List[int]
:rtype: int
"""
heaters.sort()
lh = len(heaters)
ans = 0
for h in houses:
L, U = -1, lh
while L + 1 < U:... | ckclark/leetcode | py/heaters.py | Python | apache-2.0 | 894 |
from .app import app
def main():
app.run(debug=True)
| Laisky/ApiTestHandler | src/apitesthandler/__main__.py | Python | mit | 59 |
#
# @file TestUnitDefinition.py
# @brief SBML UnitDefinition unit tests
#
# @author Akiya Jouraku (Python conversion)
# @author Ben Bornstein
#
# $Id$
# $HeadURL$
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
#
# This file was generated automaticall... | alexholehouse/SBMLIntegrator | libsbml-5.0.0/src/bindings/python/test/sbml/TestUnitDefinition.py | Python | gpl-3.0 | 18,004 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | peeyush-tm/check_mk | web/htdocs/index.py | Python | gpl-2.0 | 13,601 |
from generator import ContactGenerator, GroupGenerator
import random
import allure
def test_add_contact_to_group(app, db):
with allure.step("Given a group list"):
groups = db.get_group_list()
if len(groups) == 0:
app.group.create(GroupGenerator().get_group())
groups = db.get... | melipharo/stru-python19 | test/test_add_contact_to_group.py | Python | bsd-2-clause | 1,294 |
keyword_comments = {
# Dictionary keys are header keywords that are commonly updated
# Dictionary values are standard comments for each keyword
"AMPNAME": "Amplifier name(s)",
"BIASIM": "Bias image used",
"BPMNAME": "Name of BPM used to identify bad pixels",
"BUNIT": "Physical units of the array... | pyrrho314/recipesystem | trunk/dontload-astrodata_Gemini/ADCONFIG_Gemini/lookups/keyword_comments.py | Python | mpl-2.0 | 2,363 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# __init__.py: defines this directory as the 'modules' package.
#
# Copyright 2010-2015 Jose Riguera Lopez <jriguera@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | jriguera/photoplace | photoplace/lib/PhotoPlace/UserInterface/__init__.py | Python | apache-2.0 | 991 |
from django.conf.urls import patterns, url, include
import views
urlpatterns = patterns('',
url(r'config/?$',views.get_config),
)
| oferb/OpenTrains | webserver/opentrain/client/urls.py | Python | bsd-3-clause | 142 |
# -*- coding: utf-8 -*-
"""utils"""
from threading import current_thread
from coop_cms.moves import MiddlewareMixin
class RequestNotFound(Exception):
"""exception"""
pass
class RequestManager(object):
"""get django request from anywhere"""
_shared = {}
def __init__(self):
"""his is a ... | ljean/coop_cms | coop_cms/utils/requests.py | Python | bsd-3-clause | 1,590 |
import time
import sys
import os
import signal
import random
import threading
from urlparse import urlparse
from datetime import datetime, timedelta
from registry import NewRegistry
from boto.dynamodb2.layer1 import DynamoDBConnection
from boto.dynamodb2 import connect_to_region
from boto.dynamodb2.items import Item
f... | trustedhousesitters/roster-python | roster/client.py | Python | mit | 6,278 |
#!/usr/bin/env python
import sys
# Set up file reader
if len( sys.argv ) != 2:
print "Error: requires exactly one command line argument to specify input file."
exit( 1 )
f = open( sys.argv[1], 'r' )
# Set up variables for storage
linesRead = 0
maxPop = 0
maxPopCountyName = ''
maxMenToWomen = 0.0
maxMToFCo... | SpencerMcClure/data_science_curriculum | county_data/process_county_data.py | Python | apache-2.0 | 1,201 |
import pytest
import os
import shutil
import xapian
@pytest.fixture(scope='module')
def delete_xapian_db():
if os.path.isdir('/tmp/xapian/search'):
shutil.rmtree('/tmp/xapian/search')
@pytest.fixture(scope='module')
def create_xapian_db():
""" Fixture that creates an empty xapian db """
db = xa... | fedora-infra/fedora-packages | tests/conftest.py | Python | agpl-3.0 | 405 |
#!/bin/env python
# _*_ coding:utf-8 _*_
import xlsxwriter
def fun1():
workbook = xlsxwriter.Workbook("demo1.xlsx")
worksheet1 = workbook.add_worksheet()
worksheet2 = workbook.add_worksheet("Foglio2")
worksheet3 = workbook.add_worksheet("Data")
worksheet4 = workbook.add_worksheet()
workbook.clo... | zhengjue/mytornado | study/3/XLsxWriter/3/demo.py | Python | gpl-3.0 | 3,686 |
#python
import benchmarking
# a test to compare the benchmark results for a number of bitmap plugins
compare_list = ["BitmapAdd",
"BitmapSubtract",
"BitmapMultiply",
"BitmapColorMonochrome",
"BitmapGamma",
"BitmapInvert",
... | barche/k3d | tests/bitmap/bitmap.modifier.BenchmarkComparison.py | Python | gpl-2.0 | 647 |
##
# Copyright (C) 2014, 2015 Matt Molyneaux
#
# This file is part of CimCity.
#
# CimCity 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 versi... | xray7224/CimCity | cim/items/civics.py | Python | gpl-3.0 | 1,199 |
from django.contrib.auth.models import User
from game.models import Point, Team
def addPoint(blame_username, fixer_username):
blame = User.objects.get(username=blame_username)
fixer = User.objects.get(username=fixer_username)
point = Point()
point.blame = blame
point.fixer = fixer
point.save()
return point
def... | MitMaro/The-Blame-Game | game/service.py | Python | mit | 1,086 |
s1 = "123456"
s2 = "567890"
def getOverlap(left, right):
if left == right[-len(left):]:
return left
i = -1
while True:
temp = left[0:i]
if temp == right[-len(temp):]:
return temp
elif temp == "":
return ""
i -= 1
print getOverlap(s1,s2)
| ravyg/algorithms | python/string_overlap.py | Python | gpl-3.0 | 319 |
import pandas as pd
from tribble.transformers import base
class ClearBlanks(base.BaseTransform):
"""Replaces empty values in the specified or default fields with `None`."""
FIELDS_TO_CLEAR = ['object_code']
def __init__(self, *fields: str) -> None:
self._fields = fields or self.FIELDS_TO_CLEAR
... | GoC-Spending/fuzzy-tribble | src/tribble/transformers/clear_blanks.py | Python | mit | 595 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py | Python | mit | 4,332 |
"""
Copyright 2018 Oliver Smith
This file is part of pmbootstrap.
pmbootstrap 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.
pmbootstrap ... | postmarketOS/pmbootstrap | pmb/flasher/run.py | Python | gpl-3.0 | 2,215 |
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import Polygon, PathPatch
from matplotlib.collections import PatchCollection
from mpl_toolkits.basemap import Basemap
import numpy as np
import io
import zipfile
import csv
import sys
def find_nearest... | openmachinesblog/visualization-census-2013 | basic.py | Python | mit | 6,264 |
from grouprise.features.gestalten import models
from django import dispatch
from django.contrib import auth
from django.db.models import signals
@dispatch.receiver(signals.post_save, sender=auth.get_user_model())
def user_post_save(sender, instance, **kwargs):
models.Gestalt.objects.get_or_create(user=instance)
| stadtgestalten/stadtgestalten | grouprise/features/gestalten/signals.py | Python | agpl-3.0 | 319 |
from traitlets import TraitType
class Callable(TraitType):
"""
A trait which is callable.
Classes are callable, as are instances
with a __call__() method.
"""
info_text = 'a callable'
def validate(self, obj, value):
if callable(value):
return value
else:
... | jupyterhub/oauthenticator | oauthenticator/traitlets.py | Python | bsd-3-clause | 350 |
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
npoints = 20 # number of integer support points of the distribution minus 1
npointsh = npoints / 2
npointsf = float(npoints)
nbound = 4 # bounds for the truncated normal
normbound = (1 + 1 / npointsf) * nbound # actual bounds of truncated no... | DailyActie/Surrogate-Model | 01-codes/scipy-master/doc/source/tutorial/examples/normdiscr_plot1.py | Python | mit | 1,531 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __... | klahnakoski/Bugzilla-ETL | vendor/mo_math/crypto.py | Python | mpl-2.0 | 3,453 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 0, transform = "Anscombe", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_LinearTrend/cycle_0/ar_/test_artificial_128_Anscombe_LinearTrend_0__100.py | Python | bsd-3-clause | 266 |
# -*- coding: utf-8 -*-
# -*- Channel Legalmente Gratis -*-
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*-
import re
import urllib
from channelselector import get_thumb
from core import httptools
from core import scrapertools
from core import servertools
from core import tmdb
from cor... | alfa-jor/addon | plugin.video.alfa/channels/legalmentegratis.py | Python | gpl-3.0 | 4,747 |
import os
import platform
import sys
from logging.handlers import SysLogHandler
LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
def get_logger_config(log_dir,
logging_env="no_env",
tracking_filename="tracking.log",
edx_filename="edx.log... | yokose-ks/edx-platform | common/lib/logsettings.py | Python | agpl-3.0 | 5,212 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# 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 License, or
# (at your option) an... | ravello/ansible | v2/test/plugins/test_plugins.py | Python | gpl-3.0 | 2,968 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on Feb 20, 2013
@author: Maribel Acosta
@author: Fabian Floeck
'''
from difflib import Differ
from mw.xml_dump import Iterator as mwIterator
from mw.xml_dump.functions import open_file
from time import time
from structures import Text
from structures.Paragraph imp... | priyankamandikal/wiki_accuracy_review | WikiwhoRelationships.py | Python | mit | 37,035 |
# -*- coding: utf-8 -*-
#
# FabGIS documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 2 22:29:26 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | timlinux/fabgis | docs/source/conf.py | Python | lgpl-2.1 | 10,614 |
#!/usr/bin/env python
import sys
#-------------------------------------------------------------------------------
# Read fasta file
#-------------------------------------------------------------------------------
def readFasta( fasta ):
print >> sys.stderr, 'Reading FASTA file ', fasta
lineNum = 1
chrname = ''
... | NGSchool2016/ngschool2016-materials | src/snpEff/scripts/vcfRefCorrect.py | Python | gpl-3.0 | 1,930 |
import os
from django import template
from django.conf import settings
from django.contrib.gis.geos import GEOSGeometry
from django.core.exceptions import FieldDoesNotExist
from django.template import Context
from django.template.exceptions import TemplateDoesNotExist
from django.utils.timezone import now
from django.... | makinacorpus/Geotrek | mapentity/templatetags/mapentity_tags.py | Python | bsd-2-clause | 6,708 |
"""
Module for constructing Control Flow Graphs (cfg)
CFG are represented with a dictionary of start_address:block
Blocks here refer to basic blocks, i.e code sequence with no branches
besides at the entry and exit.
Top Level Interface:
gen_CFG(instructions): returns dictionary of id:block
bin_to_cfg: return control... | enjhnsn2/reilex | graph.py | Python | gpl-3.0 | 2,542 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | punalpatel/st2 | st2common/tests/unit/test_rbac_resolvers_webhook.py | Python | apache-2.0 | 4,315 |
# Under MIT License, see LICENSE.txt
from typing import List
from RULEngine.Command.command import _Command
from RULEngine.Communication.util.serial_protocol import DribblerStatus
from RULEngine.Game.Player import Player
from ai.executors.executor import Executor
from RULEngine.Command import command
from RULEngine.Ut... | wonwon0/StrategyIA | ai/executors/command_executor.py | Python | mit | 5,310 |
__author__ = "Andrew Hankinson (andrew.hankinson@mail.mcgill.ca)"
__version__ = "1.5"
__date__ = "2011"
__copyright__ = "Creative Commons Attribution"
__license__ = """The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and assoc... | WoLpH/pybagit | pybagit/exceptions.py | Python | mit | 1,960 |
# A dictionary of movie critics and their ratings of a small
# set of movies
critics={'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,
'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5,
'The Night Listener': 3.0},
'Gene Seymour': {'Lady in the Water': 3.0, 'Snakes on a Pla... | 7u/pci | pci-code/chapter2/recommendations.py | Python | bsd-3-clause | 4,477 |
from django.db import models
class Requester(models.Model):
email = models.CharField(max_length=300)
zendesk_user_id = models.CharField(max_length=100)
def __str__(self):
return self.email
| prontotools/zendesk-tickets-machine | zendesk_tickets_machine/requesters/models.py | Python | mit | 212 |
# 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 u... | zhreshold/mxnet | tests/python/unittest/test_numpy_op.py | Python | apache-2.0 | 389,129 |
from flask import Blueprint, jsonify, render_template, redirect, request, session, redirect, current_app
import urllib
import json
import calendar
import time
import oauth2 as oauth
app = Blueprint('users', __name__, template_folder='templates') | wigginslab/lean-workbench | lean_workbench/users/views.py | Python | mit | 246 |
#!/usr/bin/env python
# Import migration info from OE-Classic recipes wiki page into OE
# layer index database
#
# Copyright (C) 2013 Intel Corporation
# Author: Paul Eggleton <paul.eggleton@linux.intel.com>
#
# Licensed under the MIT license, see COPYING.MIT for details
import sys
import os.path
sys.path.insert(0, ... | bartosh/layerindex-web | layerindex/tools/import_classic_wiki.py | Python | mit | 7,703 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
('events', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operation... | dotKom/onlineweb4 | apps/posters/migrations/0001_initial.py | Python | mit | 3,916 |
# -*- coding: utf-8 -*-
import io, urllib, subprocess, os, time, re, sys, psutil
from .actions import ModuleBase
# como tratar os icons?
# tem que receber o ActiosManager!
MODULE_NAME = "FilesModule"
# TODO recobnhecer tambem "ls -l"
# TODO pode ter icons para copiar, apagar etc. E para abrir, usa os icons dos p... | idnael/ctxsearch | ctxsearch/modfiles.py | Python | gpl-2.0 | 5,038 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | vsmolyakov/kaggle | object_detection/create_pascal_tf_record.py | Python | mit | 7,648 |
# MySQL Connector/Python - MySQL driver written in Python.
import django
from django.db.backends import BaseDatabaseValidation
if django.VERSION < (1, 7):
from django.db import models
else:
from django.core import checks
from django.db import connection
class DatabaseValidation(BaseDatabaseValidation):
... | StixoTvorec/py-try | Parsers/mysql/connector/django/validation.py | Python | mit | 2,419 |
#!/usr/bin/python
#
# Copyright (c) SAS Institute 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... | sassoftware/mint | mint/django_rest/rbuilder/projects/testsxml.py | Python | apache-2.0 | 19,621 |
"""
Handlers for TellTrail API.
"""
from piston.handler import BaseHandler
from piston.utils import rc
from telltrail.models import Identity, DataSource, Service
from itertools import chain
class PolicyHandler(BaseHandler):
"""
Handler for data policies.
"""
allow_methods = ('GET','POST')
def ... | Axilent/tt | telltrail/api/handlers.py | Python | mit | 3,708 |
#Let us say that you are given a number N, you've to find the number of different ways to write it as the sum of 1, 3 and 4.
import sys
import pdb
def sum_of(seq):
ss = 0
for elem in seq:
ss += elem
return ss
def num_ways(nums, number, cur_sum, ways, seq):
if cur_sum == number:
ways +... | atishbits/101 | bt_numways.py | Python | mit | 920 |
def test_help_message(testdir):
result = testdir.runpytest(
'--help',
)
result.stdout.fnmatch_lines([
'pytest-random-order options:',
'*--random-order-bucket={global,package,module,class,parent,grandparent,none}*',
'*--random-order-seed=*',
])
def test_markers_message(t... | jbasko/pytest-random-order | tests/test_cli.py | Python | mit | 503 |
# Lint as: python3
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | tensorflow/lingvo | docs/apidoc/conf.py | Python | apache-2.0 | 6,969 |
from database import init_db
from flask import Flask
from flask_graphql import GraphQLView
from schema import schema
app = Flask(__name__)
app.debug = True
default_query = '''
{
allEmployees {
edges {
node {
id,
name,
department {
id,
name
},
rol... | yfilali/graphql-pynamodb | examples/flask_pynamodb/app.py | Python | mit | 552 |
# coding: utf-8
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='console_logger',
version='0.0.1',
description='Python Custom Logger',
long_description='',
url='',
author='Hirokazu Miyaji',
maintainer_email='hirokazu.miyaji@gmail... | hirokazumiyaji/console-logger | setup.py | Python | mit | 887 |
# Copyright (C) 2017 Antoine Fourmy <antoine dot fourmy at gmail dot com>
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# ... | afourmy/pyNMS | pyNMS/autonomous_system/AS.py | Python | gpl-3.0 | 32,441 |
#!/usr/bin/env python
import json
import sys
import os
import re
import time
import stat
import collections
"""
Generates the include/bh_opcode.h and core/bh_opcode
based on the definitnion in /core/codegen/opcodes.json.
"""
def gen_headerfile( opcodes ):
enums = (" %s = %s,\t\t// %s" % (opcode['o... | Ektorus/bohrium | core/codegen/gen_opcodes.py | Python | lgpl-3.0 | 6,047 |
import discord, os, logging
from discord.ext import commands
from .utils import checks
from .utils.dataIO import dataIO
from .utils.chat_formatting import pagify, box
#The Tasty Jaffa
#Requested by Freud
def get_role(ctx, role_id):
roles = set(ctx.message.server.roles)
for role in roles:
if role.id ==... | The-Tasty-Jaffa/Tasty-Jaffa-cogs | say/say.py | Python | gpl-3.0 | 6,218 |
"""Automatic addition of additional markup to the doc strings used by pygrametl,
which should allow them to be readable in the source code and in the
documentation after Sphinx has processed them.
"""
# Copyright (c) 2014-2020, Aalborg University (pygrametl@cs.aau.dk)
# All rights reserved.
# Redistribution and... | chrthomsen/pygrametl | docs/_exts/autoformat.py | Python | bsd-2-clause | 7,508 |
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.db import models
from django.contrib.auth.models import User
from allauth.socialaccount.models import SocialAcco... | Sorjak/TurboSmartHome | turbosmarthome/main/models.py | Python | bsd-3-clause | 1,306 |
"""
Copyright (C) 2017 Charles Schaff, David Yunis, Ayan Chakrabarti,
Matthew R. Walter. See LICENSE.txt for details.
"""
# Beacon model 7: Fixed beacon clusters in most rooms around the exterior
import tensorflow as tf
import numpy as np
# Use with 8 channels
wn=1
def beacon(self):
NCHAN=self.NCHAN
v = n... | cbschaff/NBP | src/models/beacon7.py | Python | gpl-3.0 | 2,117 |
"""Condition table-based trigger fsm."""
from typing import Optional, Tuple
from hdltools.vcd.trigger import VCDTriggerFSM, VCDTriggerDescriptor
class ConditionTableTrigger(VCDTriggerFSM):
"""Condition table trigger fsm.
Unordered event-based trigger
"""
def __init__(
self,
conditi... | brunosmmm/hdltools | hdltools/vcd/trigger/condtable.py | Python | mit | 5,218 |
# -*- coding: utf-8 -*-
#
# ssh2-python documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 7 11:22:12 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... | ParallelSSH/ssh2-python | doc/conf.py | Python | lgpl-2.1 | 5,463 |
#!/usr/bin/env python2
# Copyright (c) 2019 Erik Schilling
# 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 ... | mpeuster/son-emu | examples/full_stack_emulation_multiple_osm.py | Python | apache-2.0 | 2,060 |
import pytest
import responses
from django.test.client import Client
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.db.models import ProtectedError
from mc2.controllers.base.models import Controller
from mc2.controllers.base.tests.ba... | praekelt/mc2 | mc2/tests/test_views.py | Python | bsd-2-clause | 9,043 |
from utils.edit_configs import get_json
class Config:
prefix = ','
@property
def token(self):
return get_json('bot')
@property
def god_ids(self):
return get_json('bot')['gods']
@property
def server_configs(self):
return get_json('server_configs')
@property
... | initzx/aobot | config.py | Python | gpl-3.0 | 378 |
#
# This file is part of pySMT.
#
# Copyright 2014 Andrea Micheli and Marco Gario
#
# 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
... | idkwim/pysmt | pysmt/test/test_models.py | Python | apache-2.0 | 2,439 |
# Copyright 2017 Google Inc. and Skytruth 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 agr... | GlobalFishingWatch/vessel-classification | classification/metrics/compute_vessel_metrics.py | Python | apache-2.0 | 35,647 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
'''
Replace localized parts of a packaged directory with data from a langpack
di... | Yukarumya/Yukarum-Redfoxes | python/mozbuild/mozpack/packager/l10n.py | Python | mpl-2.0 | 9,809 |
class RequestHeader:
"""
A single request header. Immutable.
"""
def __init__(self, name, value):
if name is None or not name.strip():
raise ValueError("name is required")
self.__name = name
self.__value = value
@property
def name(self):
"""
... | Ingenico-ePayments/connect-sdk-python3 | ingenico/connect/sdk/request_header.py | Python | mit | 1,640 |
# 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 the hope that it will be useful,
# bu... | ldoktor/avocado-virt | avocado/virt/qemu/machine.py | Python | gpl-2.0 | 12,482 |
from distutils.core import setup
setup(
description="Chart Library for lpOD",
license="GPLv3",
name = "lpod_chart",
packages=['chart'],
package_dir={'chart': 'src'},
package_data={'chart': ['templates/chart.otc']},
)
| dave62/lpod-Chart | setup.py | Python | gpl-3.0 | 246 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-05-23 11:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gestioneide', '0019_auto_20160517_2232'),
]
operations = [
migrations.AlterF... | Etxea/gestioneide | gestioneide/migrations/0020_auto_20160523_1329.py | Python | gpl-3.0 | 471 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 1 20:13:49 2016
@author: rstreet
"""
from os import path
import glob
def chk_archive_integrity(params):
"""Function to verify that all available raw science frames have
corresponding reduced output
"""
params = parse_args()
for night_dir in pa... | rachel3834/lcogt-commissioning | scripts/archive_integrity.py | Python | gpl-3.0 | 1,539 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015 Université Catholique de Louvain.
#
# This file is part of INGInious.
#
# INGInious 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 o... | GuillaumeDerval/INGInious | frontend/submission_manager.py | Python | agpl-3.0 | 7,974 |
"""
Created on Apr 17, 2014
@author: ygor
"""
import abc
import re
from .container import List
class Content(object, metaclass=abc.ABCMeta):
"""
classdocs
"""
_documents = {}
_paragraphs = {}
_sentences = {}
_words = {}
_chars = {}
_regex = None
_default_separator = None
... | ygorcanalli/documenthandler | DocumentHandler/src/model/content.py | Python | mit | 7,341 |
# -*- coding: utf-8 -*-
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing the scheduler stages."""
from __future__ import print_function
import time
from chromite.cbuildbot.stages ... | endlessm/chromium-browser | third_party/chromite/cbuildbot/stages/scheduler_stages.py | Python | bsd-3-clause | 7,904 |
import threading
def p(x):
for i in range(10):
print(x)
t1 = threading.Thread(target=p, args=(0,))
t2 = threading.Thread(target=p, args=(1,))
t1.start()
t2.start()
t1.join()
t2.join()
| anokata/pythonPetProjects | exercises/treads.py | Python | mit | 198 |
from .Like import Like
from .Dislike import Dislike
from .Login import Login
from .Register import Register
from .AddPost import AddPost
from .AddTopic import AddTopic
from .GetPosts import GetPosts
from .GetTopics import GetTopics
from .FilterTopics import FilterTopics
from .FollowTopic import FollowTopic
from .Logout... | mustafa-cosar/ceng445Project | src/website/ceng445/components/__init__.py | Python | gpl-3.0 | 488 |
# Save some local names as in MATLAB.
import cPickle
def save(filename, **kwargs):
"""save(filename, v1, v2, ...) saves a pickle with v1, v2, into filename."""
# See http://stackoverflow.com/questions/6618795/get-locals-from-calling-namespace-in-python
with open(filename, 'w') as f:
cPickle.dump(... | kuitang/topicmatch | save.py | Python | mit | 423 |
# -*- coding: utf-8 -*-
with open('/home/lof/rt5100rs232/tmp.log','r') as infile:
for line in infile:
#if line.find('FR') !=-1:
# print line.find('FR')
#constants
R=('sph_od','cyl_od','axe_od')
L=('sph_os','cyl_os','axe_os')
MyDict={'FinalPrescriptionData'... | frouty/rt5100rs232 | paste_7.py | Python | gpl-3.0 | 1,798 |
"""Client exceptions."""
import client
import sys
import logging
log = logging.getLogger(__name__) # Get top-level logger
class OkException(Exception):
"""Base exception class for OK."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
log.debug('Exception raised: {}'... | Cal-CS-61A-Staff/ok-client | client/exceptions.py | Python | apache-2.0 | 2,277 |
""" Speed Tracker
Name: Mr Gorman
Date: 24/03/2017
"""
from datetime import datetime, timedelta
def average_speed(timestring_in, timestring_out, distance=1):
""" Function to return the average speed in mph of a vehicle
travelling between 2 speed cameras placed 1 mile apart.
E... | SHS-ComputerScience/A-Level_2016-18 | 2. Exemplars/Speed Tracker/speed_tracker.py | Python | gpl-3.0 | 1,139 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../../"))
import unittest
from arxivtimes_indicator.data.github import *
class TestGitHub(unittest.TestCase):
def test_get_all_issues(self):
issues = fetch_issues()
self.assertIsInstance(issues, list)
self.ass... | chakki-works/arXivTimesIndicator | tests/data/test_github.py | Python | apache-2.0 | 1,358 |
## Copyright 2009 Laurent Bovet <laurent.bovet@windmaster.ch>
## Jordi Puigsegur <jordi.puigsegur@gmail.com>
##
## This file is part of wfrog
##
## wfrog 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 Softwar... | wfrog/wfrog | wflogger/collector/flush.py | Python | gpl-3.0 | 2,768 |
"""
The OGRGeometry is a wrapper for using the OGR Geometry class
(see http://www.gdal.org/ogr/classOGRGeometry.html). OGRGeometry
may be instantiated when reading geometries from OGR Data Sources
(e.g. SHP files), or when given OGC WKT (a string).
While the 'full' API is not present yet, the API is "pythonic" u... | adambrenecki/django | django/contrib/gis/gdal/geometries.py | Python | bsd-3-clause | 25,356 |
from django.conf import settings
from django.views.debug import get_safe_settings
from django.utils.translation import ugettext_lazy as _
from debug_toolbar.panels import DebugPanel
class SettingsVarsDebugPanel(DebugPanel):
"""
A panel to display all variables in django.conf.settings
"""
name = 'Setti... | edisonlz/fruit | web_project/base/site-packages/debug_toolbar/panels/settings_vars.py | Python | apache-2.0 | 737 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='Wyther',
version='0.1.4',
author='Nirav Bhatia',
author_email='bnirav23@gmail.com',
packages=['wyther'],
url='https://github.com/niravb1992/Wyther',
license='LICENSE.txt',
descrip... | niravb1992/wyther | setup.py | Python | mit | 507 |
#!/usr/bin/python2
# Copyright 2014 CloudFounders NV
#
# 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 o... | mflu/openvstorage_centos | ovs/extensions/generic/watcher.py | Python | apache-2.0 | 7,323 |
import unittest
class TestUnittestAssertions(unittest.TestCase):
def testFail(self):
with self.assertRaises(AssertionError):
self.fail('failure')
def testEqual(self):
self.assertEqual(0,0)
self.assertEqual([0,1,2], [0,1,2])
with self.assertRaises(Asserti... | AaronKel/Micopython-CI | test-testsuite.py | Python | mit | 4,110 |
"""
Public Key Cryptography datatypes
"""
| pirati-cz/helios-server | helios/datatypes/pkc/__init__.py | Python | apache-2.0 | 42 |
# Copyright 2015 Cisco Systems, 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 agreed to in wr... | yangleo/cloud-github | openstack_dashboard/enabled/_9001_developer.py | Python | apache-2.0 | 948 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | wenwei202/terngrad | terngrad/inception/slim/inception_v1.py | Python | apache-2.0 | 15,174 |
LC_DIRS = ['000', '100', '200', '300', '400', '500', '600', '700']
PATTERN = r'^(\d{3}) - ([\w\d \-\(\)]+).(py|java|c|sql|sh)$'
WORD_PATTERN = r'[\w\d]+'
EXT_TO_DIR = {
'py': 'python3',
'java': 'java',
'c': 'c',
'sql': 'mysql',
'sh': 'bash',
}
EXT_TO_HEADER = {
'py': '#\n# @lc app=leetcode id=... | yamstudio/leetcode | scripts/convert.py | Python | gpl-3.0 | 2,739 |
#!/usr/bin/python2.5
# -*- coding: utf-8 -*-
#
# Copyright 2009 Google 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 requir... | elsigh/browserscope | categories/reflow/test_set.py | Python | apache-2.0 | 8,336 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.