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 |
|---|---|---|---|---|---|
#----------------------------------------------------------------------------
# Use Python's bool constants if available, make some if not
try:
True
except NameError:
__builtins__.True = 1==1
__builtins__.False = 1==0
def bool(value): return not not value
__builtins__.bool = bool
# workarounds f... | sschiesser/ASK_server | MacOSX10.6/usr/include/wx-2.8/wx/wxPython/i_files/_core_ex.py | Python | gpl-2.0 | 10,418 |
from django import forms
from django.utils.safestring import mark_safe
from django.utils.safestring import SafeUnicode
from santaclara_base.models import Tag,Icon
class SantaClaraWidget(forms.Textarea):
class Media:
js = ('js/jquery.js',
'localjs/santa-clara-widget.js')
def render(self... | chiara-paci/santaclara-base | santaclara_base/widgets.py | Python | gpl-3.0 | 3,276 |
VERSION = (0, 0, 3, 'alpha')
if VERSION[-1] != "final": # pragma: no cover
__version__ = '.'.join(map(str, VERSION))
else: # pragma: no cover
__version__ = '.'.join(map(str, VERSION[:-1]))
__author__ = u'Anton Yevzhakov'
__maintainer__ = u'Anton Yevzhakov'
__email__ = 'anber@anber.ru'
from api import *
from d... | Anber/django-extended-messages | extended_messages/__init__.py | Python | bsd-3-clause | 362 |
#!/usr/bin/env python
#Copyright 2008 Sebastian Hagen
# This file is part of gonium.
#
# gonium 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 ... | sh01/gonium | src/linux/io.py | Python | gpl-2.0 | 2,385 |
"""RT-DC dataset core classes and methods"""
import warnings
import numpy as np
from dclab import definitions as dfn
from .. import downsampling
from ..polygon_filter import PolygonFilter
class NanWarning(UserWarning):
pass
class Filter(object):
def __init__(self, rtdc_ds):
"""Boolean filter arr... | ZellMechanik-Dresden/dclab | dclab/rtdc_dataset/filter.py | Python | gpl-2.0 | 9,234 |
from django import forms
from bootcamp.results.models import Result
class ResultForm(forms.ModelForm):
status = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(
widget=forms.TextInput(attrs={'class': 'form-control'}),
max_length=255)
variable = forms.CharField(
w... | davismathew/netbot-django | bootcamp/results/forms.py | Python | mit | 1,137 |
# Prints a statement
print "I will now count my chickens:"
# Prints the number of hens
print "Hens", 25.0 + 30.0 / 6.0
# Prints the number of roosters
print "Roosters", 100.0 - 25.0 * 3.0 % 4.0
# Prints a question
print "Is it true that 3 + 2 < 5 - 7?"
# Prints the answer to the question above
print 3 + 2 < 5 - 7
#... | udoyen/pythonlearning | 1-35/ex3.py | Python | mit | 788 |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^... | anduslim/codex | codex_project/codex_project/urls.py | Python | mit | 840 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings... | gvlproject/gvldash | gvldash/contrib/sites/migrations/0002_set_site_domain_and_name.py | Python | bsd-3-clause | 945 |
def get_sponsor(self, key):
with dbapi2.connect(self.dsn) as connection:
cursor = connection.cursor()
query = "SELECT SPONSORID, SWIMMERNAME, BIRTHYEAR FROM SPONSORS WHERE (LISTNO = %s)"
cursor.execute(query, (key,))
Sponsorid,Swimmername,Birthyear = curs... | itucsdb1506/itucsdb1506 | Pools.py | Python | gpl-3.0 | 2,390 |
# test sys.getsizeof() function
import sys
try:
sys.getsizeof
except AttributeError:
print("SKIP")
raise SystemExit
print(sys.getsizeof(1.0) >= 2)
| pfalcon/micropython | tests/float/sys_getsizeof_float.py | Python | mit | 162 |
#
#
# This source file is part of ELINA (ETH LIbrary for Numerical Analysis).
# ELINA is Copyright © 2019 Department of Computer Science, ETH Zurich
# This software is distributed under GNU Lesser General Public License Version 3.0.
# For more information, see the ELINA project website at:
# http://elina.ethz.ch
#... | eth-srl/OptOctagon | python_interface/elina_scalar_h.py | Python | apache-2.0 | 1,831 |
"""Expression module
"""
# The core class
from .ExpressionSet import ExpressionSet
# I/O tools
from ..io.ExpressionSetIO import RData2ExpressionSet
from ..io.ExpressionSetIO import HDF52ExpressionSet
from ..io.ExpressionSetIO import ExpressionSet2RData
from ..io.ExpressionSetIO import ExpressionSet2HDF5
| choyichen/omics | omics/expression/__init__.py | Python | mit | 306 |
# Standard imports
import unittest
import json
import logging
from datetime import datetime, timedelta
# Our imports
from emission.clients.gamified import gamified
from emission.core.get_database import get_db, get_mode_db, get_section_db
from emission.core.wrapper.user import User
from emission.core.wrapper.client im... | joshzarrabi/e-mission-server | emission/tests/client_tests/TestGamified.py | Python | bsd-3-clause | 7,135 |
# vim: ai ts=4 sts=4 et sw=4
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from django.db import models
from django.apps import apps
from django.utils.translation import ugettext_lazy as _
from clubhouse.core.models import BlockContext, BlockBase
from clubh... | chazmead/django-clubhouse | clubhouse/contrib/models/types.py | Python | bsd-2-clause | 2,536 |
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
# Hyper Parameters
sequence_length = 28
input_size = 28
hidden_size = 128
num_layers = 2
num_classes = 10
batch_size = 100
num_epochs = 2
learning_rate = 0.003
# MN... | jastarex/DeepLearningCourseCodes | 08_RNN_and_Seq2Seq/bidirection_rnn_pytorch.py | Python | apache-2.0 | 3,204 |
from .node import Node
class Scope(Node):
def __init__(self, file, position, access, comments, children):
super(Scope, self).__init__(file, position, access, comments, children)
| gfelbing/cppstyle | cppstyle/model/scope.py | Python | gpl-3.0 | 192 |
from django.conf import settings
from django.core.management.base import BaseCommand
from kombu import (Connection,
Exchange)
from treeherder.etl.pulse_consumer import ResultsetConsumer
class Command(BaseCommand):
"""
Management command to read resultsets from a set of pulse exchanges
... | akhileshpillai/treeherder | treeherder/etl/management/commands/read_pulse_resultsets.py | Python | mpl-2.0 | 2,229 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | tfroehlich82/EventGhost | eg/Classes/PluginItem.py | Python | gpl-2.0 | 6,460 |
# Copyright (C) 2014-2016 New York University
# This file is part of ReproZip which is released under the Revised BSD License
# See file LICENSE for full license details.
"""VisTrails package for reprounzip.
This package is the component loaded by VisTrails that provide the
reprounzip modules. A separate component, r... | VisTrails/VisTrails | vistrails/packages/reprounzip/__init__.py | Python | bsd-3-clause | 681 |
#/usr/bin/python
# The following module(s) are required for listing the files in a directory.
from os import listdir
from os.path import isfile, join
# The following module(s) are rquired for regular expressions.
import re
class ParseGTF:
# Function that initializes the ParseGTF class.
def __init__(self, pathToG... | ErikSchutte/QTL-mapping | data_file_conversion/parse_flux_gtf_to_transcrip_matrix.py | Python | apache-2.0 | 8,209 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('jumpserver.views',
# Examples:
url(r'^$', 'index', name='index'),
# url(r'^api/user/$', 'api_user'),
url(r'^skin_config/$', 'skin_config', name='skin_config'),
url(r'^login/$', 'Login', name='login'),
url(r'^logout/$',... | xskh2007/zjump | jumpserver/urls.py | Python | gpl-2.0 | 955 |
#!/usr/bin/python
import sys
import random
if len(sys.argv) < 2:
print ('Usage:<filename> <k> [nfold = 5]')
exit(0)
random.seed( 10 )
k = int( sys.argv[2] )
if len(sys.argv) > 3:
nfold = int( sys.argv[3] )
else:
nfold = 5
fi = open( sys.argv[1], 'r' )
ftr = open( sys.argv[1]+'.train', 'w' )
fte = op... | RPGOne/Skynet | xgboost-master/demo/regression/mknfold.py | Python | bsd-3-clause | 498 |
from __future__ import absolute_import, division, print_function, with_statement
import contextlib
import functools
import sys
import textwrap
import time
import platform
import weakref
from tornado.concurrent import return_future
from tornado.escape import url_escape
from tornado.httpclient import AsyncHTTPClient
fr... | nephics/tornado | tornado/test/gen_test.py | Python | apache-2.0 | 29,521 |
# sqlalchemy/pool/dbapi_proxy.py
# Copyright (C) 2005-2019 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""DBAPI proxy utility.
Provides transparent connection pooling on ... | skarra/PRS | libs/sqlalchemy/pool/dbapi_proxy.py | Python | agpl-3.0 | 4,320 |
from boilerpipe.extract import Extractor
extractor = Extractor(extractor='ArticleExtractor', url='http://www.christiantoday.com/article/iphone.6.problems.bendgate.still.continues.apple.mocked.videos.memes/41216.htm')
print extractor.getText() | lasoren/hivemind | python/summary.py | Python | mit | 243 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 11:46:48 2017
@author: p
"""
from epics import caget,caput
import time
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
plt.close('all')
filenRec='log_'+time.asctime().replace(' __','_').replace(' ','_')[4:]
fid=ope... | iABC2XYZ/abc | CM/cmCooorect_5.py | Python | gpl-3.0 | 14,829 |
# coding: utf-8
# # Antibody Response Pulse
# https://github.com/blab/antibody-response-pulse
#
# ### B-cells evolution --- cross-reactive antibody response after influenza virus infection or vaccination
# ### Adaptive immune response for repeated infection
# In[1]:
'''
author: Alvason Zhenhua Li
date: 04/09/201... | blab/antibody-response-pulse | bcell-array/code/Virus_Bcell_IgM_IgG_Infection_OAS_new-Copy2.py | Python | gpl-2.0 | 13,001 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/pbc/tddft/__init__.py | Python | apache-2.0 | 746 |
import matplotlib.pyplot as plt
from datos import data
import pandas
colors = ['lightcoral', 'lightskyblue','yellowgreen']
d=data('mtcars')
ps = pandas.Series([i for i in d.cyl])
c = ps.value_counts()
plt.pie(c, labels=c.index, colors=colors, autopct='%1.1f%%', shadow=True, startangle=0)
plt.axis('equal')
plt.title('... | cimat/data-visualization-patterns | display-patterns/Proportions/Pruebas/A41Simple_Pie_Chart_Matplotlib.py | Python | cc0-1.0 | 371 |
#python3.4 generate-testresult-docker.py output_dir=/home/geryxyz/major/testresults/ original_path=/home/geryxyz/major/joda-time patch_root=/home/geryxyz/major/joda-time-mutants merge_root=/home/geryxyz/major/joda-time-merge2 relative_path_to_patch=src/main/java
from soda import *
Phase(
'generate test results... | sed-szeged/soda-coverage-tools | java/script/sample/try/generate-testresult-docker.py | Python | lgpl-3.0 | 890 |
from operator import attrgetter
import logging
import blocks
import sys
logger = logging.getLogger(__name__)
class HashChainTask(object):
"""
- get hashes chain until we see a known block hash
"""
NUM_HASHES_PER_REQUEST = 2000
def __init__(self, chain_manager, peer, block_hash):
self.cha... | jnnk/pyethereum | pyethereum/synchronizer.py | Python | mit | 6,870 |
# -*- coding: utf-8 -*-
from datetime import datetime
from flask import (Blueprint, request, current_app, session, url_for, redirect,
render_template, g, flash, abort)
from flask_babel import gettext
from sqlalchemy.sql.expression import false
import crypto_util
import store
from db import db_sess... | micahflee/securedrop | securedrop/journalist_app/main.py | Python | agpl-3.0 | 8,000 |
#!/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/option/debug-time.py | Python | mit | 5,292 |
import _plotly_utils.basevalidators
class ShowlegendValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(self, plotly_name="showlegend", parent_name="volume", **kwargs):
super(ShowlegendValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/volume/_showlegend.py | Python | mit | 450 |
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
import Build, os, sys, Options, Task, Utils, cc, TaskGen, fnmatch, re, shutil, Logs, Constants
from Configure import conf
from Logs import debug
from samba_utils import SUBST_VARS_RECURSIVE
Ta... | freenas/samba | buildtools/wafsamba/wafsamba.py | Python | gpl-3.0 | 35,849 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'add_body_dialog.ui',
# licensing of 'add_body_dialog.ui' applies.
#
# Created: Tue Aug 7 17:47:07 2018
# by: pyside2-uic running on PySide2 5.11.0
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, Q... | shavera/Davidian | Astrolabe/system_ui/ui_add_body_dialog.py | Python | gpl-2.0 | 9,113 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from gui.dwidgets import DMenu
class SettingsMenu(DMenu):
"""docstring for SettingsMenu"""
def __init__(self, parent=None):
super(SettingsMenu, self).__init__(parent)
self.parent = parent
self.menuItems = [
{
'na... | dragondjf/musicplayer | gui/menus/settingsmenu.py | Python | gpl-2.0 | 3,819 |
"""CherryPy tools. A "tool" is any helper, adapted to CP.
Tools are usually designed to be used in a variety of ways (although some
may only offer one if they choose):
Library calls:
All tools are callables that can be used wherever needed.
The arguments are straightforward and should b... | imajes/Sick-Beard | cherrypy/_cptools.py | Python | gpl-3.0 | 19,648 |
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
from collections.abc import Set
# for backward compatibility with Python <3.7
from collections import OrderedDict
class OrderedSet(Set):
"""
Ordered collection of distinct hashable objects.
... | GuillaumeSeren/alot | alot/utils/collections.py | Python | gpl-3.0 | 696 |
import unittest
import transaction
from pyramid import testing
from .models import DBSession
class TestMyViewSuccessCondition(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
from sqlalchemy import create_engine
engine = create_engine('sqlite://')
from .models i... | gahayashi/artcrm | src/artcrm/tests.py | Python | gpl-3.0 | 1,497 |
#!/usr/bin/env python3
import datetime
import os
import subprocess
import sys
import time
if len(sys.argv) != 5:
sys.exit("Usage:\n\t%s <binary> <testcase> <checker> <report-builder>" % (sys.argv[0],))
binary = sys.argv[1]
testcase = sys.argv[2]
checker = sys.argv[3]
reportbuilder = sys.argv[4]
for i in [testca... | dbaeck/aspino | tests/pyregtest.py | Python | apache-2.0 | 2,046 |
# MIT License
#
# Copyright (c) 2019 Looker Data Sciences, 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 limitation the rights
# to use, copy, ... | looker-open-source/jk-sandbox | python/looker_sdk/sdk/api40/models.py | Python | mit | 531,823 |
"""Locate the data files in the eggs to open"""
"Special thanks to https://github.com/OrkoHunter/ping-me/tree/master/ping_me/data"
import os
import sys
def we_are_frozen():
return hasattr(sys, "frozen")
def modeule_path():
encoding = sys.getfilesystemencoding()
if we_are_frozen():
return os.path.... | TwistingTwists/sms | data/module_locator.py | Python | apache-2.0 | 418 |
# Copyright 2011-2013 James McCauley
#
# 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 ... | timhuanggithub/MyPOX | pox/openflow/discovery.py | Python | apache-2.0 | 19,024 |
# coding:utf-8
import logging
import numpy as np
from scipy.linalg import svd
from mla.base import BaseEstimator
np.random.seed(1000)
class PCA(BaseEstimator):
y_required = False
def __init__(self, n_components, solver="svd"):
"""Principal component analysis (PCA) implementation.
Transfor... | rushter/MLAlgorithms | mla/pca.py | Python | mit | 1,758 |
# -*- coding: utf-8 -*-
import itertools
from lxml import html
from lxml import etree
from odm.catalogs.utils import metautils
from odm.catalogs.CatalogReader import CatalogReader
verbose = False
rooturl = u'http://www.bochum.de'
url = u'/opendata/datensaetze/nav/75F9RD294BOLD'
def findfilesanddata(html):
# Sta... | mattfullerton/odm-catalogreaders | odm/catalogs/portals/bochum.py | Python | mit | 10,194 |
import sys
import _rawffi
from _ctypes.basics import _CData, _CDataMeta, keepalive_key,\
store_reference, ensure_objects, CArgObject
from _ctypes.array import Array
from _ctypes.pointer import _Pointer
import inspect
def names_and_fields(self, _fields_, superclass, anonymous_fields=None):
# _fields_: list of... | timm/timmnix | pypy3-v5.5.0-linux64/lib_pypy/_ctypes/structure.py | Python | mit | 10,129 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | maljac/odoo-addons | portal_account_summary/__openerp__.py | Python | agpl-3.0 | 1,638 |
import smtplib
import email.mime.text
mail_host = "" # "smtp.xxx.com"
mail_user = "" # "xxx@xxx.com"
mail_pass = "" # "xxx"
mail_postfix = "" # "xxx.com"
mailto_list = [""] # ["xxx@xxx.com"]
def send_mail(to_list, sub, content):
me = "hello"+"<"+mail_user+"@"+mail_postfix+">"
msg = email.mim... | followcat/predator | tools/mail.py | Python | lgpl-3.0 | 884 |
def calcETA (dict)
oETA = 0
for key in dict
route = dict [key]
for path in route
oETA += path.ETA
return oETA
| haohanshi/HackCMU217 | calcETA.py | Python | mit | 130 |
<<<<<<< HEAD
<<<<<<< HEAD
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for print.
Change:
'print' into 'print()'
'print ...' into 'print(...)'
'print ... ,' into 'print(..., end=" ")'
'print >>x, ...' into 'print(..., fil... | ArcherSys/ArcherSys | Lib/lib2to3/fixes/fix_print.py | Python | mit | 8,702 |
"""
Helper module that can load whatever version of the json module is available.
Plugins can just import the methods from this module.
Also allows date and datetime objects to be encoded/decoded.
"""
import datetime
from collections.abc import Iterable, Mapping
from contextlib import suppress
from typing import Any, ... | Flexget/Flexget | flexget/utils/json.py | Python | mit | 4,634 |
"""Setup config file to package SIP Processing BLock Controller library."""
from setuptools import setup
from sip_pbc.release import __version__
with open('README.md', 'r') as file:
LONG_DESCRIPTION = file.read()
setup(name='skasip-pbc',
version=__version__,
author='SKA SDP SIP team.',
descrip... | SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/processing_block_controller/setup.py | Python | bsd-3-clause | 1,115 |
# coding=utf-8
import pytest
@pytest.fixture
def dns_sd():
from pymachinetalk import dns_sd
return dns_sd
@pytest.fixture
def sd():
from pymachinetalk import dns_sd
sd = dns_sd.ServiceDiscovery()
return sd
def test_registeringServicesFromServiceContainerWorks(dns_sd, sd):
service = dns_s... | strahlex/pymachinetalk | pymachinetalk/tests/test_dns_sd.py | Python | mit | 13,743 |
# -*- encoding: utf-8 -*-
from shapely.wkt import loads as wkt_loads
import dsl
from . import FixtureTest
class TestCranes(FixtureTest):
def test_crane_landuse_line(self):
self.generate_fixtures(dsl.way(1842715060, wkt_loads('POINT (0.6785997623748069 51.43672148243049)'), {u'source': u'openstreetmap.org... | mapzen/vector-datasource | integration-test/1417-cranes.py | Python | mit | 1,083 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# do this when > 1.6!!!
# from django.db import migrations, models
from gazetteer.models import GazSource,GazSourceConfig,LocationTypeField,CodeFieldConfig,NameFieldConfig
from skosxl.models import Concept, Scheme, MapRelation
from gazetteer.settings imp... | rob-metalinkage/django-gazetteer | gazetteer/fixtures/mapstory_tm_world_config.py | Python | cc0-1.0 | 2,139 |
import os
import re
import sys
import subprocess
# Use the official chef lex file
# Compile from source each time
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'swedish_chef.l')
COMPILE_CMD = "lex -o /tmp/swedish_chef.c {0} && cc /tmp/swedish_chef.c -o /tmp/swedish_chef -ll".format(path)
subprocess... | chanelcici/card-io-ios-source | scripts/string_scripts/swedish_chef/swedish_chef.py | Python | mit | 799 |
import wave
import struct
BPM = 320.0
BEAT_LENGTH = 60.0 / BPM
START_BEAT = 80.0 # beat 80 is the 'huh' of the first 'uuh-huh'
START_TIME = START_BEAT * BEAT_LENGTH
BEAT_COUNT = 16.0
CLIP_LENGTH = BEAT_LENGTH * BEAT_COUNT
FRAME_RATE = 50.0
FRAME_LENGTH = 1 / FRAME_RATE
FRAME_COUNT = int(FRAME_RATE * CLIP_LENGTH)
PIC... | gasman/kisskill | scripts/oscilloscope.py | Python | mit | 859 |
import unittest
import ROOT
class TVector3Len(unittest.TestCase):
"""
Test for the pythonization that allows to get the size of a
TVector3 (always 3) by calling `len` on it.
"""
# Tests
def test_len(self):
v = ROOT.TVector3(1., 2., 3.)
self.assertEqual(len(v), 3)
if __name_... | root-mirror/root | bindings/pyroot/pythonizations/test/tvector3_len.py | Python | lgpl-2.1 | 357 |
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import socket
import sys
from smart_qq_bot.config import COOKIE_FILE
from smart_qq_bot.logger import logger
from smart_qq_bot.app import bot, plugin_manager
from smart_qq_bot.handler import MessageObserver
from smart_qq_bot.messages import mk_msg
from sm... | BlinkTunnel/SmartQQBot | src/smart_qq_bot/main.py | Python | gpl-3.0 | 1,781 |
__author__ = 'lat9wj'
from helper import *
greeting("hello") | luket4/cs3240-labdemo | hello.py | Python | mit | 61 |
# -*- coding: windows-1252 -*-
'''
From BIFF8 on, strings are always stored using UTF-16LE text encoding. The
character array is a sequence of 16-bit values4. Additionally it is
possible to use a compressed format, which omits the high bytes of all
characters, if they are all zero.
The following tables ... | jlaniau/conquests | xlwt/UnicodeUtils.py | Python | gpl-3.0 | 5,032 |
from django.db.models import Q
from rest_framework.generics import (
ListAPIView,
RetrieveAPIView,
DestroyAPIView,
CreateAPIView,
RetrieveUpdateAPIView
)
from rest_framework.filters import OrderingFilter
from .paginations import PostLimitOffsetPagination
from rest_framework.permissions import (
... | BigBorg/Blog | Blog/posts/api/views.py | Python | gpl-3.0 | 2,049 |
#-*- coding: utf-8 -*-
from . import register
from spirit.models.topic_notification import TopicNotification
from spirit.forms.topic_notification import NotificationForm
@register.assignment_tag()
def has_topic_notifications(user):
return TopicNotification.objects.for_access(user=user)\
.filter(is_read=... | Si-elegans/Web-based_GUI_Tools | spirit/templatetags/tags/topic_notification.py | Python | apache-2.0 | 858 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, re
text_pattern = re.compile(r'<ref>(.*?)<\/ref>\s*<dev>(.*?)\|<\/dev>')
printVerse = len(sys.argv) > 3 and sys.argv[3] == 'verse'
with open(sys.argv[1]) as input_file, open(sys.argv[2], 'w') as output_file:
for line in input_file:
match = text_pattern.searc... | rjawor/tagging | vw/to_data_format.py | Python | mit | 820 |
#!/usr/bin/env python3
#
# Copyright (c) 2014-2016 Matthias Klumpp <mak@debian.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your opti... | ximion/appstream-dep11 | dep11/iconhandler.py | Python | lgpl-3.0 | 16,459 |
#coding=utf-8
import math
import File_Interface as FI
from operator import itemgetter as _itemgetter
import numpy as np
import jieba
from sklearn import preprocessing
from collections import Counter
import numpy as np
class Word2Vec():
def __init__(self, vec_len=15000, learn_rate=0.025, win_len=5, mod... | yuanlaihenjiandan/word2vec | word2vec_v2.0.py | Python | mit | 15,850 |
#
# Copyright (c) 2008 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | colloquium/spacewalk | spacewalk/certs-tools/sslToolCli.py | Python | gpl-2.0 | 17,416 |
from keras.models import Model, clone_model
import keras.layers as layers
import numpy as np
from keras import backend as K
def build_double_inp(compile=False):
inp_1 = layers.Input((1,), name="inp_0")
inp_2 = layers.Input((1,), name="inp_1")
x = layers.Concatenate()([inp_1, inp_2])
x = layers.Dense(... | ViaFerrata/DL_pipeline_TauAppearance | scraps/test_model.py | Python | agpl-3.0 | 2,683 |
# -*- coding: utf-8 -*-
class IS_CUIT(object):
def __init__(self, error_message='debe ser un CUIT válido en formato XX-YYYYYYYY-Z'):
self.error_message = error_message
def __call__(self, value):
# validaciones mínimas
if len(value) == 13 and value[2] == "-" and value[11] == "-":
... | InstitutoPascal/Staff | models/cuit.py | Python | gpl-3.0 | 873 |
import click
@click.group(help="Command line interface for trefoil")
def cli():
pass | consbio/clover | trefoil/cli/__init__.py | Python | bsd-3-clause | 90 |
#!/usr/bin/env python
"""
dgit default configuration manager
[User] section:
* user.name: Name of the user
* user.email: Email address (to be used when needed)
* user.fullname: Full name of the user
"""
import os, sys, json, re, traceback, getpass
try:
from urllib.parse import urlparse
except:
from urlpars... | pingali/dgit | dgitcore/config.py | Python | isc | 5,839 |
#!/usr/bin/python3
import sys
import pickle
codons_dict = pickle.load(open("codons_dict.pickle", "rb"))
def rna_to_amino(string, codict=codons_dict):
"""Returns the amino acid sequence of an exact RNA sequence."""
assert len(string) % 3 == 0, "RNA sequence malformed (string length not divisible by 3)"
if... | andrew-quinn/rosalind-exercises | problems/prot/prot.py | Python | mit | 1,083 |
from __future__ import unicode_literals
class AppSettings(object):
def __init__(self):
pass
def _setting(self, name, dflt):
from django.conf import settings
getter = getattr(settings,
'SPONSOR_SETTING_GETTER',
lambda name, dflt: getat... | miguelfg/django-sponsors | sponsors/app_settings.py | Python | mit | 1,790 |
from mpi4py import MPI
import helloworld as hw
null = MPI.COMM_NULL
fnull = null.py2f()
hw.sayhello(fnull)
comm = MPI.COMM_WORLD
fcomm = comm.py2f()
hw.sayhello(fcomm)
try:
hw.sayhello(list())
except:
pass
else:
assert 0, "exception not raised"
| pressel/mpi4py | demo/wrap-f2py/test.py | Python | bsd-2-clause | 260 |
import numpy as np
import pickle
import ray
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.tf.misc import normc_initializer
from ray.rllib.models.tf.recurrent_net import RecurrentNetwork
from ray.rllib.utils.annotations import override
from ray.rllib.utils.framework import try_import_tf
tf1, tf, t... | pcmoritz/ray-1 | rllib/examples/models/rnn_spy_model.py | Python | apache-2.0 | 4,582 |
from collections import namedtuple
from model.flyweight import Flyweight
from model.static.database import database
from model.dynamic.inventory.item import Item
class TypeRequirements(Flyweight): #IGNORE:R0903
def __init__(self, type_id):
#prevents reinitializing
if "_inited" in self.__d... | Iconik/eve-suite | src/model/static/ram/type_requirements.py | Python | gpl-3.0 | 1,578 |
#!/usr/bin/python
"""
Context manager for temporarily suppressing logging
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2011-2014, University of Oxford"
__license__ = "MIT (htt... | gklyne/annalist | src/annalist_root/utils/SuppressLoggingContext.py | Python | mit | 1,098 |
import time
from emotion import Controller
from emotion import log as elog
from emotion.controller import add_axis_method
from emotion.axis import AxisState
from emotion.comm import tcp
"""
- Emotion controller for PiezoMotor PMD206 piezo motor controller.
- Ethernet
- Cyril Guilloud ESRF BLISS
- Thu 10 Apr 2014 09:... | esrf-emotion/emotion | emotion/controllers/PMD206.py | Python | gpl-2.0 | 16,601 |
#!/usr/bin/env python
"""
Image processing support functions
This file is part of mrgaze.
mrgaze 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 optio... | jmtyszka/mrgaze | mrgaze/improc.py | Python | mit | 3,537 |
"""
Input Class (TODO DOC)
"""
from c_sharp_vuln_test_suite_gen.sample import Sample
class InputSample(Sample): # Initialize the type of input and the code parameters of the class
"""FiletringSample class
Args :
**sample** (xml.etree.ElementTree.Element): The XML element containing the inpu... | stivalet/C-Sharp-Vuln-test-suite-gen | c_sharp_vuln_test_suite_gen/input_sample.py | Python | mit | 3,654 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | box/three.js | utils/exporters/blender/2.63/scripts/addons/io_mesh_threejs/export_threejs.py | Python | mit | 58,235 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-datalabeling | samples/generated_samples/datalabeling_v1beta1_generated_data_labeling_service_export_data_sync.py | Python | apache-2.0 | 1,635 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions... | ywcui1990/nupic.research | htmresearch/regions/LanguageSensor.py | Python | agpl-3.0 | 8,091 |
def run(whatweb, pluginname):
whatweb.recog_from_file(pluginname, "Public/Script/VertifyForm.js", "zzs20100721")
| cflq3/getcms | plugins/strongsoft_cms.py | Python | mit | 118 |
from .ucuenca import Ucuenca
from .ucuenca import UcuencaException
| stsewd/ucuenca.py | ucuenca/__init__.py | Python | mit | 68 |
""" Data iterator"""
import mxnet as mx
import numpy as np
import sys, os
import cv2
import time
import multiprocessing
import itertools
from scipy import ndimage
from sklearn import neighbors
sys.path.append('../')
from utils import get_rgb_data
from utils import get_spectral_data
from utils import get_polygons
fro... | u1234x1234/kaggle-dstl-satellite-imagery-feature-detection | b3_data_iter.py | Python | apache-2.0 | 13,936 |
# encoding=utf-8
import jieba.posseg as pseg
import jieba
import sys
import os
import urllib2
import json
import re
import copy
import datetime
import time
import calendar
from parsedate import parseDate
from getdata import*
from showAll import*
cwd_url = os.getcwd()
jieba.load_userdict(cwd + '/wendata/dict/dict1.tx... | xiaotianyi/INTELLI-City | docs/refer_project/wx/wenpl/divide.py | Python | mit | 11,082 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/r-colorspace/package.py | Python | lgpl-2.1 | 1,882 |
# Copyright (c) 2008-2009 Aryeh Leib Taurog, all rights reserved.
# Released under the New BSD license.
"""
This module contains a base type which provides list-style mutations
without specific data storage methods.
See also http://www.aryehleib.com/MutableLists.html
Author: Aryeh Leib Taurog.
"""
from django.utils.f... | rebost/django | django/contrib/gis/geos/mutable_list.py | Python | bsd-3-clause | 10,687 |
import unittest
from calc.interpreter import INTEGER, PLUS, Token, Interpreter, ParserError
class TestInterpreter(unittest.TestCase):
def test_addition(self):
interpreter = Interpreter('4 + 3')
result = interpreter.parse()
self.assertEqual(result, 7)
def test_subtraction(self):
... | reillysiemens/calc | tests/test_interpreter.py | Python | isc | 1,132 |
####################################################################################################
#
# PySpice - A Spice Package for Python
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | FabriceSalvaire/PySpice | PySpice/Tools/File.py | Python | gpl-3.0 | 7,617 |
"""
(c) Copyright Ascensio System SIA 2021
*
The MIT License (MIT)
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... | ONLYOFFICE/document-server-integration | web/documentserver-example/python/src/utils/users.py | Python | apache-2.0 | 4,239 |
""" :mod: RegisterReplica
==================
.. module: RegisterReplica
:synopsis: register replica handler
RegisterReplica operation handler
"""
__RCSID__ = "$Id $"
from DIRAC import S_OK, S_ERROR
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
from DIRAC.DataManagementSystem.Age... | calancha/DIRAC | DataManagementSystem/Agent/RequestOperations/RegisterReplica.py | Python | gpl-3.0 | 5,236 |
# -*- coding: utf-8 -*-
# © Didotech srl (www.didotech.com)
from osv import fields, orm
from tools.translate import _
class mrp_production_product_line(orm.Model):
_inherit = "mrp.production.product.line"
def onchange_product_id(self, cr, uid, ids, product_id, product_qty=1, context=None):
context ... | iw3hxn/LibrERP | sale_order_requirement/models/mrp_production_product_line.py | Python | agpl-3.0 | 762 |
import numpy as np
from week3 import lnn, tools
import os
def f(x):
if 0 <= x < 0.25:
return float(0)
elif 0.25 <= x < 0.5:
return 16.0 * (x - 0.25)
elif 0.5 <= x < 0.75:
return -16.0 * (x - 0.75)
elif 0.75 < x <= 1:
return float(0)
else:
raise ValueError('v... | cyruscyliu/diffentropy | week3/w3_lnn.py | Python | mit | 2,275 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import webapp2,jinja2,os
import logging
import wowapi
from datetime import datetime
from google.appengine.ext import ndb
from google.appengine.api.memcache import Client
from google.appengine.api import taskqueue
from google.appengine.api.taskqueue import Queue
from goog... | AndyHannon/ctrprogress | ranker.py | Python | mit | 11,305 |
import boto3
import datetime
import json
import logging
import os
import pytz
import requests
import structlog
import transaction
import urllib.parse
from botocore.exceptions import ClientError
from copy import deepcopy
from pyramid.httpexceptions import (
HTTPForbidden,
HTTPTemporaryRedirect,
HTTPNotFound... | hms-dbmi/fourfront | src/encoded/types/file.py | Python | mit | 77,254 |
from django.contrib.admin.views.main import ChangeList
from django.forms import ModelForm, TextInput
from django.contrib import admin
class NumberInput(TextInput):
"""
HTML5 Number input
Left for backwards compatibility
"""
input_type = 'number'
class SortableModelAdminBase(object):
"""
B... | buremba/django-admin-tools | admin_tools/forms.py | Python | mit | 1,640 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.