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 |
|---|---|---|---|---|---|
"""
Tests for verified track content views.
"""
import json
from django.http import Http404
from django.test.client import RequestFactory
from openedx.core.djangolib.testing.utils import skip_unless_lms
from student.tests.factories import UserFactory, AdminFactory
from xmodule.modulestore.tests.django_utils import S... | ahmedaljazzar/edx-platform | openedx/core/djangoapps/verified_track_content/tests/test_views.py | Python | agpl-3.0 | 2,459 |
#This will be the thread responsible for the matchmaking which operates as follows:
#There are four lists where the players are divided into based on their rank.
#List 1 is for ranks 0,1,2.
#List 2 is for ranks 3,4,5.
#List 3 is for ranks 6,7,8.
#List 4 is for ranks 9,10.
#When a player waits for a match too long, this... | Shalantor/Connect4 | server/matchMakingThread.py | Python | mit | 4,679 |
# coding=utf-8
"""Guessit name parser tests."""
from __future__ import unicode_literals
import datetime
import os
import guessit
import medusa.name_parser.guessit_parser as sut
from medusa import app
import pytest
from six import binary_type, text_type
import yaml
__location__ = os.path.realpath(os.path.join(os.getc... | FireBladeNooT/Medusa_1_6 | tests/test_guessit.py | Python | gpl-3.0 | 3,739 |
from __future__ import unicode_literals
import logging
from apscheduler.schedulers.background import BackgroundScheduler
from datetime import datetime, timedelta
from django.apps import AppConfig
from django.conf import settings
from monitor import check_channel
def deferred_task(func):
def inner_function(*a... | maciekf/etherchannels | etherblinks/node/apps.py | Python | mit | 1,153 |
# nxt.motcont module -- Interface to Linus Atorf's MotorControl NXC
# Copyright (C) 2011 Marcus Wanner
#
# 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
# (a... | Eelviny/nxt-python | nxt/motcont.py | Python | gpl-3.0 | 5,883 |
"""Urls for the Zinnia entries short link"""
from django.conf.urls import url
from zinnia.views.shortlink import EntryShortLink
urlpatterns = [
url(r'^(?P<token>[\dA-Z]+)/$',
EntryShortLink.as_view(),
name='entry_shortlink'),
]
| extertioner/django-blog-zinnia | zinnia/urls/shortlink.py | Python | bsd-3-clause | 251 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
#
# This program is free software: you can redistribute it and/or ... | syci/domsense-agilebg-addons | stock_picking_related/__init__.py | Python | gpl-2.0 | 1,025 |
#!/usr/bin/env python
"""
Convert markdown to HTML, then parse the HTML, generate and insert a TOC, and
insert anchors.
I started from cmark-0.28.3/wrappers/wrapper.py.
"""
import ctypes
import sys
import cgi
import HTMLParser
# Geez find_library returns the filename and not the path? Just hardcode it as
# a worka... | oilshell/blog-code | tools-snapshot/cmark.py | Python | apache-2.0 | 5,128 |
# -*- coding: utf-8 -*-
#
# django-unload documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 12 16:17:25 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... | Styria-Digital/django-unload | docs/conf.py | Python | bsd-2-clause | 9,901 |
"""
BufferedCanvas -- flicker-free canvas widget
Copyright (C) 2005, 2006 Daniel Keep, 2011 Duane Johnson
To use this widget, just override or replace the draw method.
This will be called whenever the widget size changes, or when
the update method is explicitly called.
Please submit any improvements/bugfixes/ideas to... | xoan/Printrun | printrun/gui/bufferedcanvas.py | Python | gpl-3.0 | 3,276 |
from collections import defaultdict
import os
from biicode.common.settings.version import Version
'''
Module to create the cmake lines with the info of the boards.
It return the string that it is needed to compile and upload correctly the scketch to the Arduino.
This module is used always that biicode biicode create ... | drodri/client | dev/hardware/arduino/arduino_converter.py | Python | mit | 7,452 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
[env]
conda create --name automate_screaming_frog python=3.9.7
conda info --envs
source activate automate_screaming_frog
conda deactivate
[path]
cd /Users/brunoflaven/Documents/03_git/BlogArticlesExamples/python-automate-screaming-frog-sqlalchemy-streamlit-pandas-plotly/sq... | bflaven/BlogArticlesExamples | python-automate-screaming-frog-sqlalchemy-streamlit-pandas-plotly/sqlalchemy_guide_database/sqlalchemy_guide_databasea_app.py | Python | mit | 5,276 |
__version__ = "4.0b2"
__author__ = "kcarnold@media.mit.edu, rspeer@media.mit.edu, jalonso@media.mit.edu, havasi@media.mit.edu, hugo@media.mit.edu"
__url__ = 'conceptnet.media.mit.edu'
from django.db import models
from django.contrib.auth.models import User
from django.utils.functional import memoize
from datetime impor... | pbarton666/buzz_bot | djangoproj/djangoapp/csc/corpus/models.py | Python | mit | 6,696 |
# -*- coding: utf-8 -*-
#
import matplotlib as mpl
import numpy
def mpl_color2xcolor(data, matplotlib_color):
'''Translates a matplotlib color specification into a proper LaTeX xcolor.
'''
# Convert it to RGBA.
my_col = numpy.array(mpl.colors.ColorConverter().to_rgba(matplotlib_color))
# If the a... | danielhkl/matplotlib2tikz | matplotlib2tikz/color.py | Python | mit | 2,761 |
size = int(input())
array = [int(x) for x in input().split()]
switch_count = 0
for i in range(size-1):
for j in range(size-1-i):
if(array[j] > array[j+1]):
switch_count+=1
(array[j], array[j+1]) = (array[j+1], array[j])
print(switch_count) | clemus90/competitive-programming | hackerEarth/practice/algorithms/sorting/bubbleSort/bubble_sort.py | Python | mit | 275 |
# -*- coding: utf-8 -*-
import unittest
import sum_square_difference
class SumSquareDifferenceTests(unittest.TestCase):
def test_sum_square_difference_for_euler(self):
self.assertEqual(
25164150,
sum_square_difference.difference(100)
)
if __name__ == '__main__':
unit... | PurityControl/uchi-komi-python | problems/euler/0006-sum-square-difference/ichi/sum_square_difference_test.py | Python | mit | 332 |
from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from reviewboard.hostingsvcs.forms import HostingServiceForm
from reviewboard.hostingsvcs.service import HostingService
from reviewboard.scmtools.crypto_utils import (decrypt_password,
... | davidt/reviewboard | reviewboard/hostingsvcs/assembla.py | Python | mit | 6,436 |
##############################################################################
# Copyright (c) 2017, Los Alamos National Security, LLC
# Produced at the Los Alamos National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, ... | TheTimmy/spack | var/spack/repos/builtin/packages/pax-utils/package.py | Python | lgpl-2.1 | 1,566 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack Foundation
# 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/l... | vijayendrabvs/hap | neutron/tests/base.py | Python | apache-2.0 | 5,369 |
#!/usr/bin/env python
from pyDFTutils.ase_utils import symbol_number, symnum_to_sym
import numpy as np
import re
import os
import sys
from xyz_read import projections_to_basis, projection_dict_by_site_to_basis
def read_nbands(filename='OUTCAR'):
"""
read the number of bands form OUTCAR.
"""
text = ope... | mailhexu/pyDFTutils | pyDFTutils/wannier90/wannier_utils.py | Python | lgpl-3.0 | 15,119 |
import json
import dateutil.parser
import phonenumbers
from twisted.internet.protocol import Factory
from twisted.internet.defer import maybeDeferred
from twisted.protocols.basic import LineReceiver
from .exceptions import JsonProtocolException
class JsonProtocol(LineReceiver):
version = '0.1.0'
def __in... | praekelt/portia | portia/protocol.py | Python | bsd-3-clause | 3,108 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "awesome.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | sharkspeed/dororis | packages/python/django/awesome/manage.py | Python | bsd-2-clause | 805 |
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def get_hostnames():
if settings.DEBUG:
return {
'gpcr': "",
'gprotein': "",
'arrestin': "",
}
else:
return {
'gpcr': "https:/... | protwis/protwis | home/templatetags/menu_extras.py | Python | apache-2.0 | 444 |
import | softtyphoon/tz | tools/batch_reg.py | Python | gpl-2.0 | 8 |
import csv
import json
from django import forms
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.views.generic import View
from django.shortcuts import render_to_response
# from .forms import UploadFileForm
class UploadRecord(LoggedInMixin, View):
def post(self, requ... | NYPDVisionZeroAccountability/nyc-records | nyc_records/nyc_records/police_records/views.py | Python | gpl-2.0 | 743 |
# Easy paver commands for less command typing and more coding.
# Visit http://paver.github.com/paver/ to get started. - @brandondean Sept. 30
import subprocess
import json
import time
from paver.easy import *
path = path("./")
@task
def deploy():
sh("python deploy.py")
@task
def javascript():
"""Combine Compre... | 1fish2/the-blue-alliance | pavement.py | Python | mit | 2,650 |
from flask import Flask, jsonify, make_response
from flask.ext.mongoalchemy import MongoAlchemy
from flask.ext.cors import CORS
import datetime
import json
from bson.objectid import ObjectId
from werkzeug import Response
app = Flask(__name__)
# app.config['MONGOALCHEMY_DATABASE'] = 'flask-react-todo'
app.config['MONGO... | stanfordv/curriculum1 | api/__init__.py | Python | mit | 1,140 |
# coding=utf-8
# 文件写
f = open('test.txt','a')
for i in range(10):
f.write('hello,')
f.write('world!\n')
f.close()
#文件读
ff= open('test.txt','r')
d = ff.read(4)
print d | mythkiven/python | Training/untitled/05_其他知识点.py | Python | mit | 190 |
# Copyright 2015 IBM Corp.
#
# 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 agree... | noironetworks/heat | heat/engine/resources/openstack/senlin/cluster.py | Python | apache-2.0 | 15,586 |
#!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import subprocess
import sys
import webbrowser
SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
SK... | qiankunshe/sky_engine | sky/tools/skydoc.py | Python | bsd-3-clause | 1,262 |
"""Hass representation of an UPnP/IGD."""
import asyncio
from ipaddress import IPv4Address
import aiohttp
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import HomeAssistantType
from .const import LOGGER as _LOGGER
class Device:
"""Hass representation... | tinloaf/home-assistant | homeassistant/components/upnp/device.py | Python | apache-2.0 | 5,626 |
# -*- coding: utf-8 -*-
#################### 本文件用于进行基本的 json urlencode 操作
import sys,re
import json
from jsonpath_rw import jsonpath, parse # pip2/pip3 install jsonpath_rw
from lxml import etree
import platform
sysstr = platform.system() ### 判断操作系统类型 Windows Linux . 本脚本函数入口, 统一以 LINUX 为准, 其后在函数内... | sheerfish999/torpedo | modules/dodata.py | Python | gpl-3.0 | 9,121 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import sys
import re
from os.path import abspath, dirname, join
import shutil
import pytest
import six
from a... | waylonflinn/asv | test/test_dev.py | Python | bsd-3-clause | 3,311 |
from __future__ import print_function
import logging
from typing import Sequence
from sqlalchemy.orm.exc import NoResultFound
from passzero.backend import create_pinned_entry
from passzero.crypto_utils import get_hashed_password
from passzero.models import Entry, Link, User, EncryptionKeys
def find_entries(session... | boompig/passzero | passzero/change_password.py | Python | gpl-3.0 | 5,843 |
from __future__ import with_statement
__version__ = '0.31'
__license__ = 'MIT'
import re
import os
import sys
import finalseg
import time
import tempfile
import marshal
from math import log
import random
import threading
from functools import wraps
DICTIONARY = "dict.txt"
DICT_LOCK = threading.RLock()
trie = None # t... | seem-sky/newspaper | newspaper/packages/jieba/__init__.py | Python | mit | 11,308 |
"""remove email_notification column
Revision ID: 1b750a389c22
Revises: 48f561c0ce6
Create Date: 2015-02-25 23:01:07.253429
"""
# revision identifiers, used by Alembic.
revision = "1b750a389c22"
down_revision = "48f561c0ce6"
import sqlalchemy as sa
from alembic import op
def upgrade():
if "sqlite" not in "SQLA... | JARR-aggregator/JARR | migrations/versions/1b750a389c22_remove_email_notification_column.py | Python | agpl-3.0 | 502 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'egebra.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^egebra/', incl... | venkatarun95/eGebra | egebra/urls.py | Python | gpl-2.0 | 348 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 24 16:25:41 2016
@author: pavel
"""
from gi.repository import Gtk
import parameter_types as ptypes
from logger import Logger
logger = Logger.get_logger()
#
import gobject
gobject.threads_init()
#decorator is used to update gtk objects from ano... | i026e/python_ecg_graph | gtk_wrapper.py | Python | mit | 5,750 |
# -*- 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/gapic-generator-python | tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/base.py | Python | apache-2.0 | 18,951 |
#!/usr/bin/env python
#
# Copyright 2017 the V8 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.
import random
import sys
# Adds testrunner to the path hence it has to be imported at the beggining.
import base_runner
from tes... | MTASZTAKI/ApertusVR | plugins/languageAPI/jsAPI/3rdParty/nodejs/10.1.0/source/deps/v8/tools/testrunner/num_fuzzer.py | Python | mit | 8,529 |
# Generated by Django 1.11.15 on 2018-12-26 20:29
from django.db import migrations, models
import taggit_autosuggest.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
('course_metadata', '0141_auto_20181221_1501'),
]
operations = [
... | edx/course-discovery | course_discovery/apps/course_metadata/migrations/0142_auto_20181226_2029.py | Python | agpl-3.0 | 2,322 |
from valuenetwork.valueaccounting.tests.test_facets import *
from valuenetwork.valueaccounting.tests.test_explosions import *
#todo: temporarily disabled
#from valuenetwork.valueaccounting.tests.test_plan_rand import *
#from valuenetwork.valueaccounting.tests.test_orders import *
#from valuenetwork.valueaccounting.test... | FreedomCoop/valuenetwork | valuenetwork/valueaccounting/tests/__init__.py | Python | agpl-3.0 | 543 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2016 Ryan Fan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, c... | rfancn/wxgigo | wxgigo/management/commands/deploy/host.py | Python | mit | 4,161 |
# <copyright>
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP
#
# 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 (at your
# option) any later ve... | jeremiahpatterson-hpe/csmake | test-TestPython-source/tests/test_bad_coverage_example.py | Python | gpl-3.0 | 1,320 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Sebastian Ullrich. All rights reserved.
# Released under Apache 2.0 license as described in the file LICENSE.
#
# Author: Sebastian Ullrich
#
# Python 2/3 compatibility
from __future__ import print_function
import argparse
import collections
import o... | soonhokong/lean-windows | script/check_md_links.py | Python | apache-2.0 | 2,586 |
# 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/data_generators/snli.py | Python | apache-2.0 | 5,409 |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... | moto-timo/ironpython3 | Tests/test_missing.py | Python | apache-2.0 | 9,478 |
# 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 writing, software
# d... | mahak/neutron | neutron/tests/unit/services/qos/drivers/test_manager.py | Python | apache-2.0 | 13,793 |
import collections
import asyncio
import logging
import decimal
from datadog import statsd
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
def empty_stats(c_name):
return {
'name': c_name,
'uses': 0,
}
class Statistics(Cog):
"""Bot stats stuff... | Mstrodl/jose | ext/stats.py | Python | mit | 5,259 |
import os
import types
import config
from xdg.IniFile import *
class FirstartEntry(IniFile):
default_group = 'Firstlogin Entry'
def __init__(self):
self.content = dict()
self.config_path = os.path.join(os.environ.get('HOME'), '.config/gecos/')
self.config_file = os.path.join(self.c... | gecos-team/gecosws-agent | gecosfirstlogin_lib/FirstartEntry.py | Python | gpl-2.0 | 1,114 |
import unittest
from kindergarten_garden import (
Garden,
)
# Tests adapted from `problem-specifications//canonical-data.json`
class KindergartenGardenTest(unittest.TestCase):
def test_partial_garden_garden_with_single_student(self):
garden = Garden("RC\nGG")
self.assertEqual(
ga... | jmluy/xpython | exercises/practice/kindergarten-garden/kindergarten_garden_test.py | Python | mit | 4,706 |
""" TODO: Add docstring """
import re
import pexpect
class MediaObject(object):
"""Represents an encodable object"""
def __init__(self, input_filename, output_filename):
self.input_filename = input_filename
self.output_filename = output_filename
self.media_duration = self.get_media_d... | thethomaseffect/travers-media-tools | traversme/encoder/media_object.py | Python | mit | 2,000 |
import config
db = config.db
def get_hosts():
return db.select('host', order='name ASC')
def get_host(id):
return db.select('host', where="id=$id", vars=locals())[0]
def add_host(name, mac, ip):
db.insert('host', name=name, mac=mac, ip=ip)
def delete_host(id):
db.delete('host', where="id=$id", ... | Finn10111/webWOL | woldb.py | Python | gpl-3.0 | 453 |
#!/usr/bin/env python
import BaseHTTPServer
import CGIHTTPServer
from os import chdir
import sys
def run(server_class=BaseHTTPServer.HTTPServer,
handler_class=CGIHTTPServer.CGIHTTPRequestHandler, port=5000):
server_address = ('', port)
#handler_class.cgi_directories = ['']
httpd = server_class(server_address, h... | espenak/enkel | enkel/scripts/cgi_server.py | Python | gpl-2.0 | 830 |
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2012 Yummy Bian <yummy.bian#gmail.com>.
"""
Random. Legacy sharding distribution algorithm
"""
from __future__ import absolute_import
import bisect
import hashlib
# local requirements
from torncache.distributions import Distribution
class Ketama(Distribution)... | shipci/torncache-sample | torncache/distributions/ketama.py | Python | apache-2.0 | 4,660 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 2014, 2015 CERN.
#
# Invenio 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... | chokribr/invenio | invenio/modules/deposit/tasks.py | Python | gpl-2.0 | 18,088 |
"""
Most methods are modifications of original methods in
pybuilder.plugins.python.distutils
Their signatures are kept the same, so it'll be easier
to offer up a pull request to pybuilder in the future
"""
from pybuilder.core import use_plugin, init, task, Author
import os
def build_string_from_array(arr, keyName):
... | alex-dow/pybuilder_prettySetup | src/main/python/pybuilder_prettySetup/__init__.py | Python | mit | 7,069 |
import datetime
import os
import psycopg2
from bids import bidding_app
from comments import comment_app
from directmessages import dmessage_app
from flask import Flask, render_template,session, redirect, url_for
from images import images_app
from notifications import notific_app
from register import register_app
from ... | itucsdb1621/itucsdb1621 | server.py | Python | gpl-3.0 | 12,401 |
#__BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance ... | xgds/xgds_map_server | xgds_map_server/admin.py | Python | apache-2.0 | 2,724 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Key.net'
db.add_column('key_key', 'net', self.gf('django.db.models.fields.BooleanField')(d... | z0rr0/licdb | main/key/migrations/0002_auto__add_field_key_net.py | Python | gpl-3.0 | 4,773 |
from sys import argv
from math import log
print(int(log(int(argv[1]), 2) + 1))
| EvanHahn/bits-required | python/bits.py | Python | unlicense | 79 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests lesson 04 task 05."""
# Import Python libs
import unittest
import mock
import random
class Lesson04Task05TestCase(unittest.TestCase):
"""
Test cases for lesson 04 task 05.
"""
def test_blood_pressure_status(self):
"""
Tests that... | Logan213/is210-week-04-warmup | tests/test_task_05.py | Python | mpl-2.0 | 1,085 |
import math
# Recursive function that generated bracket
def branch(seed, level, limit):
# Level is how deep in the recursion basically
# Limit is the depth of the recursion to get to 1, ie, for 8 teams
# this value would be 4 (dividing by 2)
level_sum = (2 ** level) + 1
# How many teams there a... | jolynch/mit-tab | mittab/libs/outround_tab_logic/bracket_generation.py | Python | mit | 869 |
import logging
import sys
__version__ = "0.14.1"
CHANGE_SET_FORMAT = "{stack}-change-set"
logger = logging.getLogger("formica")
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter("%(message)s")
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.INFO)
| flomotlik/formica | formica/__init__.py | Python | mit | 309 |
from __future__ import absolute_import
from ..job import AudioDatasetJob
from origae.dataset import tasks
from origae.utils import subclass, override, constants
# NOTE: Increment this every time the pickled object changes
PICKLE_VERSION = 1
@subclass
class GenericAudioDatasetJob(AudioDatasetJob):
"""
A Job ... | winnerineast/Origae-6 | origae/dataset/audio/generic/job.py | Python | gpl-3.0 | 3,273 |
n = int(input())
data = tuple(map(int, input().split(' ')))
print(hash(data))
| alpako/hr-python | src/python/DataTypes/Ex01.py | Python | apache-2.0 | 79 |
# Copyright (c) 2015 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/LICEN... | wolverineav/neutron | neutron/agent/l3/dvr_edge_ha_router.py | Python | apache-2.0 | 4,912 |
# Copyright 2014 IBM Corp.
#
# 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 t... | zsoltdudas/lis-tempest | tempest/tests/common/test_waiters.py | Python | apache-2.0 | 3,290 |
# myapp.py
import logging
import logging
class NullHandler(logging.Handler):
def emit(self, record):
print("ran")
#print(record.__dict__)
def logger1(x):
print(x)
print("Y")
def main():
logging.basicConfig(filename='myapp.log', level=logging.INFO)
logging.info... | popcorn9499/chatBot | testLog.py | Python | gpl-3.0 | 1,231 |
#!/usr/bin/env python
import sys
from os.path import join, dirname
sys.path.append(join(dirname(__file__), 'src'))
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
VERSION = 'dev'
execfile(join(dirname(__file__), 'src', 'Scapy2Library', 'version.py'))
DESCRIPTION = """
Robot Frame... | wywincl/Scapy2Library | setup.py | Python | apache-2.0 | 1,357 |
"""
This module contains the main window implementation.
Most of the code for controlling the gui can be found in the controllers
package, the main window here just sets up its ui and implement the save/restor
state logic as well as the close event handling (give user a chance to save its
work or not).
"""
import log... | eugeniodilo/OpenCobolIDE | open_cobol_ide/view/main_window.py | Python | gpl-3.0 | 1,889 |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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 2.1 of the License, or (a... | ktan2020/legacy-automation | win/Lib/site-packages/paramiko/pkey.py | Python | mit | 14,691 |
#!/usr/bin/env python3
import numpy as np
from pysisyphus.InternalCoordinates import RedundantCoords
from pysisyphus.Geometry import Geometry
from pysisyphus.xyzloader import write_geoms_to_trj
from pysisyphus.helpers import geom_from_library, geom_from_xyz_file
from pysisyphus.interpolate.LST import LST
from pysisyp... | eljost/pysisyphus | tests_staging/test_interpolate/test_interpolate.py | Python | gpl-3.0 | 5,798 |
"""
uritemplate.api
===============
This module contains the very simple API provided by uritemplate.
"""
from uritemplate.template import URITemplate
def expand(uri, var_dict=None, **kwargs):
"""Expand the template with the given parameters.
:param str uri: The templated URI to expand
:param dict var... | ido-ran/ran-smart-frame2 | web/server/lib/uritemplate/api.py | Python | mit | 1,911 |
#!/usr/bin/env python3
# Copyright © 2014 Bart Massey
# [This program is licensed under the "MIT License"]
# Please see the file COPYING in the source
# distribution of this software for license terms.
# Sudoku solver
from sudoku_color import *
from sys import setrecursionlimit
setrecursionlimit(100)
read_puzzle()
fo... | BartMassey/sudoku | sudoku_solve.py | Python | mit | 395 |
import re
from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class FilerNetFolder(SimpleCrypter):
__name__ = "FilerNetFolder"
__type__ = "crypter"
__version__ = "0.45"
__status__ = "testing"
__pattern__ = r'https?://filer\.net/folder/\w{16}'
__config__ = ... | fzimmermann89/pyload | module/plugins/crypter/FilerNetFolder.py | Python | gpl-3.0 | 1,086 |
# Copyright (c) 2011 Gennadiy Shafranovich
# Licensed under the MIT license
# see LICENSE file for copying permission.
from sys import stdout
from django.core.management.base import BaseCommand
from frano.quotes.models import Quote
from frano.quotes.models import refresh_price_history
class Command(BaseCommand):
... | fxdemolisher/frano | frano/management/commands/refresh_price_history.py | Python | mit | 739 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# PalcoTV Regex de ezcast
# rev. 15.05.2015
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plugintools de Jesús (www.mimediacenter.info)
... | fabiking/plugin.video.Mfabiking | resources/regex/ezcast.py | Python | gpl-2.0 | 3,720 |
#coding:utf-8
from reportlab.lib.styles import getSampleStyleSheet,ParagraphStyle
from reportlab.platypus import *
from reportlab.lib.units import inch,mm
from reportlab.lib.enums import TA_JUSTIFY,TA_LEFT, TA_CENTER,TA_RIGHT
import copy
import reportlab.rl_config
reportlab.rl_config.warnOnMissingFontGlyphs = 0
from re... | vnsofthe/odoo-dev | addons/rhwl_gene/rhwl_reportlab.py | Python | agpl-3.0 | 2,277 |
# Copyright 2015-2016, Damian Johnson and The Tor Project
# See LICENSE for licensing information
import stem.response
class AddOnionResponse(stem.response.ControlMessage):
"""
ADD_ONION response.
:var str service_id: hidden service address without the '.onion' suffix
:var str private_key: base64 encoded hi... | sammyshj/stem | stem/response/add_onion.py | Python | lgpl-3.0 | 1,380 |
from datetime import date
from django import template
from django.utils.translation import gettext_lazy as _
register = template.Library()
@register.inclusion_tag('involvement/tags/contact_card.html')
def contact_card(contact_card, large_width=7, medium_width=12, small_width=12):
data = {
'large_width'... | UTNkar/moore | src/involvement/templatetags/involvement_tags.py | Python | agpl-3.0 | 1,825 |
#########
#
# Survivability
# Creates a new matrix to define survivability. This uses previous
# This is where all the generation starts, since the rest need land to do anything.
# This is also the beginning of defining a Race within our world.
#
# Therefore, this will require a Race to do anything with since... | wlodarczykj/AsciiWorldGeneration | generators/survivability_generator.py | Python | gpl-3.0 | 682 |
#!/usr/bin/env python3
from datetime import datetime
import psycopg2
from config import dsn
with psycopg2.connect(dsn) as db:
with db.cursor() as cur:
r = cur.execute("""DELETE FROM pastes WHERE expiration < %s""", (datetime.utcnow(),))
print(r)
| lbatalha/pastething | gc.py | Python | mit | 254 |
# -*- coding: utf-8 -*-
"""
"""
# Copyright (C) 2015 ZetaOps Inc.
#
# This file is licensed under the GNU General Public License v3
# (GPLv3). See LICENSE.txt for details.
class UlakbusError(Exception):
pass
class DataConflictError(UlakbusError):
pass
| zetaops/ulakbus | ulakbus/lib/exceptions.py | Python | gpl-3.0 | 267 |
#!/usr/bin/env python
import unittest
import os, sys, subprocess, argparse, shutil, re
TEMPLATE_ANDROID_MK = '''\
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
{cut}
LOCAL_MODULE := mixed_sample
LOCAL_SRC_FILES := {cpp1}
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
{cut}
L... | s-trinh/visp | platforms/android/build-tests/test_ndk_build.py | Python | gpl-2.0 | 5,331 |
# -*- coding: utf-8 -*-
import base64
import os
import random
import re
import struct
import Crypto.Cipher.AES
import Crypto.Util.Counter
from module.network.HTTPRequest import BadHeader
from ..internal.Hoster import Hoster
from ..internal.misc import decode, encode, exists, fsjoin, json
##########################... | Velociraptor85/pyload | module/plugins/hoster/MegaCoNz.py | Python | gpl-3.0 | 16,290 |
import logging
import os
import csv
import tempfile
import shutil
import json
import subprocess
import datetime
import pprint
import bz2
import fnmatch
import hashlib
import pm.config
import pm.config.patch
import pm.utility
_LOGGER = logging.getLogger(__name__)
class NoChangedFilesException(Exception):
pass
... | dsoprea/PathManifest | pm/manifest.py | Python | gpl-2.0 | 16,990 |
#!/usr/bin/env python
#
# Copyright (c) 2014-2016 Apple Inc. All rights reserved.
# Copyright (c) 2014 University of Washington. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistribution... | Debian/openjfx | modules/web/src/main/native/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py | Python | gpl-2.0 | 5,876 |
# Single example build and deploy script
import os
import subprocess
import sys
import shutil
import glob
import json
# Android SDK version used
SDK_VERSION = "android-23"
PROJECT_FOLDER = ""
# Name/folder of the project to build
if len(sys.argv) > 1:
PROJECT_FOLDER = sys.argv[1]
if not os.path.exists(PROJECT_FO... | ming4883/Vulkan | android/build.py | Python | mit | 4,661 |
import mock
import warnings
from django_webtest import WebTest
from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from django.core import mail
from django.test import TestCase
from oscar.utils.deprecation import RemovedInOscar20Warning
from oscar.apps.customer.alerts.ut... | sonofatailor/django-oscar | tests/functional/customer/test_alert.py | Python | bsd-3-clause | 12,988 |
from __future__ import print_function
import unittest2
from lldbsuite.test.decorators import *
from lldbsuite.test.concurrent_base import ConcurrentEventsBase
from lldbsuite.test.lldbtest import TestBase
@skipIfWindows
class ConcurrentTwoWatchpointsOneBreakpoint(ConcurrentEventsBase):
mydir = ConcurrentEventsB... | apple/swift-lldb | packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneBreakpoint.py | Python | apache-2.0 | 818 |
# This file is part of VoltDB.
# Copyright (C) 2008-2017 VoltDB Inc.
#
# This program 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
# License, or (at your option) any later ver... | deerwalk/voltdb | lib/python/vdm/tests/server/deployment_user_test.py | Python | agpl-3.0 | 12,365 |
__author__ = 'Christof Pieloth'
import logging
from packbacker.errors import ParameterError
from packbacker.installers import installer_prototypes
from packbacker.utils import UtilsUI
class Job(object):
log = logging.getLogger(__name__)
def __init__(self):
self._installers = []
def add_instal... | cpieloth/CppMath | tools/PackBacker/packbacker/job.py | Python | apache-2.0 | 2,389 |
#
# Typofinder for domain typo discovery
#
# Released as open source by NCC Group Plc - http://www.nccgroup.com/
#
# Simple whois query function
#
# Based on RFC3912
#
# Developed by Matt Summers, matt dot summers at nccgroup dot com
# and Stephen Tomkinson
#
# http://www.github.com/nccgroup/typofinder
#
#... | nccgroup/typofinder | howoldisdomain/whois.py | Python | agpl-3.0 | 10,182 |
#! /usr/bin/env python2
# This script will scan Rust source files looking for extern "C"
# functions and generate C header files from them with a filename
# based on the Rust filename.
#
# Usage: From the top suricata source directory:
#
# ./rust/gen-c-headers.py
#
from __future__ import print_function
import sys... | sh19871122/suricata | rust/gen-c-headers.py | Python | gpl-2.0 | 6,856 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# pynbome library
# color.py (c) Mikhail Mezyakov <mihail265@gmail.com>
#
# Rainbow colored transformation
import os
import random
import subprocess
from wand.image import Image
from . import prepare_filter
@prepare_filter
def apply_filter(input_filename, output_filena... | aluminiumgeek/psychedelizer | pynbome/filters/color.py | Python | gpl-3.0 | 749 |
# coding=utf-8
import sys
import petsc4py
petsc4py.init(sys.argv)
import numpy as np
from time import time
from scipy.io import savemat
# from src.stokes_flow import problem_dic, obj_dic
from petsc4py import PETSc
from src import stokes_flow as sf
from src.myio import *
from src.objComposite import *
# from src.myvt... | pcmagic/stokes_flow | head_Force/motion_ecoli_speed.py | Python | mit | 5,716 |
import ConfigParser
import sqlite3
import os
import urllib2
import sys
class Adopt():
def __init__(self, argv):
self.examplemode = False
print "Starting up."
self.args = sys.argv
for a in self.args:
if a == "-e":
self.examplemode = True
if os... | jonobacon/adopt-a-project | adopt-queue.py | Python | gpl-2.0 | 4,218 |
# -*- coding: utf-8 -*-
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(... | hyunchel/webargs | docs/conf.py | Python | mit | 1,549 |
#!/usr/bin/env python
import chrono
import unittest
class USCalendarTest(unittest.TestCase):
def test__subclass(self):
"USCalendar is subclass of Calendar"
self.assertTrue(
issubclass(chrono.calendar.USCalendar, chrono.calendar.Calendar)
)
class USCalendar_weekdateTest(uni... | erikgrinaker/python-chrono | tests/test_calendar/test_us.py | Python | gpl-3.0 | 6,175 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.