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 |
|---|---|---|---|---|---|
import numpy as np
import torch
from torch import nn as nn
from rlkit.policies.base import Policy
from rlkit.pythonplusplus import identity
from rlkit.torch.core import PyTorchModule, eval_np
from rlkit.torch.data_management.normalizer import TorchFixedNormalizer
from rlkit.torch.pytorch_util import activation_from_... | vitchyr/rlkit | rlkit/torch/networks/cnn.py | Python | mit | 12,489 |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
try:
from secret import *
except:
pass
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolut... | olarcheveque/usinacv | usinacv/usinacv/settings/base.py | Python | mit | 8,153 |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Based on Adafruit_I2C.py created by Kevin Townsend.
#
# 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, inc... | adafruit/Adafruit_Python_GPIO | Adafruit_GPIO/I2C.py | Python | mit | 9,083 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.gis.geos import geometry
from PIL import Image
from PIL.ExifTags import TAGS
from ..util import point_from_exif
class Migration(DataMigr... | dschep/django-photomap | photomap/migrations/0004_copy_exif_data_to_model.py | Python | mit | 1,128 |
# -*- coding: utf-8 -*-
"""The application's model objects"""
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy.orm import scoped_session, sessionmaker
# from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import declarative_base
# Global session manager: DBSession() returns the Thread-l... | LamCiuLoeng/internal | tribal/model/__init__.py | Python | mit | 6,536 |
from datetime import date, time
try:
from decimal import Decimal
haveDecimal = True
except ImportError:
haveDecimal = False
from twisted.internet import defer
from twisted.trial import unittest
import formal
from formal import validation
class TestValidators(unittest.TestCase):
def testHasValidator(s... | emgee/formal | formal/test/test_types.py | Python | mit | 6,660 |
import logging
import time
import threading
try:
import ConfigParser as config
except:
import configparser as config
from pydispatch import dispatcher
import requests
import ci_screen.service.ci_server_loader as ci_loader
logger = logging.getLogger(__name__)
class CIServerPoller(object):
def __init__(... | garyjohnson/ci_screen_2 | ci_screen/service/ci_server_poller.py | Python | mit | 2,307 |
from aqt.utils import askUser, showInfo
_field_names = ["Gid", "Gender", "Source", "Target", "Target Language", "Pronunciation"]
_model_name = "Duolingo Sync"
def create_model(mw):
mm = mw.col.models
m = mm.new(_(_model_name))
for field_name in _field_names:
fm = mm.newField(_(field_name))
... | JASchilz/AnkiSyncDuolingo | duolingo_sync/duolingo_model.py | Python | mit | 1,630 |
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from allauth.socialaccount import requests
from allauth.socialaccount.models import SocialLog... | rawjam/django-allauth | allauth/socialaccount/providers/google/views.py | Python | mit | 2,159 |
#! /usr/bin/env python
""" time to run LSTM on this bad boy! """
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import cPickle as pkl
from keras.optimizers import SGD, RMSprop, Adagrad
from keras.utils import np_utils
from keras.models import Sequential
from keras.laye... | eelanagaraj/IST_project | LSTM_ISTapps.py | Python | mit | 5,130 |
#coding=utf-8
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
# Register your models here.
class RegisterForm(forms.Form):
username=forms.CharField(label=_(u"昵称"),max_length=20,widget=forms.TextInput(attrs={'size': 20,'class':"form-cont... | flysmoke/ijizhang | ijizhang_prj/accounts/forms.py | Python | mit | 2,097 |
from django.conf.urls import include, url
from django.views.decorators.cache import cache_page as cp
from django.views.generic import TemplateView
from rest_framework.routers import DefaultRouter
from .views import ReviewViewSet, ReviewView
router = DefaultRouter()
router.register(r'reviews', ReviewViewSet)
urlpatte... | mikoim/japanization | reviews/urls.py | Python | mit | 834 |
"""
WSGI config for text_analysis project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | bungoume/mecab-web-api | text_analysis/text_analysis/wsgi.py | Python | mit | 403 |
import threading
import time
import logging
class _Module(threading.Thread):
def __init__(self, parent, name):
threading.Thread.__init__(self)
self.logger = logging.getLogger()
self.parent = parent
self.daemon = False
self.event = threading.Event()
self.running = True
self._className = se... | cscashby/pi-showcontrol | src/modules/_Module.py | Python | mit | 772 |
"""
Pixel perfect collision algorithm
From http://www.pygame.org/wiki/FastPixelPerfect?parent=CookBook
"""
import pygame
def pixel_perfect_check_collision(obj1, obj2):
image_mask = pygame.mask.from_surface(obj1.image)
otherimage_mask = pygame.mask.from_surface(obj2.image)
offset_x = obj1.rect.left - obj2... | baritone-snake-studios/flappyturtle | flappyturtle/objects/collision.py | Python | mit | 505 |
import matplotlib.pyplot as plt
import numpy as np
import pdb
if __name__ == "__main__":
fig, ax = plt.subplots(figsize=(10,5))
for clients in (10, 50, 100, 200):
median_data = np.zeros(5)
for k in (1, 2, 3, 4, 5):
data = np.loadtxt("loss_" + str(clients) + "_" + str(k) + ".csv... | DistributedML/TorML | eurosys-eval/results_tor_no_tor/makeplot.py | Python | mit | 1,404 |
# coding=utf8
import random
import logging
import json
import time
from httplib2 import Http
from logging import handlers
LOG_FILE = '../logs/WSCN_client.log'
handler = logging.handlers.RotatingFileHandler(LOG_FILE, maxBytes=1024 * 1024, backupCount=5) # 实例化handler
handler.setFormatter(logging.Formatter('%(asctime)... | katuyo/symbol-exchange | integration/script.py | Python | mit | 1,297 |
import json
import math
######################################################
# add parameters
######################################################
def addParameters(scene, h=0.005, maxIter=5, maxIterVel=5, velocityUpdateMethod=0, contactTolerance=0.05, triangleModelSimulationMethod=2, triangleModelBendingMethod=2... | janbender/PositionBasedDynamics | data/scenes/SceneGenerator.py | Python | mit | 12,344 |
class Action:
label = ""
selectable = 0
def __init__ (self,label="",s=0):
self.label = label
self.selectable = s
def getLabel (self):
return self.label
def do (self):
tmp = 1
def canSelect (self):
return self.selectable
| tbdale/crystalfontz-lcd-ui | python/Action.py | Python | mit | 289 |
# Generated by Django 3.2 on 2021-08-25 20:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Ville',
fields=[
('id', models.IntegerField(d... | fab13n/caracole | villes/migrations/0001_initial.py | Python | mit | 5,318 |
__author__ = 'mkrcah'
| mkrcah/propsort | propsort/__init__.py | Python | mit | 22 |
import json
try:
from urllib.parse import urljoin
from urllib.parse import urlencode
except ImportError:
from urlparse import urljoin
from urllib import urlencode
import facepy
from django.conf import settings
from django.utils import timezone
from django.conf import settings
from django.core import s... | pozytywnie/django-facebook-auth | facebook_auth/utils.py | Python | mit | 2,967 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2018-01-24 19:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('page', '0009_auto_20180124_0105'),
]
operations = [
migrations.AlterField(
... | mcmaxwell/idea_digital_agency | idea/feincms/module/page/migrations/0010_auto_20180124_1945.py | Python | mit | 612 |
# This file is part of the Python 2.7 module subprocess.py, included here
# for compatibility with Python 2.6.
#
# It is still under the original, very open PSF license, see the original
# copyright message included below.
#
# subprocess - Subprocesses with accessible I/O streams
#
# For more information about this mod... | auag92/n2dm | Asap-3.8.4/OpenKIMexport/subprocess_py27.py | Python | mit | 1,883 |
"""
File Adapter Module
"""
import time
import uuid
from flask import request, jsonify
from ..base import BaseAdapter
class FileAdapter(BaseAdapter):
""" File Adapter Class """
def create_routes(self, app, mongo):
""" Routes Creator """
@app.route('/api/upload', methods=['POST'])
de... | noahziheng/freeiot | libfreeiot/adapters/file/main.py | Python | mit | 1,195 |
import urllib2
import wikipedia
import json
from bs4 import BeautifulSoup
if __name__ == '__main__':
wikipedia.set_rate_limiting(True)
charity_list_url = 'List_of_charitable_foundations'
wikipage_list = wikipedia.page(charity_list_url)
charity_results = []
for charity_name in wikipage_list.links:
... | MrMallIronmaker/donatio | pullCharityData.py | Python | mit | 1,208 |
#!/usr/bin/env python
# coding=utf-8
# code by kbdancer@92ez.com
from threading import Thread
from telnetlib import Telnet
import requests
import sqlite3
import queue
import time
import sys
import os
def ip2num(ip):
ip = [int(x) for x in ip.split('.')]
return ip[0] << 24 | ip[1] << 16 | ip[2] << 8 | ip[3]
... | kbdancer/TPLINKKEY | scan.py | Python | mit | 5,658 |
"""Example process file."""
from mapchete.errors import MapcheteNodataTile
from shapely.geometry import shape
def execute(mp):
"""User defined process."""
# Reading and writing data works like this:
with mp.open("file1") as vector_file:
if vector_file.is_empty():
raise MapcheteNodataT... | ungarj/mapchete | test/testdata/geojson_test.py | Python | mit | 717 |
from geoscript.style import util
from geoscript.style.expression import Expression
from geoscript.style.font import Font
from geoscript.style.fill import Fill
from geoscript.style.halo import Halo
from geoscript.style.color import Color
from geoscript.style.property import Property
from geoscript.style.symbolizer impor... | jericks/geoscript-py | geoscript/style/label.py | Python | mit | 4,163 |
from __future__ import division
import numpy as np,opticstools,matplotlib.pyplot as plt,math,scipy.ndimage,copy
from skimage.measure import block_reduce
import astropy.io.fits as pyfits
import os,sys,contratio as crat
nameList = sys.argv[5:len(sys.argv)]
if len(sys.argv)<4:
print('Useage: crat_from_object.py raw_di... | mikeireland/pynrm | fake_companion.py | Python | mit | 4,240 |
class Blood(object):
uid = "blood"
name = "Blood"
"""
Most characters will have ordinary blood but some could have acidic blood or with other properties.
"""
| ChrisLR/Python-Roguelike-Template | bodies/blood/base.py | Python | mit | 178 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | mnahm5/django-estore | Lib/site-packages/awscli/customizations/emr/argumentschema.py | Python | mit | 22,109 |
import smtplib
from email.mime.text import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.Header import Header
from email import Charset
class MailConfig(object):
def __init__(self, config):
self.smtp_host = config.smtp_host
self.smtp_port = config.smtp_port
self.smtp_loc... | jwoschitz/SimpleAuth | src/mail.py | Python | mit | 3,973 |
__author__ = 'mpetyx'
from unittest import TestCase
import unittest
import logging
import sys
from pyapi import API
class TestpyAPI(TestCase):
def setUp(self):
# print "Setting up the coverage unit test for pyapi"
self.document = API()
self.api = API().parse(location="url", language="ram... | mpetyx/pyapi | tests/test_overview_example.py | Python | mit | 1,364 |
# Run all test suites
import unittest, os
from database_api_test_archive import *
from database_api_test_course import *
from database_api_test_exam import *
from database_api_test_teacher import *
from database_api_test_user import *
from rest_api_test_user import *
# List of test suites
db_suites = [u... | petterip/exam-archive | test/__main__.py | Python | mit | 958 |
import Fast5File
def run(parser, args):
if args.read:
for i, fast5 in enumerate(Fast5File.Fast5FileSet(args.files)):
for metadata_dict in fast5.read_metadata:
if i == 0:
header = metadata_dict.keys()
print "\t".join(["filename"] + header)
print "\t".join([fast5.filename] + [str( metadata_dict[... | arq5x/poretools | poretools/metadata.py | Python | mit | 641 |
"""Convert "arbitrary" sound files to AIFF (Apple and SGI's audio format).
Input may be compressed.
Uncompressed file type may be AIFF, WAV, VOC, 8SVX, NeXT/Sun, and others.
An exception is raised if the file is not of a recognized type.
Returned filename is either the input filename or a temporary filename;
in the la... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.2/Lib/toaiff.py | Python | mit | 2,989 |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="x", parent_name="choropleth.colorbar", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit... | plotly/plotly.py | packages/python/plotly/plotly/validators/choropleth/colorbar/_x.py | Python | mit | 472 |
"""
Implementation of the paper,
Durand and Dorsey SIGGGRAPH 2002,
"Fast Bilateral Fitering for the display of high-dynamic range images"
"""
import numpy as np
import hydra.io
import hydra.filters
def bilateral_separation(img, sigma_s=0.02, sigma_r=0.4):
r, c = img.shape
sigma_s = max(r, c) * sigma_s
... | tatsy/hydra | hydra/tonemap/durand.py | Python | mit | 1,367 |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä ... | fretsonfire/fof-python | src/NetworkTest.py | Python | mit | 2,106 |
"""
This program handles the communication over I2C between a Raspberry Pi and a
BMP180 Temperature/Pressure sensor.
Made by: MrTijn/Tijndagamer
Copyright 2015-2017
Released under the MIT license.
"""
import smbus
import math
from time import sleep
class bmp180:
# Global variables
address = None
bus = smb... | Tijndagamer/BMP180-Python | bmp180/bmp180.py | Python | mit | 6,914 |
"""Features modules"""
| timevortexproject/timevortex | features/__init__.py | Python | mit | 23 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
from sc2reader.utils import Length
from sc2reader.events.base import Event
from sc2reader.log_utils import loggable
from itertools import chain
@loggable
class GameEvent(Event):
"""
This is the base cl... | ggtracker/sc2reader | sc2reader/events/game.py | Python | mit | 25,673 |
#!/usr/bin/env python
"""Application controller for CD-HIT v3.1.1"""
import shutil
from os import remove
from cogent.app.parameters import ValuedParameter
from cogent.app.util import CommandLineApplication, ResultPath,\
get_tmp_filename
from cogent.core.moltype import RNA, DNA, PROTEIN
from cogent.core.alignme... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/cogent/app/cd_hit.py | Python | mit | 11,924 |
import code
import signal
import sys
import greenlet
import logging
class SigintHappened(object):
pass
class SystemExitFromCodeThread(SystemExit):
pass
class CodeRunner(object):
"""Runs user code in an interpreter, taking care of stdout/in/err"""
def __init__(self, interp=None, stuff_a_refresh_reques... | thomasballinger/old-bpython-with-hy-support | bpython/curtsiesfrontend/coderunner.py | Python | mit | 4,839 |
"""
Automatically generate marking helpers functions.
"""
import sys
from .objects import Mark
class SimpleHelpers(object):
"""
A class that is designed to act as a module and implement magic helper
generation.
"""
def __init__(self):
self.__helpers = {}
def make_helper(self, color... | freelan-developers/chromalog | chromalog/mark/helpers.py | Python | mit | 5,224 |
# -*- coding: utf-8 -*-
import os
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
# Initialize Base class
Base = declarative_base()
metadata = Base.metadata
session_maker = sessionmaker()
session = scoped_session(se... | thejunglejane/datums | datums/models/base.py | Python | mit | 5,846 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Contact(models.Model):
name = models.CharField(max_length=255, verbose_name=_("namn"))
email = models.EmailField(verbose_name=_("e-post"))
def __str__(self):
return self.name
class Meta:
verbos... | andersonjonathan/Navitas | navitas/contact/models.py | Python | mit | 391 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-16 21:51
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):
dependencies = [
migrations.swappable_depende... | ava-project/ava-website | website/apps/user/migrations/0003_emailvalidationtoken.py | Python | mit | 973 |
#!/usr/local/bin/python3
import cgi
print("Content-type: text/html")
print('''
<!DOCTYPE html>
<html>
<head>
<title>Python</title>
</head>
<body>
<h1>Python</h1>
<p>Python</p>
<p>This is the article for Python</p>
</body>
</html>
''')
| Secretmapper/updevcamp-session-2-dist | form/cgi-bin/lectures/simple/python.py | Python | mit | 272 |
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
numbers = [int(x) for x in input().split()]
u = 0
d = 0
for x in numbers:
if x >= 0:
u += 1
else:
d += 1
if u == 1:
for x in numbers:
if x >= 0:
... | NendoTaka/CodeForReference | Codingame/Python/Clash/intNotLikeOthers.py | Python | mit | 494 |
"""
Implement atoi() in Python (given a string, return a number).
Assume all the strings are always valid.
"""
import unittest
def atoi(string):
l = len(string)
t = 0
v = 10 ** (l - 1)
for ch in string:
t += v * int(ch)
v /= 10
return t
def atoi2(string):
l, t = len(string),... | kratorius/ads | python/interviewquestions/atoi.py | Python | mit | 1,456 |
__author__ = 'g10k'
"""Потом убрать в миграции"""
# ('Регистраторы','Регистраторы'),
# ('Менеджеры','Менеджеры'),
# ('Проф департамент','Проф департамент'),
# ('Аналитика','Аналитика'),
# ('Контроль качества','Контроль качества'),
import kb.models
departaments = {
'Регистра... | telminov/knowledge-base | kb/data.py | Python | mit | 1,498 |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# 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... | twchad/Adafruit_Python_SSD1351 | Adafruit_SSD1351/SSD1351.py | Python | mit | 11,355 |
class Solution(object):
def reverseBits(self, n):
"""
:type n: int
:rtype: int
"""
ret = 0
for i in range(32):
ret += (n%2) * 2**(31-i)
n /= 2
return ret | xingjian-f/Leetcode-solution | 190. Reverse Bits.py | Python | mit | 231 |
"""Configuration for pytest."""
import json
def pytest_generate_tests(metafunc):
"""Configure pytest to call each of the tests once for each test case."""
if "test_case" in metafunc.fixturenames:
tests = json.load(open("tests/test_data.json"))["tests"]
metafunc.parametrize("test_case", tests)
| rowanphipps/Cerberus | tests/conftest.py | Python | mit | 320 |
#! /usr/bin/env python
#
# IRC2LCD
# Tim Ballas
#
"""IRC bot to display mentions on an LCD through a Parallax Propeller.
Usage: IRCbot2LCD.py <server[:port]> <channel> <nicknameToMonitor> <COMport> <optional bot nickname>
"""
#
# Modified from:
# Example program using irc.bot.
# Joel Rosdahl <joel@rosdahl.net>
#
imp... | tballas/IRC2LCD | Python/IRC2LCD.py | Python | mit | 2,965 |
#!/usr/bin/env python3
"""
Rename and organize Horos QC exported data in <BIDS Root>/incoming and place in <BIDS Root>/sourcedata
AUTHOR
----
Mike Tyszka, Ph.D.
MIT License
Copyright (c) 2019 Mike Tyszka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated doc... | jmtyszka/CBICQA | bin/cbicqc_incoming.py | Python | mit | 4,170 |
# -*- coding: utf-8; -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Flavien Charlon
#
# 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 t... | OpenAssets/openassets | openassets/protocol.py | Python | mit | 19,047 |
#!/usr/bin/env python3
import os
import linecache
import tempfile
lorem = '''Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Vivamus eget elit. In posuere mi non
risus. Mauris id quam posuere lectus sollicitudin
varius. Praesent at mi. Nunc eu velit. Sed augue massa,
fermentum id, nonummy a, nonummy sit ame... | eroicaleo/ThePythonStandardLibraryByExample | ch06TheFileSystem/linecache_test.py | Python | mit | 1,655 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/transfer_user_in_request.py | Python | mit | 7,582 |
from django.db import models
class TimeStampedModel(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
class Caller(TimeStampedModel):
name = models.CharField(max_length=30)
phone_number = models.Cha... | benjamin0/how-do-you-like-them-apples | howdoyoulike/calls/models.py | Python | mit | 1,136 |
{
"register": {
"email": "email address already exists",
"password": "password's length must longer than six characters",
"username": "{ username } already exists"
},
"login": {
"email": "email address not exists",
"password": "password is not correct"
}
}
| free-free/pyblog | pyblog/locale/english/message.py | Python | mit | 313 |
from wasp94_base import *
# create a night to analyze
from mosasaurus.Night import Night
n = Night('ut140801', instrument=i)
n.createNightlyLog(remake=False)
# create an observation
from mosasaurus.Observation import Observation
o = Observation(t, i, n)
o.setupFilePrefixes(science=['WASP-94'], reference=['WASP-94'], ... | zkbt/mosasaurus | scripts/wasp94/wasp94_ut140801.py | Python | mit | 1,142 |
"""Kerasの各種モデル。"""
# pylint: skip-file
# flake8: noqa
from . import darknet53, efficientnet, xception
| ak110/pytoolkit | pytoolkit/applications/__init__.py | Python | mit | 117 |
# encoding: utf-8
import os
import subprocess
import sys
from workflow import Workflow3 as Workflow, MATCH_SUBSTRING
from workflow.background import run_in_background
import brew_actions
import helpers
GITHUB_SLUG = 'fniephaus/alfred-homebrew'
def execute(wf, cmd_list):
brew_arch = helpers.get_brew_arch(wf)
... | fniephaus/alfred-homebrew | src/brew.py | Python | mit | 12,427 |
from os.path import join as pjoin
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 0
_version_minor = 2
_version_micro = '' # use '' for first of series, number for 1 and above
_version_extra = 'dev'
#_version_extra = '' # Uncomment this for full releases
# Construct ful... | NickC1/skedm | build/lib/skedm/version.py | Python | mit | 1,850 |
import logging
from ..models import Activity
from .date import activity_stream_date_to_datetime, datetime_to_string
log = logging.getLogger(__name__)
def activity_from_dict(data):
log.debug("Converting YouTube dict to Activity Model")
activity_dict = activity_dict_from_dict(data)
return Activity.from_ac... | blitzagency/django-chatterbox | chatterbox/utils/youtube.py | Python | mit | 4,331 |
import web
from gothonweb import map
urls = (
'/game', 'GameEngine',
'/', 'Index',
)
app = web.application(urls, globals())
#little hack so that debug mode works with sessions
if web.config.get('_session') is None:
store = web.session.DiskStore('sessions')
session = web.session.Session(app, store,
... | githubfun/lphw | gothonweb/bin/gothon_app.py | Python | mit | 1,131 |
#FIXME: UNDO, click time at end to undo
from PyQt4 import QtCore, QtGui
import sys, os
import volume_editor_layout, settings_layout, cPickle
import numpy as np
from utils import Utils
class SettingsEditWidget(QtGui.QDialog, settings_layout.Ui_Dialog):
#################################################### Init
... | singleswitch/ticker | settings_editor.py | Python | mit | 9,463 |
# Generated from 'Appearance.h'
def FOUR_CHAR_CODE(x): return x
kAppearanceEventClass = FOUR_CHAR_CODE('appr')
kAEAppearanceChanged = FOUR_CHAR_CODE('thme')
kAESystemFontChanged = FOUR_CHAR_CODE('sysf')
kAESmallSystemFontChanged = FOUR_CHAR_CODE('ssfn')
kAEViewsFontChanged = FOUR_CHAR_CODE('vfnt')
kThemeDataFileType ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/Carbon/Appearance.py | Python | mit | 26,525 |
# -*- coding: utf-8 -*-
def get_instance_children(obj, depth=0, sig=0):
"""
Récupèration récursive des relations enfants d'un objet
@depth: integer limitant le niveau de recherche des enfants, 0=illimité
"""
children = []
# Pour toute les relations enfants de l'objet
for child in obj._m... | sveetch/sveedocuments | sveedocuments/utils/objects.py | Python | mit | 871 |
#!/usr/bin/env python
"""Plot information needed file"""
########################################################################
# File: plot_raw_read_alignment.py
# executable: plot_raw_read_alignment.py
#
# Author: Andrew Bailey
# History: Created 12/01/17
###########################################################... | UCSC-nanopore-cgl/nanopore-RNN | nanotensor/visualization/plot_raw_read_alignment.py | Python | mit | 7,635 |
#!/usr/bin/env python
"""
gets basic info about AVI file using OpenCV
input: filename or cv2.Capture
"""
from pathlib import Path
from struct import pack
from typing import Dict, Any
import cv2
def getaviprop(fn: Path) -> Dict[str, Any]:
if isinstance(fn, (str, Path)): # assuming filename
fn = Path(fn).... | scienceopen/CVutils | morecvutils/getaviprop.py | Python | mit | 1,520 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-09 15:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('helusers', '0001_add_ad_groups'),
('helevents', '0003_auto_20170915_1529'),
]
... | City-of-Helsinki/linkedevents | helevents/migrations/0004_auto_20180109_1727.py | Python | mit | 639 |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import boto.exception
import io
import json
import wizzat.kvtable
from boto.s3.key import Key, compute_md5
__all__ = [
'S3Table',
]
class S3Table(wizzat.kvtable.KVTable):
"""
This is a micro-ORM fo... | wizzat/wizzat.py | wizzat/s3table.py | Python | mit | 2,568 |
#!/usr/bin/env python
#coding=utf-8
# Filename: writer.py
'''
日志记录
@author: 1th
@data: 2017.2.28
'''
from time import sleep
import datetime
from simpleat.conf import settings, globalvar
from simpleat.core import exceptions
from .logger import write_log
_CMD_OUT = settings.CMD_OUT # 是否在命令行进行输出
_LOG_OUT = settings.LOG... | 15th/simpleat | simpleat/core/log/writer.py | Python | mit | 1,220 |
#!/usr/bin/env python
# Note: this module is not a demo per se, but is used by many of
# the demo modules for various purposes.
import wx
#---------------------------------------------------------------------------
class ColoredPanel(wx.Window):
def __init__(self, parent, color):
wx.Window.__init__(se... | dnxbjyj/python-basic | gui/wxpython/wxPython-demo-4.0.1/demo/ColorPanel.py | Python | mit | 577 |
from django.apps import AppConfig
class ImagerProfileAppConfig(AppConfig):
name = "imager_profile"
verbose_name = "Imager User Profile"
def ready(self):
"""code to run when the app is ready"""
from imager_profile import handlers
| crashtack/django-imager | imager_profile/apps.py | Python | mit | 260 |
VERSION = (0, 0, 1, 'dev')
# Dynamically calculate the version based on VERSION tuple
if len(VERSION) > 2 and VERSION[2] is not None:
if isinstance(VERSION[2], int):
str_version = "%s.%s.%s" % VERSION[:3]
else:
str_version = "%s.%s_%s" % VERSION[:3]
else:
str_version = "%s.%s" % VERSION[:2]... | yceruto/django-formapi | formapi/__init__.py | Python | mit | 348 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-24 18:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounting', '0007_bankstatement'),
]
operations = [
migrations.AddField(
... | eedf/jeito | accounting/migrations/0008_auto_20170224_1912.py | Python | mit | 631 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
Very simple script to replace a template with another one.
It also converts the old MediaWiki boilerplate format to the new format.
Syntax: python template.py [-remove] [xml[:filename]] oldTemplate [newTemplate]
Specify the template on the command line. The program will... | icyflame/batman | scripts/template.py | Python | mit | 14,372 |
'''
Virtual topology
'''
class VTopo(object):
'''
Attributes:
- switches : virtual switch list
- links : virtual links
'''
def __init__(self):
super(VTopo, self).__init__()
self.isStart = False
self.switches = []
self.links = []
def addSwitch(self, vswitc... | TakeshiTseng/HyperRyu | hyper_ryu/vtopo/vtopo.py | Python | mit | 884 |
'''
Download Cricket Data
'''
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import csv
import sys
import time
import os
import unicodedata
from urlparse import urlparse
from BeautifulSoup import BeautifulSoup, SoupStrainer
BASE_URL = 'http://www.espncricinfo.com'
if not os.path.exists('./espncricinf... | soodoku/get-cricket-data | scripts/scraper.py | Python | mit | 1,947 |
# coding: utf8
from django.test import RequestFactory
from django.test import TestCase
from django.core.urlresolvers import resolve
from django.views.generic import ListView
import pytest
from selenium import webdriver
import time
from cms.test_utils.testcases import CMSTestCase
from django.test.utils import override_... | kecheon/yablist | categories/tests/test_fn.py | Python | mit | 2,091 |
import hashlib
def hash_list():
return str(hashlib.algorithms_guaranteed)
def hash_text(algorithm_array, text, pass_count):
result_dict = {}
# Type checking
if type(pass_count) is not int:
return [False, {"error": "Pass count should be of 'integer' type."}]
elif type(text) is not str:
... | tykkz/hasherapp | algorithm.py | Python | mit | 1,194 |
"""Form mixins for the ``multilingual_tags`` app."""
from django import forms
from django.forms.utils import ErrorList
from django.contrib.contenttypes.models import ContentType
from django.utils.text import slugify
from django.utils.translation import get_language, ugettext_lazy as _
from .. import models
class Tag... | bitmazk/django-multilingual-tags | multilingual_tags/forms/mixins.py | Python | mit | 5,178 |
class Obfuscator:
""" A simple obfuscator class using repeated xor """
def __init__(self, data):
self._string = data
def obfuscate(self):
"""Obfuscate a string by using repeated xor"""
out = ""
data = self._string
a0=ord(data[0])
a1=ord(data... | ActiveState/code | recipes/Python/189745_Symmetric_datobfuscatiusing/recipe-189745.py | Python | mit | 1,786 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clients', '0017_auto_20151025_1240'),
('clients', '0015_auto_20151025_1209'),
]
operations = [
]
| deafhhs/adapt | clients/migrations/0018_merge.py | Python | mit | 297 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-03 16:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('player', '0001_initial'),
]
operations = [
... | valdergallo/raidmanager | player/migrations/0002_auto_20160403_1645.py | Python | mit | 2,163 |
#!/usr/bin/python
import magic
import sys
m = magic.open(magic.MIME_TYPE)
m.load()
for f in sys.argv[1:]:
try :
print(f, m.file(f))
except :
prin... | pzia/keepmydatas | misc/testmagic.py | Python | mit | 344 |
__all__ = ['tsort']
from functools import reduce
def tsort(data, smallest_first=False, fewest_edges_first=False, flatten=False):
# FIXME: support fewest_edges_first
# make copy of data
tmp = data.copy()
# remove self-references
for k, v in tmp.items():
v.discard(k)
# initially find v... | mtasic85/pytsort | tsort.py | Python | mit | 2,082 |
# -*- coding: utf-8 -*-
import random as rand
class PrimeTester(object):
def solovay_strassen(self, primo, acuracidade=5):
nro_tentativas = 0
if primo == 2 or primo == 3:
return (nro_tentativas, True)
if primo < 2:
raise ValueError('Entrada < 2')
if primo %... | tonussi/inseguro | laboratorio/rsa/pseudo.py | Python | mit | 4,350 |
"""
A collection of Xentica models and experiments.
Indended to illustrate how to use the framework.
"""
| a5kin/hecate | examples/__init__.py | Python | mit | 107 |
# Created by PyCharm Pro Edition
# User: Kaushik Talukdar
# Date: 01-04-17
# Time: 03:10 AM
# Using continue
# continue will send the loop back to its root
nos = 0
while nos < 10:
nos += 1
if nos%2 == 0:
continue
print(nos)
# AVOID INFINITE LOOP
#... | KT26/PythonCourse | 6. User Input and While Loops/8.py | Python | mit | 465 |
import os
import gevent
from rhizo.main import c
path_on_server = c.path_on_server()
name = path_on_server.rsplit('/', 1)[1]
print(name, os.getcwd(), path_on_server)
# loop forever sending messages
message_index = 0
while True:
message = 'msg-%s-%d' % (name, message_index)
print('%s: send: %s' % (name, mess... | rhizolab/rhizo | tests_with_server/stress-testing/each_controller.py | Python | mit | 401 |
"""
The Fibonacci numbers, which we are all familiar with, start like this:
0,1,1,2,3,5,8,13,21,34,...
Where each new number in the sequence is the sum of the previous two.
It turns out that by summing different Fibonacci numbers with each other, you can create every single positive integer.
In fact, a much stronger... | DayGitH/Python-Challenges | DailyProgrammer/DP20120709A.py | Python | mit | 2,709 |
#!/usr/bin/python3
from .compat import BaseHTTPRequestHandler, HTTPServer
import urllib
import json
import sys
import time
import warnings
from slackly import SlackClient
warnings.warn("This part of slackly (oauth_utils) is highly experimental and will likely see api breaking changes")
class CodeServer(BaseHTTPReq... | huntcsg/slackly | src/slackly/oauth_utils.py | Python | mit | 1,841 |
#!/usr/bin/env python
# Author: csiu
# Created: 2015-02-02
import argparse
from ConfigParser import SafeConfigParser
import sys
import os
from utils import get_value_from_keycolonvalue_list, ensure_dir, random_string
import features
import mirna_proximity
import correlation
import gff_unify_features
import promirna
i... | csiu/promi2 | code/promi2.py | Python | mit | 8,709 |
import unittest
import os.path
import numpy as np
import pandas as pd
from pandas.util.testing import assert_frame_equal
import test_helper
import copy
from operator import lt, le, eq, ne, ge, gt
from pandas.core.index import Index
__index_symbol__ = {
Index.union: ',',
Index.intersection: '&',
Index.diff... | Quantipy/quantipy | tests/test_rules.py | Python | mit | 81,385 |