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 |
|---|---|---|---|---|---|---|
from typing import Optional, Dict, Union, List
from .singleton import Singleton
class Arguments(metaclass=Singleton):
"""
Arguments singleton
"""
class Name:
SETTINGS_FILE: str = 'settings_file'
SETTINGS: str = 'settings'
INIT: str = 'init'
VERBOSE: str = 'verbose'
... | PetterKraabol/Twitch-Chat-Downloader | tcd/arguments.py | Python | mit | 3,199 | 0.001876 |
##############################################################################
# adaptiveMD: A Python Framework to Run Adaptive Molecular Dynamics (MD)
# Simulations on HPC Resources
# Copyright 2017 FU Berlin and the Authors
#
# Authors: Jan-Hendrik Prinz
# Contributors:
#
# `adaptiveMD` is free software: ... | thempel/adaptivemd | adaptivemd/mongodb/base.py | Python | lgpl-2.1 | 9,063 | 0.00011 |
# -*- coding: utf-8 -*-
#抓取网易公开课链接并下载对应的相视频名称和视频格式
#By : obnjis@163.com
#Python 2.7 + BeautifulSoup 4
#2014-12-18
#断点续传功能等待下一版本
#eg: python 163—video.py http://v.163.com/special/opencourse/ios7.html
from bs4 import BeautifulSoup
import re
import sys,os
import urllib
import codecs
#显示百分比
def rpb(blocknum, blocksize, to... | frankeen/163_Opencourse_download | 163_download.py | Python | mit | 2,432 | 0.033838 |
"""
The "travel from home to the park" example from my lectures.
Author: Dana Nau <nau@cs.umd.edu>, May 31, 2013
This file should work correctly in both Python 2.7 and Python 3.2.
"""
import pyhop
import random
import sys
from utils_plan import *
from util_plot import *
# state variables
state1 = pyhop.State('state'... | mdasifhasan/Experiments_HTN_Planner | PyHop/exp_1.py | Python | gpl-3.0 | 6,445 | 0.007913 |
# -*- coding: utf-8 -*-
from Scraping4blog import Scraping4blog
import sys,os
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../util')
from settings import SettingManager
def main():
conf = SettingManager()
instance = Scraping4blog(conf)
instance.run()
if __name__ == "__main__":
main... | yamanakahirofumi/mokobot | Scraping4blog/run.py | Python | mit | 323 | 0.01548 |
'''OpenGL extension OES.blend_subtract
This module customises the behaviour of the
OpenGL.raw.GLES1.OES.blend_subtract to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/OES/blend_subtract.txt
'''
from OpenGL import platform, const... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GLES1/OES/blend_subtract.py | Python | lgpl-3.0 | 768 | 0.009115 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module is Copyright (c) 2009-2013 General Solutions (http://gscom.vn) All Rights Reserved.
#
# This program is free software: you can redistribute it and/or... | addition-it-solutions/project-all | addons/l10n_vn/__openerp__.py | Python | agpl-3.0 | 1,696 | 0.008255 |
# -*- coding: utf-8 -*-
# Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the
# University of Virginia, University of Heidelberg, and University
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc.,... | copasi/COPASI | copasi/bindings/python/unittests/Test_CReport.py | Python | artistic-2.0 | 3,011 | 0.026901 |
import os, sys
from mod_python import util, Cookie
def _path(): return '/'.join(os.path.realpath(__file__).split('/')[:-1])
if _path() not in sys.path: sys.path.insert(0, _path())
def _load(req, page, dev= False):
"""
if not dev:
branch= 'html'
page= 'maintenance'
f= open('%s/%s/%s.html' %(_path(), branch, p... | Sth0nian/aurora | index.py | Python | mit | 2,289 | 0.046308 |
#
# Author: Henrique Pereira Coutada Miranda
# Example script to plot the weigth of the atomic species in the bandstructure
#
from qepy import *
import sys
import argparse
import matplotlib.pyplot as plt
folder = 'bands'
npoints = 20
p = Path([ [[0.0, 0.0, 0.0],'G'],
[[0.5, 0.0, 0.0],'M'],
[[1.... | palful/yambopy | tutorial/mos2/proj_mos2.py | Python | bsd-3-clause | 2,375 | 0.026947 |
#!/usr/bin/env python3
# Copyright (C) 2020-2021 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except... | fametrano/BitcoinBlockchainTechnology | tests/bip32/__init__.py | Python | mit | 417 | 0 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 27 01:20:46 2016
@author: caioau
"""
import matplotlib.pyplot as plt
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
def main():
G = nx.DiGraph() # G eh um grafo direcionado
# gera o grafo apartir de suas are... | caioau/caioau-personal | fluxos/lista 2/grafo-3.py | Python | gpl-3.0 | 1,558 | 0.032734 |
import builtins
# exec being part of builtins is Python 3 only
builtins.exec("print(42)") # $getCode="print(42)"
| github/codeql | python/ql/test/library-tests/frameworks/stdlib-py3/CodeExecution.py | Python | mit | 115 | 0 |
#!/usr/bin/env python
from __future__ import print_function
from molmod import *
# 0) Load the molecule and set the default graph
mol = Molecule.from_file("dopamine.xyz")
mol.set_default_graph()
# 1) Build a list of atom indexes involved in angles.
angles = []
# First loop over all atoms on the molecule.
for i1 in ... | molmod/molmod | molmod/examples/003_internal_coordinates/b_bending_angles.py | Python | gpl-3.0 | 1,360 | 0.000735 |
import sys
from typing import List
from .device import Device
from .enumeratehelper import EnumerateHelper
class DeviceManager(object):
__instance = None
@classmethod
def instance(cls):
if cls.__instance is None:
helper = EnumerateHelper()
cls.__instance = cls(helper)
... | FrodeSolheim/fs-uae-launcher | fsgamesys/input/devicemanager.py | Python | gpl-2.0 | 2,793 | 0 |
# $Id$
"""Mixins that are useful for classes using vtk_kit.
@author: Charl P. Botha <http://cpbotha.net/>
"""
from external.vtkPipeline.ConfigVtkObj import ConfigVtkObj
from external.vtkPipeline.vtkMethodParser import VtkMethodParser
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin ... | nagyistoce/devide | module_kits/vtk_kit/mixins.py | Python | bsd-3-clause | 13,612 | 0.002424 |
from bluepy.btle import *
import time
import serial
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
start_time = time.time()
data = []
data2 = []
data3 = []
data4 = []
angles = []
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
pen = pg.mkPen('k', width=8)
app = QtGui.QAppl... | ac769/continuum_technologies | software/ble_live_read_graphical.py | Python | mit | 2,073 | 0.002894 |
import os
import urllib2
import json
import re
##### Convert a name to a variable name
def cleanName(name):
return re.sub('[\W_]+', '', name.replace('&','And'))
##### Load the categories endpoint
file = urllib2.urlopen('http://api.simplegeo.com/1.0/features/categories.json')
contents = json.loads(file.read())
... | simplegeo/SimpleGeo.framework | scripts/update-sg-categories.py | Python | bsd-3-clause | 4,093 | 0.007085 |
import praw
import codecs
import unidecode
import os
import requests
import datetime
import regex as re
from collections import Counter
import RAKE
Rake = RAKE.Rake('foxstoplist.txt')
try:
requests.packages.urllib3.disable_warnings()
except:
pass
subreddits = ["earthporn", "japanpics"]
class redditLogger:
... | VerstandInvictus/ReddWall | reddwall.py | Python | mit | 3,528 | 0.003118 |
from __future__ import absolute_import
from django.conf.urls import patterns, include, url
from .views import Handler
handler = Handler.as_view()
urlpatterns = patterns('',
url(r'^$', handler, name='feincms_home'),
url(r'^(.*)/$', handler, name='feincms_handler'),
)
| pjdelport/feincms | feincms/views/cbv/urls.py | Python | bsd-3-clause | 278 | 0.003597 |
#TODO replace RPSGame with this class(for clarity)
__author__ = "Paul Council, Joseph Gonzoph, Anand Patel"
__version__ = "sprint1"
__credits__ = ["Greg Richards"]
# imports
from ServerPackage import Game
class RockPaperScissors(Game.Game):
""" this class simulates two players playing a game of rock, paper, sci... | PaulieC/sprint2-Council | AvailableGames/RockPaperScissors.py | Python | apache-2.0 | 2,006 | 0.001994 |
import os
import sys
class Widget(object):
"""
Widget is a User Interface (UI) component object. A widget
object claims a rectagular region of its content, is responsible
for all drawing within that region.
"""
def __init__(self, name, width=50, height=50):
self.name = name
sel... | ishikawa/modipyd | examples/widget/002/widget.py | Python | mit | 491 | 0.004073 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2012 Charles E. Vejnar
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
"""
Interface classes with the `Vienna RNA <http://www.tbi.univie.ac.at/RNA>`
executable programs.
"""
import re
import subprocess
... | PrashntS/miRmap | mirmap/vienna.py | Python | gpl-3.0 | 2,499 | 0.008003 |
from rlpy.Representations import IndependentDiscretization
from rlpy.Domains import GridWorld, InfiniteTrackCartPole
import numpy as np
from rlpy.Tools import __rlpy_location__
import os
def test_number_of_cells():
""" Ensure create appropriate # of cells (despite ``discretization``) """
mapDir = os.path.join(... | imanolarrieta/RL | tests/test_representations/test_IndependentDiscretization.py | Python | bsd-3-clause | 1,739 | 0.008626 |
from mieli.api import organization
from django.db import transaction
from django.conf import settings
from agora.api import link
@transaction.atomic
def create(user, **kwargs):
org = organization.get_by_username(user.username)
if org == None:
raise Exception("unknown organization for user '%s'" % user.... | pirata-cat/mieli | agora/api/user.py | Python | agpl-3.0 | 1,722 | 0.005226 |
import multiprocessing
import numpy as np
def configure(num_jobs=8, TEST=False, subtract=0, num_proc=None, num_thread_per_proc=None):
'''
num_jobs is typically the # of genes we are parallelizing over
'''
if num_proc is None:
num_proc = multiprocessing.cpu_count() - subtract
if num_jobs >... | mayavanand/RMMAFinalProject | build/lib/azimuth/local_multiprocessing.py | Python | bsd-3-clause | 821 | 0.003654 |
<<<<<<< HEAD
<<<<<<< HEAD
"""Unit tests for the copy module."""
import copy
import copyreg
import weakref
import abc
from operator import le, lt, ge, gt, eq, ne
import unittest
from test import support
order_comparisons = le, lt, ge, gt
equality_comparisons = eq, ne
comparisons = order_comparisons + equality_compari... | ArcherSys/ArcherSys | Lib/test/test_copy.py | Python | mit | 67,430 | 0.002625 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | xtiankisutsa/MARA_Framework | tools/enjarify/enjarify/hashtests.py | Python | lgpl-3.0 | 1,384 | 0.000723 |
#
# BitBake (No)TTY UI Implementation
#
# Handling output to TTYs or files (no TTY)
#
# Copyright (C) 2006-2012 Richard Purdie
#
# SPDX-License-Identifier: GPL-2.0-only
#
from __future__ import division
import os
import sys
import xmlrpc.client as xmlrpclib
import logging
import progressbar
import signal
import bb.ms... | schleichdi2/OPENNFR-6.3-CORE | bitbake/lib/bb/ui/knotty.py | Python | gpl-2.0 | 29,579 | 0.002874 |
import pygame
import numpy
def add_noise(surface):
mask = surface.copy()
mask.set_colorkey((255,255,255))
screen_array = pygame.surfarray.pixels3d(surface)
noise = numpy.random.random((surface.get_width(), surface.get_height())) * 255
screen_array *= noise[:, :, numpy.newaxis]
del screen_array... | erlehmann/noise-invaders | pyspaceinvaders_noise.py | Python | gpl-2.0 | 371 | 0.013477 |
from pyvows import Vows, expect
from minopt import minopt
@Vows.batch
class Minopt(Vows.Context):
def topic(self):
return minopt(['--baz', 'hello', '--foo', 'bar', '-baz',
'--riff=wobble', '--hey', '-ho', 'world'],
{'string': ['a', 'hey', 'w'],
... | AjayMT/minopt | minopt_vows.py | Python | mit | 1,187 | 0 |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
# pylint: disable=W0212,W0613
from twisted.internet.defer import Deferred, DeferredList
from twisted.python.failure import Failure
from twisted.trial.unittest import TestCase
import smartanthill.litemq.exchange as ex
from smartanthill.exceptio... | smartanthill/smartanthill1_0 | smartanthill/test/test_litemq.py | Python | mit | 4,944 | 0 |
"""
Syncronize with OPIMD
General information about opimd is available here (L{http://wiki.openmoko.org/wiki/Opimd}).
This file is part of Pisi.
Pisi 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 vers... | kichkasch/pisi | modules/contacts_opimd.py | Python | gpl-3.0 | 12,467 | 0.010588 |
#!/usr/bin/env python
import socket
import struct
import stkuser
from stkutil import running, socklist, updateinfo
STK_SERVER_PORT = 9007
STK_MAX_CLIENTS = 30
STK_MAX_PACKET_SIZE = 65535
STK_MAGIC = 'ST'
STK_VERSION = 0x0001
STK_CLIENT_FLAG = 0x00
STK_SERVER_FLAG = 0x01
STK_END = 0x07
COMMANDS =... | sharmer/sixtalk | stkserver/python/stksocket.py | Python | gpl-2.0 | 8,920 | 0.042377 |
# -*- coding: utf-8 -*-
#
# Name: Yubico Python Client
# Description: Python class for verifying Yubico One Time Passwords (OTPs).
#
# Author: Tomaž Muraus (http://www.tomaz-muraus.info)
# License: BSD
#
# Requirements:
# - Python >= 2.5
import re
import os
import sys
import time
import socket
import urllib
import url... | meddius/yubisaslauthd | yubico/yubico.py | Python | bsd-3-clause | 11,064 | 0.001085 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import psycopg2
import json
import urllib
import urllib2
import sys
con = None
con = psycopg2.connect("host='54.227.245.32' port='5432' dbname='pmt' user='postgres' password='postgres'")
cnt = 0
sqlFile = sys.argv[1]
print 'Argument List:', str(sys.argv[1])
try:
cur = co... | spatialdev/PMT | Database/Installation/executeSql.py | Python | apache-2.0 | 539 | 0.040816 |
'''
Adapted from https://github.com/tornadomeet/ResNet/blob/master/symbol_resnet.py
(Original author Wei Wu) by Antti-Pekka Hynninen
Implementing the original resnet ILSVRC 2015 winning network from:
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun. "Deep Residual Learning for Image Recognition"
'''
import mxnet as ... | coder-james/mxnet | example/image-classification/symbols/resnet-v1.py | Python | apache-2.0 | 8,907 | 0.010666 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.forms.util import flatatt, ErrorDict, ErrorList
from django.test import TestCase
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy
class FormsU... | rebost/django | tests/regressiontests/forms/tests/util.py | Python | bsd-3-clause | 3,188 | 0.008475 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/grappler/layout_optimizer_test.py | Python | apache-2.0 | 3,838 | 0.010422 |
"""United States Macroeconomic data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
Compiled by Skipper Seabold. All data are from the Federal Reserve Bank of St.
Louis [1] except the unemployment rate which was taken from the National
Bureau of... | wesm/statsmodels | scikits/statsmodels/datasets/macrodata/data.py | Python | bsd-3-clause | 3,085 | 0.004538 |
import logging
import os
from autotest.client.shared import error
from virttest import data_dir
@error.context_aware
def run_kexec(test, params, env):
"""
Reboot to new kernel through kexec command:
1) Boot guest with x2apic cpu flag.
2) Check x2apic enabled in guest if need.
2) Install a new kern... | spiceqa/virt-test | qemu/tests/kexec.py | Python | gpl-2.0 | 4,019 | 0 |
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Ignore indention messages, since legacy scripts use 2 spaces instead of 4.
# pylint: disable=bad-indentation,docstring-section-indent
# pylint: disable... | coreboot/chrome-ec | extra/tigertool/ecusb/tiny_servod.py | Python | bsd-3-clause | 1,767 | 0.00283 |
# Copyright 2019 Oihane Crucelaegui - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime, timedelta
from pytz import timezone, utc
from odoo import api, fields, models
class ResourceCalendar(models.Model):
_inherit = 'resource.calendar'
hour_gap = f... | oihane/odoo-addons | resource_time/models/resource_calendar.py | Python | agpl-3.0 | 2,606 | 0 |
# coding: utf-8
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from registration import forms as registration_forms
from kobo.static_lists import SECTORS, COUNTRIES
USERNAME_REGEX = r'^[a-z][a-z0-9_]+$'
USERNAME_MAX_LENGTH = 30
USERNAME_INV... | onaio/kpi | kpi/forms.py | Python | agpl-3.0 | 1,879 | 0.000532 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-04-23 05:02
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wallet', '0002_auto_20160418_0334'),
]
operations = [
migrations.RenameField(
... | priestc/MultiExplorer | multiexplorer/wallet/migrations/0003_auto_20160423_0502.py | Python | mit | 456 | 0 |
#from satpy import Scene
from satpy.utils import debug_on
debug_on()
#from glob import glob
#base_dir="/data/COALITION2/database/meteosat/radiance_HRIT/case-studies/2015/07/07/"
#import os
#os.chdir(base_dir)
#filenames = glob("*201507071200*__")
#print base_dir
#print filenames
##global_scene = Scene(reader="hrit_ms... | meteoswiss-mdr/monti-pytroll | scripts/demo_satpy_ndvi_decorate.py | Python | lgpl-3.0 | 7,498 | 0.015071 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/keystoneauth1/loading/base.py | Python | mit | 3,953 | 0 |
# Copyright (c) 2015-2016 Western Digital Corporation or its affiliates.
#
# 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 versio... | samiWaheed/nvme-cli | tests/nvme_compare_test.py | Python | gpl-2.0 | 3,106 | 0 |
#!/usr/bin/env python
import os
from django.core import management
os.environ['DJANGO_SETTINGS_MODULE'] = 'kgadmin.conf.settings'
if __name__ == "__main__":
management.execute_from_command_line()
| Karaage-Cluster/karaage-admin | manage.py | Python | gpl-3.0 | 201 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from wtforms import validators
from jinja2 import Markup
from studio.core.engines import db
from riitc.models import NaviModel, ChannelModel
from .base import BaseView
from .forms import CKTextAreaField
class Navi(BaseView):
column_labels = {'name... | qisanstudio/qsapp-riitc | src/riitc/panel/channel.py | Python | mit | 2,269 | 0 |
from __future__ import unicode_literals
from django.apps import AppConfig
class IngestConfig(AppConfig):
name = 'ingest'
| IQSS/miniverse | dv_apps/ingest/apps.py | Python | mit | 128 | 0 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/btp_literal_boolean255.py | Python | mit | 9,062 | 0.00011 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Glencoe Software, Inc. All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
# 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
# th... | tp81/openmicroscopy | components/tools/OmeroPy/src/omero/install/jvmcfg.py | Python | gpl-2.0 | 15,795 | 0.000253 |
#!/usr/bin/env python
"""
Input: fasta, int
Output: tabular
Return titles with lengths of corresponding seq
"""
import sys
assert sys.version_info[:2] >= ( 2, 4 )
def compute_fasta_length( fasta_file, out_file, keep_first_char, keep_first_word=False ):
infile = fasta_file
out = open( out_file, 'w')
keep... | icaoberg/cellorganizer-galaxy-tools | datatypes/converters/fasta_to_len.py | Python | gpl-3.0 | 1,377 | 0.02106 |
class User(object):
_instance = None
def __new__(cls, *args):
if not cls._instance:
cls._instance = super(User, cls).__new__(cls, *args)
return cls._instance
@property
def is_authenticated(self):
return True
@property
def is_active(self):
return Tru... | sanchopanca/rcblog | rcblog/user.py | Python | mit | 509 | 0 |
import tkinter as tk
from .convertwidget import ConvertWidget
class SpeedWidget(ConvertWidget):
"""Widget used to convert weight and mass units
Attributes:
root The Frame parent of the widget.
"""
def __init__(self, root):
super(SpeedWidget, self).__init__(root)
sel... | NicolasBi/super_converter | sconv/lib/gui/convertwidget/speed.py | Python | gpl-3.0 | 631 | 0 |
# Copyright 2014 PerfKitBenchmarker 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... | xiaolihope/PerfKitBenchmarker-1.7.0 | perfkitbenchmarker/data/__init__.py | Python | apache-2.0 | 6,390 | 0.007355 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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 limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/Rpcgen/RPCGEN.py | Python | mit | 4,064 | 0.000984 |
# -*- coding: utf-8 -*-
# Copyright 2012 Jaap Karssenberg <jaap.karssenberg@gmail.com>
import gtk
from zim.fs import TrashNotSupportedError
from zim.config import XDG_DATA_HOME, data_file
from zim.templates import list_template_categories, list_templates
from zim.gui.widgets import Dialog, BrowserTreeView, Button, ... | fabricehong/zim-desktop | zim/gui/templateeditordialog.py | Python | gpl-2.0 | 5,701 | 0.029118 |
import unittest
from db.migrations import migrations_util
class TestMigrationUtil(unittest.TestCase):
"""Test the CLI API."""
@classmethod
def setUpClass(cls):
cls.db_path = '/some/random/path/file.db'
def setUp(self):
self.parser = migrations_util.make_argument_parser(self.db_path)... | im0rtel/OpenBazaar | tests/test_migrations_util.py | Python | mit | 1,060 | 0.000943 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-present, CloudZero, Inc. All rights reserved.
# Licensed under the BSD-style license. See LICENSE file in the project root for full license information.
"""
Plugin used to extract all contextual information we can from EC2 network-interface (ENI) Cloudtrail Events.
"""
imp... | Cloudzero/cloudzero-reactor-aws | reactor/features/cloudtrail_event_source/ingest_plugins/ec2/network_interface.py | Python | bsd-3-clause | 2,385 | 0.002935 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Minimal web interface to cve-search to display the last entries
# and view a specific CVE.
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 2017 Pieter-Jan Moreels - pieterjan.moreels@gmail.com
# imports
import json
import os... | deontp/misc | zenoic_api/cve-search-master/web/advanced_api.py | Python | gpl-3.0 | 7,190 | 0.017524 |
from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
from api.models import Hackathon
from hackfsu_com.admin import hackfsu_admin
class WifiCred(models.Model):
hackathon = models.ForeignKey(to=Hackathon, on_delete=models.CASCADE)
username = models.CharField... | andrewsosa/hackfsu_com | api/api/models/wifi_cred.py | Python | apache-2.0 | 879 | 0.002275 |
# Copyright 2021, 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 writing... | google-research/federated | fedopt_guide/cifar10_resnet/federated_cifar10.py | Python | apache-2.0 | 5,796 | 0.004313 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache/libcloud | libcloud/backup/base.py | Python | apache-2.0 | 15,294 | 0.001177 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from GestureAgentsTUIO.Tuio import TuioAgentGenerator
import GestureAgentsPygame.Screen as Screen
from pygame.locals import *
class MouseAsTuioAgentGenerator(object):
def __init__(self):
self.pressed = False
self.myagent = None
self.sid = -1... | chaosct/GestureAgents | GestureAgentsPygame/Mouse.py | Python | mit | 1,272 | 0 |
from django import forms
from django.core.files import File
from django.conf import settings
from .widgets import FPFileWidget
import urllib2
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
class FPFieldMixin():
widget = FPFileWidget
default_mimetypes = "*/*"
... | thethomaseffect/travers-media-tools | django_filepicker/forms.py | Python | mit | 4,508 | 0.003327 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
"""
「石取りゲーム1」(「C言語による最新アルゴリズム事典」6ページより)
"""
def get_num(message):
sys.stdout.write(message)
n = ''
while (not n.isdigit()):
n = raw_input()
return int(n)
n = get_num(u"石の数?")
m = get_num(u"1回に取れる最大の石の数?")
if (n < 1 or m < 1):
sys.ex... | ryu22e/algorithm1000 | ishi/ishi1.py | Python | mit | 922 | 0.001337 |
import numpy as np
### 1: IH
### 2: EH
### 3: AE
### 4: AO
### 6: AH
### 7: UH
###
### 11: iyC beat
### 12: iyF be
### 21: eyC bait
### 22: eyF bay
### 41: ayV buy
### 47: ayO bite
### 61: oy boy
### 42: aw bough
### 62: owC boat
### 63: owF bow
### 72: uwC boot
### 73: uwF too
### 82: iw suit
### 43: ah father
### 53... | mmcauliffe/linguistic-helper-functions | linghelper/phonetics/vowels/mahalanobis.py | Python | gpl-3.0 | 11,375 | 0.008176 |
"""
File: tonal_permutation.py
Purpose: Class defining a function on one tonality based on a permatuation specification.
"""
from transformation.functions.tonalfunctions.tonal_permutation import TonalPermutation
class TonalityPermutation(TonalPermutation):
"""
Class implementation of a permutation on a set... | dpazel/music_rep | transformation/functions/tonalfunctions/tonality_permutation.py | Python | mit | 830 | 0.003614 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact
STANDARD_USERS = ("... | indictranstech/erpnext | erpnext/non_profit/doctype/member/member.py | Python | agpl-3.0 | 738 | 0.01897 |
from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(context, username, password, email, first_name, last_name):
... | jonrf93/genos | dbservices/tests/functional_tests/steps/user_service_steps.py | Python | mit | 1,685 | 0.003561 |
import sys
from arrowhead.core import Step
from arrowhead.core import ErrorArrow
from arrowhead.core import NormalArrow
from arrowhead.core import ValueArrow
def print_flow_state(flow, active_step_name=None, file=sys.stdout):
"""
Display the state of a given flow.
:param flow:
A Flow, instance o... | zyga/arrowhead | arrowhead/inspector.py | Python | bsd-3-clause | 6,120 | 0.000163 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This file contains everything needed to interface with JUnit"""
#####
# pyCheck
#
# Copyright 2012, erebos42 (https://github.com/erebos42/miscScripts)
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public... | m-wichmann/pyCheck | src/ifJUnit.py | Python | lgpl-3.0 | 1,199 | 0.000834 |
self.description = "CleanMethod = KeepCurrent"
sp = pmpkg("dummy", "2.0-1")
self.addpkg2db("sync", sp)
sp = pmpkg("bar", "2.0-1")
self.addpkg2db("sync", sp)
sp = pmpkg("baz", "2.0-1")
self.addpkg2db("sync", sp)
lp = pmpkg("dummy", "1.0-1")
self.addpkg2db("local", lp)
lp = pmpkg("bar", "2.0-1")
self.addpkg2db("loca... | vodik/pacman | test/pacman/tests/clean002.py | Python | gpl-2.0 | 615 | 0 |
# Copyright (c) 2018 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 app... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_maxout_op.py | Python | apache-2.0 | 5,104 | 0.001763 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
fro... | miroag/mfs | setup.py | Python | mit | 2,863 | 0.001048 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | nuagenetworks/vspk-python | vspk/v6/nuvmresync.py | Python | bsd-3-clause | 11,928 | 0.00897 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | dermute/ansible | lib/ansible/executor/task_queue_manager.py | Python | gpl-3.0 | 11,908 | 0.002939 |
from __future__ import absolute_import, unicode_literals
import json
import os
from django.contrib.contenttypes.models import ContentType
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.shortcuts import render
from django.utils.encoding import python_2_unicode_compa... | chrxr/wagtail | wagtail/wagtailforms/models.py | Python | bsd-3-clause | 9,515 | 0.001261 |
#!/usr/bin/python
# Copyright (c) 2009 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.
"""Extract UserMetrics "actions" strings from the Chrome source.
This program generates the list of known actions we expect to see in ... | rwatson/chromium-capsicum | chrome/tools/extract_actions.py | Python | bsd-3-clause | 4,264 | 0.010319 |
import os.path
import sys
from setuptools import setup, Command
class Tox(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import tox
sys.exit(tox.cmdline([]))
setup(
name="kafka-python",
versio... | skyportsystems/kafka-python | setup.py | Python | apache-2.0 | 990 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Feedback'
db.create_table(u'auxiliary_feedback', (
(u'id', self.gf('django.db.mo... | OriHoch/Open-Knesset | auxiliary/migrations/0007_auto__add_feedback.py | Python | bsd-3-clause | 5,930 | 0.007757 |
"""events
Revision ID: 9c92c85163a9
Revises: 666668eae682
Create Date: 2016-05-09 19:04:44.498817
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '9c92c85163a9'
down_revision = '666668eae682'
def upgrade():
op.cre... | gazeti/aleph | aleph/migrate/versions/9c92c85163a9_events.py | Python | mit | 1,959 | 0.011741 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: KevinMidboe
# @Date: 2017-02-08 14:00:04
# @Last Modified by: KevinMidboe
# @Last Modified time: 2017-02-16 17:08:08
import requests
from pprint import pprint
try:
from plexSearch import plexSearch
except ImportError:
from plex.plexSearch import plexSearc... | KevinMidboe/statusHandler | plex/tmdb.py | Python | mit | 1,451 | 0.026189 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def levelOrderBottom(self, root):
list = []
self.helper(list, root, 0)
return list[::-1]
d... | Jspsun/LEETCodePractice | Python/BinaryTreeLevelOrderTraversal2.py | Python | mit | 687 | 0.002911 |
from __future__ import absolute_import
from datetime import datetime
from django.core.urlresolvers import reverse
from sentry.models import Release
from sentry.testutils import APITestCase
class ProjectReleaseListTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = sel... | jokey2k/sentry | tests/sentry/api/endpoints/test_project_releases.py | Python | bsd-3-clause | 1,979 | 0 |
import unittest
from convert import convert
class TestConvert(unittest.TestCase):
def testEmptyJsonParse(self):
generated = convert.parse(convert._load_json_files("./jsonSamples/minimal.json")[0])
def testGlossaryJsonParse(self):
generated = convert.parse(convert._load_json_files("./jsonSampl... | HenrikPoulsen/Json2Class | test/testConvert.py | Python | mit | 475 | 0.006316 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | huiyiqun/check_mk | doc/treasures/Event_Console/snmptd_mkevent.py | Python | gpl-2.0 | 2,674 | 0.00187 |
# -*- coding: utf-8 -*-
import pathlib
from typing import Union
import lxml.etree
def save_as_xml(
element_tree: Union[lxml.etree._Element, lxml.etree._ElementTree],
filepath: Union[str, pathlib.Path],
pretty_print: bool = True) -> None:
"""save ElementTree in the file as XML... | 085astatine/togetter | togetter/xml_tools.py | Python | mit | 972 | 0 |
import unittest
from test import test_support
import UserDict, random, string
import gc, weakref
class DictTest(unittest.TestCase):
def test_constructor(self):
# calling built-in types without argument must return empty
self.assertEqual(dict(), {})
self.assert_(dict() is not {})
def ... | leighpauls/k2cro4 | third_party/python_26/Lib/test/test_dict.py | Python | bsd-3-clause | 17,651 | 0.005156 |
# -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from django.contrib.auth import get_u... | akvo/akvo-rsr | akvo/rest/serializers/user.py | Python | agpl-3.0 | 6,303 | 0.002697 |
from opc.drivers.baseclass import RopDriver
class Driver(RopDriver):
"""
Just pass back the raw data to the caller for rendering by the app
"""
def __init__(self, width, height, address):
pass
def putPixels(self, channel, pixels):
return pixels
def sysEx(self, systemId, comm... | slobberchops/rop | opc/drivers/echo.py | Python | gpl-3.0 | 455 | 0 |
#!/usr/bin/env python2.7
# __BEGIN_LICENSE__
#
# Copyright (C) 2010-2012 Stanford University.
# All rights reserved.
#
# __END_LICENSE__
# rectify.py
#
# Usage: rectify.py <lightfield_image.{tif,png,etc}> [--pixels-per-lenslet <ppl>]
#
# This script simply applies a rectification from a
# campixel_to_camlens.warp fil... | sophie63/FlyLFM | stanford_lfanalyze_v0.4/lfrectify.py | Python | bsd-2-clause | 3,622 | 0.004417 |
################################################################################
# Copyright (C) 2013-2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
"""
Unit tests for `dot` module.
"""
import unittest
import nu... | bayespy/bayespy | bayespy/inference/vmp/nodes/tests/test_dot.py | Python | mit | 34,668 | 0.006202 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ArticleComment'
db.create_table('cms_articlecomment', (
... | josircg/raizcidadanista | raizcidadanista/cms/migrations/0004_auto__add_articlecomment.py | Python | gpl-3.0 | 14,504 | 0.008274 |
# -*- coding: utf-8 -*-
import json
import datetime
from decimal import Decimal
from requests.packages.urllib3.util import parse_url
from .models import BaseModel
from .errors import OptimoError
DEFAULT_API_VERSION = 'v1'
class CoreOptimoEncoder(json.JSONEncoder):
"""Custom JSON encoder that knows how to ser... | fieldaware/optimoroute | optimo/util.py | Python | bsd-3-clause | 2,432 | 0.000822 |
# ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008-2012 Daniel Moisset, Ricardo Quesada, Rayentray Tappa,
# Lucio Torre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | shadowmint/nwidget | lib/cocos2d-0.5.5/cocos/layer/python_interpreter.py | Python | apache-2.0 | 9,867 | 0.003142 |
# Copyright 2014 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.
DEPS = [
'recipe_engine/step',
'url',
]
def RunSteps(api):
api.step('step1',
['/bin/echo', api.url.join('foo', 'bar', 'baz')])
api.step('... | eunchong/build | scripts/slave/recipe_modules/url/example.py | Python | bsd-3-clause | 743 | 0.012113 |
import os
import json
from django.test import TestCase
from documents.models import Document
from documents.exporters.sql import (MysqlExporter, OracleExporter,
PostgresExporter, SQLiteExporter)
TEST_DOCUMENT_PATH = os.path.join(os.path.dirname(__file__),
... | fatiherikli/dbpatterns | web/dbpatterns/documents/tests.py | Python | mit | 3,562 | 0.016844 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.