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 __future__ import absolute_import
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
# init for externals package
from . import argparse
from . import configobj
| alexis-roche/nireg | nireg/externals/__init__.py | Python | bsd-3-clause | 229 |
# -*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from django.db.backends.sqlite3.base import DatabaseWrapper as OrigDatabaseWrapper
from .operations import DatabaseOperations
class DatabaseWrapper(OrigDatabaseWrapper):
def __init__(self, *args, **kwargs)... | moumoutte/django-perf-rec | tests/django18_sqlite3_backend/base.py | Python | mit | 429 |
# Copyright 2011 OpenStack LLC.
# 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... | openstack/manila | manila/context.py | Python | apache-2.0 | 5,476 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
usage: generate_network.py -m <FILE> -c <FILE> [-o <STR>] [--exclude_universal]
[-h|--help]
Options:
-h --help show this
-m, --cluster_summary <FILE> TAXON.cluster_summar... | DRL/kinfin | scripts/generate_network.py | Python | gpl-3.0 | 8,546 |
#import time
start = time.time()
#def twoSum(nums, target):
lst = []
for i, e in enumerate(nums):
if target - e in nums:
j = nums.index(target - e)
if i == j:
continue
lst.append(i)
lst.append(j)
return lst
twoSum([3,2,4],6)
#... | CharlotteLock/LeetCode | 1.Two Sum.py | Python | gpl-3.0 | 734 |
#!/usr/bin/env python
"""
Simple-stupid time tracker script
=================================
Timetrack
opyright (C) 2010, Branko Vukelic <studio@brankovukelic.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 Soft... | foxbunny/Timetrack | tt.py | Python | gpl-3.0 | 7,554 |
"""
Task
Write a function deNico/de_nico() that accepts two parameters:
key/$key - string consists of unique letters and digits
message/$message - string with encoded message
and decodes the message using the key.
First create a numeric key basing on the provided key by assigning each letter position in which it is ... | bgarnaat/codewars_katas | src/python/5kyu/basic_DeNico/basic_DeNico.py | Python | mit | 1,696 |
from django.http import Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.comments.models import Comment, KarmaScore
def vote(request, comment_id, vote):
"""
Rate a comment (+1 or -1)
Templates: `karma_vote_accepted`
Context:
... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-0.96/django/contrib/comments/views/karma.py | Python | bsd-3-clause | 1,140 |
'''
This is version001
about 程序最简单最粗糙的版本
my_debugger_defines.py # 数据结构
my_debugger.py # 功能
my_test_%.py # 测试
''' | MrLi008/mysimpledebugger | Gray_Hat_Python/src/simpledebugger/version001/__init__.py | Python | gpl-3.0 | 176 |
"""
Kernel module the kernels to sit in.
.. automodule:: .src
:members:
:private-members:
"""
from .src.kern import Kern
from .src.add import Add
from .src.prod import Prod
from .src.rbf import RBF
from .src.linear import Linear, LinearFull
from .src.static import Bias, White, Fixed, WhiteHeteroscedastic, Precom... | avehtari/GPy | GPy/kern/__init__.py | Python | bsd-3-clause | 1,764 |
#!/usr/bin/env python
"""
lit - LLVM Integrated Tester.
See lit.pod for more information.
"""
import math, os, platform, random, re, sys, time, threading, traceback
import ProgressBar
import TestRunner
import Util
import LitConfig
import Test
import lit.discovery
class TestingProgressDisplay:
def __init__(se... | dbrumley/recfi | llvm-3.3/utils/lit/lit/main.py | Python | mit | 15,230 |
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext_lazy
from django_countries import countries
from django_countries.fields import CountryField
COUNTRIES = [(ugettext_lazy(name), code) for (name, code) in list(countries)]
class Company(models.Model):
# Company credenti... | samupl/simpleERP | apps/contacts/models.py | Python | mit | 6,028 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Python bindings for Unitex/GramLab documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 28 11:29:29 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration valu... | patwat/python-unitex | documentation/conf.py | Python | gpl-3.0 | 9,751 |
'''
This module contains different variations of the Physics Informer Neural Network model using the JaxModel API
'''
import numpy as np
import time
from typing import Any, Callable, Iterable, List, Optional, Tuple, Union
try:
from collections.abc import Sequence as SequenceCollection
except:
from collections impo... | deepchem/deepchem | deepchem/models/jax_models/pinns_model.py | Python | mit | 14,995 |
#! /Users/jasonlu/.virtualenvs/pyven3_6/bin/python
import os
#-------------------------------------------------------#
"""
是否退出
"""
def b_quit(str):
if str in ['q', 'Q']:
return True
return False
"""
列出所有文件
"""
def show_all_files():
str_work_path = os.getcwd()
list_files = os.listdir(str_work_... | jinzekid/codehub | python/练习_数据结构/c1_9_8.py | Python | gpl-3.0 | 1,731 |
# Generated by Django 2.2.10 on 2020-03-12 12:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('devicetags', '0002_rm_read_perm'),
]
operations = [
migrations.AlterModelOptions(
name='devicetag',
options={'ordering': ['... | MPIB/Lagerregal | devicetags/migrations/0003_auto_20200312_1315.py | Python | bsd-3-clause | 412 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
sshd notification script to be used with PAM sshd module.
'''
import ConfigParser
import io
import os
from requests import post as http_post
from sh import hostname
HOSTNAME = hostname().strip()
ACTION_TYPES = {
'open_session': '登录',
'close_session': '注销登录',
}... | JokerQyou/toolset | server/sshd_notify.py | Python | bsd-2-clause | 2,999 |
class Solution(object):
def search(self, tar, pos):
posl = 0
posr = len(pos)
ret = -1
while posl < posr:
mid = (posl + posr) / 2
if pos[mid] <= tar:
ret = pos[mid]
posl = mid+1
else:
posr = mid
return ret
def longestSubstring(self, s, k):
"""
:type s: str
:type k: int
:rtype:... | xingjian-f/Leetcode-solution | 395. Longest Substring with At Least K Repeating Characters.py | Python | mit | 1,030 |
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponseRedirect
from rest_framework.test import APIRequestFactory
from geokey.users.tests.model_factories import UserFactory
from geokey.projects.tests.model_... | ExCiteS/geokey-cartodb | geokey_cartodb/tests/test_views.py | Python | mit | 3,759 |
import numpy as np
import matplotlib.pyplot as plt
plt.subplot(111)
dat = np.genfromtxt('energy.dat')
plt.plot(dat[:,0],dat[:,1],'-',label='K')
plt.plot(dat[:,0],dat[:,2],'--',label='V')
plt.plot(dat[:,0],dat[:,3],'--',label='U')
en = dat[:,1]+dat[:,2]+dat[:,3]
plt.plot(dat[:,0],en,'--',label='E')
plt.legen... | binghongcha08/pyQMD | GHQT/en.py | Python | gpl-3.0 | 336 |
from datetime import datetime, timedelta
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy import event
from inbox.models.vault import vault
from inbox.models.backends.imap import ImapAccount
from inbox.oauth import new_token, validate_token
from inbox.basicauth import AuthError
from inbox.l... | rmasters/inbox | inbox/models/backends/gmail.py | Python | agpl-3.0 | 3,991 |
import re
""" returns name but with capitalized letters lowercased and preceded by _"""
def dbname(s):
return re.sub( '(?<!^)(?=[A-Z])', '_', example ).lower()
| bchoward/homehub | homehubdb/homehubdb/util.py | Python | gpl-2.0 | 167 |
# 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: validate.py
"""
Middleware to check for obedience to the WSGI specification.
Some of the things this checks:
* Signature of the application and sta... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/wsgiref/validate.py | Python | unlicense | 13,478 |
from .MacTypes import *
import time
import numpy as np
class mach_timebase_info_data_t(Structure):
_fields_ = [
('numer', UInt32),
('denom', UInt32),
]
mach_absolute_time = CDLL(None).mach_absolute_time
mach_absolute_time.restype = UInt64
mach_absolute_time.argtypes = ()
mach_timebase_info = ... | piannucci/blurt | blurt_py_80211/streaming/blurt/audio/mach_time.py | Python | mit | 1,373 |
import datetime
import json
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.forms.formsets import formset_factory
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.datastructures import MultiValueDictKeyE... | clouserw/olympia | apps/editors/views_themes.py | Python | bsd-3-clause | 18,642 |
#! /usr/bin/env python
'''Test of text objects
'''
from OpenGLContext import testingcontext
BaseContext = testingcontext.getInteractive()
from OpenGL.GL import *
from OpenGLContext.arrays import *
import string, time, sys, os
import logging
log = logging.getLogger( __name__ )
from OpenGLContext.scenegraph.basenodes im... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGLContext/bin/choosefonts.py | Python | lgpl-3.0 | 7,200 |
# -*- coding: utf-8 -*-
"""Constants"""
from __future__ import division
C3515 = 42.9140
r"""Conductivity of 42.914 [mmho cm :sup:`-1` == mS cm :sup:`-1`] at Salinity
35 psu, Temperature 15 :math:`^\\circ` C [ITPS 68] and Pressure 0 db.
References
----------
.. [1] Culkin and Smith, 1980: Determination of the Conce... | kthyng/octant | octant/python-gsw/gsw/gibbs/constants.py | Python | bsd-3-clause | 6,478 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-28 19:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_duration_limits', '0002_auto_20181119_0959'),
]
operations = [
migrations.AlterField(
model_na... | stvstnfrd/edx-platform | openedx/features/course_duration_limits/migrations/0003_auto_20181128_1407.py | Python | agpl-3.0 | 625 |
# 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 Fcgi(AutotoolsPackage):
"""FastCGI is simple because it is actually CGI with only a few ex... | LLNL/spack | var/spack/repos/builtin/packages/fcgi/package.py | Python | lgpl-2.1 | 1,171 |
# Copyright (c) 2017-2017 Cisco Systems, 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
#
# Unl... | Gitweijie/first_project | networking_cisco/plugins/ml2/drivers/cisco/nexus/nexus_restapi_network_driver.py | Python | apache-2.0 | 19,340 |
import sys
import math
import communication.avr_communication as avr_communication
import time
# Types of corridors
CORRIDOR = 0
DEAD_END = 1
MAYBE_CORRIDOR = 2 # when front sensor has detected a corridor but back has yet not
# Commands
GO_FORWARD = 0
TURN_LEFT = 1
TURN_RIGHT = 2
STOP = 3
CLIMB_OBSTACLE = 4
COMPLETE_... | TheZoq2/LiTHe-Hex | source/central_unit/decisions/decision_making.py | Python | gpl-3.0 | 8,063 |
import logging
class ProgramTitles(object):
def __init__(self):
self.title120 = None # type: unicode
@classmethod
def from_iterable(cls, iterable): # type: (Iterable[dict]) -> ProgramTitles
"""
:param iterable:
:return:
"""
program_titles = cls()
... | astrilchuk/sd2xmltv | libschedulesdirect/common/programtitles.py | Python | mit | 559 |
"""
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the
longest path from the root node down to the farthest leaf node.
"""
class Node():
def __init__(self, val = 0):
self.val = val
self.left = None
self.right = None
# def max_height(root):
... | amaozhao/algorithms | algorithms/tree/max_height.py | Python | mit | 1,170 |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from os import curdir, sep
import string,cgi,time
import sys, socket
from datetime import datetime
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
try:
if self.path.endswith("info.html"): #our dynamic content
... | compatibleone/accords-platform | paprocci/test/to-cosacs/httpserver.py | Python | apache-2.0 | 1,434 |
__author__ = 'Pyboy'
# Module for interact with GUI
# This module must be able to interact with the database and retrieve its content to GUI
import sqlite3 as s
import random
from tkinter import messagebox
def rand_number(table):
"""This function is for pick a random number for select a random element in t... | pywill/promesario | manager.py | Python | gpl-3.0 | 1,526 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.template import loader, Context
from nuages.core import serializers
from nuages.utils import get_matching_mime_types
from nuages.http import NotAcceptableError
HTTP_ERROR_FORMATS = ['application/json', 'application/xml', 'text/html',
... | mohamedattahri/Nuages | nuages/core/formatters.py | Python | bsd-3-clause | 2,225 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.text
~~~~~~~~~~~~~~~~~~~~
Lexers for non-source code file types.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
import re
from bisect import bisect
... | davy39/eric | ThirdParty/Pygments/pygments/lexers/text.py | Python | gpl-3.0 | 67,421 |
# Authors: Travis Oliphant, Matthew Brett
"""
Base classes for MATLAB file stream reading.
MATLAB is a registered trademark of the Mathworks inc.
"""
import operator
import functools
import numpy as np
from scipy._lib import doccer
from . import _byteordercodes as boc
__all__ = [
'MatFileReader', 'MatReadError... | ilayn/scipy | scipy/io/matlab/_miobase.py | Python | bsd-3-clause | 12,881 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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 op... | pculture/unisubs | apps/videos/templatetags/subtitles_tags.py | Python | agpl-3.0 | 3,375 |
#!/usr/bin/env python
import sys
import os
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| desec-io/desec-stack | api/manage.py | Python | mit | 248 |
#!/usr/bin/env python
import os
import sys
import argparse
sys.path.append('../scripts/labtainer-student/bin')
import InspectLocalReg
import InspectRemoteReg
import VersionInfo
import labutils
import subprocess
'''
Retag all labtainer images to include their base image id, and include the base
image name in a label.
''... | thomashaw/SecGen | modules/utilities/unix/labtainers/files/Labtainers-master/distrib/retag_all.py | Python | gpl-3.0 | 2,608 |
"""
Author: Lasse Regin Nielsen
"""
from __future__ import division, print_function
import os
import numpy as np
import random as rnd
filepath = os.path.dirname(os.path.abspath(__file__))
class SVM():
"""
Simple implementation of a Support Vector Machine using the
Sequential Minimal Optimizati... | roscoche/pyflowcontrol | SVM.py | Python | gpl-3.0 | 3,656 |
import sys
import socket
import struct
import time
from thread import start_new_thread
from time import sleep
num_send = 0
num_recv = 0
def get_ip_address():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
address = (get_ip_address(), 31500)
d... | FinalTheory/wireless-network-reproduction | scripts/show_delay.py | Python | bsd-3-clause | 1,319 |
#!/usr/bin/env python
import sys
import vcf
MAX_COORD = 18588
def read_truth_set(fn):
truthset = set()
for ln in open(fn):
cols = ln.rstrip().split("\t")
pos = int(cols[0])
# if pos > MAX_COORD: continue
truthset.add(int(cols[0]))
return truthset
def read_vcf(fn):
vcfset = set()
vcfinfo = {}
vcf_reade... | zibraproject/zika-pipeline | scripts/intersection_vcf.py | Python | mit | 1,065 |
# -*- coding: utf-8 -*-
#
# Copyright 2012 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 hope that it will be useful, but
# W... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/ubuntu-sso-client/ubuntu_sso/main/glib.py | Python | mit | 2,110 |
try:
from . import generic as g
except BaseException:
import generic as g
import numpy as np
class CameraTests(g.unittest.TestCase):
def test_K(self):
resolution = (320, 240)
fov = (60, 40)
camera = g.trimesh.scene.Camera(
resolution=resolution,
fov=fov)
... | mikedh/trimesh | tests/test_camera.py | Python | mit | 4,406 |
#!/usr/bin/env python
""" Based on the original C++ code referenced below """
"""***************************************************************************
* FastMatchTemplate.cpp
*
*
* Copyright 2010 Tristen Georgiou
* tristen_georgiou@hotmail.com
***********************************************... | dan-git/outdoor_bot | vision/nodes/fast_template.py | Python | bsd-2-clause | 15,724 |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 30 11:15:21 2016
@author: RCGlade
"""
#Cubic hillslope flux component
from landlab import Component
import numpy as np
from landlab import INACTIVE_LINK, CLOSED_BOUNDARY
class CubicNonLinearDiffuser(Component):
"""
hillslope evolution using a cubic formul... | Carralex/landlab | landlab/components/cubic_nonlinear_hillslope_flux/cubic_nonlinear_hillslope_flux.py | Python | mit | 9,498 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2010 TUBITAK/UEKAE
#
# 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.
#
# ... | hknyldz/pisitools | pisilinux-python/pisilinux/filelock.py | Python | gpl-3.0 | 1,258 |
# Volatility
#
# Authors:
# Mike Auty <mike.auty@gmail.com>
#
# This file is part of Volatility.
#
# Volatility 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 op... | Cisco-Talos/pyrebox | volatility/volatility/plugins/connections.py | Python | gpl-2.0 | 3,953 |
#
# Copyright (c) 2011 Daniel Truemper truemped@googlemail.com
#
# logsink.py 03-Feb-2011
#
# 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
#
# ... | retresco/Spyder | src/spyder/logsink.py | Python | apache-2.0 | 2,623 |
# pyOCD debugger
# Copyright (c) 2006-2013 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | mbedmicro/pyOCD | pyocd/target/builtin/target_RTL8195AM.py | Python | apache-2.0 | 1,241 |
from datetime import datetime as dt
# 装饰器-测试函数运行时间
def time_calcuate(func):
def inner(*args, **kwargs):
start = dt.now()
ret = func(*args, **kwargs)
delta = dt.now() - start
print('elapsed time:' , delta.microseconds)
return ret
return inner
"""
@time_calcuate
def... | jinzekid/codehub | python/code_snippet/高级编程/装饰器-测试函数运行时间.py | Python | gpl-3.0 | 418 |
# =============================================================================
#
# Copyright (c) 2016, Cisco Systems
# All rights reserved.
#
# # Author: Klaudiusz Staniek
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met... | anushreejangid/csm-ut | csmpe/plugins/base.py | Python | bsd-2-clause | 3,610 |
import unittest
import pymysql
_mysql = pymysql
from pymysql.constants import FIELD_TYPE
from pymysql.tests import base
class TestDBAPISet(unittest.TestCase):
def test_set_equality(self):
self.assertTrue(pymysql.STRING == pymysql.STRING)
def test_set_inequality(self):
self.assertTrue(pymysql... | shivekkhurana/learning | python/scripts/fb/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py | Python | mit | 2,834 |
#!/usr/bin/python
# -*- coding: utf8 -*-
from report_aeroo.ctt_objects import ctt_currency
class ltl(ctt_currency):
def _init_currency(self):
self.language = u'en_US'
self.code = u'LTL'
self.fractions = 100
self.cur_singular = u' Lithuanian litas'
self.cur_plural = u' Lithu... | odoousers2014/LibrERP | report_aeroo/ctt_languages/en_US/currencies/ltl.py | Python | agpl-3.0 | 557 |
"""
Porticus plugins for DjangoCMS
"""
__version__ = "0.6.0"
| emencia/cmsplugin-porticus | cmsplugin_porticus/__init__.py | Python | mit | 61 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'new_lib_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_newLibDialog(object):
def setupUi(self, newLibDialog):
... | grapesmoker/pdf-library | new_lib_dialog.py | Python | mit | 3,004 |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 2, s, t 5.1, s, q"
tags = "Waves3D"
import cocos
from cocos.director imp... | Alwnikrotikz/los-cocos | test/test_waves3d.py | Python | bsd-3-clause | 1,052 |
"""!
@package mapdisp_window.py
@brief Map display canvas - buffered window.
Classes:
- MapWindow
- BufferedWindow
(C) 2006-2011 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
@author Martin Landa <l... | AsherBond/MondocosmOS | grass_trunk/gui/wxpython/gui_modules/mapdisp_window.py | Python | agpl-3.0 | 69,583 |
import numpy as np
import logging
import os
from tqdm import tqdm
import parmap
import torch
import torch.multiprocessing as mp
from sklearn.decomposition import PCA
from scipy.signal import argrelmin
#from numba import jit
from yass.util import absolute_path_to_asset
from yass.empty import empty
from yass.geometry i... | paninski-lab/yass | src/yass/cluster/util.py | Python | apache-2.0 | 31,810 |
#!/usr/bin/env python
import os
import optparse
import sys
import re
from pip.exceptions import InstallationError, CommandError, PipError
from pip.log import logger
from pip.util import get_installed_distributions, get_prog
from pip.vcs import git, mercurial, subversion, bazaar # noqa
from pip.baseparser import Conf... | Ivoz/pip | pip/__init__.py | Python | mit | 8,141 |
"""Eval python code with global namespace of a python source file."""
# Copyright (C) 2002 John Goerzen
# <jgoerzen@complete.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... | william-ml-leslie/offlineimap | offlineimap/localeval.py | Python | gpl-2.0 | 1,515 |
#!/usr/bin/env python
""" ros2opencv.py - Version 0.2 2011-11-09
A ROS-to-OpenCV node that uses cv_bridge to map a ROS image topic and optionally a ROS
depth image topic to the equivalent OpenCV image stream(s).
Includes variables and helper functions to store detection and tracking information and d... | openrobotics/openrobotics_thunderbot | pi_vision/ros2opencv/src/ros2opencv.py | Python | mit | 13,724 |
from __future__ import division
import platform
import pytest
import time
import unittest2
from uuid import uuid4
from pykafka import KafkaClient
from pykafka.common import OffsetType
from pykafka.exceptions import MessageSizeTooLarge, ProducerQueueFullError
from pykafka.partitioners import hashing_partitioner
from p... | wikimedia/operations-debs-python-pykafka | tests/pykafka/test_producer.py | Python | apache-2.0 | 11,877 |
# -*- coding: utf-8 -*-
import sys, os
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Insert Mathdeck's path into the system so we can use autodoc module
sys.path.insert(0, os.path.abspath('..'))
# Add any Sphinx extension module names here, as strings. They can be
# e... | patrickspencer/mathdeck | docs/conf.py | Python | apache-2.0 | 7,409 |
# Copyright 2016 Capital One Services, 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 agreed to in... | RyanWolfe/cloud-custodian | c7n/resources/__init__.py | Python | apache-2.0 | 1,884 |
import datetime
import numpy as np
import matplotlib.pyplot as plt
def readLog(fname="workdays.csv",onlyAfter=datetime.datetime(year=2017,month=1,day=1)):
"""return a list of [stamp, project] elements."""
with open(fname) as f:
raw=f.read().split("\n")
efforts=[] #date,nickname
for lin... | swharden/SWHLab | swhlab/tools/project log/analyze.py | Python | mit | 1,548 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the iPOPO @Bind/Update/UnbindField decorators.
:author: Thomas Calmant
"""
# Tests
from tests.ipopo import install_bundle, install_ipopo
# Pelix
from pelix.framework import FrameworkFactory
# Standard library
try:
import unittest2 as unittest
excep... | isandlaTech/cohorte-3rdparty | pelix/src/test/python/tests/ipopo/test_field_callbacks.py | Python | apache-2.0 | 6,606 |
import dobby
class Graze(dobby.App):
def startup(self):
main_container = dobby.Container()
main_password = dobby.PasswordInput(placeholder="Password")
main_container.add(main_password)
main_container.constrain(main_password.TOP == main_container.TOP + 5)
main_cont... | gabrielcsapo/dobby | dobby/examples/passwordinput.py | Python | bsd-3-clause | 606 |
# -*- coding: utf-8 -*-
#
import os
import subprocess
import datetime
from celery import shared_task
from celery.utils.log import get_task_logger
from django.utils import timezone
from django.core.files.storage import default_storage
from common.utils import get_log_keep_day
from ops.celery.decorator import (
re... | jumpserver/jumpserver | apps/terminal/tasks.py | Python | gpl-3.0 | 3,442 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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... | nop33/indico | indico/modules/events/sessions/models/legacy_mapping.py | Python | gpl-3.0 | 3,530 |
#
# Copyright (c) 2013 The Linux Foundation. All rights reserved.
#
import sys
import struct
def create_header(base, size):
"""Returns a packed MBN header image with the specified base and size.
@arg base: integer, specifies the image load address in RAM
@arg size: integer, specifies the size of the imag... | SVoxel/R9000 | git_home/u-boot.git/tools/mkheader.py | Python | gpl-2.0 | 2,753 |
import datetime
import functools
import logging
import tarfile
import time
import flask
import simplejson as json
import checksums
import mirroring
import storage
import toolkit
from .app import app
from .app import cfg
import layers
import storage.local
store = storage.load()
logger = logging.getLogger(__name__)
... | hpcloud/docker-registry | registry/images.py | Python | apache-2.0 | 15,622 |
"""Support for (EMEA/EU-based) Honeywell TCC climate systems.
Such systems include evohome, Round Thermostat, and others.
"""
from __future__ import annotations
from datetime import datetime as dt, timedelta
import logging
import re
from typing import Any
import aiohttp.client_exceptions
import evohomeasync
import e... | kennedyshead/home-assistant | homeassistant/components/evohome/__init__.py | Python | apache-2.0 | 25,207 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: mango
@contact: w4n9@sina.com
@create: 16/7/4
hail hydra!
pip install threadpool
源码中有提供一个示例
"""
__author__ = "mango"
__version__ = "0.1"
import threadpool
import time
import traceback
def callback_func():
pass
def exc_callback(excinfo):
errorst... | w4n9H/PythonSkillTree | Distributed/ProcessThread/LocalThreadPool.py | Python | apache-2.0 | 807 |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | cc1-cloud/cc1 | src/ec2/wsgi.py | Python | apache-2.0 | 774 |
from itertools import combinations_with_replacement
from string import ascii_uppercase, ascii_lowercase, ascii_letters
from re import finditer
class Generator(object):
"""
This class is a items' generator for use to brute force exploit
"""
def __init__(self):
"""Initialize the generator a... | DaniLabs/rexploit | rexploit/lib/misc/generator.py | Python | gpl-3.0 | 4,828 |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0])
_CSP = "script-src * 'unsafe-... | BruceDai/web-testing-service | wts/tests/csp/csp_script-src_asterisk.py | Python | bsd-3-clause | 3,002 |
import mxnet as mx
def batchnorm(net,
gamma=None,
beta=None,
moving_mean=None,
moving_var=None,
eps=0.001,
momentum=0.9,
fix_gamma=False,
use_global_stats=False,
output_mean_var=False,
... | samsungsds-rnd/deepspeech.mxnet | layer/batchnorm.py | Python | apache-2.0 | 1,436 |
# proxy module
from traitsui.wx.themed_cell_renderer import *
| enthought/etsproxy | enthought/traits/ui/wx/themed_cell_renderer.py | Python | bsd-3-clause | 62 |
from openbci.offline_analysis.obci_signal_processing.tags import smart_tag_definition
from openbci.offline_analysis.obci_signal_processing import smart_tags_manager
from offline_analysis.erp import erp_avg
import sys, os, os.path, random
import scipy
START_SEC_OFFSET = -0.1
DURATION = 0.6
TARGET_DEF = smart_tag_defini... | BrainTech/openbci | obci/analysis/p300/p300_train_prepare_train_set.py | Python | gpl-3.0 | 12,890 |
import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i, h2o_exec as h2e, h2o_jobs
print "overlap the parse (not the putfile) of the next one, with the exec of the last one"
print ""
print "Was getting a failure trying to write lock iris2_1.hex during the exec for iri... | rowhit/h2o-2 | py/testdir_single_jvm/notest_exec2_fast_locks_overlap.py | Python | apache-2.0 | 3,316 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pyappstore
----------------------------------
Tests for `pyappstore` module.
"""
import unittest
from pyappstore import pyappstore
class TestPyappstore(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_... | jaingaurav/PyAppStore | tests/test_pyappstore.py | Python | isc | 428 |
from werkzeug.datastructures import CallbackDict
from flask.sessions import SessionInterface, SessionMixin
from itsdangerous import URLSafeTimedSerializer, BadSignature
class ItsDangerousSession(CallbackDict, SessionMixin):
def __init__(self, initial=None):
def on_update(self):
self.modified ... | hacsoc/kraller | kraller/itsdangerous_session.py | Python | bsd-2-clause | 1,752 |
# -*- coding: UTF-8 -*-
from flask import session, request, redirect, url_for, flash
from flask.ext.babel import gettext
from flask_oauth import OAuth
from ..config import config
from ..log import mkLogger
logger = mkLogger("web.oauth")
oauth = OAuth()
twitter = oauth.remote_app('twitter',
base_url='https://ap... | bfontaine/Teebr | teebr/web/oauth.py | Python | mit | 1,393 |
from bead.archive import Archive
from bead.tech.fs import read_file, write_file
from bead.test import TestCase
from . import test_fixtures as fixtures
class Test_xmeta(TestCase, fixtures.RobotAndBeads):
def test_meta_attributes_are_available_without_reading_the_archive(
self, robot, bead_with_inputs, be... | krisztianfekete/lib | bead_cli/test_xmeta.py | Python | unlicense | 1,160 |
"""
NSSwitchConf - file ``/etc/nsswitch.conf``
==========================================
"""
from insights import LegacyItemAccess, Parser, parser
from insights.parsers import get_active_lines
from insights.specs import Specs
@parser(Specs.nsswitch_conf)
class NSSwitchConf(Parser, LegacyItemAccess):
"""
Re... | RedHatInsights/insights-core | insights/parsers/nsswitch_conf.py | Python | apache-2.0 | 2,055 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.website.utils import find_first_image
from frappe.utils import cstr
import re
def execute():
item_details = frappe._dict()
... | ebukoz/thrive | erpnext/patches/v5_0/update_item_desc_in_invoice.py | Python | gpl-3.0 | 1,677 |
"""
.. module:: logger
:synopsis: Output which sends events to the standard logging output
.. moduleauthor:: Colin Alston <colin@imcol.in>
"""
from twisted.python import log
from duct.objects import Output
class Logger(Output):
"""Logger output
**Configuration arguments:**
:param logfile: Logfile (... | ducted/duct | duct/outputs/logger.py | Python | mit | 928 |
import _plotly_utils.basevalidators
class SelectedpointsValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="selectedpoints", parent_name="ohlc", **kwargs):
super(SelectedpointsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/ohlc/_selectedpoints.py | Python | mit | 411 |
# -*- coding: utf-8 -*-
#
# mete0r.recipe.stow : a buildout recipe to stow/unstow generated files
# Copyright (C) 2015 mete0r <mete0r@sarangbang.or.kr>
#
# 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 F... | mete0r/recipe.stow | mete0r_recipe_stow/tests/__init__.py | Python | agpl-3.0 | 835 |
#
# 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 us... | sureshthalamati/spark | examples/src/main/python/mllib/kmeans.py | Python | apache-2.0 | 1,552 |
# _*_ coding: utf-8 _*_
import os
try:
from cStringIO import StringIO # python 2
except ImportError:
from io import StringIO # python 3
from collections import OrderedDict
import unittest
from tornado.escape import to_unicode
from tortik.util import make_qs, update_url, real_ip
from tortik.util.xml_etree im... | glibin/tortik | tortik_tests/util_test.py | Python | mit | 7,001 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '... | jhawkesworth/ansible | lib/ansible/modules/system/setup.py | Python | gpl-3.0 | 8,021 |
# Copyright (c) 2010-2012 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 or agre... | williamthegrey/swift | test/unit/container/test_sync.py | Python | apache-2.0 | 49,828 |
import _plotly_utils.basevalidators
class HoverinfosrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="hoverinfosrc", parent_name="volume", **kwargs):
super(HoverinfosrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... | plotly/python-api | packages/python/plotly/plotly/validators/volume/_hoverinfosrc.py | Python | mit | 452 |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy
from django.views.generic import CreateView
from django.views.generic import DeleteView
from django.views.generic import ListView
from django.views.generic import UpdateView
fr... | diegoduncan21/subastas | subastas_repo/personas/views.py | Python | bsd-3-clause | 2,612 |
"""Typing helpers."""
from __future__ import annotations
from typing import TYPE_CHECKING
from beancount.core.data import Entries
from beancount.core.display_context import DisplayContext
if TYPE_CHECKING:
from typing import TypedDict
from fava.helpers import BeancountError
class BeancountOptions(Type... | beancount/fava | src/fava/util/typing.py | Python | mit | 878 |
import numpy as np
from pySDC.core.Errors import TransferError
from pySDC.core.SpaceTransfer import space_transfer
from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh
class dedalus_field_transfer(space_transfer):
"""
Custon base_transfer class, implements Transfer.py
This implement... | Parallel-in-Time/pySDC | pySDC/playgrounds/deprecated/Dedalus/TransferDedalusFields.py | Python | bsd-2-clause | 3,368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.