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
import sys # for windows # > python setup.py py2exe if sys.platform == 'win32' or sys.platform == 'cygwin': import py2exe from distutils.core import setup setup( name = "example-app", version = "0.0", console = ["example.py"] ) # for mac # > python setup.py py2app elif sys.plat...
Darkman/esky
tutorial/stage0/setup.py
Python
bsd-3-clause
541
from Box2D import * import numpy as np from gym import spaces import pygame from pygame.locals import QUIT, KEYDOWN, K_ESCAPE, K_UP, K_DOWN, K_RIGHT, K_LEFT from drl.env.environment import Environment class Maze(Environment): FORCE_SCALE = 50. TORQUE_SCALE = 100. PPM = 20.0 TARGET_FPS = 60 TIME_S...
BartKeulen/drl
drl/env/maze.py
Python
mit
8,592
""" This module contains the client socket API. This API is exposed to the user throught the backend manager ( :class:`pyqode.core.managers.BackendManager`) """ import locale import json import logging import socket import struct import sys import uuid from weakref import ref from pyqode.qt import QtCore, QtNetwork ...
pyQode/pyqode.core
pyqode/core/api/client.py
Python
mit
14,430
structs = 'sprite,canvas'.split(',') structs = [ 'struct ' + s for s in structs ] types = { 'int': 'i', 'char*': 's', } ignore = 'get_overview_area_dimensions gfx_fileextensions get_sprite_dimensions ' \ 'city_dialog_is_open get_text_size gui_set_rulesets add_idle_callback ' \ 'caravan_dialo...
eric-stanley/freeciv-android
genglue.py
Python
gpl-2.0
4,425
""" DISET request handler base class for the TransformationDB. """ __RCSID__ = "$Id$" from DIRAC import gLogger, S_OK, S_ERROR from DIRAC.Core.DISET.RequestHandler import RequestHandler from DIRAC.TransformationSystem.DB.TransformationDB import Tr...
marcelovilaca/DIRAC
TransformationSystem/Service/TransformationManagerHandler.py
Python
gpl-3.0
31,894
# -*- coding: utf-8 -*- # # Copyright (c) The PyAMF Project. # See LICENSE.txt for details. # # PyAMF documentation build configuration file. # # 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 file. # # All configura...
cardmagic/PyAMF
doc/conf.py
Python
mit
6,100
import json from tests.integration.util import IntegrationTestCase class InventoryIntegrationTestCase(IntegrationTestCase): def test_inventory_empty(self): client = self.get_client() self.register_and_login(client, "test_inventory_empty") client.send("inventory\r\n") response = jso...
ecdavis/spacegame
tests/integration/test_inventory.py
Python
apache-2.0
6,133
#!/usr/bin/env python # -*- coding: utf-8 -*- # from struct import pack,unpack from mmap import mmap def grampus_modulo(): return ("ext", mainPSD, ("psd",)) def mainPSD(nFile): xmlData = mapFile(nFile,500) return parseXml(xmlData[xmlData.find(">")+1:])#parseXml(mapFile(nFile,500)) def parseXml(xmlData): xmlDat...
overxfl0w/Grampus-Forensic-Utils
Metadata/Image/XMP/PSD/extractpsd.py
Python
gpl-2.0
1,306
import numpy as np def smallestPrimeDivisor( n ): primeTest = np.ones(np.ceil(pow(n,0.5))) primeTest[0] = 0 smallestPrimeLocation = np.where(primeTest==1) if (np.size(smallestPrimeLocation) != 0): smallestPrime = smallestPrimeLocation[0][0] + 1 while (n%smallestPrime != 0): ...
aerokappa/ProjectEuler
smallestPrimeDivisor.py
Python
mit
619
from django.template import Library, Node, TemplateSyntaxError, Variable register = Library() class Placeholder(Node): """ Simple placeholder node. """ @classmethod def parse(cls, parser, token): tokens = token.contents.split() if len(tokens) == 2: return cls(Variable...
edoburu/django-template-analyzer
template_analyzer/templatetags/template_analyzer_test_tags.py
Python
bsd-3-clause
807
# Comprend un SparkSession mais aussi SparkContext que avant from pyspark.sql import SparkSession from pyspark.sql.functions import col if __name__ == "__main__": spark = SparkSession.builder.appName("SparkQuery").getOrCreate() # Convert data to Spark Dataset salesDataset = spark.read.option("header","t...
PrincessMadMath/LOG8415-Advanced_Cloud
TP2/Sources/SparkQuery/q5_SpecificPurchaseCount.py
Python
mit
720
import attr from property_manager import cached_property from .component import Component from .contents import parse_contents from .internals import unprefix @attr.s class Suite: # not for public construction archive = attr.ib() name = attr.ib() release = attr.ib() d...
jwodder/aptrepo
src/aptrepo/suite.py
Python
mit
1,391
# coding=utf-8 """General settings for feature tests.""" from fuzzing.log import LoggerFactory def before_all(context): """Set up before all tests. Initialize the logger framework. :param context: test context. """ lf = LoggerFactory(config_file='../features/resources/test_config.yaml') lf....
stbraun/fuzzing
features/environment.py
Python
mit
483
# cat command that also produced stderr output, for testing import sys import time import logging if __name__ == "__main__": for line in sys.stdin: print line, logging.warn(line.strip())
TeamCohen/GuineaPig
mrs_test/caterr.py
Python
lgpl-3.0
208
from anastruct.fem.system import SystemElements ss = SystemElements() ss.add_element([0, 10]) ss.add_element([5, 10]) ss.add_element([5, 0]) ss.add_support_hinged(1) ss.add_support_hinged(4) ss.point_load(2, Fy=-10, rotation=30) if __name__ == "__main__": ss.show_structure()
ritchie46/anaStruct
anastruct/fem/examples/ex_21_rotate_force.py
Python
gpl-3.0
285
import re from kraken.core.maths import Vec3 from kraken.core.maths.xfo import Xfo, xfoFromDirAndUpV, aimAt from kraken.core.maths.rotation_order import RotationOrder from kraken.core.maths.constants import * from kraken.core.objects.components.base_example_component import BaseExampleComponent from kraken.core.obj...
oculusstorystudio/kraken
Python/OSS/OSS_hand_component.py
Python
bsd-3-clause
28,212
import asyncio def create_remote_signal_actor(ray): # TODO(barakmich): num_cpus=0 @ray.remote class SignalActor: def __init__(self): self.ready_event = asyncio.Event() def send(self, clear=False): self.ready_event.set() if clear: self.re...
ray-project/ray
python/ray/tests/client_test_utils.py
Python
apache-2.0
863
# -*- coding: utf-8 -*- import cPickle import sys, os import numpy as np # written by zhaowuxia @ 2015/5/22 # used for generate datasets for the adding problem def generate_data(pkl_path, T, norm): dataset = [] for f in os.listdir(pkl_path): data = cPickle.load(open(os.path.join(pkl_path, f), 'rb')) ...
Dlyma/keras-plus
keras/datasets/stock.py
Python
mit
1,315
try: from setuptools import setup except ImportError: from distutils.core import setup config = { 'description': '', 'author': 'Forrest Alvarez', 'url': 'https://github.com/gravyboat/planet-rest-api', 'version': '1.0', 'install_requires': ['flask'], 'packages': ['planet-rest-api'], 'scr...
gravyboat/planet-rest-api
setup.py
Python
mit
380
from django.contrib import admin # Register your models here. from .models import Page from .models import Home admin.site.register(Home) admin.site.register(Page)
epl692/django-project
test_base/pages/admin.py
Python
gpl-3.0
167
#!/usr/bin/python import sys import os import getopt from lothar import * from testcases import motortest, ultrasoundtest, lighttest, touchtest, colortest # helper functions for getopt def usage(out): out.write('''Usage: manualtest.py [options] testcase where testcase can be any of: motor : basic motor test ...
klaasjacobdevries/lothar
tests/manualtest.py
Python
mit
2,881
import json from flask import url_for from flask_restplus import schemas from udata.tests.helpers import assert200 class SwaggerBlueprintTest: modules = [] def test_swagger_resource_type(self, api): response = api.get(url_for('api.specs')) assert200(response) swagger = json.loads(re...
opendatateam/udata
udata/tests/api/test_swagger.py
Python
agpl-3.0
763
# Copyright 2013 VMware, 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 a...
igor-toga/local-snat
neutron/tests/unit/objects/network/extensions/test_port_security.py
Python
apache-2.0
1,496
## Copyright (C) 2011 Stellenbosch University ## ## This file is part of SUCEM. ## ## SUCEM 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 v...
cemagg/sucem-fem
examples/resonant_cavity/driver.py
Python
gpl-3.0
3,718
#!/usr/bin/env python # Time-stamp: <2019-09-25 14:44:07 taoliu> import io import unittest from numpy.testing import assert_equal, assert_almost_equal, assert_array_equal from MACS2.IO.ScoreTrack import * from MACS2.IO.BedGraph import bedGraphTrackI class Test_TwoConditionScores(unittest.TestCase): def setUp(se...
taoliu/MACS
test/test_ScoreTrack.py
Python
bsd-3-clause
8,251
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
quantumlib/OpenFermion-FQE
tests/util_test.py
Python
apache-2.0
10,767
import os import logging from .axle import split_package_name logger = logging.getLogger(__name__) class Path(object): def __init__(self, path): self.path = path @property def exists(self): return os.path.exists(self.path) class ReleaseValue(object): _md5 = '' def __init__(...
rob-b/belt
belt/values.py
Python
bsd-3-clause
1,091
import numpy as np def random_input_generator(num, batchsize=32, format='NHWC'): input_shape = (batchsize, 224, 224, 3) if format == 'NHWC' else (batchsize, 3, 224, 224) rng = np.random.RandomState(1234) for i in range(num): x = rng.uniform(0.0, 1.0, size=input_shape).astype(np.float32) y ...
zsdonghao/tensorlayer
tests/performance_test/vgg/exp_config.py
Python
apache-2.0
463
import json from zeropush.models import PushDevice from django.conf import settings from django.contrib.auth import authenticate from django.core.serializers.json import DjangoJSONEncoder from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import...
dogukantufekci/easyfind
easyfind/connect/views.py
Python
mit
2,907
#!/usr/bin/python """Html generators for the base uweb server""" import uweb import simplejson import subprocess import re import os import sys class PageMaker(uweb.DebuggingPageMaker): """Holds all the html generators for the webapp Each page as a separate method. """ def Index(self): """Returns the i...
mberntsen/uwebmanager
pages.py
Python
gpl-3.0
2,321
import logging import socket import urllib2 import calendar import atexit from threading import Lock, Thread, Timer from common.modules.Utils import touch LOG = logging.getLogger(__name__) class UpdateCRLThread(Thread): def __init__(self, crlFile, crlUrl, crlInterval, importFunc=None): """ Initi...
tumi8/sKnock
server/modules/Security/UpdateCRLThread.py
Python
gpl-3.0
3,229
import re import collections from enum import Enum from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI...
abhikeshav/ydk-py
ietf/ydk/models/ietf/_meta/_ietf_interfaces.py
Python
apache-2.0
29,579
import SourceBase from tkinter import * from tkinter import ttk import re class redditEarthporn(SourceBase.SourceBase): pluginid = '_r_EarthPorn' subreddit = 'EarthPorn' sourceurl = 'http://reddit.com/r/EarthPorn' def __init__(self): pass def load_plugin(self): '''This method is c...
Mgamerz/fsoi_plugins
FSOI_Plugins/Plugins/Reddit/redditEarthporn.py
Python
gpl-3.0
5,107
# ERPNext - web based ERP (http://erpnext.com) # Copyright (C) 2012 Web Notes Technologies Pvt Ltd # # 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 yo...
gangadhar-kadam/mtn-erpnext
website/page/unsubscribe/unsubscribe.py
Python
agpl-3.0
1,049
#!/usr/bin/env python traindat = '../data/fm_train_real.dat' testdat = '../data/fm_test_real.dat' parameter_list = [[traindat,testdat,2,10], [traindat,testdat,5,10]] def kernel_anova_modular (train_fname=traindat,test_fname=testdat,cardinality=2, size_cache=10): from modshogun import ANOVAKernel,RealFeatures,CSVFile ...
c4goldsw/shogun
examples/undocumented/python_modular/kernel_anova_modular.py
Python
gpl-3.0
717
# 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 # d...
vedujoshi/os_tempest
tempest/services/volume/json/snapshots_client.py
Python
apache-2.0
7,293
# -*- coding: utf-8 -*- import pandas as pd import sys from builtins import str as text from utils import find_zipcode, str2date header_mapping = { 'origin': 'ORIGIN', 'company_name': 'LABO', 'lastname_firstname': 'BENEF_PS_QUALITE_NOM_PRENOM', 'address': 'BENEF_PS_ADR', 'job': 'BENEF_PS_QUALIFIC...
regardscitoyens/sunshine-data
scripts/format_pharmaciens.py
Python
agpl-3.0
1,072
# -*- coding: utf8 -*- # # Created by 'myth' on 3/15/16 import unittest from copy import deepcopy import numpy as np import settings from modules.flatland import (DOWN, EMPTY, FOOD, LEFT, PLAYER, POISON, RIGHT, UP, Agent, FlatLand) from modules.nnet import ActivationFunction, Layer, Neur...
myth/trashcan
it3708/project3/tests.py
Python
gpl-2.0
12,163
import pytest import numpy as np from lucid.misc.io import load, save from lucid.misc.ndimage_utils import resize, composite @pytest.fixture() def image(): return load("./tests/fixtures/rgbeye.png") def test_resize(image): size = (3, 3) resized = resize(image, size) assert resized.shape[-3:-1] == ...
tensorflow/lucid
tests/misc/test_ndimage_utils.py
Python
apache-2.0
1,259
""" The core model """ import settings from tensorflow_model.nn import * from tensorflow_model.model_session import ModelSession import keras from keras.layers import Dense,Dropout savePath = settings.MODEL_STORE_PATH ITEM_DIM = 100 class Lenet_Model_Session(ModelSession): """ An OOP style ModelSession fo...
LuxxxLucy/mnist_LeNet
tensorflow_model/model.py
Python
mit
6,122
'''OpenGL extension EXT.texture_format_BGRA8888 This module customises the behaviour of the OpenGL.raw.GLES1.EXT.texture_format_BGRA8888 to provide a more Python-friendly API The official definition of this extension is available here: http://www.opengl.org/registry/specs/EXT/texture_format_BGRA8888.txt ''' from Op...
stack-of-tasks/rbdlpy
tutorial/lib/python2.7/site-packages/OpenGL/GLES1/EXT/texture_format_BGRA8888.py
Python
lgpl-3.0
821
"""do Androguard things Builds class_result dictionary, which contains class and method information and cross-references of code """ import logging from pprint import pprint import sys #from multiprocessing import Process, Queue from androguard.core.analysis.analysis import ExternalClass, ExternalMethod from Merca...
ehrenb/Mercator
Mercator/utils/ClassAnalysis.py
Python
mit
12,720
import gtk, pango from xml.sax.saxutils import escape from gettext import gettext as _ from generic_recipe_parser import RecipeParser import gourmet.gtk_extras.cb_extras as cb import gourmet.gglobals as gglobals import importer import re import gourmet.convert as convert from gourmet.threadManager import NotThreadSafe ...
Linutux/Gourmet
gourmet/importers/interactive_importer.py
Python
gpl-2.0
22,124
from .zips import unzipper, zipper from .directory import rm_file_if_exists, create_tmp_dir, find_files from .bag import create_bag from .csvs import get_csv_from_metadata, write_csv_to_file, merge_csv_metadata, read_csvs from .jsons import write_json_to_file, idx_num_to_name, idx_name_to_num, rm_empty_fields, read_jso...
nickmckay/LiPD-utilities
Python/lipd/lipd_io.py
Python
gpl-2.0
3,743
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
EmreAtes/spack
var/spack/repos/builtin/packages/r-rngtools/package.py
Python
lgpl-2.1
2,067
#!/usr/bin/env python import urllib2 import json def main(): # Read the json file as json filename = "missing_ids.json" with open(filename, "r") as infile: missing = json.load(infile) newRemixes = [] print "Processing {} missing tracks in {}".format(len(missing), filename) ...
carmensteenbrink/Remixes_dataposter
proces/scrape_missing.py
Python
mit
1,575
#!/usr/bin/python3 # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your option) any # later version. See http://www.gnu.org/copyleft/lgpl.html fo...
martinpitt/python-dbusmock
tests/test_timedated.py
Python
lgpl-3.0
3,009
# Author: Marvin Pinto <me@marvinp.ca> # Author: Dennis Lutter <lad1337@gmail.com> # Author: Aaron Bieber <deftly@gmail.com> # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickRage. # # SickRage is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public L...
keen99/SickRage
sickbeard/notifiers/pushover.py
Python
gpl-3.0
6,292
import hashlib def omanghasher(identity): return hashlib.sha256(identity.encode()).hexdigest()
botswana-harvard/edc-rdb
bcpp_rdb/old/rdb/utils.py
Python
gpl-2.0
101
import usb.core import time # Find the st link dev = usb.core.find(idVendor=0x0483, idProduct=0x3748) # configuration = dev.get_active_configuration() # print configuration # # dev.set_configuration() # # We senf 0xf308, and the chip responds with 20 bytes. The first four and last 12 # # are encrypted with key "best...
UCT-White-Lab/provisioning-jig
fw_update/talk_usb.py
Python
mit
7,841
# Copyright 2014 Netflix, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
firebitsbr/security_monkey
security_monkey/watchers/s3.py
Python
apache-2.0
9,353
import shopify from test.test_helper import TestCase class ShippingZoneTest(TestCase): def test_get_shipping_zones(self): self.fake("shipping_zones", method="GET", body=self.load_fixture("shipping_zones")) shipping_zones = shopify.ShippingZone.find() self.assertEqual(1, len(shipping_zones)...
Shopify/shopify_python_api
test/shipping_zone_test.py
Python
mit
446
__version__ = '3.10.2'
mikedh/trimesh
trimesh/version.py
Python
mit
23
# Copyright 2019 DeepMind Technologies Limited. 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 ...
deepmind/dm-haiku
haiku/_src/bias_test.py
Python
apache-2.0
3,277
from django.contrib.auth.models import User from rest_framework import serializers from models import ContactModel from userprofile.models import UserProfile, UserSettings from userprofile.serializers import (FollowSerializer, NotificationSerializer, UserProfileSerializer) class ...
andela/codango
codango/account/serializers.py
Python
mit
5,415
#!/usr/bin/env python common_parameters = dict( #bed_3UTR bed_3UTR_input = '../data/refseq/refGene_2015-06-03.bed', bed_3UTR_output = '../data/refseq/refGene_2015-06-03_3UTR.bed', #MIRBASE_GFF2BED mirbase_gff2bed_input = '../data/miRBase/v21/hsa.gff3', mirbase_gff2bed_output = '../data/miRBase/v21/hsa.bed', #liftOve...
Naoto-Imamachi/MIRAGE
scripts/parameter/common_parameters.py
Python
mit
3,440
import sys import os from time import time if os.path.isfile("/usr/lib/enigma2/python/enigma.zip"): sys.path.append("/usr/lib/enigma2/python/enigma.zip") from Tools.Profile import profile, profile_final profile("PYTHON_START") import Tools.RedirectOutput import enigma from boxbranding import getBoxType, getBrandOEM...
formiano/enigma2
mytest.py
Python
gpl-2.0
27,937
#!/usr/bin/env python # -*- coding: utf-8 -*- #---------------------- #Criado por Cadu #---------------------- import re, sys, time, threading #Detector de leitura (Campbell, 2001) #------------------------------------ class Detector (threading.Thread): def __init__(self, thresh, cv): threading.Thread....
elmadjian/mac0499
coletas/user_5_OK/detector.py
Python
mit
4,312
import os, time join = ''.join def getFilename(ext='', pre='', fext='.mrc', format='%y%m%d_%H%M_%S'): """ <pre> + <current time> + <ext> + <fext> """ if fext and not fext.startswith(os.path.extsep): fext = join((os.path.extsep, fext)) tm = time.localtime() tmf = time.strftime(format, tm...
macronucleus/chromagnon
Chromagnon/PriCommon/fntools.py
Python
mit
3,855
# Script Name : portscanner.py # Author : Craig Richards # Created : 20 May 2013 # Last Modified : # Version : 1.0 # Modifications : # Description : Port Scanner, you just pass the host and the ports import optparse # Import the module from socket import * # Import the module from threading import * # Impor...
areriff/pythonlearncanvas
Python Script Sample/portscanner.py
Python
mit
2,143
# Copyright 2012 Viewfinder Inc. All Rights Reserved. """Tests for Accounting data object. """ __author__ = 'marc@emailscrubbed.com (Marc Berhault)' import logging import time import unittest from viewfinder.backend.base.testing import async_test from viewfinder.backend.db.accounting import Accounting from viewfind...
qskycolor/viewfinder
backend/db/test/accounting_test.py
Python
apache-2.0
2,951
import numpy as np from nilabels.tools.aux_methods.utils_nib import set_new_data def merge_labels_from_4d(in_data, keep_original_values=True): """ Can be the inverse function of split label with default parameters. The labels are assuming to have no overlaps. :param in_data: 4d volume :param keep...
SebastianoF/LabelsManager
nilabels/tools/image_shape_manipulations/merger.py
Python
mit
4,806
# 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. """Provides a web interface for dumping graph data as JSON. This is meant to be used with /load_from_prod in order to easily grab data for a graph to a loca...
endlessm/chromium-browser
third_party/catapult/dashboard/dashboard/dump_graph_json.py
Python
bsd-3-clause
6,421
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect from mezgrman.utils.classes import ExtendedTemplateResponse from django.template import RequestContext, Template from .models import StaticPage, StaticPageGroup from django.conf import settings from django.db.models import Q impo...
Mezgrman/mezgrmanDE
staticpages/middleware.py
Python
agpl-3.0
4,812
from django.shortcuts import render from django.http import HttpResponse from django.template import loader from .models import Author def index(request): author_list = Author.objects.order_by('-name')[:5] template = loader.get_template('mafirstapp/index.html') context = { 'author_list': author_list } return ...
iggyGCD/diplomacy2016
mafirstapp/views.py
Python
mit
368
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('employee', '0004_auto_20151026_1823'), ('project_admin', '0004_auto_20151026_0929'), ] operations = [ migrations.Cre...
luiscberrocal/homeworkpal
homeworkpal_project/project_admin/migrations/0005_stakeholder.py
Python
mit
945
#!/usr/bin/python from os import readlink, getppid from os.path import basename from sys import stderr from dbus import SystemBus, Interface from zypp_plugin import Plugin class MyPlugin(Plugin): def parse_userdata(self, s): ud = {} for kv in s.split(","): k, v = kv.split("=", 1) k = k.strip() ...
oniko/ok-snap
scripts/zypp-plugin.py
Python
gpl-2.0
1,119
import sys def brute_force(txt, pat): occ = [] n = len(txt) m = len(pat) i = 0 j = 0 while i < n-m+1: #print #print " %si=%d"%(i*" ",i) #print "T: %s"%txt j = 0 while j<m and txt[i+j]==pat[j]: j += 1 #print " %s%s%s"%(i*" ", (j)*"...
gppeixoto/pcc
boyer-moore/paguso/bm.py
Python
mit
4,001
# Copyright (c) 2009, 2010, 2011, 2012 Brendon J. Brewer. # # This file is part of DNest3. # # DNest3 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 ...
JohannesBuchner/PyDNest
PyDNest/showresults.py
Python
gpl-3.0
1,004
############################################################################## # # Copyright 2015-2016 Bastien Mottiaux # # 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.apac...
basmot/futsal_management
base/models/account.py
Python
apache-2.0
1,494
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import webbrowser try: from opinel.utils.console import configPrintException, printInfo from opinel.utils.globals import check_requirements except Exception as e: print('Error: Scout2 depends on the opinel package. Install all the requirem...
SecurityFTW/cs-suite
tools/Scout2/AWSScout2/__rules_generator__.py
Python
gpl-3.0
1,704
# Plot the window and its frequency response: from scipy import signal from scipy.fftpack import fft, fftshift import matplotlib.pyplot as plt window = signal.hamming(51) plt.plot(window) plt.title("Hamming window") plt.ylabel("Amplitude") plt.xlabel("Sample") plt.figure() A = fft(window, 2048) / (len(window)/2.0) f...
platinhom/ManualHom
Coding/Python/scipy-html-0.16.1/generated/scipy-signal-hamming-1.py
Python
gpl-2.0
623
import argparse from gscripts.qtools import Submitter class CommandLine(object): def __init__(self, inOpts=None): self.parser = parser = argparse.ArgumentParser( description='Submit a job to the cluster which concatenates your ' 'miso summary files together and creates...
YeoLab/gscripts
gscripts/miso/submit_concatenate_miso.py
Python
mit
5,508
# coding: utf8 from __future__ import unicode_literals from ...symbols import NOUN, PROPN, PRON def noun_chunks(obj): """ Detect base noun phrases from a dependency parse. Works on both Doc and Span. """ labels = ['nsubj', 'dobj', 'nsubjpass', 'pcomp', 'pobj', 'dative', 'appos', 'attr',...
recognai/spaCy
spacy/lang/fa/syntax_iterators.py
Python
mit
1,535
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Example of postprocessing fields.""" import bibpy from bibpy.tools import get_abspath_for def print_entry_fields(entries): for entry in entries: for field, value in entry: print(" {0} = {1} ({2})".format(field, value, type(value))) ...
MisanthropicBit/bibpy
examples/field_conversion.py
Python
mit
1,092
from enum import Enum import logging import struct as st import serial from artiq.language.units import V logger = logging.getLogger(__name__) class MGMSG(Enum): HW_DISCONNECT = 0x0002 HW_REQ_INFO = 0x0005 HW_GET_INFO = 0x0006 HW_START_UPDATEMSGS = 0x0011 HW_STOP_UPDATEMSGS = 0x0012 HUB_RE...
kgilmo/penning_artiq
artiq/devices/thorlabs_tcube/driver.py
Python
gpl-3.0
57,773
from __future__ import unicode_literals import difflib import errno import json import os import posixpath import socket import sys import threading import unittest import warnings from collections import Counter from contextlib import contextmanager from copy import copy from functools import wraps from unittest.util...
ohmini/thaifoodapi
lib/django/test/testcases.py
Python
bsd-3-clause
58,079
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "theoliveoilbakers.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
theodesp/aspoonfulofhome
manage.py
Python
mit
260
#!/usr/bin/env python # # Copyright 2010 Markus Pielmeier # # This file is part of tagfs utils. # # tagfs utils 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 op...
marook/tagfs-utils
test/test_csv_import.py
Python
gpl-3.0
1,498
import re from nose.tools import assert_equals, assert_true, assert_false # pylint: disable=no-name-in-module from static_replace import ( replace_static_urls, replace_course_urls, _url_replace_regex, process_static_urls, make_static_urls_absolute ) from mock import patch, Mock from opaque_keys.e...
RPI-OPENEDX/edx-platform
common/djangoapps/static_replace/test/test_static_replace.py
Python
agpl-3.0
6,187
#!/usr/bin/env python3 from storer import Storer import sys s = Storer() if s.get_value() != 0: print('Initial value incorrect.') sys.exit(1) s.set_value(42) if s.get_value() != 42: print('Setting value failed.') sys.exit(1) try: s.set_value('not a number') print('Using wrong argument type...
aaronp24/meson
test cases/python3/3 cython/cytest.py
Python
apache-2.0
380
""" Cisco_IOS_XR_aaa_protocol_radius_cfg This module contains a collection of YANG definitions for Cisco IOS\-XR aaa\-protocol\-radius package configuration. This YANG module augments the Cisco\-IOS\-XR\-aaa\-locald\-cfg, Cisco\-IOS\-XR\-aaa\-lib\-cfg modules with configuration data. Copyright (c) 2013\-2015 by...
abhikeshav/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_aaa_protocol_radius_cfg.py
Python
apache-2.0
4,020
#!/usr/bin/env python # -*- coding: utf-8 -*- __version__ = '0.3.0.dev'
jcrist/pydy
pydy/version.py
Python
bsd-3-clause
73
# -*- coding: utf-8 -*- # Resource object code # # Created: Fri 17. Oct 15:30:51 2014 # by: The Resource Compiler for PyQt (Qt v4.8.5) # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore qt_resource_data = "\ \x00\x00\x03\x64\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x0...
alittel/2016_Group04_StormHelper
resources_rc.py
Python
gpl-2.0
4,822
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from frappe.model.document import Document class LeavePolicyDetail(Document): pass
mhbu50/erpnext
erpnext/hr/doctype/leave_policy_detail/leave_policy_detail.py
Python
gpl-3.0
207
# -*- coding: utf-8 -*- import glob import os import polib from django import VERSION as DJANGO_VERSION from django.core.management.commands.makemessages import ( Command as OriginalMakeMessagesCommand) from django.utils import translation from django.utils.translation.trans_real import CONTEXT_SEPARATOR class Co...
divio/django-commontranslations
django_commontranslations/management/commands/makemessages_unique.py
Python
bsd-3-clause
4,136
import unittest import json import responses import checkmate class TestProperties(unittest.TestCase): def setUp(self): cm = checkmate.CheckMate(api_key='12345', api_base='http://partners.checkmate.dev') self.properties_client = cm.properties self.property_...
CheckMateIO/checkmate_python
checkmate/test/test_properties.py
Python
mit
1,134
""" This package contains algorithms for extracting document representations from their raw bag-of-word counts. """ # bring model classes directly into package namespace, to save some typing from .hdpmodel import HdpModel from .ldamodel import LdaModel from .lsimodel import LsiModel from .tfidfmodel import TfidfModel ...
samantp/gensimPy3
gensim/models/__init__.py
Python
gpl-3.0
1,768
""" Provide pre-made queries on top of the recorder component. For more details about this component, please refer to the documentation at https://home-assistant.io/components/history/ """ import asyncio from collections import defaultdict from datetime import timedelta from itertools import groupby import logging imp...
kyvinh/home-assistant
homeassistant/components/history.py
Python
apache-2.0
12,100
from __future__ import unicode_literals import logging from .utils import comma_join, get_subclass_names logger = logging.getLogger('clickhouse_orm') class Engine(object): def create_table_sql(self, db): raise NotImplementedError() # pragma: no cover class TinyLog(Engine): def create_table_sq...
Infinidat/infi.clickhouse_orm
src/infi/clickhouse_orm/engines.py
Python
bsd-3-clause
10,842
#!/usr/bin/python3 # -*- coding: utf-8 -*- import sys import os import optparse from wiki2blog import * from genpages import * from util import * import ftp import filecmp import shutil as sh import json if __name__ == '__main__': usage = '根据vimwiki的结果,修改并生成blog所需相关文件 \n%prog -h for help' parser = optparse....
linuxcaffe/taskwiki-web
tools/vimwiki2blog.py
Python
bsd-3-clause
6,500
# Copyright 2015 gRPC 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 or agreed to in writing...
mehrdada/grpc
src/python/grpcio_tests/tests/unit/_channel_connectivity_test.py
Python
apache-2.0
6,300
#!/usr/bin/env python # # Copyright (c) 2012 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. """DEPRECATED! TODO(bulach): remove me once all other repositories reference 'test_runner.py perf' directly. """ import optparse...
hugegreenbug/libgestures
include/build/android/bb_run_sharded_steps.py
Python
bsd-3-clause
1,441
# -*- coding: utf-8 -*- """ 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) a...
JamesLinEngineer/RKMC
addons/plugin.video.salts/scrapers/serieswatch_scraper.py
Python
gpl-2.0
5,249
import vstruct import vstruct.defs.inet as vs_inet from vstruct.primitives import * PCAP_LINKTYPE_ETHER = 1 PCAP_LINKTYPE_RAW = 101 PCAP_LINKTYPE_LINUX_SLL = 113 PCAPNG_BOM = 0x1A2B3C4D OPT_ENDOFOPT = 0 OPT_COMMENT = 1 #PCAPNG_BLOCKTYPE_SECTION_HEADER options OPT_SHB_H...
imjonsnooow/vivisect
vstruct/defs/pcap.py
Python
apache-2.0
16,054
#!/usr/bin/env python3 import cmd from tictactoe.ai_player import AIPlayer from tictactoe.ai_strategy_factory import AIStrategyFactory from tictactoe.human_player import HumanPlayer from tictactoe.game_controller import GameController from tictactoe.board_stringification import BoardStringification class CommandLineT...
rickerbh/tictactoe_py
command_line_tic_tac_toe.py
Python
mit
3,044
import pymysql import dbconfig connection = pymysql.connect( host = dbconfig.db_host, user = dbconfig.db_user, passwd = dbconfig.db_password ) try: with connection.cursor() as cursor: sql = "CREATE DATABASE IF NOT EXISTS crimemap" cursor.execute(sql) sql = """CRE...
nirajkvinit/flask-headlines
ch8/db_setup.py
Python
mit
768
# -*- coding: utf-8 -*- # pylint: disable=bad-whitespace """ javaprops - Read and write Java property files. This libary allows you to read Java property files including all the lesser known formatting details, like Unicode escaping. What sets it apart from similar projects are these requirements: * M...
Feed-The-Web/javaprops
src/javaprops/__init__.py
Python
apache-2.0
1,780
import sys # recursive generator SHOW_ITEMS = 1 # 001 SHOW_DICTS = 2 # 010 SHOW_LISTS = 4 # 100 SHOW_ALL = 7 # 111 def traverse(structure, type_filter=SHOW_ALL): for index, item in __traverse_recursive__(structure): is_list = isinstance(item, list) is_dict = isinstance(item, dict) is_...
mxns/coco
util/src/main/python/coco/my.py
Python
mit
2,256
# # 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 # ...
CCI-MOC/python-novaclient
novaclient/tests/unit/v2/test_networks.py
Python
apache-2.0
4,025