code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
#!/usr/bin/python # -*- coding: utf-8 -*- from dockpulp import Pulp, cli import pytest import os import json import logging from flexmock import flexmock # wrapper classes class testbOpts(object): def __init__(self, server="testserv", config_file="testconf", debug=False, cert=True, key=True): ...
breillyr/dockpulp
tests/test_cli.py
Python
gpl-3.0
13,085
''' -- imports from python libraries -- ''' # from datetime import datetime import datetime import json ''' -- imports from installed packages -- ''' from django.http import HttpResponseRedirect # , HttpResponse uncomment when to use from django.http import HttpResponse from django.http import Http404 from django.sho...
olympian94/gstudio
gnowsys-ndf/gnowsys_ndf/ndf/views/course.py
Python
agpl-3.0
64,077
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
bdrillard/spark
python/pyspark/mllib/tests/test_feature.py
Python
apache-2.0
7,210
#!/usr/bin/env python2 ## # PyChat # https://github.com/leosartaj/PyChat.git # # Copyright (c) 2014 Sartaj Singh # Licensed under the MIT license. ## import unittest from PyChat.client.gui.helper.helperFunc import validate_host class TestValidateHost(unittest.TestCase): """ tests the validate_host function i...
leosartaj/PyChat
PyChat/client/gui/helper/tests/tests_helperFunc/test_validate_host.py
Python
mit
1,055
from sdf import * IMAGE = 'examples/butterfly.png' w, h = measure_image(IMAGE) f = rounded_box((w * 1.1, h * 1.1, 0.1), 0.05) f |= image(IMAGE).extrude(1) & slab(z0=0, z1=0.075) f.save('image.stl')
fogleman/sdf
examples/image.py
Python
mit
202
from django.forms.formsets import BaseFormSet, formset_factory from django.forms.models import BaseModelFormSet from django.forms.models import modelformset_factory from django import forms from models import PlanillaHistoricas, ConceptosFolios, Folios, Tomos class PlanillaHistoricasForm(forms.Form): codi_empl_pe...
heraldmatias/django-payroll
src/inei/planilla/forms.py
Python
gpl-3.0
3,110
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** from . import AWSObject, AWSProperty, PropsDictType from .validators import boolean class S3(AWSProperty): """ `S3 <http://docs.aws.amazon...
cloudtools/troposphere
troposphere/codestar.py
Python
bsd-2-clause
1,389
# # Copyright (C) 2015 FreeIPA Contributors see COPYING for license # from __future__ import print_function import errno import logging import os import pickle import shutil import sys import tempfile import textwrap import six from ipalib.install import certmonger, sysrestore from ipapython import ipautil from ip...
apophys/freeipa
ipaserver/install/server/install.py
Python
gpl-3.0
44,536
from django.core.management.base import BaseCommand from tracking.utils_salt import salt_load_computers class Command(BaseCommand): help = 'Loads data from Salt (minions/grains).' def handle(self, *args, **options): salt_load_computers()
rockychen-dpaw/oim-cms
tracking/management/commands/salt_load_data.py
Python
apache-2.0
257
""" Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score. For example...
pgrm/project-euler
0001-0050/22-Names_scores.py
Python
apache-2.0
999
# Copyright 2014 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
VitalLabs/gcloud-python
gcloud/_testing.py
Python
apache-2.0
2,090
from django.core.management.base import BaseCommand from firecares.firestation.models import FireDepartment from firecares.tasks.update import calculate_department_census_geom class Command(BaseCommand): help = """Calculates and caches owned department boundaries based on census tracts that had a incidents respon...
FireCARES/firecares
firecares/firestation/management/commands/calc-department-owned-tracts.py
Python
mit
872
# =============================================================================== # Copyright 2011 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/licens...
USGSDenverPychron/pychron
pychron/managers/motion_controller_managers/motion_controller_manager.py
Python
apache-2.0
7,482
import csv import random import sys import numpy as np from src.gen_prog import GP def rename(new_name): def decorator(f): f.__name__ = new_name return f return decorator @rename("({0} + {1})") def add(x, y): return x + y @rename("({0} - {1})") def sub(x, y): return x - y @ren...
juanpablos/CC5114-Projects
Tarea 4/Main.py
Python
mit
2,973
"""Generic plugin support so we can find XBlocks. This code is in the Runtime layer. """ import functools import itertools import logging import pkg_resources from xblock.internal import class_lazy log = logging.getLogger(__name__) PLUGIN_CACHE = {} class PluginMissingError(Exception): """Raised when trying ...
GbalsaC/bitnamiP
venv/lib/python2.7/site-packages/xblock/plugin.py
Python
agpl-3.0
5,882
from flask import Flask, request, Response import prometheus_client from prometheus_client import start_http_server, Counter REQUEST_COUNT = Counter('request_count', 'App Request Count', ['app_name', 'method', 'endpoint', 'http_status']) app = Flask(__name__) CONTENT_TYPE_LATEST = str('text/plain; version=0.0...
amitsaha/python-web-app-recipes
telemetry/prometheus/flask/app1.py
Python
mit
827
"OrderPortal: Load all CouchDB database design documents." from __future__ import print_function, absolute_import import os import sys import couchdb from orderportal import constants from orderportal import utils def load_designs(db, root=None, verbose=False): "Load all CouchDB database design documents." ...
ewels/OrderPortal
orderportal/scripts/load_designs.py
Python
mit
3,124
from roompi.modules import RoomPiModule class SomeModule(RoomPiModule): module_name = 'SomeModule' requires_thread = True
corvis/heats-roompi
testpackage/somemodule/__init__.py
Python
gpl-2.0
131
from gourmet.plugin import PrefsPlugin from gourmet.prefs import get_prefs import gtk from gettext import gettext as _ from constants import PREF_NOTEBOOK, PREF_DEVTOKEN, DEFAULT_NOTEBOOK class SL2EvernotePrefs (PrefsPlugin): """ A preference pane for the evernote shopping lists plugin. It is where the us...
nephlm/evernoteShopping
gourmet/plugins/sl2evernote/sl2evernotePrefs.py
Python
gpl-2.0
4,606
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. version_info = (4, 0, 6) __version__ = '.'.join(map(str, version_info))
bdh1011/wau
venv/lib/python2.7/site-packages/jupyter_core/version.py
Python
mit
175
## # Copyright (c) 2012-2015 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
red-hood/calendarserver
txdav/common/datastore/test/test_oracle_sql.py
Python
apache-2.0
2,777
#!/usr/bin/env python # -*- coding: utf-8 -*- def ShowResults(urls,array_ip,target, option): newlist=[] ip = "" contador = 0 try: if option == 1: print "\n Domains and subdomains of "+ str(target) + " are:" #Read the list to print the value in a line for i in urls: ip = array_ip[contador...
n4xh4ck5/N4xD0rk
modules/showresults/showresults.py
Python
gpl-3.0
753
from werkzeug.security import (generate_password_hash, check_password_hash) from sqlalchemy import text from models import User, Playlist import json def user_exists(engine, user): ''' Checks to see if a username already exists ''' sql = text('SELECT COUNT(*) FROM users WHERE username=:user') with engine....
DropMuse/DropMuse
app/db_utils.py
Python
mit
18,390
from typing import Callable, Iterable, TYPE_CHECKING, overload, Any, cast, Mapping, Optional import gi from blueman.main.indicators.IndicatorInterface import IndicatorInterface gi.require_version("Gtk", "3.0") from gi.repository import Gtk from blueman.Functions import create_menuitem if TYPE_CHECKING: from typ...
blueman-project/blueman
blueman/main/indicators/GtkStatusIcon.py
Python
gpl-3.0
3,623
# -*- encoding: utf-8 -*- from supriya.tools import osctools from supriya.tools.requesttools.Request import Request class StatusRequest(Request): r'''A /status request. :: >>> from supriya.tools import requesttools >>> request = requesttools.StatusRequest() >>> request Status...
andrewyoung1991/supriya
supriya/tools/requesttools/StatusRequest.py
Python
mit
1,106
__author__ = 'alisonbnt' from flask import g, jsonify from flask_restful import Resource from app import db from conf.auth import auth from app.resources import parser from app.models.UserModel import User class UsersResource(Resource): @staticmethod @auth.login_required def get(): return jsonif...
processos-2015-1/api
app/resources/user_resource.py
Python
mit
2,417
# -*- coding: utf-8 -*- """ This is the common settings file, intended to set sane defaults. If you have a piece of configuration that's dependent on a set of feature flags being set, then create a function that returns the calculated value based on the value of FEATURES[...]. Modules that extend this one can change th...
miptliot/edx-platform
lms/envs/common.py
Python
agpl-3.0
112,268
# -*- coding: utf-8 -*- """ /*************************************************************************** Name : Catalog on the fly Description : Automatically adds images that are in the catalog layer that intersect with the map area. Date : April, 2015 copyright : (...
lmotta/catalog-on-the-fly
__init__.py
Python
gpl-2.0
3,754
################################################################################ # copyright 2010 Lucas Baudin <xapantu@gmail.com> # # # # This file is part of Ultimate Smash Friends. ...
tshirtman/ultimate-smash-friends
usf/widgets/spinner.py
Python
gpl-3.0
6,964
import html import os import jinja2 from PyQt5 import QtCore, QtGui, QtWidgets import util from fa import maps class GameView(QtCore.QObject): """ Helps with displaying games in the game widget. Forwards interaction with the view. """ game_double_clicked = QtCore.pyqtSignal(object) def __in...
FAForever/client
src/games/gameitem.py
Python
gpl-3.0
8,871
import pytest """ Order is important currently: self._get_packages() self._create_package() self._get_package() self._find_package() self._copy_package() self._rename_package() self._remove_package() """ @pytest.fixture() def create_package(remote, token): """ Adds a "testpackage0" for a test. :param rem...
jmaas/cobbler
tests/xmlrpcapi/package_test.py
Python
gpl-2.0
3,261
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Sorna documentation build configuration file, created by # sphinx-quickstart on Tue Jul 28 20:12:45 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 # auto...
lablup/sorna-manager
docs/conf.py
Python
lgpl-3.0
9,232
# -*- coding: utf-8 -*- ################################################################################ # Copyright (C) 2012 Travis Shirk <travis@pobox.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 So...
daltonsena/eyed3
src/eyed3/id3/apple.py
Python
gpl-2.0
2,111
from django.conf.urls import * urlpatterns = patterns('basic.messages.views', url(r'(?P<mailbox>inbox|trash|sent)/$', view='message_list', name='messages'), url(r'compose(?:/(?P<content_type_id>\w+):(?P<object_id>\w+))?/$', view='message_create', name='create'), url(r'rem...
hittu123/ruhive
src/basic/messages/urls.py
Python
mit
691
#coding: utf-8 import csv import threading import lucene from lucene import getVMEnv print "预处理" INDEX_DIR = '../index/' nt = 100000 WRITE_DIR = "../data/mult/" lucene.initVM() directory = lucene.SimpleFSDirectory(lucene.File(INDEX_DIR)) analyzer = lucene.StandardAnalyzer(lucene.Version.LUCENE_CURRENT) class sub...
lavizhao/keyword
lucene/mult_search.py
Python
apache-2.0
2,456
""" A Printer for generating executable code. The most important function here is srepr that returns a string so that the relation eval(srepr(expr))=expr holds in an appropriate environment. """ from printer import Printer from sympy.core import Basic import sympy.mpmath.libmp as mlib from sympy.mpmath.libmp import p...
tarballs-are-good/sympy
sympy/printing/repr.py
Python
bsd-3-clause
4,037
from datetime import datetime from http import client from unittest import skipIf import uuid from django.urls import reverse from rest_framework.test import APITestCase from common.models import ( CassandraFamilyMember, CassandraThing, CassandraThingMultiplePK, ) from common.serializers import CassandraF...
r4fek/django-cassandra-engine
testproject/common/tests/test_drf.py
Python
bsd-2-clause
4,079
# -*- coding: utf-8 -*- from operator import attrgetter from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType from pyangbind.lib.yangtypes import RestrictedClassType from pyangbind.lib.yangtypes import TypedListType from pyangbind.lib.yangtypes import YANGBool from pyangbind.lib.yangtypes import YANGListTy...
napalm-automation/napalm-yang
napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/isis_neighbor_attribute/neighbors/neighbor/undefined_subtlvs/undefined_subtlv/state/__init__.py
Python
apache-2.0
26,641
# -*- coding: utf-8 -*- # Copyright 2014, Digital Reasoning # # 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...
stackdio/stackdio-python-client
stackdio/client/version.py
Python
apache-2.0
3,425
########################################################################## # # # Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios), # its affiliates and/or its licensors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the fo...
lento/cortex
contrib/for_review/SkeletonPrimitive_DrD/py_SkeletonPrimitiveIO/exportSkeletonFromMaya.py
Python
bsd-3-clause
2,235
class Program(object): pass
Neppord/py2py
py2py_lib/ast/program.py
Python
mit
30
#!/usr/bin/python import sys import os pin = int(os.environ['UMLFRI_PIN']) pout = int(os.environ['UMLFRI_POUT']) if os.name == 'nt': import msvcrt pin = msvcrt.open_osfhandle(pin, os.O_RDONLY) pout = msvcrt.open_osfhandle(pout, os.O_APPEND) sys.path.insert(0, os.environ['UMLFRI_PATH']) sys.path.append(o...
umlfri/umlfri2
addons/python_starter/starter/python_runner.py
Python
gpl-3.0
1,044
# coding=utf-8 # Copyright 2021 The Deadunits 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
google-research/deadunits
deadunits/generic_convnet.py
Python
apache-2.0
13,192
#!/usr/bin/env python2 import sys import os.path import argparse import json import shutil from urllib2 import build_opener, HTTPCookieProcessor, Request, HTTPHandler from urllib import urlencode from cookielib import CookieJar from tempfile import mkstemp from contextlib import closing from subprocess import Popen, P...
baverman/accuradio
accuradio.py
Python
mit
3,370
from nose.tools import make_decorator from utils import clear_users as clear_users_func def clear_users(func): ''' Calls cheddar's delete all users method no matter the test result ''' def new(*args, **kwargs): try: func(*args, **kwargs) except Exception: clear...
smartfile/sharpy
tests/testing_tools/decorators.py
Python
bsd-3-clause
433
# -*- coding: utf-8 -*- # ------------------------------------------------------------ # pelisalacarta - XBMC Plugin # Conector para turbobit # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ # ------------------------------------------------------------ import re from core import logger def get_video_url(pa...
neno1978/pelisalacarta
python/main-classic/servers/turbobit.py
Python
gpl-3.0
1,263
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import accounting_assert_test
Aravinthu/odoo
addons/account_test/models/__init__.py
Python
agpl-3.0
137
""" beam_block.core.beam_block_json =============================== Calculates partial beam block(PBB) and cumulative beam block(CBB) by using wradlib's beamblock and geotiff functions. PBB and CBB are then used to created flags when a certain beam block fraction is passed. This code is adapted from code written by K...
zssherman/beam_block
beam_block/core/beam_block_json.py
Python
bsd-2-clause
4,656
from __future__ import print_function import sys import os import os.path import fnmatch import json import shlex try: import fcntl def flock(fp): fcntl.flock(fp.fileno(), fcntl.LOCK_EX) def funlock(fp): fcntl.flock(fp.fileno(), fcntl.LOCK_UN) except: import msvcrt def flock(fp)...
roc-project/roc
scripts/wrappers/clangdb.py
Python
mpl-2.0
2,108
import networkx as nx import copy from nose.tools import assert_equals from regraph import (print_graph, NXGraph) # from regraph.utils import assert_nx_graph_eq from regraph.category_utils import (pullback, pushout, pullback_...
Kappa-Dev/ReGraph
tests/test_category_utils.py
Python
mit
5,768
# Copyright 2019 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
cloudspannerecosystem/sampledb
batch_import.py
Python
apache-2.0
3,617
# -*- coding: utf-8 -*- import io import os import pytest import six from anymarkup_core import * from test import * class TestSerialize(object): """Note: testing serialization is a bit tricky, since serializing dicts can result in different order of values in serialized string in different runs. That ...
bkabrda/anymarkup-core
test/test_serialize.py
Python
bsd-3-clause
3,156
from __future__ import absolute_import import unittest from dynamodb_mapper.model import DynamoDBModel from dynamodb_mapper.migration import Migration, VersionError # test case: field rename rename class UserMigration(Migration): def check_1(self, raw_data): field_count = 0 field_count += u"id" i...
sxnol/dynamodb2-mapper
dynamodb2_mapper/tests/test_migrations.py
Python
lgpl-3.0
4,804
# ./_iso639a2.py # -*- coding: utf-8 -*- # PyXB bindings for NM:49097258e5c38f24397bbfa3fe9b068fcbb13543 # Generated 2015-07-06 15:53:56.868489 by PyXB version 1.2.4 using Python 2.7.6.final.0 # Namespace http://ddex.net/xml/20120719/iso639a2 [xmlns:iso639a2] from __future__ import unicode_literals import pyxb import ...
Trax-air/ddexreader
ddexreader/ern35/_iso639a2.py
Python
mit
20,867
"""Database for simulation data in a relational database """ import threading import os from functools import total_ordering import numpy as np from sqlalchemy import create_engine, and_, or_ from sqlalchemy.orm import sessionmaker, undefer from sqlalchemy import Column, Integer, Float, PickleType, String from sqlalc...
matthewghgriffiths/nestedbasinsampling
nestedbasinsampling/storage/database.py
Python
gpl-3.0
54,976
# Copyright 2018 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...
tensorflow/tensorflow
tensorflow/python/autograph/pyct/static_analysis/reaching_definitions.py
Python
apache-2.0
9,095
# coding=utf-8 import random import time import threading import unittest from lru_cache import LruCache class TesLruCache(unittest.TestCase): def test_cache_normal(self): a = [] @LruCache(maxsize=2, timeout=1) def foo(num): a.append(num) return num foo(1)...
Backflipz/plugin.video.excubed
resources/lib/cache/tests.py
Python
gpl-2.0
4,445
#!/usr/bin/env python2.6 # -*- coding: utf-8 -*- #!/usr/bin/env python # # Software License Agreement (GPLv2 License) # # Copyright (c) 2012 TheCorpora SL # # 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...
HailStorm32/Q.bo_stacks
qbo_webi/src/voiceRecognition/voiceRecognition.py
Python
lgpl-2.1
10,125
import numpy as np import os import sys sys.path.append(os.path.abspath("../../python/KMeansRex")) import KMeansRex def make_data(n_examples_per_cluster=20, seed=0): prng = np.random.RandomState(int(seed)) x1 = -5 + 0.1 * prng.randn(n_examples_per_cluster, 2) x2 = 0 + 0.1 * prng.randn(n_examples_per_clust...
michaelchughes/KMeansRex
examples/python/simple_demo.py
Python
bsd-3-clause
738
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistribu...
AustinRoy7/Pomodoro-timer
venv/Lib/site-packages/pyglet/info.py
Python
mit
7,680
class AppConsumer(): """ The interface for common application consumers (e.g. sequence number based and timestamp based) :param face: the face to consume data with :type face: Face :param keyChain: the keyChain to verify received data with :type keyChain: KeyChain :param doVerify: flag ...
remap/ndn-flow
framework/ndn_iot_python/python/ndn_iot_python/consumer/app_consumer.py
Python
lgpl-3.0
1,272
from __future__ import with_statement import logging import struct import threading import time from hazelcast.config import PROPERTY_HEARTBEAT_INTERVAL, PROPERTY_HEARTBEAT_TIMEOUT from hazelcast.core import CLIENT_TYPE from hazelcast.exception import AuthenticationError from hazelcast.future import ImmediateFuture fro...
cangencer/hazelcast-python-client
hazelcast/connection.py
Python
apache-2.0
9,386
""" This plugin captures logging statements issued during test execution. When an error or failure occurs, the captured log messages are attached to the running test in the test.capturedLogging attribute, and displayed with the error failure output. It is enabled by default but can be turned off with the option ``--nol...
Reagankm/KnockKnock
venv/lib/python3.4/site-packages/nose/plugins/logcapture.py
Python
gpl-2.0
9,358
# coding: utf-8 """zmq poll function""" # Copyright (C) PyZMQ Developers # Distributed under the terms of the Modified BSD License. from ._cffi import C, ffi, zmq_version_info from .constants import * from zmq.error import _check_rc def _make_zmq_pollitem(socket, flags): zmq_socket = socket._zmq_socket zm...
kalikaneko/pyzqm-deb
zmq/backend/cffi/_poll.py
Python
lgpl-3.0
1,830
#!/usr/bin/env python from jpb.utils import * from jpb.source_provider import get_source_provider import jpb.source_provider.rpmbuild as rpmbuild import jpb.utils.rpm as rpm from jpb.utils.log import init_logging import os import sys import glob import logging import platform from jpb.repo_provider.createrepo import cr...
bmiklautz/jenkins-package-builder
jpb/cli/__init__.py
Python
mit
4,012
# print string "This program is to convert cm's to inches" print "This program is to convert cm's to inches" # declare variable inch which stores value 0.393701 inch = 0.393701 # declare variable cm1 which stores value cm1 = 25 inch1 = 30 s1 = "You know 1 cm is %0.3f inches" % inch print s1 s2 = "what is %d cms in ...
mrniranjan/python-scripts
reboot/math10.py
Python
gpl-2.0
568
# oppia/tests/tracker/test_tracker.py from django.contrib.auth.models import User from django.test import TestCase from django.test.client import Client
DigitalCampus/django-nurhi-oppia
oppia/tests/activitylog/test_activitylog.py
Python
gpl-3.0
153
"""A reference implementation of graddfril desktop aggregator. Handles buffering of data from grabbing modules and sending it to storage server. """
graddfril/desktop.grabber-aggregator-refimpl
graddfril/desktop/grabber_aggregator_refimpl/__init__.py
Python
agpl-3.0
150
# -*- coding: utf-8 -*- # Copyright 2016, 2017 Mircea Ulinic. All rights reserved. # # The contents of this file are 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/lice...
mirceaulinic/py-dhcp-relay
dhcp_relay/relay.py
Python
gpl-3.0
5,556
import json from pprint import pprint import time import io # from http://www.codigomanso.com/en/2011/05/trucomanso-transformar-el-tiempo-en-formato-24h-a-formato-12h-python/ def ampmformat (hhmmss): """ This method converts time in 24h format to 12h format Example: "00:32" is "12:32 AM" "13...
inachen/cs171-hw4-chen-ina
ProblemGeoUSA/data_wrangle_total.py
Python
mit
1,779
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import re import copy from parser_exception import ParserException import utils import xml_utils VALID_UNDERLYING_TYPES_FOR_ENUMS = [ 'int8_t', 'uint8_t', 'int16_t', 'uint16_t', 'int32_t', 'uint32_t', 'int64_t', 'uint64_t' ] # Not allowed are 'float' and 'char' class...
dergraaf/xpcc
tools/system_design/xmlparser/type.py
Python
bsd-3-clause
14,044
""" (This script is not generally useful for most ilastik users or developers.) Input: hdf5 volume Output: directory of .png tiles representing the volume. """ if __name__ == "__main__": import sys import h5py import logging import argparse from lazyflow.utility import PathComponents, ex...
stuarteberg/lazyflow
bin/make_tiles.py
Python
lgpl-3.0
1,058
# -*- coding: utf-8 -*- #+---------------------------------------------------------------------------+ #| 01001110 01100101 01110100 01111010 01101111 01100010 | #| | #| Netzob : Inferring communication protocol...
nagyistoce/netzob
src/netzob_plugins/Capturers/NetworkCapturer/NetworkCapturer/NetworkCapturerController.py
Python
gpl-3.0
7,440
# -*- 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): # Changing field 'AuthoredData.user' db.alter_column(u'dingos_authoring_authoreddata', 'user_id', self.gf('...
siemens/django-dingos-authoring
dingos_authoring/south_migrations/0006_auto__chg_field_authoreddata_user.py
Python
gpl-2.0
17,097
#!/usr/bin/env python # coding=utf-8 import random import time import urllib import hmac import hashlib import binascii import base64 import cos_cred class Auth(object): def __init__(self, cred): self.cred = cred def app_sign(self, bucket, cos_path, expired, upload_sign=True): appid = se...
tencentyun/cos-python-sdk
qcloud_cos/cos_auth.py
Python
mit
2,321
"""W3C Document Object Model implementation for Python. The Python mapping of the Document Object Model is documented in <...>. This package contains the following modules: minidom -- A simple implementation of the Level 1 DOM with namespace support added (based on the Level 2 specification). """
atmark-techno/atmark-dist
user/python/Lib/xml/dom/__init__.py
Python
gpl-2.0
313
import random CHARS = 'abcdefghijkmnpqrstuvwxyz3456789' CURSE_CHARS = 'csfhuit' NO_CURSE_CHARS = list(set(CHARS).difference(set(CURSE_CHARS))) __all__ = ['randomish_id'] def randomish_id(length=6): s = '' # Algorithm for avoiding English curse words taken from Hashids # (<http://hashids.org>). for _...
editorsnotes/editorsnotes
editorsnotes/main/utils/randomish_id.py
Python
agpl-3.0
458
import sys def swap_numbers(word): return word[-1] + word[1:-1] + word[0] def main(): test_cases = open(sys.argv[1], 'r') for test in test_cases: print(' '.join([swap_numbers(word) for word in test.strip().split(' ')])) test_cases.close() if __name__ == '__main__': main()
mpillar/codeeval
0-easy/swap-numbers/main.py
Python
unlicense
304
# -*- coding: utf-8 -*- import pytest from datetime import datetime from wasp_general.task.thread import WThreadTask from wasp_general.datetime import utc_datetime from wasp_general.task.scheduler.proto import WScheduleTask, WScheduleRecord, WTaskSourceProto from wasp_general.task.scheduler.proto import WRunningReco...
a1ezzz/wasp-general
tests/wasp_general_task_scheduler_proto_test.py
Python
lgpl-3.0
2,491
# # Copyright 2013 Hewlett-Packard Development Company, L.P. # 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...
bbandaru/heat-cfntools
heat_cfntools/tests/test_cfn_helper.py
Python
apache-2.0
49,595
""" Views related to course tabs """ from Crypto.Cipher import DES import base64 from access import has_course_access from util.json_request import expect_json, JsonResponse from django.conf import settings from django.http import HttpResponseNotFound from django.contrib.auth.decorators import login_required from dja...
XiaodunServerGroup/xiaodun-platform
cms/djangoapps/contentstore/views/tabs.py
Python
agpl-3.0
8,469
# -*- 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 'Resource.resource_type' db.delete_column('curated_resources_resource', 'resource_type_id')...
evildmp/django-curated-resources
curated_resources/migrations/0007_auto__del_field_resource_resource_type.py
Python
bsd-2-clause
9,905
import numpy import matplotlib.pyplot as plot X = numpy.linspace(-3, 2, 200) Y = X ** 2 - 2 * X + 1. plot.plot(X, Y) plot.show()
moonbury/notebooks
github/MatplotlibCookbook/Chapter 1/03.py
Python
gpl-3.0
131
#!/usr/bin/env python # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Given a GYP/GN filename, sort C-ish source files in that file. Shows a diff and prompts for confirmation before doing the deed. Wor...
hujiajie/chromium-crosswalk
tools/sort_sources.py
Python
bsd-3-clause
5,062
# -*- coding: utf-8 -*- """ <DefineSource> @Date : Fri Nov 14 13:20:38 2014 \n @Author : Erwan Ledoux \n\n </DefineSource> The Printer is an object that can directly print Strs in the Printer context. """ #<DefineAugmentation> import ShareYourSystem as SYS BaseModuleStr="ShareYourSystem.Standards.Interfacers.In...
Ledoux/ShareYourSystem
Pythonlogy/build/lib/ShareYourSystem/Standards/Interfacers/Printer/__init__.py
Python
mit
26,126
# 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 https://mozilla.org/MPL/2.0/. import os from pathlib import Path import sys import importlib from sisl.messages import warn from sisl._environ import...
zerothi/sisl
sisl/viz/backends/plotly/_user_customs.py
Python
mpl-2.0
3,819
# -*- coding: utf-8 -*- # © 2016 Alessandro Fernandes Martini, Trustcode # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import res_partner
Trust-Code/trust-addons
partner_wkf/models/__init__.py
Python
agpl-3.0
170
from tree.tree import TreeNode class AvlTree(object): """ An avl tree. """ def __init__(self): # Root node of the tree. self.node = None self.height = -1 self.balance = 0 def insert(self, key): """ Insert new key into node """ # Cre...
amaozhao/algorithms
algorithms/tree/avl/avl.py
Python
mit
3,411
import sys import collections as c from scipy import special, stats import numpy as n, pylab as p, networkx as x class NetworkDrawer: drawer_count=0 def __init__(self,metric="strength"): self.drawer_count+=1 metric_=self.standardizeName(metric) self.metric_=metric_ self.draw_cou...
ttm/gmaneLegacy
gmaneLegacy/networkDrawer.py
Python
unlicense
7,293
""" Team Testing Module """ import pytest import api.user import api.team import api.common import bcrypt from api.common import WebException, InternalException from common import clear_collections, ensure_empty_collections from common import base_team, base_user from conftest import setup_db, teardown_db dict_filte...
alpire/picoCTF-web
unit_tests/team_test.py
Python
mit
4,330
from django.db import models from edc_appointment.models import AppointmentMixin from edc_base.audit_trail import AuditTrail from edc_base.model.models import BaseUuidModel from edc_base.model.validators import datetime_not_before_study_start, datetime_not_future from edc_base.model.validators.date import date_not_fut...
botswana-harvard/microbiome
microbiome/apps/mb_infant/models/infant_birth.py
Python
gpl-2.0
2,928
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import os from pex.interpreter import PythonInterpreter from pex.pex_builder import PEXB...
twitter/pants
src/python/pants/backend/python/tasks/python_binary_create.py
Python
apache-2.0
7,831
def caught(pyn, fpyn): fx, fy = fpyn.xy() return pyn.distance(fx, fy) <= 1
aresnick/pynguin
doc/examples_src/threaded_pynd/00015.py
Python
gpl-3.0
83
""" File Author: Will Lowry, Will Hescott File Creation Date: 1/28/2015 File Purpose: To create our drive functions Transmission gear ratio: 18.74/1 """ import wpilib from wpilib import CANTalon, Encoder, Timer, RobotDrive from wpilib.interfaces import Gyro from . import Component import hal class driveTrain(Compo...
Team74/FRC_2016_Python_Stronghold
components/drive.py
Python
gpl-3.0
14,598
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bep_bep.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
ChrisHartley/bep_bep
manage.py
Python
gpl-3.0
250
#!/usr/bin/env python import tensorflow as tf import edward as ed import numpy as np from numpy import array from numpy.linalg import norm from edward.models import Dirichlet, Multinomial, Gamma, Poisson sess = tf.Session() def build_toy_dataset(n, p, A, b): """ toy HMM with: n=number of timesteps,...
kyjohnso/mlbslice
hmm_sandbox.py
Python
bsd-2-clause
3,478
# (c) 2017 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 dis...
tsdmgz/ansible
test/units/modules/cloud/amazon/test_cloudformation.py
Python
gpl-3.0
4,428
#!/usr/bin/env python # coding=utf-8 def process(a,b,add=0,sub=0,mut=0,div=0): if add==1: return a+b if sub==1: return a-b if mut ==1: return a*b if div ==1: return a/b print process(1,2,add=1) print process(1,2,sub=1) print process(1,2,mut=1)
zhaochl/python-utils
utils/fun_util.py
Python
apache-2.0
293
""" Django settings for qlinkplanner project. Generated by 'django-admin startproject' using Django 1.11.3. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ impo...
nickubels/qlinkplanner
qlinkplanner/settings.py
Python
mit
4,429
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals from collections import namedtuple import datetime from difflib import SequenceMatcher import logging import time from django.conf import settings from django.utils.timezone import now import magic i...
mozillazg/chendian-plus
chendian/book/utils.py
Python
mit
5,400