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 |
|---|---|---|---|---|---|
# from numpy import empty, zeros, ones, where
import os
import sys
import warnings
import numpy as np
from .mfdis import get_layer
from ..utils import check
from ..utils.flopy_io import line_parse, pop_item
from ..utils import MfList
from ..pakbase import Package
class Mnw(object):
"""Multi-Node ... | brclark-usgs/flopy | flopy/modflow/mfmnw2.py | Python | bsd-3-clause | 71,441 |
"""Parse (absolute and relative) URLs.
urlparse module is based upon the following RFC specifications.
RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
and L. Masinter, January 2005.
RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
and L.Masinter, Decemb... | google/grumpy | third_party/stdlib/urlparse.py | Python | apache-2.0 | 19,619 |
# -*- coding: utf-8 -*-
import sqlite3
from numpy.testing import assert_array_almost_equal
def create_sqlite(path, fixture_data):
"""Create an SQLite database.
Parameters
----------
path : str
Path where the database should be created
fixture_data : dict
Database schema and cont... | sjpet/epysteme | tests/help_functions.py | Python | mit | 1,924 |
資料 = [1, 2, 3, 4, 5]
'''
program: list1.py
'''
print(資料[:3])
print(資料[2:])
print(資料[1:2])
a = [3, 5, 7, 11, 13]
for x in a:
if x == 7:
print('list contains 7')
break
print(list(range(10)))
for 索引 in range(-5, 6, 2):
print(索引)
squares = [ x*x for x in range(0, 11) ]
print(squares)
a = [10, '... | 2014c2g5/2014cadp | wsgi/local_data/brython_programs/list1.py | Python | gpl-3.0 | 609 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'client_fva/ui/ui_elements/mysignatures.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MySignatures(object):
def setupUi(se... | luisza/dfva_client | src/client_fva/ui/mysignaturesui.py | Python | gpl-3.0 | 2,400 |
#!/usr/bin/env python
import os
import runpy
PKG = 'XXX' # TODO Change to the name of your package (not your executable!).
try:
run_globals = runpy.run_module(PKG, run_name='__main__', alter_sys=True)
executed = os.path.splitext(os.path.basename(run_globals['__file__']))[0]
if executed != '__main__': #... | ActiveState/code | recipes/Python/577088_Generic_executiscript/recipe-577088.py | Python | mit | 593 |
# -*- coding: utf-8 -*-
import classes.level_controller as lc
import classes.game_driver as gd
import classes.extras as ex
import classes.board
import random
import math
import pygame
class Board(gd.BoardGame):
def __init__(self, mainloop, speaker, config, screen_w, screen_h):
self.level = lc.Level(self... | OriHoch/pysiogame | game_boards/game054.py | Python | gpl-3.0 | 7,891 |
# Copyright (c) 2012 Spotify 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 law or agreed to in writing, s... | Mappy/luigi | test/file_test.py | Python | apache-2.0 | 6,346 |
#!/usr/bin/python
# -*- coding: ISO-8859-15-*-
import sys
import os
import datetime
import time
from mpi4py import MPI
# MPI related initialisations
comm = MPI.COMM_WORLD
rank = comm.Get_rank() # number of the processor
size = comm.Get_size() # number of all participating processes
name = MPI.Get_... | zalf-lsa/carbiocial-project | monica/monica-cluster-mpi/test-mpi.py | Python | mpl-2.0 | 1,331 |
# -*- coding: utf-8 -*-
"""Configs
"""
from typing import (Optional, Dict)
import logbook
import os
from raven import Client
class Config:
"""Base config
"""
DEBUG: bool = True
TESTING: bool = False
LOGLEVEL: int = logbook.DEBUG
PORT: int = 5000
log_backend: str = "127.0.0.1"
broker_... | faruken/science | science/config.py | Python | gpl-3.0 | 1,789 |
"""
Tests that NA values are properly handled during
parsing for all of the parsers defined in parsers.py
"""
from io import StringIO
import numpy as np
import pytest
from pandas._libs.parsers import STR_NA_VALUES
from pandas import DataFrame, Index, MultiIndex
import pandas._testing as tm
def test_string_nas(all_... | jreback/pandas | pandas/tests/io/parser/test_na_values.py | Python | bsd-3-clause | 15,075 |
#-*-coding:utf-8-*-
"""
Copyright (c) 2012 yangzhe1991 <ud1937@gmail.com>
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, copy... | BigRocky/xiaohuangji | plugins/wikipedia.py | Python | mit | 2,001 |
#!/usr/bin/env python
"""
Commands related to the syncing assets.
"""
from glob import glob
import os
import boto
from boto.s3.connection import OrdinaryCallingFormat
from fabric.api import prompt, task
import app_config
from fnmatch import fnmatch
import utils
ASSETS_ROOT = 'www/assets'
@task
def sync():
"""
... | nprapps/books14 | fabfile/assets.py | Python | mit | 6,793 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.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 Li... | garyjyao1/ansible | lib/ansible/modules/extras/cloud/vmware/vmware_vmkernel_ip_config.py | Python | gpl-3.0 | 4,192 |
import requests
import re
GITHUB_URL = 'https://github.com/blockcypher/bcwallet'
VERSION_URL = 'https://raw.githubusercontent.com/blockcypher/bcwallet/master/setup.py'
def get_latest_bcwallet_version():
r = requests.get(VERSION_URL)
assert r.status_code == 200, 'Could Not Connect to GitHub (status code %s)'... | blockcypher/bcwallet | bcwallet/version_checker.py | Python | apache-2.0 | 474 |
# -*- coding: utf-8 -*-
"""Notebook Javascript Test Controller
This module runs one or more subprocesses which will actually run the Javascript
test suite.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import absolute_import, print_function
... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/notebook/jstest.py | Python | bsd-2-clause | 21,394 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Xsbench(MakefilePackage):
"""XSBench is a mini-app representing a key computational
... | LLNL/spack | var/spack/repos/builtin/packages/xsbench/package.py | Python | lgpl-2.1 | 2,165 |
#!/usr/bin/python3
#
# Handy tool to simplify docker container management.
#
# try 'rocker help' for usage information.
#
from rocker import commands, restclient
from rocker.commands import help
from rocker.rocker import Rocker
import pkgutil
import sys
_commands = None
def getCommand(name):
global _commands
lis... | mreithub/rocker | rocker/__init__.py | Python | apache-2.0 | 2,009 |
# Copyright (C) 2007, Eduardo Silva <edsiper@gmail.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; either version 2 of the License, or
# (at your option) any later version.
#
# This progr... | godiard/sugar | src/jarabe/frame/frameinvoker.py | Python | gpl-2.0 | 1,411 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009 Timothée Lecomte
# This file is part of Friture.
#
# Friture is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# Friture is distri... | tlecomte/friture | friture/generators/sine.py | Python | gpl-3.0 | 2,662 |
import json
from django import template
register = template.Library()
@register.simple_tag
def query_transform(request, **kwargs):
updated = request.GET.copy()
# Avoid duplicating these keys at all (no page=1&page=2)
single_value_keys = ["state", "set", "page", "match", "sort"]
# Allow multiple va... | CenterForOpenScience/lookit-api | exp/templatetags/exp_extras.py | Python | apache-2.0 | 1,623 |
# -*- coding: utf-8 -*-
import os
import sys
import djcelery
from django.core.exceptions import ImproperlyConfigured
djcelery.setup_loader()
IS_TESTING = bool(('test' in sys.argv) or ('test_coverage' in sys.argv))
IS_LOADDATA = bool('loaddata' in sys.argv)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_DIR = os.path.... | scailer/picarchive | project/settings.py | Python | mit | 4,532 |
#
# The Python Imaging Library
# $Id$
#
# map CSS3-style colour description strings to RGB
#
# History:
# 2002-10-24 fl Added support for CSS-style color strings
# 2002-12-15 fl Added RGBA support
# 2004-03-27 fl Fixed remaining int() problems for Python 1.5.2
# 2004-07-19 fl Fixed gray/grey spelling issues
# 2... | Amechi101/concepteur-market-app | venv/lib/python2.7/site-packages/PIL/ImageColor.py | Python | mit | 8,085 |
import os
import json
from .. import util
from .. import context
from .lib import xmlformatter
from .login import soap_login
from .lib.panel import Printer
"""
from .salesforce.soap import SOAP
from . import context
settings = context.get_settings()
soap = SOAP(settings)
soap.create_request('readMetadata', {
"ty... | xjsender/haoide | salesforce/soap.py | Python | mit | 14,902 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/MSVS/vs-11.0-scc-files.py | Python | mit | 3,967 |
import pytest
from everest.repositories.rdb.testing import check_attributes
from everest.repositories.rdb.testing import persist
from thelma.tests.entity.conftest import TestEntityBase
class TestExperimentEntity(TestEntityBase):
def test_init(self, experiment_fac):
exp = experiment_fac()
check_a... | helixyte/TheLMA | thelma/tests/entity/test_experiment.py | Python | mit | 3,511 |
from .cluster_pb2 import FLNodeDef, FLClusterDef
from .cluster_spec import FLClusterSpec
| bytedance/fedlearner | fedlearner/fedavg/cluster/__init__.py | Python | apache-2.0 | 90 |
from unittest.mock import Mock, patch
from gwaith.main import get_all_rates
@patch('gwaith.main.get_currency_feed_urls', return_value={'PLN': 'url'})
@patch('gwaith.main.get_rates')
def test_get_all_rates(get_rates, get_currency_feed_urls):
m_processor = Mock()
for _ in get_all_rates(processor=m_processor):
... | bartekbrak/gwaith | tests/gwaith/test_main.py | Python | mit | 432 |
# -*- test-case-name: twisted.mail.test.test_smtp -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Simple Mail Transfer Protocol implementation.
"""
import time, re, base64, types, socket, os, random, rfc822
import binascii
import warnings
from email.base64MIME import encode as encode_b... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/mail/smtp.py | Python | gpl-2.0 | 68,320 |
# Copyright (C) 2014 Johnny Vestergaard <jkv@unixcluster.dk>
#
# 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 ... | mushorg/conpot | conpot/core/attack_session.py | Python | gpl-2.0 | 2,606 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
('oracle', '0016_answerconfig_is_wrong'),
]
operations = [
migrations.CreateModel(
... | rolandgeider/pk15-orakel | oracle/migrations/0017_auto_20140921_1802.py | Python | agpl-3.0 | 1,430 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import unittest
sys.path.insert(0, os.path.abspath('..'))
import dxpad._contest as _contest
class SignalMonitor:
signal_received = False
signal_value = None
def __init__(self, signal):
signal.connect(self.signal_receiver)
... | ftl/dxpad | tests/test_contest.py | Python | mit | 3,821 |
from datetime import date
from django.db.models import Q
__author__ = 'alfioemanuele'
from anagrafica.permessi.costanti import GESTIONE_SOCI, ELENCHI_SOCI, GESTIONE_ATTIVITA_SEDE, GESTIONE_CORSI_SEDE, \
GESTIONE_SEDE, GESTIONE_ATTIVITA_AREA, GESTIONE_ATTIVITA, GESTIONE_CORSO, MODIFICA, LETTURA, COMPLETO, \
G... | CroceRossaItaliana/jorvik | anagrafica/permessi/espansioni.py | Python | gpl-3.0 | 16,829 |
#!/usr/bin/env python2
class Effect:
def __init__(self):
print "Hi, I'm an Effect!"
class Magic(Effect):
def whoAreYou(self):
print "Hi, I'm a Magic effect!"
| whoracle/manaclone | libs/Effect.py | Python | gpl-3.0 | 166 |
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/ssl_detection | detection/data.py | Python | apache-2.0 | 23,632 |
__all__ = ["MobileIdAuthenticator", "MobileIDError", "MobileIdSigner"]
from ..exceptions import EsteidError as MobileIDError
from .authenticator import MobileIdAuthenticator
from .signer import MobileIdSigner
| thorgate/django-esteid | esteid/mobileid/__init__.py | Python | bsd-3-clause | 210 |
print("Love Mom!") | KamilSzot/365_programs | 2017-05-26/msg.py | Python | unlicense | 18 |
import pygame as pg
from settings import *
from tilemap import collide_hit_rect
vec = pg.math.Vector2
def collide_with_walls(sprite, group, dir):
if dir == 'x':
hits = pg.sprite.spritecollide(sprite, group, False, collide_hit_rect)
if hits:
if sprite.vel.x > 0:
sprite.po... | kidscancode/gamedev | tutorials/tilemap/part 08/sprites.py | Python | mit | 4,092 |
#
# Copyright (C) 2001 Andrew T. Csillag <drew_csillag@geocities.com>
#
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
import globals
import os
from DT import DTTags, DTTagRegistry, DTLexer, DTParser, D... | drewcsillag/skunkweb | pylibs/skunkdoc/scanners/STMLScanner.py | Python | gpl-2.0 | 9,219 |
class Solution(object):
def combinationSum3(self, k, n):
"""
:type k: int
:type n: int
:rtype: List[List[int]]
"""
def dfs(s, n):
if len(path) >= k:
if n == 0:
result.append(path[:])
return
fo... | zqfan/leetcode | algorithms/216. Combination Sum III/solution2.py | Python | gpl-3.0 | 557 |
from couchpotato.core.downloaders.base import Downloader, StatusList
from couchpotato.core.helpers.encoding import tryUrlencode, ss
from couchpotato.core.helpers.variable import cleanHost, mergeDicts
from couchpotato.core.logger import CPLog
from couchpotato.environment import Env
from datetime import timedelta
from ur... | coolbombom/CouchPotatoServer | couchpotato/core/downloaders/sabnzbd/main.py | Python | gpl-3.0 | 4,865 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import xbmc
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.premiumizerx?action=updatecache)")
| tvaddonsco/tva-release-repo | matrix/plugin.video.premiumizerx/context/updatecache.py | Python | gpl-3.0 | 146 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "auth_demo.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that th... | GunnerJnr/_CodeInstitute | Stream-3/Full-Stack-Development/10.Custom-User-And-Email-Authentication/5.Handling-Authentication/challenge_solution/auth_demo/manage.py | Python | mit | 807 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
... | vlegoff/tsunami | src/lib.py | Python | bsd-3-clause | 2,007 |
import unittest
"""
Given a binary array and an integer m, find the position of zeros flipping which creates the maximum
number of consecutive 1s in the array such that number of zeros is <= m.
Input: 1 0 0 1 1 0 1 0 1 1 1
Output: 5 7
"""
"""
Approach:
1. First, compute number of consecutive zeros to the left and righ... | prathamtandon/g4gproblems | Arrays/flip_zeros_to_maximize_ones.py | Python | mit | 3,953 |
teams = ['Milan','Inter','Juventus']
for team in teams:
print(team.title() + " is a Seria A team")
print("My favourite team is " + teams[0]) | LittleTodd/pythonWork | pythonTest.py | Python | gpl-3.0 | 141 |
from django.contrib import admin
from .models import ExperimentData, ExperimentKeyValue
@admin.register(ExperimentData)
class ExperimentDataAdmin(admin.ModelAdmin):
list_display = ('user', 'experiment_id', 'key',)
list_filter = ('experiment_id',)
ordering = ('experiment_id', 'user', 'key',)
raw_id_fi... | BehavioralInsightsTeam/edx-platform | lms/djangoapps/experiments/admin.py | Python | agpl-3.0 | 741 |
"""Tests for openid.server.
"""
from __future__ import unicode_literals
import unittest
import warnings
from functools import partial
import six
from cryptography.hazmat.primitives import hashes
from mock import sentinel
from six.moves.urllib.parse import parse_qs, parse_qsl, urlparse
from testfixtures import LogCapt... | openid/python-openid | openid/test/test_server.py | Python | apache-2.0 | 79,485 |
#!/usr/bin/env python
import subprocess, os, csv
with open("durations.csv", "w") as out:
writer = csv.writer(out, quoting=csv.QUOTE_NONNUMERIC)
writer.writerow(["pid", "file", "dur"])
for root, dirs, files in os.walk("audio/upload-sites.omroep.nl"):
for f in files:
if f.endswith(".m4a"... | davidavdav/SprekendNederland | bin/mk-duration.py | Python | gpl-2.0 | 838 |
from random import randint
def powmod(a, b, m):
if m == 0:
return -1
if a == 0:
return 0
if a == 1:
return 1
if b == 0:
return 1
if b == 1:
return a % m
if b == 2:
return (a * a) % m
if b % 2:
return (a * powmod(a, b - 1, m)) % m
... | sillyfellow/PES | old_python/primality.py | Python | apache-2.0 | 1,535 |
players = ['charles','martina','michael','florence','eli']
print(players[0:3])
print(players[1:4])
print(players[:4])
print(players[2:])
print(players[-3:])
print("\nHere are the players on my team:")
for player in players[:3]:
print(player.title())
| lukeebhert/python_crash_course | Chapter_4/players.py | Python | gpl-3.0 | 258 |
from datetime import date, timedelta
from decimal import Decimal
from django.db.models import Q, Sum
from .models import Expense, Invoice
def get_monthly_totals(year, month):
totals = {}
start = date(year, month, 1)
if month == 12:
end = date(year+1, 1, 1)
else:
end = date(year, month... | soundgnome/django-rom | rom/invoices/calculator.py | Python | mit | 3,170 |
from unittest import mock
from django.contrib.auth.models import Permission
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from wagtail.core.models import Page
from wagtail.core.signals import pa... | wagtail/wagtail | wagtail/admin/tests/pages/test_unpublish_page.py | Python | bsd-3-clause | 9,650 |
from abc import ABCMeta, abstractproperty
class Generator(object):
__metaclass__ = ABCMeta
def __init__(self, conanfile):
self.conanfile = conanfile
self._deps_build_info = conanfile.deps_cpp_info
self._deps_env_info = conanfile.deps_env_info
self._env_info = conanfile.env_inf... | birsoyo/conan | conans/model/conan_generator.py | Python | mit | 933 |
from event import Event
class RulePartialMatch(object):
"""A potential match of a rule.
Mantains the current status in the rule
associated graph, the current context values and time informations.
"""
def __init__(self, graph):
self.graph = graph
self.rule = graph.rule
... | gmambro/colino | colino/engine.py | Python | apache-2.0 | 1,801 |
#!/usr/bin/env python
from __future__ import print_function
import pyslurm
b = pyslurm.hostlist()
hosts = "dummy0,dummy1,dummy1,dummy3,dummy4"
print("Creating hostlist ...... with {0}".format(hosts))
if b.create(hosts):
print()
print("\tHost list count is {0}".format(b.count()))
node = "dummy3"
pos... | edf-hpc/python-pyslurm | examples/hostlist.py | Python | gpl-2.0 | 1,600 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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, eith... | miyataken999/weblate | weblate/trans/management/commands/updatechecks.py | Python | gpl-3.0 | 1,051 |
from sqlalchemy import Column, Integer, String, ForeignKey
from models.spells.loader import load_buff
from utils.helper import create_attributes_dict
from items import Weapon, Equipment, Potion, Item
from utils.helper import parse_int
from database.main import Base
class ItemTemplateSchema(Base):
"""
Holds i... | Enether/python_wow | models/items/item_template.py | Python | mit | 5,280 |
import os
import sys
import subprocess
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import lines
from cycler import cycler
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
sys.path.insert(0, "../utils/")
import utils
from scipy import stats
trecEval = "../eval/... | fmance/deep-medical-ir | ranking/precperquery.py | Python | gpl-3.0 | 9,742 |
"""Support for IKEA Tradfri covers."""
from __future__ import annotations
from collections.abc import Callable
from typing import Any, cast
from pytradfri.command import Command
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
from homeassistant.config_entries import ConfigEntry
from homeassista... | aronsky/home-assistant | homeassistant/components/tradfri/cover.py | Python | apache-2.0 | 3,363 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright (C) 2014 Hive Tech, SAS.
import unittest
from hivy import __api__
from hivy.core import app
# http://flask.pocoo.org/docs/testing/
# http://packages.python.org/Flask-Testing/
class SystemTestCase(unittest.TestCase):
def setUp(self):
... | hivetech/hivy | tests/test_system.py | Python | apache-2.0 | 1,028 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Copyright (C) 2013, 2014 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; version 3.
#
# Thi... | ubuntu-touch-apps/filemanager-app | tests/autopilot/filemanager/fixture_setup.py | Python | gpl-3.0 | 2,725 |
import json
from mmeowlink.mmtune import MMTune
from base_mmeowlink_app import BaseMMeowlinkApp
class MMTuneApp(BaseMMeowlinkApp):
"""
Tune radio automatically
"""
def customize_parser(self, parser):
parser = super(self.__class__, self).configure_radio_params(parser)
parser.add_argument('--radio_loca... | oskarpearson/mmeowlink | mmeowlink/cli/mmtune_app.py | Python | gpl-3.0 | 898 |
import unittest
from pyramid import testing
class TestRouter(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
self.registry = self.config.registry
def tearDown(self):
testing.tearDown()
def _registerRouteRequest(self, name):
from pyramid.interfaces impor... | gamesbrewer/kegger | kegger/myapp/libs/pyramid/tests/test_router.py | Python | cc0-1.0 | 58,986 |
import sys, pygame, pygame.mixer
from pygame.locals import *
import random
import time
pygame.init()
screen=pygame.display.set_mode((500,500))
pygame.key.set_repeat(25,25)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
| lizerd123/github | motorman/dungeon.py | Python | mit | 264 |
#!/usr/bin/env python
import webapp2
from google.appengine.ext import ndb
from models import Session
from google.appengine.api import app_identity
from google.appengine.api import mail
from google.appengine.api import memcache
from conference import ConferenceApi
MEMCACHE_FEATURED_SPEAKER = "FEATURED SPEAKER FOR THIS ... | YB137514/Conference | main.py | Python | apache-2.0 | 2,641 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | 3v1n0/snapcraft | snapcraft/internal/pluginhandler/_scriptlets.py | Python | gpl-3.0 | 1,487 |
# -*- coding: utf-8 -*-
from allauth.socialaccount.tests import create_oauth_tests
from allauth.tests import MockedResponse
from allauth.socialaccount.providers import registry
from .provider import FlickrProvider
class FlickrTests(create_oauth_tests(registry.by_id(FlickrProvider.id))):
def get_mocked_response(s... | tejesh95/Zubio.in | zubio/allauth/socialaccount/providers/flickr/tests.py | Python | mit | 1,692 |
import os, csv
datadir = "/Users/titlis/cogsci/projects/stanford/projects/overinformativeness/Caroline/3_OI_Final_interactive_replication/data/"
csv_messagenames = [o for o in os.listdir("/Users/titlis/cogsci/projects/stanford/projects/overinformativeness/Caroline/3_OI_Final_interactive_replication/data/message/") if... | thegricean/overinformativeness | experiments/1_gatt_replication/results/scripts/parseMessages.py | Python | mit | 4,386 |
# -*- 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):
# Changing field 'Choropleth.palette'
db.alter_column(u'choropleths_chor... | unt-libraries/texas-choropleth | src/choropleths/migrations/0002_auto__chg_field_choropleth_palette.py | Python | bsd-3-clause | 7,676 |
import os
import subprocess
from graph_diff.cpp_algorithms import parameters
from graph_diff.cpp_algorithms.decorators import clone_method
from graph_diff.cpp_algorithms.parameters import ALGORITHMS_INCLUDE
@clone_method('compile', *parameters.SUPPORTED_ALGORITHMS)
class AlgorithmCompiler:
"""Class for compiling... | alexander-bzikadze/graph_diff | graph_diff/cpp_algorithms/algorithm_compiler.py | Python | apache-2.0 | 1,780 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('downloads', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Compatibility',
fields=[... | codefisher/codefisher_apps | extension_downloads/migrations/0001_initial.py | Python | mit | 1,391 |
import sys
import os
import os.path
import shutil
import subprocess
from pathlib import Path
import functools
import re
import click
from doit.doit_cmd import DoitMain
from doit.cmd_base import ModuleTaskLoader
from doit.runner import ERROR
from elm_doc.run_config import Build, Validate
from elm_doc.loader import mak... | ento/elm-doc | src/elm_doc/cli.py | Python | bsd-3-clause | 7,922 |
from __future__ import unicode_literals
from datetime import date
from django.conf import settings
from django.contrib.sites.models import Site
from usersettings.shortcuts import get_current_usersettings
from auth_helpers.views import user_in_group
from candidates.models import (
TRUSTED_TO_MERGE_GROUP_NAME,
T... | mysociety/yournextrepresentative | mysite/context_processors.py | Python | agpl-3.0 | 2,983 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import Client
from django.test.utils import override_settings
from mock import patch
from nose.tools import eq_, ok_
from mozillians.common.templatetags.helpers import urlparams
from mozillians.common.tests impor... | akatsoulas/mozillians | mozillians/phonebook/tests/test_views/test_views_register.py | Python | bsd-3-clause | 3,421 |
import json
from .db import Model
from .admin import disableable, admin_only
from .player import Player
from .location import Location
from .template import templater, inside_page
from .game import Game
class Murder(Model):
_table='murder'
def __init__(self, id, game, murderer, victim, datetime, location, lat=None... | andr-kun/ncss-murder | murder/murder.py | Python | mit | 7,164 |
#!/usr/bin/env python3
# Download from https://dev.maxmind.com/geoip/geoip2/geolite2/
# You only need GeoLite2-City-Blocks-IPv4.csv from GeoLite2 City
# license of the DB is CC-BY-SA 4.0
#
# This product includes GeoLite2 data created by MaxMind, available from
# http://www.maxmind.com
# usage: generate-ip-mappings.py... | leyyin/stk-addons | tools/generate-ip-mappings.py | Python | gpl-3.0 | 1,794 |
# Copyright (c) 2012 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.
"""Top-level presubmit script for Chromium.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presu... | was4444/chromium.src | PRESUBMIT.py | Python | bsd-3-clause | 77,787 |
assert True
| coala/coala-bears | tests/python/bandit_test_files/assert.py | Python | agpl-3.0 | 12 |
''' *** '''
# start app
from app import app
PORT = app.config['PORT']
DEBUG = app.config['DEBUG']
app.run(host='0.0.0.0', port=PORT, debug=DEBUG)
| greenglobal/face-recognition-demo | run.py | Python | mit | 149 |
import unittest
from context import html2md
from assertions import assertEq
__author__ = 'alex'
class SpecialListsTest(unittest.TestCase):
def test_text_and_paragraph(self):
in_html = '''<ul>
<li>item 1</li>
<li>item 2
<p>item 2 paragraph</p>
<p>item 2 item 2</p>
</li>
<li>item 3</li>
</ul>'''
... | al3xandru/html2md | tests/test_lists.py | Python | bsd-2-clause | 2,503 |
# 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 use ... | pquentin/libcloud | libcloud/compute/drivers/ec2.py | Python | apache-2.0 | 266,514 |
from rest_framework import serializers
from models import WorkSpace, Project, Tag, TimeEntry
from users.utils import get_user_workspaces
class WorkspaceSerializer(serializers.HyperlinkedModelSerializer):
admin = serializers.HyperlinkedRelatedField(view_name='user-detail', read_only=True)
class Meta:
... | mmohaveri/pro-timer | better_timer/time_entries/serialiezers.py | Python | gpl-3.0 | 1,780 |
# -*- coding: utf-8 -*-
import os
if "NIWI_ENVIRON" in os.environ:
if os.environ["NIWI_ENVIRON"] in ('production', 'development', 'local'):
print "importing %s" % os.environ["NIWI_ENVIRON"]
eval("from .%s import *" % (os.environ["NIWI_ENVIRON"]))
else:
try:
print "Trying import local.... | niwinz/niwi-web | src/niwi/settings/__init__.py | Python | bsd-3-clause | 482 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import warnings
import pytest
import torch
from pytest import approx
from torch.distributions import constraints
from pyro.generic import distributions as dist
from pyro.generic import infer, ops, optim, pyro, pyro_backend
from t... | uber/pyro | tests/contrib/test_minipyro.py | Python | apache-2.0 | 8,583 |
""" Hook specifications for tox.
"""
from pluggy import HookspecMarker, HookimplMarker
hookspec = HookspecMarker("tox")
hookimpl = HookimplMarker("tox")
@hookspec
def tox_addoption(parser):
""" add command line options to the argparse-style parser object."""
@hookspec
def tox_configure(config):
""" calle... | cvegaj/ElectriCERT | venv3/lib/python3.6/site-packages/tox/hookspecs.py | Python | gpl-3.0 | 3,276 |
class Episode():
"""Model of a serie's episode."""
pass
| Rolinh/pydeo | pydeo/app/models/episode.py | Python | bsd-3-clause | 64 |
#!/usr/bin/env python3
import math
#import numpy as np
from operator import itemgetter
# amount of parameters to be mined (as a percentage to the domain size, i.e. total number of persons)
SHARE = 0.01
def allclose(a, b, rtol=1e-05, atol=1e-08):
return abs(a - b) <= (atol + rtol * abs(b))
def readFactors(f):
res ... | ldbc/ldbc_snb_datagen | paramgenerator/discoverparams.py | Python | gpl-3.0 | 4,456 |
#!/usr/bin/env python
import time
from SOAPpy import SOAP
srv = SOAP.SOAPProxy('http://localhost:10080/')
for p in ('good param', 'ok param'):
ret = srv.badparam(p)
if isinstance(ret, SOAP.faultType):
print(ret)
else:
print('ok')
dt = SOAP.dateTimeType(time.localtime(time.time()))
print(... | cmsdaq/hltd | lib/SOAPpy-py3-0.52.24/contrib/soap_cli.py | Python | lgpl-3.0 | 335 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-06 16:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('player', '0006_remove_player_events'),
]
operations = [
migrations.AddField... | rarellano/socializa | backend/player/migrations/0007_meeting_event_id.py | Python | agpl-3.0 | 478 |
# Copyright 2015 OpenStack Foundation
#
# 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 ... | wolverineav/neutron | neutron/db/migration/alembic_migrations/versions/newton/expand/45f8dd33480b_qos_dscp_db_addition.py | Python | apache-2.0 | 1,241 |
#!/usr/bin/env python
#
# Copyright 2017 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 required by applicable la... | davygeek/vitess | test/vertical_split_rbr.py | Python | apache-2.0 | 789 |
""" Defines the hook required for the PyInstaller to use projexui with it. """
# define authorship information
__authors__ = ['Eric Hulser']
__author__ = ','.join(__authors__)
__credits__ = []
__copyright__ = 'Copyright (c) 2011, Projex Software'
__license__ = 'LGPL'
im... | ProjexSoftware/projexui | projexui/highlighters/__init__.py | Python | lgpl-3.0 | 393 |
import json
import collections
check_list = []
def validate(file_name):
'''
validates and return whether the given json file is valid one are not
input:json file path
returns True or False or error message.
'''
data = get_json(file_name)
if not isinstance(data.get("endpoints"), list):
return "e... | millij/apibox | apibox/utils/json_validator.py | Python | mit | 2,262 |
# Copyright 2014-2018 The PySCF Developers. 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 appl... | gkc1000/pyscf | pyscf/nao/m_fermi_dirac.py | Python | apache-2.0 | 1,194 |
from Matrix22 import Matrix22
from Vector2D import Vector2D
vec = Vector2D(2, 3)
x=Matrix22(1, 2, 3, 4)
print(x)
print(x*2)
print(abs(x))
print(x/3)
print(inv(x))
| mtyler88/PyTopDownShooter | matrixtest.py | Python | mit | 164 |
# -*- encoding: utf-8 -*-
# vim: ts=4 sw=4 expandtab ai
"""
Usage::
hammer hostgroup [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
create Create an hostgroup.
delete ... | oshtaier/robottelo | robottelo/cli/hostgroup.py | Python | gpl-3.0 | 947 |
"""
URLconf for development-only views.
This gets imported by urls.py and added to its URLconf if we are running in
development mode; otherwise, it is ignored.
"""
from django.conf.urls import url
from contentstore.views.dev import dev_mode
urlpatterns = [
url(r'^dev_mode$', dev_mode, name='dev_mode'),
]
| cpennington/edx-platform | cms/urls_dev.py | Python | agpl-3.0 | 314 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#-------------------------------------------------------------------
# tarfile.py
#-------------------------------------------------------------------
# Copyright (C) 2002 Lars Gustäbel <lars@gustaebel.de>
# All rights reserved.
#
# Permission is hereby grant... | kleientertainment/ds_mod_tools | pkg/win32/Python27/Lib/tarfile.py | Python | mit | 91,727 |
import numpy as np
import sys
from multiprocessing import Process
import ctypes
def run_tests():
data_file = 'data_c/X_250_1600.csv'
labels_file = 'data_c/Y_250_1600.csv'
data = np.genfromtxt(data_file)
labels = np.genfromtxt(labels_file)
mu = 1e-5
#tau_range = [1e-2,1e0]
... | slipguru/l1l2py | cuda/32bit/test_multiprocess.py | Python | gpl-3.0 | 3,126 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.