text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# b... | nvoron23/python-weka-wrapper | tests/wekatests/plottests/experiments.py | Python | gpl-3.0 | 2,900 | 0.002759 |
from .. import Provider as CurrencyProvider
class Provider(CurrencyProvider):
# Format: (code, name)
currencies = (
("AED", "Dírham de los Emiratos Árabes Unidos"),
("AFN", "Afghaní"),
("ALL", "Lek albanés"),
("AMD", "Dram armenio"),
("ANG", "Florín de las Antillas Hola... | joke2k/faker | faker/providers/currency/es_ES/__init__.py | Python | mit | 6,293 | 0.000161 |
import pytest
from formulaic.parser.types import Factor, Term
class TestTerm:
@pytest.fixture
def term1(self):
return Term([Factor("c"), Factor("b")])
@pytest.fixture
def term2(self):
return Term([Factor("c"), Factor("d")])
@pytest.fixture
def term3(self):
return Ter... | matthewwardrop/formulaic | tests/parser/types/test_term.py | Python | mit | 1,044 | 0 |
#!/usr/bin/env python
# Copyright 2015-2016 Yelp 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 ... | somic/paasta | paasta_tools/cleanup_chronos_jobs.py | Python | apache-2.0 | 8,610 | 0.002323 |
#!/usr/bin/env python
import io
import os
import sys
from efesto.Version import version
from setuptools import find_packages, setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('python setup.py bdist_wheel upload')
sys.exit()
readme = io.open('README.md', 'r', enco... | getefesto/efesto | setup.py | Python | gpl-3.0 | 1,723 | 0 |
"""SCons.Tool.sunf90
Tool-specific initialization for sunf90, the Sun Studio F90 compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20... | michalliu/OpenWrt-Firefly-Libraries | staging_dir/host/lib/scons-2.3.1/SCons/Tool/sunf90.py | Python | gpl-2.0 | 2,198 | 0.003185 |
#!/usr/bin/env python3
'''Conway's Game of Life in a Curses Terminal Window
'''
import curses
import time
from GameOfLife import NumpyWorld
from GameOfLife import Patterns
from curses import ( COLOR_BLACK, COLOR_BLUE, COLOR_CYAN,
COLOR_GREEN, COLOR_MAGENTA, COLOR_RED,
COLOR... | JnyJny/GameOfLife | contrib/NCGameOfLife.py | Python | mit | 5,897 | 0.010853 |
# 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.
"""RPC compatible subprocess-type module.
This module defined both a task-side process class as well as a controller-side
process wrapper for easier access ... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/testing/legion/process.py | Python | mit | 8,760 | 0.010046 |
import fnmatch
import glob
import os
import re
import sys
from functools import total_ordering
from itertools import dropwhile
import django
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.temp import NamedTemporaryFile
from django.core.management.base im... | edmorley/django | django/core/management/commands/makemessages.py | Python | bsd-3-clause | 27,345 | 0.001682 |
# -*- coding: utf-8 -*-
import os
from AppiumLibrary.keywords import *
from AppiumLibrary.version import VERSION
__version__ = VERSION
class AppiumLibrary(
_LoggingKeywords,
_RunOnFailureKeywords,
_ElementKeywords,
_ScreenshotKeywords,
_ApplicationManagementKeywords,
_WaitingK... | jollychang/robotframework-appiumlibrary | AppiumLibrary/__init__.py | Python | apache-2.0 | 5,544 | 0.004509 |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysnmp/license.html
#
from pysnmp import error
class MetaObserver(object):
"""This is a simple facility for exposing internal SNMP Engine
working details to pysnmp applicat... | etingof/pysnmp | pysnmp/entity/observer.py | Python | bsd-2-clause | 2,572 | 0.000778 |
'''
Problem:
Find the kth smallest element in a bst without using static/global variables.
'''
def find(node, k, items=0):
# Base case.
if not node:
return items, None
# Decode the node.
left, value, right = node
# Check left.
index, result = find(left, k, items)
# Exit early.
... | RishiRamraj/interviews | solutions/algorithms/bst.py | Python | mit | 667 | 0.004498 |
# -*- coding: utf-8 -*-
# Copyright(C) 2017 Juliette Fourcot
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of th... | laurentb/weboob | modules/ensap/__init__.py | Python | lgpl-3.0 | 885 | 0 |
# coding: utf-8
# # Simple Character-level Language Model using vanilla RNN
# 2017-04-21 jkang
# Python3.5
# TensorFlow1.0.1
#
# - <p style="color:red">Different window sizes were applied</p> e.g. n_window = 3 (three-character window)
# - input: 'hello_world_good_morning_see_you_hello_grea'
# ... | jaekookang/useful_bits | Machine_Learning/RNN_LSTM/predict_character/rnn_char_windowing.py | Python | mit | 7,262 | 0.006063 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# bitk3 documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | daviortega/bitk3 | docs/conf.py | Python | mit | 8,433 | 0.005336 |
from django.conf.urls import include, url
from demo.views import common
from demo.views.visadirect import fundstransfer, mvisa, reports, watchlist
from demo.views.pav import pav
from demo.views.dcas import cardinquiry
from demo.views.merchantsearch import search
from demo.views.paai.fundstransferattinq.cardattributes.... | ppokrovsky/pyvdp | demo/demo/urls.py | Python | mit | 2,820 | 0.002837 |
import sys
if '' not in sys.path:
sys.path.append('')
import time
import unittest
from pyactors.logs import file_logger
from pyactors.exceptions import EmptyInboxException
from tests import ForkedGreActor as TestActor
from multiprocessing import Manager
class ForkedGreenletActorTest(unittest.TestCase):
de... | snakeego/pyactors | tests/test_forked_green_actors.py | Python | bsd-2-clause | 1,024 | 0.003906 |
from django import forms
from django_roa_client.models import RemotePage, RemotePageWithRelations
class TestForm(forms.Form):
test_field = forms.CharField()
remote_page = forms.ModelChoiceField(queryset=RemotePage.objects.all())
class RemotePageForm(forms.ModelForm):
class Meta:
model = RemotePag... | charles-vdulac/django-roa | examples/django_roa_client/forms.py | Python | bsd-3-clause | 432 | 0.002315 |
from datetime import datetime, timedelta
from django.core.files.storage import default_storage as storage
import olympia.core.logger
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.addons.models import Addon
from olympia.addons.tasks import delete_addons
from olympia.amo.utils imp... | mozilla/olympia | src/olympia/amo/cron.py | Python | bsd-3-clause | 3,247 | 0.000924 |
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (... | lbjay/cds-invenio | modules/websubmit/lib/functions/Check_Group.py | Python | gpl-2.0 | 2,200 | 0.010455 |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
"""
Classes and functions for layer 2 protocols.
"""
import os,struct,time
from scapy.base_classes import Net
from scapy... | kisel/trex-core | scripts/external_libs/scapy-2.3.1/python3/scapy/layers/l2.py | Python | apache-2.0 | 17,955 | 0.017154 |
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from googleapiclient.discovery import build
from google.oauth2 import service_account
class RealTimeReportingServer():
SCOPES = ['https://www.... | chromium/chromium | chrome/test/enterprise/e2e/connector/realtime_reporting_bce/reporting_server.py | Python | bsd-3-clause | 1,846 | 0.003792 |
import logging
import mapnik
import xml.etree.ElementTree as ET
import os
import subprocess
import tempfile
# Set up logging
logging.basicConfig(format="%(asctime)s|%(levelname)s|%(message)s", level=logging.INFO)
# Parameters
shpPath = "C:/Projects/BirthsAndPregnanciesMapping/data/2014-04-24/Zanzibar/Zanzibar.shp"
ep... | hishivshah/WorldPop | code/create_zanzibar_boundary_map.py | Python | mit | 1,981 | 0.002524 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the source package recipe view classes and templates."""
__metaclass__ = type
from mechanize import LinkNotFoundError
from storm.locals import Store
from testtools.ma... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py | Python | agpl-3.0 | 11,028 | 0.000091 |
#!/usr/bin/env python3
###############################################################################
# Copyright (c) Intel Corporation - All rights reserved. #
# This file is part of the LIBXSMM library. #
# ... | hfp/libxsmm | samples/deeplearning/tvm_cnnlayer/mb1_tuned_latest.py | Python | bsd-3-clause | 20,227 | 0.039996 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base... | tysonholub/twilio-python | twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py | Python | mit | 15,072 | 0.003715 |
#!/usr/bin/python
# coding=utf-8
from setuptools import setup, find_packages
setup(
name = "HEIGVD_TimetableParser",
version = "0.1",
packages = find_packages(),
install_requires = ['icalendar>=3.5', 'xlrd>=0.9.2'],
# metadata for upload to PyPI
author = "Leeroy Brun",
author_email = "lee... | leeroybrun/heigvd-timetable-parser | setup.py | Python | mit | 604 | 0.036484 |
import io
from rich.console import Console
from rich.measure import Measurement
from rich.styled import Styled
def test_styled():
styled_foo = Styled("foo", "on red")
console = Console(file=io.StringIO(), force_terminal=True, _environ={})
assert Measurement.get(console, console.options, styled_foo) == Me... | willmcgugan/rich | tests/test_styled.py | Python | mit | 471 | 0.002123 |
from __future__ import division #brings in Python 3.0 mixed type calculation rules
import logging
import numpy as np
import pandas as pd
class TerrplantFunctions(object):
"""
Function class for Stir.
"""
def __init__(self):
"""Class representing the functions for Sip"""
super(Terrplan... | puruckertom/ubertool | ubertool/terrplant/terrplant_functions.py | Python | unlicense | 20,304 | 0.006403 |
from setuptools import setup
version = '0.4'
setup(
name = 'django-cache-decorator',
packages = ['django_cache_decorator'],
license = 'MIT',
version = version,
description = 'Easily add caching to functions within a django project.',
long_description=open('README.md').read(),
author = 'Ric... | rchrd2/django-cache-decorator | setup.py | Python | mit | 596 | 0.041946 |
# -*- coding: utf-8 -*-
import os
import json
from sqlalchemy import and_, extract, func, desc
from datetime import datetime
from jinja2 import TemplateNotFound
from flask import Blueprint, render_template, send_from_directory, abort, request
from flask.ext.paginate import Pagination
from flask.ext import restful
fro... | LuizArmesto/gastos_abertos | gastosabertos/contratos/views.py | Python | agpl-3.0 | 13,828 | 0.005496 |
# Copyright (c) 2011 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file is part of the ASKAP software distribution.
#
# The ASKAP software distribution is free softwar... | ATNF/askapsdp | Code/Base/py-accessor/current/askap/accessors/__init__.py | Python | gpl-2.0 | 991 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-09 13:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0002_tablefield_allow_null'),
]
operations = [
migrations.AddField(
... | lealhugui/schema-analyser | app/server/api/migrations/0003_tablefield_inner_type.py | Python | mit | 467 | 0 |
# -*- coding: utf-8 -*-
from module.plugins.internal.XFSPAccount import XFSPAccount
class RyushareCom(XFSPAccount):
__name__ = "RyushareCom"
__version__ = "0.03"
__type__ = "account"
__description__ = """ryushare.com account plugin"""
__author_name__ = ("zoidberg", "trance4us")
__author_mail__... | chaosmaker/pyload | module/plugins/accounts/RyushareCom.py | Python | gpl-3.0 | 742 | 0.001348 |
from numpy import matrix
# integer Size; integer nPQ, Matrix G; Matrix B; Array U
def JacMat(Size, nPQ, G, B, U):
# Method Of Every Entry Of Jacbean Matrix
f = U.real
e = U.imag
JacMat = zeros(Size, Size)
def Hij(B, G, e, f):
return -B*e+Gf
def Nij(B, G, e, f):
retur... | bitmingw/hexomega | assets/HOJacMat.py | Python | mit | 2,566 | 0.011302 |
"""
WSGI config for batfinancas project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | rafaelnsantos/batfinancas | batfinancas/wsgi.py | Python | mit | 399 | 0 |
# -*- coding: utf-8 -*-
""" *==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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... | zrax/moul-scripts | Python/xPodBahroSymbol.py | Python | gpl-3.0 | 6,228 | 0.006744 |
#!/bin/env python
import npyscreen
class MainFm(npyscreen.Form):
def create(self):
self.mb = self.add(npyscreen.MonthBox,
use_datetime = True)
class TestApp(npyscreen.NPSAppManaged):
def onStart(self):
self.addForm("MAIN", MainFm)
if __name__ == "__main__":
A = TestA... | tescalada/npyscreen-restructure | tests/testMonthbox.py | Python | bsd-2-clause | 337 | 0.011869 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2010 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
#
# ... | sridevikoushik31/nova | nova/virt/xenapi/vmops.py | Python | apache-2.0 | 88,390 | 0.000645 |
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^$', 'recollect.views.home', name='home'),
url(r'^albums$', 'recollect.views.albums', name='albums'),
url(r'^album/(?P<album_slug>[A-z0-9-]+)$', 'recollect.views.album', name='album'),
)
| richbs/django-record-collector | recollect/urls.py | Python | bsd-3-clause | 275 | 0.007273 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Holoscópio Tecnologia
# Author: Luciana Fujii Pontello <luciana@holoscopio.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... | Geheimorganisation/sltv | sltv/ui/input/autoaudioinput.py | Python | gpl-2.0 | 1,172 | 0.000854 |
"""
Author: Eric J. Ma
License: MIT
A Python module that provides helper functions and variables for encoding amino
acid features in the protein interaction network. We encode features in order
to feed the data into the neural fingerprinting software later on.
"""
amino_acids = [
"A",
"B",
"C",
"D",
... | ericmjl/protein-interaction-network | proteingraph/features.py | Python | mit | 501 | 0 |
from abc import ABCMeta, abstractmethod
class NotificationSource():
"""
Abstract class for all notification sources.
"""
__metaclass__ = ABCMeta
@abstractmethod
def poll(self):
"""
Used to get a set of changes between data retrieved in this call and the last.
"""
... | DanNixon/Sakuya | pc_client/sakuyaclient/NotificationSource.py | Python | apache-2.0 | 562 | 0.001779 |
# -*- coding: utf-8 -*-
"""Example: Test for equality of coefficients across groups/regressions
Created on Sat Mar 27 22:36:51 2010
Author: josef-pktd
"""
import numpy as np
from scipy import stats
#from numpy.testing import assert_almost_equal
import scikits.statsmodels as sm
from scikits.statsmodels.sandbox.regres... | matthew-brett/draft-statsmodels | scikits/statsmodels/sandbox/examples/ex_onewaygls.py | Python | bsd-3-clause | 4,198 | 0.010005 |
# 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 import _
default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
<a style="color... | anandpdoshi/erpnext | erpnext/setup/install.py | Python | agpl-3.0 | 1,780 | 0.024719 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ve... | sparkslabs/kamaelia_ | Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Apps/JsonRPC/BDJsonRPC.py | Python | apache-2.0 | 35,300 | 0.013059 |
'''
笔记
for i in range(10):
#3次机会问一次
'''
age=22
c=0
while True:
if c<3:
cai=input("请输入要猜的年龄:")
if cai.isdigit(): #判断是否为整数
print("格式正确")
cai1=int(cai) #判断为整数把输入的变量变成int型
if cai1==age and c<3:
print("猜对了")
break
eli... | xiaoyongaa/ALL | python基础2周/17猜年龄游戏.py | Python | apache-2.0 | 1,545 | 0.027353 |
import numpy as np
from ctypes import (
CDLL,
POINTER,
ARRAY,
c_void_p,
c_int,
byref,
c_double,
c_char,
c_char_p,
create_string_buffer,
)
from numpy.ctypeslib import ndpointer
import sys, os
prefix = {"win32": "lib"}.get(sys.platform, "lib")
extension = {"darwin": ".dylib", "wi... | cbcoutinho/learn_dg | tests/helpers.py | Python | bsd-2-clause | 4,156 | 0.001444 |
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
# import frappe
import unittest
class TestCampaign(unittest.TestCase):
pass
| mhbu50/erpnext | erpnext/crm/doctype/campaign/test_campaign.py | Python | gpl-3.0 | 167 | 0.005988 |
"""Make sure that existing Koogeek LS1 support isn't broken."""
from datetime import timedelta
from unittest import mock
from aiohomekit.exceptions import AccessoryDisconnectedError, EncryptionError
from aiohomekit.testing import FakePairing
import pytest
from homeassistant.components.light import SUPPORT_BRIGHTNESS... | w1ll1am23/home-assistant | tests/components/homekit_controller/specific_devices/test_koogeek_ls1.py | Python | apache-2.0 | 3,555 | 0.000281 |
from itertools import product
from inspect import signature
import warnings
from textwrap import dedent
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from ._core import VectorPlotter, variable_type, categorical_order
from . import utils
from .utils import _check_argum... | mwaskom/seaborn | seaborn/axisgrid.py | Python | bsd-3-clause | 87,264 | 0.000562 |
# -*- coding: utf-8 -*-
# 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, ... | pmverdugo/fiware-validator | validator/tests/clients/test_chef_client.py | Python | apache-2.0 | 4,428 | 0.001807 |
import itertools
import random
from hb_res.explanation_source import sources_registry, ExplanationSource
__author__ = 'moskupols'
ALL_SOURCES = sources_registry.sources_registered()
ALL_SOURCES_NAMES_SET = frozenset(sources_registry.names_registered())
all_words_list = []
words_list_by_source_name = dict()
for s i... | hatbot-team/hatbot | explanator/_explanator.py | Python | mit | 2,930 | 0 |
class DestinationNotFoundException(Exception):
pass
class InvalidDateFormat(Exception):
pass | kapucko/bus-train-search | btsearch/exceptions.py | Python | apache-2.0 | 101 | 0.019802 |
# -*- 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):
# Adding field 'Face.district_id'
db.add_column(u'faces_face', 'district_... | RuralIndia/pari | pari/faces/migrations/0006_auto__add_field_face_district_id.py | Python | bsd-3-clause | 11,120 | 0.009083 |
import sys
import os
import re
def human_size_to_byte(number):
"""
Convert number of these units to bytes, ignore case:
b : 512
kB : 1000
K : 1024
mB : 1000*1000
m : 1024*1024
MB : 1000*1000
M : 1024*1024
GB : 1000*1000*1000
G : 1024*1024*1024
TB : 1000*... | iesugrace/pycmd | lib.py | Python | gpl-3.0 | 24,434 | 0.000941 |
# -*- coding: utf-8 -*-
"""
hydrogen
~~~~~~~~
Hydrogen is an extremely lightweight workflow enhancement tool for Python
web applications, providing bower/npm-like functionality for both pip and
bower packages.
:author: David Gidwani <david.gidwani@gmail.com>
:license: BSD, see LICENSE for ... | darvid/hydrogen | hydrogen.py | Python | bsd-2-clause | 26,677 | 0 |
# 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... | nburn42/tensorflow | tensorflow/contrib/autograph/converters/side_effect_guards.py | Python | apache-2.0 | 7,026 | 0.007543 |
import random
from sets import Set
class Network(object):
"""
Network class represents the whole graph that we read from the
data file. Since we store all the edges ONLY, the size of this
information is much smaller due to the graph sparsity (in general,
around 0.1% of links are connected)
... | wenzheli/python_new | com/uva/network.py | Python | gpl-3.0 | 17,149 | 0.012595 |
# -*- coding: utf-8 -*-
from django.db import models
from apps.postitulos.models.EstadoPostitulo import EstadoPostitulo
from apps.postitulos.models.TipoPostitulo import TipoPostitulo
from apps.postitulos.models.PostituloTipoNormativa import PostituloTipoNormativa
from apps.postitulos.models.CarreraPostitulo import Carr... | MERegistro/meregistro | meregistro/apps/postitulos/models/Postitulo.py | Python | bsd-3-clause | 2,464 | 0.007323 |
# -*- coding: utf-8 -*-
"""
debug.py - Functions to aid in debugging
Copyright 2010 Luke Campagnola
Distributed under MIT/X11 license. See license.txt for more information.
"""
from __future__ import print_function
import sys, traceback, time, gc, re, types, weakref, inspect, os, cProfile, threading
from . import p... | ArteliaTelemac/PostTelemac | PostTelemac/meshlayerlibs/pyqtgraph/debug.py | Python | gpl-3.0 | 41,232 | 0.00827 |
import datetime
import json
from classrank.database.wrapper import Query
"""add_to_database.py: adds courses from Grouch to the ClassRank DB."""
def add_to_database(grouch_output, db):
"""
Add courses from Grouch's output to a db.
Keyword arguments:
grouch_output -- the output of Grouch (the scrap... | classrank/ClassRank | classrank/grouch/grouch_util.py | Python | gpl-2.0 | 3,951 | 0.000253 |
# 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... | airbnb/airflow | airflow/providers/cncf/kubernetes/hooks/kubernetes.py | Python | apache-2.0 | 9,757 | 0.002152 |
"""
Handling signals of the `core` app
"""
from django.dispatch import receiver
from core import signals
from reader import actions
@receiver(signals.app_link_ready)
def app_link_ready(sender, **kwargs):
actions.create_app_link()
| signaldetect/messity | reader/receivers/core.py | Python | mit | 238 | 0 |
from setuptools import setup
setup(
name="agentarchives",
description="Clients to retrieve, add, and modify records from archival management systems",
url="https://github.com/artefactual-labs/agentarchives",
author="Artefactual Systems",
author_email="info@artefactual.com",
license="AGPL 3",
... | artefactual-labs/agentarchives | setup.py | Python | agpl-3.0 | 1,074 | 0.000931 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | lanpa/tensorboardX | tensorboardX/beholder/beholder.py | Python | mit | 8,355 | 0.000838 |
from .base import TestCase
import os
import shutil
import time
from django.conf import settings
import whisper
import gzip
from graphite.readers import WhisperReader, FetchInProgress, MultiReader, merge_with_cache
from graphite.wsgi import application # NOQA makes sure we have a working WSGI app
from graphite.node... | gwaldo/graphite-web | webapp/tests/test_readers_util.py | Python | apache-2.0 | 16,540 | 0.000665 |
# Copyright (c) 2012-2013 Rackspace Hosting
# 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
#
# Unles... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/cells/weights/ram_by_instance_type.py | Python | gpl-2.0 | 1,971 | 0 |
from django.conf import settings
from .func import (check_if_trusted,
get_from_X_FORWARDED_FOR as _get_from_xff,
get_from_X_REAL_IP)
trusted_list = (settings.REAL_IP_TRUSTED_LIST
if hasattr(settings, 'REAL_IP_TRUSTED_LIST')
else [])
def get_from_X_FO... | Daishi1223/py-http-realip | http_realip/middlewares.py | Python | mit | 1,364 | 0.002933 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | HBEE/odoo-addons | project_analytic_integration/__openerp__.py | Python | agpl-3.0 | 1,908 | 0.002096 |
# Script to request hosts with DOWN status and total hosts by accessing MK Livestatus
# Required field to be passed to this script from Splunk: n/a
import socket,string,sys,re,splunk.Intersplunk,mklivestatus
results = []
try:
results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults()
for r in ... | skywalka/splunk-for-nagios | bin/livehostsdownstatus.py | Python | gpl-3.0 | 1,840 | 0.044565 |
import pyspeckit
import os
from pyspeckit.spectrum.models import nh2d
import numpy as np
import astropy.units as u
if not os.path.exists('p-nh2d_spec.fits'):
import astropy.utils.data as aud
from astropy.io import fits
f = aud.download_file('https://github.com/pyspeckit/pyspeckit-example-files/raw/master/... | jpinedaf/pyspeckit | examples/example_pNH2D.py | Python | mit | 1,329 | 0.017306 |
#!/usr/bin/env python
import argparse
import os
import sqlite3
from Bio import SeqIO, SeqRecord, Seq
from Bio.Align.Applications import ClustalwCommandline
from Bio.Blast import NCBIXML
from Bio.Blast.Applications import NcbiblastnCommandline as bn
from Bio import AlignIO
AT_DB_FILE = 'AT.db'
BLAST_EXE = '~/opt/ncbi... | Serulab/Py4Bio | code/ch20/estimateintrons.py | Python | mit | 4,302 | 0.006044 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, modify, merge, publish... | rwl/PyCIM | CIM15/IEC61970/LoadModel/Season.py | Python | mit | 3,209 | 0.002805 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import argparse
import shutil
import urllib2
from contextlib import closing
from os.path import basename
import gzip
import tarfile
# argparse for information
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--directory", help="input dire... | Twinstar2/Python_Master_scripts | data_mining/extract_all_targz_in_dir.py | Python | mit | 2,292 | 0.004363 |
from multiprocessing import Process,Queue
import os
class TestMP:
def __init__(self,n):
self.n = n
@staticmethod
def worker(q):
"""worker function"""
# print('worker',*args)
# print("ppid= {} pid= {}".format(os.getppid(),os.getpid()))
q.put([1,'x',(os.getpid(),[])])
... | vleo/vleo-notebook | test_python/multiprocessing/test_multiprocessing.py | Python | gpl-3.0 | 811 | 0.014797 |
"""
Oracle database backend for Django.
Requires cx_Oracle: http://cx-oracle.sourceforge.net/
"""
from __future__ import unicode_literals
import datetime
import decimal
import os
import platform
import sys
import warnings
from django.conf import settings
from django.db import utils
from django.db.backends.base.base ... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/db/backends/oracle/base.py | Python | artistic-2.0 | 24,995 | 0.00164 |
"""Services for ScreenLogic integration."""
import logging
from screenlogicpy import ScreenLogicError
import voluptuous as vol
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv
from homeassi... | rohitranjan1991/home-assistant | homeassistant/components/screenlogic/services.py | Python | mit | 3,148 | 0.001906 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
from odoo.addons.http_routing.models.ir_http import url_for
class Website(models.Model):
_inherit = "website"
def get_suggested_controllers(self):
suggested_controllers = sup... | ddico/odoo | addons/website_event/models/website.py | Python | agpl-3.0 | 491 | 0.004073 |
from unittest import TestCase
from netcontrol.util import singleton
@singleton
class SingletonClass(object):
pass
@singleton
class SingletonClassWithAttributes(object):
@classmethod
def setup_attributes(cls):
cls.value = 1
class SingletonTest(TestCase):
def test_that_only_instance_is_crea... | drimer/NetControl | netcontrol/test/util/test_singleton.py | Python | gpl-2.0 | 593 | 0.001686 |
import re
from datetime import date
from calendar import monthrange, IllegalMonthError
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
# from - https://github.com/bryanchow/django-creditcard-fields
CREDIT_CARD_RE = r'^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][... | jumoconnect/openjumo | jumodjango/etc/credit_card_fields.py | Python | mit | 4,687 | 0.00256 |
#-*- coding: utf-8 -*-
# processes.py
# Module providing informations about processes
#
# Copyright (C) 2016 Jakub Kadlcik
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your... | FrostyX/tracer | tracer/resources/processes.py | Python | gpl-2.0 | 9,071 | 0.026127 |
#!/usr/bin/env python
#
# vim:syntax=python:sw=4:ts=4:expandtab
"""
test hasAttributes()
---------------------
>>> from guppy import hasAttributes
>>> class Foo(object):
... def __init__(self):
... self.a = 23
... self.b = 42
>>> hasAttributes('a')(Foo())
True... | xfire/guppy | test/doctest_assertions.py | Python | gpl-2.0 | 3,440 | 0 |
from tempfile import gettempdir
from os.path import join, dirname
import example_project
ADMINS = (
)
MANAGERS = ADMINS
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DISABLE_CACHE_TEMPLATE = DEBUG
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = join(gettempdir(), 'django_ratings_example_project.db')
TEST_DATABASE_NAME =join(ge... | ella/django-ratings | tests/example_project/settings/config.py | Python | bsd-3-clause | 1,465 | 0.004778 |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 22 14:18:45 2016
@author: Alex Kerr
Define functions that draw molecule objects.
"""
import copy
from itertools import cycle
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from .molecule import ... | ajkerr0/kappa | kappa/plot.py | Python | mit | 16,060 | 0.022167 |
from time import sleep
import math
__author__ = 'sergio'
## @package clitellum.endpoints.channels.reconnectiontimers
# Este paquete contiene las clases para los temporizadores de reconexion
#
## Metodo factoria que crea una instancia de un temporizador
# instantaneo
def CreateInstantTimer():
return InstantRecon... | petxo/clitellum | clitellum/endpoints/channels/reconnectiontimers.py | Python | gpl-3.0 | 3,471 | 0.007779 |
#!/usr/bin/env python
"""
=================================================
Draw a Quantile-Quantile Plot and Confidence Band
=================================================
This is an example of drawing a quantile-quantile plot with a confidence level
(CL) band.
"""
print __doc__
import ROOT
from rootpy.interactive... | qbuat/rootpy | examples/stats/plot_quantiles.py | Python | gpl-3.0 | 1,944 | 0.002058 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-PsExec',
'Author': ['@harmj0y'],
'Description': ('Executes a stager on remote hosts using PsExec type functionality.'),
'Background' : Tru... | thebarbershopper/Empire | lib/modules/lateral_movement/invoke_psexec.py | Python | bsd-3-clause | 5,198 | 0.012697 |
#!/usr/bin/env python3
'''
Copyright (c) 2016 The Hyve B.V.
This code is licensed under the GNU Affero General Public License (AGPL),
version 3, or (at your option) any later version.
'''
import unittest
import logging
import tempfile
import os
import shutil
import time
import difflib
from importer import validateDa... | mandawilson/cbioportal | core/src/test/scripts/system_tests_validate_data.py | Python | agpl-3.0 | 11,621 | 0.001807 |
'''Tests the RPC "calculator" example.'''
import unittest
import types
from pulsar import send
from pulsar.apps import rpc, http
from pulsar.apps.test import dont_run_with_thread
from .manage import server, Root, Calculator
class TestRpcOnThread(unittest.TestCase):
app_cfg = None
concurrency = 'thread'
... | nooperpudd/pulsar | examples/calculator/tests.py | Python | bsd-3-clause | 9,018 | 0.000887 |
"""Run all test cases.
"""
import sys
import os
import unittest
try:
# For Pythons w/distutils pybsddb
import bsddb3 as bsddb
except ImportError:
# For Python 2.3
import bsddb
if sys.version_info[0] >= 3 :
charset = "iso8859-1" # Full 8 bit
class logcursor_py3k(object) :
... | Jeff-Tian/mybnb | Python27/Lib/bsddb/test/test_all.py | Python | apache-2.0 | 19,765 | 0.011131 |
# -*- coding: utf-8 -*-
from distutils.core import setup
import os.path
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Library or Lesser General Public Lice... | huyx/icall | setup.py | Python | lgpl-3.0 | 1,026 | 0.024366 |
#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1beta1 import firestore_pb2
from google.firestore.v1be... | GoogleCloudPlatform/grpc-gcp-python | firestore/examples/end2end/src/Write.py | Python | apache-2.0 | 2,967 | 0.013482 |
from ..subpackage1 import module1g
def func1h():
print('1h')
module1g.func1g()
| autodefrost/sandbox | python/test_rel_import/package1/subpackage2/module1h.py | Python | apache-2.0 | 88 | 0.011364 |
# Copyright (c) 2005, California Institute of Technology
# 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, th... | astraw/PyUniversalLibrary | examples/ulai01.py | Python | bsd-3-clause | 1,869 | 0 |
#!/usr/bin/env python3
import os
import os.path
from nipype.interfaces.utility import IdentityInterface, Function
from nipype.interfaces.io import SelectFiles, DataSink, DataGrabber
from nipype.pipeline.engine import Workflow, Node, MapNode
from nipype.interfaces.minc import Resample, BigAverage, VolSymm
import argpars... | carlohamalainen/volgenmodel-nipype | new_data_to_atlas_space.py | Python | bsd-3-clause | 4,566 | 0 |
"""
Created on 26 Aug 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
from collections import OrderedDict
from enum import Enum
from scs_core.data.json import JSONReport
# --------------------------------------------------------------------------------------------------------------------
class... | south-coast-science/scs_core | src/scs_core/data/queue_report.py | Python | mit | 4,239 | 0.006841 |
#!/usr/bin/env python
import numpy as np
from scipy import special
from ..routines import median, mahalanobis, gamln, psi
from nose.tools import assert_true
from numpy.testing import assert_almost_equal, assert_equal, TestCase
class TestAll(TestCase):
def test_median(self):
x = np.random.rand(100)
... | arokem/nipy | nipy/labs/utils/tests/test_misc.py | Python | bsd-3-clause | 2,093 | 0.010511 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-05-25 20:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('anagrafica', '0046_delega_stato'),
]
operations = [
migrations.AlterIndexTogether(
... | CroceRossaItaliana/jorvik | anagrafica/migrations/0047_auto_20170525_2011.py | Python | gpl-3.0 | 865 | 0.001156 |
# coding: utf-8
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be use... | davivcgarcia/wttd-15 | eventex/core/tests/test_models_speaker_contact.py | Python | gpl-3.0 | 3,199 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.