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 |
|---|---|---|---|---|---|
from tools import *
from default_record import *
from xen.xend import uuid
from xen.xend import XendDomain, XendNode
from xen.xend import BNVMAPI, BNStorageAPI
from xen.xend.server.netif import randomMAC
from xen.xend.ConfigUtil import getConfigVar
from xen.xend.XendAPIConstants import *
from xen.xend.XendAuthS... | Hearen/OnceServer | pool_management/bn-xend-core/xend/tests/util/BNVMAPI_Util.py | Python | mit | 13,032 |
from setuptools import setup, find_packages
setup(
name="mould",
version="0.1",
packages=find_packages(),
package_data={
"mould": ["*.tpl"],
},
install_requires=[
"Flask",
"Flask-Script",
"Flask-Test... | kates/mould | setup.py | Python | mit | 440 |
from __future__ import absolute_import
from .validates import *
| openelections/openelections-core | openelex/us/vt/validate/__init__.py | Python | mit | 64 |
import hashlib
import hmac
import json
import requests
class GitHubResponse:
"""Wrapper for GET request response from GitHub"""
def __init__(self, response):
self.response = response
@property
def is_ok(self):
"""Check if request has been successful
:return: if it was OK
... | MarekSuchanek/repocribro | repocribro/github.py | Python | mit | 9,565 |
import os
def Dir_toStdName(path):
if not (path[-1]=="/" or path[-1] == "//"):
path=path+"/"
return path
def Dir_getFiles(path):
path=Dir_toStdName(path)
allfiles=[]
files=os.listdir(path)
for f in files:
abs_path = path + f
if os.path.isdir(abs_path):
sub_files=Dir_getFiles(abs_path)
sub_fil... | FSource/Faeris | tool/binpy/libpy/files/Dir.py | Python | mit | 703 |
def get_related_fields(model):
pass
def get_table_size(model):
pass
def get_row_size(model):
pass
| unbracketed/snowbird | snowbird/analyzer.py | Python | mit | 112 |
import os, requests, tempfile, time, webbrowser
import lacuna.bc
import lacuna.exceptions as err
### Dev notes:
### The tempfile containing the captcha image is not deleted until solveit()
### has been called.
###
### Allowing the tempfile to delete itself (delete=True during tempfile
### creation), or using the... | tmtowtdi/MontyLacuna | lib/lacuna/captcha.py | Python | mit | 5,055 |
# pylint: disable=C0111,R0903
"""Shows that debug is enabled"""
import platform
import core.module
import core.widget
import core.decorators
class Module(core.module.Module):
@core.decorators.every(minutes=60)
def __init__(self, config, theme):
super().__init__(config, theme, core.widget.Widget(sel... | tobi-wan-kenobi/bumblebee-status | bumblebee_status/modules/core/debug.py | Python | mit | 503 |
from ctypes import c_float, cast, POINTER
import numpy as np
import OpenGL.GL as gl
import openvr
from openvr.gl_renderer import OpenVrFramebuffer as OpenVRFramebuffer
from openvr.gl_renderer import matrixForOpenVrMatrix as matrixForOpenVRMatrix
from openvr.tracked_devices_actor import TrackedDevicesActor
import g... | jzitelli/python-gltf-experiments | OpenVRRenderer.py | Python | mit | 4,971 |
__author__ = 'shinyorke_mbp'
| Shinichi-Nakagawa/xp2015_baseball_tools | service/__init__.py | Python | mit | 29 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
# not sure about line 7
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^dropzone-drag-drop/$', inc... | vdmann/cse-360-image-hosting-website | src/mvp_landing/urls.py | Python | mit | 1,288 |
"""
The following tests that db connections works properly.
Make sure the default configurations match your connection to the database
"""
import pymysql
import warnings
warnings.filterwarnings("ignore")
from StreamingSQL.db import create_connection, execute_command
from StreamingSQL.fonts import Colors, Formats
"""D... | oshadmon/StreamingSQL | tests/test_db.py | Python | mit | 4,584 |
from app import app
import argparse
import os
import routes
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Run the MightySpring backend server.')
parser.add_argument('--debug',
'-d',
default=True)
parser.a... | texuf/myantname | main.py | Python | mit | 869 |
def clean_dict_repr(mw):
"""Produce a repr()-like output of dict mw with ordered keys"""
return '{' + \
', '.join('{k!r}: {v!r}'.format(k=k, v=v) for k, v in
sorted(mw.items())) +\
'}'
| npilon/planterbox | planterbox/util.py | Python | mit | 236 |
#http://pandas.pydata.org/pandas-docs/stable/tutorials.html
#file='pand.py'
#exec(compile(open(file).read(), file, 'exec'))
from pandas import DataFrame, read_csv
import matplotlib.pyplot as plt
import pandas as pd
#import sys
#import matplotlib
names = ['Bob','Jessica','Mary','John','Mel']
births = [968, 155, 77, ... | nuitrcs/python-researchers-toolkit | scripts/pand.py | Python | mit | 2,880 |
import numpy as np
import itertools
from scipy.misc import comb as bincoef
import random
#########################################################################
# GENERATORS
#########################################################################
def sign_permutations(length):
""" Memory efficient generator: ... | maebert/knyfe | knyfe/perm_test.py | Python | mit | 8,835 |
import time
import json
import tornado.httpclient
http_client = tornado.httpclient.HTTPClient()
class HTTPServiceProxy(object):
def __init__(self, host='localhost', port=6999, cache_timeout=5.0):
self._host = host
self._port = port
self._cache_timeout = cache_timeout
self._cache... | nickbjohnson4224/greyhat-crypto-ctf-2014 | frontend/services.py | Python | mit | 4,564 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for gclient.py.
See gclient_smoketest.py for integration tests.
"""
import Queue
import copy
import logging
import ... | Shouqun/node-gn | tools/depot_tools/tests/gclient_test.py | Python | mit | 40,396 |
from zang.exceptions.zang_exception import ZangException
from zang.configuration.configuration import Configuration
from zang.connectors.connector_factory import ConnectorFactory
from zang.domain.enums.http_method import HttpMethod
from docs.examples.credetnials import sid, authToken
url = 'https://api.zang.io/v2'
c... | zang-cloud/zang-python | docs/examples/sip_domains_example.py | Python | mit | 2,859 |
# -*- coding: utf-8 -*-
import pytest
from mmb_perceptron.feature_extractor import FeatureExtractor
class TestFeatureExtractor(object):
"""Tests for feature extractors.
"""
def test_context_size(self):
f = FeatureExtractor()
assert f.context_size == (0, 0)
f.context_size = (1, 2)
... | mbollmann/perceptron | test/test_feature_extractor.py | Python | mit | 554 |
from unittest import TestCase
from unittest.mock import Mock, patch, call, MagicMock
from flowirc.protocol import IRCClientProtocol
__author__ = 'Olle Lundberg'
class TestIRCClientProtocol(TestCase):
def setUp(self):
self.proto = IRCClientProtocol()
self.transport = Mock()
self.proto.mes... | lndbrg/flowirc | flowirc/tests/test_IRCClientProtocol.py | Python | mit | 2,853 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import absolute_import, print_function, unicode_literals
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.... | StefanKjartansson/drf-react-skeleton | project/settings/apps.py | Python | mit | 426 |
#!/usr/bin/env python
"""Print out a report about whats in a vectortile
Usage:
tileinfo.py [options] [SOURCE]
Options:
--srcformat=SRC_FORMAT Source file format: (tile | json)
--indent=INT|None JSON indentation level. Defaults to 4. Use 'None' to disable.
-h --help Show this screen.
--vers... | SkyTruth/vectortile | utils/tileinfo.py | Python | mit | 2,468 |
#!/usr/bin/env python
#
# Protein Engineering Analysis Tool DataBase (PEATDB)
# Copyright (C) 2010 Damien Farrell & Jens Erik Nielsen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ver... | dmnfarrell/peat | PEATDB/scripts/multiProjects.py | Python | mit | 10,004 |
from setuptools import setup, find_packages
with open("README.rst") as readme:
long_description = readme.read()
setup(
name='algos-py',
version='0.4.5',
license='MIT',
author='Aleksandr Lisianoi',
author_email='all3fox@gmail.com',
url='https://github.com/all3fox/algos-py',
packages=fin... | all3fox/algos-py | setup.py | Python | mit | 485 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Michael Hogg
# This file is part of bonemapy - See LICENSE.txt for information on usage and redistribution
import bonemapy
from distutils.core import setup
setup(
name = 'bonemapy',
version = bonemapy.__version__,
description = 'An ABAQUS plug-in to map bo... | mhogg/bonemapy | setup.py | Python | mit | 2,237 |
#!python
import re
import sys
import logging
import boto.ec2
from texttable import Texttable
from pprint import PrettyPrinter
from optparse import OptionParser
PP = PrettyPrinter( indent=2 )
###################
### Arg parsing
###################
parser = OptionParser("usage: %prog [options]" )
parser.add_... | jib/aws-analysis-tools | instances.py | Python | mit | 6,405 |
def read_data(file_name):
return pd.read_csv(file_name)
def preprocess(data):
# Data Preprocessing
data['GDP_scaled']=preprocessing.scale(data['GDP'])
data['CLPRB_scaled']=preprocessing.scale(data['CLPRB'])
data['EMFDB_scaled']=preprocessing.scale(data['EMFDB'])
data['ENPRP_scaled']=preproces... | uwkejia/Clean-Energy-Outlook | examples/Extra/Codes/SVR_nuclear.py | Python | mit | 1,586 |
# Docker-specific local settings
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db',
}
}
# Make this unique, and don't share it with anybody.
SECRET_KEY = ''
TEMPLATE_DIRS = (
'/srv/webldap/templates',
)
EMAIL_F... | FedeRez/webldap | app/webldap/local_settings.docker.py | Python | mit | 764 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2020 Richard Hull and contributors
# See LICENSE.rst for details.
"""
Simplified sprite animation framework.
.. note:: This module is an evolving "work-in-progress" and should be treated
as such until such time as this notice disappears.
"""
from time import sle... | rm-hull/luma.core | luma/core/sprite_system.py | Python | mit | 8,896 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def populate_target_amount(apps, schema_editor):
Entry = apps.get_model("momentum", "Entry")
for entry in Entry.objects.all():
entry.target_amount = entry.goal.target_amount
entry.save()
... | mod2/momentum | momentum/migrations/0010_target_data_migration.py | Python | mit | 517 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from itertools import groupby
from time import time
from functools import partial
import re
import django
django.setup()
from django.db import transaction
from clldutils.dsv import reader
from clldutils.text import split_text
from clldutils.path import Path
fro... | NESCent/dplace | dplace_app/load.py | Python | mit | 5,554 |
def count_keys_equal(A, n, m):
equal = [0] * (m + 1)
for i in range(0, n): # 0 1 2 3 4 5 6
key = A[i] # 1 3 0 1 1 3 1
equal[key] += 1
return equal
def count_keys_less(equal, m):
less = [0] * (m + 1)
less[0] = 0
for j in range(1, m+1): # 0 1 2 3 4... | wastegas/Data-Structures-Algorithms | src/Sorting/counting-sort.py | Python | mit | 951 |
'''
Copyright 2011 Jean-Baptiste B'edrune, Jean Sigwald
Using New BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditio... | ydkhatri/mac_apt | plugins/helpers/hfs_alt.py | Python | mit | 22,333 |
# -*- encoding: utf-8 -*-
from mock import Mock, patch
from psutil import AccessDenied, TimeoutExpired
from thefuck.output_readers import rerun
class TestRerun(object):
def setup_method(self, test_method):
self.patcher = patch('thefuck.output_readers.rerun.Process')
process_mock = self.patcher.s... | nvbn/thefuck | tests/output_readers/test_rerun.py | Python | mit | 2,942 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Action'
db.create_table('gratitude_action', (
('id', self.gf('django.db.models.f... | adamfeuer/ArtOfGratitude_app | gratitude/migrations/0005_auto__add_action.py | Python | mit | 7,091 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015 Axel Mendoza <aekroft@gmail.com>
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 limita... | aek/solt_sftp | src/solt_sftp/__init__.py | Python | mit | 1,132 |
from snowball.utils import SnowMachine
from snowball.climate import WeatherProbe
# Note: multiline import limits line length
from snowball.water.phases import (
WaterVapor, IceCrystal, SnowFlake
)
def let_it_snow():
"""
Makes it snow, using a SnowMachine when weather doesn't allow it.
Returns a list... | dokterbob/slf-programming-workshops | examples/snowball/main.py | Python | mit | 1,795 |
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from inspect import isgenerator
class Element(object):
tag = ''
self_closing = False
def __init__(self, *children, **attrs):
if children and isinstance(children[0], dict):
self.attrs = children[0]
... | russiancow/stag | stag/base.py | Python | mit | 1,436 |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
# pylint: disable=W0212,W0613
from twisted.internet.defer import Deferred, DeferredList
from twisted.python.failure import Failure
from twisted.trial.unittest import TestCase
import smartanthill.litemq.exchange as ex
from smartanthill.exceptio... | smartanthill/smartanthill1_0 | smartanthill/test/test_litemq.py | Python | mit | 4,944 |
#Copyright 2008, Meka Robotics
#All rights reserved.
#http://mekabot.com
#Redistribution and use in source and binary forms, with or without
#modification, are permitted.
#THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#LIMITED... | ahoarau/m3meka | python/scripts/m3qa/calibrate_arm_a1r1.py | Python | mit | 4,744 |
#
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from mock import Mock, call
from os.path import dirname, join
from requests import HTTPError
from requests_mock import ANY, mock as requests_mock
from unittest import TestCase
from octodns.record import Record
from octodns... | h-hwang/octodns | tests/test_octodns_provider_dnsimple.py | Python | mit | 6,915 |
from components.base.automotive_component import AutomotiveComponent
from config import project_registration as proj
from tools.ecu_logging import ECULogger as L
import random
class AbstractECU(AutomotiveComponent):
'''
This abstract class defines the interface of
an ECU as it is found in an automotive n... | PhilippMundhenk/IVNS | ECUSimulation/components/base/ecu/types/abst_ecu.py | Python | mit | 5,802 |
import boto3
import logging
import argparse
import os
from botocore.exceptions import ClientError
from boto3.dynamodb.conditions import Key, Attr
import json
import decimal
import time
import datetime
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import contracts
fro... | th3sys/capsule | nightwatch.py | Python | mit | 16,596 |
from django import template
from django.conf import settings
register = template.Library()
# settings value
@register.assignment_tag
def get_google_maps_key():
return getattr(settings, 'GOOGLE_MAPS_KEY', "")
| linuxsoftware/mamc-wagtail-site | home/templatetags/home_tags.py | Python | mit | 217 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Fast R-CNN config system.
This file specifies default config option... | yuxng/Deep_ISM | ISM/lib/ism/config.py | Python | mit | 10,824 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-14 02:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | foohooboo/graphql-cookiecutter | graphql_cookiecutter/buildings/migrations/0001_initial.py | Python | mit | 1,612 |
# 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 ... | sharadagarwal/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py | Python | mit | 44,870 |
from pseudoregion import *
class Edge(PseudoRegion):
"""EDGE Fringe field and other kicks for hard-edged field models
1) edge type (A4) {SOL, DIP, HDIP, DIP3, QUAD, SQUA, SEX, BSOL, FACE}
2.1) model # (I) {1}
2.2-5) p1, p2, p3,p4 (R) model-dependent parameters
Edge type = SOL
p1: BS [T]
... | jon2718/ipycool_2.0 | edge.py | Python | mit | 4,743 |
"""code_for_good URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cla... | Spferical/cure-alzheimers-fund-tracker | code_for_good/urls.py | Python | mit | 826 |
"""config URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | thomasperrot/MTGTrader | mtg/config/urls.py | Python | mit | 915 |
from OpenGLCffi.GL import params
@params(api='gl', prms=['pname', 'index', 'val'])
def glGetMultisamplefvNV(pname, index, val):
pass
@params(api='gl', prms=['index', 'mask'])
def glSampleMaskIndexedNV(index, mask):
pass
@params(api='gl', prms=['target', 'renderbuffer'])
def glTexRenderbufferNV(target, renderbuffe... | cydenix/OpenGLCffi | OpenGLCffi/GL/EXT/NV/explicit_multisample.py | Python | mit | 332 |
import os, pickle, re, sys, rsa
from common.safeprint import safeprint
from common.call import parse
from multiprocessing import Lock
from hashlib import sha256
global bountyList
global bountyLock
global bountyPath
global masterKey
bountyList = []
bountyLock = Lock()
bounty_path = "data" + os.sep + "bounties.pickle"
m... | gappleto97/Senior-Project | common/bounty.py | Python | mit | 14,300 |
from collections import Counter
import sys
import numpy as np
import scipy as sp
from lexical_structure import WordEmbeddingDict
import dense_feature_functions as df
def _get_word2vec_ff(embedding_path, projection):
word2vec = df.EmbeddingFeaturizer(embedding_path)
if projection == 'mean_pool':
return ... | jimmycallin/master-thesis | architectures/nn_discourse_parser/nets/util.py | Python | mit | 11,972 |
import numpy as np
import numpy.linalg as la
import collections
import IPython
import tensorflow as tf
from utils import *
import time
from collections import defaultdict
class PolicyGradient(Utils):
"""
Calculates policy gradient
for given input state/actions.
Users should primarily be calling main
PolicyGrad... | WesleyHsieh/policy_gradient | policy_gradient/policy_gradient.py | Python | mit | 10,569 |
# -*- coding: utf8 -*-
"""
The ``queue` utils
==================
Some operation will require a queue. This utils file
"""
__author__ = 'Salas'
__copyright__ = 'Copyright 2014 LTL'
__credits__ = ['Salas']
__license__ = 'MIT'
__version__ = '0.2.0'
__maintainer__ = 'Salas'
__email__ = 'Salas.106.212@gma... | salas106/irc-ltl-framework | utils/queue.py | Python | mit | 352 |
'''
evaluate result
'''
from keras.models import load_model
from keras.utils import np_utils
import numpy as np
import os
import sys
# add path
sys.path.append('../')
sys.path.append('../tools')
from tools import conf
from tools import load_data
from tools import prepare
# input sentence dimensions
step_length =... | danche354/Sequence-Labeling | ner_BIOES/evaluate-senna-hash-2-pos-chunk-128-64-rmsprop5.py | Python | mit | 3,163 |
import numpy as np
import cvxopt as co
def load_mnist_dataset():
import torchvision.datasets as datasets
mnist_train = datasets.MNIST(root='../data/mnist', train=True, download=True, transform=None)
mnist_test = datasets.MNIST(root='../data/mnist', train=False, download=True, transform=None)
test_labe... | nicococo/tilitools | tilitools/utils_data.py | Python | mit | 5,881 |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 10 10:43:53 2019
@author: Heathro
Description: Reduces a vcf file to meta section and
one line for each chromosome number for testing and
debugging purposes.
"""
# Open files to read from and write to
vcfpath = open("D:/MG_GAP/Ali_w_767.vcf", "rU")
testvcf = open("REDU... | davidfarr/mg-gap | mg-gap/mg-gap-py/mg-gap/test_files/reduceVCF.py | Python | mit | 1,210 |
import random
rand = random.SystemRandom()
def rabinMiller(num):
if num % 2 == 0:
return False
s = num - 1
t = 0
while s % 2 == 0:
s = s // 2
t += 1
for trials in range(64):
a = rand.randrange(2, num - 1)
v = pow(a, s, num)
if v != 1:
i = 0... | Fitzgibbons/Cryptograpy | rabinmiller.py | Python | mit | 526 |
"""Tests exceptions and DB-API exception wrapping."""
from sqlalchemy import exc as sa_exceptions
from sqlalchemy.test import TestBase
# Py3K
#StandardError = BaseException
# Py2K
from exceptions import StandardError, KeyboardInterrupt, SystemExit
# end Py2K
class Error(StandardError):
"""This class will be old-s... | obeattie/sqlalchemy | test/base/test_except.py | Python | mit | 5,046 |
import re
from collections import OrderedDict
import compiler.lang as lang
doc_next = None
doc_prev_component = None
doc_root_component = None
class CustomParser(object):
def match(self, next):
raise Exception("Expression should implement match method")
escape_re = re.compile(r"[\0\n\r\v\t\b\f]")
escape_map = {
... | pureqml/qmlcore | compiler/grammar2.py | Python | mit | 21,146 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('app', '0008_playlistitem_network'),
]
operations = [
migrations.AddField(
model_name='playlistit... | m-vdb/ourplaylists | ourplaylists/app/migrations/0009_playlistitem_created_at.py | Python | mit | 527 |
#!/usr/bin/env python
from math import pi, sin, log, exp, atan
DEG_TO_RAD = pi / 180
RAD_TO_DEG = 180 / pi
def minmax (a,b,c):
a = max(a,b)
a = min(a,c)
return a
class GoogleProjection:
"""
Google projection transformations. Sourced from the OSM.
Have not taken the time to figure out how thi... | onyxfish/invar | invar/projections.py | Python | mit | 1,202 |
import pytest
import pandas as pd
from lcdblib.pandas import utils
@pytest.fixture(scope='session')
def sample_table():
metadata = {
'sample': ['one', 'two'],
'tissue': ['ovary', 'testis']
}
return pd.DataFrame(metadata)
def test_cartesian_df(sample_table):
df2 = pd.DataFrame({'num... | lcdb/lcdblib | tests/test_pandas_utils.py | Python | mit | 1,376 |
import io
import tempfile
import unittest
from zipencrypt import ZipFile, ZipInfo, ZIP_DEFLATED
from zipencrypt.zipencrypt2 import _ZipEncrypter, _ZipDecrypter
class TestEncryption(unittest.TestCase):
def setUp(self):
self.plain = "plaintext" * 3
self.pwd = b"password"
def test_roundtrip(sel... | devthat/zipencrypt | tests/python2/test_encryption.py | Python | mit | 3,249 |
"""
Abstract base for a specific IP transports (TCP or UDP).
* It starts and stops a socket
* It handles callbacks for incoming frame service types
"""
from __future__ import annotations
from abc import ABC, abstractmethod
import asyncio
import logging
from typing import Callable, cast
from xknx.exceptions import Co... | XKNX/xknx | xknx/io/transport/ip_transport.py | Python | mit | 3,449 |
class Base:
def meth(self):
print("in Base meth")
class Sub(Base):
def meth(self):
print("in Sub meth")
return super().meth()
a = Sub()
a.meth()
| aitjcize/micropython | tests/basics/class-super.py | Python | mit | 181 |
from neo.Core.UIntBase import UIntBase
class UInt256(UIntBase):
def __init__(self, data=None):
super(UInt256, self).__init__(num_bytes=32, data=data)
@staticmethod
def ParseString(value):
"""
Parse the input str `value` into UInt256
Raises:
ValueError: if the ... | hal0x2328/neo-python | neo/Core/UInt256.py | Python | mit | 688 |
'''
Build a tweet sentiment analyzer
'''
from __future__ import print_function
import cPickle as pickle
import sys
import time
from collections import OrderedDict
import numpy
import theano
import theano.tensor as tensor
from theano import config
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
... | bitesandbytes/upgraded-system | src/vanilla_lstm.py | Python | mit | 22,530 |
import rinocloud
import requests
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
from clint.textui.progress import Bar as ProgressBar
from clint.textui import progress
import json
def upload(filepath=None, meta=None):
encoder = MultipartEncoder(
fields={
'file': ('file... | rinocloud/rinocloud-python | rinocloud/http.py | Python | mit | 4,102 |
import os
import json
import pytest
from .. import bot, PACKAGEDIR
EXAMPLE_TWEET = json.load(open(os.path.join(PACKAGEDIR, 'tests', 'examples', 'example-tweet.json'), 'r'))
EXAMPLE_RETWEET = json.load(open(os.path.join(PACKAGEDIR, 'tests', 'examples', 'retweeted-status.json'), 'r'))
EXAMPLE_NARCISSISTIC = json.load(... | mrtommyb/AstroFuckOffs | bot/tests/test_bot.py | Python | mit | 1,600 |
"""Defines the SMEFT class that provides the main API to smeftrunner."""
from . import rge
from . import io
from . import definitions
from . import beta
from . import smpar
import pylha
from collections import OrderedDict
from math import sqrt
import numpy as np
import ckmutil.phases, ckmutil.diag
class SMEFT(object)... | DsixTools/python-smeftrunner | smeftrunner/classes.py | Python | mit | 11,842 |
from collections import namedtuple
import sublime
from sublime_plugin import WindowCommand
from ..git_command import GitCommand
MenuOption = namedtuple("MenuOption", ["requires_action", "menu_text", "filename", "is_untracked"])
CLEAN_WORKING_DIR = "Nothing to commit, working directory clean."
ADD_ALL_UNSTAGED_FILES... | ypersyntelykos/GitSavvy | core/commands/quick_stage.py | Python | mit | 3,133 |
# standard imports
import os
import logging
import traceback
# Qt imports
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import QPlainTextEdit
# toolbox imports
from dltb.util.debug import edit
# GUI imports
from ..utils import protect
# logging
LOG = logging.getLogger(__name__)
class QLogHa... | Petr-By/qtpyvis | qtgui/widgets/logging.py | Python | mit | 5,929 |
from __future__ import unicode_literals
import django
from django.core.exceptions import FieldError
from django.test import SimpleTestCase, TestCase
from .models import (
AdvancedUserStat, Child1, Child2, Child3, Child4, Image, LinkedList,
Parent1, Parent2, Product, StatDetails, User, UserProfile, UserStat,
... | denisenkom/django-sqlserver | tests/select_related_onetoone/tests.py | Python | mit | 11,118 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_05_01/operations/_express_route_ports_locations_operations.py | Python | mit | 7,987 |
#!/usr/bin/env python
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
import matplotlib.pyplot as plt
from dataset.mnist import load_mnist
from simple_convnet import SimpleConvNet
from common.trainer import Trainer
# データの読み込み
(x_train, t_train), (x_test, t_tes... | kgsn1763/deep-learning-from-scratch | ch07/train_convnet.py | Python | mit | 1,553 |
from copy import deepcopy
import settings
from twitch.player_manager import PlayerManager
class QuestPlayerManager(PlayerManager):
"""
Functions like add_gold perform a raw store action and then save. __add_gold is the raw store action in this case.
Properties of raw store actions:
- Call usernam... | Xelaadryth/Xelabot | quest_bot/quest_player_manager.py | Python | mit | 11,668 |
import pyactiveresource.connection
from pyactiveresource.activeresource import ActiveResource, ResourceMeta, formats
import shopify.yamlobjects
import shopify.mixins as mixins
import shopify
import threading
import sys
from six.moves import urllib
import six
from shopify.collection import PaginatedCollection
from pyac... | Shopify/shopify_python_api | shopify/base.py | Python | mit | 7,625 |
from django.conf import settings
from images.models import S3Connection
from shutil import copyfileobj
import tinys3
import os
import urllib
class LocalStorage(object):
def __init__(self, filename):
self.filename = filename
def get_file_data(self):
"""
Returns the raw data for the spec... | sokanu/frame | images/storage.py | Python | mit | 3,547 |
# -*- coding: utf-8 -*-
#
# powerschool_apps documentation build configuration file, created by
# sphinx-quickstart.
#
# 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 configuration valu... | IronCountySchoolDistrict/powerschool_apps | docs/conf.py | Python | mit | 8,001 |
#!/usr/bin/env python
import atexit
import argparse
import getpass
import sys
import textwrap
import time
from pyVim import connect
from pyVmomi import vim
import requests
requests.packages.urllib3.disable_warnings()
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except Att... | kenelite/vmapi | 005reset.py | Python | mit | 4,622 |
__author__ = 'Akshay'
"""
File contains code to Mine reviews and stars from a state reviews.
This is just an additional POC that we had done on YELP for visualising number of 5 star reviews per state on a map.
For each business per state, 5 reviews are taken and the count of the review is kept in the dictionary for e... | akshaykamath/StateReviewTrendAnalysisYelp | StateReviewTrendsPOC.py | Python | mit | 4,899 |
# Author: Samuel Genheden, samuel.genheden@gmail.com
"""
Program to build lipids from a template, similarly to MARTINI INSANE
Is VERY experimental!
"""
import argparse
import os
import xml.etree.ElementTree as ET
import numpy as np
from sgenlib import pdb
class BeadDefinition(object):
def __init__(self):
... | SGenheden/Scripts | Membrane/build_lipid.py | Python | mit | 3,765 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | darthdeus/dotfiles | c_ycm_conf.py | Python | mit | 5,178 |
class RepeatError(ValueError):
pass
class NoneError(ValueError):
pass
| HarborYuan/cashier | Errors.py | Python | mit | 79 |
from storytext.javaswttoolkit import describer as swtdescriber
from org.eclipse.core.internal.runtime import InternalPlatform
from org.eclipse.ui.forms.widgets import ExpandableComposite
import os
from pprint import pprint
class Describer(swtdescriber.Describer):
swtdescriber.Describer.stateWidgets = [ ExpandableC... | emilybache/texttest-runner | src/main/python/storytext/lib/storytext/javarcptoolkit/describer.py | Python | mit | 2,499 |
import os
from setuptools import find_packages
from setuptools import setup
version = '1.0'
project = 'kotti_mb'
install_requires=[
'Kotti',
],
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read(... | potzenheimer/kotti_mb | setup.py | Python | mit | 1,275 |
# Natural Language Toolkit: POS Tag Simplification
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# Brown Corpus
# http://khnt.hit.uib.no/icame/manuals/brown/INDEX.HTM
brown_mapping1 = {
'j': 'ADJ', '... | syllog1sm/TextBlob | text/nltk/tag/simplify.py | Python | mit | 3,411 |
import codecs
f = codecs.open("/Users/hjp/Downloads/task/data/dev.txt", 'r', 'utf-8')
for line in f.readlines():
print(line)
sents = line.split('\t')
print(sents[1] + "\t" + sents[3])
for i in range(len(sents)):
print(sents[i])
f.close()
| hjpwhu/Python | src/hjp.edu.nlp.data.task/semeval.py | Python | mit | 269 |
"""nubrain URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | NuChwezi/nubrain | nubrain/urls.py | Python | mit | 1,184 |
from django.contrib import admin
from .models import SimpleModel, Type, FKModel
admin.site.register(SimpleModel)
admin.site.register(Type)
admin.site.register(FKModel)
| wq/django-data-wizard | tests/data_app/admin.py | Python | mit | 170 |
from .logic import LogicAdapter
from chatterbot.conversation import Statement
from chatterbot.utils.pos_tagger import POSTagger
import re
import forecastio
class WeatherLogicAdapter(LogicAdapter):
"""
A logic adapter that returns information regarding the weather and
the forecast for a specific location.... | imminent-tuba/thesis | server/chatterbot/chatterbot/adapters/logic/weather.py | Python | mit | 2,362 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Alarm.last_checked'
db.alter_column(u'ddsc_core_alarm', 'last_checked', self.gf('django.d... | ddsc/ddsc-core | ddsc_core/migrations/0078_auto__chg_field_alarm_last_checked.py | Python | mit | 28,517 |
#!/usr/bin/env python
print " Formated number:", "{:,}".format(102403)
| daltonmenezes/learning-C | src/Python/format/thousands_separator.py | Python | mit | 72 |
# Name: Seline, Li, Taylor, Son
# Leap Motion project
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import time
mpl.rcParams['legend.fontsize'] = 10
fig = plt.figure()
ax = Axes3D(fig)
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
z = np.linspac... | BoolLi/LeapMotionDesignChallenge | Plotting.py | Python | mit | 602 |
#!/usr/bin/env python3
# imports go here
import sched
import time
#
# Free Coding session for 2015-05-04
# Written by Matt Warren
#
scheduler = sched.scheduler(time.time, time.sleep)
def print_time():
print(time.time())
return True
scheduler.enter(3, 1, print_time)
scheduler.enter(5, 1, print_time)
print(s... | mfwarren/FreeCoding | 2015/05/fc_2015_05_04.py | Python | mit | 412 |
# -*- coding: utf-8 -*-
# pylint: disable=C0302,fixme, protected-access
""" The core module contains the SoCo class that implements
the main entry to the SoCo functionality
"""
from __future__ import unicode_literals
import socket
import logging
import re
import requests
from .services import DeviceProperties, Conte... | xxdede/SoCo | soco/core.py | Python | mit | 72,281 |
# coding=UTF-8
'''
Created on 24.09.2017
@author: sysoev
'''
from google.appengine.ext import db
from google.appengine.api import users
import datetime
import time
import logging
from myusers import MyUser
def force_unicode(string):
if type(string) == unicode:
return string
return string.decode('ut... | sysoevss/WebApps17 | data.py | Python | mit | 2,774 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.