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 |
|---|---|---|---|---|---|
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LogisticRegression
from common_functions import load_data
if __name__ == '__main__':
X, y = load_data('ex2data1.txt')
x1, x2 = X.T
f_y = y.ravel()
plt.plot(x1[f_y==0], x2[f_y==0], 'yo')
plt.plot(x1[f_y... | mlyundin/Machine-Learning | ex2/ex2_sklearn.py | Python | mit | 832 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Liuyzh'
import asyncio, os, inspect, logging, functools
from urllib import parse
from aiohttp import web
from apis import APIError
#被修饰函数func获得属性__method__和__route__
def get(path):
'''
Define decorator @get('/path')
'''
def decorator(fun... | 1iuyzh/awesome-python3-webapp | www/coroweb.py | Python | gpl-3.0 | 8,940 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: errors.py
import mcl.status
ERR_SUCCESS = mcl.status.MCL_SUCCESS
ERR_INVALID_PARAM = mcl.status.framework.ERR_START
ERR_INVALID_HIVE = mcl.status.fra... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/survey/cmd/registryhive/errors.py | Python | unlicense | 1,689 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2017-2018 Roxanne Gibson
#
# 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 witho... | RainbowDinoaur/roxbot | roxbot/scripts/JSONtoDB.py | Python | mit | 6,104 |
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import datetime
import frappe
from frappe.utils import (
getdate, get_datetime, get_time,
get_user_date_format, get_user_time_format,
formatdate, format_datetime, format_time)... | saurabh6790/frappe | frappe/tests/test_fmt_datetime.py | Python | mit | 4,553 |
from __future__ import unicode_literals
import pytest
from pre_commit.clientlib.validate_manifest import additional_manifest_check
from pre_commit.clientlib.validate_manifest import InvalidManifestError
from pre_commit.clientlib.validate_manifest import MANIFEST_JSON_SCHEMA
from pre_commit.clientlib.validate_manifest... | barrysteyn/pre-commit | tests/clientlib/validate_manifest_test.py | Python | mit | 2,559 |
#!/usr/bin/env python
import random
from src.core import setcore as core
try:
print ("\n [****] Custom Template Generator [****]\n")
print ("\n Always looking for new templates! In the set/src/templates directory send an email\nto davek@secmaniac.com if you got a good template!")
author=raw_input(core.s... | firebitsbr/pwn_plug_sources | src/set/src/phishing/smtp/client/custom_template.py | Python | gpl-3.0 | 1,123 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
--- Day 22: Wizard Simulator 20XX ---
Little Henry Case decides that defeating bosses
with swords and stuff is boring.
Now he's playing the game with a wizard.
Of course, he gets stuck on another boss and needs your help again.
In this version, combat still proceeds with... | coolharsh55/advent-of-code | 2015/day22/wizard_simulator_20xx_part_2.py | Python | mit | 14,917 |
import pygame, sys, os, time
from pygame.locals import *
n = 36
velocidad = 0.5
color = (0,0,0)
rectangulos = [[0 for x in range(n)] for x in range(n)]
mapa = [[0 for x in range(n)] for x in range(n)]
listaPuntos = []
def vecinas(i, j, mapa):
#SE CREA UN CUADRADO CON LOS BORDES CONTROLADOS PARA CONTAR CELDAS VECI... | faustojuanramon/conway-game-of-life-python | Life/interfaz.py | Python | mit | 4,317 |
"""
最大の利益
"""
import sys
def main():
n = int(sys.stdin.readline())
r = [int(sys.stdin.readline()) for _ in xrange(n)]
m = r[0]
result = -(10 ** 9)
for i in xrange(1, n):
m = min(m, r[i - 1])
d = r[i] - m
if d > result:
result = d
print result
if __name__ =... | miyazaki-tm/aoj | Lesson/ALDS1/ALDS1_1_D.py | Python | mit | 357 |
# Natural Language Toolkit: Nonmonotonic Reasoning
#
# Author: Daniel H. Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2013 NLTK Project
# URL: <http://www.nltk.org>
# For license information, see LICENSE.TXT
"""
A module to perform nonmonotonic reasoning. The ideas and demonstrations in
this module are base... | bbengfort/TextBlob | textblob/nltk/inference/nonmonotonic.py | Python | mit | 18,706 |
import os
import pytest
import mock
import numpy
from utilities import *
from pyo import *
class TestPyoBaseObject_ServerNotCreated:
def test_PyoObjectBase_server_not_created_exception(self):
with pytest.raises(PyoServerStateException):
a = Sine()
@pytest.mark.usefixtures("audio_server")
cl... | belangeo/pyo | tests/pytests/test_baseObjects.py | Python | lgpl-3.0 | 39,485 |
from nose.tools import eq_
from ..detector import Detector
def test_detector():
detector = Detector(2)
eq_(detector.process("a", {'id': 1}), None)
# Check noop
eq_(detector.process("a", {'id': 2}), None)
# Short revert
eq_(detector.process("b", {'id': 3}), None)
eq_(
detector.p... | mediawiki-utilities/python-mwreverts | mwreverts/tests/test_detector.py | Python | mit | 849 |
#!/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.
"""Runs an isolate bundled Telemetry GPU integration test.
This script attempts to emulate the contract of gtest-style tests
invoked v... | endlessm/chromium-browser | testing/scripts/run_gpu_integration_test_as_googletest.py | Python | bsd-3-clause | 1,575 |
#!/usr/bin/python2.4
# Copyright (c) 2006-2008 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.
"""SiteCompare module for invoking, locating, and manipulating windows.
This module is a catch-all wrapper for operating syste... | meego-tablet-ux/meego-app-browser | tools/site_compare/drivers/win32/windowing.py | Python | bsd-3-clause | 11,367 |
# 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 applica... | chemelnucfin/tensorflow | tensorflow/python/platform/benchmark.py | Python | apache-2.0 | 17,117 |
from lnst.Common.Parameters import Param, StrParam, BoolParam
from lnst.Common.IpAddress import ipaddress
from lnst.Controller import HostReq, DeviceReq, RecipeParam
from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe
from lnst.Recipes.ENRT.ConfigMixins.OffloadSubConfigMixin import (
OffloadSubConfigMixin)
... | jpirko/lnst | lnst/Recipes/ENRT/DoubleTeamRecipe.py | Python | gpl-2.0 | 4,707 |
#------------------------------------------------------------------------------#
# Copyright 2016-2017 Golden Sierra Game Development Class #
# This file is part of Verloren (GSHS_RPG). #
# ... | turtlewit/GSHS_RPG | src/items/signpost.py | Python | gpl-3.0 | 2,516 |
from foo import bar as b, bar as a
from foo import bar as c, bar
print(bar, a, b, c)
| asedunov/intellij-community | python/testData/optimizeImports/sameNameImportedWithDifferentAliasesInline.py | Python | apache-2.0 | 87 |
#!/usr/bin/env python
from __future__ import with_statement
try:
from setuptools import setup
except ImportError:
# Distribute is not actually required to install
from distutils.core import setup
__AUTHOR__ = 'David Halter'
__AUTHOR_EMAIL__ = 'davidhalter88@gmail.com'
readme = open('README.rst').read() +... | ldong/vim_youcompleteme | third_party/jedi/setup.py | Python | gpl-3.0 | 1,742 |
class Nodo:
valor = None
l = None
r = None
def __init__(self, valor):
self.valor = valor
class Arbol:
root = None
tail = None
def __init__(self):
self.tail = []
def addCom(self, val):
new = Nodo(val)
if(self.root == None):
self.root = new
else:
if(self.tail[0].l == Non... | ejherran/acaest | Arboles/arbol.py | Python | gpl-3.0 | 1,012 |
this is going to be the first main python program to show the 2d turbulence on a beta plane.
Now I am modifying it to create a branch.
Add another sentence in
| yangzang/PS-GFD-py | main.py | Python | mit | 160 |
#!/usr/bin/env python
import json
import logging
import os
import threading
import traceback
from future.backports.urllib.parse import quote_plus
from future.backports.urllib.parse import parse_qs
from werkzeug.http import parse_accept_header
from aatest.check import State, OK, ERROR
from aatest.events import EV_COND... | identinetics/saml2test2 | script/idp_test.py | Python | bsd-2-clause | 20,596 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'window.ui'
#
# Created: Tue Dec 22 17:18:58 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(se... | RLejolivet/MarioMakerLevelsBot | MarioMakerLevelsBot/MarioMakerLevelsBot/ui/window.py | Python | mit | 18,935 |
#!/usr/bin/env python3
import os
import subprocess
import sys
cnex = os.path.join("exec", "cnex", "cnex")
i = 1
while i < len(sys.argv):
if sys.argv[i] == "--cnex":
i += 1
cnex = sys.argv[i]
else:
break
i += 1
fullname = sys.argv[i]
subprocess.check_call([cnex, fullname + "x"] +... | ghewgill/neon-lang | exec/cnex/run_test.py | Python | mit | 337 |
########################################################################
# File name: register.py
# This file is part of: aioxmpp
#
# LICENSE
#
# 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 Foundat... | horazont/aioxmpp | examples/register.py | Python | lgpl-3.0 | 1,494 |
# Copyright 2015 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... | jbedorf/tensorflow | tensorflow/python/kernel_tests/tensor_array_ops_test.py | Python | apache-2.0 | 64,536 |
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# 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 ... | capturePointer/or-tools | examples/python/nontransitive_dice.py | Python | apache-2.0 | 5,680 |
from . import model
from . import wizard
| Pexego/PXGO_00019_2014_BU | project-addons/product_do_merge/__init__.py | Python | agpl-3.0 | 41 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 Geisha Tokyo Entertainment, Inc.
#
# 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 witho... | geishatokyo-lightning/lightning | lightning_core/sample/xml2html.py | Python | mit | 1,705 |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
#... | drupalmk/Google-Class-Python-Exercice | copyspecial/copyspecial.py | Python | apache-2.0 | 1,894 |
import random
import unittest
from unittest.mock import patch, mock_open
from datetime import datetime
from spot_sdk import Feed, Message, SpotSDKError
class TestMessage(unittest.TestCase):
raw_message = {
"@clientUnixTime": "0",
"id": 823677113,
"messengerId": "0-3049668",
"messengerName": "svcats... | gregology/spot-sdk | spot_sdk/tests.py | Python | mit | 2,246 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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) ... | NickDaly/GemRB-FixConfig-Branch | gemrb/GUIScripts/bg1/GUIPR.py | Python | gpl-2.0 | 10,081 |
# encoding: utf-8
# module samba.dcerpc.netlogon
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/netlogon.so
# by generator 1.135
""" netlogon DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class netr_SidAttr(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # re... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/netlogon/netr_SidAttr.py | Python | gpl-2.0 | 763 |
#!/usr/bin/python
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | richardfergie/googleads-python-lib | examples/dfp/v201505/creative_set_service/get_creative_sets_by_statement.py | Python | apache-2.0 | 2,502 |
# Copyright 2022 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | google/flax | examples/wmt/decode.py | Python | apache-2.0 | 15,118 |
import sys
import signal
import numpy as np
import time
import subprocess
import multiprocessing
from .base import BaseWorker
from ..defaults import TASKDB_STATES, TASK_STATES
from ..utils import print_start, print_end
_task_infos = []
_taskdb = None
_pool = None
def _signal_handler(signal, frame):
if _pool is ... | beckermr/cake | cake/workers/pmpworker.py | Python | bsd-3-clause | 4,946 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.cloud import provider as cloud_provider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.common.vm import VM
from cfme.infrastructure.provider import wait_for_a_provider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
fr... | jkandasa/integration_tests | cfme/tests/test_db_restore.py | Python | gpl-2.0 | 4,699 |
# Copyright (c) 2016 kamyu. All rights reserved.
#
# Google Code Jam 2014 Round 1B - Problem B. New Lottery Game
# https://code.google.com/codejam/contest/2994486/dashboard#s=p1
#
# Time: O(log(max(A, B)))
# Space: O(log(max(A, B)))
#
lookup = {}
def f(A, B, K):
if (A, B, K) in lookup:
return lookup[(A, B... | kamyu104/GoogleCodeJam-2014 | Round 1B/new-lottery-game.py | Python | mit | 1,613 |
# -*- coding: utf-8 -*-
import json
from . import check_input_attribute, standard_error_message
from pyipasnhistory import IPASNHistory
from pymisp import MISPAttribute, MISPEvent, MISPObject
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst'], 'format': 'misp_standard'}
moduleinfo = {'ver... | VirusTotal/misp-modules | misp_modules/modules/expansion/ipasn.py | Python | agpl-3.0 | 2,208 |
import openpyxl
class Excel_Template:
def __init__(self, cols, col_names, sheet_name):
self.num_cols = cols
self.data = []
self.wb = openpyxl.Workbook()
# for name in self.wb.get_sheet_names():
# print name
# self.wb.remove_sheet(name)
self.wb.crea... | jeremy24/python-file-handling | src/write_excel.py | Python | mit | 1,097 |
# -*- coding: utf-8 -*-
"""
This module provides all tests with a common base to build upon.
"""
from pickle import loads
from re import sub
from os.path import basename, dirname, realpath
from unittest import main, TestCase
class TestBase(TestCase):
def setUp(self, *args, **kwargs):
"""
Initial... | jaschac/nginx-resolution-tree | nrt/tests/test_base.py | Python | apache-2.0 | 1,919 |
# -*- coding: utf-8 -*-
"""
-------------------------------------
N A C S P Y T H O N S C R I P T
-------------------------------------
NACS version: 2.0.2745 - pre3
NACS architecture: CENTOS 5.11 (X86_64)
File generated at Tue Jan 20 16:55:05 2015
On host 'lse86' by 'cae42'
"""
from __future__ import division ... | cosailer/caeproject | simulation_result/10/project3.py | Python | gpl-2.0 | 2,021 |
# ===================================================================
#
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
# 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. Redistributio... | mrquim/repository.mrquim | script.module.pycryptodome/lib/Crypto/Cipher/_mode_siv.py | Python | gpl-2.0 | 13,741 |
# coding: utf-8
# Author: Milan Kubik
class PluginConfigError(ValueError):
pass
class PluginBase(object): # pylint: disable=R0903
"""Dynamic Directory plugin base class
All plugins must inherit from this class and
implement the __call__ method.
This method is later used by the plugin manager
... | apophys/ipaqe-dyndir | ipaqe_dyndir/plugin/base.py | Python | mit | 700 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
from . import np
def argparser(x,vartype,**kwargs):
if isinstance(x,vartype):
if kwargs.has_key('varsize'):
if len(x) == kwargs['varsize']:
pass
else:
raise Inde... | gusmaogabriels/optinpy | optinpy/simplex/base.py | Python | gpl-3.0 | 6,561 |
from .pvector import PVector
import naturepy.tk_monkey_patch
import tkinter
class Mover:
# Contains loc, vec, acc, mass
canvas_id = 0
elast = -1
def __init__(self, _loc, _vec, _acc, _mass):
self.loc = _loc
self.vec = _vec
self.acc = _acc
self.mass = _mass
def upda... | rptynan/naturepy | naturepy/mover.py | Python | gpl-2.0 | 1,530 |
# 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 law or agreed to in writing, s... | thenenadx/forseti-security | google/cloud/security/scanner/audit/base_rules_engine.py | Python | apache-2.0 | 2,972 |
# Copyright (C) 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
#
# This file is part of Kitty.
#
# Kitty 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, o... | cisco-sas/kitty | tests/test_interface_web.py | Python | gpl-2.0 | 8,401 |
## fileHistoryUnitTests.py
## Author: Daniel "Albinohat" Mercado
## This script returns the most recently opened/saved files using the windows open/save prompts.
## CLAs (2)
## 1 - REQUIRED - File extension without leading dot or star for last 20 regardless of extension.
## 2 - OPTIONAL - SID of the user to get info fo... | ForensicTools/OpenSourceArtifactollectionToolkit-OSACT-475_2141-Cifranic-Mercado-Simmonds-Voellmer | Daniel Mercado/fileHistoryUnitTests.py | Python | apache-2.0 | 1,506 |
try:
from setman.lazy import LazySettings
except ImportError:
# Do not care about "Settings cannot be imported, because environment
# variable DJANGO_SETTINGS_MODULE is undefined." errors
LazySettings = type('LazySettings', (object, ), {})
__all__ = ('get_version', 'settings')
VERSION = (0, 2, 'beta... | owais/django-setman | setman/__init__.py | Python | bsd-3-clause | 802 |
from __future__ import division, print_function, absolute_import
import pytest
from scipy.special._testutils import MissingModule, check_version
from scipy.special._mptestutils import mp_assert_allclose
from scipy.special._precompute.utils import lagrange_inversion
try:
import sympy
except ImportError:
sympy ... | jamestwebber/scipy | scipy/special/tests/test_precompute_utils.py | Python | bsd-3-clause | 1,238 |
# from django.core.management.base import BaseCommand, CommandError
# from django.db.models import get_model
#
# from bhp066.apps.bcpp.choices import COMMUNITIES
# from bhp066.apps.bcpp_survey.models import Survey
#
#
# class Command(BaseCommand):
#
# args = 'community source-survey-slug label'
# help = 'Ad... | botswana-harvard/bcpp-subject | bcpp_subject/management/commands/update_call_list.py | Python | gpl-3.0 | 1,587 |
# -*- coding: utf-8 -*-
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FIWARE project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at:
#
# http://w... | telefonicaid/fiware-aiakos | test/acceptance/commons/authentication.py | Python | apache-2.0 | 4,111 |
#!/usr/bin/env python
import argparse
import atexit
import copy
import os
import shutil
import subprocess
import sys
import tempfile
import warnings
import django
from django.apps import apps
from django.conf import settings
from django.db import connection, connections
from django.test import TestCase, TransactionTes... | vincepandolfo/django | tests/runtests.py | Python | bsd-3-clause | 17,997 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# Under the hood, there are 3 separate classes that perform different
# parts of the transformation:
#
# - `~astropy.wcs.Wcsprm`: Is a direct wrapper of the core WCS
# functionality in `wcslib`_. (This includes TPV and TPD
# polynomial disto... | aleksandr-bakanov/astropy | astropy/wcs/wcs.py | Python | bsd-3-clause | 132,566 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# Copyright (C) 2011 Matthias Müller-Reineke
# 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... | MatthiasMuellerReineke/push-admin | aslib/process_hosts.py | Python | gpl-3.0 | 11,805 |
# Copyright 2013 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/licenses/LICENSE-2.0
#
# Unless requ... | apporc/neutron | neutron/tests/api/test_routers.py | Python | apache-2.0 | 19,299 |
import os
import subprocess
import unittest
import sand_env
from pubs import config
def git_hash(pubsdir):
"""Return the git revision"""
hash_cmd = ('git', '-C', pubsdir, 'rev-parse', 'HEAD')
return subprocess.check_output(hash_cmd)
class TestGitPlugin(sand_env.SandboxedCommandTestCase):
def setU... | pubs/pubs | tests/test_git.py | Python | lgpl-3.0 | 4,075 |
from typing import List
from logger import logger
from perfrunner.helpers.memcached import MemcachedHelper
from perfrunner.helpers.misc import maybe_atoi, pretty_dict
from perfrunner.helpers.monitor import Monitor
from perfrunner.helpers.remote import RemoteHelper
from perfrunner.helpers.rest import RestHelper
from pe... | pavel-paulau/perfrunner | perfrunner/helpers/cluster.py | Python | apache-2.0 | 16,769 |
#
# Copyright (C) 2011 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV 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 hope... | hmpf/nav | python/nav/topology/layer2.py | Python | gpl-3.0 | 3,426 |
import foo
import bar | asedunov/intellij-community | python/testData/optimizeImports/extractImportBlockNoWhitespaceAtEnd.py | Python | apache-2.0 | 21 |
# 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... | apache/incubator-superset | superset/migrations/versions/979c03af3341_.py | Python | apache-2.0 | 1,135 |
from defines import *
import numpy as np
import mobula
import mobula.layers as L
class LeNet5:
def __init__(self, X, labels):
data, label = L.Data([X, labels], "data", batch_size = 100)
conv1 = L.Conv(data, dim_out = 20, kernel = 5)
pool1 = L.Pool(conv1, pool = L.Pool.MAX, kernel = 2, stri... | wkcn/mobula | examples/LeNet5.py | Python | mit | 1,026 |
from django import forms
from django.contrib import admin
from django.contrib.admin import AdminSite
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.contenttypes.admin import GenericStackedInline
from django.contrib.messages.m... | georgemarshall/django | tests/admin_checks/tests.py | Python | bsd-3-clause | 30,932 |
#!/usr/bin/env python
# -*- coding: ISO-8859-15 -*-
#
# Copyright (C) 2005-2007 David Guerizec <david@guerizec.net>
#
# Last modified: 2008 Jan 24, 22:56:59 by david
#
# 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... | OutOfOrder/sshproxy | sshproxy/registry.py | Python | gpl-2.0 | 2,265 |
@crclan.command(name="roster", pass_context=True, no_pm=True)
async def crclan_roster(self, ctx, key, *args):
"""Clan roster by key.
To associate a key with a clan tag:
[p]bsclan addkey
Optional arguments:
--sort {name,trophies,level,donations,crowns}
... | Dino0631/RedRain-Bot | cogs/notinusecogs/crclanAudit.py | Python | gpl-3.0 | 2,388 |
# Copyright (C) 2009-2011 Jason Scheunemann <jason.scheunemann@yahoo.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 vers... | grevutiu-gabriel/sopcast-player | lib/FileDownload.py | Python | gpl-2.0 | 1,592 |
import unittest2
import inspect
import errno
import socket
from mock import patch, Mock, call
from snakebite.client import HAClient, AutoConfigClient, Client
from snakebite.config import HDFSConfig
from snakebite.namenode import Namenode
from snakebite.errors import OutOfNNException, RequestError, InvalidInputExceptio... | spotify/snakebite | test/client_test.py | Python | apache-2.0 | 6,721 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^search/(?P<handler>[a-zA-Z0-9_]+)$', 'foreignkeysearch.views.search', name='foreignkey_search'),
url(r'^get/(?P<handler>[a-zA-Z0-9_]+)$', 'foreignkeysearch.views.get_item', name='foreignkey_get'),
)
| schneck/django-foreignkeysearch | foreignkeysearch/urls.py | Python | mit | 282 |
# -*- coding: utf-8 -*-
import os
from setuptools import setup
from setuptools import find_packages
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir... | botswana-harvard/edc-label | setup.py | Python | gpl-3.0 | 1,302 |
from db import DB
import datetime
# coding: utf-8
db = DB()
def microseconds_to_timedelta(usecs):
return datetime.timedelta(microseconds=usecs)
def get_tariff(service, tariff):
return db.query('select id, price from tariffs_tariff where service="{0}" and name="{1}"'.format(service, tariff))
def get_list_by_... | rdl-telecom/billing | tariffs/tariffs.py | Python | unlicense | 2,545 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "berth.settings.dev")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| joealcorn/berth.cc | manage.py | Python | mit | 252 |
# Sketch - A Python-based interactive drawing program
# Copyright (C) 2002 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at ... | shumik/skencil-c | Script/reload_image.py | Python | gpl-2.0 | 3,084 |
import unittest
from test import support
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import array
import platform
import contextlib
from weakref import proxy
import signal
import math
import pickle
import struct
impo... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Lib/test/test_socket.py | Python | apache-2.0 | 203,339 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/pi/Documents/desenvolvimentoRos/devel/include".split(';') if "/home/pi/Documents/desenvolvimentoRos/devel/include" != "" else []
PROJECT_CATKIN_DEPENDS = "geometry_msgs;message_runtime;std_msgs".... | UnbDroid/robomagellan | Codigos/Raspberry/desenvolvimentoRos/build/common_msgs/shape_msgs/catkin_generated/pkg.develspace.context.pc.py | Python | gpl-3.0 | 528 |
#!/usr/bin/env python
import pygal
import argparse
def parse_csv_file(input_file):
first = True
comment = False
data = {}
with open(input_file) as f:
for line in f:
# skip blank lines
if not line.isspace():
if line.startswith("#"):
comment = line[1:].strip()
elif fir... | GeoffWilliams/csv2svg_graph | csv2svg_graph.py | Python | gpl-2.0 | 1,623 |
# -----------------------------------------------------------------------------
# Vanda multilang
# Copyright (C) 2012 Sameer Rahmani <lxsameer@gnu.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 F... | Karajlug/karajlug | multilang/urls.py | Python | gpl-2.0 | 1,707 |
#!/usr/bin/env python
import sys
sys.path.append('../../monitor')
import datetime, glob, job_stats, os, subprocess, time
import matplotlib
if not 'matplotlib.pyplot' in sys.modules:
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy
import scipy, scipy.stats
import argparse
import tspl, tspl_utils
c... | rtevans/tacc_stats_old | analyze/process_pickles/htrate.py | Python | lgpl-2.1 | 2,109 |
_PRIVATE = "private"
_PUBLIC = "public"
Privacy = (
(_PRIVATE, "Private"),
(_PUBLIC, "Public"),
) | TunedMystic/monq-app | snippet/definitions/privacy.py | Python | gpl-2.0 | 103 |
from sqlalchemy import orm, Column, types, inspect, Index, ForeignKey
from sqlalchemy.exc import InvalidRequestError
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship
from sqlalchemy.orm.exc import UnmappedClassError
from alchy import query
from .base import TestQueryBase
f... | dgilland/alchy | tests/test_model.py | Python | mit | 20,141 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | SauloAislan/ironic | ironic/tests/base.py | Python | apache-2.0 | 7,903 |
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# these are system modules
import numpy
import sys
# these are my local ones
from env import gidgetConfigVars
import tsvIO
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
NA_VALUE = -999999
# -#-#-#-#-... | cancerregulome/gidget | commands/feature_matrix_construction/main/addGnabFeatures.py | Python | mit | 38,773 |
from flask import Flask
app = Flask(__name__)
@app.route('/') #event handler
def index(): #event function
return '<h1>Hello World</h1>'
@app.route('/user/<name>') #dynamic route
def user(name):
return '<h1>Hello, {}</h1>'.format(name)
if __name__ == '__main__': #ensures dev server is started only
a... | MrOrioleCashback/snippets | FlaskApp1.py | Python | mit | 369 |
"""
Helios Security -- mostly access control
Ben Adida (ben@adida.net)
"""
import urllib
# nicely update the wrapper function
from functools import update_wrapper
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.http import HttpResponseR... | shirlei/helios-server | helios/security.py | Python | apache-2.0 | 5,988 |
from django import forms
from game.models import Bid
class MakeBidForm(forms.ModelForm):
class Meta:
model = Bid
fields = ['bid']
def __init__(self, *args, **kwargs):
current_round = kwargs.get('current_round', None)
if 'current_round' in kwargs:
... | JoepDriesen/Rikker | game/forms.py | Python | gpl-2.0 | 1,510 |
#!/usr/bin/python
#
# This is a 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.
#
# This Ansible library is distributed in the hope that i... | KyleJamesWalker/ansible | lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py | Python | gpl-3.0 | 23,637 |
"""
Django module container for classes and operations related to the "Course Module" content type
"""
import json
import logging
from cStringIO import StringIO
from datetime import datetime, timedelta
import dateutil.parser
from django.conf import settings
import requests
from lazy import lazy
from lxml import etree... | Edraak/edraak-platform | common/lib/xmodule/xmodule/course_module.py | Python | agpl-3.0 | 59,237 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | frippe12573/geonode | geonode/layers/utils.py | Python | gpl-3.0 | 29,864 |
import yaml
from django.conf import settings
from django.core.management.base import BaseCommand
from django.contrib.gis.geos import GEOSGeometry
from ...models import StopPoint
class Command(BaseCommand):
def handle(self, *args, **options):
with open(settings.DATA_DIR / 'stops.yaml') as open_file:
... | jclgoodwin/bustimes.org.uk | busstops/management/commands/correct_stops.py | Python | mpl-2.0 | 626 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
## ##
## Copyright 2011-2012, Neil Wallace <neil@openmolar.com> ##
## ... | rowinggolfer/openmolar2 | configure.py | Python | gpl-3.0 | 6,157 |
emk.module("java")
| kmackay/emk | tutorial/2_java/emk_rules.py | Python | bsd-2-clause | 19 |
from collections import OrderedDict
from textwrap import dedent
import re
import sublime
from sublime_plugin import TextCommand
from . import util
from ..core.runtime import enqueue_on_worker
from ..core.settings import GitSavvySettings
from ..core.utils import focus_view
MYPY = False
if MYPY:
from typing import... | divmain/GitSavvy | common/ui.py | Python | mit | 13,594 |
# Copyright 2015 TellApart, 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 writi... | tellapart/aurproxy | tellapart/aurproxy/backends/backend.py | Python | apache-2.0 | 8,568 |
#!/usr/bin/env python
# coding: utf-8
__author__ = 'k_morishita'
| mokemokechicken/PlayingChainer | src/reinforce1b/__init__.py | Python | mit | 66 |
#
# mainwindow.py
#
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
#
# Deluge is free software.
#
# You may 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... | s0undt3ch/Deluge | deluge/ui/gtkui/mainwindow.py | Python | gpl-3.0 | 9,942 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import unittest
from pants.option.option_value_container import OptionValueContainerBuilder
from pants.option.ranked_value import Rank, RankedValue
class OptionValueContainerTest(unitte... | benjyw/pants | src/python/pants/option/option_value_container_test.py | Python | apache-2.0 | 3,316 |
"""Tests for the myq integration."""
import json
from homeassistant.components.myq.const import DOMAIN
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from tests.async_mock import patch
from tests.common import MockConfigEntry, load_fixture
async def async_... | pschmitt/home-assistant | tests/components/myq/util.py | Python | apache-2.0 | 1,299 |
# 4chThreadArchiver
# Copyright (C) 2016, Sebastian "Chloride Cull" Johansson
#
# 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... | ChlorideCull/4chThreadArchiver | config.py | Python | agpl-3.0 | 825 |
# Generated from Excellent.g4 by ANTLR 4.7
# encoding: utf-8
from __future__ import print_function
from antlr4 import *
from io import StringIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write(u"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3")
buf.write(u"\30D\4\2\t\2\4\3\t\3... | rapidpro/expressions | python/temba_expressions/gen/ExcellentParser.py | Python | bsd-3-clause | 31,645 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.