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/env python
import os
from slackclient import SlackClient
BOT_NAME = 'chopbot3000'
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
if __name__ == "__main__":
api_call = slack_client.api_call("users.list")
if api_call.get('ok'):
# retrieve all users so we can find our bot
... | baylesj/chopBot3000 | scripts/print_bot_id.py | Python | mit | 604 |
import re
import os
import itertools
import time
from string import upper
import ete3
import copy
import subprocess
from collections import defaultdict
from sys import platform
from scipy import stats
from ete3 import Tree
from natsort import natsorted
from Bio import AlignIO
"""
Functions:
~
Chabrielle Allen
Travis... | chilleo/ALPHA | CommandLineFiles/RunDGEN.py | Python | mit | 100,444 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Configuration for Invenio-Formatter."""
from __future__ import absolute_import, p... | tiborsimko/invenio-formatter | invenio_formatter/config.py | Python | mit | 479 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
test_data = [
{
"Transaction" : {
"transaction_date" : "2015-01-08",
"amount" : -1286.75,
"security_amount" : 4.0726,
"security_rate" : 413.68
},
"Account" : ... | nilsFK/py-privatekonomi | py_privatekonomi/tests/dataset/avanza/sample1.py | Python | mit | 6,015 |
import logging
from marshmallow import ValidationError, post_load
from marshmallow_jsonapi import Schema, fields
from timeswitch.auth.dao import User
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHandler(NullHandler())
LOGGER = logging.getLogger(__name_... | weichweich/Pi-Timeswitch | Flask-Server/timeswitch/auth/schema.py | Python | mit | 1,110 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from random import shuffle
class Carta():
def __init__(self, numero, naipe):
self.numero = numero
self.naipe = naipe
def __repr__(self):
return '%s de %s' % (self.numero, self.naipe)
class Baralho():
... | renzon/fatec-script | backend/appengine/pythonicos.py | Python | mit | 1,283 |
__all__ = ("settings", "urls", "wsgi")
__version__ = "0.159.0"
| lopopolo/hyperbola | hyperbola/__init__.py | Python | mit | 63 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from os import path
current_dir = path.dirname(__file__)
sys.path.insert(0, path.join(path.dirname(current_dir), 'wdom'))
| miyakogi/livemark | livemark/__init__.py | Python | mit | 182 |
import sys
import time
from pprint import pprint
import telepot
from telepot.namedtuple import StickerSet
TOKEN = sys.argv[1]
USER_ID = long(sys.argv[2])
STICKER_SET = sys.argv[3]
bot = telepot.Bot(TOKEN)
f = bot.uploadStickerFile(USER_ID, open('gandhi.png', 'rb'))
print 'Uploaded Gandhi'
bot.addStickerToSet(USER_I... | nickoala/telepot | test/test27_sticker.py | Python | mit | 727 |
from __future__ import unicode_literals
import unittest
from ship.datastructures import rowdatacollection as rdc
from ship.datastructures import dataobject as do
from ship.fmp.datunits import ROW_DATA_TYPES as rdt
class RowDataCollectionTests(unittest.TestCase):
def setUp(self):
# Create some object t... | duncan-r/SHIP | tests/test_rowdatacollection.py | Python | mit | 10,219 |
"""
Django settings for busquecursos project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... | ProfessionalIT/products | busquecursos/busquecursos/busquecursos/settings.py | Python | mit | 2,076 |
# -*- coding: utf-8 -*-
class PortalMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
# Code to be executed for each request before
# the view (and later middleware) are called.
response = self.get_response(request)
# Code to be executed for each... | WST/django-project-template | portal/middleware.py | Python | mit | 388 |
from snovault import upgrade_step
@upgrade_step('gene', '1', '2')
def gene_1_2(value, system):
# https://encodedcc.atlassian.net/browse/ENCD-5005
# go_annotations are replaced by a link on UI to GO
value.pop('go_annotations', None)
@upgrade_step('gene', '2', '3')
def gene_2_3(value, system):
# https:... | ENCODE-DCC/encoded | src/encoded/upgrade/gene.py | Python | mit | 437 |
#!/usr/bin/env python
import numpy as np
import os,sys
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
import argparse
ap=argparse.ArgumentParser()
ap.add_argument('-vis') # 1 plot cropped point cloud
ap.add_argument('-refine') # 1 refine mesh
ap.add_argument('-clean') # 1 remove tmp... | Chunfang/defmod-swpc | example/F3Dp/F3D_syn.py | Python | mit | 4,626 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
"""oclubs filters."""
from __future__ import absolute_import
from oclubs.filters.resfilter import ResFilter, ResFilterConverter
from oclubs.filters.clubfilter import ClubFilter, ClubFilterConverter
from oclubs.filters.roomfilter import RoomFilter, RoomFilterConverter
... | SHSIDers/oclubs | oclubs/filters/__init__.py | Python | mit | 462 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-28 18:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('benchmark', '0008_benchmarkdefinition_commit_keyword_updated'),
]
operations = [
... | imvu/bluesteel | app/logic/benchmark/migrations/0009_auto_20160828_1131.py | Python | mit | 586 |
"""Creates beautiful visualizations of the publication database."""
import datetime
import sqlite3 as sql
import numpy as np
from astropy import log
from matplotlib import pyplot as plt
import matplotlib.patheffects as path_effects
import matplotlib as mpl
from matplotlib import style
import seaborn as sns
from kpub... | barentsen/exoplanet-charts | publication-stats/publications-per-year-k2.py | Python | mit | 3,121 |
# -*- coding: utf-8 -*-
#
# BayesPy documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 27 12:22:11 2012.
#
# 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... | jluttine/bayespy | doc/source/conf.py | Python | mit | 11,116 |
import logging
from office365.sharepoint.helpers.utils import to_camel
logger = logging.getLogger(__name__)
class QueryStringBuilder:
"""class to map web-querystring dictionary to sharepoint-querystring"""
date_operators = ['ge', 'gt', 'le', 'lt']
mapping_operator = {
'gte': 'ge',
'gt': ... | vgrem/SharePointOnline-REST-Python-Client | office365/sharepoint/helpers/querystring_builder.py | Python | mit | 1,822 |
import unittest
import json
import time
from celery import current_app
from django.conf import settings
from django.utils import timezone
from ep.models import DPMeasurements, DeviceParameter
from ep.tasks import send_msg
from django.test import TestCase, modify_settings, override_settings
from ep.tests.static_fac... | dschien/energy-aggregator | ep/tests/test_docker.py | Python | mit | 1,639 |
from django.http import Http404, HttpResponse
from django.template.context_processors import csrf
from rest_framework.authentication import TokenAuthentication
from rest_framework.parsers import JSONParser
from rest_framework.permissions import DjangoModelPermissions
from rest_framework.views import APIView
from .model... | sussexstudent/falmer | falmer/frontend/views.py | Python | mit | 1,727 |
#!/usr/bin/env python
#
# Copyright 2008 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# noti... | x684867/nemesis | src/node/tools/test.py | Python | mit | 42,571 |
#!/usr/bin/env python
import getopt
import json
import locale
import os
import re
import sys
from urllib import request, parse
import platform
import threading
from .version import __version__
from .util import log, sogou_proxy_server, get_filename, unescape_html
dry_run = False
force = False
player = None
sogou_pro... | kzganesan/you-get | src/you_get/common.py | Python | mit | 30,127 |
import math
import scipy.optimize as opt
log = math.log
exp = math.exp
small = 1e-20 # unitless
T0 = 1 # K
Tcrit = 650 # K
zero_C = 273.15 # K
p0 = 1 # Pa
atm = 101325 # Pa
bar = 100000 ... | estansifer/mape | src/thermo.py | Python | mit | 10,645 |
# coding:ascii
""" Example usage of DbC (design by contract)
In this example we show you how to use pre- and post-condition checkers
decorating the same function.
"""
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import DbC
DbC.ASSERTION_LEVEL = DbC.ASSERTION_ALL
# in this example we bring `pre` an... | JazzyServices/jazzy | examples/DbC_methods_with_both_pre_and_post.py | Python | mit | 1,944 |
# Generated by Django 2.0.13 on 2019-06-22 18:48
import django.db.models.deletion
import django.utils.timezone
import django_fsm
from django.conf import settings
from django.db import migrations, models
import apps.core.models
class Migration(migrations.Migration):
initial = True
dependencies = [migration... | SoPR/horas | apps/meetings/migrations/0001_initial.py | Python | mit | 2,640 |
from datetime import date
from openpyxl import load_workbook
if __name__ == '__main__':
wb = load_workbook('FixedCouponBond.xlsx')
ws = wb.active
# Take the input parameters
today = ws['C2'].value.date()
# OIS Data
ois_startdate = today
ois_maturities = []
ois_mktquotes = []
for c... | gabberthomson/fm_finpy | fixedcouponbond_project.py | Python | mit | 1,921 |
'''
ÏÂÀý չʾÁËÒ»¸öʵÓÃС¹¤¾ß, Ëü¿ÉÒÔ°Ñ GIF ¸ñʽת»»Îª Python ½Å±¾, ±ãÓÚʹÓà Tkinter ¿â.
'''
import base64, sys
if not sys.argv[1:]:
print "Usage: gif2tk.py giffile >pyfile"
sys.exit(1)
data = open(sys.argv[1], "rb").read()
if data[:4] != "GIF8":
print sys.argv[1], "is not a GIF file"
sys.exit(1... | iamweilee/pylearn | base64-example-4.py | Python | mit | 513 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
########## boafi Pentest script
########## - Perform various pentests automatically and save reports for further study
########## - Features/TODOs: Ipv6,DHCP,DNS,NTP,exploits,mitm..
########## - Router bruteforce for easy guessable passwords
########## - Scan networks hosts and... | fnzv/Boafi | BoafiPenTest.py | Python | mit | 12,450 |
from setuptools import setup
setup(name='PyRankinity',
version='0.1',
description='Rankinity API Wrapper - See http://my.rankinity.com/api.en',
author='UpCounsel',
author_email='brad@upcounsel.com',
url='https://www.github.com/upcounsel/pyrankinity',
packages=['pyrankinity'],
... | upcounsel/PyRankinity | setup.py | Python | mit | 396 |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^external/', include('external.urls')),
url(r'^dev/', include('dev.urls')),
]
| SequencingDOTcom/App-Market-API-integration | python/bootstrap/urls.py | Python | mit | 231 |
from collections import defaultdict
import re
import sys
from stop_words import STOP_WORD_SET
from collections import Counter
PUNCTUATION_RE = re.compile("[%s]" % re.escape(
"""!"&()*+,-\.\/:;<=>?\[\\\]^`\{|\}~]+"""))
DISCARD_RE = re.compile("^('{|`|git@|@|https?:)")
def remove_stop_words(word_seq, stop_words):
... | sprin/heroku-tut | worker/word_count.py | Python | mit | 1,663 |
# Generated by Django 2.0.4 on 2018-04-24 21:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contacts', '0006_auto_20180423_1629'),
]
operations = [
migrations.AddField(
model_name='contact',
name='recruiter',... | RobSpectre/garfield | garfield/contacts/migrations/0007_contact_recruiter.py | Python | mit | 392 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import socket
import traceback
from lineup.datastructures import Queue
class Node(object):
def __init__(self, *args, **kw):
self.initialize(*args, **kw)
def initialize(self, *args, **kw):
pass
... | pombredanne/lineup | lineup/framework.py | Python | mit | 1,964 |
# coding: utf-8
from flask import Blueprint
user = Blueprint('user', __name__)
from . import views
| spark8103/ops17 | app/user/__init__.py | Python | mit | 101 |
import datetime
import os
import shutil
import time
from files_by_date.utils.logging_wrapper import get_logger, log_message
from files_by_date.validators.argument_validator import ArgumentValidator
logger = get_logger(name='files_service')
class FilesService:
def __init__(self):
raise NotImplementedErro... | DEV3L/python-files-by-date | files_by_date/service/files_service.py | Python | mit | 4,825 |
"""
Example taken from http://matplotlib.org/1.5.0/examples/showcase/xkcd.html
"""
import matplotlib.pyplot as plt
import numpy as np
with plt.xkcd():
# Based on "The Data So Far" from XKCD by Randall Monroe
# http://xkcd.com/373/
index = [0, 1]
data = [0, 100]
labels = ['CONFIRMED BY EXPERIMENT'... | apdavison/space-station-transylvania | xkcd.py | Python | mit | 870 |
#!/usr/bin/env python3
# encoding: utf8
# license: ISC (MIT/BSD compatible) https://choosealicense.com/licenses/isc/
# This library is principally created for python 3. However python 2 support may be doable and is welcomed.
"""Use python in a more object oriented, saner and shorter way.
# WARNING
First: A word of w... | dwt/BayesianNetworks | fluent.py | Python | mit | 46,253 |
from collections import OrderedDict as odict
from values import decode_kv_pairs, encode_kv_pairs
from loops import decode_loops, encode_loops
def split_frames(lines):
'''
splits a list of lines into lines that are not part of a frame,
and a list of lines, where each list is part of the same frame.
fr... | craigyk/pystar | frames.py | Python | mit | 1,984 |
#!/usr/bin/env python
from lighthouse import app
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True)
| Nizebulous/lighthouse | run.py | Python | mit | 119 |
""" Python test discovery, setup and run of test functions. """
import re
import fnmatch
import functools
import py
import inspect
import sys
import pytest
from _pytest.mark import MarkDecorator, MarkerError
from py._code.code import TerminalRepr
try:
import enum
except ImportError: # pragma: no cover
# Only ... | codewarrior0/pytest | _pytest/python.py | Python | mit | 84,482 |
"""
This example uses OpenGL via Pyglet and draws
a bunch of rectangles on the screen.
"""
import random
import time
import pyglet.gl as GL
import pyglet
import ctypes
# Set up the constants
SCREEN_WIDTH = 700
SCREEN_HEIGHT = 500
RECT_WIDTH = 50
RECT_HEIGHT = 50
class Shape():
def __init__(self):
self.... | mwreuter/arcade | experimental/a_quick_test5.py | Python | mit | 4,042 |
import mock
from django.test import TestCase
from mediaviewer.views.signout import signout
class TestSignout(TestCase):
def setUp(self):
self.logout_patcher = mock.patch('mediaviewer.views.signout.logout')
self.mock_logout = self.logout_patcher.start()
self.addCleanup(self.logout_patcher... | kyokley/MediaViewer | mediaviewer/tests/views/test_signout.py | Python | mit | 1,454 |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 1 16:10:56 2013
@author: vterzopoulos, abrys
"""
# To ignore numpy errors:
# pylint: disable=E1101
import nibabel
import numpy
from dicom2nifti.image_volume import load, SliceType, ImageVolume
def reorient_image(input_image, output_image):
"""
Change the o... | icometrix/dicom2nifti | dicom2nifti/image_reorientation.py | Python | mit | 6,865 |
# This is a modified version of original twilio_sms Gluu's script to work with Casa
from java.util import Arrays
from javax.faces.application import FacesMessage
from org.gluu.jsf2.message import FacesMessages
from org.gluu.oxauth.security import Identity
from org.gluu.oxauth.service import UserService, Authenticati... | GluuFederation/community-edition-setup | static/casa/scripts/casa-external_twilio_sms.py | Python | mit | 6,740 |
from db_utils import deleteLinksByHost
from db_utils import deleteHost
from db_utils import addNewHost
from db_utils import getAllHosts
from error_message import showErrorPage
from error_message import ErrorMessages
import utils
import webapp2
from google.appengine.api import users
from google.appengine.ext import ndb... | cloud-io/CloudUp | src/admin_views.py | Python | mit | 2,370 |
# Joey Velez-Ginorio
# Gridworld Implementation
# ---------------------------------
from mdp import MDP
from grid import Grid
from scipy.stats import uniform
from scipy.stats import beta
from scipy.stats import expon
import numpy as np
import random
import pyprind
import matplotlib.pyplot as plt
class GridWorld(MDP):... | joeyginorio/Action-Understanding-with-Rational-Rules | model_src/grid_world.py | Python | mit | 9,591 |
from fam.buffer import buffered_db
cache = buffered_db
| paulharter/fam | src/fam/database/caching.py | Python | mit | 56 |
"""
Created on Thu May 05 20:02:00 2011
@author: Tillsten
"""
import numpy as np
from scipy.linalg import qr
eps = np.finfo(float).eps
def mls(B, v, umin, umax, Wv=None, Wu=None, ud=None, u=None, W=None, imax=100):
"""
mls - Control allocation using minimal least squares.
[u,W,iter] = mls_alloc(... | treverhines/ModEst | modest/pymls/init.py | Python | mit | 7,780 |
from __future__ import annotations
import contextlib
import os.path
import shutil
import sys
import pytest
from pre_commit import parse_shebang
from pre_commit.envcontext import envcontext
from pre_commit.envcontext import Var
from pre_commit.util import make_executable
def _echo_exe() -> str:
exe = shutil.whi... | pre-commit/pre-commit | tests/parse_shebang_test.py | Python | mit | 4,687 |
# -*- coding: utf-8 -*-
r"""
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
# //// / // : : --- (,------. \ .'_ (`-')----. ,... | edonyM/toolkitem | fileprocess/mergefile/filebuf.py | Python | mit | 5,258 |
from django.db.models import fields, ForeignKey, ManyToOneRel, OneToOneRel
from .obj_types import clss
from .search_schema import schema as search_schema
def build_search_filters(cls):
"""Return list of dicts of options for a QueryBuilder filter.
See https://querybuilder.js.org/#filters for details.
""... | ebmdatalab/openprescribing | openprescribing/dmd/build_search_filters.py | Python | mit | 3,765 |
# -*- coding: utf-8 -*-
"""VGG16 model for Keras.
# Reference
- [Very Deep Convolutional Networks for Large-Scale Image Recognition](https://arxiv.org/abs/1409.1556)
"""
from __future__ import print_function
from __future__ import absolute_import
import warnings
from keras.models import Model
from keras.layers imp... | cosmos342/VisionClassifier | vgg16.py | Python | mit | 8,410 |
#open a gsd file and write out a subsampled version, keeping only every N timesteps
#useful if you want to be analyzing a shorter trajectory
import gsd.hoomd
import argparse
import time
start = time.time()
parser = argparse.ArgumentParser(description='Subsamble GSD trajectory')
parser.add_argument('fname',metavar='inpu... | ramansbach/cluster_analysis | clustering/scripts/gsdSubsample.py | Python | mit | 959 |
#!/usr/bin/env python
"""
othello.py Humberto Henrique Campos Pinheiro
Game initialization and main loop
"""
import pygame
import ui
import player
import board
from config import BLACK, WHITE, HUMAN
import log
logger = log.setup_custom_logger('root')
# py2exe workaround
# import sys
# import os
# sys.stdout = open(... | humbhenri/pyOthello | othello.py | Python | mit | 2,473 |
"""
Usage:
run.py mlp --train=<train> --test=<test> --config=<config>
run.py som --train=<train> --test=<test> --config=<config>
Options:
--train Path to training data, txt file.
--test Path to test data, txt file.
--config Json configuration for the network.
"""
from redes_neurais.resources.mana... | senechal/ssc0570-Redes-Neurais | run.py | Python | mit | 708 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import string
import random
# Simple recursive descent parser for dice rolls, e.g. '3d6+1d8+4'.
#
# roll := die {('+' | '-') die} ('+' | '-') modifier
# di... | jcarreiro/jmc-python | imp/dice.py | Python | mit | 1,405 |
from __future__ import absolute_import, unicode_literals
from copy import copy
import json
from peewee import Model, CharField, ForeignKeyField, IntegerField
from utils.modules import BaseModule, modules
from utils.modules.api import api as pmb_api
from utils import db
class Action(Model):
class Meta:
... | Gagaro/PimpMyBot | pimpmybot/utils/commands.py | Python | mit | 1,789 |
import _plotly_utils.basevalidators
class SourceattributionValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="sourceattribution",
parent_name="layout.mapbox.layer",
**kwargs
):
super(SourceattributionValidator, self).__init__(
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/mapbox/layer/_sourceattribution.py | Python | mit | 521 |
#! /usr/bin/python
f = open("birds.txt", "r")
data = f.read()
f.close()
lines = data.split("\n")
print("Wrong: The number of lines is", len(lines))
for l in lines:
if not l:
# Can also do this: if len(l) == 0
lines.remove(l)
print("Right: The number of lines is", len(lines))
| shantnu/PyEng | WordCount/count_lines_fixed.py | Python | mit | 299 |
from boto.ses import SESConnection
import os
def sendmail(name, comment):
source = "patte.wilhelm@googlemail.com"
subject = "Kommentar eingegangen"
body = 'Es wurde ein neues Wetter bewertet. Von: ' + name + ': ' + comment
to_addresses = ["patte.wilhelm@googlemail.com"]
connection = SESConnection(... | PatteWi/pythonwetter | executables/mailsend.py | Python | mit | 513 |
import os
import os.path
import sys
import pygame
from buffalo import utils
from buffalo.scene import Scene
from buffalo.label import Label
from buffalo.button import Button
from buffalo.input import Input
from buffalo.tray import Tray
from camera import Camera
from mapManager import MapManager
from pluginManager im... | benjamincongdon/adept | editMapTestScene.py | Python | mit | 5,875 |
"""Contains the drivers and interface code for pinball machines which use the Multimorphic R-ROC hardware controllers.
This code can be used with P-ROC driver boards, or with Stern SAM, Stern
Whitestar, Williams WPC, or Williams WPC95 driver boards.
Much of this code is from the P-ROC drivers section of the pyprocgam... | missionpinball/mpf | mpf/platforms/p_roc.py | Python | mit | 22,477 |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
"""
Builder for Atmel AVR series of microcontrollers
"""
from os.path import join
from time import sleep
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, SConscript)
from ... | bkudria/platformio | platformio/builder/scripts/atmelavr.py | Python | mit | 3,837 |
"""
## NumPy UltraQuick Tutorial
[source](https://colab.research.google.com/github/google/eng-edu/blob/main/ml/cc/exercises/numpy_ultraquick_tutorial.ipynb?utm_source=mlcc)
> create/manipulate vectors and matrices
"""
## import module as
import numpy as np
## populate array with specific numbers
### 'np.array' to... | abhishekkr/tutorials_as_code | talks-articles/machine-learning/google-courses/prework--numpy-ultraquick-tutorial.py | Python | mit | 2,051 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
... | ivngithub/testproject | config.py | Python | mit | 1,559 |
"""TailorDev Biblio
Bibliography management with Django.
"""
__version__ = "2.0.0"
default_app_config = "td_biblio.apps.TDBiblioConfig"
| TailorDev/django-tailordev-biblio | td_biblio/__init__.py | Python | mit | 139 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='SkipRequest',
fields=[
('id', models.AutoField(... | katajakasa/utuputki | Utuputki/manager/migrations/0001_initial.py | Python | mit | 1,910 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-04 18:58
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 = [
('snippets', '0006_snippet_la... | vitorfs/cmdbox | cmdbox/snippets/migrations/0007_auto_20160404_1858.py | Python | mit | 1,372 |
import itertools, logging
from gibbs.models import CommonName, Compound, Enzyme
from haystack.query import SearchQuerySet
class Error(Exception):
pass
class IllegalQueryError(Error):
pass
class Match(object):
"""An object containing a string match and it's score."""
def __init__(self, key, va... | flamholz/equilibrator | matching/matcher.py | Python | mit | 7,321 |
# -*- coding: utf-8 -*-
from sys import version_info
import copy
import types
try:
from collections import OrderedDict
except ImportError: # pragma: nocover
# Django < 1.5 fallback
from django.utils.datastructures import SortedDict as OrderedDict # noqa
# There is a bug with deepcopy in 2.6, patch if w... | rjusher/djsqla-query-operations | djsqla_query_operations/compat.py | Python | mit | 590 |
import os, sys, re
import ConfigParser
import optparse
import shutil
import subprocess
import difflib
import collections
#import numpy as np
# Alberto Meseguer file; 18/11/2016
# Modified by Quim Aguirre; 13/03/2017
# This file is the master coordinator of the DIANA project. It is used to run multiple DIANA commands... | quimaguirre/diana | scripts/old_scripts/run_experiment_cluster.py | Python | mit | 5,102 |
from __future__ import print_function
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence, pad_packed_sequence
#from torchtext import vocab
class Vocabulary(object):... | douwekiela/nncg-negation | acl17/models.py | Python | mit | 13,191 |
import mongoengine as db
class User(db.Document):
user_id = db.StringField(required=True, unique=True)
created = db.DateTimeField(required=True)
last_login = db.DateTimeField()
nino = db.StringField()
linked_ids = db.ListField(db.ReferenceField('User'), default=[])
def link(self, other):
... | crossgovernmentservices/userstore-prototype | application/models.py | Python | mit | 404 |
#!/usr/bin/env python
'''
Module that update the software and its databases
'''
import os
import shutil
from sys import exit
import os.path
import tarfile
import requests
from bs4 import BeautifulSoup
from ...base import *
from ...sentry import sentry
from ...clint import progress
class Updater(object):
def __i... | PhantomGhosts/BigBrother | lib/bbro/core/update.py | Python | mit | 3,968 |
from venv import _venv
from fabric.api import task
@task
def migrate():
"""
Run Django's migrate command
"""
_venv("python manage.py migrate")
@task
def syncdb():
"""
Run Django's syncdb command
"""
_venv("python manage.py syncdb")
| pastpages/wordpress-memento-plugin | fabfile/migrate.py | Python | mit | 268 |
import sys
import os.path
from xml.etree import ElementTree as et
if len(sys.argv) != 3:
raise Exception("Expected at least 2 args, {} given!".format(len(sys.argv) - 1))
version = sys.argv[1]
csprojPath = sys.argv[2]
if not os.path.isfile(csprojPath):
raise Exception("File {} does not exist!".format(csprojPa... | dukeofharen/wolk | scripts/build/patch-csproj.py | Python | mit | 506 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import sys
extra_install = []
if sys.version_info <= (3,1):
extra_install.append('futures')
if sys.version_info <= (3,6):
extra_install.append('pysha3')
setup(
name="moneywagon",
version='{{ version }}',
description='Next Gener... | cst13/canstel | setup_template.py | Python | mit | 1,030 |
#!/usr/bin/python
from heapq import heapify, heapreplace
class Solution(object):
def kthSmallest(self, matrix, k):
"""
:type matrix: List[List[int]]
:type k: int
:rtype: int
"""
if len(matrix) is 1:
return matrix[0][0]
z = zip(*matrix[1:])
... | pisskidney/leetcode | medium/378.py | Python | mit | 745 |
import json, sys, glob, datetime, math, random, pickle, gzip
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import chainer
from chainer import computational_graph as c
from chainer import cuda
import chainer.functions as F
from chainer import optimizers
class AutoEncoder:
def __init... | miyamotok0105/deeplearning-sample | src/chainer1.7/ae/train.py | Python | mit | 2,598 |
""" This file contains code for working on lists and dictionaries. """
def moreThanOne(dict, key):
""" Checks if a key in a dictionary has a value more than one.
Arguments:
dict -- the dictionary
key -- the key
Returns:
True if the key exists in the dictionary and the value is at least one, otherwise... | ephracis/hermes | utilities/lists.py | Python | mit | 1,117 |
# -*- coding: utf-8 -*-
#
desc = 'Color bars'
phash = ''
def plot():
import matplotlib as mpl
from matplotlib import pyplot as pp
from matplotlib import style
import numpy as np
# Make a figure and axes with dimensions as desired.
fig, ax = pp.subplots(3)
# Set the colormap and norm to co... | dougnd/matplotlib2tikz | test/testfunctions/colorbars.py | Python | mit | 2,797 |
import lexer
s = "program id; var beto: int; { id = 1234; }"
lexer.lexer.input(s)
for token in lexer.lexer:
print token
| betoesquivel/PLYpractice | testingLexer.py | Python | mit | 126 |
'''
Created on 2013-01-22
@author: levi
'''
import unittest
import time
from path_condition_generator import PathConditionGenerator
from t_core.matcher import Matcher
from t_core.rewriter import Rewriter
from t_core.iterator import Iterator
from t_core.messages import Packet
from t_core.tc_python.frule import FRul... | levilucio/SyVOLT | tests/combine_test.py | Python | mit | 20,391 |
'''
plans.py
'''
from forex_python.converter import CurrencyCodes
from .base import Base
class Plan(Base):
'''
Plan class for making payment plans
'''
interval = None
name = None
amount = None
plan_code = None
currency = None
id = None
send_sms = True
send_invoices = True
... | Chibuzor-IN/python-paystack | python_paystack/objects/plans.py | Python | mit | 1,566 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from jcconv import kata2hira, hira2kata
from itertools import chain
from printable import PrintableDict, PrintableList
__by_vowels = PrintableDict(**{
u'ア': u'ワラヤャマハナタサカアァ',
u'イ': u'リミヒニちシキイィ',
u'ウ': u'ルユュムフヌツスクウゥ',
... | Saevon/AnkiHelpers | kana.py | Python | mit | 7,233 |
import requests, os
from bs4 import BeautifulSoup
url = 'http://www.nytimes.com'
def extractArticles (url):
data = requests.get(url)
soup = BeautifulSoup(data.text, 'html.parser')
articles = []
for article in soup.find_all('article'):
if article.find('h2') != None and article.find('h2').find... | timgrossmann/dailyProgrammer | Challenges/Python/decodeWebPage.py | Python | mit | 698 |
from base import IfbyphoneApiBase
class Addons(IfbyphoneApiBase):
def list(self):
"""List all purchased Addons for an account
"""
self.options['action'] = 'addons.list'
return self.call(self.options)
def purchase(self, **kwargs):
"""Purchase an addon f... | Opus1no2/Ifbyphone-API-Module | src/Ifbyphone/api/addons.py | Python | mit | 685 |
# -*- coding: utf-8 -*-
"""Utility functions.
"""
from collections import OrderedDict
from .bsd_checksum import bsd_checksum # make name available from this module
def n_(s, replacement='_'):
"""Make binary fields more readable.
"""
if isinstance(s, (str, unicode, bytearray)):
return s.replace('... | thebjorn/fixedrec | fixedrec/utils.py | Python | mit | 2,032 |
# encoding: utf-8
# pylint: disable=redefined-outer-name,missing-docstring
import pytest
from tests import utils
from app import create_app
@pytest.yield_fixture(scope='session')
def flask_app():
app = create_app(flask_config_name='testing')
from app.extensions import db
with app.app_context():
... | millen1m/flask-restplus-server-example | tests/conftest.py | Python | mit | 2,625 |
# 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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py | Python | mit | 15,441 |
class Heap(object):
def __init__(self, data=[]):
if len(data) == 0:
self.data = [None] * 100
else:
self.data = data
self.__size = sum([1 if item is not None else 0 for item in self.data])
self.__heapify()
def size(self):
return self.__size
... | haoliangyu/basic-data-structure | Heap.py | Python | mit | 3,852 |
#!/usr/bin/python
# File: mapentity.py
# import pygtk
# pygtk.require('2.0')
from gi.repository import Gtk, Gdk
class MapEntity:
# self.x = None
# self.y = None
# self.name = None
# self.texture = None
def getCoords(self):
return self.x,self.y
def getx(self):
return self.x
def gety(self):
return self.... | lotusronin/KronosEngine | editor/mapentity.py | Python | mit | 592 |
"""
.. module:: test
test
*************
:Description: test
:Authors: bejar
:Version:
:Created on: 10/02/2015 9:50
"""
__author__ = 'bejar'
from MeanPartition import MeanPartitionClustering
from kemlglearn.datasets import cluster_generator
import matplotlib.pyplot as plt
from sklearn.datasets import make_blo... | bejar/kemlglearn | kemlglearn/cluster/consensus/test.py | Python | mit | 905 |
# This doesn't work- not updated with eventmaster.py updates
# TODO: Fix This :)
# Import Libraries
import eventmaster
import time
import random
import sys
import unittest
import sys
class InputsTestCase(unittest.TestCase):
def setUp(self):
self.s3 = E2S3.E2S3Switcher()
self.s3.set_verbose(0)
... | kyelewisstgc/EventMaster-Python | tests/test_unit.py | Python | mit | 1,220 |
""" synrcat
gaussian mixture model
"""
import sys
import os
import numpy as np
import logging
from collections import OrderedDict
from astropy.table import Table
from pypeline import pype, add_param, depends_on
from syn import Syn
from syncat.errors import NoPoints
import syncat.misc as misc
import syncat.fileio a... | bengranett/syncat | syncat/methods/gmm.py | Python | mit | 6,003 |
# -*- coding: utf-8 -*-
import re
from jinja2 import Environment
from .observable import Observable
def get_attribute(render_data, variable):
levels = variable.split('.')
r = render_data
for level in levels:
if hasattr(r, level):
r = getattr(r, level)
else:
r = r.ge... | soasme/riotpy | riot/template.py | Python | mit | 1,172 |
#!/usr/bin/env python
#------------------------------------------------------------
#
# Ciro D. Santilli
#
# Prints a list of paths which are files followed by their inodes and sha1 sums.
#
# Useful to make a backup of paths names before mass renaming them,
# supposing your files are distinct by SHA1 and that SHA1 ha... | cirosantilli/python-utils | bin/find_path_sha1.py | Python | mit | 2,436 |
# -*- coding:utf-8 -*-
'''
Test
'''
import sys
sys.path.append('.')
from tornado.testing import AsyncHTTPSTestCase
from application import APP
class TestSomeHandler(AsyncHTTPSTestCase):
'''
Test
'''
def get_app(self):
'''
Test
'''
return APP
def test_index(sel... | bukun/TorCMS | tester/test_handlers/test_index_handler.py | Python | mit | 448 |
# 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/synapse/azure-synapse/azure/synapse/_configuration.py | Python | mit | 3,305 |