code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import datetime
import logging
import os
import signal
import threading
import time
from multiprocessing import Event as ProcessEvent
from multiprocessing import Process
try:
import gevent
from gevent import Greenlet
from gevent.event import Event as GreenEvent
except ImportError:
Greenlet = GreenEven... | deathowl/huey | huey/consumer.py | Python | mit | 11,130 |
from setuptools import setup, find_packages
import sys, os, glob
version = '0.7.1'
setup(name='seqtools',
version=version,
description="",
long_description="""\
""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='',
author='Sean ... | lowks/SDST | setup.py | Python | mit | 788 |
#!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: magic
"""
from django.contrib import admin
from blog.models import User
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext, ugettext_lazy as _
class BlogUserAdmin(UserAdmin):
filesets = (
(None, {'fields': ... | csunny/blog_project | source/apps/blog/admin/user.py | Python | mit | 863 |
#!/usr/bin/env python
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
# Script to make a new python-sensor release on Github
# Requires the Github CLI to be installed and configured: https://github.com/cli/cli
import os
import sys
import distutils.spawn
from subprocess import check_output
if len(sy... | instana/python-sensor | bin/create_general_release.py | Python | mit | 1,486 |
#!/usr/bin/env python
# encoding: utf-8
# Here's a simple script (feels like a program, though) that prints out
# the first n narcissistic numbers, where n is provided on the command line. import sys
import sys
def numDigits(num):
"""Returns the number of digits making
up a number, not counting leading zeroes,
exce... | nakayamaqs/PythonModule | Learning/narcissistic.py | Python | mit | 1,383 |
# -*- coding: utf-8 -*-
#
from . import ek90, porcelain
| nschloe/maelstrom | examples/problems/my_materials/__init__.py | Python | mit | 57 |
import unittest
from y2017.day5 import *
class TestDay5(unittest.TestCase):
def test_part_A(self):
self.assertEqual(jump_increment('0\n3\n0\n1\n-3\n'), 5)
def test_part_B(self):
self.assertEqual(jump_conditional_increment('0\n3\n0\n1\n-3\n'), 10)
| martakus/advent-of-code | y2017/tests/test5.py | Python | mit | 274 |
# -*- coding: utf-8 -*-
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Div, Field, Layout, Submit
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .mo... | maru/fiubar | fiubar/users/forms.py | Python | mit | 4,831 |
import dj_database_url
import pkg_resources
from yawn.settings.base import *
# this uses DATABASE_URL env variable:
DATABASES['default'] = dj_database_url.config(conn_max_age=600)
SECRET_KEY = os.environ.get('SECRET_KEY')
ALLOWED_HOSTS = [os.environ.get('ALLOWED_HOSTS')]
# Allow anonymous read
REST_FRAMEWORK['DEF... | aclowes/yawn-gke | yawn_settings.py | Python | mit | 727 |
"""
Lua pattern matcher based on a NFA
inspired by
http://swtch.com/~rsc/regexp/regexp1.html
"""
from rpyre.interface.lua import compile_re
from rpyre.matching import find
def main(args):
n = 20
s = args[1]
#s = "(a|b)*a%sa(a|b)*$" % ("(a|b)" * n, )
print s
evilregex = compile_re(s)
import os... | fhahn/rpyre | tools/cli.py | Python | mit | 904 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#==============================================================================
# main file for creating apsimRegion experiments
#==============================================================================
import os
from apsimRegions.preprocess.configMaker import create... | dhstack/apsimRegions | scripts/preprocess.py | Python | mit | 2,525 |
from django.contrib import admin
from .models import CustomUser, Equipment, Search, TagManagement
from .models import Reserved, Request, Vote, Log, Tag
admin.site.register(CustomUser)
admin.site.register(Equipment)
admin.site.register(Search)
admin.site.register(Reserved)
admin.site.register(Request)
admin.site.regist... | XMLPro/ManagementSystem | system/admin.py | Python | mit | 414 |
import uuid
import base64
import re
def generate_key():
"""
generates a uuid, encodes it with base32 and strips it's padding.
this reduces the string size from 32 to 26 chars.
"""
return base64.b32encode(uuid.uuid4().bytes).strip('=').lower()[0:12]
def thousand_separator(x=0, sep='.', dot=','):
"""
creates a ... | hsw5138/bis | backend/helpers.py | Python | mit | 2,048 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class LoCatrConfig(AppConfig):
name = 'LoCatr'
| scifiswapnil/Project-LoCatr | LoCatr/LoCatr/apps.py | Python | mit | 152 |
from collections import deque
from sys import stdout
import re
contextLines = 3
class DiffLines:
"""A single span of lines from a chunk of diff, used to store either the original
or the changed lines"""
def __init__(self, start, lines):
"""Note: end is inclusive"""
self.start = start
... | martinthomson/blame-bridge | blame_bridge/diffu.py | Python | mit | 8,505 |
#!/usr/bin/env python
# encoding: utf-8
from cadnano.cnproxy import ProxyObject, ProxySignal
import cadnano.util as util
from cadnano.enum import StrandType
from cadnano.cnproxy import UndoStack, UndoCommand
from cadnano.strandset import StrandSet
from .removevhelixcmd import RemoveVirtualHelixCommand
class Virtua... | JMMolenaar/cadnano2.5 | cadnano/virtualhelix/virtualhelix.py | Python | mit | 7,266 |
from implementation import *
from implementations import *
| drvinceknight/sklDj | sklDj/implementations/__init__.py | Python | mit | 59 |
import _plotly_utils.basevalidators
class NamelengthsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="namelengthsrc", parent_name="bar.hoverlabel", **kwargs
):
super(NamelengthsrcValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/hoverlabel/_namelengthsrc.py | Python | mit | 432 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'newmember.ui'
#
# Created: Sat Mar 29 19:36:48 2014
# by: PyQt5 UI code generator 5.2.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_NewMember(object):
def setupUi(se... | Teknologforeningen/svaksvat | ui/newmember.py | Python | mit | 9,586 |
# Copyright (c) 2018, Ansible Project
from ansiblelint.rules import AnsibleLintRule
class MetaChangeFromDefaultRule(AnsibleLintRule):
id = '703'
shortdesc = 'meta/main.yml default values should be changed'
field_defaults = [
('author', 'your name'),
('description', 'your description'),
... | willthames/ansible-lint | lib/ansiblelint/rules/MetaChangeFromDefaultRule.py | Python | mit | 1,254 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error_py3.py | Python | mit | 1,474 |
from distutils.core import setup, Command
from pyvx import __version__
import sys
class PyTestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import pytest
errno = pytest.main()
sys.exit(er... | hakanardo/pyvx | setup.py | Python | mit | 1,768 |
from __future__ import annotations
class Node:
def __init__(self, data=None):
self.data = data
self.next = None
def __repr__(self):
"""Returns a visual representation of the node and all its following nodes."""
string_rep = []
temp = self
while temp:
... | TheAlgorithms/Python | data_structures/linked_list/print_reverse.py | Python | mit | 1,768 |
"""
The algorithm finds the pattern in given text using following rule.
The bad-character rule considers the mismatched character in Text.
The next occurrence of that character to the left in Pattern is found,
If the mismatched character occurs to the left in Pattern,
a shift is proposed that aligns text block and pa... | TheAlgorithms/Python | strings/boyer_moore_search.py | Python | mit | 2,738 |
__all__ = [
'json_schema',
]
import lollipop.types as lt
import lollipop.validators as lv
from lollipop.utils import identity
from collections import OrderedDict
from .compat import iteritems
def find_validators(schema, validator_type):
return [validator
for validator in schema.validators
... | akscram/lollipop-jsonschema | lollipop_jsonschema/jsonschema.py | Python | mit | 5,661 |
compl_iupacdict = {'A':'T',
'C':'G',
'G':'C',
'T':'A',
'M':'K',
'R':'Y',
'W':'W',
'S':'S',
'Y':'R',
'K':'M',
'V':'B',
... | xguse/spartan | src/spartan/utils/seqs.py | Python | mit | 1,664 |
import lief
import sys
import os
import traceback
import configparser
import struct
from collections import OrderedDict
# Opcodes
X86_PUSH_BYTE = 0x6a
X86_32_PUSH_DWORD = 0x68
x86_32_CALL = [0xff, 0x15]
X86_64_CALL = [0xff, 0xd0]
X86_64_MOV_R9 = [0x49, 0xb9]
X86_64_MOV_R8 = [0x49, 0xb8]
X86_6... | ner0x652/RElief | dololi/dololi.py | Python | mit | 6,472 |
import argparse
import sys
import pytest
from pyscaffold import extensions
from pyscaffold.exceptions import ErrorLoadingExtension
from .extensions import __name__ as test_extensions_pkg
from .extensions.helpers import make_extension
if sys.version_info[:2] >= (3, 8):
# TODO: Import directly (no need for condit... | blue-yonder/pyscaffold | tests/test_extensions.py | Python | mit | 3,932 |
#inherits from standard local settings
from bukkakegram.settings import *
import dj_database_url
DATABASES['default'] = dj_database_url.config()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = ['.herokuapp.com', '*',]
DEBUG = config('DEBUG', cast=bool)
STATICFILES_STORAGE = 'whitenoi... | delitamakanda/BukkakeGram | bukkakegram/settings_production.py | Python | mit | 1,341 |
#! /usr/bin/python3
# -*- coding:utf-8 -*-
# lagos
# by antoine@2ohm.fr
"""
Play a little with imap.
"""
import imaplib
import smtplib
from lib.remail import remail
from lib.redoc import redoc
import yaml
import sys
import os
import logging
# Config the log machine
logging.basicConfig(
format='\033[90m[%(lev... | a2ohm/lagos | lagos.py | Python | mit | 2,116 |
#!/usr/bin/env python
from exceptions import KeyError
import os
import requests
class GoogleDoc(object):
"""
A class for accessing a Google document as an object.
Includes the bits necessary for accessing the document and auth and such.
For example:
doc = {
"key": "123456abcdef",... | nprapps/visits | etc/gdocs.py | Python | mit | 3,436 |
#!/usr/bin/env python
# coding: utf-8
"""阻塞和非阻塞的 HTTP 客户端接口.
这个模块定义了一个被两种实现方式 ``simple_httpclient`` 和
``curl_httpclient`` 共享的通用接口 . 应用程序可以选择直接实例化相对应的实现类,
或使用本模块提供的 `AsyncHTTPClient` 类, 通过复写
`AsyncHTTPClient.configure` 方法来选择一种实现 .
默认的实现是 ``simple_httpclient``, 这可以能满足大多数用户的需要 . 然而, 一
些应用程序可能会因为以下原因想切换到 ``curl_httpclie... | tao12345666333/tornado-zh | tornado/httpclient.py | Python | mit | 25,743 |
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
return [int(i) for i in str(int(''.join(map(str, digits)))+1)]
Solution().plusOne([0]) | xingjian-f/Leetcode-solution | 66. Plus One.py | Python | mit | 232 |
#!/usr/bin/env python3
# coding: utf-8
#
import re
import os
import time
import argparse
import yaml
import bunch
import uiautomator2 as u2
from logzero import logger
CLICK = "click"
# swipe
SWIPE_UP = "swipe_up"
SWIPE_RIGHT = "swipe_right"
SWIPE_LEFT = "swipe_left"
SWIPE_DOWN = "swipe_down"
SCREENSHOT = "screensh... | openatx/uiautomator2 | examples/runyaml/run.py | Python | mit | 3,918 |
from __future__ import unicode_literals
__author__ = ", ".join(["Shyue Ping Ong", "Anubhav Jain", "Geoffroy Hautier",
"William Davidson Richard", "Stephen Dacek",
"Sai Jayaraman", "Michael Kocher", "Dan Gunter",
"Shreyas Cholia", "Vincent L Chevri... | yanikou19/pymatgen | pymatgen/__init__.py | Python | mit | 775 |
#===========================================================================================================================
# aims : define both 3 hidden layers model and 4 hidden layers model
#
# input : x : placeholder variable which has as column number the number of features of the training matrix con... | allspeak/api.allspeak.eu | web/project/training_api/libs/models.py | Python | mit | 10,685 |
# -*- coding: utf-8 -*-
"""
pytest-pylint
=============
Plugin for py.test for doing pylint tests
"""
from setuptools import setup
setup(
name='pytest-pylint',
description='pytest plugin to check source code with pylint',
long_description=open("README.rst").read(),
license="MIT",
version='0.3.0',... | rutsky/pytest-pylint | setup.py | Python | mit | 906 |
import logging
from pdfminer.psparser import KWD, LIT, PSBaseParser, PSStackParser, PSEOF
logger = logging.getLogger(__name__)
class TestPSBaseParser:
"""Simplistic Test cases"""
TESTDATA = rb"""%!PS
begin end
" @ #
/a/BCD /Some_Name /foo#5f#xbaa
0 +1 -2 .5 1.234
(abc) () (abc ( def ) ghi)
(def\040\0\040... | pdfminer/pdfminer.six | tests/test_pdfminer_psparser.py | Python | mit | 3,405 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-05-08 17:49
from __future__ import unicode_literals
from django.db import migrations
from django.core import management
from django.contrib.sessions.models import Session
from django.utils.timezone import now
def expire_all_sessions(apps, schema_editor):
... | WikipediaLibrary/TWLight | TWLight/users/migrations/0057_expire_all_sessions.py | Python | mit | 818 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tdjango.tests.testapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| calston/tdjango | manage_test.py | Python | mit | 264 |
#!/usr/bin/env python
PACKAGE_NAME = 'shiba_teleop'
import roslib
roslib.load_manifest(PACKAGE_NAME)
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy
import rospkg
FORWARD = 1
BACKWARDS = 2
SPINNING = 3
STOPPED = 4
linear_increment = 0.3
max_linear_vel = 1.0
min_linear_vel = -1.0
de... | Laika-ETS/shiba | shiba_ws/src/shiba_teleop/script/teleop.py | Python | mit | 533 |
# CodeIgniter
# http://codeigniter.com
#
# An open source application development framework for PHP
#
# This content is released under the MIT License (MIT)
#
# Copyright (c) 2014 - 2015, British Columbia Institute of Technology
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of thi... | ajose1024/Code_Igniter_Extended | user_guide_src/cilexer/cilexer/cilexer.py | Python | mit | 2,222 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "juisapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| snirp/juis | manage.py | Python | mit | 250 |
#!/bin/python
'''
Library for formulating and solving game trees as linear programs.
'''
class Node(object):
'''Abstract class to represent a node in the game tree.'''
def solve(self):
'''
Should populate the solutions dictionary.
solutions: TerminalNode ==> list of lists of inequali... | jdhenke/ally | core.py | Python | mit | 4,087 |
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
import threading
import os
import time
spoolgore_local = threading.local()
class EmailBackend(BaseEmailBackend):
__tmp__ = "%s/tmp" % settings.SPOOLGORE_DIRECTORY
def send_messages(self, email_messages):
pid... | 20tab/django-spoolgore | spoolgore/backend.py | Python | mit | 1,588 |
# hackerrank - Algorithms: Time Conversion
# Written by James Andreou, University of Waterloo
S = raw_input()
TYPE = S[len(S)-2]
if S[:2] == "12":
if TYPE == "A":
print "00" + S[2:-2]
else:
print S[:-2]
elif TYPE == "P":
HOUR = int(S[:2]) + 12
print str(HOUR) + S[2:-2]
else:
print S[:-2] | jamesandreou/hackerrank-solutions | warmup/hr_time_conversion.py | Python | mit | 298 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
kw = {
'name': 'draw',
'version': '0.0.1',
'description': 'A drawing tool for IPython',
'long_description': "",
'author': 'Naoki Nishida',
'author_email': 'domitry@gmail.com',
'license': 'MIT Lice... | domitry/draw | setup.py | Python | mit | 601 |
import os
import runpy
from codecs import open
from setuptools import setup, find_packages
# Based on https://github.com/pypa/sampleproject/blob/master/setup.py
# and https://python-packaging-user-guide.readthedocs.org/
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst'), en... | xaxa89/mitmproxy | setup.py | Python | mit | 4,202 |
# Helper functions for the Maine Legislature project
import app_config
import collections
import copytext
import re
import json
import numbers
from unicodedata import normalize
from operator import itemgetter
CACHE = {}
def get_copy():
"""
Thank you Ryan for this neat trick to avoid thrashing the disk
ht... | benlk/harvey-senior-homes | helpers.py | Python | mit | 3,147 |
# -*- coding: utf-8 -*-
from exam.exceptions import ModelDoesNotExist, InvalidParameter
def create_specific_exam(name_class):
try:
app_name = name_class.lower()
module = __import__(app_name + '.models', fromlist=[name_class])
class_ = getattr(module, name_class)
instance = class_... | msfernandes/anato-hub | core/dynamic_import.py | Python | mit | 920 |
import simtk.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_bond_type import AbstractBondType
class CubicBondType(AbstractBondType):
__slots__ = ['length', 'C2', 'C3', 'order', 'c']
@accepts_compatible_units(None, None,
len... | ctk3b/InterMol | intermol/forces/cubic_bond_type.py | Python | mit | 1,664 |
# download.py
import urllib.request
print("Downloading")
url = 'https://www.python.org/ftp/python/3.4.1/python-3.4.1.msi'
print('File Downloading')
urllib.request.urlretrieve(url, 'python-3.4.1.msi')
| darkless456/Python | download.py | Python | mit | 208 |
# This file is part of ConfigFile - Parse and edit configuration files.
# Copyright (C) 2011-present Dario Giovannetti <dev@dariogiovannetti.net>
# Licensed under MIT
# https://github.com/kynikos/lib.py.configfile/blob/master/LICENSE
"""
This library provides the :py:class:`ConfigFile` class, whose goal is to
provide... | kynikos/lib.py.configfile | configfile/__init__.py | Python | mit | 60,029 |
'''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | fsxfreak/esys-pbi | src/pupil/pupil_src/player/vis_eye_video_overlay.py | Python | mit | 12,941 |
#!/usr/bin/env python
import os,sys
import string
import re
import pickle
stopword_file = './stopwords'
class CleanTweet(object):
"""
case-sensitive, removed url, hashtag#, special term like 'RT', and reply@
"""
_url = r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F])... | luozhaoyu/big-data-system | assignment3/partB/parsetweet.py | Python | mit | 2,168 |
import _plotly_utils.basevalidators
class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="sizesrc", parent_name="surface.hoverlabel.font", **kwargs
):
super(SizesrcValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/surface/hoverlabel/font/_sizesrc.py | Python | mit | 423 |
Flask==0.10.1
Jinja2==2.7.2
MarkupSafe==0.18
Werkzeug==0.9.4
distribute==0.6.31
itsdangerous==0.23
lxml==3.3.1
pygal==1.3.1
wsgiref==0.1.2
| birknilson/oyster | examples/piechart/requirements.py | Python | mit | 139 |
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from apps.employees import ajax
from . import views
urlpatterns = (
url(r'^home/$', login_required(views.home), name="employee_home_redirect"),
url(r'^(?P<pk>[\d]+)/$', login_required(views.EmployeeDetail.as_view()), na... | lmann4/cis526-final-project | resource_management/apps/employees/urls.py | Python | mit | 807 |
from math import *
from Vertex import *
#Length of the three subparts of the robot leg
L1 = 51.0
L2 = 63.7
L3 = 93.0
Alpha = 20.69 #Mecanic constraint on Theta 2
Beta = 5.06 #Mecanic constraint on Theta 3
# Check if the given float match with radian (between 2PI and -2PI)
def radValidation (radian):
return (radian... | Foxnox/robotique-delpeyroux-monseigne | src/direct_kinematics.py | Python | mit | 1,409 |
class cube():
CUBE_STATUS = "Off"
PATTERN = "Hello"
def __init__(self):
pass
@staticmethod
def status():
"""
Return dictionary of details about the cube
:return: Dictionary
"""
return {
'pattern': cube.PATTERN,
'status': cube... | kamodev/8x8x8_RPi_Zero_LED_Cube | rpi_zero_ledcube/cube.py | Python | mit | 343 |
import serial
import struct
import time
# j = 2 means open, j = 1 means close shutter
def command_shutter(port, j):
# first, start the serial port to communicate with the arduino
if port.isOpen():
print "port open"
port.write(struct.pack('>B', j))
return 1
else:
return 0
... | srkiyengar/NewGripper | src/shutter.py | Python | mit | 509 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from sqlalchemy import DDL, text
SQL_FUNCTION_NATSORT = '''
... | mic4ael/indico | indico/core/db/sqlalchemy/custom/natsort.py | Python | mit | 1,070 |
import os
import cPickle
import gzip
from collections import namedtuple
import numpy as np
import matplotlib
matplotlib.rcParams.update({'axes.labelsize': 9,
'xtick.labelsize' : 9,
'ytick.labelsize' : 9,
'axes.titlesize' : 11})
import... | slinderman/pyhsmm_spiketrains | experiments/make_figure7.py | Python | mit | 3,751 |
from dolfin import *
import ipdb
# Print log messages only from the root process in parallel
parameters["std_out_all_processes"] = False;
# Load mesh from file
mesh = Mesh()
domain_vertices = [Point(1.0, -1.0),
Point(6.0, -1.0),
Point(6.0, 1.0),
Point(1.0, 1.0)... | wathen/PhD | MHD/FEniCS/mesh/test.py | Python | mit | 5,783 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import sys
import cPickle
import traceback
import types
import os
import logging
from storage import S... | SEA000/uw-empathica | empathica/gluon/restricted.py | Python | mit | 9,911 |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import pickle
# Read in an image
image = mpimg.imread('signs_vehicles_xygrad.png')
# Define a function that applies Sobel x and y,
# then computes the direction of the gradient
# and applies a threshold.
def dir_threshol... | swirlingsand/self-driving-car-nanodegree-nd013 | play/advanced_lane_finding-direction_of_the_gradient_exercise.py | Python | mit | 1,656 |
import MySQLdb
import urllib2, urllib, re, sys
import xml
from datetime import datetime
## gets woeid from query -helper function
def getwoeid(searchstring):
try:
import xml.etree.ElementTree as ET
namespaces = {'yweather': 'http://www.yahooapis.com/v1/base.rng'} # add more as needed
#get records
proxy = urll... | rishirdua/eep702-software-laboratory | 03_ubuntu-weather-app/code/woeidfromquery.py | Python | mit | 1,278 |
import asyncio
import random
import names
from chilero.web.test import asynctest
from chilero.pg import Resource
from chilero.pg.test import TestCase, TEST_DB_SUFFIX
import json
class Friends(Resource):
order_by = 'name ASC'
search_fields = ['name']
allowed_fields = ['name', 'meta']
required_fields ... | dmonroy/chilero.pg | tests/test_sample_app.py | Python | mit | 8,628 |
# $description: Split into layer cells
# $autorun
# $show-in-menu
import pya
import sys
sys.stderr = sys.stdout
class MenuAction(pya.Action):
def __init__(self, title, shortcut, action):
self.title = title
self.shortcut = shortcut
self.action = action
def triggered(self):
... | calebjordan/klayout-macros | pymacros/Make Layer Cells.py | Python | mit | 2,057 |
import numpy as np
import pandas as pd
import tensorflow as tf
import scipy.misc
from keras.utils import plot_model
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Model, Sequential
from keras.layers import Input, Dropout, Activation, LSTM, Conv2D, Conv2DTranspose, Dense, TimeDistribu... | ultra-lstm/RNA-GAN | Refinement/predict.py | Python | mit | 7,897 |
import RPi.GPIO as GPIO
import time
import utils
import therm
GPIO.setmode(GPIO.BOARD)
#pwr = utils.PSU(13, 15)
#pwr.on()
#pwr.off()
adresses = therm.get_adr()
samples = 5
therms = []
now = time.time()
t_amb = therm.Therm('28-000004e08693')
t_c_b = therm.Therm('28-000004e0f7cc')
t_c_m = therm.Therm('28-000004e0840a... | Wollert/beer | test_therm.py | Python | mit | 709 |
#encoding:utf-8
from user import app
if __name__ == '__main__':
app.run(host='0.0.0.0',port=9002,debug=True) | 51reboot/actual_09_homework | 09/liubaobao/cmdb_V4/manage.py | Python | mit | 121 |
"""Configure heppyplotlib or the underlying matplotlib."""
import matplotlib.pyplot as plt
def use_tex(use_serif=True, overwrite=True, preamble=None):
"""Configure pyplot to use LaTeX for text rendering."""
if plt.rcParams['text.usetex'] and not overwrite:
print("Will not override tex settings ...")
... | ebothmann/heppyplotlib | heppyplotlib/configuration.py | Python | mit | 2,563 |
import keras
import keras.layers
import keras.models
def concatenate(x):
if hasattr(keras.layers, 'Concatenate'):
return keras.layers.Concatenate()(x)
else:
return keras.layers.merge(x, mode='concat')
def add(x):
if hasattr(keras.layers, 'Add'):
return keras.layers.Add()(x)
e... | sahabi/opt | rl/keras_future.py | Python | mit | 618 |
class ShirtsioError(Exception):
def __init__(self, message=None, http_body=None, http_status=None, json_body=None):
super(ShirtsioError, self).__init__(message)
self.http_body = http_body and http_body.decode('utf-8')
self.http_status = http_status
self.json_body = json_body
class ... | harpesichord/Door-Access | door/exception.py | Python | mit | 679 |
import chaospy
import numpy
import pytest
@pytest.fixture
def samples(joint):
return joint.sample(10, rule="sobol")
@pytest.fixture
def evaluations(model_solver, samples):
return numpy.array([model_solver(sample) for sample in samples.T])
@pytest.fixture
def expansion(samples):
return chaospy.lagrange... | jonathf/chaospy | tests/test_lagrange_polynomials.py | Python | mit | 800 |
import nose
from os import path
file_path = path.abspath(__file__)
tests_path = path.join(path.abspath(path.dirname(file_path)), "tests")
nose.main(argv=[path.abspath(__file__), "--with-coverage", "--cover-erase", "--cover-package=frapalyzer", tests_path])
| rbnvrw/FRAPalyzer | test.py | Python | mit | 258 |
from jira_extended import JIRA
jira = JIRA(
'<url>',
basic_auth=(
'<user>',
'<password>',
),
options={
'extended_url': '<url>',
}
)
jira.search_issues('project = "PROJECT1"')[0].move('PROJECT2')
| gillarkod/jira_extended | example.py | Python | mit | 240 |
from flask import Blueprint
import flask_restx
from flask_restx import Resource
from flask import request
# import subprocess
# from os import path
# from flask import redirect
from sanskrit_parser.base.sanskrit_base import SanskritObject, SLP1
from sanskrit_parser.parser.sandhi_analyzer import LexicalSandhiAnalyzer
f... | kmadathil/sanskrit_parser | sanskrit_parser/rest_api/api_v1.py | Python | mit | 4,459 |
# -*- coding: utf-8 -*-
#
# pymfe documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 11 12:35:11 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | mikeireland/pymfe | doc/conf.py | Python | mit | 9,303 |
# -*- coding: utf-8 -*-
"""
flask_security.forms
~~~~~~~~~~~~~~~~~~~~
Flask-Security forms module
:copyright: (c) 2012 by Matt Wright.
:copyright: (c) 2017 by CERN.
:license: MIT, see LICENSE for more details.
"""
import inspect
from flask import Markup, current_app, flash, request
from flas... | themylogin/flask-security | flask_security/forms.py | Python | mit | 9,925 |
#!/usr/bin/env python
# http://stackoverflow.com/questions/517923/what-is-the-best-way-to-remove-accents-in-a-python-unicode-string
import re
import unicodedata
def strip_accents(text):
"""
Strip accents from input String.
:param text: The input string.
:type text: String.
:returns: The proces... | oh6hay/refworks-bibtex-postprocess | textutil.py | Python | mit | 943 |
import struct
OK, EFORMAT, ESERVER, ENAME, ENOTIMP, EREFUSED = range(6)
IXFR, AXFR, MAILB, MAILA, ALL_RECORDS = range(251, 256)
IN, CS, CH, HS = range(1, 5)
from io import BytesIO
class Message:
"""
L{Message} contains all the information represented by a single
DNS request or response.
@ivar id: Se... | MathYourLife/TSatPy-thesis | sandbox/dns_string_io.py | Python | mit | 10,430 |
"""Functions for TML layout that are used in the grammar to construct DOM-like
node objects used in the 164 layout engine.
"""
def createNode(name, attributes=None, children=None):
"""Creates a DOM-like node object, using the 164 representation so that
the node can be processed by the 164 layout engine.
"... | michelle/sink | 164/tml.py | Python | mit | 733 |
import urllib.parse
from upol_search_engine.upol_crawler.tools import blacklist, robots
def validate_regex(url, regex):
"""Check if url is validate with regex"""
return regex.match(url)
def validate_anchor(url):
"""Check if url include anchor"""
cheme, netloc, path, qs, anchor = urllib.parse.urlspl... | UPOLSearch/UPOL-Search-Engine | upol_search_engine/upol_crawler/core/validator.py | Python | mit | 1,618 |
from __future__ import with_statement
import unittest
import re
import os
import sys
import cStringIO as StringIO
from distutils.version import LooseVersion
import pep8
PEP8_VERSION = LooseVersion(pep8.__version__)
PEP8_MAX_OLD_VERSION = LooseVersion('1.0.1')
PEP8_MIN_NEW_VERSION = LooseVersion('1.3.3')
# Check for ... | njharman/cuprum | tests/test_pep8.py | Python | mit | 3,761 |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^$', views.BlogListView.as_view(), name="blog_list"),
url(r'^(?P<slug>[\w-]+)/$', views.BlogSingleView.as_view(), name="blog_single"),
url(r'^category/(?P<slug>[\w-]+)/$', views.BlogCategoryView.as_view(), name="blog_categ... | ethdeveloper/ethdeveloper | blog/urls.py | Python | mit | 329 |
# encoding: utf-8
# ## Imports
from threading import local as __local
# Expose these as importable from the top-level `web.core` namespace.
from .application import Application
from .util import lazy
# ## Module Globals
__all__ = ['local', 'Application', 'lazy'] # Symbols exported by this package.
# This is to... | marrow/WebCore | web/core/__init__.py | Python | mit | 424 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the MineCoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
in... | CoinProjects/MineCoin | share/qt/clean_mac_info_plist.py | Python | mit | 897 |
# -*- coding: utf-8 -*-
# urls.py ---
#
# Created: Wed Dec 14 23:02:53 2011 (+0200)
# Author: Janne Kuuskeri
#
from django.conf.urls.defaults import patterns, url
import resources
dictresource = resources.MyDictResource()
textresource = resources.MyTextResource()
respresource = resources.MyRespResource()
authresou... | wuher/devil | test/deviltest/simple/urls.py | Python | mit | 1,935 |
from django.apps import apps
from rest_framework.serializers import SlugRelatedField, ModelSerializer, ValidationError
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from rest_polymorphic.serializers import PolymorphicSerializer
from taxonomy.models import Community, Taxon
from occurrence.models ... | parksandwildlife/wastd | occurrence/serializers.py | Python | mit | 14,367 |
#!/usr/bin/python
# filename: basespace.py
#
# Copyright (c) 2015 Bryan Briney
# License: The MIT license (http://opensource.org/licenses/MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software... | briney/abstar | abstar/utils/basespace.py | Python | mit | 11,356 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import curses
import cumodoro.config as config
import cumodoro.interface as interface
import cumodoro.globals as globals
from cumodoro.cursest import Refresher
import logging
log = logging.getLogger('cumodoro')
def set_title(msg):
print("\x1B]0;... | gisodal/cumodoro | cumodoro/main.py | Python | mit | 765 |
import scrapy
from congress.items import Article
class Example(scrapy.Spider):
'''Modeled after scrapy tutorial here:
https://doc.scrapy.org/en/latest/intro/tutorial.html
'''
# spider name should be name of website/source
name = 'example'
def start_requests(self):
# list of URLs or ... | jss367/assemble | congress/congress/spiders/example.py | Python | mit | 1,924 |
default_app_config = 'botManager.apps.BotmanagerConfig'
| stefan2904/activismBot | botManager/__init__.py | Python | mit | 56 |
# -*- encoding: UTF-8 -*-
import struct
from time import localtime
import itertools
import codecs
import gevent
from copy import copy
from copy import deepcopy
import screen
from screen import ForegroundColors, BackgroundColors
from screen import Align
from utility import Dimension
from string import lowercase
retu... | pencilcheck/pttbbs-py | src/pttbbs/screenlets.py | Python | mit | 33,791 |
from Gaudi.Configuration import *
from Configurables import DaVinci
#from Configurables import AlgTool
from Configurables import GaudiSequencer
MySequencer = GaudiSequencer('Sequence')
#For 2012 MC
DaVinci.DDDBtag='dddb-20130929-1'
DaVinci.CondDBtag='sim-20130522-1-vc-md100'
#for 2011 MC
#DaVinci.DDDBtag='dddb-2013092... | Williams224/davinci-scripts | ksteta3pi/NTupleMaker_MagDown.py | Python | mit | 17,928 |
import os
import logging
import pandas as pd
from dataactvalidator.app import createApp
from dataactvalidator.scripts.loaderUtils import LoaderUtils
from dataactcore.interfaces.db import GlobalDB
from dataactcore.models.domainModels import CGAC, ObjectClass, ProgramActivity
from dataactcore.config import CONFIG_BROKE... | chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend | dataactvalidator/scripts/loadFile.py | Python | cc0-1.0 | 4,378 |
import OOMP
newPart = OOMP.oompItem(9019)
newPart.addTag("oompType", "HESH")
newPart.addTag("oompSize", "03")
newPart.addTag("oompColor", "L")
newPart.addTag("oompDesc", "STAN")
newPart.addTag("oompIndex", "01")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_HESH_03_L_STAN_01.py | Python | cc0-1.0 | 241 |
'''Tests for currency.py'''
import unittest
from decimal import Decimal
from mexbtcapi.currency import Currency, ExchangeRate, Amount, CurrencyPair
class CurrencytTest(unittest.TestCase):
def test_create(self):
c1 = Currency("c1")
self.assertIsInstance(c1, Currency)
def test_equality(self):
... | goncalopp/mexbtcapi | mexbtcapi/test/test_currency.py | Python | cc0-1.0 | 7,419 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.