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
#!/usr/bin/env python import argparse import sys import re import os import locale import subprocess from multiprocessing import Process def dbquery(query): import psycopg2 db = psycopg2.connect(dbname = "firmware", user = "firmadyne", password = "firmadyne", host = "127.0.0.1") ret = None try: ...
niorehkids/firmanal
analyze.py
Python
mit
6,828
0.006737
"""Simulation of controlled dumbbell around Itokawa with simulated imagery using Blender This will generate the imagery of Itokawa from a spacecraft following a vertical descent onto the surface. 4 August 2017 - Shankar Kulumani """ from __future__ import absolute_import, division, print_function, unicode_literals ...
skulumani/asteroid_dumbbell
blender_sim.py
Python
gpl-3.0
26,548
0.007571
"""Functions for the backend of LetterBoy""" def lb_standardcase(): """Capitalise the first letter of each sentence, and set all others to lowercase.""" pass def lb_uppercase(): """Capitalise each letter.""" pass def lb_lowercase(): """Set all letters to lowercase.""" pass def ...
Moth-Tolias/LetterBoy
LetterBoy_backend.py
Python
gpl-3.0
788
0.01269
import uuid import datetime as dt import json import urllib.request import urllib.parse from Main.handlers.settings import RECAPTCHA_SECRET_KEY def get_title(title=""): if title == "": return "GetCompany info" else: return title + " - GetCompany info" def get_new_token(): return str(str(...
G4brym/GetCompany.info
Main/handlers/utilities.py
Python
mit
1,191
0.006717
# 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 ...
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_rule.py
Python
mit
5,618
0.002492
# Copyright 2018 Capital One Services, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
FireballDWF/cloud-custodian
tools/c7n_azure/c7n_azure/resources/storage.py
Python
apache-2.0
14,922
0.002211
from django import template from bookmarks.models import BookmarkInstance from tagging.models import Tag register = template.Library() @register.inclusion_tag('bookmarks/tags.html') def show_bookmarks_tags(): """ Show a box with tags for all articles that belong to current site. """ return {'bookmark_tags...
incuna/incuna-bookmarks
bookmarks/templatetags/bookmark_tags.py
Python
mit
421
0.007126
""" Helper file to manage translations for the Meerkat Authentication module. We have two types of translations, general and implementation specific The general translations are extracted from the python, jijna2 and js files. """ from csv import DictReader import argparse import os import shutil import datetime f...
meerkat-code/meerkat_auth
translate.py
Python
mit
1,780
0.008989
#/usr/bin/python #!*-* coding:utf-8 *-* # Este script es sofware libre. Puede redistribuirlo y/o modificarlo bajo # los terminos de la licencia pública general de GNU, según es publicada # por la free software fundation bien la versión 3 de la misma licencia # o de cualquier versión posterior. (según su elección )....
Diego-debian/Free-infrarossi
free_infrarossi/bin/Atenuacion.py
Python
gpl-3.0
2,477
0.031617
import os from conans.tools import unzip import shutil from conans.util.files import rmdir, mkdir from conans.client.remote_registry import RemoteRegistry from conans import tools from conans.errors import ConanException def _handle_remotes(registry_path, remote_file, output): registry = RemoteRegistry(registry_p...
lasote/conan
conans/client/conf/config_installer.py
Python
mit
4,484
0.001338
""" RUN FROM THIS FILE Alexandre Yang ITP 115 Final Project 05/08/2014 Description: Refer to readme.txt """ import pygame from Oto import Oto from Button import Button from Label import Label # Input: pygame.Surface, tuple, int, int, int, int # Output: none # Side-effect: Draws the grid on the screen def drawBoard...
yangalex/Otomata-python
Otomata.py
Python
mit
7,139
0.001541
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('SocialNetworkModels', '0006_remove_comments_post_author'), ] operations = [ migrations.AddField( model_name='com...
diego04/cmput410-project
Distributed_Social_Networking/SocialNetworkModels/migrations/0007_comments_comment_author.py
Python
apache-2.0
483
0
#!/usr/bin/env python import sys import socket import colorsys import time try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) except: print('Failed to create socket') sys.exit(1) host = sys.argv[1]; port = 1337; r = int(sys.argv[3]) g = int(sys.argv[4]) b = int(sys.argv[5]) msg = bytes([ 0x20 + i...
Cytrill/tools
led_tools/set_led.py
Python
gpl-3.0
407
0.014742
from __future__ import print_function import pandas from sklearn.naive_bayes import MultinomialNB from sklearn.cross_validation import train_test_split from sklearn.preprocessing import LabelEncoder def main(): train_all = pandas.DataFrame.from_csv('train.csv') train = train_all[['Survived', 'Sex', 'Fare']][:...
noelevans/sandpit
kaggle/titanic/categorical_and_scaler_prediction.py
Python
mit
773
0
import datetime import decimal import hashlib import logging from time import time from django.conf import settings from django.utils.encoding import force_bytes from django.utils.timezone import utc logger = logging.getLogger('django.db.backends') class CursorWrapper: def __init__(self, cursor, db): se...
mattseymour/django
django/db/backends/utils.py
Python
bsd-3-clause
7,044
0.000568
def pig_it(text): return ' '.join([x[1:]+x[0]+'ay' if x.isalpha() else x for x in text.split()]) # 其实就是2个字符串过滤拼接,比移动方便多了,思路巧妙 # a if xx else b, 单行判断处理异常字符,xx为判断,标准套路 for x in text.split() if x.isalpha() ...
lluxury/codewars
Simple Pig Latin.py
Python
mit
564
0.006198
# 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...
ghchinoy/tensorflow
tensorflow/python/grappler/layout_optimizer_test.py
Python
apache-2.0
60,128
0.015018
from configparser import ConfigParser import v20 # Create an object config config = ConfigParser() # Read the config config.read("../API_Connection_Oanda/pyalgo.cfg") ctx = v20.Context( 'api-fxpractice.oanda.com', 443, True, application = 'sample_code', token = config['oanda_v20']['access_token'],...
cgomezfandino/Project_PTX
API_Connection_Oanda/PTX_oandaInfo.py
Python
mit
972
0.009259
# By starting at the top of the triangle below and moving to adjacent numbers on the # row below, the maximum total from top to bottom is 23. # 3 # 7 4 # 2 4 6 # 8 5 9 3 # That is, 3 + 7 + 4 + 9 = 23. # Find the maximum total from top to bottom of the triangle below: # 75 # 95 64 # 17 47 82 # 18 35 87 10 # 20 04 8...
cloudzfy/euler
src/18.py
Python
mit
1,684
0.006532
def get_perm_argparser(self, args): args = args.split(" ") if args[0] == "nick": self.conman.gen_send("Permission level for %s: %s" % (args[1], self.permsman.get_nick_perms(args[1]))) elif args[0] == "cmd": if args[1].startswith("."): args[1] = args[1][1:] self.conman.gen...
vsquare95/JiyuuBot
modules/permissions.py
Python
gpl-3.0
1,361
0.005878
#!/usr/bin/env python import os import sys PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) sys.path.append(PROJECT_DIR) sys.path.append(os.path.abspath(PROJECT_DIR + '/../')) sys.path.append(os.path.abspath(PROJECT_DIR + '/../realestate/')) if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTIN...
wm3ndez/realestate
testproject/manage.py
Python
bsd-2-clause
464
0.002155
# -*- coding: utf-8 -*- # gedit CodeCompletion plugin # Copyright (C) 2011 Fabio Zendhi Nagao # # 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...
nagaozen/my-os-customizations
home/nagaozen/.gnome2/gedit/plugins/codecompletion/utils.py
Python
gpl-3.0
1,420
0.008451
"""Admin Configuration for Improved User""" from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.utils.translation import gettext_lazy as _ from .forms import UserChangeForm, UserCreationForm class UserAdmin(BaseUserAdmin): """Admin panel for Improved User, mimics Django's default""" ...
jambonsw/django-improved-user
src/improved_user/admin.py
Python
bsd-2-clause
1,256
0
import os import re import struct from . import helpers from .raid import RaidController, RaidLD, RaidPD, DeviceCapacity from .mixins import TextAttributeParser from .smart import SMARTinfo if os.name == 'nt': raidUtil = 'C:\\Program Files (x86)\\MegaRAID Storage Manager\\StorCLI64.exe' elif 'VMkernel' in os.una...
Bloodoff/raidinfo
lib/raid_megaraid.py
Python
gpl-3.0
8,614
0.003018
# -*- encoding: utf-8 -*- import os from abjad import abjad_configuration from abjad.demos import desordre def test_demos_desordre_01(): lilypond_file = desordre.make_desordre_lilypond_file()
mscuthbert/abjad
abjad/demos/desordre/test/test_demos_desordre.py
Python
gpl-3.0
198
0.005051
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/furniture/all/shared_frn_all_lamp_free_s01_lit.iff" result.attribut...
anhstudios/swganh
data/scripts/templates/object/tangible/furniture/all/shared_frn_all_lamp_free_s01_lit.py
Python
mit
461
0.047722
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2020, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
mrcslws/nupic.research
src/nupic/research/frameworks/vernon/mixins/step_based_logging.py
Python
agpl-3.0
4,696
0.000213
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Trial.max_participants' db.delete_column(u'trials_trial', 'max_participants') def ba...
openhealthcare/randomise.me
rm/trials/migrations/0035_auto__del_field_trial_max_participants.py
Python
agpl-3.0
7,643
0.008112
# Ansible module to manage CheckPoint Firewall (c) 2019 # # 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 dist...
kvar/ansible
test/units/modules/network/check_point/test_cp_mgmt_host.py
Python
gpl-3.0
3,853
0.001557
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
0.002481
#!/usr/bin/python import math # return statement def printLog(x): if x <= 0: print "Positive number only, please." return result = math.log(x) print "The log of x is", result x, y = -2, 3 printLog(y)
janusnic/21v-python
unit_01/23.py
Python
mit
210
0.033333
# 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.utils import flt, getdate, get_url from frappe import _ from frappe.model.document import Document from erpnext.controllers....
RandyLowery/erpnext
erpnext/projects/doctype/project/project.py
Python
gpl-3.0
8,909
0.02851
from base import MediaFile from fields import MediaFileField from widgets import AdminMediaFileWidget
aino/aino-convert
convert/__init__.py
Python
bsd-3-clause
105
0
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the G...
jmesteve/saas3
openerp/addons/auth_crypt/__openerp__.py
Python
agpl-3.0
1,628
0
# encoding: utf-8 # module pyexpat # from /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so # by generator 1.135 """ Python wrapper for Expat parser. """ # imports import pyexpat.errors as errors # <module 'pyexpat.errors' (built-in)> import pyexpat.model as model # <module 'pyexpat.model' (built-in)> # Vari...
ProfessorX/Config
.PyCharm30/system/python_stubs/-1247972723/pyexpat/__init__.py
Python
gpl-2.0
1,861
0.009672
"""Support for the AccuWeather service.""" from __future__ import annotations from statistics import mean from typing import Any, cast from homeassistant.components.weather import ( ATTR_FORECAST_CONDITION, ATTR_FORECAST_PRECIPITATION, ATTR_FORECAST_PRECIPITATION_PROBABILITY, ATTR_FORECAST_TEMP, A...
rohitranjan1991/home-assistant
homeassistant/components/accuweather/weather.py
Python
mit
6,728
0.002081
#!/usr/bin/python -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ # Basic string exercises # Fill in the code for the functions below. main() is already se...
kghatala/googlePythonCourse
basic/string1.py
Python
apache-2.0
3,654
0.011768
def main(): #init an array named a a = list() a = [] b = [1,'1',[1,2]] #Get the size of a list a_size = len(a) #how to check if a list is empty if (a): print ("not empty") else: print ("empty") index = 0 a = ['a','b','c'] print (a[index]) a.append('d') a.extend(['e']) print ('After append a, ex...
jeremykid/FunAlgorithm
python_practice/data_structure/array/array.py
Python
mit
869
0.073648
# # product import logging from django.contrib import messages from django.contrib.auth.decorators import user_passes_test from django.urls import reverse from django.http import HttpResponseRedirect from django.shortcuts import render from dojo.utils import add_breadcrumb from dojo.forms import ToolTypeForm from doj...
rackerlabs/django-DefectDojo
dojo/tool_type/views.py
Python
bsd-3-clause
2,344
0.002133
# Copyright (C) 2009, Brad Beattie # # 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 ...
R-daneel-olivaw/mutation-tolerance-voting
pyvotecore/schulze_helper.py
Python
lgpl-3.0
8,939
0.002685
# =============================================================================== # Copyright 2015 Jake Ross # # 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...
UManPychron/pychron
pychron/experiment/conflict_resolver.py
Python
apache-2.0
4,802
0.001874
# flake8: noqa # -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models from ..compat import USER_MODEL class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Review' db.create_table(u'review_review', ( ...
bitmazk/django-review
review/south_migrations/0001_initial.py
Python
mit
10,388
0.007605
from .plot_widget import PlotWidget from .filter_popup import FilterPopup from .filterable_kw_list_model import FilterableKwListModel from .data_type_keys_list_model import DataTypeKeysListModel from .data_type_proxy_model import DataTypeProxyModel from .data_type_keys_widget import DataTypeKeysWidget from .plot_cas...
joakim-hove/ert
ert_gui/tools/plot/__init__.py
Python
gpl-3.0
555
0
from selenium import webdriver from selenium.webdriver.common.keys import Keys from random import randint from time import sleep import brain import game drv = webdriver.Firefox() drv.get('http://gabrielecirulli.github.io/2048/') container = drv.find_element_by_class_name('tile-container') retry = drv.find_element_by_...
munk/play2048
tfe.py
Python
mit
1,792
0.004464
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2004-2011 Pexego Sistemas Informáticos. All Rights Reserved # $Omar Castiñeira Saavedra$ # # This program is free software: you can redistribute it and/or modify # it under the terms of th...
diagramsoftware/l10n-spain
l10n_es_igic/data/__init__.py
Python
agpl-3.0
985
0
#-*- coding: utf-8 -*- # collections.py # Define various kind of collections # # 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 option) ...
sean797/tracer
tracer/resources/collections.py
Python
gpl-2.0
3,632
0.022577
""" Analytical template tags and filters. """ from __future__ import absolute_import import logging from django import template from django.template import Node, TemplateSyntaxError from django.utils.importlib import import_module from templatetags.utils import AnalyticalException TAG_LOCATIONS = ['head_top', 'hea...
linkedin/indextank-service
storefront/templatetags/analytical.py
Python
apache-2.0
2,352
0.002976
# 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, software # distributed under the Li...
alex/warehouse
warehouse/migrations/versions/a65114e48d6f_set_user_last_login_automatically_in_.py
Python
apache-2.0
1,008
0
from man import comm from . import NogginConstants as Constants from . import GameStates from .util import FSA from . import Leds TEAM_BLUE = 0 TEAM_RED = 1 class GameController(FSA.FSA): def __init__(self, brain): FSA.FSA.__init__(self,brain) self.brain = brain self.gc = brain.comm.gc...
northern-bites/nao-man
noggin/GameController.py
Python
gpl-3.0
4,831
0.002484
############################################################################### ## ## Copyright (C) 2013-2014 Tavendo GmbH ## ## 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 ## ## h...
ahmedbodi/AutobahnPython
autobahn/autobahn/wamp/message.py
Python
apache-2.0
84,035
0.020694
# Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2019, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it unde...
mrcslws/nupic.research
projects/rsm/rsm_samplers.py
Python
agpl-3.0
9,884
0.001315
""" SALTS XBMC Addon Copyright (C) 2014 tknorris 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. T...
aplicatii-romanesti/allinclusive-kodi-pi
.kodi/addons/plugin.video.salts/service.py
Python
apache-2.0
5,535
0.00271
''' New Integration Test for hybrid. @author: Quarkonics ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_state as test_state import zstackwoodpecker.operations.hybrid_operations as hyb_ops import zstackwoodpecker.operations.resou...
zstackorg/zstack-woodpecker
integrationtest/vm/hybrid/test_attach_detach_oss_bucket.py
Python
apache-2.0
1,062
0.003766
import os import uuid from django.db import models from django.core.files.uploadedfile import UploadedFile from django.forms.forms import pretty_name from . import get_image_cropper from . import tasks from . import settings from . import utils from . import signals from .managers import AssetManager from .fields imp...
ff0000/scarlet
scarlet/assets/models.py
Python
mit
7,186
0.000835
#!/usr/bin/env python ####################################################### # Copyright (c) 2015, ArrayFire # All rights reserved. # # This file is distributed under 3-clause BSD license. # The complete license agreement can be obtained at: # http://arrayfire.com/licenses/BSD-3-Clause ###############################...
arrayfire/arrayfire_python
tests/simple/algorithm.py
Python
bsd-3-clause
3,357
0.000298
#!/usr/bin/env python import datetime import logging import math import socket import tables import xml.etree.ElementTree as ET logging.basicConfig(filename = 'mbta_daemon.log', level=logging.INFO) logger = logging.getLogger('xml2hdf5') class VehicleLocation(tables.IsDescription): vehicleID = tables.StringCol(4) ...
jiahao/godot
parseh5.py
Python
mit
5,010
0.011976
import logging from datetime import datetime import os import json from flask import request, g, Response #from openspending.core import cache from openspending.auth import require from openspending.lib.jsonexport import jsonify from openspending.views.api_v2.common import blueprint from openspending.views.error impo...
nathanhilbert/FPA_Core
openspending/views/api_v2/cubes_ext.py
Python
agpl-3.0
9,418
0.008388
# Transformer/Utilities/__init__.py
JMSkelton/Transformer
Transformer/Utilities/__init__.py
Python
gpl-3.0
36
0
import bcrypt from hashlib import sha512 from helptux import db, login_manager class Role(db.Model): __tablename__ = 'roles' id = db.Column(db.Integer, primary_key=True) role = db.Column(db.String(255), index=True, unique=True) def __repr__(self): return '<Role {0}>'.format(self.role) de...
pieterdp/helptux
helptux/models/user.py
Python
gpl-2.0
2,613
0.001148
import csv from openpyxl import load_workbook import io from dwarfsquad.lib.build.from_export import build_compound_methods, build_lots_and_levels from dwarfsquad.lib.build.from_export.build_assay_configuration import build_assay_configuration from dwarfsquad.lib.build.from_export.build_rulesettings import add_rules_to...
whereskenneth/Dwarfsquad
dwarfsquad/lib/build/from_xlsx/build_full_ac.py
Python
mit
1,706
0.004103
from __future__ import absolute_import, unicode_literals import flask import os import logging from flask_heroku import Heroku from flask_redis import Redis from flask_sslify import SSLify from flask_sqlalchemy import SQLAlchemy from raven.contrib.flask import Sentry from werkzeug.contrib.fixers import ProxyFix from...
jkimbo/freight
freight/config.py
Python
apache-2.0
8,210
0.000853
#!/usr/bin/env python # 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, software...
openstack/tripleo-heat-templates
tools/convert_nic_config.py
Python
apache-2.0
7,737
0
from Monument import Monument, Dataset import importer_utils as utils import importer as importer class DkBygningDa(Monument): def set_adm_location(self): if self.has_non_empty_attribute("kommune"): if utils.count_wikilinks(self.kommune) == 1: adm_location = utils.q_from_first...
Vesihiisi/COH-tools
importer/DkBygningDa.py
Python
mit
3,500
0
"""helpers.py -- supporting routines for PyBlaster project @Author Ulrich Jansen <ulrich.jansen@rwth-aachen.de> """ suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'] def humansize(nbytes): if nbytes == 0: return '0 B' i = 0 while nbytes >= 1024 and i < len(suffixes)-1: nbytes /= 1024. ...
ujac81/PiBlaster
Pi/PyBlaster/src/helpers.py
Python
gpl-3.0
541
0
import unittest from cumulusci.core import template_utils class TemplateUtils(unittest.TestCase): def test_string_generator(self): x = 100 y = template_utils.StringGenerator(lambda: str(x)) assert str(y) == "100" x = 200 assert str(y) == "200" def test_faker_library(se...
SalesforceFoundation/CumulusCI
cumulusci/robotframework/tests/test_template_util.py
Python
bsd-3-clause
1,872
0.000534
"""General tests for Buoyant library.""" import datetime import unittest from io import BytesIO import buoyant from buoyant import buoy sampledata = [ { "latitude (degree)": "39.235", "sea_surface_wave_peak_period (s)": "13.79", "polar_coordinate_r1 (1)": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;...
fitnr/buoyant
tests/test_buoyant.py
Python
gpl-3.0
5,408
0.001664
# Copyright 2002-2011 Nick Mathewson. See LICENSE for licensing information. """mixminion.ServerKeys Classes for servers to generate and store keys and server descriptors. """ #FFFF We need support for encrypting private keys. __all__ = [ "ServerKeyring", "generateServerDescriptorAndKeys", "genera...
Javex/mixminion
lib/mixminion/server/ServerKeys.py
Python
mit
49,832
0.003793
import datetime from django.db import models from django.utils import timezone class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): # __unicode__ on Python 2 return self.question_text ...
JCraft40/finalproject
polls/models.py
Python
gpl-2.0
899
0.006674
# Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
krmahadevan/selenium
py/selenium/webdriver/safari/webdriver.py
Python
apache-2.0
4,520
0.001991
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
oldpa/luigi
luigi/scheduler.py
Python
apache-2.0
45,889
0.002245
import nose from nose.plugins.attrib import attr import logging import colorguard import os bin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries')) @attr(speed='slow') def test_cromu_00070_caching(): # Test exploitation of CROMU_00070 given an input which causes a leak. Th...
mechaphish/colorguard
tests/test_cromu70_caching.py
Python
bsd-2-clause
1,245
0.006426
# coding=utf-8 #https://developers.google.com/drive/v3/web/quickstart/python from __future__ import print_function import httplib2 import os import io from apiclient import discovery import oauth2client from oauth2client import client from oauth2client import tools from apiclient.http import MediaIoBaseDownload from ap...
aleixo/cnn_fire
googlemanager.py
Python
gpl-3.0
4,878
0.009842
# -*- coding: utf-8 -*- #Import libraries from sys import exit from math import sqrt #Print title (http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Equation%20Solver%20V2.1) print " ____ __ _ ____ __ _ _____ ___" print " / __/__ ___ _____ _/ /_(_)__ ___ ...
V3sth4cks153/Python-Programs
equation_solver.py
Python
mit
1,645
0.024924
""" sentry_javascript_lite.plugin ~~~~~~~~~~~~~~~~~~~~~ """ import re from django.conf import settings from sentry.lang.javascript.plugin import JavascriptPlugin from sentry.lang.javascript.processor import SourceProcessor from sentry.interfaces.stacktrace import (Frame, Stacktrace) from sentry_javascript_lite import...
Banno/getsentry-javascript-lite
sentry_javascript_lite/plugin.py
Python
apache-2.0
3,880
0.004897
############################################################################### # This file is part of openWNS (open Wireless Network Simulator) # _____________________________________________________________________________ # # Copyright (C) 2004-2007 # Chair of Communication Networks (ComNets) # Kopernikusstr. 16, D-...
creasyw/IMTAphy
framework/scenarios/PyConfig/scenarios/placer/positionList.py
Python
gpl-2.0
2,880
0.010069
# AsteriskLint -- an Asterisk PBX config syntax checker # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. # # 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 ...
ossobv/asterisklint
asterisklint/__init__.py
Python
gpl-3.0
1,096
0
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
won0089/oppia
extensions/rules/real_test.py
Python
apache-2.0
2,944
0
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2016 OSGeo # # 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 ...
Geode/geonode
geonode/upload/migrations/0001_initial.py
Python
gpl-3.0
2,961
0.00304
# Sample 5 import socket import sys try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error as msg: print('Failed to create socket!') print('Error code: ' + str(msg[0]) + ', error message: ' + msg[1]) sys.exit() print('Socked created successfully.') # Part 1 host = '' port = 8888 try: s....
jessicayuen/cmput410-lab2
sample5.py
Python
gpl-3.0
1,165
0.017167
import typing as t import warnings from .request import Request class _FakeSubclassCheck(type): def __subclasscheck__(cls, subclass: t.Type) -> bool: warnings.warn( "'BaseRequest' is deprecated and will be removed in" " Werkzeug 2.1. Use 'issubclass(cls, Request)' instead.", ...
mitsuhiko/werkzeug
src/werkzeug/wrappers/base_request.py
Python
bsd-3-clause
1,174
0
# -*- coding: utf-8 -*- import rlp import secp256k1 from rlp.sedes import big_endian_int, binary, Binary from rlp.utils import str_to_bytes, ascii_chr from eth_utils.address import to_normalized_address from eth_utils.hexidecimal import encode_hex, decode_hex try: from Crypto.Hash import keccak sha3_256 = lambd...
mikeshultz/icenine
icenine/contrib/transactions.py
Python
gpl-3.0
9,242
0.003787
# This file is part of the Trezor project. # # Copyright (C) 2012-2018 SatoshiLabs and contributors # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 # as published by the Free Software Foundation. # # This library is distrib...
jhoenicke/python-trezor
trezorlib/ontology.py
Python
lgpl-3.0
2,134
0.001406
assignments = [] rows = 'ABCDEFGHI' cols = '123456789' def assign_value(values, box, value): """ Please use this function to update your values dictionary! Assigns a value to a given box. If it updates the board record it. """ # Don't waste memory appending actions that don't actually change any v...
edno/udacity-sandbox
ud889/AIND_Sudoku/solution.py
Python
unlicense
6,141
0.006839
import click import pickle from build import Build @click.group() def cli(): pass @cli.command() @click.option('--cache-file', default='test-cache') @click.option('--query') def query(cache_file, query): with open(cache_file, 'rb') as f: key, criteria = query.split('=') buildobjs = pickle.l...
jpmontez/jenkins-rpc
scripts/build-summary/cachequery.py
Python
gpl-2.0
492
0
from dnfpyUtils.stats.statistic import Statistic import numpy as np class Trajectory(Statistic): """ Abstract class for trajectory """ def __init__(self,name,dt=0.1,dim=0,**kwargs): super().__init__(name=name,size=0,dim=dim,dt=dt,**kwargs) self.trace = [] #save the trace ...
bchappet/dnfpy
src/dnfpyUtils/stats/trajectory.py
Python
gpl-2.0
1,105
0.021719
# -*- coding: utf-8 -*- # # Moonstone is platform for processing of medical images (DICOM). # Copyright (C) 2009-2011 by Neppo Tecnologia da Informação LTDA # and Aevum Softwares LTDA # # This file is part of Moonstone. # # Moonstone is free software: you can redistribute it and/or modify # it under the terms of the GN...
aevum/moonstone
src/moonstone/gui/qt/component/mwindow.py
Python
lgpl-3.0
14,404
0.00854
# Copyright (C) 2012 - 2014 EMC 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 # # Unle...
Akrog/cinder
cinder/api/contrib/consistencygroups.py
Python
apache-2.0
14,556
0
import unittest from restkiss.preparers import Preparer, FieldsPreparer class InstaObj(object): def __init__(self, **kwargs): for k, v in kwargs.items(): setattr(self, k, v) class LookupDataTestCase(unittest.TestCase): def setUp(self): super(LookupDataTestCase, self).setUp() ...
CraveFood/restkiss
tests/test_preparers.py
Python
bsd-3-clause
2,628
0.003805
from huzzer.function_generator import generate_expression, generate_unary_expr from huzzer.expressions import VariableExpression, FunctionExpression, BRANCH_EXPRESSIONS from huzzer.namers import DefaultNamer from huzzer import INT, BOOL empty_variables = { INT: [], BOOL: [] } def test_generate_unary_expr(): ...
coopie/huzzer
test/test_function_generator.py
Python
mit
3,071
0.001954
import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'persephone.settings') app = Celery('persephone') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks()
karamanolev/persephone
persephone/persephone/celery.py
Python
mit
231
0
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at you...
SNoiraud/gramps
gramps/gen/filters/rules/_regexpidbase.py
Python
gpl-2.0
1,899
0.005793
import numpy as np from . import _marching_cubes_cy def marching_cubes(volume, level, spacing=(1., 1., 1.)): """ Marching cubes algorithm to find iso-valued surfaces in 3d volumetric data Parameters ---------- volume : (M, N, P) array of doubles Input data volume to find isosurfaces. Will...
almarklein/scikit-image
skimage/measure/_marching_cubes.py
Python
bsd-3-clause
6,374
0.000157
#!/bin/false # -*- coding: utf-8 -*- from objects.orobject import OrObject from objects.function import Function from objects.number import Number from objects.file import File from objects.inheritdict import InheritDict from objects.ordict import OrDict from objects.orddict import ODict import objects.console as cons...
pavpanchekha/oranj
oranj/core/builtin.py
Python
gpl-3.0
1,879
0.010112
from django.contrib.auth import update_session_auth_hash from rest_framework import serializers from authentication.models import Account class AccountSerializer(serializers.ModelSerializer): password = serializers.CharField(write_only=True, required=False) confirm_password = serializers.CharField(write_onl...
bewallyt/Classy
authentication/serializers.py
Python
mit
1,481
0.000675
#!/usr/bin/python # coding=utf-8 # Simple Steam profile checker Telegram bot # Copyright (c) 2017 EasyCoding Team # # 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 Licen...
xvitaly/stmbot
stmbot/checker.py
Python
gpl-3.0
5,895
0.002969
# -*- coding: utf-8 -*- """ Tablib - JSON Support """ import tablib import sys from tablib.packages import omnijson as json title = 'json' extentions = ('json', 'jsn') def export_set(dataset): """Returns JSON representation of Dataset.""" return json.dumps(dataset.dict) def export_book(databook): "...
justinpotts/mozillians
vendor-local/lib/python/tablib/formats/_json.py
Python
bsd-3-clause
991
0
"""Support for Nest devices.""" from datetime import datetime, timedelta import logging import socket import threading from nest import Nest from nest.nest import APIError, AuthorizationError import voluptuous as vol from homeassistant import config_entries from homeassistant.const import ( CONF_BINARY_SENSORS, ...
leppa/home-assistant
homeassistant/components/nest/__init__.py
Python
apache-2.0
14,138
0.000637
# -*- coding: utf-8 -*- import os import django from .fixtures import * # noqa # import pytest os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") def pytest_configure(config): django.setup()
pythonindia/junction
tests/conftest.py
Python
mit
212
0
#!/usr/bin/env python # # Copyright 2014 (c) Lei Xu <eddyxu@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
vsfs/vsfs-bench
ec2/fabfile.py
Python
apache-2.0
3,913
0
""" This file tests the MNISTPlus class. majorly concerning the X and y member of the dataset and their corresponding sizes, data scales and topological views. """ from pylearn2.datasets.mnistplus import MNISTPlus from pylearn2.space import IndexSpace, VectorSpace import unittest from pylearn2.testing.skip import skip_...
JazzeYoung/VeryDeepAutoEncoder
pylearn2/pylearn2/datasets/tests/test_mnistplus.py
Python
bsd-3-clause
1,978
0