text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import ply.lex
#
# Lexer setup
#
instructions = (
'NOP', 'INT', 'IPI', 'RETINT', 'CALL', 'RET', 'CLI', 'STI', 'HLT', 'RST', 'IDLE',
'PUSH', 'POP', 'INC', 'DEC', 'ADD', 'SUB', 'CMP', 'J', 'AND', 'OR', 'XOR', 'NOT',
'SHL', 'SHR', 'SHRS', 'LW', 'LS', 'LB', 'LI', 'LIU', 'LA', 'STW', 'STS', 'STB',
'MOV', 'SWP', 'MU... | happz/ducky | ducky/asm/lexer.py | Python | mit | 2,836 | 0.012694 |
# requests-oauth 0.4.0
# Hacked to support RSA-SHA1 encryption for Atlassian OAuth.
# Original author: Miguel Araujo
# Forked from https://github.com/maraujop/requests_oauth
# Original license: 3-clause BSD
from hook import OAuthHook
| blackspiraldev/jira-python | jira/packages/requests_oauth/__init__.py | Python | bsd-2-clause | 235 | 0 |
# WifiZoo
# complains to Hernan Ochoa (hernan@gmail.com)
import curses.ascii
from scapy import *
import datetime
import WifiZooEntities
import os
class WifiGlobals:
def __init__(self):
self.APdict = {}
self.AccessPointsList = []
self.ProbeRequestsListBySSID = []
self.ProbeRequestsListBySRC = []
self._hasPr... | firebitsbr/pwn_plug_sources | src/wifizoo/wifiglobals.py | Python | gpl-3.0 | 8,025 | 0.04486 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2017 VoltDB Inc.
#
# 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 limitati... | deerwalk/voltdb | tests/scripts/valleak.py | Python | agpl-3.0 | 3,161 | 0.003796 |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import time
import shutil
import logging
import Queue
from threading import Thread, Lock
from lib.cuckoo.common.config import Config
from li... | liorvh/CuckooSploit | lib/cuckoo/core/scheduler.py | Python | gpl-3.0 | 21,948 | 0.000456 |
#
# Copyright 2016 Red Hat, Inc.
#
# 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 option) any later version.
#
# This program is distributed in th... | EdDev/vdsm | tests/osinfo_test.py | Python | gpl-2.0 | 1,439 | 0 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | USGSDenverPychron/pychron | pychron/envisage/tasks/actions.py | Python | apache-2.0 | 14,692 | 0.000204 |
import unittest
from mock import Mock, patch
from expyrimenter import Executor
from expyrimenter.runnable import Runnable
from subprocess import CalledProcessError
from concurrent.futures import ThreadPoolExecutor
import re
class TestExecutor(unittest.TestCase):
output = 'TestExecutor output'
outputs = ['Tes... | cemsbr/expyrimenter | tests/test_executor.py | Python | gpl-3.0 | 4,989 | 0.0002 |
from __future__ import absolute_import
import os
import subprocess
import sys
import tarfile
import tempfile
import traceback
import zipfile
from threading import Thread
import six
from django.utils.text import get_valid_filename
from django.core.files import File
from django.conf import settings
from celery import T... | wooey/Wooey | wooey/tasks.py | Python | bsd-3-clause | 10,721 | 0.002332 |
# Copyright (C) 2009-2010 Sergey Koposov
# This file is part of astrolibpy
#
# astrolibpy 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 ... | segasai/astrolibpy | my_utils/from_hex.py | Python | gpl-3.0 | 1,118 | 0.027728 |
import os
import sys
from time import time as clock
from rpython.rlib import jit
from rpython.rlib import rrandom
from rpython.jit.codewriter.policy import JitPolicy
# The regex is built up from a combination individual Regex objects.
# Each is responsiblef for implementing a specific operator.
class Regex(object... | perkinslr/pypyjs | tools/rematcher.py | Python | mit | 4,972 | 0.000402 |
# -*- coding: utf-8 -*-
from reportlab.lib.colors import Color, CMYKColor, getAllNamedColors, toColor, \
HexColor
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
from reportlab.lib.units import inch, cm
import base64
import httplib
import logging
import mimetypes
import os.path
import re
im... | tecknicaltom/xhtml2pdf | xhtml2pdf/util.py | Python | apache-2.0 | 27,717 | 0.003355 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2010-2012 Associazione OpenERP Italia
# (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... | iw3hxn/LibrERP | l10n_it_sale/models/inherit_sale_order.py | Python | agpl-3.0 | 2,854 | 0.002803 |
# 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... | sandeepdsouza93/TensorFlow-15712 | tensorflow/python/client/timeline_test.py | Python | apache-2.0 | 7,065 | 0.00368 |
import unittest
import os
import math
from rdbtools import RdbCallback, RdbParser
class RedisParserTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_empty_rdb(self):
r = load_rdb('empty_database.rdb')
self.assert_('start_rdb' in r... | idning/redis-rdb-tools | tests/parser_tests.py | Python | mit | 14,949 | 0.009967 |
import os
from buildtest.defaults import BUILDTEST_ROOT
from buildtest.menu.build import discover_buildspecs
included_bp, excluded_bp = discover_buildspecs(
buildspec=[os.path.join(BUILDTEST_ROOT, "tutorials")]
)
print(f"discovered_buildspec: {included_bp} excluded buildspec: {excluded_bp}")
| HPC-buildtest/buildtest-framework | docs/scripting_examples/ex1.py | Python | mit | 300 | 0.003333 |
from db_Dao import init_db
init_db()
| fs714/drcontroller | drcontroller/db/init_db.py | Python | apache-2.0 | 38 | 0 |
# -*- coding: utf-8 -*-
"""
direct PAS
Python Application Services
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?pas;upnp
The following license agreement remains valid unless any additions or
changes a... | dNG-git/pas_upnp | src/dNG/data/upnp/services/abstract_service.py | Python | gpl-2.0 | 20,705 | 0.008211 |
#!/usr/bin/env python
# Takes apart large IATI XML files and outputs one file per reporting org.
# Copyright 2013 Mark Brough.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3.0 as
# published by the Free Software Foundation, e... | markbrough/iati-country-tester | segment_ro.py | Python | mit | 3,383 | 0.005912 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#windowController.py
from PyQt4 import QtGui
import sys, multiprocessing
import mainWindow, windowListerner
class QWindowsController(multiprocessing.Process):
def __init__(self, messageBox):
super(QWindowsController, self).__init__()
self.messageBox = messageBox
def run... | sharmaking/CoIntegrationAnalysis | windowController.py | Python | mit | 579 | 0.03255 |
from birdseye.server import main
if __name__ == '__main__':
main()
| alexmojaki/birdseye | birdseye/__main__.py | Python | mit | 72 | 0 |
# coding: utf-8
"""Test the kernel specs webservice API."""
import errno
import io
import json
import os
import shutil
pjoin = os.path.join
import requests
from IPython.kernel.kernelspec import NATIVE_KERNEL_NAME
from IPython.html.utils import url_path_join
from IPython.html.tests.launchnotebook import NotebookTest... | mattvonrocketstein/smash | smashlib/ipy3x/html/services/kernelspecs/tests/test_kernelspecs_api.py | Python | mit | 4,428 | 0.001355 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library 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 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/StreamLines/F7.py | Python | lgpl-2.1 | 1,521 | 0.001972 |
from datetime import datetime, timedelta
import dateutil.parser
import discord
from discord.ext import commands
import utils
def not_season_or_year(ctx):
now = datetime.now()
return AniList.seasons[now.month // 3] not in ctx.message.content or str(now.year) not in ctx.message.content
class AniList(utils.Se... | Drowrin/Weeabot | cogs/anilist.py | Python | mit | 4,392 | 0.003189 |
"""
Tensor Contraction Engine output parser.
This module provides parsers of the output of the Tensor Contraction Engine of
So Hirata into Tensor objects in drudge.
"""
import collections
import itertools
import re
from sympy import nsimplify, sympify, Symbol
from drudge import Term
#
# The driver function
# --... | tschijnmo/drudge | drudge/_tceparser.py | Python | mit | 5,439 | 0 |
import serial
from time import sleep
import base64
import sys
def readSerial():
while True:
response = ser.readline();
return response
# main
ser = serial.Serial(port='/dev/ttyACM0', baudrate=115200, timeout=3)
ser.isOpen()
# Wait UART Listener VM to be done.
while(1):
message = readSerial()
i... | prplfoundation/prpl-hypervisor | bin/board-control.py | Python | isc | 1,093 | 0.013724 |
# 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 applicable ... | hehongliang/tensorflow | tensorflow/contrib/cluster_resolver/python/training/slurm_cluster_resolver.py | Python | apache-2.0 | 8,923 | 0.003474 |
# -*- coding: utf-8 -*-
# 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, softw... | kickstandproject/wildcard | wildcard/dashboards/admin/info/tables.py | Python | apache-2.0 | 2,073 | 0 |
from ogcserver.cgiserver import Handler
from jon import fcgi
class OGCServerHandler(Handler):
configpath = '/path/to/ogcserver.conf'
fcgi.Server({fcgi.FCGI_RESPONDER: OGCServerHandler}).run()
| pbabik/OGCServer | conf/fcgi_app.py | Python | bsd-3-clause | 198 | 0.010101 |
#!/usr/bin/env python
"""
Test module for demo.py.
Runs various tests on the demo module. Simply run this module to test
the demo.py module.
"""
import test
import demo
def test_echo():
print("In echo test")
echo = demo.echo("hej")
test.assert_equal("hej", echo)
test.assert_not_equal(None, echo)
de... | diblaze/TDP002 | 2.3/testdemo/test/demo_test.py | Python | mit | 614 | 0.006515 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from numpy.testing import (run_module_suite, assert_almost_equal,
assert_allclose)
import pywt
def test_centrfreq():
# db1 is Haar function, frequency=1
w = pywt.Wavelet('db1')
expected = 1
... | ThomasA/pywt | pywt/tests/test_functions.py | Python | mit | 1,468 | 0 |
# Part of Mead. See LICENSE file for full copyright and licensing details.
import datetime, re
def datetime_convert(time):
"""
Convert time to YYYYY-MM-DD HH:MM:SS
"""
_time = str(time)
retime = re.compile(r'\W+')
_list = retime.split(_time)
if len(_list) >= 6:
year = int(_list[... | kennethreitz-archive/mead | mead/core/tools/date_time.py | Python | isc | 3,456 | 0.000289 |
import ctypes
import json
def post_analyzer(HKEY_hKey,
LPCTSTR_lpSubKey,
DWORD_ulOptions,
REGSAM_samDesired,
PHKEY_phkResult,
**kwargs):
lpSubKey = ctypes.c_char_p.from_address(LPCTSTR_lpSubKey)
hKey = ctypes.c_void_p.fro... | 0xPhoeniX/MazeWalker | MazeTracer/PyScripts/post_regopenkeyexa.py | Python | lgpl-3.0 | 1,056 | 0.001894 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | lib_openshift/models/v1_cluster_role_list.py | Python | apache-2.0 | 6,290 | 0.001272 |
import shelve
db = shelve.open('class-shelve')
for key in db:
print(key, '=>\n)', db[key].name, db[key].pay)
bob = db['bob']
print(bob.lastName())
print(db['tom'].lastName) | ViMiao/PythonLearning | ProgrammingPython/C01/dump_db_classes.py | Python | gpl-3.0 | 177 | 0.00565 |
from setuptools import setup, find_packages
setup(
name = "pymp",
version = "0.1",
url = 'http://www.fort-awesome.net/wiki/pymp',
license = 'MIT',
description = "A very specific case when Python's multiprocessing library doesn't work",
author = 'Erik Karulf',
# Below this line is tasty Kool... | ekarulf/pymp | setup.py | Python | mit | 461 | 0.043384 |
# --------------------------------------------------------
# test_socket.py: Unit tests for socket, select.
# --------------------------------------------------------
# Make sure we can import i2p
import sys; sys.path += ['../../']
import traceback, time, thread, threading, random, copy
from i2p import socket, selec... | metamarcdw/PyBitmessage-I2P | src/i2p/test/test_socket.py | Python | mit | 12,449 | 0.019038 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/operations/usages_operations.py | Python | mit | 4,282 | 0.002102 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0012_article_organisations'),
]
operations = [
migrations.AlterField(
model_name='article',
... | I-sektionen/i-portalen | wsgi/iportalen_django/articles/migrations/0013_auto_20151021_0155.py | Python | mit | 598 | 0.00335 |
# lpbm/exceptions.py - All the errors that can be raised in the program.
# Author: Franck Michea < franck.michea@gmail.com >
# License: New BSD License (See LICENSE)
class GeneralOptionError(Exception):
def __init__(self, name):
self.name = name
def __str__(self):
msg = 'Could not find or cal... | fmichea/lpbm | lpbm/exceptions.py | Python | bsd-3-clause | 2,013 | 0.000497 |
"""
.. currentmodule:: pylayers.antprop.diff
.. autosummary::
:members:
"""
from __future__ import print_function
import doctest
import os
import glob
import numpy as np
import scipy.special as sps
import matplotlib.pyplot as plt
import pdb
def diff(fGHz,phi0,phi,si,sd,N,mat0,matN,beta=np.pi/2):
""" Luebbers... | dialounke/pylayers | pylayers/antprop/diff.py | Python | mit | 13,499 | 0.029632 |
# 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 option) any later version.
"""Add data_migration table
Revision ID: 2e171e6198e6
Revises: 15d3fad... | jtoppins/beaker | Server/bkr/server/alembic/versions/2e171e6198e6_add_data_migration_table.py | Python | gpl-2.0 | 863 | 0.005794 |
# -*- coding: utf-8 -*-
import logging
import chwrapper
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
class CompaniesHouseClient():
def __init__(self):
self._ch = chwrapper.Search()
def get_company_data(self, k, v):
"""Search companies house for the data"""
... | nestauk/inet | inet/sources/companies_house.py | Python | mit | 1,473 | 0 |
from django.conf.urls import patterns, url
from .views import PlaylistList, PlaylistDetail, SongList, SongUpdate
urlpatterns = patterns('songs.views',
url(r'^playlists$', PlaylistList.as_view(), name='playlists_list'),
url(r'^playlists/(?P<playlist_pk>[0-9]+)/$', PlaylistDetail.as_view(),
name="playlist_detail")... | kburts/django-playlist | django_playlist/songs/urls.py | Python | mit | 465 | 0.021505 |
# -*- coding: utf-8 -*-
#This is generated code - do not edit
encoding = 'utf-8'
dict = {
'&About...': '&\xd8\xb9\xd9\x86...',
'&Delete Window': '&\xd8\xa7\xd8\xad\xd8\xb0\xd9\x81 \xd8\xa7\xd9\x84\xd9\x86\xd8\xa7\xd9\x81\xd8\xb0\xd8\xa9',
'&Describe Action': '&\xd8\xa3\xd9\x88\xd8\xb5\xd9\x81 \xd8\xa7\xd9\x84\xd8\xb9\x... | robmcmullen/peppy | peppy/i18n/ar.py | Python | gpl-2.0 | 2,474 | 0.017785 |
from ndlib.models.compartments.Compartment import Compartiment
import networkx as nx
import numpy as np
import operator
__author__ = 'Giulio Rossetti'
__license__ = "BSD-2-Clause"
__email__ = "giulio.rossetti@gmail.com"
class NodeNumericalAttribute(Compartiment):
def __init__(self, attribute, value=None, op=Non... | GiulioRossetti/ndlib | ndlib/models/compartments/NodeNumericalAttribute.py | Python | bsd-2-clause | 2,351 | 0.005104 |
# PyAnimation - Animation, in a terminal.
# Copyright (C) 2015 Nathaniel Olsen
#
# 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 ... | UltimateNate/TURPG | PyAnimationEngine.py | Python | gpl-3.0 | 2,064 | 0.009205 |
import my_data_file
d = my_data_file.my_data
print "Hello my name is %s and i am %d years of age and my coolnes is %d " % (d [ 'naam' ], d [ 'age' ], d ['coolheid']) | ArtezGDA/text-IO | Martijn/format.py | Python | mit | 170 | 0.058824 |
# Copyright © 2013, 2015, 2016, 2017, 2018, 2020, 2022 Tom Most <twm@freecog.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 3 of the License, or
# (at your option) any lat... | twm/yarrharr | yarrharr/application.py | Python | gpl-3.0 | 20,459 | 0.000978 |
import sqlite3
import sys
"""<Mindpass is a intelligent password manager written in Python3
that checks your mailbox for logins and passwords that you do not remember.>
Copyright (C) <2016> <Cantaluppi Thibaut, Garchery Martial, Domain Alexandre, Boulmane Yassine>
This program is free software: you can r... | MindPass/Code | Interface_graphique/PyQt/application/classeGestion.py | Python | gpl-3.0 | 24,892 | 0.028687 |
'''
/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
* Junior University
* Copyright (c) 2011, 2012 Open Networking Foundation
*
* We are making the OpenFlow specification and associated documentation
* (Software) available for public use and benefit with the expectation
* that others will use, modify... | hubo1016/vlcp | vlcp/protocol/openflow/defs/openflow13.py | Python | apache-2.0 | 130,995 | 0.031612 |
import numpy as np
import pytest
from pandas.core.dtypes.common import is_datetime64_dtype, is_timedelta64_dtype
from pandas.core.dtypes.dtypes import DatetimeTZDtype
import pandas as pd
from pandas import CategoricalIndex, Series, Timedelta, Timestamp
import pandas._testing as tm
from pandas.core.arrays import (
... | TomAugspurger/pandas | pandas/tests/base/test_conversion.py | Python | bsd-3-clause | 14,519 | 0.000551 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the storage file CLI arguments helper."""
import argparse
import unittest
from plaso.cli import tools
from plaso.cli.helpers import storage_file
from plaso.lib import errors
from tests.cli import test_lib as cli_test_lib
class StorageFileArgumentsHelperTe... | Onager/plaso | tests/cli/helpers/storage_file.py | Python | apache-2.0 | 1,615 | 0.004334 |
import errno
import os
import sys
from contextlib import contextmanager
@contextmanager
def open_with_error(filename: str, mode: str = "r", encoding: str = "utf-8"):
try:
f = open(filename, mode=mode, encoding=encoding)
except IOError as err:
yield None, err
else:
try:
... | raphaeldore/analyzr | analyzr/utils/file.py | Python | mit | 2,428 | 0.002471 |
import sys,os
import numpy as np
#os.environ["EPICS_CA_AUTO_ADDR_LIST"] = "NO"
#os.environ["EPICS_CA_ADDR_LIST"] = "192.168.82.10"
#os.environ["EPICS_CA_MAX_ARRAY_BYTES"] = "10000000000"
import velaINJMagnetControl as VIMC
a = VIMC.velaINJMagnetController(True,False)
print( np.array(a.getQuadNames()))
| mothyjohn/VELA-CLARA-Controllers | General/enums/bin/Release/test.py | Python | gpl-3.0 | 307 | 0.022801 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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... | franek/weboob | modules/youtube/test.py | Python | agpl-3.0 | 1,394 | 0.002152 |
from helper import unittest, PillowTestCase, py3
from PIL import Image
class TestLibPack(PillowTestCase):
def pack(self):
pass # not yet
def test_pack(self):
def pack(mode, rawmode):
if len(mode) == 1:
im = Image.new(mode, (1, 1), 1)
else:
... | 1upon0/rfid-auth-system | GUI/printer/Pillow-2.7.0/Tests/test_lib_pack.py | Python | apache-2.0 | 5,896 | 0 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2013 - 2014 by Wilbert Berendsen
#
# 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
... | brownian/frescobaldi | frescobaldi_app/lydocument.py | Python | gpl-2.0 | 8,870 | 0.000676 |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | yangdw/PyRepo | src/annotation/haven/haven/autoreload.py | Python | mit | 5,900 | 0.002712 |
"""
Test suite for module.
Holds constants and methods shared among multiple tests.
See submodules for individual tests.
"""
import os
import shutil
PARAM_LIST = {
'pre_min': 100,
'pre_max': 101,
'Pre': 10,
'pim_min': -101,
'pim_max': -100,
'Pim': 14,
'T': 16,
'I': 20,
}
OUTPUT_DIR ... | kidmose/python-course | mandelbrot/tests/__init__.py | Python | mit | 674 | 0.004451 |
from .base import Base
class Containing(Base):
_description = 'containing: {}'
def _check(self, value):
# This will check list like objects
for v in self.args:
if v not in value:
return False
# This will check dictionary like objects
for k, v in se... | toddsifleet/equals | equals/constraints/containing.py | Python | mit | 440 | 0 |
""" Test the change_enrollment command line script."""
import ddt
import unittest
from uuid import uuid4
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from enrollment.api import get_enrollment
from student.tests.factories import ... | defance/edx-platform | common/djangoapps/enrollment/management/tests/test_enroll_user_in_course.py | Python | agpl-3.0 | 2,563 | 0.00039 |
from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse_lazy
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'pipeye.views.home', name='home'),
url(r'^watches/', include('pipeye.watches.urls')),
url(r'^packages/', include... | oinopion/pipeye | pipeye/urls.py | Python | bsd-2-clause | 820 | 0.004878 |
#!/usr/bin/env python3
# encoding: utf-8
"""
main.py
The entry point for the book reader application.
"""
__version_info__ = (0, 0, 1)
__version__ = '.'.join(map(str, __version_info__))
__author__ = "c.guenther@mac.com"
import time
import sqlite3
import pdb
import signal
import sys, os
import rfid
import config
i... | siliconchris1973/fairytale | RASPI-stuff/python-codeline/fairytale/main.py | Python | apache-2.0 | 3,954 | 0.006576 |
#!/usr/bin/python
import cairo
import gtk
import copy
def abs(x):
if x < 0:
return -x
else:
return x
class object:
def __init__(self, name, x, y, w, h):
self.name = name
self.x = x
self.y = y
self.w = w
self.h = h
# huddung vector
self.dx = 0
self.dy = 0
# 0 = normal ; 1 = active ; 2 = select... | Newterm/florence | editor/toolkit.py | Python | gpl-2.0 | 16,795 | 0.050491 |
#!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
"""
Interface to OpenShift oc command
"""
#
# Copyright 2015 Red Hat 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 ... | rhdedgar/openshift-tools | openshift_tools/monitoring/ocutil.py | Python | apache-2.0 | 4,378 | 0.001827 |
"""Wrapper for running Freebayes.
"""
import collections
import errno
import fileinput
import glob
import tempfile
import os
import shutil
import subprocess
import vcf
from celery import task
from django.conf import settings
from main.models import Dataset
from main.model_utils import get_dataset_with_type
from pipe... | woodymit/millstone | genome_designer/pipeline/variant_calling/freebayes.py | Python | mit | 10,343 | 0.002127 |
# This file is part of Firemix.
#
# Copyright 2013-2016 Jonathan Evans <jon@craftyjon.com>
#
# Firemix 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... | nyarasha/firemix | plugins/radial_wipe.py | Python | gpl-3.0 | 1,645 | 0.001824 |
# -*- coding: utf-8 -*-
'''
Copyright 2011 NTT Software Corporation.
All Rights Reserved.
@author NTT Software Corporation.
@version 1.0.0
$Date: 2010-08-31 09:54:14 +0900 (火, 31 8 2010) $
$Revision: 435 $
$Author: NTT Software Corporation. $
'''
import os
import sys
from optparse import OptionParser
f... | kuenishi/vHut | src/admin_server/vhut/agent/vhut/vhutac.py | Python | gpl-2.0 | 12,562 | 0.006064 |
# -*- coding: utf-8 -*-
# Copyright 2007-2011 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | pburdet/hyperspy | hyperspy/_signals/eels.py | Python | gpl-3.0 | 48,505 | 0.000309 |
__author__ = 'Nathen'
# get min and max bounds
a, b = map(lambda i: int(i), input('Nums: ').split(' '))
# create generator of all odd nums
nums = [x for x in range(a, b + 1) if x % 2 == 1]
# sum nums
ans = sum(nums)
# print answer
print(ans) | nadrees/PyRosalind | Python Village/INI4.py | Python | unlicense | 243 | 0.004115 |
"""
A nearly direct translation of Andrej's code
https://github.com/karpathy/char-rnn
"""
from __future__ import division
import cgt
from cgt import nn, utils, profiler
import numpy as np, numpy.random as nr
import os.path as osp
import argparse
from time import time
from StringIO import StringIO
from param_collection... | rohanraja/cgt_distributed | examples/char.py | Python | mit | 12,474 | 0.010742 |
"""
components.verisure
~~~~~~~~~~~~~~~~~~~
Provides support for verisure components.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/verisure/
"""
import logging
import time
from datetime import timedelta
from homeassistant import bootstrap
from homeas... | nnic/home-assistant | homeassistant/components/verisure.py | Python | mit | 5,074 | 0 |
#!/usr/bin/env python
# encoding: utf-8
"""
crawler.py
~~~~~~~~~~~~~
主要模块,爬虫的具体实现。
"""
import re
import time
import logging
import threading
import traceback
from hashlib import md5
from bs4 import BeautifulSoup
from datetime import datetime
from collections import deque
from locale import getdefaultlocale
from urlpar... | zhkzyth/a-super-fast-crawler | crawler.py | Python | mit | 9,133 | 0.00478 |
# Copyright (c) 2016 kamyu. All rights reserved.
#
# Google Code Jam 2014 Round 1B - Problem A. The Repeater
# https://code.google.com/codejam/contest/2994486/dashboard#s=p0
#
# Time: O(X * N), N is the number of strings,
# X is the number of characters in the frequency string.
# Space: O(X * N)
#
fr... | kamyu104/GoogleCodeJam-2014 | Round 1B/the-repeater.py | Python | mit | 2,367 | 0.00169 |
#!/bin/env python
import itertools
import collections
def read_table(filename):
with open(filename) as fp:
header = next(fp).split()
rows = [line.split()[1:] for line in fp if line.strip()]
columns = zip(*rows)
data = dict(zip(header, columns))
return data
table = read_table("../... | ketancmaheshwari/hello-goog | src/python/collectionsexample.py | Python | apache-2.0 | 718 | 0.001393 |
from MA_version import version as __version__
from MA_version import version_info as __version_info__
from MA import *
| fxia22/ASM_xf | PythonD/site_python/Numeric/MA/__init__.py | Python | gpl-2.0 | 119 | 0 |
import requests
from django.shortcuts import render
# Create your views here.
from django.template.response import TemplateResponse
from account.models import OAuthToken
def list_azure_groups(request):
token = OAuthToken.objects.filter(user=request.user, service__name='microsoft').last()
if token is None:
... | BdEINSALyon/resa | permissions/views.py | Python | gpl-3.0 | 589 | 0.005093 |
from auditlog.models import LogEntry
from django.contrib import admin
admin.site.unregister(LogEntry)
| OWASP/django-DefectDojo | dojo/admin.py | Python | bsd-3-clause | 103 | 0 |
import caffe
import surgery, score
import numpy as np
import os
import setproctitle
setproctitle.setproctitle(os.path.basename(os.getcwd()))
weights = '../ilsvrc-nets/vgg16-fcn.caffemodel'
# init
caffe.set_device(int(sys.argv[1]))
caffe.set_mode_gpu()
solver = caffe.SGDSolver('solver.prototxt')
solver.net.copy_fro... | wkentaro/fcn | fcn/external/fcn.berkeleyvision.org/nyud-fcn32s-hha/solve.py | Python | mit | 616 | 0.001623 |
# coding: utf-8
"""
Kubeflow Pipelines API
This file contains REST API specification for Kubeflow Pipelines. The file is autogenerated from the swagger definition.
Contact: kubeflow-pipelines@google.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import ... | kubeflow/pipelines | backend/api/python_http_client/test/test_api_run_storage_state.py | Python | apache-2.0 | 1,436 | 0.003482 |
"""Tests for the simple rate limiting classes of the ``unshorten`` app."""
from mock import Mock
from django.conf import settings
from django.test import TestCase
from mixer.backend.django import mixer
from ..backend import RateLimit
from ..models import APICallDayHistory
class SimpleRateLimitTestCase(TestCase):
... | bitmazk/django-unshorten | unshorten/tests/rate_limit_tests.py | Python | mit | 1,841 | 0 |
from utils import scaleToZoom
def jsonScript(layer):
json = """
<script src="data/json_{layer}.js\"></script>""".format(layer=layer)
return json
def scaleDependentLayerScript(layer, layerName):
min = layer.minimumScale()
max = layer.maximumScale()
scaleDependentLayer = """
if (map.ge... | radumas/qgis2web | leafletScriptStrings.py | Python | gpl-2.0 | 20,814 | 0.002114 |
"""
WSGI config for superlists project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | xueyaodeai/DjangoWebsite | superlists/wsgi.py | Python | mit | 398 | 0 |
"""The gearbest component."""
| jnewland/home-assistant | homeassistant/components/gearbest/__init__.py | Python | apache-2.0 | 30 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0032_auto_20160819_1209'),
]
operations = [
migrations.AlterField(
model_name='docket',
na... | voutilad/courtlistener | cl/search/migrations/0033_auto_20160819_1214.py | Python | agpl-3.0 | 473 | 0.002114 |
## @file
# This file is used to create a database used by ECC tool
#
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. Th... | intel/ipmctl | BaseTools/Source/Python/Ecc/Database.py | Python | bsd-3-clause | 14,225 | 0.005413 |
#! /usr/bin/env python3
import sys
import csv
import menu_map
import datetime
db_input = sys.argv[1]
def normalize_elem(min_, max_, value):
'''DESCUBRA'''
return (value - min_)/(max_ - min_) - 0.5
def normalize(array, min_, max_):
'''DESCUBRA'''
for i in range(0, len(array)):
array[i] = norm... | guilhermerc/fournir-au-public | tools/fann_input_norm.py | Python | gpl-3.0 | 2,101 | 0.005236 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# create a class for correlation matrix and other class to find out similar users who have rated a particular movie w.r.t. a particular user based on correlation
import numpy as np
import pandas as pd
class Correlation:
"""
"""
def pearson(self, rating_matrix... | sagnik17/Movie-Recommendation-System | mrs/recsys/cf.py | Python | gpl-3.0 | 387 | 0.005168 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 liangzy
#
# 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... | vliangzy/sillypool | sillypool/spider/parser/xpath.py | Python | apache-2.0 | 2,885 | 0.000365 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2015 Trustcode - www.trustcode.com.br #
# ... | Trust-Code/trust-addons | trust_sale/models/__init__.py | Python | agpl-3.0 | 1,413 | 0 |
#
# Race Capture App
#
# Copyright (C) 2014-2017 Autosport Labs
#
# This file is part of the Race Capture App
#
# This 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 ... | autosportlabs/RaceCapture_App | spacer.py | Python | gpl-3.0 | 1,123 | 0.005343 |
import sys
import os
import shutil as sh
import logging as log
import multiprocessing as mp
import ex.util as eu
from OMOP import OMOP
import base
eu.InitLog(log.INFO)
dat_dest="D:/Documents/DataSet/omop/simulation/"
# dat_dest="~/h/data/omop/simulation/"
def DoTask(configs):
modifier=configs[0]
folder=bas... | excelly/xpy-ml | omop/simu_flow.py | Python | apache-2.0 | 2,109 | 0.009483 |
# -*- coding: utf-8 -*-
# Gedit Better Defaults plugin
# Copyright (C) 2017 Fabio Zendhi Nagao
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | nagaozen/my-os-customizations | home/nagaozen/.gnome2/gedit/plugins/better-defaults/__init__.py | Python | gpl-3.0 | 6,370 | 0.027002 |
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
from models import session
from models import Device
from models import Module
from models import Event_Log
from time import sleep
from sys import stdout
# Modules pins and description
M1A = session.query(Module).filter(Module.name == 'M1A').first()
M1B = session.query(M... | TemosEngenharia/RPI-IO | RPi_IO/rpi_io.py | Python | agpl-3.0 | 6,968 | 0.004167 |
#!/usr/bin/python3
#
# examples/xfixes-selection-notify.py -- demonstrate the XFIXES extension
# SelectionNotify event.
#
# Copyright (C) 2019
# Tony Crisci <tony@dubstepdish.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public Licen... | python-xlib/python-xlib | examples/xfixes-selection-notify.py | Python | lgpl-2.1 | 2,764 | 0.002894 |
# 2016 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 distrib... | qrkourier/ansible | lib/ansible/plugins/action/dellos6.py | Python | gpl-3.0 | 4,351 | 0.001379 |
## @file Test_Reverse_Transform.py
#
# This script file has simple implementation the reverse odsa transform algorithm
## reverse_jumps function
#
# make reverse jumps to the elloborateed output
def reverse_jumps(letter, index, input_text):
output = input_text
for x in xrange(0, len(letter)):
output =... | melvinodsa/odsatransform | Code/Test_Reverse_Transform.py | Python | apache-2.0 | 2,316 | 0.007772 |
# Easy to use system logging for Python's logging module.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: December 10, 2020
# URL: https://coloredlogs.readthedocs.io
"""
Easy to use UNIX system logging for Python's :mod:`logging` module.
Admittedly system logging has little to do with colored terminal... | xolox/python-coloredlogs | coloredlogs/syslog.py | Python | mit | 11,849 | 0.001772 |
#
# Copyright 2008 Huang Ying <huang.ying.caritas@gmail.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 Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
import... | hying-caritas/ibsuite | ibpy/ibpy/image.py | Python | gpl-2.0 | 12,386 | 0.00549 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.