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
""" This module offers one templatetag called ``include_snippet``. ``include_snippet`` acts like an ``{% include %}``, that loads a template and renders it with the current context, but the template content comes from database. It accepts 2 parameter: slug The slug/key of the text (for example 'comment_l...
semente/django-snippets
snippets/templatetags/snippets.py
Python
bsd-3-clause
3,246
# Copyright 2020 Makani Technologies 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...
google/makani
lib/python/pack2/backend_c.py
Python
apache-2.0
6,023
from django.conf.urls import url from rest_framework import routers from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework.urlpatterns import format_suffix_patterns from rest_framework.views import APIView from api import views as api_views class MultiLookupRouter...
eHealthAfrica/formhub
api/urls.py
Python
bsd-2-clause
13,371
#!/usr/bin/env python ''' =============================================================================== Script: xyz2aac.py Author: Sebastian Weigand Email: sab@sab.systems Current: June 2018 Copyright: 2012-2018, Sebastian Weigand License: MIT Description: A script whic...
swdd/multimedia
xyz2aac.py
Python
mit
10,963
#!/usr/bin/env python import rpm ts = rpm.TransactionSet() mi = ts.dbMatch() for h in mi: fi = h.fiFromHeader() for f in fi: print '%s\t%s' % (f[0], h['NAME'])
redhat-cip/pitstop
pitstop/rpmqal.py
Python
apache-2.0
178
# Copyright 2015 The Tornado 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 w...
mr-ping/tornado
tornado/routing.py
Python
apache-2.0
21,421
HOST = "ip-172-31-29-102.us-west-2.compute.internal:27017,ip-172-31-29-103.us-west-2.compute.internal:27017,ip-172-31-29-104.us-west-2.compute.internal:27017,ip-172-31-29-105.us-west-2.compute.internal:27017,ip-172-31-29-101.us-west-2.compute.internal:27017,ip-172-31-29-106.us-west-2.compute.internal:27017,ip-172-31-29...
elainenaomi/sciwonc-dataflow-examples
dissertation2017/Experiment 1A/instances/11_2_workflow_full_10files_secondary_wmj_3sh_3rs_with_annot_with_proj_3s_hash/work/ubuntu/pegasus/example_workflow/20161109T024901+0000/ConfigDB_Calc_TaskEvent_4.py
Python
gpl-3.0
1,023
import sys sys.path.insert(1, "../../../") import h2o, tests import numpy as np from sklearn.cluster import KMeans from sklearn.preprocessing import Imputer def get_modelKmeans(): # Connect to a pre-existing cluster # connect to localhost:54321 #Log.info("Importing benign.csv data...\n") benign_h2o...
printedheart/h2o-3
h2o-py/tests/testdir_algos/kmeans/pyunit_get_modelKmeans.py
Python
apache-2.0
1,092
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-13 06:54 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('.league.champ_chooser', '0001_initial'), ] operations = [ migrations.RenameField( ...
belleandindygames/league
league/champ_chooser/bkp/0002_auto_20170613_0654.py
Python
mit
443
from collections import namedtuple from logging import WARNING from uuid import uuid4 import ddt from django.test import TestCase from django.urls import reverse from rest_framework.exceptions import ValidationError from rest_framework.settings import api_settings from rest_framework.test import APIRequestFactory fro...
edx/credentials
credentials/apps/api/v2/tests/test_serializers.py
Python
agpl-3.0
15,360
# -*- coding: utf-8 -*- # # # Author: Nicolas Bessi, Leonardo Pistone # Copyright 2013, 2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version ...
damdam-s/sale-workflow
sale_exception_nostock/model/sale.py
Python
agpl-3.0
9,058
# -*- coding: utf-8 -*- # # Copyright (C) 2005-2009 Edgewall Software # Copyright (C) 2005-2007 Christopher Lenz <cmlenz@gmx.de> # Copyright (C) 2005 Matthew Good <trac@matt-good.net> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this ...
pkdevbox/trac
trac/web/main.py
Python
bsd-3-clause
34,356
#!/usr/bin/python import os, sys import httplib2 from lxml import etree from StringIO import StringIO import re import simplejson # Table Three Scraper http://uscode.house.gov/table3/table3years.htm # The scrapers grab the URLs for each year from 1789 to 2011, go one directory down to grab the directory, then go one ...
unitedstates/uscode
table3/table3_scraper.py
Python
cc0-1.0
3,822
import os import command import serverinfo import accounts from google.appengine.ext.webapp import template class Drain(command.Command): def have_access(self): account = accounts.account() if not account or not account.DRAIN_ACCESS_RIGHT: return False return True def fini...
spiffcode/hostile-takeover
stats/drain.py
Python
bsd-2-clause
1,517
#!/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. """Entry point for both build and try bots. This script is invoked from XXX, usually without arguments to package an SDK. It autom...
bright-sparks/chromium-spacewalk
native_client_sdk/src/build_tools/build_sdk.py
Python
bsd-3-clause
36,606
from Values import x, y, z l = [] t = () s = {1} XY = x XY = y XYZ = z XYZ = XY D = l D = t D = s D = s # ensure multiple assignments do not clear it from Values import D
Microsoft/PTVS
Python/Tests/TestData/AstAnalysis/MultiValues.py
Python
apache-2.0
175
#!/usr/bin/env python ''' 1. Using SNMPv3 create a script that detects router configuration changes. If the running configuration has changed, then send an email notification to yourself identifying the router that changed and the time that it changed. Note, the running configuration of pynet-rtr2 is changing every ...
joeyb182/pynet_ansible
byers-paid/exercise_week_3_1.py
Python
apache-2.0
6,430
""" Tests for the FileRequest module. """ from teiler import filerequest from twisted.internet.defer import Deferred from twisted.trial import unittest class ParseFileRequestTests(unittest.SynchronousTestCase): def test_parse_file_req_ret(self): request = { 'url': ['192.168.1.1'], ...
derwolfe/teiler
teiler/test/test_filerequest.py
Python
mit
3,551
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class HrEmployee(models.Model): _name = 'hr.employee' _inherit = ['hr.employee', 'website.published.mixin'] public_info = fields.Char(string='Public Info') @api.mul...
ChawalitK/odoo
addons/website_hr/models/hr_employee.py
Python
gpl-3.0
549
# -*- coding:utf-8 -*- import sys import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import EngFormatter local_path = '/'.join(sys.path[0].split('/')[:-2]) + '/' sys.path.insert(0, local_path + 'mswim/') from mswim import WimSys a = '' x = True if a else False print(x) exit() root_file = '/ho...
xmnlab/minilab
labtrans/plotter/lab.py
Python
gpl-3.0
1,420
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pants.backend.shell import dependency_inference, shell_command, shunit2_test_runner, tailor from pants.backend.shell.target_types import ( ShellCommand, ShellCommandRun, S...
patricklaw/pants
src/python/pants/backend/shell/register.py
Python
apache-2.0
917
import methods methods.reset_dates_ids()
jaimejimbo/rod-analysis
reset_dates_ids.py
Python
gpl-3.0
42
""" mbed SDK Copyright (c) 2011-2013 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
NordicSemiconductor/mbed
workspace_tools/settings.py
Python
apache-2.0
3,867
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-06-29 01:49 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0008_maintenancenotice'), ] operations = [ migrations.AddField( ...
CCI-MOC/GUI-Frontend
api/migrations/0009_maintenancenotice_title.py
Python
apache-2.0
474
def findNextPalindrome(number): new_list = [] list_number = list(str(number)) size = len(list_number) first = list_number[0] last = list_number[size-1] if first == last and size == 3: new_list = list_number new_list[1] = str(int(list_number[1]) + 1) elif size > 3: ...
Diegow3b/Sphere-Online-Judge-SPOJ-
challenges/classical/PALINTheNextPalindrome.py
Python
mit
889
"""Loader for the Labeled Faces in the Wild (LFW) dataset This dataset is a collection of JPEG pictures of famous people collected over the internet, all details are available on the official website: http://vis-www.cs.umass.edu/lfw/ Each picture is centered on a single face. The typical task is called Face Veri...
treycausey/scikit-learn
sklearn/datasets/lfw.py
Python
bsd-3-clause
16,524
#!/usr/bin/python import sqlite3 conn = sqlite3.connect('elephant-seals.db') c = conn.cursor() # Create table (no primary key, rowid is sufficient) c.execute('''CREATE TABLE IF NOT EXISTS ddt (individual INTEGER NOT NULL, date REAL, ax REAL, ay REAL, az REAL, mx REAL, m...
cedricpradalier/elephant-seals
python/data_to_db.py
Python
gpl-3.0
2,836
from Screen import Screen from Components.ActionMap import ActionMap from Components.ActionMap import NumberActionMap from Components.Label import Label from Components.Sources.StaticText import StaticText from Components.config import config, ConfigSubsection, ConfigSelection, ConfigSubList, getConfigListEntry, KEY_L...
mrnamingo/vix4-34-enigma2-bcm
lib/python/Screens/Ci.py
Python
gpl-2.0
11,872
from django.shortcuts import get_object_or_404 from facebook import GraphAPI, GraphAPIError from raven.contrib.django.raven_compat.models import client from canvas.exceptions import InvalidFacebookAccessToken from canvas.templatetags.jinja_base import render_jinja_to_string from canvas.view_guards import require_staff...
drawquest/drawquest-web
website/drawquest/apps/profiles/api.py
Python
bsd-3-clause
1,424
import os import appdirs def get_local_datadir(name): """ Helper function for datadir transition. It returns path to a data directory of given name in 'data' dir. Usage should be avoid at all costs. It is always better to ask for a dir the upper layer (like Client instance). """ ...
Radagast-red/golem
golem/core/simpleenv.py
Python
gpl-3.0
960
# Copyright 2016 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/contrib/learn/python/learn/ops/__init__.py
Python
apache-2.0
1,296
""" Parser and serializer for file formats supported by compare-locales library: https://hg.mozilla.org/l10n/compare-locales/ """ import logging from collections import OrderedDict from compare_locales import ( parser, serializer, ) from pontoon.sync.exceptions import ParseError, SyncError from pontoon.sync.f...
jotes/pontoon
pontoon/sync/formats/compare_locales.py
Python
bsd-3-clause
3,791
##~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~## ## ## ## This file forms part of the Badlands surface processes modelling companion. ## ## ...
badlands-model/pyBadlands-Companion
badlands_companion/toolDynTopo.py
Python
gpl-3.0
6,636
#!/usr/bin/env python # $Id: keyPress.py,v 1.3 2005/06/23 20:27:16 shawns Exp $ # tab:2 # "Copyright (c) 2000-2003 The Regents of the University of California. # All rights reserved. # # Permission to use, copy, modify, and distribute this sof...
fresskarma/tinyos-1.x
contrib/ucb/apps/Monstro/lib/keyPress.py
Python
bsd-3-clause
3,636
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # For license information, please see license.txt import frappe from frappe import _ from frappe.model.document import Document from frappe.model.meta import get_field_precision from frappe.utils import flt import erpnext from erpnext.controllers.t...
frappe/erpnext
erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
Python
gpl-3.0
8,235
# coding: utf-8 import warnings from .util import configobj_walker as new_configobj_walker if False: # MYPY from typing import Any # NOQA def configobj_walker(cfg): # type: (Any) -> Any warnings.warn('configobj_walker has moved to ruamel.yaml.util, please update your code') return new_configobj_w...
rochacbruno/dynaconf
dynaconf/vendor_src/ruamel/yaml/configobjwalker.py
Python
mit
331
from nose.tools import eq_ import inflect def test_loop(): p = inflect.engine() for thresh in range(21): for n in range(21): threshed = p.number_to_words(n, threshold=thresh) numwords = p.number_to_words(n) if (n <= thresh): eq_(numwords, thresh...
GeneralizedLearningUtilities/SuperGLU
python_module/SuperGLU/Services/TextProcessing/Tests/Inflect/test_numwords.py
Python
mit
17,379
# -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license """Superdesk...
mdhaman/superdesk-core
superdesk/__init__.py
Python
agpl-3.0
5,286
#!c:\users\montes\documents\github\fluid-designer\win64-vc\2.78\python\bin\python.exe # # The Python Imaging Library # $Id$ # from __future__ import print_function try: from tkinter import Tk, Label except ImportError: from Tkinter import Tk, Label from PIL import Image, ImageTk # # an image viewer class ...
Microvellum/Fluid-Designer
win64-vc/2.78/Python/Scripts/viewer.py
Python
gpl-3.0
1,034
#!/usr/bin/env python import argparse import json import logging import multiprocessing as mp import os import signal import time from collections import defaultdict from random import sample from insights.core import archives from insights.core import load_package from insights.core.evaluators import MultiEvaluator,...
PaulWay/insights-core
insights/tools/perf.py
Python
apache-2.0
5,493
"""SoloVideoJuegos URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='...
lKaza/VideoJuegosFisicosChile
solovideojuegos/SoloVideoJuegos/urls.py
Python
mit
793
from unittest import mock import pytest from conftest import create_project_config from datakit_data import Push @pytest.fixture(autouse=True) def initialize_data_configs(dkit_home, fake_project): project_configs = { 's3_bucket': 'foo.org', 's3_path': '2017/fake-project', 'aws_user_profi...
associatedpress/datakit-data
tests/commands/test_push.py
Python
isc
1,702
# Copyright (c) 2020 PaddlePaddle 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 appli...
luotao1/Paddle
python/paddle/fluid/tests/unittests/test_max_op.py
Python
apache-2.0
4,924
""" Imitate the parser representation. """ import inspect import re import sys import os from functools import partial from jedi._compatibility import builtins as _builtins, unicode from jedi import debug from jedi.cache import underscore_memoization, memoize_method from jedi.parser.tree import Param, Base, Operator, ...
snakeleon/YouCompleteMe-x86
third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/compiled/__init__.py
Python
gpl-3.0
17,309
# # ================================================================= # ================================================================= from oslo.config import cfg CONF = cfg.CONF class IBMPowerVMBaseNetworkPlacement(object): """ Serves as a base class for host-agnostic placement/deploy data. """ d...
windskyer/k_nova
paxes_nova/network/placement.py
Python
apache-2.0
3,574
import json from django import forms from django_webtest import WebTest from . import build_test_urls class TextareaForm(forms.Form): test_field = forms.CharField( min_length=5, max_length=20, widget=forms.Textarea(attrs={'data-test': 'Test Attr'})) class Test(WebTest): default_form...
thiagoramos-luizalabs/django-material
tests/integration/tests/test_textarea.py
Python
bsd-3-clause
4,963
#!/usr/bin/env python copyright = ''' /* * Copyright 2009 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without li...
execunix/vinos
xsrc/external/mit/MesaLib/dist/src/gallium/auxiliary/indices/u_indices_gen.py
Python
apache-2.0
10,366
import logging import os import sys import time import bluetooth from Utilities.SettingsManager import SettingsManager from Utilities.SleepableThread import SleepableThread from Motors.MotorController import MotorController from Sensors.CompassController import CompassController from Sensors.GPSController import GPSCon...
MJWherry/Greggg-Python
Bluetooth/BluetoothController.py
Python
mit
13,969
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 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 prog...
rfancn/myprojects
spload/network/httpchunk.py
Python
mit
9,633
"constants used for testing. Tightly coupled to settings.py" # {error_count:set_of_numerals} for Figures representing Numeral 0 to 9 valid_figure_superpositions = ( {0: {'0'}, 1: {'8'}, 2: {'6', '9'}, 3: {'2', '3', '5', '7'}, 4: {'1', '4'}}, {0: {'1'}, 1: {'7'}, 2: {'4'}, 3: {'3'}, 4: {'0', '9'}, 5: {'2', '5',...
gJigsaw/KataBankOCR
parse/test/fixture_constants.py
Python
gpl-2.0
3,242
import numpy as np import matplotlib.pyplot as plt import csv import os # csv format is image_number, bits_per_pixel, mem_per_pixel, PSNR, MS-SSIM, MSE data_folder = os.path.expanduser("~")+"/CAE_Project/CAEs/data/" balle_file = data_folder+"r_d_Balle.csv" jpeg_file = data_folder+"r_d_JPEG.csv" jpeg2k_file = data_fol...
rzarcone/CAEs
utils/r_d_curves.py
Python
bsd-2-clause
3,358
from viperid import app import unittest class ViperidTestCase(unittest.TestCase): contract_1 = { 'code': 'import os\ndef foo(x: num) -> num:\n return x * 2' } error = {'error': {'line_no': 1, 'message': 'Invalid top-level statement', 'source_code': ['import os', 'def foo(x: num) -> num:', ' ...
yograterol/viperid
backend/tests/tests_invalid_viperid.py
Python
mit
1,191
from django.db import models, migrations import django.utils.timezone import django.core.validators from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('auth', '0001_initial'), ('contenttypes', '0001_initial'), ] operations = [ migrations.Cre...
dezede/dezede
accounts/migrations/0001_initial.py
Python
bsd-3-clause
4,770
# Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
SkyLined/headsup
decode/struct_GUID.py
Python
apache-2.0
2,438
#!/usr/bin/env python # # Generate pnSeed[] from Pieter's DNS seeder # NSEEDS=600 import re import sys from subprocess import check_output def main(): lines = sys.stdin.readlines() ips = [] pattern = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):10809") for line in lines: m = patt...
onnz423/Scorecoin
contrib/seeds/makeseeds.py
Python
mit
709
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file import re from waflib import Utils,Logs def filter_comments(filename): txt=Utils.readf(filename) i=0 buf=[] max=len(txt) begin=0 while i<max: c=txt[i] ...
bit-trade-one/SoundModuleAP
lib-src/lv2/lv2/waflib/Tools/d_scan.py
Python
gpl-2.0
3,162
from setuptools import setup, find_packages import os import poser CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Indepe...
elishowk/django-poser
setup.py
Python
agpl-3.0
1,378
# The Hazard Library # Copyright (C) 2012-2014, GEM Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. ...
silviacanessa/oq-hazardlib
openquake/hazardlib/mfd/evenly_discretized.py
Python
agpl-3.0
3,967
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """""" from colony.entities.actingentity import ActingEntity from colony.entities.attributes import Limbs # from .references import get_interval from colony.references import interval __title__ = "MovingEntity" __author__ = "DeflatedPickle" __version__ = "1.0.3" class ...
DeflatedPickle/Colony
colony/entities/movingentity.py
Python
mit
3,590
""" Convert a QuinCe CSV output file to netCDF """ import argparse import os.path import yaml import pandas as pd from datetime import datetime from netCDF4 import Dataset from cftime import date2num def make_netcdf(config, in_file): """ Main program function """ out_file = f"{os.path.splitext(in_fil...
BjerknesClimateDataCentre/QuinCe
DataPreparation/HaraldSodemann/netCDFConverter/make_netcdf.py
Python
gpl-3.0
2,368
# Copyright (c) 2011 by Zocolab <pablo@zocolab.es> # # This software 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. # # This so...
pablorecio/django-qrcode
qrcode/utils.py
Python
lgpl-3.0
712
__license__ = """ Copyright 2015 Parse.ly, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
jofusa/pykafka
doc/conf.py
Python
apache-2.0
1,267
# -*- coding: utf-8 -*- ''' Wheel system wrapper for key system ''' from __future__ import absolute_import # Import python libs import os import hashlib # Import salt libs import salt.key import salt.crypt __func_alias__ = { 'list_': 'list' } def list_(match): ''' List all the keys under a named status...
stephane-martin/salt-debian-packaging
salt-2016.3.3/salt/wheel/key.py
Python
apache-2.0
3,278
#!/usr/bin/env python3 import random import unittest from panda import pack_can_buffer, unpack_can_buffer class PandaTestPackUnpack(unittest.TestCase): def test_panda_lib_pack_unpack(self): to_pack = [] for _ in range(10000): address = random.randint(1, 0x1FFFFFFF) data = bytes([random.getrandbi...
commaai/panda
tests/usbprotocol/test_pandalib.py
Python
mit
615
"""HTML form handling for web clients. ClientForm is a Python module for handling HTML forms on the client side, useful for parsing HTML forms, filling them in and returning the completed forms to the server. It has developed from a port of Gisle Aas' Perl module HTML::Form, from the libwww-perl library, but the inte...
aaronsw/watchdog
vendor/python-clientform/ClientForm-0.2.2.py
Python
agpl-3.0
119,500
""" Library example from the EMF wikipedia page: https://fr.wikipedia.org/wiki/Eclipse_Modeling_Framework#/media/File:EMF_based_meta-model.png The static metamodel had been produced by hand in this example """ import sys import pyecore.ecore as Ecore from pyecore.ecore import EObject, EAttribute, EString, EEnum, ERefer...
pyecore/pyecore
tests/wikilibrary/wikilib.py
Python
bsd-3-clause
2,126
from __future__ import division def solve(n): print ' ' * 2 + "/\\" for i in range(n): print ' ' * 2 + '||' print ' /||\\' print '/:||:\\' for i in range(n - 1): print '|:||:|' print '|/||\\|' print ' **\n **' if __name__ == '__main__': n = int(raw_input()) solve(n)
m00nlight/hackerrank
algorithm/contests/Indeed-Prime-Challenges/A.py
Python
gpl-2.0
287
import sys from newrelic.agent import WSGIApplicationWrapper, wrap_out_function def _nr_wrapper_Application_wsgi_(application): # Normally Application.wsgi() returns a WSGI application, but in # the case of the Tornado worker it can return an Tornado ASYNC # application object. Not being a WSGI applicatio...
GbalsaC/bitnamiP
venv/lib/python2.7/site-packages/newrelic-2.46.0.37/newrelic/hooks/adapter_gunicorn.py
Python
agpl-3.0
1,184
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # AMJPureBLEKbd documentation build configuration file, created by # sphinx-quickstart on Tue Nov 22 21:36:49 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in thi...
AMJKeyboard/AMJPureBLEKbd
docs/source/conf.py
Python
bsd-2-clause
9,869
from jirafs import utils from jirafs.plugin import CommandPlugin class Command(CommandPlugin): """Create a subtask of a given issue.""" MIN_VERSION = "2.0.0" MAX_VERSION = "3.0.0" def main(self, folder, args, **kwargs): summary = " ".join(args.summary) issue_data = { "pr...
coddingtonbear/jirafs
jirafs/commands/subtask.py
Python
mit
1,060
#!/bin/python3 import argparse import sys, os import subprocess import shutil import urllib.request from zipfile import ZipFile import re parser = argparse.ArgumentParser(description='Set up a Kattis skeleton') parser.add_argument('name', help='the name of the problem') args = parser.parse_args() subprocess.check_ca...
danielschemmel/kattis_skeleton
get.py
Python
mit
1,924
#!/usr/bin/env python import rospy import os import roslib roslib.load_manifest("denso_pendant_publisher") roslib.load_manifest("actionlib_msgs") import denso_pendant_publisher.msg import std_msgs.msg import actionlib_msgs.msg rospy.init_node("moveit_canceler") g_runnable = True g_prev_status = None def pendantC...
mikewrock/phd_backup_full
src/wrock/vs060/scripts/moveit_canceler.py
Python
apache-2.0
1,094
"""Test the Tradfri config flow.""" import pytest from homeassistant import data_entry_flow from homeassistant.components.tradfri import config_flow from tests.async_mock import patch from tests.common import MockConfigEntry @pytest.fixture def mock_auth(): """Mock authenticate.""" with patch( "home...
nkgilley/home-assistant
tests/components/tradfri/test_config_flow.py
Python
apache-2.0
9,174
""" Base Storage Class provides the base interface for all storage plug-ins exists() These are the methods for manipulating files: isFile() getFile() putFile() removeFile() getFileMetadata() getFileSize() prestageFile() getTransportURL() These are the methods for...
ic-hep/DIRAC
src/DIRAC/Resources/Storage/StorageBase.py
Python
gpl-3.0
16,613
from functools import partial from typing import Any, Dict, Optional from django.http import HttpRequest, HttpResponse from zerver.decorator import api_key_only_webhook_view from zerver.lib.request import REQ, has_request_variables from zerver.lib.response import json_success from zerver.lib.webhooks.common import Un...
timabbott/zulip
zerver/webhooks/clubhouse/view.py
Python
apache-2.0
20,329
""" avocado.utils.partition unittests :author: Lukas Doktor <ldoktor@redhat.com> :copyright: 2016 Red Hat, Inc """ import os import shutil import sys import tempfile import time from flexmock import flexmock, flexmock_teardown from avocado.utils import partition, process from avocado.utils import path as utils_path ...
adereis/avocado
selftests/unit/test_utils_partition.py
Python
gpl-2.0
4,346
from raspyrfm_client import RaspyRFMClient rfm_client = RaspyRFMClient() gateways = rfm_client.search() for gateway in gateways: print(gateway)
markusressel/raspyrfm-client
example_search.py
Python
gpl-3.0
151
from symengine.utilities import raises from symengine import (Interval, EmptySet, FiniteSet, I, oo, Eq, Symbol, linsolve) from symengine.lib.symengine_wrapper import solve def test_solve(): x = Symbol("x") reals = Interval(-oo, oo) assert solve(1, x, reals) == EmptySet assert solve(0, x, reals) ==...
bjodah/symengine.py
symengine/tests/test_solve.py
Python
mit
930
# Seamless DVD Player # Copyright (C) 2004-2006 Martin Soto <martinsoto@users.sourceforge.net> # # 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 your op...
MartinSoto/Seamless
src/mainwindow.py
Python
gpl-2.0
6,953
import unittest import numpy as np import networkx as nx from pele.rates import RateCalculation from pele.rates._rate_calculations import GraphReduction, kmcgraph_from_rates np.random.seed(0) def make_rates_complete(nnodes=10): rates = dict() for i in range(nnodes): for j in range(i+1,nnodes): ...
kjs73/pele
pele/rates/tests/test_graph_transformation.py
Python
gpl-3.0
3,988
# Copyright 2016 Cloudbase Solutions Srl # 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 r...
rahulunair/nova
nova/policies/admin_actions.py
Python
apache-2.0
1,849
#!/bin/python # -*- coding: utf-8 -*- # #################################################################### # gofed-ng - Golang system # Copyright (C) 2016 Fridolin Pokorny, fpokorny@redhat.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public Lice...
gofed/gofed-ng
scenarios/api.py
Python
gpl-3.0
4,252
#!/usr/bin/env python """ @package ion.agents.platform.platform_agent_stream_publisher @file ion/agents/platform/platform_agent_stream_publisher.py @author Carlos Rueda @brief Stream publishing support for platform agents. """ __author__ = 'Carlos Rueda' import logging import uuid from coverage_model.paramet...
ooici/coi-services
ion/agents/platform/platform_agent_stream_publisher.py
Python
bsd-2-clause
10,637
# Copyright 2011 Denali Systems, 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 requ...
citrix-openstack-build/cinder
cinder/tests/api/v1/test_snapshots.py
Python
apache-2.0
16,658
# -*- coding: utf-8 -*- """ Copyright (C) 2011 Dariusz Suchojad <dsuch at zato.io> Licensed under LGPLv3, see LICENSE.txt for terms and conditions. """ from __future__ import absolute_import, division, print_function, unicode_literals # pika from pika.spec import FRAME_MAX_SIZE, PORT # Django from django import fo...
alirizakeles/zato
code/zato-web-admin/src/zato/admin/web/forms/definition/amqp.py
Python
gpl-3.0
1,135
''' Created on Jun 19, 2016 @author: riccardo ''' import os import sys import glob from click.testing import CliRunner from gfzreport.cli import main as gfzreport_main from gfzreport.sphinxbuild import get_logfilename as get_build_logfilename from gfzreport.templates.utils import get_logfilename as get_template_logfil...
rizac/gfzreport
tests/test_templates_network.py
Python
gpl-3.0
24,752
from sqlalchemy import Column, Integer, String, Sequence, ForeignKey, Enum, Float from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from . import Base from .utils import ModelMixin class Source(Base, ModelMixin): __tablename__ = 'source' __repr_props__ = ['id', ...
richlewis42/qsardb
qsardb/models/models.py
Python
mit
3,946
# setup.py from distutils.core import setup, Extension setup(name="ptexample", ext_modules=[ Extension("ptexample", ["ptexample.c"], include_dirs = ['..','.'], # May need pysample.h directory ) ] )
tuanavu/python-cookbook-3rd
src/15/defining_and_exporting_c_apis_from_extension_modules/ptsetup.py
Python
mit
277
default_app_config = 'django_aur.apps.AURConfig'
eyolfson/site-eyl
django_aur/__init__.py
Python
gpl-3.0
49
# 高精度还是python好 from math import sqrt from random import randint isqrt_threshold_small=2**62 isqrt_threshold_medim=2**120 def i_sqrt_small(n): # assert(n<=isqrt_threshold_small) z=int(sqrt(float(n))) q=z*z qa=q+z+z+1 if q>n: return z-1 elif qa<=n: return z+1 else: return z def i_sqrt_medium(n): # assert...
iamstupid/toybi
信仰的崩塌.py
Python
unlicense
6,123
""" kombu.mixins ============ Useful mixin classes. """ from __future__ import absolute_import from __future__ import with_statement import socket from contextlib import contextmanager from functools import partial from itertools import count from .common import ignore_errors from .messaging import Consumer from ....
mozilla/firefox-flicks
vendor-local/lib/python/kombu/mixins.py
Python
bsd-3-clause
7,526
#!/usr/bin/env python """ This program is to collect some AWS stuff """ import boto3 import threading from local_helpers.config import accounts_db from local_helpers import assume_role, get_session, misc from local_helpers import ec2_helper if __name__ == "__main__": """main""" """bucket to hold results"""...
ndoit/awsdit
aws_audit/sec_sgrules_all_regions.py
Python
mit
1,924
#!/usr/bin/env python #coding:utf-8 import sys import os import glob import platform import re import random import string print(''' -------------------------------- TeamViewer ID Changer for MAC OS -------------------------------- ''') if platform.system() != 'Darwin': print('This script can be run only on MAC ...
cheenwe/cheenwe.github.io
_posts/sh/python/teamview.py
Python
mit
3,173
#!/usr/bin/env python from __future__ import print_function import argparse import math import os import os.path import re import subprocess import sys # Runs the benchmarks. # # It runs several benchmarks across several languages. For each # benchmark/language pair, it runs a number of trials. Each trial is one run...
Rohansi/wren
util/benchmark.py
Python
mit
10,277
from matplotlib import pyplot as plt import numpy as np from types import FunctionType class HashableDict(dict): # http://code.activestate.com/recipes/414283-frozen-dictionaries/ def __hash__(self): return hash(tuple(sorted(self.items()))) def imagesc(data, dest=None, grayscale=True, vmin=None, vmax...
gregdetre/evendeeper
rbm/utils/utils.py
Python
mit
1,332
#!/usr/bin/python # # 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 b...
coxmediagroup/googleads-python-lib
examples/dfp/v201411/network_service/get_all_networks.py
Python
apache-2.0
1,545
# -*- coding: utf-8 -*- # # This file is part of Django ipinfodb released under the MIT license. # See the LICENSE for more information. from django.db import models class IpCountryManager(models.Manager): def find_ip(self, ip): import socket import struct ip = struct.unpack('!L',...
pombredanne/django-ipinfodb
django_ipinfodb/models.py
Python
mit
734
from inspect import getcallargs from decorator import decorator from covenant.util import toggled_decorator from covenant.exceptions import (PreconditionViolationError, PostconditionViolationError) @toggled_decorator @decorator def constrain(func, *args, **kwargs): """Enforce con...
kisielk/covenant
covenant/annotations.py
Python
mit
1,255
#!/usr/bin/env python3 """ Compute the number of IBD pair at each position. @Author: wavefancy@gmail.com Usage: IBDPairByPos.py IBDPairByPos.py -h | --help | -v | --version | -f | --format Notes: 1. Read results from stdin(output from beagle3 fibd), and output results to stdo...
wavefancy/BIDMC-PYTHON
Exome/beagle/IBDPairByPos/IBDPairByPos.py
Python
mit
1,899
""" Copyright (c) 2012 Philip Schliehauf (uniphil@gmail.com) and the Queen's University Applied Sustainability Centre This project is hosted on github; for up-to-date code and contacts: https://github.com/Queens-Applied-Sustainability/PyRTM This file is part of PyRTM. PyRTM is free so...
Queens-Applied-Sustainability/PyRTM
rtm/test/test_cache.py
Python
gpl-3.0
2,536