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 math
from pyb import DAC, micros, elapsed_micros
def tone1(freq):
t0 = micros()
dac = DAC(1)
while True:
theta = 2*math.pi*float(elapsed_micros(t0))*freq/1e6
fv = math.sin(theta)
v = int(126.0 * fv) + 127
#print("Theta %f, sin %f, scaled %d" % (theta, fv, v))
... | pramasoul/pyboard-fun | tone.py | Python | mit | 1,739 | 0.008626 |
#!/usr/bin/env python2
import sys, os
import pwd, grp
from gi.repository import Gtk, GObject, Gio, GdkPixbuf, AccountsService
import gettext
import shutil
import PIL
from PIL import Image
from random import randint
import re
import subprocess
gettext.install("cinnamon", "/usr/share/locale")
(INDEX_USER_OBJECT, INDEX... | Kulmerov/Cinnamon | files/usr/share/cinnamon/cinnamon-settings-users/cinnamon-settings-users.py | Python | gpl-2.0 | 37,177 | 0.00382 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleapis/python-documentai | samples/snippets/process_document_splitter_sample.py | Python | apache-2.0 | 3,497 | 0.001716 |
# Copyright 2012 OpenStack Foundation
#
# 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 l... | openstack/glance | glance/version.py | Python | apache-2.0 | 731 | 0 |
'''
Imports the hooks dynamically while keeping the package API clean,
abstracting the underlying modules
'''
from airflow.utils import import_module_attrs as _import_module_attrs
_hooks = {
'ftp_hook': ['FTPHook'],
}
_import_module_attrs(globals(), _hooks)
| cswaroop/airflow | airflow/contrib/hooks/__init__.py | Python | apache-2.0 | 264 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""Application template.
"""
# Import standard packages.
import inspect
import logging
# Import installed packages.
import matplotlib.pyplot as plt
import seaborn as sns
# Import local packages.
from .. import utils
# Define module exports:
__all__ =... | stharrold/demo | demo/app_template/template.py | Python | mit | 1,935 | 0.001034 |
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
import datetime # for checking renewal date range
class RenewBookForm(forms.Form):
renewal_date = forms.DateField(help_text="Enter a date between now and 4 weeks (default 3). ")
... | PatrickCmd/django_local_library | catalog/forms.py | Python | apache-2.0 | 776 | 0.016753 |
'''
*******************************************************************************
* ButtonEvent.py 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... | iocanto/bug-python-libraries | ButtonEvent.py | Python | gpl-3.0 | 2,246 | 0.026269 |
lookup = {}
lookup = dict()
lookup = {'age': 42, 'loc': 'Italy'}
lookup = dict(age=42, loc='Italy')
print(lookup)
print(lookup['loc'])
lookup['cat'] = 'cat'
if 'cat' in lookup:
print(lookup['cat'])
class Wizard:
# This actually creates a key value dictionary
def __init__(self, name, level... | derrickyoo/python-jumpstart | apps/09_real_estate_data_miner/concept_dicts.py | Python | mit | 933 | 0.005359 |
import logging
import json
import textwrap
from json.encoder import JSONEncoder
from logging import StreamHandler, Formatter, FileHandler
from ethereum.utils import bcolors, is_numeric
DEFAULT_LOGLEVEL = 'INFO'
JSON_FORMAT = '%(message)s'
PRINT_FORMAT = '%(levelname)s:%(name)s\t%(message)s'
FILE_PREFIX = '%(asctime... | nirenzang/Serpent-Pyethereum-Tutorial | pyethereum/ethereum/slogging.py | Python | gpl-3.0 | 10,541 | 0.001613 |
import re
import os
import sys
from jcompiler.token import tokenize
from jcompiler.parse import Parser
import jcompiler.xmlutil as xmlutil
def remove_comments(s):
return re.sub(r'(\s*//.*)|(\s*/\*(.|\n)*?\*/\s*)', '', s)
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'a input fil... | my-zhang/nand2tetris | ch10-frontend/jcompiler/cli.py | Python | mit | 709 | 0.026798 |
"""add timezone to each station
Revision ID: 4d0be367f095
Revises: 6722b0ef4e1
Create Date: 2014-03-19 16:43:00.326820
"""
# revision identifiers, used by Alembic.
revision = '4d0be367f095'
down_revision = '6722b0ef4e1'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated ... | rootio/rootio_web | alembic/versions/4d0be367f095_station_timezone.py | Python | agpl-3.0 | 644 | 0.01087 |
from setuptools import setup, find_packages
setup(
name='pulp_ostree_common',
version='1.0.0a2',
packages=find_packages(),
url='http://www.pulpproject.org',
license='GPLv2+',
author='Pulp Team',
author_email='pulp-list@redhat.com',
description='common code for pulp\'s ostree support',
)... | ipanova/pulp_ostree | common/setup.py | Python | gpl-2.0 | 321 | 0 |
import os
import sys
import datetime as dt
import json
from itertools import groupby
from kivy.properties import (StringProperty,
DictProperty,
ListProperty,
BooleanProperty)
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.sc... | 9and3r/RPi-InfoScreen-Kivy | screens/mythtv/screen.py | Python | gpl-3.0 | 6,297 | 0.000476 |
import sublime_plugin
from cmakehelpers.compilerflags import clang, gcc
from cmakehelpers.compilerflags import find_completions
COMPLETION_DATABASES = dict(
clang=dict(loader=clang, database=None),
gcc=dict(loader=gcc, database=None))
def log_message(s):
print("CMakeSnippets: {0}".format(s))
def load... | sevas/sublime_cmake_snippets | compiler_completions.py | Python | mit | 1,676 | 0.001193 |
from __future__ import absolute_import
import operator
from django.db import models
from django.db.models import Q
from django.utils import timezone
from sentry.db.models import Model, sane_repr
from sentry.db.models.fields import FlexibleForeignKey, JSONField
from sentry.ownership.grammar import load_schema
from f... | mvaled/sentry | src/sentry/models/projectownership.py | Python | bsd-3-clause | 5,206 | 0.000768 |
#
# The Python Imaging Library.
# $Id$
#
# image enhancement classes
#
# For a background, see "Image Processing By Interpolation and
# Extrapolation", Paul Haeberli and Douglas Voorhies. Available
# at http://www.sgi.com/grafica/interp/index.html
#
# History:
# 1996-03-23 fl Created
# 2009-06-16 fl Fixed mean calcu... | Amechi101/concepteur-market-app | venv/lib/python2.7/site-packages/PIL/ImageEnhance.py | Python | mit | 2,760 | 0 |
from __future__ import print_function
from sklearn.datasets import fetch_20newsgroups
from sklearn.decomposition import TruncatedSVD
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import Normalizer
from sklearn import metrics
import nu... | clara-labs/spherecluster | examples/document_clustering.py | Python | mit | 8,298 | 0.00229 |
import msgpackrpc
import time
class SumServer(object):
def sum(self, x, y):
return x + y
def sleepy_sum(self, x, y):
time.sleep(1)
return x + y
server = msgpackrpc.Server(SumServer())
server.listen(msgpackrpc.Address("localhost", 18800))
server.start()
| jpfairbanks/streaming | server.py | Python | bsd-3-clause | 286 | 0.01049 |
import unittest
from palindromes import is_palindrome
cases = (
('lsdkjfskf', False),
('radar', True),
('racecar', True),
)
class TestCorrectness(unittest.TestCase):
def test_identifies_palindromes(self):
for word, expectation in cases:
self.assertEqual(is_palindrome(word), expec... | Bradfield/algorithms-and-data-structures | book/deques/palindromes_test.py | Python | cc0-1.0 | 328 | 0 |
import ply.lex as lex
import re
tokens = (
'LANGLE', # <
'LANGLESLASH', # </
'RANGLE', # >
'EQUAL', # =
'STRING', # "hello"
'WORD') # Welcome!
state = (
("htmlcomment", "exclusive"),
)
t_ignore = ' '
def t_htmlcomment(token):
r'<!--'
token.lexer.begin('htmlcomment')
def t_htmlcommen... | melvin0008/pythoncodestrial | first.py | Python | apache-2.0 | 1,107 | 0.01897 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | tests/contrib/operators/test_gcp_bigtable_operator.py | Python | apache-2.0 | 31,128 | 0.001542 |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field references on 'Message'
db.delete_table('django_mailbox_message_references')
def backwards(self... | coddingtonbear/django-mailbox | django_mailbox/south_migrations/0009_remove_references_table.py | Python | mit | 2,520 | 0.007143 |
import urllib
from cyclone.web import asynchronous
from twisted.python import log
from sockjs.cyclone import proto
from sockjs.cyclone.transports import pollingbase
class JSONPTransport(pollingbase.PollingTransportBase):
name = 'jsonp'
@asynchronous
def get(self, session_id): ... | flaviogrossi/sockjs-cyclone | sockjs/cyclone/transports/jsonp.py | Python | mit | 3,786 | 0.003698 |
import sys
import numpy as np
from scipy import stats
import subprocess as sp
import datetime
import socket
import os
exec_name = sys.argv[1]
max_t = int(sys.argv[2])
ntries = 5
tot_timings = []
for t_idx in range(1,max_t + 1):
cur_timings = []
for _ in range(ntries):
# Run the process.
p = sp.Popen([exec_nam... | darioizzo/piranha | tools/benchmark.py | Python | gpl-3.0 | 911 | 0.023052 |
# Copyright (c) 2011 Justin Santa Barbara
#
# 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 applicab... | hanlind/nova | nova/tests/functional/api/client.py | Python | apache-2.0 | 15,004 | 0.000267 |
from number_theory import int_pow, prime_sieve, prime, mod_exp
from itertools import count
from math import ceil, sqrt
def find_n(p1, p2):
"""
Finds n such that for consecutive primes p1 and p2 (p2 > p1), n is
divisible by p2 and the last digits of n are formed by p1.
"""
len_p1 = len(str(p1))
... | peterstace/project-euler | OLD_PY_CODE/project_euler_old_old/134/134.py | Python | unlicense | 858 | 0.006993 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | haxwithaxe/qutebrowser | tests/unit/browser/test_webelem.py | Python | gpl-3.0 | 30,783 | 0 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectio... | mmottahedi/neuralnilm_prototype | scripts/e362.py | Python | mit | 5,901 | 0.009659 |
# position/views_admin.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .controllers import generate_position_sorting_dates_for_election, positions_import_from_master_server, \
refresh_cached_position_info_for_election, \
refresh_positions_with_candidate_details_for_election, \
refresh... | wevote/WeVoteServer | position/views_admin.py | Python | mit | 50,531 | 0.004552 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
operations = [
migrations.CreateModel(
name='Entry',
fields=[
('id', models.AutoField(auto_created=T... | tbeadle/django | tests/migrations/test_auto_now_add/0001_initial.py | Python | bsd-3-clause | 474 | 0.00211 |
import shutil
import json
from rest_framework import routers, serializers, viewsets, parsers, filters
from rest_framework.views import APIView
from rest_framework.exceptions import APIException
from rest_framework.response import Response
from django.core.exceptions import ValidationError
from django.core.files.uploa... | memex-explorer/memex-explorer | source/memex/rest.py | Python | bsd-2-clause | 8,218 | 0.003407 |
from buildbot.plugins import worker
infosun = {
"polyjit-ci": {
"host": "polyjit-ci",
"password": None,
"properties": {
"uchroot_image_path": "/data/polyjit/xenial-image/",
"uchroot_binary": "/data/polyjit/erlent/build/uchroot",
"can_build_llvm_debug": Fa... | PolyJIT/buildbot | polyjit/buildbot/slaves.py | Python | mit | 2,304 | 0.003038 |
# This file is part of MyPaint.
# Copyright (C) 2014 by Andrew Chadwick <a.t.chadwick@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
"""Modes ... | glenux/contrib-mypaint | gui/viewmanip.py | Python | gpl-2.0 | 3,703 | 0.00135 |
import app_info
import loggers
import plist_editor
__version__ = '1.9.1'
__all__ = ['app_info', 'fs_analysis', 'loggers', 'plist_editor', 'slack']
# This provides the ability to get the version from the command line.
# Do something like:
# $ python -m management_tools.__init__
if __name__ == "__main__":
pri... | univ-of-utah-marriott-library-apple/management_tools | management_tools/__init__.py | Python | mit | 376 | 0.00266 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
d = {'Michael':95, 'Henry':96, 'Emily':97}
d['Lucy'] = 94
d['Lucy'] = 91
key = (1, 2, 3)
d[key] = 98
print(d['Michael'])
d.pop('Michael')
print(d)
print('Tom' in d)
print(d.get('Tom'))
print(d.get('Tom'), -1)
s1 = set([1, 2, 2, 3, 3])
s2 = set([2, 3, 4])
s3 = set((1, 2))... | henryneu/Python | sample/dict.py | Python | apache-2.0 | 415 | 0.007229 |
import heapq
import sys
filename = "Median.txt"
lst = [int(l) for l in open(filename)]
H_low = []
H_high = []
sum = 0
for num in lst:
if len(H_low) > 0:
if num > -H_low[0]:
heapq.heappush(H_high, num)
else:
heapq.heappush(H_low, -num)
else:
heapq.heappush(H_low, -num)
if len(H_low) > len(H_high) + 1:
... | xala3pa/my-way-to-algorithms | graphs/hash/python/median.py | Python | mit | 489 | 0.05317 |
#!/usr/bin/env python
#
# Copyright 2010 Andrei <vish@gravitysoft.org>
#
# 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... | barmalei/scalpel | lib/gravity/common/db.py | Python | lgpl-3.0 | 10,270 | 0.013048 |
from __future__ import print_function
import unittest
import sys
import os
import re
import tempfile
import shutil
import glob
import warnings
warnings.simplefilter("default")
# Only use coverage if it's new enough and is requested
try:
import coverage
if not hasattr(coverage.coverage, 'combine'):
cov... | salilab/saliweb | test/backend/run-all-tests.py | Python | lgpl-2.1 | 3,023 | 0 |
""":mod:`ShopWizardResult` -- Provides an interface for shop wizard results
.. module:: ShopWizardResult
:synopsis: Provides an interface for shop wizard results
.. moduleauthor:: Joshua Gilman <joshuagilman@gmail.com>
"""
from neolib.exceptions import parseException
from neolib.inventory.Inventory import Inventor... | jmgilman/Neolib | neolib/inventory/ShopWizardResult.py | Python | mit | 3,097 | 0.009041 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import markdown
from sklearn import metrics
from sklearn.externals import joblib
import re
def plot_precision_recall_n(y_true, y_prob, model_name=None):
# thanks rayid
from sklearn.metrics import precision_recall_curve
y_score = y_prob
... | dssg/babies-public | babysaver/evaluation.py | Python | mit | 5,646 | 0.007793 |
"""Unit tests for the ``organizations`` paths.
Each ``APITestCase`` subclass tests a single URL. A full list of URLs to be
tested can be found here:
http://theforeman.org/api/apidoc/v2/organizations.html
:Requirement: Organization
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: API
:TestType: F... | elyezer/robottelo | tests/foreman/api/test_organization.py | Python | gpl-3.0 | 17,745 | 0 |
#!/usr/bin/env python
#
# Copyright (c) 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list o... | teamfx/openjfx-8u-dev-rt | modules/web/src/main/native/Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_implementation.py | Python | gpl-2.0 | 7,074 | 0.003534 |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = ""
services_str = ""
pkg_name = "quad"
dependencies_str = "std_msgs;geometry_msgs;kobuki_msgs;hector_uav_msgs;nav_msgs;sensor_msgs;gazebo_msgs;tf"
langs = "gencpp;genlisp;genpy"
dep_include_paths_str = "std_msgs;/opt/ros/hydro/share/std_msgs/cmake/../m... | rafafigueroa/cws | build/quad/cmake/quad-genmsg-context.py | Python | apache-2.0 | 928 | 0.002155 |
#!/usr/bin/env python
################################################################################
#
# Project Euler - Problem 6
#
# The sum of the squares of the first ten natural numbers is,
#
# 1^2 + 2^2 + ... + 10^2 = 385
# The square of the sum of the first ten natural numbers is,
#
# (1 + 2 + ... + 10)^2 = 5... | carrdelling/project_euler | problem6.py | Python | gpl-2.0 | 996 | 0.002008 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | eayunstack/neutron | neutron/tests/unit/extensions/test_subnet_service_types.py | Python | apache-2.0 | 14,519 | 0 |
from ..utils import *
##
# Minions
class AT_019:
"Dreadsteed"
deathrattle = Summon(CONTROLLER, "AT_019")
class AT_021:
"Tiny Knight of Evil"
events = Discard(FRIENDLY).on(Buff(SELF, "AT_021e"))
AT_021e = buff(+1, +1)
class AT_023:
"Void Crusher"
inspire = Destroy(RANDOM_ENEMY_MINION | RANDOM_FRIENDLY_MINI... | beheh/fireplace | fireplace/cards/tgt/warlock.py | Python | agpl-3.0 | 950 | 0.024211 |
#!/usr/bin/env python
#
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import multiprocessing
import optparse
import os
import sys
from pylib import android_commands
from pylib import test_options_pa... | junmin-zhu/chromium-rivertrail | build/android/adb_install_apk.py | Python | bsd-3-clause | 1,365 | 0.011722 |
# -*- coding: utf-8 -*-
"""configuration module for MPContribs Flask API"""
import os
import datetime
import json
import gzip
formulae_path = os.path.join(
os.path.dirname(__file__), "contributions", "formulae.json.gz"
)
with gzip.open(formulae_path) as f:
FORMULAE = json.load(f)
VERSION = datetime.datetime... | materialsproject/MPContribs | mpcontribs-api/mpcontribs/api/config.py | Python | mit | 5,326 | 0.003567 |
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# these are system modules
import math
import numpy
import random
import sys
import urllib
# these are my local modules
import miscIO
import path
import tsvIO
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-... | cancerregulome/gidget | commands/feature_matrix_construction/main/filterPWPV.py | Python | mit | 4,776 | 0.002094 |
import os, pygame
#create window of correct size (320x200, with some multiple)
x = 320
y = 200
size_mult = 4
bright_mult = 4
pygame.init()
os.environ['SDL_VIDEO_WINDOW_POS'] = str(0) + "," + str(40) #put window in consistent location
os.environ['SDL_VIDEO_WINDOW_POS'] = str(0) + "," + str(40) #put window in consisten... | delMar43/wcmodtoolsources | WC1_clone/room_engine/win_init.py | Python | mit | 424 | 0.023585 |
from builtins import object
from nose.tools import assert_equal, assert_not_equal, raises
from nose.plugins.skip import Skip, SkipTest
from openpathsampling.range_logic import *
class TestRangeLogic(object):
def test_range_and(self):
assert_equal(range_and(1, 3, 2, 4), [(2, 3)])
assert_equal(range... | choderalab/openpathsampling | openpathsampling/tests/test_range_logic.py | Python | lgpl-2.1 | 4,127 | 0.000969 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softw... | timeyyy/PyUpdater | pyupdater/hooks/hook-cryptography.py | Python | bsd-2-clause | 1,600 | 0 |
# Copyright 2016-2021 IBM Corp. 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... | zhmcclient/python-zhmcclient | tests/unit/zhmcclient/test_activation_profile.py | Python | apache-2.0 | 11,882 | 0 |
# Copyright 2013-2017 The Meson development team
# 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 agre... | wberrier/meson | mesonbuild/dependencies/misc.py | Python | apache-2.0 | 14,951 | 0.001271 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui4/printdialog_base.ui'
#
# Created: Mon May 4 14:30:35 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self,... | matrumz/RPi_Custom_Files | Printing/hplip-3.15.2/ui4/printdialog_base.py | Python | gpl-2.0 | 5,718 | 0.002973 |
def MassFit(particle) :
if raw_input("Do %s mass fit? [y/N] " % (particle)) not in ["y", "Y"]:
return
print "************************************"
print "* Doing mass fit *"
print "************************************"
f = TFile.Open("workspace.root")
w = f.Get("w")
asse... | lbel/Maastricht-Masterclass-2015 | scripts/MassFit.py | Python | mit | 2,260 | 0.031858 |
__author__ = 'bdeutsch'
import re
import numpy as np
import pandas as pd
# List cards drawn by me and played by opponent
def get_cards(filename):
# Open the file
with open(filename) as f:
mycards = []
oppcards = []
for line in f:
# Generate my revealed card list
... | aspera1631/hs_logreader | logreader.py | Python | mit | 4,183 | 0.005738 |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, The BiPy Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------... | biocore/pyqi | pyqi/core/interfaces/html/input_handler.py | Python | bsd-3-clause | 1,074 | 0.005587 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | SymbiFlow/prjuray | fuzzers/004-tileinfo/cleanup_site_pins.py | Python | isc | 4,765 | 0.000839 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-translate | samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_async.py | Python | apache-2.0 | 1,703 | 0.001762 |
#!/usr/bin/env python
from fs.errors import ResourceNotFoundError
from fs.opener import opener
from fs.commands.runner import Command
import sys
class FSrm(Command):
usage = """fsrm [OPTION]... [PATH]
Remove a file or directory at PATH"""
def get_optparse(self):
optparse = super(FSrm, self).get_optp... | PyFilesystem/pyfilesystem | fs/commands/fsrm.py | Python | bsd-3-clause | 1,775 | 0.003944 |
"""
Test cases to cover Accounts-related behaviors of the User API application
"""
import datetime
import hashlib
import json
from copy import deepcopy
from unittest import mock
import ddt
import pytz
from django.conf import settings
from django.test.testcases import TransactionTestCase
from django.test.utils import ... | edx/edx-platform | openedx/core/djangoapps/user_api/accounts/tests/test_views.py | Python | agpl-3.0 | 53,614 | 0.003117 |
DEBUG = False
BASEDIR = ''
SUBDIR = ''
PREFIX = ''
QUALITY = 85
CONVERT = '/usr/bin/convert'
WVPS = '/usr/bin/wvPS'
PROCESSORS = (
'populous.thumbnail.processors.colorspace',
'populous.thumbnail.processors.autocrop',
'populous.thumbnail.processors.scale_and_crop',
'populous.thumbnail.processors.filters'... | caiges/populous | populous/thumbnail/defaults.py | Python | bsd-3-clause | 324 | 0 |
'''
Author: Peter Chip (furamail001@gmail.com)
Date: 2015 03 25
Given: Positive integers n≤100 and m≤20.
Return: The total number of pairs of rabbits that will remain after the n-th month if all rabbits live for m months.
Theory: The standard fibonacci series : 1 1 2 3 5 8 13
fn = fn-1 + fn-2
In re... | amidoimidazol/bio_info | Rosalind.info Problems/Mortal Fibonacci Rabbits.py | Python | mit | 1,178 | 0.005111 |
import sys
import os
import os.path
import glob
from optparse import OptionParser
#-------------------------------------------------------------------------------
# the main function
# cd bin_VS2010
# ctest -C Release
# cd Testing
# python ../../elastix/Testing/elx_get_checksum_list.py -l elastix_run*
# cd ..
# cmake ... | SuperElastix/elastix | Testing/elx_get_checksum_list.py | Python | apache-2.0 | 2,114 | 0.028382 |
#
# Copyright (C) 2012, 2014 UNINETT
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# This program is distributed in the h... | alexanderfefelov/nav | python/nav/eventengine/plugins/modulestate.py | Python | gpl-2.0 | 2,481 | 0 |
"""Conditional Event item definition."""
from gaphor.diagram.presentation import (
Classified,
ElementPresentation,
from_package_str,
)
from gaphor.diagram.shapes import Box, IconBox, Text
from gaphor.diagram.support import represents
from gaphor.diagram.text import FontStyle, FontWeight
from gaphor.RAAML ... | amolenaar/gaphor | gaphor/RAAML/fta/conditionalevent.py | Python | lgpl-2.1 | 1,442 | 0.000693 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP
#
# 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 limi... | andreadean5/python-hpOneView | hpOneView/resources/servers/logical_enclosures.py | Python | mit | 9,117 | 0.002962 |
class EventSearchPageLocators(object):
NAME_FIELD = ".form-control[name='name']"
START_DATE_FIELD = ".form-control[name='start_date']"
END_DATE_FIELD = ".form-control[name='end_date']"
CITY_FIELD = ".form-control[name='city']"
STATE_FIELD = ".form-control[name='state']"
COUNTRY_FIELD = ".form-c... | systers/vms | vms/pom/locators/eventSearchPageLocators.py | Python | gpl-2.0 | 481 | 0.002079 |
"""
Utilities module whose functions are designed to do the basic processing of
the data using obspy modules (which also rely on scipy and numpy).
:copyright:
EQcorrscan developers.
:license:
GNU Lesser General Public License, Version 3
(https://www.gnu.org/copyleft/lesser.html)
"""
import numpy as np
imp... | calum-chamberlain/EQcorrscan | eqcorrscan/utils/pre_processing.py | Python | gpl-3.0 | 39,205 | 0 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import pytest
import numpy as np
from ..convolve import convolve, convolve_fft
from ..kernels import Gaussian2DKernel
from ...nddata import NDDat... | kelle/astropy | astropy/convolution/tests/test_convolve_nddata.py | Python | bsd-3-clause | 1,827 | 0.002737 |
""" Testing DICOM wrappers
"""
from os.path import join as pjoin, dirname
import gzip
import numpy as np
try:
import dicom
except ImportError:
have_dicom = False
else:
have_dicom = True
dicom_test = np.testing.dec.skipif(not have_dicom,
'could not import pydicom')
from... | ME-ICA/me-ica | meica.libs/nibabel/nicom/tests/test_dicomwrappers.py | Python | lgpl-2.1 | 6,163 | 0.004543 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!가입; 봇 게임센터에 가입합니다.\n!내정보; 내 등록된 정보를 봅니다."""
import re
import json
from botlib import BotLib
from rpg import RPG
from util.util import enum
CmdType = enum(
Register = 1,
MyInfo = 2,
WeaponInfo = 3,
AddWeapon = 4,
UpgradeWeapon = 5,
)
# 입력으로부터 명령어 ... | storyhe/playWithBot | plugins/rpgbot.py | Python | mit | 3,282 | 0.014009 |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | lach76/scancode-toolkit | src/commoncode/functional.py | Python | apache-2.0 | 5,818 | 0.001203 |
import unittest
import imp
import os
import errno
import sys
import glob
import re
from distutils.errors import *
def unlink(path):
try:
os.unlink(path)
except OSError, exc:
if exc.errno != errno.ENOENT:
raise
class BrokenTest(unittest.TestCase.failureException):
def __repr__... | sshrdp/mclab | lib/antlr-3.0.1/runtime/Python/tests/testbase.py | Python | apache-2.0 | 9,623 | 0.004053 |
'''
.. module:: skrf.network
========================================
network (:mod:`skrf.network`)
========================================
Provides a n-port network class and associated functions.
Most of the functionality in this module is provided as methods and
properties of the :class:`Network` Class.
Networ... | hohe/scikit-rf | skrf/network.py | Python | bsd-3-clause | 141,218 | 0.00973 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_provider_operations_operations.py | Python | mit | 4,782 | 0.004391 |
#!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Contact: Ian Horn <ian@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WAR... | imh/gnss-analysis | gnss_analysis/agg_run.py | Python | lgpl-3.0 | 2,348 | 0.013203 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
import hashlib
import six
from djan... | hrayr-artunyan/shuup | shuup/utils/filer.py | Python | agpl-3.0 | 5,631 | 0.003374 |
# -*-Python-*-
################################################################################
#
# File: frontend.py
# RCS: $Header: $
# Description: frontend:
# responsibility:
# init backend
# init processors
# handle two query types:
# ... | laats/dpdq | src/qp/frontend.py | Python | gpl-3.0 | 3,696 | 0.005952 |
"""
Copyright (c) 2012, CCL Forensics
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 copyright
notice, this list of conditions and the fo... | Wonfee/pymobiledevice | util/ccl_bplist.py | Python | gpl-3.0 | 15,606 | 0.005318 |
import _plotly_utils.basevalidators
class MaxpointsValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="maxpoints", parent_name="histogram.stream", **kwargs
):
super(MaxpointsValidator, self).__init__(
plotly_name=plotly_name,
parent... | plotly/python-api | packages/python/plotly/plotly/validators/histogram/stream/_maxpoints.py | Python | mit | 550 | 0 |
import os
import shutil
import jinja2
from saliere.core import UsageError
class Templatizer:
"""Template manager.
Handles all the template related operations.
"""
def __init__(self, template_path_list=None, template_type=None):
"""Initializer.
:param template_path_list: the list o... | TeamLovely/Saliere | saliere/templatizer.py | Python | mit | 6,214 | 0.001609 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from io import BytesIO
from django.core.files.storage import Storage
class TestStorage(Storage):
def __init__(self, *args, **kwargs):
self.reset()
def _open(self, name, mode='rb'):
if not self.exists(name):
if 'w' i... | jsatt/django-db-email-backend | test_app/storage.py | Python | mit | 1,353 | 0.001478 |
import urllib.request
pagina = urllib.request.urlopen(
'http://beans.itcarlow.ie/prices-loyalty.html')
texto = pagina.read().decode('utf8')
onde = texto.find('>$')
início = onde + 2
fim = início + 4
preço = texto[início:fim]
if preço < 4.74:
print ('Comprar pois está barato:', preço)
else:
prin... | wsricardo/mcestudos | treinamento-webScraping/Abraji/p08.py | Python | gpl-3.0 | 342 | 0.01194 |
from django.db import models
from _datetime import date
class Restaurant(models.Model):
name = models.CharField(max_length=200)
transportation = models.BooleanField(default=False)
weatherSensetion = models.BooleanField(default=False)
status = models.BooleanField(default=True)
totalDay = models.Inte... | itucsProject2/Proje1 | restaurant/models.py | Python | unlicense | 639 | 0.00626 |
#!/usr/bin/python
"""
::
This experiment is used to study Half wave rectifiers
"""
from __future__ import print_function
from PSL_Apps.utilitiesClass import utilitiesClass
from PSL_Apps.templates import ui_template_graph_nofft as template_graph_nofft
from PyQt4 import QtGui,QtCore
import sys,time
params = ... | jithinbp/pslab-desktop-apps | psl_res/GUI/B_ELECTRONICS/B_Opamps/L_Summing.py | Python | gpl-3.0 | 4,802 | 0.05935 |
"""
Bob is a honest user. Bob creates transactions and smart contracts, like Alice.
Thread for sync must be started separately, wallet must be already created.
"""
from hodl import block
import logging as log
def main(wallet, keys=None):
log.info("Bob's main started")
log.debug("Bob's money: " + str(wallet.bc... | leofnch/kc | tests/testnet/roles/Bob.py | Python | gpl-3.0 | 526 | 0 |
#!/usr/bin/python
# Copyright 2014 Google Inc. All Rights Reserved.
"""Package application for the given platform and build configs.
Depending on platform, this will create a package suitable for distribution.
If the buildbot is running the script, it will be uploaded to the
buildbot staging area.
Usage varies depend... | snibug/gyp_example | build/package_application.py | Python | apache-2.0 | 3,909 | 0.008186 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012 CERN.
##
## Invenio 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) a... | Panos512/invenio | modules/miscutil/lib/upgrades/invenio_2012_11_04_circulation_and_linkback_updates.py | Python | gpl-2.0 | 4,682 | 0.006621 |
#!/usr/bin/env python3
import argparse
from pathlib import Path
from PIL import Image
parser = argparse.ArgumentParser(
prog='emoji-extractor',
description="""Resize extracted emojis to 128x128.""")
parser.add_argument(
'-e', '--emojis',
help='folder where emojis are stored',
default='output/',
... | SMSSecure/SMSSecure | scripts/emoji-extractor/remove-emoji-margins.py | Python | gpl-3.0 | 738 | 0.001355 |
"""Start/stop/manage workers."""
from __future__ import absolute_import, unicode_literals
import errno
import os
import shlex
import signal
import sys
from collections import OrderedDict, defaultdict
from functools import partial
from subprocess import Popen
from time import sleep
from kombu.utils.encoding import fro... | kawamon/hue | desktop/core/ext-py/celery-4.2.1/celery/apps/multi.py | Python | apache-2.0 | 15,740 | 0 |
"""The Tile component."""
import asyncio
from datetime import timedelta
from pytile import async_login
from pytile.errors import SessionExpiredError, TileError
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.helpers import aioht... | tboyce1/home-assistant | homeassistant/components/tile/__init__.py | Python | apache-2.0 | 3,733 | 0.000536 |
from __future__ import print_function
import xml.dom.minidom
import DWML
import datetime
import pyxb.binding.datatypes as xsd
import urllib2
import time
import collections
import sys
# Get the next seven days forecast for two locations
zip = [ 85711, 55108 ]
if 1 < len(sys.argv):
zip = sys.argv[1:]
begin = xsd.dat... | jonfoster/pyxb-upstream-mirror | examples/ndfd/forecast.py | Python | apache-2.0 | 2,426 | 0.005359 |
# Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... | kfcpaladin/sze-the-game | renpy/editor.py | Python | mit | 5,015 | 0.002792 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: dummy.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf ... | vmagamedov/grpclib | tests/dummy_pb2.py | Python | bsd-3-clause | 5,139 | 0.003308 |
__all__ = ["user_controller", "plant_controller"] | CHrycyna/LandscapeTracker | app/controllers/__init__.py | Python | mit | 49 | 0.020408 |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | jasonehines/mycroft-core | mycroft/skills/container.py | Python | gpl-3.0 | 3,372 | 0 |
#!/usr/bin/env python
# coding: utf-8
import datetime
import subprocess
import logging
import json
import os
import sys
from io import BytesIO
import requests
from bottle import route, run, request
from bottle import jinja2_view as view, jinja2_template as template
logging.basicConfig(level=logging.INFO)
logger = lo... | JoseTomasTocino/image-metadata-viewer | main.py | Python | lgpl-3.0 | 3,693 | 0.002709 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.