code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
""" TODO: - Handle if file already exists """ import ctypes import io import os import struct from contextlib import contextmanager import ddt import mock from unittest2 import TestCase import tempfile from polypype import _MAX_C_FLOAT, _MAX_C_UINT32, PolyPype from polypype.exceptions import ( PolyPypeArgumen...
dan-f/polypype
tests/test_polypipe.py
Python
mit
5,061
import objc # Load IOBluetooth objc.loadBundle('IOBluetooth', globals(), bundle_path=objc.pathForFramework("IOBluetooth.framework")) # IOBluetooth CBCentralManager state CONSTS CBCentralManagerStateUnkown = 0 CBCentralManagerStateResetting = 1 CBCentralManagerStateUnsupported = 2 CBCentralManagerState...
brettchien/PyBLEWrapper
pyble/osx/IOBluetooth.py
Python
mit
2,261
#Functions and Functional Programming #La programacion funcional es un #paradigma en el que la programacion #se basa casi en su totalidad en funciones, def saludar(lang): def saludar_es(): print "Hola" def saludar_en(): print "Hi" def saludar_fr(): print "Salut" lang_func ...
Eduardogit/HackProjects
python/random-scripts/python course/clase5.py
Python
mit
505
from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * import couchbase import wizzat.kvtable __all__ = [ 'CBTable', ] class CBTable(wizzat.kvtable.KVTable): """ This is a micro-ORM for working with Couchbase. It attempts to work with CAS values a...
wizzat/wizzat.py
wizzat/cbtable.py
Python
mit
1,650
#!/usr/bin/env python3 """ MIT License Copyright (c) 2016 Steven P. Crain, SUNY Plattsburgh 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 ...
scrain777/MassivelyUnreliableSystems
Voting/Utilities/check.py
Python
mit
2,156
import django.forms as forms from django.core.exceptions import ValidationError from .models import TicketPurchase, Ticket, TicketType class TicketPurchaseForm(forms.ModelForm): class Meta: model = TicketPurchase fields = [ 'buyer_first_name', 'buyer_surname', 'buyer_email', ...
gdetrez/fscons-ticketshop
ticketshop/ticketapp/forms.py
Python
mit
3,715
from setuptools import setup setup( name='banter', version='0.2.0', author='Mark Drago', author_email='markdrago@gmail.com', url='http://github.com/markdrago/banter', download_url='http://pypi.python.org/pypi/banter', description='Create crucible code reviews from the command line', lic...
spookylukey/banter
setup.py
Python
mit
1,171
from csacompendium.locations.models import Precipitation from csacompendium.utils.pagination import APILimitOffsetPagination from csacompendium.utils.permissions import IsOwnerOrReadOnly from csacompendium.utils.viewsutils import DetailViewUpdateDelete, CreateAPIViewHook from rest_framework.filters import DjangoFilterB...
nkoech/csacompendium
csacompendium/locations/api/precipitation/precipitationviews.py
Python
mit
2,016
# adapted from https://gist.github.com/cliffano/9868180 import os import time import json from json import JSONEncoder def json_log(res, host): if type(res) == type(dict()): if 'verbose_override' not in res: res.update({"host": host}) combined_json = JSONEncoder().encode(res) print(combined_js...
petems/ansible-json
callback_plugins/json_logs.py
Python
mit
1,719
#!/usr/bin/env python3 # Copyright (c) 2016-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the SegWit changeover logic.""" from test_framework.test_framework import BitcoinTestFramework fr...
laudaa/bitcoin
test/functional/segwit.py
Python
mit
42,732
from pyvisdk.base.managed_object_types import ManagedObjectTypes from pyvisdk.base.base_entity import BaseEntity import logging ######################################## # Automatically generated, do not edit. ######################################## log = logging.getLogger(__name__) class VirtualDiskManager(BaseE...
xuru/pyvisdk
pyvisdk/mo/virtual_disk_manager.py
Python
mit
16,908
# # The Python Imaging Library. # $Id$ # # the Image class wrapper # # partial release history: # 1995-09-09 fl Created # 1996-03-11 fl PIL release 0.0 (proof of concept) # 1996-04-30 fl PIL release 0.1b1 # 1999-07-28 fl PIL release 1.0 final # 2000-06-07 fl PIL release 1.1 # 2000-10-20 fl PIL release 1.1.1...
isabernardes/Heriga
Herigaenv/lib/python2.7/site-packages/PIL/Image.py
Python
mit
95,395
__author__ = 'BryanAke@gmail.com' from unittest import TestCase from rest_framework_mongoengine.utils import PolymorphicChainMap from rest_framework_mongoengine.serializers import PolymorphicDocumentSerializer from test_models import Vehicle, Car, Truck, Mileage, FuelMileage ##tests for PolymorphicChainMap class Dumm...
BryanAke/django-rest-framework-mongoengine
rest_framework_mongoengine/tests/test_utils.py
Python
mit
975
# 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/v2018_12_01/operations/_connection_monitors_operations.py
Python
mit
42,196
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "unshorten.tests.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
bitmazk/django-unshorten
manage.py
Python
mit
259
from distutils.core import setup setup( name='standard_deviation', version='0.1dev', packages=['sd_py',], license='MIT', long_description=open('README.md').read(), )
jghenry/standard_deviation
setup.py
Python
mit
187
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.http import HttpResponse def index(request): return HttpResponse('hello, workd')
boldmanQ/blogsys
blogsys/testcase/views.py
Python
mit
199
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-20 14:32 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('learning_logs', '0001_initial'), ] operations = [ migrations.CreateModel( ...
romeubertho/USP-IntroPython
django/learning_log/learning_log/learning_logs/migrations/0002_teste.py
Python
mit
647
from ..plugin import StreamerBase class DirectStreamer(StreamerBase): plugin_name = 'direct' def __init__(self, item, allowed_extensions=None): self.item = item self.allowed_extensions = [x.lower() for x in allowed_extensions or []] def _find_best_item(self, item): best_size, bes...
JohnDoee/thomas
thomas/streamers/direct.py
Python
mit
1,265
# -*- coding: utf-8 -*- # # Misaka documentation build configuration file, created by # sphinx-quickstart on Sun Jul 12 11:37:42 2015. # # 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. # # Al...
hepochen/hoedown_misaka
docs/conf.py
Python
mit
9,639
#!/usr/bin/env python3 from auto.config import DIR, RV32_LINUX from auto.gnu_toolchain import GnuToolchain from auto.utils import cat, cd, path, shell import auto.pkg import os class LLVM(auto.pkg.Package): def _prepare(self): link = path(DIR.submodules, "llvm/tools/clang") if not os.path.exist...
OpenISA/riscv-sbt
scripts/auto/llvm.py
Python
mit
3,402
from django import forms from journeyman.projects.models import Project class RepositoryForm(forms.Form): name = forms.CharField( help_text='What\'s the name of your awesome project?') repository = forms.CharField( help_text='Please enter a valid repository url \ (e.g. git+git://github....
stephrdev/loetwerk
journeyman/projects/forms.py
Python
mit
1,763
# 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/Informative/InfWork/Request.py
Python
mit
5,609
from syzoj.models import JudgeState from syzoj import db db.create_all() all_judge = JudgeState.query.all() for item in all_judge: item.update_userac_info()
cdcq/jzyzj
syzoj/update_assistant/misc.py
Python
mit
163
import collections import sys from .parser import Parser from .item import Item class ItemList(object): items = [] def __init__(self, path=None): if path: self.path = path self.items = Parser.parse(path) def append(self, *args): for item in args: if i...
victorgama/todo
todo/itemlist.py
Python
mit
1,776
import sys def solve(l): numbers = l.split(',') row_hash = {} for num in numbers: count = row_hash.setdefault(num, 0) row_hash[num] = count + 1 if row_hash[num] > len(numbers) / 2: return num return None with open(sys.argv[1], 'r') as f: for line in f.readline...
systemsoverload/codeeval
easy/132_major_element/solution.py
Python
mit
359
from __future__ import division import cv2 import sys, os from pytube import YouTube import upload_video from pymongo import MongoClient client = MongoClient('mongodb://localhost:27017/') db = client.CaseyBot.urls face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') def cluster(data, maxgap): ...
shubh24/casey-compile
compile.py
Python
mit
3,001
""" Converts argparse parser actions into json "Build Specs" """ import argparse from argparse import ( _CountAction, _HelpAction, _StoreConstAction, _StoreFalseAction, _StoreTrueAction, ArgumentParser, _SubParsersAction) from collections import OrderedDict from functools import partial VALID_WIDGETS = (...
lrq3000/pyFileFixity
pyFileFixity/lib/gooey/python_bindings/argparse_to_json.py
Python
mit
5,242
from models import Likes def filterKey(key): return key.id() def showCount(post_key): like_obj = Likes.query(Likes.post == post_key).get() if like_obj: return like_obj.like_count else: return "0"
ghoshabhi/Multi-User-Blog
utility/filters.py
Python
mit
230
import numpy as np from util import resolve, genson_dumps, get_global_seed, assert_kwargs_consumed from internal_ops import GenSONOperand from internal_ops import GenSONFunction from internal_ops import registry import logging logging.basicConfig(level=logging.INFO) log = logging.getLogger(__name__) def register_fun...
davidcox/genson
genson/functions.py
Python
mit
8,655
""" Details of how the data model objects are mapped onto the relational database are encapsulated here. """ import logging log = logging.getLogger( __name__ ) import sys import datetime from galaxy.model import * from galaxy.model.orm import * from galaxy.model.orm.ext.assignmapper import * from galaxy.model.custom...
volpino/Yeps-EURAC
lib/galaxy/model/mapping.py
Python
mit
73,637
#!/usr/bin/env python3 import os os.environ['TF_CPP_MIN_LOG_LEVEL']='2' import numpy as np np.set_printoptions(threshold=np.nan) import tensorflow as tf import time # seeding for debug purposes --- dont forget to remove SEED = 12345 np.random.seed(SEED) tf.set_random_seed(SEED) def convolve_inner_layers(x, W, b): ...
michaelneuder/image_quality_analysis
bin/nets/old/pixel_diff_conv_net_automated.py
Python
mit
5,287
from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.shortcuts import redirect from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import ugettext as _ ...
bgroff/kala-app
django_kala/organizations/views/new_organization.py
Python
mit
1,353
n = 1 while n <= 100: if (n % 3 == 0 and n % 5 == 0): print "FizzBuzz" elif (n % 3 == 0): print "Fizz" elif (n % 5 == 0): print "Buzz" else: print n n += 1
CorySpitzer/FizzBuzz
everest/FizzBuzz.py
Python
mit
175
class Node: def __init__(self,val): self.value = val self.nextNode = None def getValue(self): return self.value def getNextNode(self): return self.nextNode def setValue(self,val): self.value = val def setNextNode(self,nxtNode): self.nextNode = n...
njanirudh/Python-DataStructures
linked_list.py
Python
mit
2,365
# copies.py - copy detection for Mercurial # # Copyright 2008 Matt Mackall <mpm@selenic.com> # # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. from node import nullid, nullrev from i18n import _ import util, heapq def _nonoverla...
carlgao/lenga
images/lenny64-peon/usr/share/python-support/mercurial-common/mercurial/copies.py
Python
mit
7,357
regex= '^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])[a-zA-Z0-9]{6,}$'
Orange9000/Codewars
Solutions/5kyu/5kyu_regex_password_validation.py
Python
mit
60
#!/usr/bin/env python -*- coding: utf-8 -*- import math import cPickle as pickle import numpy as np from sklearn.svm import SVR from sklearn.linear_model import BayesianRidge x = np.loadtxt('x.asiya.train')[:,np.newaxis] y = np.loadtxt('y.asiya.train') x_test = np.loadtxt('x.asiya.test')[:,np.newaxis] br = pickle...
alvations/USAAR-SemEval-2015
task02-USAAR-SHEFFIELD/modely.py
Python
mit
684
"""Search initial values of parameters in our simple neural network""" import math import random import numpy as np class SimpleNeuralNetwork(object): """Simple neural network""" def __init__(self): self.lamb = np.random.randn() # pylint: disable = no-member self.bias = np.random.randn() # p...
ZhongxingPeng/simple_neural_network
search_param.py
Python
mit
6,378
""" Useful and shared functions """ import os import math import numpy as np from scipy.interpolate import interp1d def chunks(l, size): """ Return same size chunks in a list """ return [l[i:i+size] for i in range(0, len(l), size)] def findLine(filename, s): """ Return first encountered line from a file w...
nelsyeung/half-metals-analysis
lib/nmod.py
Python
mit
5,429
#!/usr/bin/python #!/usr/bin/env python # # Jetduino Python Setup # # The Jetduino connects the Jetson and Grove sensors. You can learn more about the Jetduino here: http://www.NeuroRoboticTech.com/Projects/Jetduino # # Have a question about this example? Ask on the forums here: http://www.NeuroRoboticTech.com/Foru...
NeuroRoboticTech/Jetduino
Software/Python/setup.py
Python
mit
2,589
# -*- coding: utf-8 -*- # # metasci documentation build configuration file, created by # sphinx-quickstart on Sun Feb 7 22:29:49 2010. # # 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. # # All...
samuelshaner/openmc
docs/source/conf.py
Python
mit
7,909
#!/usr/bin/env python import psutil def main(): for proc in psutil.process_iter(): if any(name in proc.name() for name in ['start_producer', 'start_converter', 'start_online']) or any(name in ''.join(proc.cmdline()) for name in ['start_producer', 'start_converter', 'start_online']): proc.kill(...
SiLab-Bonn/online_monitor
online_monitor/stop_online_monitor.py
Python
mit
362
#!/usr/bin/env python # -*- coding: utf-8 -*- from base import PagueVelozClient VERSAO = 'v3' class Boleto(PagueVelozClient): '''Serviço de emissão e consulta de Boletos Bancários.''' def __init__(self, chave=None): PagueVelozClient.__init__(self, VERSAO, 'Boleto', chave)
PagueVeloz/ClientAPI
python/pagueveloz/api/v3.py
Python
mit
295
# -*- coding: utf-8 -*- """ Production Configurations - Use djangosecure - Use Amazon's S3 for storing static files and uploaded media - Use mailgun to send emails - Use Redis on Heroku """ from __future__ import absolute_import, unicode_literals from boto.s3.connection import OrdinaryCallingFormat from django.util...
TraMZzz/travelize
config/settings/production.py
Python
mit
6,774
API_VERSION = 'v1' API_ROOT_PATH = 'https://api.assembla.com' MAX_PER_PAGE = 100
markfinger/assembla
assembla/settings.py
Python
mit
81
""" Contains the database models for the application. """
Teddy-Schmitz/temperature_admin
models/__init__.py
Python
mit
58
# 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
import csv import webapp2 from google.appengine.ext import blobstore from google.appengine.ext.webapp import blobstore_handlers import models import mentor import logging import re class ImportPageHandler(blobstore_handlers.BlobstoreUploadHandler): def get(self): upload_url = blobstore.create_upload_url('/...
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/csv_import.py
Python
mit
2,999
import datetime from django.conf import settings from django_remote_forms import logger, widgets class RemoteField(object): """ A base object for being able to return a Django Form Field as a Python dictionary. This object also takes into account if there is initial data for the field coming in ...
promil23/django-remote-forms
django_remote_forms/fields.py
Python
mit
10,077
""" Implementation of an auto-balanced binary tree! For doctests run following command: python3 -m doctest -v avl_tree.py For testing run: python avl_tree.py """ from __future__ import annotations import math import random from typing import Any class my_queue: def __init__(self) -> None: self.data: list...
TheAlgorithms/Python
data_structures/binary_tree/avl_tree.py
Python
mit
9,677
import rate_opinion
amitt001/Analytics-App
API/rate/__init__.py
Python
mit
19
__author__ = 'SmileyBarry' from .core import APIConnection, SteamObject, store from .decorators import cached_property, INFINITE class SteamApp(SteamObject): def __init__(self, appid, name=None, owner=None): self._id = appid if name is not None: import time self._cache = d...
balohmatevz/steamapi
steamapi/app.py
Python
mit
6,268
class Solution(object): def generateMatrix(self, n): """ :type n: int :rtype: List[List[int]] """ if n <= 0: return [] if n == 1: return [[1]] matrix = [[None] * n for _ in range(n)] x = y = 0 direction = [(0,1),(1,0),(0...
tedye/leetcode
Python/leetcode.059.spiral-matrix-ii.py
Python
mit
1,134
# 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/Wires/DCLineSegment.py
Python
mit
2,414
#%% # information extraction: getting meaning from text import nltk, re, pprint def preprocess(document): sents = nltk.sent_tokenize(document) sents = [nltk.word_tokenize(sent) for sent in sents] sents = [nltk.pos_tag(sent) for sent in sents] return sents #%% chunking # NP-chunking # one of most useful...
DoWhatILove/turtle
programming/python/library/nltk/information_extraction.py
Python
mit
4,285
#!/usr/bin/python3 # -*- coding: utf-8 -*- import sys, time, os, hashlib, atexit import ftplib import traceback from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog from PyQt5.QtWidgets import QPushButton, QHBoxLayout, QVBoxLayout, \ QScrollArea, QLineEdit, QCheckBox, QMessageBox,...
lisitsky/one-button-ftp
pyftp1.py
Python
mit
15,763
#!/usr/bin/python # noqa # -*- coding: utf-8 -*- # pylint: disable=C0103 """This is decryption module for tkm.py""" from array import array import numpy as np # region Constants _REF_TABLE_1 = array('i', ( 237, 220, 239, 100, 120, 248, 241, 54, 244, 169, 178, 230, 68, 203, 43, 127, 175, 114, 154, 60, 218, 20,...
isezen/pytkm
tkmdecrypt.py
Python
mit
6,869
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
fsschneider/DeepOBS
docs/conf.py
Python
mit
5,559
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: Test2 Baseband Rx File Sink # Generated: Mon Jun 12 17:02:58 2017 ################################################## if __name__ == '__main__': import ctypes import sys i...
YaguangZhang/EarsMeasurementCampaignCode
Trials/lib/Test2_baseband_rx_file_sink_Mod.py
Python
mit
14,988
""" Sensor for checking the status of Hue sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.hue/ """ import asyncio import async_timeout from datetime import timedelta import logging import homeassistant.util.dt as dt_util from homeassistan...
shire210/Shire-HA
custom_components/hue_custom/device_tracker.py
Python
mit
3,939
"""Manage, delete, order compute instances.""" # :license: MIT, see LICENSE for more details. import SoftLayer from SoftLayer.CLI import environment from SoftLayer.CLI import exceptions from SoftLayer.CLI import formatting from SoftLayer.CLI import helpers from SoftLayer.CLI import template from SoftLayer.CLI import v...
cloudify-cosmo/softlayer-python
SoftLayer/CLI/virt/create.py
Python
mit
10,420
""" This file is a pre-setup environments file to make splinter play nice with behave It is setup to take screenshots whenever of the browser if your steps fail To change which browser you are using, change the string in Browser(). Note you may need to install Chromedriver for chrome It is lovingly shared and free to u...
mc706/prog-strat-game
core/features/environment.py
Python
mit
1,165
""" Add user scren name to whitelist if it is not to be unfollowed """ whitelist = [ ]
kimgea/simple_twitter_functions
twitter_functions/twitter/whitelisted_users.py
Python
mit
119
# source: http://www.pyimagesearch.com/2014/11/24/detecting-barcodes-images-python-opencv/ # import the necessary packages import numpy as np import argparse import cv2 # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required = True, help = "path t...
yuhangwang/MirrorAI
special_topic/barcode/try.py
Python
mit
1,895
# -*- coding: utf-8 -*- import re from scrapy.spider import BaseSpider from scrapy.selector import Selector from cnpq.items import CnpqItem class CnpqSpider(BaseSpider): name = "cnpq" allowed_domains = ["cnpq.br"] start_urls = [ "http://www.cnpq.br/web/guest/chamadas-publicas?p_p_id=resultadospo...
dmvieira/ETL-example
crawler/cnpq/cnpq/spiders/cnpq_spider.py
Python
mit
1,042
import simplejson import os from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.contrib.markup.templatetags.markup import restructuredtext from django.core.urlresolvers import reverse from django.conf import settings from django.http import HttpResponseRedi...
chrisdickinson/tweezers
projects/views/private.py
Python
mit
9,684
# -*- coding: utf-8 -*- users = { 'Jean-jacques': ('12345678', 'api-key'), }
Glandos/FreeMobile-SMS
config.sample.py
Python
mit
82
from django.conf.urls import url from . import views urlpatterns = [ url(r'^(?P<typed_letter>[a-zA-Z]+[0-9]{0,3})$', views.gethint, name='hint'), ]
superpenshine/RipMyProfessor
gethint/urls.py
Python
mit
150
import requests import json import random import uuid login="test" password="P@ssword" with open("dict", 'r', encoding="latin-1") as words : a = words.readlines() headers = { 'Content-type': 'application/json', 'Accept': 'application/json' } def gen_ip(): a = random.randint(1, 254) b = rando...
H0neyBadger/cmdb
extra/create_rand_host.py
Python
mit
2,026
# -*- coding: utf-8 -*- # vim: expandtab shiftwidth=4 softtabstop=4 # import unittest from unittest_data_provider import data_provider import os import shutil import owncloud import datetime import time import tempfile import random import six from config import Config def getSupportedDavVersion(): # connect just...
blizzz/pyocclient
owncloud/test/test.py
Python
mit
48,130
#!/usr/bin/python ''' Extract _("...") strings for translation and convert to Qt4 stringdefs so that they can be picked up by Qt linguist. ''' from subprocess import Popen, PIPE import glob import operator import os OUT_CPP="src/qt/lulacoinstrings.cpp" EMPTY=['""'] def parse_po(text): """ Parse 'po' format pr...
mmboulhosa/lulacoin
share/qt/extract_strings_qt.py
Python
mit
2,052
from werkzeug.exceptions import HTTPException from werkzeug.wsgi import SharedDataMiddleware from partial import routing, scanner from partial.request import Request class Application(object): def dispatch_request(self, request): scanner.LOCAL.request = request adapter = scanner.GLOBAL['routemap'...
RentennaDev/partial
partial/application.py
Python
mit
1,463
# This file is part of the django-environ. # # Copyright (c) 2021, Serghei Iakovlev <egrep@protonmail.ch> # Copyright (c) 2013-2021, Daniele Faraglia <daniele.faraglia@gmail.com> # # For the full copyright and license information, please view # the LICENSE.txt file that was distributed with this source code. from envi...
joke2k/django-environ
tests/fixtures.py
Python
mit
3,765
"""Support for raspihats board binary sensors.""" from __future__ import annotations import logging import voluptuous as vol from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity from homeassistant.const import ( CONF_ADDRESS, CONF_DEVICE_CLASS, CONF_NAME, DEVICE_DEFA...
rohitranjan1991/home-assistant
homeassistant/components/raspihats/binary_sensor.py
Python
mit
4,436
import copy import unittest from numpy.testing import assert_equal from test_simobj import VectCalc from arrayaccess import DefaultArrayAccess class TestCopy(unittest.TestCase): simclass = VectCalc copyfunc = staticmethod(copy.copy) clone_v1 = [20] * 10 def check_copy(self, name, value): o...
tkf/railgun
tests/test_simple_copy.py
Python
mit
1,929
import gevent from gevent import monkey from gevent.pool import Pool monkey.patch_all() import requests import json import time import os def download_image(image_url): filename = 'async_images/' + image_url.rsplit('/', 1)[-1] print 'Downloading %s...' % filename response = requests.get(image_url) with...
50onRed/phillypug-concurrent
io_bound/phillypug_async_requests.py
Python
mit
1,225
f = open("font.txt","rb") fontdata = f.read() f.close() out = "static char font[128][5] = {" for i in xrange(128): out += "{" #Encode these into 7 bit "byte"s, with MSB=0 #We don't save anything by using 8-bit bytes; the last five bits of the last byte spill over, so we still get 5 bytes/char ...
imallett/MOSS
resources/bytemap font/echo as array.py
Python
mit
923
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-21 07:28 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True depe...
Ninad998/FinalYearProject
django_app/migrations/0001_initial.py
Python
mit
1,051
# -*- coding: utf-8 -*- """ zang.domain.enums.sms_message_status ~~~~~~~~~~~~~~~~~~~ Module containing `SmsMessageStatus` available options """ from enum import Enum class SmsMessageStatus(Enum): SENT = 'sent' SENDING = 'sending' QUEUED = 'queued' FAILED = 'failed'
jaymin-panchal/zang-python
zang/domain/enums/sms_message_status.py
Python
mit
285
# Graph - Data Structure ''' class "Edge" contains information about Source Node ID Destination Node ID Weight between Source and Destination ''' class Edge(object): def __init__(self,From,To,Weight): self.From = From self.To = To self.Weight = Weight ''' ...
yashp241195/graphs
makeGraph.py
Python
mit
1,931
import os from nose.tools import assert_equals, assert_items_equal from rsk_mind.dataset import PandasDataset from rsk_mind.transformer import * import pandas as pd class CustomTransformer(Transformer): class Feats(): a1 = Feat() a2 = Feat() f1 = CompositeFeat(['a1', 'a2']) def ge...
rsk-mind/rsk-mind-framework
tests/dataset/test_dataset_pandas.py
Python
mit
2,486
from PyQt4 import QtGui import bisect class Track(object): DEFAULT_COLOR = QtGui.QColor(100, 100, 255) def __init__(self, parent): self._title = '' self._color = self.DEFAULT_COLOR self._parent = parent self._periods = [] # Functions needed for the bisect insertion #####...
sunj1/my_pyforms
pyforms/gui/Controls/ControlEventsGraph/Track.py
Python
mit
2,110
# Charles Hong (csh6cw) # 09/11/17 # quack.py __author__ = 'Charles Hong' __emailID__ = 'csh6cw' def quack(msg): print(msg)
charleshong/cs3240-labdemo
quack.py
Python
mit
129
import pytest import cv2 from plantcv.plantcv.visualize import auto_threshold_methods def test_auto_threshold_methods_bad_input(visualize_test_data): """Test for PlantCV.""" img = cv2.imread(visualize_test_data.small_rgb_img) with pytest.raises(RuntimeError): _ = auto_threshold_methods(gray_img=im...
danforthcenter/plantcv
tests/plantcv/visualize/test_auto_threshold_methods.py
Python
mit
558
import _plotly_utils.basevalidators class A0Validator(_plotly_utils.basevalidators.NumberValidator): def __init__(self, plotly_name="a0", parent_name="carpet", **kwargs): super(A0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwar...
plotly/plotly.py
packages/python/plotly/plotly/validators/carpet/_a0.py
Python
mit
380
from models.TFMacros.tf_macros import * def model(model, inputs, dataset_parameters): agreement = ( Input(name='world', shape=dataset_parameters['world_shape'], tensor=inputs.get('world')) >> Constant(value=True, dtype='float') >> Binary(name='agreement', binary_transform=False, tensor=in...
AlexKuhnle/ShapeWorld
models/agreement/always_true.py
Python
mit
371
# -*- encoding: utf-8 -*- # # Copyright 2013 Jay Pipes # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
openilabs/falconlab
env/lib/python2.7/site-packages/talons/helpers.py
Python
mit
1,777
import time import numpy as np import pandas as pd class DNB: """ Class representing Dynamic Naive Bayes. """ def __init__(self, debug=False): self.states_prior = None self.states_list = None self.features = None self.A = None self.B = None self.debug ...
tsabata/PyDNB
pydnb/dnb.py
Python
mit
6,733
#! /usr/bin/env python3 import os import zipfile import sys import settings __author__ = 'tigge' def main(): zipfilename = os.path.join(settings.get("folder"), settings.get("basename") + ".zip") zip = zipfile.ZipFile(zipfilename, mode="w", ) for filename in os.listdir(settings.get("folder")): p...
Tigge/trello-to-web
zip.py
Python
mit
659
""" XVM (c) www.modxvm.com 2013-2017 """ ##################################################################### # imports import SoundGroups from helpers import dependency from skeletons.gui.battle_session import IBattleSessionProvider from gui.Scaleform.daapi.view.battle.shared.damage_panel import DamagePanel from x...
peterbartha/ImmunoMod
res_mods/mods/packages/xvm_sounds/python/ammoBay.py
Python
mit
1,412
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from tests import IntegrationTestCase from tests.holodeck import Request from twilio.base.exceptions import TwilioException from twilio.http.response import Response class SyncListTestCase(Integrat...
twilio/twilio-python
tests/integration/preview/sync/service/test_sync_list.py
Python
mit
8,183
#!/usr/bin/env python ''' Serve data on a TCP port (using the assumption that the machine can listen on the specified address and port), imitating a Rhizome Systems energy monitoring device. The imitation is accomplished by reading from a "profile," i.e., a list of sample readings. Called with two arguments: The ...
cjmay/energyweb
graph/management/commands/energyfaker.py
Python
mit
5,892
import datetime import math class MethodAttribute: """ A method attribute is an attribute with the method and its corresponding arity attached as parameters. It simply acts as a tuple for easy access """ def __init__(self, method, arity): self.method = method self.arity = arit...
Emigna/05AB1E
lib/constants.py
Python
mit
146,313
from AppKit import NSScroller, NSColor, NSAttributedString, NSMenuItem, NSShadowAttributeName, NSShadow, \ NSForegroundColorAttributeName, NSFont, NSFontAttributeName, NSSmallControlSize, NSView import vanilla class OpenTypeControlsView(vanilla.ScrollView): def __init__(self, posSize, callback): self...
typesupply/defconAppKit
Lib/defconAppKit/controls/openTypeControlsView.py
Python
mit
12,083
import os, sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import apx import unittest import remotefile import autosar class TestApxDataType(unittest.TestCase): def setUp(self): pass def test_create_uint8_type(self): dt = apx.DataType('MyU8_T','C') ...
cogu/py-apx
tests/data_type_test.py
Python
mit
3,285
import math from log_parser import parse_loglines from event_timer import add_realtimes_to_datapoint_list class HeartBeatTimings(object): def __init__(self, hrm_datapoint_iter): self.samples = list(_generate_beat_samples(hrm_datapoint_iter)) def first_beat_time(self): return self.samples[0][0] def last_beat_...
ncleaton/njcant
njcant/hr_analysis.py
Python
mit
4,240
import os import pickle import xbmc import urllib2 def getFilesAsDic(FilePath,TrimPath): ''' Based on a passed path build a dictionary of files and update times ''' file_list = {} FilePath = xbmc.validatePath(FilePath) if os.path.isdir(FilePath): for root, dirs, files in os....
declankenny/XBMC_datasync
resources/lib/functions.py
Python
mit
2,067
# -*- coding: utf-8 -*- from django.conf import settings PAGINATE_BY = getattr(settings, 'LINKCAT_PAGINATE_BY', 20) GROUPS_CAN_POST_LINK = getattr(settings, 'LINKCAT_GROUPS_CAN_POST_LINK', ['linkcat_post']) GROUPS_CAN_MODERATE = getattr(settings, 'LINKCAT_GROUPS_CAN_MODERATE', ['linkcat_moderation']) languages = (...
synw/django-linkcat
linkcat/conf.py
Python
mit
577
from django.conf.urls.defaults import patterns, url, include def default_urlpatterns(provider): urlpatterns = patterns(provider.package + '.views', url('^login/$', 'oauth2_login', name=provider.id + "_login"), url('^login/done/$...
uroslates/django-allauth
allauth/socialaccount/providers/oauth2/urls.py
Python
mit
483