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 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
NAME='guimao33'
SPELL='guǐmǎo'
CN='癸卯'
SEQ='40'
if __name__=='__main__':
pass
| sinotradition/sinoera | sinoera/ganzhi/guimao33.py | Python | apache-2.0 | 231 | 0.031111 |
from .Commerce import Commerce
from .Transaction import Transaction
| lexotero/python-redsys | redsys/__init__.py | Python | mit | 68 | 0 |
import wpilib
import math
class SharpIR2Y0A02:
'''
Sharp IR sensor GP2Y0A02YK0F
Long distance sensor: 20cm to 150cm
Output is in centimeters
Distance can be calculated using 62.28*x ^ -1.092
'''
def __init__(self,num):
self.distance = ... | frc1418/2015-robot | robot/common/distance_sensors.py | Python | apache-2.0 | 1,861 | 0.014508 |
"""Detect zmq version"""
#
# Copyright (C) PyZMQ Developers
#
# This file is part of pyzmq, copied and adapted from h5py.
# h5py source used under the New BSD license
#
# h5py: <http://code.google.com/p/h5py/>
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, ... | SymbiFlow/pycapnp | buildutils/detect.py | Python | bsd-2-clause | 4,766 | 0.000629 |
import torch
import torchvision.transforms as transforms
import torch.utils.data as data
import os
import json
import pickle
import argparse
from PIL import Image
import numpy as np
from utils import Vocabulary
class CocoDataset(data.Dataset):
def __init__(self, root, anns, vocab, mode='train',transform=None):
... | incredible-vision/show-and-tell | data_loader.py | Python | mit | 3,497 | 0.003432 |
# -*- 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):
pass
def backwards(self, orm):
pass
models = {
'accountlinker.thirdpartyaccount': {
... | norayr/unisubs | apps/auth/migrations/0032_remove_thumb_options.py | Python | agpl-3.0 | 21,604 | 0.008193 |
# -*- encoding: utf-8 -*-
import mock
import os
from shutil import rmtree
from tempfile import mkdtemp
from django.test import TestCase
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test.utils import override_settings
... | johan--/Geotrek | geotrek/common/tests/test_parsers.py | Python | bsd-2-clause | 5,465 | 0.004762 |
"""Main command module that starts the different threads."""
from ws4py.server.cherrypyserver import WebSocketPlugin
from ws4py.server.cherrypyserver import WebSocketTool
import argparse
import cherrypy
import datetime
import logging
import os
import serial
import signal
import subprocess
import sys
import threading
im... | bskari/sparkfun-avc | main.py | Python | mit | 13,115 | 0.001067 |
"Add a movie to Plex."
import sys
from pathlib import Path
from argparse import ArgumentParser
from tkinter import filedialog, messagebox, simpledialog, Tk, Frame, Label
from tkinter.ttk import Combobox, Button
class FeaturettePicker:
FEATURETTES = {
"Behind the Scenes": "behindthescenes",
"Delet... | stefco/dotfiles | winscripts/plexmovie.py | Python | mit | 4,386 | 0.003648 |
#!/usr/bin/env python3
import rainbow
import hashlib
import string
import time
import random
"""SHA-256 hash function
Precondition: Input plaintext as string
Postcondition: Returns hash as string
"""
def sha256(plaintext):
return hashlib.sha256(bytes(plaintext, 'utf-8')).hexdigest()
"""Returns a reduction function... | clu8/RainbowTable | crack.py | Python | mit | 2,202 | 0.024069 |
#!/usr/bin/env python3
# NOTE: this example requires PyAudio because it uses the Microphone class
import speech_recognition as sr
# this is called from the background thread
def callback(recognizer, audio):
# received audio data, now we'll recognize it using Google Speech Recognition
try:
# for testi... | xe1gyq/GiekIs | examples/au.py | Python | apache-2.0 | 1,636 | 0.011002 |
# Copyright 2016 VMware, 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... | BaluDontu/docker-volume-vsphere | esx_service/utils/auth.py | Python | apache-2.0 | 13,215 | 0.003405 |
import unittest
from fractions import Fraction as F
from abcesac.music import *
class KeyTestCase(unittest.TestCase):
def test_get_notes(self):
got = Key('C').get_notes()
want = ['C','D','E','F','G','A','B']
self.assertEquals(got, want)
got = Key('D').get_notes()
want = [... | google-code/abc2esac | abcesac/tests/music.py | Python | gpl-3.0 | 4,909 | 0.017315 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2019, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Container
########################
The :class:`~exa.core.container.Container` class is the primary object for
data processing, analysis, and visualization. In brief, containers a... | tjduigna/exa | exa/core/container.py | Python | apache-2.0 | 24,987 | 0.002441 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/aio/operations/_service_endpoint_policy_definitions_operations.py | Python | mit | 24,059 | 0.005362 |
from contextlib import ContextDecorator
from unittest import mock
import httpx
import pytest
from util.working_directory import working_directory
from .http import pull_http
class MockedHttpxStreamResponse(ContextDecorator):
"""
VCR does not like recording HTTPX stream requests so mock it.
"""
def... | stencila/hub | worker/jobs/pull/http_test.py | Python | apache-2.0 | 1,623 | 0.000616 |
#!/usr/bin/env python3
# https://docs.python.org/3/library/modulefinder.html
from modulefinder import ModuleFinder
finder = ModuleFinder()
finder.run_script('graph1.py')
print('Loaded modules:')
for name, mod in finder.modules.items():
print('%s: ' % name, end='')
print(','.join(list(mod.globalnames.keys())... | jtraver/dev | python3/graphics/modulefinder1.py | Python | mit | 416 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Genera... | akretion/bank-statement-reconcile | __unported__/statement_voucher_killer/voucher.py | Python | agpl-3.0 | 6,659 | 0.00015 |
from pygame.sprite import DirtySprite
from pygame import draw
class BaseWidget(DirtySprite):
"""clase base para todos los widgets"""
focusable = True
# si no es focusable, no se le llaman focusin y focusout
# (por ejemplo, un contenedor, una etiqueta de texto)
hasFocus = False
# indi... | zenieldanaku/DyDCreature_Editor | azoe/widgets/basewidget.py | Python | mit | 2,314 | 0 |
from django.conf import settings
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello")
| rochacbruno/dynaconf | example/django_pure/polls/views.py | Python | mit | 125 | 0 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce 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.
import decimal
import os
import time
import pytest
from django.cor... | suutari/shoop | shuup_tests/browser/admin/test_refunds.py | Python | agpl-3.0 | 4,879 | 0.003689 |
"""Source code used for the talk:
http://www.slideshare.net/MarcGarcia11/cart-not-only-classification-and-regression-trees
"""
# data
import pandas as pd
data = {'age': [38, 49, 27, 19, 54, 29, 19, 42, 34, 64,
19, 62, 27, 77, 55, 41, 56, 32, 59, 35],
'distance': [6169.98, 7598.87, 3276.07, 15... | datapythonista/datapythonista.github.io | docs/cart_talk.py | Python | apache-2.0 | 5,718 | 0.003498 |
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
import formatter
import io
import sys
import time
import portage
from portage import os
from portage import _encodings
from portage import _unicode_encode
from portage.ou... | nullishzero/Portage | pym/_emerge/JobStatusDisplay.py | Python | gpl-2.0 | 7,763 | 0.031302 |
#!/usr/bin/env python3
from mutagen.mp3 import MP3
import sys
if len(sys.argv) < 2:
print('error: didn\'t pass enough arguments')
print('usage: ./bitrate.py <file name>')
print('usage: find the bitrate of an mp3 file')
exit(1)
f = MP3(sys.argv[1])
print('bitrate: %s' % (f.info.bitrate / 1000))
| lehmacdj/.dotfiles | bin/bitrate.py | Python | gpl-3.0 | 314 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
('id', models.AutoField(seriali... | joshsmith2/superlists | lists/migrations/0001_initial.py | Python | gpl-2.0 | 492 | 0.002033 |
from rstem import led_matrix, accel
import RPi.GPIO as GPIO
import random
import time
import sys
# notify of progress
print("P50")
sys.stdout.flush()
# set up led matrix
#led_matrix.init_grid(2,2)
led_matrix.init_matrices([(0,8),(8,8),(8,0),(0,0)])
# set up accelometer
accel.init(1)
# notify of progress
print("P60"... | scottsilverlabs/raspberrystem | rstem/projects/led_matrix_games/aspirin.py | Python | apache-2.0 | 9,366 | 0.009075 |
import sqlite3 as sql
from flask.json import jsonify
from flask import current_app
def total_entries():
with sql.connect("names.db") as con:
cur = con.cursor()
entries = cur.execute("SELECT count(*) FROM names").fetchone()
con.commit()
return '{}\n'.format('{}\n'.format(entries)[1:-3])
... | carlitos26/RESTful-Web-service | browser-version/app/modules.py | Python | gpl-3.0 | 1,874 | 0.012807 |
#
# 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... | airbnb/airflow | tests/dags/test_task_view_type_check.py | Python | apache-2.0 | 1,768 | 0 |
from . import data_reduce
import numpy as np
from . import readout_classifier
class single_shot_readout:
"""
Single shot readout class
Args:
adc (Instrument): a device that measures a complex vector for each readout trigger (an ADC)
prepare_seqs (list of pulses.sequence): a dict of sequences of control pulses.... | ooovector/qtlab_replacement | single_shot_readout.py | Python | gpl-3.0 | 8,239 | 0.028766 |
#!/usr/bin/python
import fileinput
import string
import sys
import os
ar = 'ar'
fortran_compiler = 'ftn'
fortran_opt_flags = '-O3'
fortran_link_flags = '-O1'
c_compiler = 'cc'
c_opt_flags = '-O3'
src_dir = './src/'
obj_dir = './obj/'
exe_dir = './exe/'
lib_name = 'tce_sort_f77_basic.a'
count = '100'
rank = '30'... | jeffhammond/spaghetty | branches/old/python/archive/build_executables_basic.py | Python | bsd-2-clause | 11,373 | 0.006419 |
import unittest
from models import heliosat
import numpy as np
from netcdf import netcdf as nc
from datetime import datetime
import os
import glob
class TestPerformance(unittest.TestCase):
def setUp(self):
# os.system('rm -rf static.nc temporal_cache products')
os.system('rm -rf temporal_cache pr... | ahMarrone/solar_radiation_model | tests/performance_test.py | Python | mit | 1,278 | 0 |
import datetime
from typing import Optional, TypedDict
from backend.common.sitevars.sitevar import Sitevar
class WebConfig(TypedDict):
travis_job: str
tbaClient_endpoints_sha: str
current_commit: str
deploy_time: str
endpoints_sha: str
commit_time: str
class AndroidConfig(TypedDict):
mi... | the-blue-alliance/the-blue-alliance | src/backend/common/sitevars/apistatus.py | Python | mit | 1,216 | 0 |
from .max import max
from pyramda.private.asserts import assert_equal
def max_test():
assert_equal(max([1, 3, 4, 2]), 4)
| jackfirth/pyramda | pyramda/relation/max_test.py | Python | mit | 127 | 0 |
"""
Script for selecting a good number of basis functions.
Too many or too few basis functions will introduce numerical error.
True solution must be known.
Run the program several times, varying the value of the -N option.
There may be a way to improve on this brute force method.
"""
# To allow __main__ in subdirecto... | srmagura/potential | scripts/optimize_basis.py | Python | gpl-3.0 | 1,662 | 0.006619 |
from .model import SVC
| ljwolf/spvcm | spvcm/svc/__init__.py | Python | mit | 23 | 0 |
import os
import socket
from airflow import DAG
from airflow.contrib.hooks import SSHHook
from airflow.operators import PythonOperator
from airflow.operators import BashOperator
from airflow.operators import BranchPythonOperator
from airflow.hooks.mysql_hook import MySqlHook
from airflow.hooks import RedisHook
from air... | vipul-tm/DAG | dags-ttpl/sync.py | Python | bsd-3-clause | 19,607 | 0.033304 |
#!/Users/abhisheksamdaria/GitHub/pstHealth/venv/bin/python2.7
from __future__ import print_function
import base64
import os
import sys
if __name__ == "__main__":
# create font data chunk for embedding
font = "Tests/images/courB08"
print(" f._load_pilfont_data(")
print(" # %s" % os.path.basen... | samabhi/pstHealth | venv/bin/createfontdatachunk.py | Python | mit | 600 | 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 field 'Event.photo'
db.add_column('events_event', 'photo',
self.gf('django.db... | e-Luminate/eluminate_web | eluminate_web/apps/events/migrations/0006_auto__add_field_event_photo.py | Python | gpl-3.0 | 7,343 | 0.007899 |
import settings
import mysql.connector
from domain.domain import Article
from domain.domain import Project
from domain.domain import User
from domain.domain import Tag
import service.database as db
# 文章管理
class ArticleService:
# 查询最近发表的文章
def query_most_published_article(self):
conn = d... | hwangsyin/cbrc-devteam-blog | service/service.py | Python | apache-2.0 | 5,715 | 0.006211 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import datetime
from cms.api import create_page, publish_page, add_plugin
from cms.exceptions import PluginAlreadyRegistered, PluginNotRegistered
from cms.models import Page, Placeholder
from cms.models.pluginmodel import CMSPlugin, PluginModelBase
from cms... | mpetyx/palmdrop | venv/lib/python2.7/site-packages/cms/tests/plugins.py | Python | apache-2.0 | 46,414 | 0.001982 |
# 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... | orbitfp7/nova | nova/tests/unit/scheduler/filters/test_numa_topology_filters.py | Python | apache-2.0 | 7,379 | 0.000678 |
#!/usr/bin/env python
from os.path import dirname, join
import plyer
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
curdir = dirname(__file__)
packages = [
'plyer',
'plyer.platforms',
'plyer.platforms.linux',
'plyer.platforms.android',
'plyer.platfo... | inclement/plyer | setup.py | Python | mit | 1,374 | 0 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Description: File system resilience testing application
# Author: Hubert Kario <hubert@kario.pl>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Hubert Kario. All rights reserved.
#
# This ... | tomato42/fsresck | fsresck/nbd/request.py | Python | gpl-2.0 | 3,965 | 0 |
#!/usr/bin/env python3
# -----------------------------------------------------------------------------
# Copyright (C) British Crown (Met Office) & Contributors.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of... | metomi/rose | metomi/rosie/svn_pre_commit.py | Python | gpl-3.0 | 13,444 | 0.000149 |
# encoding: utf-8
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | redhat-imaging/imagefactory | imagefactory_plugins/Rackspace/__init__.py | Python | apache-2.0 | 668 | 0 |
# From: https://gist.github.com/nathan-hoad/8966377
import os
import asyncio
import sys
from asyncio.streams import StreamWriter, FlowControlMixin
reader, writer = None, None
@asyncio.coroutine
def stdio(loop=None):
if loop is None:
loop = asyncio.get_event_loop()
reader = asyncio.StreamReader()
... | dpdani/tBB | tBB/async_stdio.py | Python | gpl-3.0 | 1,064 | 0.00094 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | ingenieroariel/geonode | geonode/groups/forms.py | Python | gpl-3.0 | 5,314 | 0.000188 |
# -*- coding: utf-8 -*-
"""
irc/server.py
Copyright © 2009 Ferry Boender
Copyright © 2012 Jason R. Coombs
This server has basic support for:
* Connecting
* Channels
* Nicknames
* Public/private messages
It is MISSING support for notably:
* Server linking
* Modes (user and channel)
* Proper error reporting
* Basic... | sim0629/irc | irc/server.py | Python | lgpl-2.1 | 17,734 | 0.002425 |
import random
import time
import datetime
from consts import *
__all__ = ['gen_valid_id', 'gen_list_page', 'log']
def gen_valid_id(collection):
def gen_id():
_id = ''
for i in range(4):
_id += random.choice('0123456789')
return _id
id = gen_id()
while collection.find_... | oyiadin/Songs-Distributor | utils.py | Python | mit | 1,548 | 0.00646 |
# -----------------------------------------------------------------------------
#
# This file is the copyrighted property of Tableau Software and is protected
# by registered patents and other applicable U.S. and international laws and
# regulations.
#
# Unlicensed use of the contents of this file is prohibited. Please... | corystreet/pyOdbcToTde | Static/TableauSDK-9100.15.0828.1711/tableausdk/Exceptions.py | Python | gpl-2.0 | 1,040 | 0.003846 |
# Copyright (C) 2011 One Laptop Per Child
#
# 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 distribu... | gusDuarte/sugar | src/jarabe/model/speech.py | Python | gpl-2.0 | 7,214 | 0.000832 |
"""
PyLEMS API module.
:author: Gautham Ganapathy
:organization: LEMS (https://github.com/organizations/LEMS)
"""
from lems.model.fundamental import *
from lems.model.structure import *
from lems.model.dynamics import *
from lems.model.simulation import *
from lems.model.component import *
from lems.model.model impor... | LEMS/pylems | lems/api.py | Python | lgpl-3.0 | 328 | 0 |
import argparse, collections, configparser, json, math, mysql.connector as sql, praw, os, requests, sys, time
from datetime import datetime
from pprint import pprint
from mysql.connector import errorcode
from requests import HTTPError
from requests import ConnectionError
from fcntl import flock, LOCK_EX, LOCK_NB
# Pri... | pmaconi/RedditGoggles | reddit-goggles.py | Python | mit | 11,792 | 0.037907 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.core.urlresolvers import reverse_lazy
from django.views.generic import RedirectView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r''... | psych0der/resumizr | resumizr/urls.py | Python | mit | 3,010 | 0.01495 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | hradec/gaffer | python/GafferUI/Slider.py | Python | bsd-3-clause | 18,399 | 0.051796 |
from unittest import TestCase
from paramiko import SSHException
from pyinfra.api import Config, State
from pyinfra.api.connect import connect_all
from pyinfra.api.exceptions import NoGroupError, NoHostError, PyinfraError
from ..paramiko_util import PatchSSHTestCase
from ..util import make_inventory
class TestInven... | Fizzadar/pyinfra | tests/test_api/test_api.py | Python | mit | 2,193 | 0 |
"""
Copyright 2016 Rasmus Larsen
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE.txt file for details.
"""
import sys
import time
from sacred import Experiment
from core.ALEEmulator import ALEEmulator
from dqn.Agent import Agent
from dqn.DoubleDQN import DoubleDQN
e... | rlrs/deep-rl | run_double.py | Python | mit | 1,928 | 0.001556 |
import gtk
from plugin_base.find_extension import FindExtension
class SizeFindFiles(FindExtension):
"""Size extension for find files tool"""
def __init__(self, parent):
FindExtension.__init__(self, parent)
# create container
table = gtk.Table(2, 4, False)
table.set_border_wi... | Hammer2900/SunflowerX | application/plugins/find_file_extensions/size.py | Python | gpl-3.0 | 2,732 | 0.00183 |
import yaml
from os import makedirs
from os.path import join,dirname,realpath,isdir
script_dir = dirname(realpath(__file__))
default_yml_filepath = join(script_dir,'defaults.yml')
defaults = {
"output_dir": 'output',
"header_img_dir": 'imgs/headers/',
"scaled_img_dir": 'imgs/scaled/',
"original_img_d... | naggie/dsblog | dsblog/environment.py | Python | mit | 1,659 | 0.010247 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_medicament_template/history/clv_medicament_template_history.py | Python | agpl-3.0 | 4,727 | 0.008462 |
import mytest
print '----This is func1----'
mytest.world.func1()
print '----This is func2----'
mytest.simple.func2()
print '----This is func3----'
mytest.whatever.func3()
print '----This is myobj using MyClass----'
myobj = mytest.MyClass('nick', 'florida')
myobj.hello()
| bonno800/pynet | week9exercise9-a-b.py | Python | apache-2.0 | 275 | 0 |
# Copyright 2014 Cirruspath, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | cirruspath/python-oauth2-middleware | pom/server/pomserver.py | Python | apache-2.0 | 7,922 | 0.012497 |
import numpy as np
import pandas as pd
from plotnine import (ggplot, aes, geom_area, geom_ribbon,
facet_wrap, scale_x_continuous, theme)
n = 4 # No. of ribbions in a vertical stack
m = 100 # Points
width = 2*np.pi # width of each ribbon
x = np.linspace(0, width, m)
df = pd.... | has2k1/plotnine | plotnine/tests/test_geom_ribbon_area.py | Python | gpl-2.0 | 2,328 | 0 |
import os
import amo.search
from .models import Reindexing
from django.core.management.base import CommandError
# shortcut functions
is_reindexing_amo = Reindexing.objects.is_reindexing_amo
flag_reindexing_amo = Reindexing.objects.flag_reindexing_amo
unflag_reindexing_amo = Reindexing.objects.unflag_reindexing_amo
g... | anaran/olympia | lib/es/utils.py | Python | bsd-3-clause | 1,403 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('shows', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='show',
options={'verbo... | Cinemair/cinemair-server | cinemair/shows/migrations/0002_auto_20150712_2126.py | Python | mit | 430 | 0.002326 |
# This file is part of James CI.
#
# James CI is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# James CI is distributed in the hope t... | alehaa/james | jamesci/status.py | Python | gpl-3.0 | 1,897 | 0.000527 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nanditav/15712-TensorFlow | tensorflow/contrib/learn/python/learn/estimators/linear.py | Python | apache-2.0 | 31,382 | 0.004716 |
################################################################################
#
# Copyright 2015-2020 Félix Brezo and Yaiza Rubio
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Softwa... | i3visio/osrframework | osrframework/wrappers/papaly.py | Python | agpl-3.0 | 3,867 | 0.004397 |
from __future__ import unicode_literals
from collections import defaultdict
import datetime
import json
from moto.compat import OrderedDict
from moto.core import BaseBackend
from moto.core.utils import unix_time
from .comparisons import get_comparison_func
class DynamoJsonEncoder(json.JSONEncoder):
def default(s... | silveregg/moto | moto/dynamodb/models.py | Python | apache-2.0 | 9,875 | 0.00081 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetTariff
# Returns an individual Tariff object with a given id.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may no... | jordanemedlock/psychtruths | temboo/core/Library/Genability/TariffData/GetTariff.py | Python | apache-2.0 | 4,018 | 0.004978 |
# -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
class SaleOrder(models.Model):
_inherit = 'sale.order'
@api.multi
def action_button_confirm(self):
procurement_obj = self.env... | esthermm/odoo-addons | procurement_service_project/models/sale_order.py | Python | agpl-3.0 | 1,663 | 0 |
# -*- encoding: utf-8 -*-
# from django.shortcuts import render, render_to_response, redirect, get_object_or_404, get_list_or_404, Http404
from django.core.cache import cache
from django.shortcuts import *
from django.views.generic import TemplateView, FormView
from django.http import HttpResponseRedirect, HttpResponse... | VigTech/Vigtech-Services | principal/views.py | Python | lgpl-3.0 | 45,303 | 0.014399 |
# 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... | cernops/keystone | keystone/tests/unit/common/test_manager.py | Python | apache-2.0 | 1,531 | 0 |
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.models import AnonymousUser
from django.contrib.messages.storage import default_storage as default_messages_storage
from django.db import connection
from django.test import RequestFactory
from django.test.utils import CaptureQuer... | mozilla/addons-server | src/olympia/users/tests/test_admin.py | Python | bsd-3-clause | 38,889 | 0.001363 |
from intprim.bayesian_interaction_primitives import *
import intprim.basis
import intprim.constants
import intprim.examples
import intprim.filter
import intprim.filter.align
import intprim.filter.spatiotemporal
import intprim.util
| ir-lab/intprim | intprim/__init__.py | Python | mit | 231 | 0 |
# coding: utf-8
import random
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import sys
import os
# how many pictures to generate
num = 10
if len(sys.argv) > 1:
num = int(sys.argv[1])
def genline(text, font, filename):
'''
generate one line
'''
w, h = font.getsize(text... | Halfish/lstm-ctc-ocr | 1_generateImage.py | Python | apache-2.0 | 1,086 | 0.003683 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 20 23:53:19 2017
@author: chosenone
Train CNN for Text Classification
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import os
import ti... | chosenone75/Neural-Networks | tf/CNN-Sentence-Classification/train_CNN4Text.py | Python | gpl-3.0 | 10,181 | 0.021904 |
"""
CMSIS-DAP Interface Firmware
Copyright (c) 2009-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable la... | flyhung/CMSIS-DAP | tools/get_binary.py | Python | apache-2.0 | 1,166 | 0.002573 |
#Ensure there is an exceptional edge from the following case
def f2():
b, d = Base, Derived
try:
class MyNewClass(b, d):
pass
except:
e2
def f3():
sequence_of_four = a_global
try:
a, b, c = sequence_of_four
except:
e3
#Always treat locals as no... | github/codeql | python/ql/test/library-tests/ControlFlow/except/test.py | Python | mit | 1,251 | 0.02558 |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/ns/nspbr6_args.py | Python | apache-2.0 | 1,047 | 0.025788 |
import pytest
from plumbum.colorlib.styles import ANSIStyle, Color, AttributeNotFound, ColorNotFound
from plumbum.colorlib.names import color_html, FindNearest
class TestNearestColor:
def test_exact(self):
assert FindNearest(0,0,0).all_fast() == 0
for n,color in enumerate(color_html):
... | vodik/plumbum | tests/test_color.py | Python | mit | 2,444 | 0.020458 |
#!/usr/bin/env python
# vim: tw=80 ts=4 sw=4 noet
from os.path import join, basename, dirname, abspath
import _import
from wwwclient import browse, scrape
HTML = scrape.HTML
s = browse.Session("http://www.google.com")
f = s.form().fill(q="python web scraping")
s.submit(f, action="btnG", method="GET")
tree = scrape.H... | sebastien/wwwclient | tests/site-google.py | Python | lgpl-3.0 | 902 | 0.012195 |
#! Tests out the CG solver with CPHF Polarizabilities
import time
import numpy as np
import psi4
psi4.set_output_file("output.dat")
# Benzene
mol = psi4.geometry("""
0 1
O 0.000000000000 0.000000000000 -0.075791843589
H 0.000000000000 -0.866811828967 0.601435779270
H ... | psi4/psi4 | tests/psi4numpy/cphf/input.py | Python | lgpl-3.0 | 2,679 | 0.005972 |
from bs4 import BeautifulSoup
class RunParameter_xml:
'''
A class for reading runparameters xml file from Illumina sequencing runs
:param xml_file: A runparameters xml file
'''
def __init__(self, xml_file):
self.xml_file = xml_file
self._read_xml()
def _read_xml(self):
'''
Internal funct... | imperial-genomics-facility/data-management-python | igf_data/illumina/runparameters_xml.py | Python | apache-2.0 | 3,007 | 0.018291 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | odoo-arg/odoo_l10n_ar | l10n_ar_reject_checks/models/account_own_check.py | Python | agpl-3.0 | 2,297 | 0.002612 |
import datetime
import tweepy
from geopy.geocoders import Nominatim
import json
from secret import *
import boto3
import re
import preprocessor as p
import time
p.set_options(p.OPT.URL, p.OPT.EMOJI)
# Get the service resource.
dynamodb = boto3.resource('dynamodb', region_name='us-west-2')
table = dynamodb.Table('fuck... | Gknoblau/gladitude | twitter/twitter_tweepy.py | Python | mit | 3,076 | 0.002276 |
from __future__ import division
__author__ = 'jerry'
from utils.settings import pbp, seasons
from Game import Game
class NoCollectionError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class SeasonDataError(Exception):
def __init__(self, msg... | grapesmoker/nba | game/Season.py | Python | gpl-2.0 | 12,250 | 0.002286 |
#!/usr/bin/env python3
print('hello hello hello')
| bobisme/hello | python/hello3.py | Python | mit | 50 | 0 |
#def binh_phuong()
try:
a=int(raw_input("Nhap so n>=0 \n"))
while a<=0:
a=int(raw_input("Nhap lai so n>=0\n "))
print "%d" %(a)
b=pow(a,2)
c=int(raw_input("Doan so binh phuong cua ban\n"))
while c!=b:
if c<b:
print"chua dung, cao len 1 chut\n"
c=input()
else:
print"qua rui giam xuon... | pythonvietnam/pbc082015 | VuQuangThang/21082015_B2/bai4.py | Python | gpl-2.0 | 433 | 0.080831 |
import unittest
import logging
from domaincrawl.link_aggregator import LinkAggregator
from domaincrawl.link_filters import DomainFilter, is_acceptable_url_scheme
from domaincrawl.site_graph import SiteGraph
from domaincrawl.util import URLNormalizer, extract_domain_port
class LinkAggregatorTest(unittest.Tes... | planBrk/domaincrawler | test/test_link_aggregator.py | Python | apache-2.0 | 3,054 | 0.007531 |
from flask import Flask, request, session, g, redirect, url_for, \
abort, flash
import db
import routes
DATABASE = 'test.db'
DEBUG = True
SECRET_KEY = 'key'
USERNAME = 'admin'
PASSWORD = 'password'
app = Flask(__name__)
app.config.from_object(__name__)
if __name__ == '__main__':
app.run()
| JackMc/CourseScraper | web/main.py | Python | mit | 311 | 0 |
#
# Copyright (C) University College London, 2007-2012, all rights reserved.
#
# This file is part of HemeLB and is provided to you under the terms of
# the GNU LGPL. Please see LICENSE in the top level directory for full
# details.
#
import numpy as np
import xdrlib
import warnings
from .. import HemeLbMagicNumbe... | jenshnielsen/hemelb | Tools/hemeTools/parsers/snapshot/__init__.py | Python | lgpl-3.0 | 11,074 | 0.00587 |
# A Job consists of many "Tasks".
# A task is the run of an external tool, with proper methods for failure handling
from Tools.CList import CList
class Job(object):
NOT_STARTED, IN_PROGRESS, FINISHED, FAILED = range(4)
def __init__(self, name):
self.tasks = [ ]
self.resident_tasks = [ ]
self.workspace = "/tmp... | popazerty/EG-2 | lib/python/Components/Task.py | Python | gpl-2.0 | 15,627 | 0.03398 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | ntt-sic/heat | heat/tests/test_neutron_loadbalancer.py | Python | apache-2.0 | 34,298 | 0.000087 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.context_processors import csrf
from django.http import HttpRequest, HttpResponse
from django.middleware.csrf import CsrfViewMiddleware, CSRF_KEY_LENGTH
from django.template import RequestContext, Template
from django.test import TestCase
from dj... | adrianholovaty/django | tests/regressiontests/csrf_tests/tests.py | Python | bsd-3-clause | 13,454 | 0.002155 |
the_count = [1, 2, 3, 4, 5]
fruits = ['apple', 'oranges', 'pears', 'apricots',]
change = [1, 'pennies', 2, 'dimes', 3, 'quarters',]
#this first kind of for-loop goes through a list
for number in the_count:
print("This is count %d" % number)
# same as above
for fruit in fruits:
print("A fruit of type: %s" % fr... | sunrin92/LearnPython | 1-lpthw/ex32.py | Python | mit | 812 | 0.004926 |
from pydub import *
class AudioMerger:
voice_tags = ["one", "two", "three", "four", "five", "ten", "RUN", "relax", "completed"]
def __init__(self, music):
self.music = music
self.additionalGain = 8
self.voices={}
for voice in self.voice_tags:
sound = AudioSegment.from_file('voices/' + voice + '.wav')
... | gyimothilaszlo/interval-music-maker | AudioMerger.py | Python | mit | 1,005 | 0.034826 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-03 16:13
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('books', '0003_book_owner'),
]
operations = [
migrations.RenameModel(
old... | pankajlal/prabandh | books/migrations/0004_auto_20160703_2143.py | Python | apache-2.0 | 384 | 0 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | akash1808/tempest | tempest/api/compute/volumes/test_volumes_get.py | Python | apache-2.0 | 3,025 | 0 |
#!/usr/bin/python
#
# OpenStack Heat Plugin for interfacing with VMware Big Data Extensions
#
# Chris Mutchler - chris@virtualelephant.com
# http://www.VirtualElephant.com
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License... | virtualelephant/openstack-heat-bde-plugin | plugin/BigDataExtensions.py | Python | apache-2.0 | 17,510 | 0.003198 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.