code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 27 18:31:59 2017
@author: katsuya.ishiyama
"""
from numpy import random
# Definition of module level constants
SUCCESS_CODE = 1
FAILURE_CODE = 0
class Strategy():
def __init__(self, n):
_success_probability = _generate_success_proba... | Katsuya-Ishiyama/simulation | strategy/strategy.py | Python | mit | 2,013 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015 by PyCLibrary Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT/X11 license.
#
# The full license is in the file LICENCE, distributed with this software.
# -----------... | mrh1997/pyclibrary | pyclibrary/c_parser.py | Python | mit | 62,500 |
''' This file contains tests for the bar plot.
'''
import matplotlib.pyplot as plt
import pytest
import shap
from .utils import explainer # (pytest fixture do not remove) pylint: disable=unused-import
@pytest.mark.mpl_image_compare
def test_simple_bar(explainer): # pylint: disable=redefined-outer-name
""" Check ... | slundberg/shap | tests/plots/test_bar.py | Python | mit | 509 |
# -*- coding: utf-8 -*-
from datetime import timedelta, datetime
import asyncio
import random
from .api import every, once_at, JobSchedule, default_schedule_manager
__all__ = ['every_day', 'every_week', 'every_monday', 'every_tuesday', 'every_wednesday',
'every_thursday', 'every_friday', 'every_saturday', '... | eightnoteight/aschedule | aschedule/ext.py | Python | mit | 3,564 |
# -*- coding: utf-8 -*-
"""
This module provides the necessary methods for a Certification Authority.
For creating the self signed Certificate for the CA, use the following command:
$ openssl req -x509 -newkey rsa:2048 -keyout ca_priv.pem -out ca_cert.pem
@author: Vasco Santos
"""
import time
from M2Crypto impo... | vasco-santos/CertificationService | certModule/CertAuthority.py | Python | mit | 6,803 |
from baby_steps import given, then, when
from district42 import represent, schema
def test_list_of_representation():
with given:
sch = schema.list(schema.bool)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.bool)"
def test_list_of_values_represent... | nikitanovosibirsk/district42 | tests/list/test_list_of_representation.py | Python | mit | 1,650 |
import cx_Freeze
import sys
import os
executables = [cx_Freeze.Executable("MusicCompiler.py", base=None)]
cx_Freeze.setup(
name= "MusicCompiler",
description = "Best Program Ever Known To Humanity.",
author = "Space Sheep Enterprises",
options = {"build_exe":{"excludes":["urllib","html","h... | Jonathan-Z/PowerShellMusic | setup.py | Python | mit | 457 |
#!/Users/Varun/Documents/GitHub/LockScreen/venv/bin/python
# $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing Docutils XML.
"""
try:
import l... | LockScreen/Backend | venv/bin/rst2xml.py | Python | mit | 642 |
from messenger import Skype
import keyring
import utils
token = keyring.get_password('messagesReceiver', 'skypeToken')
registrationToken = keyring.get_password('messagesReceiver', 'skypeRegistrationToken')
username = keyring.get_password('messagesReceiver', 'skypeUsername')
password = keyring.get_password('messagesRec... | khapota/messages-terminal | test.py | Python | mit | 1,064 |
#!/usr/bin/env python
import os
import sys # provides interaction with the Python interpreter
from functools import partial
from PyQt4 import QtGui # provides the graphic elements
from PyQt4.QtCore import Qt # provides Qt identifiers
from PyQt4.QtGui import QPushButton
t... | AlManja/logs.py | logsgui3.py | Python | mit | 9,203 |
a = [1,2,3,4,5]
b = [2,3,4,5,6]
to_100=list(range(1,100))
print ("Printing B")
for i in a:
print i
print ("Printing A")
for i in b:
print i
print ("Print 100 elements")
for i in to_100:
print i | davidvillaciscalderon/PythonLab | Session 4/bucles.py | Python | mit | 211 |
from ga_starters import * | Drob-AI/music-queue-rec | src/playlistsRecomender/gaPlaylistGenerator/__init__.py | Python | mit | 25 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from te... | segwit/atbcoin-insight | qa/rpc-tests/p2p-feefilter.py | Python | mit | 4,317 |
""" TODO: Add docstring """
import re
import pexpect
class MediaObject(object):
"""Represents an encodable object"""
def __init__(self, input_filename, output_filename):
self.input_filename = input_filename
self.output_filename = output_filename
self.media_duration = self.get_media_d... | thethomaseffect/travers-media-tools | traversme/encoder/media_object.py | Python | mit | 2,000 |
import random
import musictheory
import filezart
import math
from pydub import AudioSegment
from pydub.playback import play
class Part:
def __init__(self, typ=None, intensity=0, size=0, gen=0, cho=0):
self._type = typ #"n1", "n2", "bg", "ch", "ge"
if intensity<0 or gen<0 or cho<0 or size<0 or inte... | joaoperfig/mikezart | source/markovzart2.py | Python | mit | 8,058 |
from . uuid64 import *
| jdowner/uuid64 | uuid64/__init__.py | Python | mit | 23 |
#!/usr/bin/env python
# T. Carman
# January 2017
import os
import json
def get_CMTs_in_file(aFile):
'''
Gets a list of the CMTs found in a file.
Parameters
----------
aFile : string, required
The path to a file to read.
Returns
-------
A list of CMTs found in a file.
'''
data = read_paramf... | tobeycarman/dvm-dos-tem | scripts/param_util.py | Python | mit | 11,387 |
# -*- test-case-name: twisted.test.test_task,twisted.test.test_cooperator -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Scheduling utility methods and classes.
@author: Jp Calderone
"""
__metaclass__ = type
import time
from zope.interface import implements
from twisted.python imp... | Varriount/Colliberation | libs/twisted/internet/task.py | Python | mit | 24,723 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-21 12:06
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | srijannnd/Login-and-Register-App-in-Django | simplesocial/groups/migrations/0001_initial.py | Python | mit | 1,868 |
from network import WLAN
###############################################################################
# Settings for WLAN STA mode
###############################################################################
WLAN_MODE = 'off'
#WLAN_SSID = ''
#WLAN_AUTH = (WLAN.WPA2,'')
#################... | ttn-be/ttnmapper | config.py | Python | mit | 1,297 |
from django.dispatch import Signal
user_email_bounced = Signal() # args: ['bounce', 'should_deactivate']
email_bounced = Signal() # args: ['bounce', 'should_deactivate']
email_unsubscribed = Signal() # args: ['email', 'reference']
| fin/froide | froide/bounce/signals.py | Python | mit | 236 |
a = [int(i) for i in input().split()]
print(sum(a))
| maisilex/Lets-Begin-Python | list.py | Python | mit | 52 |
from django.conf import settings
from django.conf.urls import static
from django.urls import include, path, re_path
from django.contrib import admin
urlpatterns = [
path(r"admin/", admin.site.urls),
path(r"flickr/", include("ditto.flickr.urls")),
path(r"lastfm/", include("ditto.lastfm.urls")),
path(r"... | philgyford/django-ditto | devproject/devproject/urls.py | Python | mit | 795 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os import listdir
import os
import re
import sys
from argparse import ArgumentParser
import random
import subprocess
from math import sqrt
import ast
from adderror import adderror
"""ENSAMBLE, -d directory -n number of models """
"""-k number of selected structure"""
... | spirit01/SAXS | test_caxs.py | Python | mit | 6,842 |
import collections
puzzle_input = (0,13,1,8,6,15)
test_inputs = [
([(0,3,6), 10], 0),
([(1,3,2)], 1),
([(2,1,3)], 10),
([(1,2,3)], 27),
([(2,3,1)], 78),
([(3,2,1)], 438),
([(3,1,2)], 1836),
# Expensive Tests
# ([(0,3,6), 30000000], 175594),
# ([(1,3,2), 30000000], 2578),
#... | AustinTSchaffer/DailyProgrammer | AdventOfCode/2020/day_15/solution.py | Python | mit | 1,352 |
#!/usr/bin/env python
import os
import time
import argparse
import tempfile
import PyPDF2
import datetime
from reportlab.pdfgen import canvas
parser = argparse.ArgumentParser("Add signatures to PDF files")
parser.add_argument("pdf", help="The pdf file to annotate")
parser.add_argument("signature", help="The signature... | yourcelf/signpdf | signpdf.py | Python | mit | 2,594 |
#!/usr/bin/python
import pexpect
import sys
import logging
import vt102
import os
import time
def termcheck(child, timeout=0):
time.sleep(0.05)
try:
logging.debug("Waiting for EOF or timeout=%d"%timeout)
child.expect(pexpect.EOF, timeout=timeout)
except pexpect.exceptions.TIMEOUT:
logging.debug("Hit timeout... | paulboal/pexpect-curses | demo/demo3.py | Python | mit | 1,476 |
# -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request.data
def get_headers(request):
return request.header... | soasme/axe | axe/default_exts.py | Python | mit | 680 |
def tryprint():
return ('it will be oke') | cherylyli/stress-aid | env/lib/python3.5/site-packages/helowrld/__init__.py | Python | mit | 45 |
#!/usr/bin/env python
import time
from nicfit.aio import Application
async def _main(args):
print(args)
print("Sleeping 2...")
time.sleep(2)
print("Sleeping 0...")
return 0
def atexit():
print("atexit")
app = Application(_main, atexit=atexit)
app.arg_parser.add_argument("--example", help="Ex... | nicfit/nicfit.py | examples/asyncio_example.py | Python | mit | 371 |
# -*- coding: utf-8 -*-
"""
Organization Registry - Controllers
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# -----------------------------------------------------------------------------
def index(... | code-for-india/sahana_shelter_worldbank | controllers/org.py | Python | mit | 10,621 |
# coding: utf8
from wsgidav.dav_provider import DAVCollection, DAVNonCollection
from wsgidav.dav_error import DAVError, HTTP_FORBIDDEN
from wsgidav import util
from wsgidav.addons.tracim import role, MyFileStream
from time import mktime
from datetime import datetime
from os.path import normpath, dirname, basename
try... | tracim/tracim-webdav | wsgidav/addons/tracim/sql_resources.py | Python | mit | 16,929 |
# coding=utf-8
# Bootstrap installation of setuptools
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from propane_distribution import cmdclassdict
from setuptools import setup, find_packages
from engineer import version... | tylerbutler/engineer | setup.py | Python | mit | 5,374 |
# 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/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py | Python | mit | 524 |
# Ant
#
# Copyright (c) 2012, Gustav Tiger <gustav@tiger.name>
#
# 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, m... | ddboline/Garmin-Forerunner-610-Extractor_fork | ant/easy/node.py | Python | mit | 4,653 |
import os
from ConfigParser import ConfigParser
from amlib import argp
tmp_conf = ConfigParser()
tmp_path = os.path.dirname(os.path.abspath(__file__)) # /base/lib/here
tmp_path = tmp_path.split('/')
conf_path = '/'.join(tmp_path[0:-1]) # /base/lib
tmp_conf.read(conf_path+'/ampush.conf')
c = {}
c.update(tmp_conf.ite... | sfu-rcg/ampush | amlib/conf.py | Python | mit | 1,274 |
# encoding: utf-8
from __future__ import unicode_literals
import operator
import pytest
from marrow.mongo import Filter
from marrow.schema.compat import odict, py3
@pytest.fixture
def empty_ops(request):
return Filter()
@pytest.fixture
def single_ops(request):
return Filter({'roll': 27})
def test_ops_iterat... | marrow/mongo | test/query/test_ops.py | Python | mit | 5,358 |
# 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/v2016_09_01/aio/operations/_load_balancers_operations.py | Python | mit | 23,464 |
"""Contains tests for oweb.views.updates.item_update"""
# Python imports
from unittest import skip
# Django imports
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from django.contrib.auth.models import User
# app imports
from oweb.tests import OWebViewTests
from oweb.models... | Mischback/django-oweb | oweb/tests/views/item_update.py | Python | mit | 10,246 |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings.prod')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| monovertex/ygorganizer | manage.py | Python | mit | 247 |
import os
import sys
import pygame
import signal
import time
import ConfigParser
from twython import TwythonStreamer
#-----------------------------------------------------------------------------
# Import custom modules
#-----------------------------------------------------------------------------
# Add pyscope modul... | ShawnHymel/TweetRace | pytest/wager_test_01.py | Python | mit | 5,938 |
import asyncio
from abc import ABCMeta
from collections.abc import MutableMapping
from aiohttp import web
from aiohttp.web_request import Request
from aiohttp_session import get_session
from collections.abc import Sequence
AIOLOGIN_KEY = '__aiologin__'
ON_LOGIN = 1
ON_LOGOUT = 2
ON_AUTHENTICATED = 3
ON_FORBIDDEN = 4... | trivigy/aiologin | aiologin/__init__.py | Python | mit | 7,901 |
# coding: utf-8
# pylint: disable=too-many-lines
import inspect
import sys
from typing import TypeVar, Optional, Sequence, Iterable, List, Any
from owlmixin import util
from owlmixin.errors import RequiredError, UnknownPropertiesError, InvalidTypeError
from owlmixin.owlcollections import TDict, TIterator, TList
from ... | tadashi-aikawa/owlmixin | owlmixin/__init__.py | Python | mit | 34,064 |
"""Chapter 22 Practice Questions
Answers Chapter 22 Practice Questions via Python code.
"""
from pythontutorials.books.CrackingCodes.Ch18.vigenereCipher import decryptMessage
def main():
# 1. How many prime numbers are there?
# Hint: Check page 322
message = "Iymdi ah rv urxxeqfi fjdjqv gu gzuqw clunijh... | JoseALermaIII/python-tutorials | pythontutorials/books/CrackingCodes/Ch22/PracticeQuestions.py | Python | mit | 1,117 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
from future.utils import with_metaclass
import numpy as np
import scipy as sp
from abc import ABCMeta, abstractmethod
from scipy import integrate
import scipy.interpolate as interpolate
from . import core
from . import refstate
_... | aswolf/xmeos | xmeos/models/gamma.py | Python | mit | 11,700 |
import numpy
import pytest
import theano
class TestInputLayer:
@pytest.fixture
def layer(self):
from lasagne.layers.input import InputLayer
return InputLayer((3, 2))
def test_input_var(self, layer):
assert layer.input_var.ndim == 2
def test_get_output_shape(self, layer):
... | diogo149/Lasagne | lasagne/tests/layers/test_input.py | Python | mit | 1,255 |
'''
Created on Nov 19, 2011
@author: scottporter
'''
class BaseSingleton(object):
_instance = None
@classmethod
def get_instance(cls):
if cls._instance is None:
cls._instance = cls()
return cls._instance | freneticmonkey/epsilonc | resources/scripts/core/basesingleton.py | Python | mit | 263 |
"""Device tracker for Synology SRM routers."""
from __future__ import annotations
import logging
import synology_srm
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA as DEVICE_TRACKER_PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.const import (... | rohitranjan1991/home-assistant | homeassistant/components/synology_srm/device_tracker.py | Python | mit | 4,397 |
'''
utils.py: helper functions for DLP api
Copyright (c) 2017 Vanessa Sochat
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, ... | radinformatics/som-tools | som/api/google/dlp/utils.py | Python | mit | 1,944 |
# -*- coding: utf-8 -*-
'''
Description:
Extract the feature from the text in English.
Version:
python3
'''
from sklearn.feature_extraction.text import CountVectorizer
VECTORIZER = CountVectorizer(min_df=1)
# 以下代码设置了特征提取方法的参数(以1-2个单词作为滑动窗口大小,以空格作为单词的分割点,最小词频为1)
# 详细参考API介绍:
# http://scikit-learn.org/stable/m... | Jackson-Y/Machine-Learning | text/feature_extraction.py | Python | mit | 828 |
import _plotly_utils.basevalidators
class YValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="y", parent_name="bar", **kwargs):
super(YValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
anim=kwargs.pop("... | plotly/python-api | packages/python/plotly/plotly/validators/bar/_y.py | Python | mit | 480 |
# -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(factors) < 7:
return
registry, cc... | yosida95/ip2country | ip2country/parser.py | Python | mit | 1,079 |
class Solution(object):
def isPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
if not s:
return True
start = 0
end = len(s)-1
s = s.lower()
while start < end:
while start < end and not s[start].isalnum():
... | tedye/leetcode | Python/leetcode.125.valid-palindrome.py | Python | mit | 594 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api_v3/models/work_title_v30_rc2.py | Python | mit | 4,930 |
import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
... | kura/batfish | tests/test_client_authorize.py | Python | mit | 1,645 |
from .. import console, fields
from ..exceptions import ConsoleError
from . import mock
import pytest
console.raw_input=mock.raw_input
def test_prompt():
field=fields.Field("test_field", "test field", fields.Field.TYPE_TEXT_ONELINE, "this is a test field")
assert console.prompt(field)=="999"
def test_input_p... | gorbinphilip/PyRegistrar | pyregistrar/test/test_console.py | Python | mit | 577 |
import sys
import petsc4py
petsc4py.init(sys.argv)
from ecoli_in_pipe import head_tail
# import numpy as np
# from scipy.interpolate import interp1d
# from petsc4py import PETSc
# from ecoli_in_pipe import single_ecoli, ecoliInPipe, head_tail, ecoli_U
# from codeStore import ecoli_common
#
#
# def call_head_tial(uz_f... | pcmagic/stokes_flow | ecoli_in_pipe/wrapper_head_tail.py | Python | mit | 1,450 |
# Python Code From Book
# This file consists of code snippets only
# It is not intended to be run as a script
raise SystemExit
####################################################################
# 3. Thinking in Binary
####################################################################
import magic
print magic.f... | 0ppen/introhacking | code_from_book.py | Python | mit | 16,192 |
from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework.reverse import reve... | climberwb/video-api | src/comments/serializers.py | Python | mit | 2,962 |
<<<<<<< HEAD
<<<<<<< HEAD
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,... | ArcherSys/ArcherSys | Lib/encodings/cp852.py | Python | mit | 105,146 |
""" Setup file """
import os
from setuptools import find_packages, setup
HERE = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(HERE, "README.rst")) as f:
README = f.read()
with open(os.path.join(HERE, "CHANGES.rst")) as f:
CHANGES = f.read()
REQUIREMENTS_TEST = open(os.path.join(HERE, "r... | stevearc/dynamo3 | setup.py | Python | mit | 1,819 |
#!/usr/bin/env python
import Config
import Database
import atexit, os, time
from flask import Flask
from concurrent.futures import ThreadPoolExecutor
from classes import CRONTask
# Generate a thread pool
executor = ThreadPoolExecutor(5)
app = Flask( __name__ )
@app.route( "/" )
def index( ) :
return "View Generator... | BioGRID/ORCA | operations/ViewGenerator/ViewGeneratorService.py | Python | mit | 594 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-23 15:47
from __future__ import unicode_literals
from django.db import migrations, models
import oktansite.models
class Migration(migrations.Migration):
dependencies = [
('oktansite', '0004_news_attachment'),
]
operations = [
... | aliakbr/oktan | oktansite/migrations/0005_news_image.py | Python | mit | 526 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Models.FeatureProcessing import *
from keras.models import Sequential
from keras.layers import Activation, Dense, LSTM
from keras.optimizers import Adam, SGD
import numpy as np
import abc
from ClassificationModule import ClassificationModule
class descriptionreponame... | Ichaelus/Github-Classifier | Application/Models/ClassificationModules/descriptionreponamelstm.py | Python | mit | 3,641 |
__author__ = 'sekely'
'''
we are using variables almost everywhere in the code.
variables are used to store results, calculations and many more.
this of it as the famous "x" from high school
x = 5, right?
the only thing is, that in Python "x" can store anything
'''
# try this code:
x = 5
y = x + 3
print(y)
# what... | idosekely/python-lessons | lesson_1/variables.py | Python | mit | 403 |
# img
# trigger = attributes[12]
# http://ws-tcg.com/en/cardlist
# edit
import os
import requests
import sqlite3
def get_card(browser):
attributes = browser.find_elements_by_xpath('//table[@class="status"]/tbody/tr/td')
image = attributes[0].find_element_by_xpath('./img').get_attribute('src')
if attri... | electronicdaisy/WeissSchwarzTCGDatabase | card.py | Python | mit | 3,176 |
#
# NineMSN CatchUp TV Video API Library
#
# This code is forked from Network Ten CatchUp TV Video API Library
# Copyright (c) 2013 Adam Malcontenti-Wilson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), ... | predakanga/plugin.video.catchuptv.au.ninemsn | resources/lib/ninemsnvideo/objects.py | Python | mit | 3,248 |
from Bio import SeqIO
def get_proteins_for_db(fastafn, fastadelim, genefield):
"""Runs through fasta file and returns proteins accession nrs, sequences
and evidence levels for storage in lookup DB. Duplicate accessions in
fasta are accepted and removed by keeping only the last one.
"""
records = {... | glormph/msstitch | src/app/readers/fasta.py | Python | mit | 4,853 |
# ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana 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.apa... | matthijsvk/multimodalSR | code/Experiments/neon-master/tests/test_bleuscore.py | Python | mit | 1,914 |
#-*- coding: utf-8 -*-
from .grant import Grant
from ..endpoint import AuthorizationEndpoint
class ImplicitGrant(Grant):
"""
The implicit grant type is used to obtain access tokens (it does not
support the issuance of refresh tokens) and is optimized for public
clients known to operate a particular r... | uptown/django-town | django_town/oauth2/grant/implicitgrant.py | Python | mit | 2,061 |
#!/usr/bin/env python3
from framework import do_exit, get_globals, main
def do_work():
global g_test_import
global globals1
print("do_work")
globals1 = get_globals()
g_test_import = globals1["g_test_import"]
print("do_work: g_test_import = %s" % str(g_test_import))
main(do_work)
| jtraver/dev | python3/globals/test1.py | Python | mit | 308 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/Execute.py | Python | mit | 4,013 |
from django import forms
from django.core.validators import validate_email
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from .utils import get_user_model
class PasswordRecoveryForm(forms.Form):
username_or_email = forms.CharField()
error_messages = {
'not_fo... | xsunfeng/cir | password_reset/forms.py | Python | mit | 4,276 |
from bioscrape.inference import DeterministicLikelihood as DLL
from bioscrape.inference import StochasticTrajectoriesLikelihood as STLL
from bioscrape.inference import StochasticTrajectories
from bioscrape.inference import BulkData
import warnings
import numpy as np
class PIDInterface():
'''
PID Interface : Pa... | ananswam/bioscrape | bioscrape/pid_interfaces.py | Python | mit | 13,998 |
from flask_bcrypt import generate_password_hash
# Change the number of rounds (second argument) until it takes between
# 0.25 and 0.5 seconds to run.
generate_password_hash('password1', 8)
| VaSe7u/Supernutrient_0_5 | hash_check.py | Python | mit | 195 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2017 Tuukka Turto
#
# 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,... | tuturto/pyherc | src/herculeum/ui/gui/mainwindow.py | Python | mit | 8,099 |
from utils.face import Face
import pygame
from utils.message import Message
from utils.alarm import Alarm
class Button(pygame.sprite.Sprite):
def __init__(self, rect, color=(0,0,255), action=None):
pygame.sprite.Sprite.__init__(self)
self.color = color
self.action = action
self... | khan-git/pialarmclock | faces/alarmsetting.py | Python | mit | 3,537 |
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.forms import inlineformset_factory
from djangosige.apps.financeiro.models import PlanoContasGrupo, PlanoContasSubgrupo
class PlanoContasGrupoForm(forms.ModelForm):
class Meta:
model = Pl... | thiagopena/djangoSIGE | djangosige/apps/financeiro/forms/plano.py | Python | mit | 1,165 |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.admin import UserAdmin
from django.contrib import admin
from django import forms
class VoterCreationForm(UserCreationForm):
section = forms.CharField()
def save(self, com... | seanballais/SAElections | SAElections/voting/admin.py | Python | mit | 1,715 |
# -*- coding: utf-8 -*-
# Simple script to test sending UTF8 text with the GrowlNotifier class
import logging
logging.basicConfig(level=logging.DEBUG)
from gntp.notifier import GrowlNotifier
import platform
growl = GrowlNotifier(notifications=['Testing'],password='password',hostname='ayu')
growl.subscribe(platform.nod... | kfdm/gntp | test/subscribe.py | Python | mit | 347 |
#Scripts to plot the data, currently only in the context of Q&A communites.
| Nik0l/UTemPro | Plot.py | Python | mit | 76 |
from django.conf.urls.defaults import *
urlpatterns = patterns('member.views',
url(r'^$', 'login', name='passport_index'),
url(r'^register/$', 'register', name='passport_register'),
url(r'^login/$', 'login', name='passport_login'),
url(r'^logout/$', 'logout', name='passport_logout'),
url(r'^active/... | masiqi/douquan | member/urls.py | Python | mit | 478 |
# -*- coding: utf-8 -*-
"""
The following examples are used to demonstrate how to get/record
analytics
The method signatures are:
Pushbots.get_analytics()
and
Pushbots.record_analytics(platform=None, data=None)
In which you must specify either platform or data.
"""
from pushbots import Pushbots
def example_get_an... | tchar/pushbots | pushbots/examples/analytics.py | Python | mit | 1,805 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import httpretty
import json
import sure
from pyeqs import QuerySet, Filter
from pyeqs.dsl import Term, Sort, ScriptScore
from tests.helpers import homogeneous
@httpretty.activate
def test_create_queryset_with_host_string():
"""
Create a querys... | Yipit/pyeqs | tests/unit/test_connection.py | Python | mit | 4,100 |
from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependency parse. Works on both Doc and Span.
"""
# fmt: off
l... | spacy-io/spaCy | spacy/lang/id/syntax_iterators.py | Python | mit | 1,515 |
from random import randint, seed, choice, random
from numpy import zeros, uint8, cumsum, floor, ceil
from math import sqrt, log
from collections import namedtuple
from PIL import Image
from logging import info, getLogger
class Tree:
def __init__(self, leaf):
self.leaf = leaf
self.lchild = None
self.rchild = Non... | juancroldan/derinkuyu | generation/BSPTree.py | Python | mit | 6,186 |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
def _uniform(*shape):
return numpy.random.uniform(-1, 1, shape).astype(numpy.float32)
@testing.parameteriz... | anaruse/chainer | tests/chainer_tests/functions_tests/connection_tests/test_bilinear.py | Python | mit | 6,944 |
from modelmapper.declarations import Mapper, Field
from modelmapper.qt.fields import QLineEditAccessor
class String(QLineEditAccessor):
def get_value(self):
return str(self.widget.text())
def set_value(self, value):
self.widget.setText(str(value))
class Integer(QLineEditAccessor):
def... | franramirez688/model-mapper | tests/factory/qt/mapper_data.py | Python | mit | 1,040 |
__author__ = 'bptripp'
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Flatten
from keras.... | bptripp/grasp-convnet | py/cninit.py | Python | mit | 7,083 |
# -*- coding: utf-8 -*-
tokens = [
'LPAREN',
'RPAREN',
'LBRACE',
'RBRACE',
'EQUAL',
'DOUBLE_EQUAL',
'NUMBER',
'COMMA',
'VAR_DEFINITION',
'IF',
'ELSE',
'END',
'ID',
'PRINT'
]
t_LPAREN = r"\("
t_RPAREN = r"\)"
t_LBRACE = r"\{"
t_RBRACE = r"\}"
t_EQUAL = r"\="
t_DOU... | pablogonzalezalba/a-language-of-ice-and-fire | lexer_rules.py | Python | mit | 1,138 |
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
import numpy#
from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType
class FeatureSelectionDialog(QtGui.QDialog):
def __init__(self,viewer, parent):
super(FeatureSelectionDialog, self).__init... | timoMa/vigra | vigranumpy/examples/boundary_gui/bv_feature_selection.py | Python | mit | 3,993 |
from engine.api import API
from engine.utils.printing_utils import progressBar
from setup.utils.datastore_utils import repair_corrupt_reference, link_references_to_paper
def remove_duplicates_from_cited_by():
print("\nRemove Duplicates")
api = API()
papers = api.get_all_paper()
for i, paper in enumer... | thomasmauerhofer/search-engine | src/setup/check_for_currupt_references.py | Python | mit | 2,124 |
from polyphony import testbench
def g(x):
if x == 0:
return 0
return 1
def h(x):
if x == 0:
pass
def f(v, i, j, k):
if i == 0:
return v
elif i == 1:
return v
elif i == 2:
h(g(j) + g(k))
return v
elif i == 3:
for m in range(j):
... | ktok07b6/polyphony | tests/if/if28.py | Python | mit | 922 |
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.dirname(BASE_DIR))
from global_variables import *
from evaluation_helper import *
cls_names = g_shape_names
img_name_file_list = [os.path.join(g_real_images_voc12val_det_bbox_folder, name+'.tx... | ShapeNet/RenderForCNN | view_estimation/run_evaluation.py | Python | mit | 932 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Theo Crevon
# Copyright (c) 2013, Greg Leclercq
#
# See the file LICENSE for copying permission.
from boto.swf.exceptions import SWFResponseError
from swf.constants import REGISTERED
from swf.querysets.base import BaseQuerySet
from swf.models import Domain
from swf.model... | botify-labs/python-simple-workflow | swf/querysets/workflow.py | Python | mit | 25,485 |
import tensorflow as tf
from ocnn import *
# octree-based resnet55
def network_resnet(octree, flags, training=True, reuse=None):
depth = flags.depth
channels = [2048, 1024, 512, 256, 128, 64, 32, 16, 8]
with tf.variable_scope("ocnn_resnet", reuse=reuse):
data = octree_property(octree, property_name="feature... | microsoft/O-CNN | tensorflow/script/network_cls.py | Python | mit | 2,557 |
#!/usr/bin/env python
from distutils.core import setup
from dangagearman import __version__ as version
setup(
name = 'danga-gearman',
version = version,
description = 'Client for the Danga (Perl) Gearman implementation',
author = 'Samuel Stauffer',
author_email = 'samuel@descolada.com',
url =... | saymedia/python-danga-gearman | setup.py | Python | mit | 699 |
#!/usr/bin/env python
from __future__ import print_function
import sys
import re
from utils import CDNEngine
from utils import request
if sys.version_info >= (3, 0):
import subprocess as commands
import urllib.parse as urlparse
else:
import commands
import urlparse
def detect(hostname):
"""
P... | Nitr4x/whichCDN | plugins/ErrorServerDetection/behaviors.py | Python | mit | 907 |
"""
=================================================
Modeling quasi-seasonal trends with date features
=================================================
Some trends are common enough to appear seasonal, yet sporadic enough that
approaching them from a seasonal perspective may not be valid. An example of
this is the ... | tgsmith61591/pyramid | examples/preprocessing/example_date_featurizer.py | Python | mit | 2,754 |
import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError
class Plan(Model):
class Tier(Model):
fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in_decimal"]
pass
class ApplicableAddon(Mo... | chargebee/chargebee-python | chargebee/models/plan.py | Python | mit | 2,784 |