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 |
|---|---|---|---|---|---|---|
import os
from pvfactors.geometry.timeseries import TsPointCoords, TsLineCoords
from pvfactors.geometry.pvrow import TsPVRow
from pvfactors.geometry.pvground import TsGround, TsGroundElement
import pandas as pd
import numpy as np
from pvfactors.geometry.pvrow import PVRow
from pvfactors.geometry.base import \
BaseS... | SunPower/pvfactors | pvfactors/tests/test_geometry/test_timeseries.py | Python | bsd-3-clause | 13,582 | 0 |
#
# (c) 2020 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | azaghal/ansible | test/units/plugins/connection/test_local.py | Python | gpl-3.0 | 1,355 | 0.001476 |
#!/usr/bin/python
# _*_ coding: utf-8 _*_
import zlib
s = b'witch which has which witches wrist watch'
print len(s)
t = zlib.compress(s)
print len(t)
print t
print zlib.decompress(t)
print zlib.crc32(s)
| louistin/thinkstation | a_byte_of_python/unit_15_standard_library/compress_test.py | Python | mit | 207 | 0 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... | CalthorpeAnalytics/urbanfootprint | footprint/main/management/commands/create_datadump.py | Python | gpl-3.0 | 4,014 | 0.005232 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | rahulunair/nova | nova/api/openstack/compute/limits.py | Python | apache-2.0 | 3,590 | 0 |
"""Config flow for OpenWeatherMap."""
from pyowm import OWM
from pyowm.exceptions.api_call_error import APICallError
from pyowm.exceptions.api_response_error import UnauthorizedError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_API_KEY,
CONF_LATITUDE,... | GenericStudent/home-assistant | homeassistant/components/openweathermap/config_flow.py | Python | apache-2.0 | 4,415 | 0.00068 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/aio/operations/_network_interfaces_operations.py | Python | mit | 64,200 | 0.005109 |
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2016 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# Entry-type module for the 16-bit x86 reset code for U-Boot
#
from binman.entry import Entry
from binman.etype.blob import Entry_blob
class Entry_x86_reset16(Entry_blob):
"""x86 16-bit reset code fo... | Digilent/u-boot-digilent | tools/binman/etype/x86_reset16.py | Python | gpl-2.0 | 1,018 | 0.000982 |
import logging
import os
import datetime
import six
import humanfriendly
from pathlib import Path
from django.db import models
from django.utils.html import format_html
from django.utils.encoding import uri_to_iri
from django.core.management import call_command
from django.utils.safestring import mark_safe
from django.... | xahhy/Django-vod | vodmanagement/models.py | Python | lgpl-3.0 | 14,356 | 0.002854 |
# coding=utf-8
"""Request handler for authentication."""
from __future__ import unicode_literals
import logging
import random
import string
import time
from builtins import range
import jwt
from medusa import app, helpers, notifiers
from medusa.logger.adapters.style import BraceAdapter
from medusa.server.api.v2.base... | pymedusa/SickRage | medusa/server/api/v2/auth.py | Python | gpl-3.0 | 2,962 | 0.001013 |
#!/usr/bin/python
# This file is part of tcollector.
# Copyright (C) 2010 The tcollector Authors.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (a... | optimizely/tcollector | tcollector.py | Python | lgpl-3.0 | 53,880 | 0.001188 |
#!/usr/bin/env python
import numpy as np
import os
import shutil
import mss
import matplotlib
matplotlib.use('TkAgg')
from datetime import datetime
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg as FigCanvas
from PIL import ImageTk, Image
import sys
PY3_OR_LATER... | kevinhughes27/TensorKart | record.py | Python | mit | 6,952 | 0.008631 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | seankelly/buildbot | master/buildbot/scripts/trycmd.py | Python | gpl-2.0 | 903 | 0 |
from hypothesis import given
from ppb_vector import Vector
from utils import floats, vectors
@given(x=floats(), y=floats())
def test_class_member_access(x: float, y: float):
v = Vector(x, y)
assert v.x == x
assert v.y == y
@given(v=vectors())
def test_index_access(v: Vector):
assert v[0] == v.x
... | ppb/ppb-vector | tests/test_member_access.py | Python | artistic-2.0 | 444 | 0 |
"""
Copyright (C) 2010 David Fong and Michael Saunders
LSMR uses an iterative method.
07 Jun 2010: Documentation updated
03 Jun 2010: First release version in Python
David Chin-lung Fong clfong@stanford.edu
Institute for Computational and Mathematical Engineering
Stanford University
Michael Saunders ... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/sparse/linalg/isolve/lsmr.py | Python | mit | 15,126 | 0.000463 |
from datetime import datetime
from django.core.files import storage
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
class DummyStorage(storage.Storage):
"""
A storage class that does implement modified_time() but raises
NotImplementedError when calling
"""
def _save(self, n... | lecaoquochung/ddnb.django | tests/staticfiles_tests/storage.py | Python | bsd-3-clause | 660 | 0 |
import json
import urllib2
from isodate.isodatetime import parse_datetime
from isodate.isoerror import ISO8601Error
from django.conf import settings
from util import validate_uuid, convert_to_dict, get_agent_ifp
from Authorization import auth
from StatementValidator import StatementValidator
from ..models import Sta... | diagonalwalnut/Experience | lrs/util/req_validate.py | Python | apache-2.0 | 32,206 | 0.006334 |
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... | avsm/xen-unstable | tools/python/xen/xend/XendConstants.py | Python | gpl-2.0 | 3,953 | 0.012396 |
# Copyright 2013 Ken Pepple <ken@pepple.info>
#
# 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
#
# U... | slashk/prowl.alfredworkflow | prowl_alfred.py | Python | apache-2.0 | 1,835 | 0.00545 |
# Copyright(c)2015 NTT corp. 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 app... | Vaidyanath/tempest | tempest/api/object_storage/test_container_sync_middleware.py | Python | apache-2.0 | 1,985 | 0 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from .formatting import ConditionalFormatting
from .rule import Rule
| saukrIppl/seahub | thirdpart/openpyxl-2.3.0-py2.7.egg/openpyxl/formatting/__init__.py | Python | apache-2.0 | 144 | 0 |
import json
import time
import pytest
from anchore_engine.auth.common import (
get_creds_by_registry,
get_docker_registry_userpw,
registry_record_matches,
)
_test_username = "tonystark"
_test_password = "potts"
_test_registry_meta = {
"authorizationToken": "{}:{}".format(_test_username, _test_passwor... | anchore/anchore-engine | tests/unit/anchore_engine/auth/test_common.py | Python | apache-2.0 | 3,612 | 0.001661 |
#!/usr/bin/env python3
"""
sumton.py : compute the sum of 0 through N
Copyright (C) Simon D. Levy 2016
This file is part of ISCPP.
ISCPP 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... | simondlevy/ISCPP | Chapter08/sumton.py | Python | gpl-3.0 | 926 | 0.006479 |
#!/usr/bin/env python2
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica 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, ... | sevein/archivematica | src/MCPClient/lib/clientScripts/generateDIPFromAIPGenerateDIP.py | Python | agpl-3.0 | 2,681 | 0.002611 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import json
import frappe
from frappe import _, throw
from frappe.desk.form.assign_to import clear, close_all_assignments
from frappe.model.mapper imp... | ESS-LLP/erpnext | erpnext/projects/doctype/task/task.py | Python | gpl-3.0 | 12,175 | 0.026201 |
#!/usr/bin/env python
# encoding: utf-8
"""
Show how to use `dur` and `delay` parameters of play() and out()
methods to sequence events over time.
"""
from pyo import *
import random
s = Server(duplex=0).boot()
num = 70
freqs = [random.uniform(100, 1000) for i in range(num)]
start1 = [i * 0.5 for i in range(num)]
fa... | belangeo/pyo | pyo/examples/sequencing/01_starttime_duration.py | Python | lgpl-3.0 | 1,118 | 0.002683 |
# -*- coding: utf-8 -*-
from Headset import Headset
import logging
import time
puerto = 'COM3'
headset = Headset(logging.INFO)
try:
headset.connect(puerto, 115200)
except Exception, e:
raise e
print "Is conected? " + str(headset.isConnected())
print "-----------------------------------------"
headset.startR... | emotrix/Emotrix | emotrix/HeadsetTester.py | Python | bsd-2-clause | 529 | 0 |
import sublime
import sublime_plugin
import re
import os
import datetime
TMLP_DIR = 'templates'
KEY_SYNTAX = 'syntax'
KEY_FILE_EXT = 'extension'
IS_GTE_ST3 = int(sublime.version()) >= 3000
PACKAGE_NAME = 'new-file-pro'
PACKAGES_PATH = sublime.packages_path()
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
cla... | KevinHoo/new-file-pro | commands/NewFileBase.py | Python | gpl-3.0 | 3,250 | 0.029231 |
#!/usr/bin/env python
"""A QR Move SCU application.
For sending Query/Retrieve (QR) C-MOVE requests to a QR Move SCP.
"""
import argparse
import sys
from pynetdicom import (
AE,
evt,
QueryRetrievePresentationContexts,
AllStoragePresentationContexts,
)
from pynetdicom.apps.common import setup_logging,... | scaramallion/pynetdicom | pynetdicom/apps/movescu/movescu.py | Python | mit | 11,001 | 0.000364 |
from sys import exit
from random import randint
def death():
quips = ["You died. You kinda suck at this.",
"Your mom would be proud. If she were smarter.",
"Such a luser.",
"I have a small puppy that's better at this."]
print quips[randint(0,len(quips)-1)]
exit(1)
def princess_lives_here():
print "Y... | veratulips/OMOOC2py | _src/exCodesHardWay/ex41.py | Python | mit | 4,337 | 0.027669 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py | Python | apache-2.0 | 37,342 | 0.001767 |
# -*- coding: utf-8 -*-
{
'name': 'Import OFX Bank Statement',
'category': 'Banking addons',
'version': '8.0.1.0.1',
'license': 'AGPL-3',
'author': 'OpenERP SA,'
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/bank-statement-import',
'depends': [
... | acsone/bank-statement-import | account_bank_statement_import_ofx/__openerp__.py | Python | agpl-3.0 | 534 | 0 |
from __future__ import absolute_import, division, print_function
import pygtk
pygtk.require('2.0')
import gtk, gobject, cairo
import time
import sys
import imp
import os
from bcam.loader_dxf import DXFLoader
from bcam.loader_excellon import ExcellonLoader
from bcam.tool_operation import TOResult
from bcam.tool_op_dri... | snegovick/bcam | bcam/events.py | Python | gpl-3.0 | 31,621 | 0.004744 |
from zope.interface import Interface, Attribute
from zope import schema
from uwosh.emergency.client.config import mf as _
class IUWOshEmergencyClientLayer(Interface):
"""Marker interface that defines a browser layer
""" | uwosh/uwosh.emergency.client | uwosh/emergency/client/interfaces.py | Python | gpl-2.0 | 228 | 0.008772 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | airbnb/kafka | tests/kafkatest/services/monitor/jmx.py | Python | apache-2.0 | 5,768 | 0.003814 |
# -*- coding: utf-8 -*-
#
# textract documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 4 11:09:09 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | shobhitmittal/textract | docs/conf.py | Python | mit | 8,694 | 0.005866 |
import random
class ImageQueryParser:
def __init__(self):
pass
def parse(self, query_string):
tab = query_string.split(" ")
last = tab[-1].lower()
is_random = False
index = 0
if last.startswith("-"):
if last == "-r":
is_random = True... | mamaddeveloper/teleadmin | tools/imageQueryParser.py | Python | mit | 1,079 | 0 |
class Parameter(object):
def __init__(self, name):
self.name = name
class Vehicle(object):
def __init__(self, name, path):
self.name = name
self.path = path
self.params = []
class Library(object):
def __init__(self, name):
self.name = name
self.params = [... | gcrisis/ardupilot | Tools/autotest/param_metadata/param.py | Python | gpl-3.0 | 5,433 | 0.024664 |
# coding=utf-8
HOSTNAME = 'localhost'
DATABASE = 'r'
USERNAME = 'web'
PASSWORD = 'web'
DB_URI = 'mysql://{}:{}@{}/{}'.format(
USERNAME, PASSWORD, HOSTNAME, DATABASE)
| dongweiming/web_develop | chapter3/section4/consts.py | Python | gpl-3.0 | 170 | 0 |
# Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
import logging
from django.core import urlresolvers
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext, loader
from django.utils import simplejs... | django-wodnas/django-tinymce | tinymce/views.py | Python | mit | 4,440 | 0.001802 |
'''
mode | desc
r 또는 rt | 텍스트 모드로 읽기
w 또는 wt | 텍스트 모드로 쓰기
a 또는 at | 텍스트 모드로 파일 마지막에 추가하기
rb | 바이너리 모드로 읽기
wb | 바이너리 모드로 쓰기
ab | 바이너리 모드로 파일 마지막에 추가하기
'''
f = open("./py200_sample.txt", "w")
f.write("abcd")
f.close()
r = open("./py200_sample.txt", "r")
print("-" * 60)
... | JaeGyu/PythonEx_1 | p200_048.py | Python | mit | 497 | 0 |
# Copyright 2019 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... | karllessard/tensorflow | tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/structured_output.py | Python | apache-2.0 | 5,614 | 0.015497 |
import unittest
from series import slices
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
class SeriesTest(unittest.TestCase):
def test_slices_of_one_from_one(self):
self.assertEqual(slices("1", 1), ["1"])
def test_slices_of_one_from_two(self):
self.assertEqual(s... | TGITS/programming-workouts | exercism/python/series/series_test.py | Python | mit | 1,747 | 0.000572 |
# (c) 2016, Matt Davis <mdavis@ansible.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
import time
from datetime import datetime, timedelta
from ansible.errors import AnsibleErro... | photoninger/ansible | lib/ansible/plugins/action/win_reboot.py | Python | gpl-3.0 | 8,292 | 0.0041 |
# Created By: Virgil Dupras
# Created On: 2006/01/29
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-... | mahmutf/dupeguru | core/engine.py | Python | gpl-3.0 | 18,745 | 0.002401 |
#!/usr/bin/env python
# encoding: utf-8
"""
Copyright (c) 2010 The Echo Nest. All rights reserved.
Created by Tyler Williams on 2010-09-01
# 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; eithe... | alex/pyechonest | examples/try_new_things.py | Python | bsd-3-clause | 6,593 | 0.005764 |
# -*- coding: utf-8 -*-
def main():
startApplication("sasview")
clickTab(waitForObject(":FittingWidgetUI.tabFitting_QTabWidget_2"), "Resolution")
test.compare(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").currentIndex, 0)
test.compare(str(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox"... | SasView/sasview | src/sas/qtgui/UnitTesting/SquishTestSuites/suite_sasview_qt/tst_Resolution/test.py | Python | bsd-3-clause | 3,434 | 0.009027 |
from __future__ import absolute_import, division
import time
import os
try:
unicode
except NameError:
unicode = str
from . import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked
class SQLiteLockFile(LockBase):
"Demonstrate SQL-based locking."
testdb = None
def __init__(self, path, t... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/pip/_vendor/lockfile/sqlitelockfile.py | Python | apache-2.0 | 5,540 | 0.000722 |
#!/usr/bin/python
import json
import sys
import data_processing as dp
from mython import NumpyToListEncoder
from subprocess import check_output
from imp import reload
reload(dp)
# Neat way of calling:
# find . -name '*_metadata.json' > rootlist
# python gen_json.py $(< rootlist) &> gen_json.out
files = sys.argv[1:]... | bbusemeyer/busempyer | drivers/gen_json.py | Python | gpl-2.0 | 653 | 0.018377 |
import numpy as np
class lemketableau:
def __init__(self,M,q,maxIter = 100):
n = len(q)
self.T = np.hstack((np.eye(n),-M,-np.ones((n,1)),q.reshape((n,1))))
self.n = n
self.wPos = np.arange(n)
self.zPos = np.arange(n,2*n)
self.W = 0
self.Z = 1
self.Y =... | AndyLamperski/lemkelcp | lemkelcp/lemkelcp.py | Python | mit | 5,431 | 0.02228 |
import logging
#Config
MYSQL_HOST = '127.0.0.1'
MYSQL_PORT = 3306
MYSQL_USER = 'root'
MYSQL_PASS = 'oppzk'
MYSQL_DB = 'SSMM'
MANAGE_PASS = 'passwd'
#if you want manage in other server you should set this value to global ip
MANAGE_BIND_IP = '127.0.0.1'
#make sure this port is idle
MANAGE_PORT = 10001
PANEL_VERSION = ... | niubileme/shadowsocks-manyuser | shadowsocks/config.py | Python | apache-2.0 | 805 | 0.016149 |
#!/usr/bin/env python
import sys
# import particle restart
sys.path.append('../../src/utils')
import particle_restart as pr
# read in particle restart file
if len(sys.argv) > 1:
p = pr.Particle(sys.argv[1])
else:
p = pr.Particle('particle_12_842.binary')
# set up output string
outstr = ''
# write out pro... | shenqicang/openmc | tests/test_particle_restart_eigval/results.py | Python | mit | 1,055 | 0.008531 |
__version__ = '$Id$'
from Acquisition import aq_inner
from Products.Five.browser import BrowserView
from Products.CMFCore.utils import getToolByName
from DateTime import DateTime
class LastZorionagurrak(BrowserView):
def getLastZorionagurrak(self, num=5):
context = aq_inner(self.context)
today ... | codesyntax/Products.zorionagurra | Products/zorionagurra/browser/portlet.py | Python | gpl-2.0 | 1,398 | 0.004292 |
import unittest
import os
import hiframe
import hipubiface_test_basic_plugin._hiframe
MY_ABSOLUTE_PATH = os.path.abspath(__file__)
MY_ABSOLUTE_PARENT = os.path.dirname(MY_ABSOLUTE_PATH)
HIPUBIFACE_PATH = os.path.dirname(os.path.dirname(os.path.dirname(MY_ABSOLUTE_PARENT)))
HIPUBIFACE_SRC_PATH = HIPUBIFACE_PATH+"/src"... | luzi82/HiSocial | HiPubIface/test/000_basic/src/hipubiface_test_basic.py | Python | gpl-3.0 | 4,370 | 0.019908 |
#!/usr/bin/env python
import os
import sys
import argparse
import traceback
sys.path.insert(1, os.path.join(os.path.dirname(__file__), os.pardir))
from toollib.group import Group,UnsortedInputGrouper
import scipy.stats as ss
class KSGroup(Group):
def __init__(self, tup):
super(KSGroup, self).__init__(tup)... | scoky/pytools | curve/ks_test.py | Python | mit | 2,158 | 0.008341 |
from django.db import models
from django.template.defaultfilters import slugify
from datetime import datetime
from redactor.fields import RedactorField
from management.post_tweet import post_tweet
### News
####################################################################################################
cla... | morelab/labman_ud | labman_ud/entities/news/models.py | Python | gpl-3.0 | 3,999 | 0.003251 |
from PIL import Image
import stripe
import datetime
from django.shortcuts import render, redirect
from django.views.generic import TemplateView, View, FormView
from django.core.urlresolvers import reverse_lazy, reverse
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_dec... | ZzCalvinzZ/picturepay | picture/views.py | Python | mit | 5,543 | 0.027242 |
import startbot, stats, os, re, random, sys
import utils
MARKOV_LENGTH = 2
#majority of the code taken from https://github.com/hrs/markov-sentence-generator
#changes made: allowed it to hook up from the text gotten directly from messages
#changed it to be encompassed in a class structure. Made minor changes to make ... | crc5464/groupme-bot | src/markov.py | Python | gpl-3.0 | 6,551 | 0.003817 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2018-12-04 15:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('anagrafica', '0049_auto_20181028_1639')... | CroceRossaItaliana/jorvik | survey/migrations/0001_initial.py | Python | gpl-3.0 | 2,602 | 0.003459 |
#-*- coding: utf-8 -*-
import unittest
from top.WordTableModel import WordTableModel
class WordTableModelTestsTestCase(unittest.TestCase):
def setUp(self):
self.model = WordTableModel()
self.model.load("dotestow.pkl")
def testLoading(self):
assert len(self.model.words) == 5, "incorre... | michaupl/wordtester | src/tests/WordTableModelTests.py | Python | apache-2.0 | 2,079 | 0.005291 |
#!/usr/bin/env python2
# Print out the 2^n possibilities of a word with the length n
import unittest
from itertools import product, permutations
def word_variations(s):
try:
if not len(s): return
lower, upper = s.lower(), s.upper()
except:
return
# Since number strings won't produ... | mikar/projects | various/word_possibilities.py | Python | mit | 1,021 | 0.007835 |
import unittest
from collections import deque
import datetime
import sys
import os
import StringIO
from south import exceptions
from south.migration import migrate_app
from south.migration.base import all_migrations, Migration, Migrations
from south.migration.utils import depends, dfs, flatten, get_app_label
from sou... | defcube/django-south | south/tests/logic.py | Python | apache-2.0 | 32,253 | 0.002263 |
from __future__ import unicode_literals
from django.contrib.syndication import views
from django.utils import feedgenerator
from django.utils.timezone import get_fixed_timezone
from .models import Article, Entry
class TestRss2Feed(views.Feed):
title = 'My blog'
description = 'A more thorough desc... | yephper/django | tests/syndication_tests/feeds.py | Python | bsd-3-clause | 6,128 | 0.000653 |
"""A simple interface for executing bytecodes over a Bluetooth serial port.
From the lms2012 source code documentation:
Beside running user programs the VM is able to execute direct commands from
the Communication Module. In fact direct commands are small programs that
consist of regular byte codes and they are execu... | inductivekickback/ev3 | ev3/direct_command.py | Python | mit | 72,705 | 0.011361 |
from vectores_oo import Vector
x = input('vector U componente X= ')
y = input('vector U componente X= ')
U = Vector(x,y)
m = input('vector V magnitud= ')
a = input('vector V angulo= ')
V = Vector(m=m, a=a)
E = input('Escalar= ')
print "U=%s" % U
print "V=%s" % V
print 'UxE=%s' % U.x_escalar(E)
print 'VxE=%s'... | rgarcia-herrera/vectores | vectores.py | Python | gpl-3.0 | 446 | 0.006726 |
# -*- coding: utf-8 -*-
import os
import pygame
from pygame.locals import *
class Sprite(pygame.sprite.Sprite):
def __init__(self,SpriteName):
pygame.sprite.Sprite.__init__(self)
self.Name = SpriteName
self.rect = 0
self.image = 0
def getRect(self):
return self.rect
... | vtungn/HackaPanzer | Sprite.py | Python | mit | 2,212 | 0.007233 |
from validx import Dict, List
from .protos import DataObject
from .palette import Palette
from .utils.parser import BinaryParser
from .utils.validator import UInt8
from .utils.types import Remappings, Remapping
class PaletteMapping(DataObject):
__slots__ = (
"colors",
"remaps",
)
schema ... | omf2097/pyomftools | omftools/pyshadowdive/palette_mapping.py | Python | mit | 1,335 | 0 |
from pyroute2.netlink import nlmsg
class errmsg(nlmsg):
'''
Custom message type
Error ersatz-message
'''
fields = (('code', 'i'), )
| craneworks/python-pyroute2 | pyroute2/netlink/rtnl/errmsg.py | Python | apache-2.0 | 155 | 0 |
import src
class Chemical(src.items.Item):
type = "Chemical"
def __init__(self):
super().__init__(display=src.canvas.displayChars.fireCrystals)
self.name = "chemical"
self.composition = b"cccccggggg"
def apply(self, character):
import hashlib
results = []
... | MarxMustermann/OfMiceAndMechs | src/itemFolder/obsolete/chemical.py | Python | gpl-3.0 | 1,571 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
ZMQ example using python3's asyncio
Bitcoin should be started with the command line argument... | nlgcoin/guldencoin-official | contrib/zmq/zmq_sub3.4.py | Python | mit | 3,273 | 0.001833 |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# 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 appli... | mdurrant-b3/acos-client | acos_client/v21/slb/template/persistence.py | Python | apache-2.0 | 2,180 | 0 |
# tsuserver3, an Attorney Online server
#
# Copyright (C) 2016 argoneus <argoneuscze@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | AttorneyOnlineVidya/tsuserver3 | server/ban_manager.py | Python | agpl-3.0 | 2,392 | 0.001254 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... | Willem23/mbed | workspace_tools/export/__init__.py | Python | apache-2.0 | 4,602 | 0.004129 |
# -*- coding: UTF-8 -*-
# Copyright 2015-2021 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
"""
Defines a set of user roles and fills
:class:`lino.modlib.users.choicelists.UserTypes`.
This is used as the :attr:`user_types_module
<lino.core.site.Site.user_types_module>` ... | lino-framework/noi | lino_noi/lib/noi/user_types.py | Python | bsd-2-clause | 3,072 | 0.002604 |
##
# Copyright 2009-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | ULHPC/modules | easybuild/easybuild-easyblocks/easybuild/easyblocks/s/suitesparse.py | Python | mit | 7,433 | 0.002422 |
from django.urls import path
from . import views
urlpatterns = [
path('start-ga', views.StartGA.as_view()),
path('stop-ga', views.StopGA.as_view()),
path('check-ga', views.CheckGA.as_view()),
]
| seakers/daphne_brain | example_problem/explorer/urls.py | Python | mit | 208 | 0 |
#!/usr/bin/env python
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
import datetime
import sys
import unittest
import test_env
test_env.setup_test_env()
# From components/third_party/
import webtes... | madecoste/swarming | appengine/isolate/tests/stats_test.py | Python | apache-2.0 | 3,366 | 0.006239 |
"""
Updated on 19.12.2009
@author: alen, pinda
"""
from django.conf import settings
from django.conf.urls.defaults import *
from socialregistration.utils import OpenID, OAuthClient, OAuthTwitter, OAuthLinkedin
urlpatterns = patterns('',
url('^setup/$', 'socialregistration.views.setup',
name='socialregi... | nvbn/django-socialregistration | socialregistration/urls.py | Python | mit | 4,237 | 0.006372 |
# -*- coding: utf-8 -*-
"""
兼容Python版本
"""
import sys
is_py2 = (sys.version_info[0] == 2)
is_py3 = (sys.version_info[0] == 3)
is_py33 = (sys.version_info[0] == 3 and sys.version_info[1] == 3)
try:
import simplejson as json
except (ImportError, SyntaxError):
import json
if is_py2:
from urllib import q... | aliyun/aliyun-oss-python-sdk | oss2/compat.py | Python | mit | 2,283 | 0.001447 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import re
# Todo this mapping REALLY needs a non-hardcoded home
_slave_type = {
"bld-linux64-ec2": [
re.com... | Callek/build-relengapi-slaveloan | relengapi/blueprints/slaveloan/slave_mappings.py | Python | mpl-2.0 | 3,163 | 0 |
# Time: O(n)
# Space: O(1)
# Suppose you have a long flowerbed in which some of the plots are planted and some are not.
# However, flowers cannot be planted in adjacent plots - they would compete for water
# and both would die.
#
# Given a flowerbed (represented as an array containing 0 and 1,
# where 0 means empty a... | yiwen-luo/LeetCode | Python/can-place-flowers.py | Python | mit | 1,263 | 0.003167 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Customize Form is a Single DocType used to mask the Property Setter
Thus providing a better UI from user perspective
"""
import webnotes
from webnotes.utils import cstr
class DocType:
... | gangadhar-kadam/sapphite_lib | core/doctype/customize_form/customize_form.py | Python | mit | 8,959 | 0.041299 |
"""
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | googleinterns/adversarial-0th-order-optimization | discretezoo/loss/semantic_similarity.py | Python | apache-2.0 | 9,072 | 0.003307 |
# Copyright 2015 Mirantis, 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 ... | torgartor21/solar | solar/solar/system_log/tasks.py | Python | apache-2.0 | 1,007 | 0 |
import numpy
import data_generator
class Generator:
def __init__(self):
self.combinations = data_generator.generateAllByteToAx25DataCombinations()
self.frameSeparatorOne = data_generator.calculateNewAx25DataFromOldImpl(1, 0, 0x7E, False)
self.frameSeparatorZero = data_generator.calculateNew... | far-far-away-science/hab-v2 | software/ax25-utils/code_generation_v2.py | Python | gpl-3.0 | 2,693 | 0.004827 |
from documents.models import Document
from categories.models import Category
import os
def move_doc(doc_id, cat_id):
doc = Document.objects.get(pk=int(doc_id))
old_cat = doc.refer_category
new_cat = Category.objects.get(pk=int(cat_id))
for p in doc.pages.all():
cmd = "mv " + p.get_absolute_pat... | Foxugly/MyTaxAccountant | scripts/move_document.py | Python | agpl-3.0 | 504 | 0.003968 |
from hypothesis import given
from hypothesis.strategies import binary
from msgpack import packb
from mitmproxy.contentviews import msgpack
from . import full_eval
def msgpack_encode(content):
return packb(content, use_bin_type=True)
def test_parse_msgpack():
assert msgpack.parse_msgpack(msgpack_encode({"f... | mitmproxy/mitmproxy | test/mitmproxy/contentviews/test_msgpack.py | Python | mit | 1,392 | 0.000718 |
# vim: set ts=2 expandtab:
'''
Module: read.py
Desc: unpack data from binary files
Author: John O'Neil
Email: oneil.john@gmail.com
DATE: Thursday, March 13th 2014
'''
import struct
DEBUG = False
class EOFError(Exception):
""" Custom exception raised when we read to EOF
"""
pass
def split_buffer(length, buf):
... | johnoneil/arib | arib/read.py | Python | apache-2.0 | 2,368 | 0.022382 |
# Copyright 2013 NEC Corporation
# 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 ... | queria/my-tempest | tempest/api/compute/admin/test_simple_tenant_usage_negative.py | Python | apache-2.0 | 2,656 | 0 |
"""Tests the surveytools.footprint module."""
import numpy as np
from surveytools.footprint import VphasFootprint, VphasOffset
def test_vphas_offset_coordinates():
"""Test the offset pattern, which is expected to equal
ra -0, dec +0 arcsec for the "a" pointing;
ra -588, dec +660 arcsec for the "b" pointin... | barentsen/surveytools | surveytools/tests/test_footprint.py | Python | mit | 2,130 | 0.002817 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of agora-tools.
# Copyright (C) 2014-2016 Agora Voting SL <agora@agoravoting.com>
# agora-tools 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... | agoravoting/agora-tools | import_election_csv.py | Python | agpl-3.0 | 18,685 | 0.005516 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jmesteve/saas3 | openerp/addons/base_report_designer/base_report_designer.py | Python | agpl-3.0 | 3,471 | 0.007491 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
from datetime import datetime
from werkzeug import cached_property
from flask import url_for, Markup
from flask.ext.sqlalchemy import BaseQuery
from flask.ext.principal import Permission, UserNeed, Denial
from newsmeme.extensions import db
from newsmeme.h... | sixu05202004/newsmeme | newsmeme/newsmeme/models/posts.py | Python | bsd-3-clause | 10,746 | 0.000279 |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/policies/random_py_policy_test.py | Python | apache-2.0 | 5,609 | 0.001783 |
# coding: utf-8
"""
regex.tests
~~~~~~~~~~~
:copyright: 2012 by Daniel Neuhäuser
:license: BSD, see LICENSE.rst
"""
from unittest import TestCase
from itertools import izip
from contextlib import contextmanager
from regex.parser import (
parse, ParserError, Parser, DEFAULT_ALPHABET, DEFAULT_LANGUA... | DasIch/editor | prototypes/regex/tests.py | Python | bsd-3-clause | 17,417 | 0.000172 |
# -*- coding: utf-8 -*-
#
# This file is part of GetTor, a Tor Browser distribution system.
#
# :authors: Israel Leiva <ilv@riseup.net>
# see also AUTHORS file
#
# :copyright: (c) 2008-2014, The Tor Project, Inc.
# (c) 2014, Israel Leiva
#
# :license: This is Free Software. See LICENSE for lic... | ilv/gettor | gettor/smtp.py | Python | bsd-3-clause | 17,953 | 0.000501 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Fast R-CNN config system.
This file specifies default config option... | yuxng/Deep_ISM | ISM/lib/ism/config.py | Python | mit | 10,824 | 0.001663 |
"""
Parse spotify URLs
"""
from __future__ import unicode_literals
import re
import logging
log = logging.getLogger('spotify')
def handle_privmsg(bot, user, channel, args):
"""Grab Spotify URLs from the messages and handle them"""
m = re.match(".*(http:\/\/open.spotify.com\/|spotify:)(?P<item>album|artist|... | EArmour/pyfibot | pyfibot/modules/module_spotify.py | Python | bsd-3-clause | 1,777 | 0.005627 |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib import comments
from django.utils.encoding import smart_unicode
register = template.Library()
class BaseCommentNode(t... | hunch/hunch-gift-app | django/contrib/comments/templatetags/comments.py | Python | mit | 12,178 | 0.006077 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from novel import serial, utils
BASE_URL = 'http://www.quanben5.com/n/{}/xiaoshuo.html'
class Quanben5(serial.SerialNovel):
def __init__(self, tid):
super().__init__(utils.base_to_url(BASE_URL, tid), '#content',
intro_sel='.descript... | wangjiezhe/FetchNovels | novel/sources/quanben5.py | Python | gpl-3.0 | 612 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.