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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/MSVS/vs-11.0-scc-files.py | Python | mit | 3,967 |
from Control_functions import *
from servoctl import *
#from enum import Enum
from Compass_HMC5883L import Compass
#from pypurss_test import *
'''
class NavState(Enum):
GO_TO_GOAL=0
PRE_WALL_FOLLOW=1
WALL_FOLLOW=2
HALT=3
# AVOID_OBSTACLES=4
'''
class Navigation:
def __init__(self):
self.control_func= ControlFu... | chenyez/Quickbot | qb_zcycode.py | Python | mit | 3,792 |
from rhizopathy.cli import main
def test_main():
main([])
| williamgibb/rhizopathy | tests/test_rhizopathy.py | Python | mit | 65 |
# -*- coding: utf-8 -*-
class Solution(object):
''' https://leetcode.com/problems/count-primes/
'''
def countPrimes(self, n):
if n <= 2:
return 0
is_prime = [True] * n
ret = 0
for i in range(2, n):
if not is_prime[i]:
continue
... | lycheng/leetcode | others/count_primes.py | Python | mit | 488 |
#Requires .aws credentials at Home
#1st arg bucket name
#2nd project name or Folder
#3rd files path
import sys,os,glob,boto3
bkname=sys.argv[1]
prekee=sys.argv[2]+'/'
dir=sys.argv[3]
files=glob.glob(dir)
s3 = boto3.resource('s3')
for filename in files:
kee = os.path.basename(filename)
data = open(filename,'r... | vramirez/Ashgabat-Black | python3/s3_uploader.py | Python | mit | 452 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2017 Tuukka Turto
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | tuturto/pyherc | src/pyherc/rules/constants.py | Python | mit | 1,438 |
from platforms.desktop.desktop_service import DesktopService
from specializations.dlv.dlv_answer_sets import DLVAnswerSets
class DLVDesktopService(DesktopService):
"""Is an extention of DesktopService for DLV's solver"""
def __init__(self, exe_path):
super(DLVDesktopService, self).__init__(exe_pat... | SimoneLucia/EmbASP-Python | specializations/dlv/desktop/dlv_desktop_service.py | Python | mit | 529 |
#!/usr/bin/env python
## path configuration
caffe_root = './caffe'
script_path = '.'
caffe_model = script_path + '/soccer.prototxt'
caffe_weight = script_path + '/snapshot/superlatefusion_iter_15000.caffemodel'
caffe_inference_weight = script_path + '/superlatefusion_inference.caffemodel'
### start generate caffemode... | xionluhnis/decnet-scripts | test.py | Python | mit | 1,462 |
# multiprocessing.py
# -*- coding: utf-8 -*-
import os
print('Process (%s) start...' % os.getpid())
pid = os.CreatProcess ()
if pid == 0:
print("I'am child process (%s) and my parent is %s." % (os.getpid(), os.getpid()))
else:
print("I (%s) just creat a child process (%s)." % (os.getpid(), pid))
# 此语句只能在基于UNI... | darkless456/Python | multiprocessing1.py | Python | mit | 359 |
"""Unit tests of resource records."""
import pytest
from ..utilities.general import is_never_authz, is_no_authz, uses_cataloging, uses_filesystem_only
@pytest.mark.usefixtures("resource_record_class_fixture", "resource_record_test_fixture")
class TestResourceRecord(object):
"""Tests for ResourceRecord"""
@p... | mitsei/dlkit | tests/resource/test_record_templates.py | Python | mit | 1,495 |
# 06_read_data.py
import sqlite3
conn = sqlite3.connect('../../lupsEdgeServer/db.sqlite3')
cursor = conn.cursor()
# def localizar_cliente(id):
# r = cursor.execute(
# 'SELECT * FROM API_RestFul_persistance WHERE publisher = ?', (id,))
# for cliente in r.fetchall():
# print(cliente)
#
# local... | hubertokf/lupsEdgeServer | projects/old_files/Backup e arquivos N utilizados/conectDB.py | Python | mit | 462 |
import _plotly_utils.basevalidators
class ShowexponentValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="showexponent",
parent_name="scatter3d.marker.colorbar",
**kwargs
):
super(ShowexponentValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/marker/colorbar/_showexponent.py | Python | mit | 546 |
"""
Robust MLR via iteratively reweighted least squares.
"""
import numpy as np
from utide.utilities import Bunch
# Weighting functions:
def andrews(r):
r = np.abs(r)
r = max(np.sqrt(np.spacing(1)), r)
w = (r < np.pi) * np.sin(r) / r
return w
def bisquare(r):
r = np.abs(r)
w = (r < 1) * (... | wesleybowman/UTide | utide/robustfit.py | Python | mit | 7,233 |
import openmc
from openmc.source import Source
from openmc.stats import Box
###############################################################################
# Simulation Input File Parameters
###############################################################################
# OpenMC simulation parame... | kellyrowland/openmc | examples/python/lattice/nested/build-xml.py | Python | mit | 5,920 |
#!/usr/bin/env python
# file: make-flac.py
# vim:fileencoding=utf-8:fdm=marker:ft=python
#
# Copyright © 2012-2018 R.F. Smith <rsmith@xs4all.nl>.
# SPDX-License-Identifier: MIT
# Created: 2012-12-22T00:12:03+01:00
# Last modified: 2020-04-01T00:19:43+0200
"""
Encodes WAV files from cdparanoia (“trackNN.cdda.wav”) to FL... | rsmith-nl/scripts | make-flac.py | Python | mit | 3,732 |
# 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-datalake-analytics/azure/mgmt/datalake/analytics/account/models/firewall_rule.py | Python | mit | 1,956 |
from django.conf import settings
from django.conf.urls import patterns, url
from django.contrib.auth.views import login, logout
import views
urlpatterns = patterns(
'gauth',
url(r'^login/$', login, {'template_name': 'login.html'}, name='login'),
url(r'^login/$', logout, {'template_name': 'logout.html'}, ... | Fl0r14n/django_googleapi | gdrive/urls.py | Python | mit | 560 |
#encoding:utf-8
subreddit = 'Blackfellas'
t_channel = '@blackfellas'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/blackfellas/app.py | Python | mit | 143 |
import numpy as np
arr = np.arange(10)
arr
arr[5]
arr[5:8]
arr[5:8] = 12
arr
arr_slice = arr[5:8]
arr_slice
arr_slice[1] = 12345
arr
arr_slice[:] = 64
arr2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
arr2d[2]
arr2d[0, 2]
arr2d[0][2]
arr3d = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]])
old_vals... | eroicaleo/LearningPython | PythonForDA/ch04/basic_indexing.py | Python | mit | 469 |
import logging
import click
from halo import Halo
DEFAULT_COLORS = {
logging.WARN: {'fg': 'yellow'},
logging.ERROR: {'fg': 'red'},
logging.CRITICAL: {'fg': 'black', 'bg': 'red'},
}
# See how Django change its logging confs with settings specifics.
# https://github.com/django/django/blob/master/django/uti... | rougeth/bottery | bottery/log.py | Python | mit | 1,475 |
from webargs.core import json
from django.http import HttpResponse
from django.views.generic import View
import marshmallow as ma
from webargs import fields
from webargs.djangoparser import parser, use_args, use_kwargs
from webargs.core import MARSHMALLOW_VERSION_INFO
hello_args = {"name": fields.Str(missing="World",... | sloria/webargs | tests/apps/django_app/echo/views.py | Python | mit | 3,826 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from .corner import _quantile
from ..models.priors import TopHat as Uniform
__all__ = ["get_best", "best_sample", "get_simple_prior", "sample_prior", "sample_posterior",
"boxplot", "violinplot", "step"]
def get_simple_prior(prior, xlim, nu... | bd-j/prospector | prospect/plotting/utils.py | Python | mit | 5,908 |
'''Trains a simple convnet on the MNIST dataset.
Gets to 99.25% test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
16 seconds per epoch on a GRID K520 GPU.
'''
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
from... | yoshiweb/keras-mnist | keras-mnist/mnist_cnn/mnist_cnn_train.py | Python | mit | 2,369 |
from distutils.core import setup
from setuptools import find_packages
setup(name='blitzdb',
version='0.2.12',
author='Andreas Dewes - 7scientists',
author_email='andreas@7scientists.com',
license='MIT',
entry_points={
},
url='https://github.com/adewes/blitzdb',
packages=find_packages(),
zip_safe=False,
description... | programmdesign/blitzdb | setup.py | Python | mit | 3,033 |
# Ben Puccio
# 2016-06-02
#
# parse log file for last entry that says time elapsed
import numpy as np
import glob
import time
import datetime
path='/home/bpuccio/BET/IBSR_nifti_stripped/log'
log_names=glob.glob(path+'*.log')
time=[]
splitter=[]
sec=[]
for i in log_names:
with open(i,'r') as f:
f=f.r... | preprocessed-connectomes-project/NFB_skullstripped | validation_scripts/parse_log.py | Python | mit | 819 |
# Generated by Django 1.11.23 on 2020-01-12 23:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ticket', '0017_positive_integers_20180322_2056'),
]
operations = [
migrations.AddField(
model_name='ticket',
name=... | Karspexet/Karspexet | karspexet/ticket/migrations/0018_ticket_reference.py | Python | mit | 426 |
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT
import sys
class myMainWindow(QtGui.QMainWindow):
@pyqtSlot(int)
def onIndexChange(self, i):
print i
def main():
app = QtGui.QApplication(sys.argv)
window = myMainWindow()
palette =... | janusnic/21v-python | unit_13/qcombobox.py | Python | mit | 796 |
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^$', 'charts.views.charts', name='charts'),
)
| zknyoyo/chartkick.py | examples/demo/charts/urls.py | Python | mit | 128 |
'''
Test cases for pyclbr.py
Nick Mathewson
'''
from test.support import run_unittest
import sys
from types import FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase
StaticMethodType = type(staticmethod(lambda: None))
ClassMethodType = type(classmethod(lambda c: None))
# H... | timm/timmnix | pypy3-v5.5.0-linux64/lib-python/3/test/test_pyclbr.py | Python | mit | 7,018 |
import datetime
try:
import cPickle as pickle
except ImportError:
import pickle
from django.db import models
from django.db.models.query import QuerySet
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template import Context
from django.template.loader import render_t... | soad241/django-notification | notification/models.py | Python | mit | 14,929 |
def test_var_args(f_arg, *argv):
print("normal:", f_arg)
for arg in argv:
print("another one:", arg)
def greet_me(**kwargs):
for key, value in kwargs.items():
print("{0} = {1}".format(key, value))
test_var_args('hello', 'there', 'general', 'Kenobi')
greet_me(name="test", surname="me")
| CajetanP/code-learning | Python/Learning/Tips/args_and_kwargs.py | Python | mit | 319 |
import os
import sys
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst', format='md')
except (IOError, ImportError):
long_description = open('README.md').read()
try:
from setuptools import setup, find_packages, Extension
except ImportError:
sys.stderr.write('Setuptools not... | FALCONN-LIB/FALCONN | src/python/package/setup.py | Python | mit | 1,325 |
'''
Created by auto_sdk on 2015.09.17
'''
from top.api.base import RestApi
class AreasGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.fields = None
def getapiname(self):
return 'taobao.areas.get'
| colaftc/webtool | top/api/rest/AreasGetRequest.py | Python | mit | 285 |
content =\
[line.strip().split() for line in open("ut_align_no_tag.a")]
f = open("ut_align_no_tag_clean.a", "w")
for line in content:
for entry in line:
if entry.find('?') != -1:
l, rs = entry.split('?')
rs = rs.split(',')
for r in rs:
f.write(l + '?'... | sfu-natlang/HMM-Aligner | src/support/proc_no_tag_to_clean.py | Python | mit | 510 |
#!/home/bolt/.python_compiled/bin/python3
import math
from PIL import Image
def complex_wrapper(func, scale_factor=1):
"""
Modifies a complex function that takes a complex
argument and returns a complex number to take a
tuple and return a tuple.
"""
def inner(real, imag):
complex_num=c... | Bolt64/my_code | Code Snippets/domain_coloring.py | Python | mit | 3,030 |
def clt():
""" Flips a coin to generate a sample.
Modifies meanOfMeans and stdOfMeans defined before the function
to get the means and stddevs based on the sample means.
Does not return anything """
for sampleSize in sampleSizes:
sampleMeans = []
for t in range(20):
... | johntauber/MITx6.00.2x | Unit3/Lecture8Exercise1.py | Python | mit | 532 |
"""
Common distributions with standard parameterizations in Python
@author : Spencer Lyon <spencer.lyon@stern.nyu.edu>
@date : 2014-12-31 15:59:31
"""
from math import sqrt
import numpy as np
__all__ = ["CanDistFromScipy"]
pdf_docstr = r"""
Evaluate the probability density function, which is defined as
.. math::
... | spencerlyon2/distcan | distcan/scipy_wrap.py | Python | mit | 10,929 |
from datetime import time
from django.test import TestCase
from django.core.files.uploadedfile import SimpleUploadedFile
from .models import Transcript, TranscriptPhrase
class TranscriptTestCase(TestCase):
def setUp(self):
fake_file = SimpleUploadedFile(
'not-really-a-file.txt',
... | WGBH/FixIt | mla_game/apps/transcript/tests.py | Python | mit | 2,490 |
from .test_base_class import ZhihuClientClassTest
PEOPLE_SLUG = 'giantchen'
class TestPeopleBadgeNumber(ZhihuClientClassTest):
def test_badge_topics_number(self):
self.assertEqual(
len(list(self.client.people(PEOPLE_SLUG).badge.topics)), 2,
)
def test_people_has_badge(self):
... | 7sDream/zhihu-oauth | test/test_client_people_badge.py | Python | mit | 762 |
"""
get_unique.py
USAGE: get_unique.py [-h] [--sarcastic_path SARCASTIC_PATH]
[--non_sarcastic_path NON_SARCASTIC_PATH]
Create one json file with unique tweets
optional arguments:
-h, --help show this help message and exit
--sarcastic_path
path to directory... | TheWeiTheTruthAndTheLight/senior-design | src/get_unique.py | Python | mit | 2,936 |
# -*- coding: utf-8 -*-
"""
File: test_unit_tests.py
Path: fantasypremierleague/tests/
Author: Grant W
"""
import unittest
import fantasypremierleagueapi as fp
class TestEnsureOneItem(unittest.TestCase):
def setUp(self):
super().setUp()
@fp.ensure_one_item
def fake_func(self, list):
retu... | grantula/fantasypremierleagueapi | fantasypremierleagueapi/tests/test_unit_tests.py | Python | mit | 763 |
import os, sys, py
from rpython.tool.udir import udir
from rpython.rlib.jit import JitDriver, unroll_parameters, set_param
from rpython.rlib.jit import PARAMETERS, dont_look_inside
from rpython.rlib.jit import promote, _get_virtualizable_token
from rpython.rlib import jit_hooks, rposix, rgc
from rpython.rlib.objectmode... | oblique-labs/pyVM | rpython/jit/backend/llsupport/test/ztranslation_test.py | Python | mit | 11,930 |
#!/usr/bin/env python
import sys, argparse, yaml
from xidb import Guild
parser = argparse.ArgumentParser(description="Add comment to an asset")
parser.add_argument('-r', '--repo', dest='repo', required=False)
parser.add_argument('-a', '--agent', dest='agent', required=True)
parser.add_argument('-x', '--xlink', dest='... | Nomicoin/viki | scripts/addVote.py | Python | mit | 814 |
import array
import struct
import socket
from odict import OrderedDict as OD
class NLRI:
def __init__(self, afi, safi, val):
self.afi = afi
self.safi = safi
self.val = val
def encode(self):
return self.val
class vpnv4(NLRI):
def __init__(self, labels, rd, prefix):
... | plajjan/pybgp | pybgp/nlri.py | Python | mit | 5,029 |
import datetime
import time as mod_time
from aredis.exceptions import (ResponseError,
RedisError,
DataError)
from aredis.utils import (merge_result,
NodeFlag,
first_key,
b, dict_me... | NoneGG/aredis | aredis/commands/keys.py | Python | mit | 11,719 |
"""
Includes the help page of the program having information about the different flags and options.
Most importantly includes examples of how the different flags are going to be used. This page
is going to be implemented iteratively i.e when a new feature is implemented this page is updated
to include info about it.
"... | jkatsioloudes/Who-Dis | help.py | Python | mit | 8,443 |
# -*- coding: utf8 -*-
"""
The ``dbs`` module
===================
Contain all functions to access to main site db or any sql-lite db, in a secure way
"""
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.sql import join
__all__ = ['... | salas106/lahorie | lahorie/utils/sql.py | Python | mit | 886 |
# 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-containerinstance/azure/mgmt/containerinstance/models/environment_variable.py | Python | mit | 1,151 |
#!/usr/bin/env python
import time
from hashlib import md5
from gluon.dal import DAL
def motp_auth(db=DAL('sqlite://storage.sqlite'),
time_offset=60):
"""
motp allows you to login with a one time password(OTP) generated on a motp client,
motp clients are available for practica... | SEA000/uw-empathica | empathica/gluon/contrib/login_methods/motp_auth.py | Python | mit | 4,542 |
from __future__ import unicode_literals
from django.db import models
from django.core.mail import send_mail
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.base_user import AbstractBaseUser
from django.utils.translation import ugettext_lazy as _
from .managers import UserManager
cla... | jokuf/hack-blog | users/models.py | Python | mit | 1,710 |
from __future__ import print_function
import os, sys
__version__ = '0.9.3'
# If we are running from a git repo, generate a more descriptive version number
from .util.gitversion import getGitVersion
try:
gitv = getGitVersion('acq4', os.path.join(os.path.dirname(__file__), '..'))
if gitv is not None:
_... | acq4/acq4 | acq4/__init__.py | Python | mit | 1,108 |
import unittest
from time import strftime, time, gmtime
from pymongo import Connection
from waskr.database import Stats
config = {
'db_engine': 'mongodb',
'db_host': 'localhost',
'db_port': 27017,
}
class TestDatabase(unittest.TestCase):
def __init__(self, *args, **params):
... | AloneRoad/waskr | waskr/tests/test_database.py | Python | mit | 5,538 |
'''@file deepclustering_reconstructor.py
contains the reconstor class using deep clustering'''
from sklearn.cluster import KMeans
import mask_reconstructor
from nabu.postprocessing import data_reader
import numpy as np
import os
import pdb
class DeepattractornoisehardReconstructor(mask_reconstructor.MaskReconstructor... | JeroenZegers/Nabu-MSSS | nabu/postprocessing/reconstructors/deepattractornetnoise_hard_reconstructor.py | Python | mit | 4,078 |
import imp
import sys
import os
import subprocess
import pprint
import iopc
import ops_git
def Main(args):
account = iopc.getAccount(args)
cfg = iopc.getCfg(args)
params = iopc.getParams(args)
is_single_package = iopc.isSinglePackage(args)
single_package_name = iopc.getSinglePackageName(args)
p... | YuanYuLin/PackMan_IOPC | pyiopc/iopc_genlist.py | Python | mit | 742 |
"""
Spam comments to be classified by the relational model.
"""
import os
import numpy as np
class Comments:
"""Class to write comment predicate data for the relational model."""
def __init__(self, config_obj, util_obj):
"""Initializes object dependencies."""
self.config_obj = config_obj
... | jjbrophy47/sn_spam | relational/scripts/comments.py | Python | mit | 3,047 |
import discord
from discord.ext import commands
from random import choice as randomchoice
from .utils.dataIO import fileIO
from .utils import checks
import os
defaultQuotes = [
"Thats why I love switch hitting, I like to be in control ~ Jan, from the Hypermine Dragon Fight - 21st May 2016",
"Thank you for wwaking wi... | Wolfst0rm/Wolf-Cogs | quote/quote.py | Python | mit | 2,264 |
# coding: utf-8
# Create your views here.
| Locu/djredis | djredis/views.py | Python | mit | 43 |
from string import ascii_lowercase, maketrans
def mirror(code, rev=ascii_lowercase): # python 2
half = len(rev) // 2
the_mirror = (rev[:half][::-1] + rev[::-1][:half]).lower()
return code.lower().translate(maketrans(the_mirror, the_mirror[::-1]))
# from string import ascii_lowercase
#
#
# def mirror(co... | the-zebulan/CodeWars | katas/beta/assignment_2.py | Python | mit | 531 |
#!/usr/bin/env python
#
# -*- mode:python; sh-basic-offset:4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim:set tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8:
#
import hashlib
import os
import sys
import unittest
import urlparse
import webtest
import util
class FunctionalTest(unittest.TestCase):
... | urbanairship/pasttle | tests/suites/functional.py | Python | mit | 9,972 |
from django.db.models import Count
from django.http import HttpResponse
from rest_framework.generics import ListAPIView
from rest_framework.views import APIView
from rest_framework.authentication import TokenAuthentication
from prometheus_client import generate_latest
from core import models
from core import serializ... | telminov/ansible-manager | core/views/rest.py | Python | mit | 2,316 |
from toee import *
from utilities import *
from Co8 import *
from py00439script_daemon import npc_set, npc_get
from combat_standard_routines import *
def san_dialog( attachee, triggerer ):
if (npc_get(attachee, 1) == 0):
triggerer.begin_dialog( attachee, 1 )
elif (npc_get(attachee, 1) == 1):
triggerer.begin_dia... | GrognardsFromHell/TemplePlus | tpdatasrc/co8infra/scr/py00416standard_equipment_chest.py | Python | mit | 4,171 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A twisted UDP interface that is similar to the built-in socket interface."""
import traceback
from twisted.internet import reactor
from twisted.internet.protocol import DatagramProtocol
class UDPSocket(DatagramProtocol):
def __init__(self, host, port):
se... | hiidef/pylogd | pylogd/twisted/socket.py | Python | mit | 1,335 |
import os
import pandas as pd
#import seaborn as sns
total_reads = pd.read_csv('../data/sample_info/sample_read_counts.tsv', sep='\t', names = ['fastq filename', 'number of reads'])
total_reads['cryptic metagenome name'] = total_reads['fastq filename'].str.strip('.fastq.gz')
sample_info = pd.read_csv('../data/sample_... | dacb/assembly_and_binning | assess_unbinned_reads_across_samples/assess_unbinned_reads_across_samples.py | Python | mit | 858 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import datetime
import unittest
from pytz import UTC, timezone
from influxdb import line_protocol
class TestLineProtocol(unittes... | Asimmetric/influxdb-python | influxdb/tests/test_line_protocol.py | Python | mit | 3,723 |
from .. import BaseForm
from wtforms import StringField, TextAreaField
from wtforms.validators import DataRequired
class CategoryForm(BaseForm):
name = StringField('name',
validators=[
DataRequired()
])
description = TextAreaField('desc... | friendly-of-python/flask-online-store | flask_online_store/forms/admin/category.py | Python | mit | 461 |
# -*- encoding:utf8 -*-
from model.parser import Parser
from model.googledrive import GoogleDrive
from plugins.base.responsebase import IResponseBase
class Drive(IResponseBase):
def hear_regex(self, **kwargs):
lists = Parser().get_keyword_list(expand=True)
print("Lists : %r" % lists)
ret... | supistar/Botnyan | plugins/drive.py | Python | mit | 603 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
this_dir = os.path.abspath(os.path.dirname(__file__))
VERSIONFILE = os.path.join(this_dir, "textx", "__init__.py")
VERSION = None
for line in open(VERSIONFILE, "r").readlines():
if line.startswith('__version__'):
... | igordejanovic/textX | setup.py | Python | mit | 1,005 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import unittest
import tempfile
from karesansui.lib.file.k2v import *
class TestK2V(unittest.TestCase):
_w = {'key.1':'h oge',
'key.2':'fo o',
'key.3':'bar ',
'key.4':' piyo',
'key.5':'s p am'}
def setUp(... | karesansui/karesansui | karesansui/tests/lib/file/testk2v.py | Python | mit | 1,427 |
import math
import config
import utils
import packets
import logbot
import fops
import blocks
import behavior_tree as bt
from axisbox import AABB
log = logbot.getlogger("BOT_ENTITY")
class BotObject(object):
def __init__(self):
self.velocities = utils.Vector(0.0, 0.0, 0.0)
self.direction = ut... | lukleh/TwistedBot | twistedbot/botentity.py | Python | mit | 16,437 |
#!/usr/bin/python
a = 60 # 60 = 2b00111100
b = 13 # 13 = 2b00001101
c = 0 # 0 = 2b00000000
c = a & b # 12 = 2b00001100
print "Line 1: Value of c = a & b is: ", c
c = a | b # 61 = 2b00111101
print "Line 2: Value of c = a | b is: ", c
c = a ^ b # 49 = 2b00110001
print "L... | HuuHoangNguyen/Python_learning | bitwise_operators.py | Python | mit | 586 |
import hashlib
puzzle_input = 'iwrupvqb'
current = 0
done = False
while not done:
combined_input = puzzle_input + str(current)
solution = hashlib.md5(combined_input.encode())
solution = str(solution.hexdigest())
print(solution)
if solution.startswith('000000'):
done = True
print(c... | rubiconjosh/aoc-2015 | day4-part2.py | Python | mit | 345 |
from dominoes import players
from dominoes import search
from dominoes.board import Board
from dominoes.domino import Domino
from dominoes.exceptions import EmptyBoardException
from dominoes.exceptions import EndsMismatchException
from dominoes.exceptions import GameInProgressException
from dominoes.exceptions import G... | abw333/dominoes | dominoes/__init__.py | Python | mit | 675 |
import functools
import os
import flask
import werkzeug.security
from .db import get_db
from .looker import get_my_user
bp = flask.Blueprint("auth", __name__, url_prefix="/auth")
@bp.route("/register", methods=("GET", "POST"))
def register():
if flask.request.method == "POST":
username = flask.request.f... | looker-open-source/sdk-codegen | examples/python/lookersdk-flask/app/auth.py | Python | mit | 2,667 |
MEMCACHE_KEY = 'weerapi-cache'
MEMCACHE_EXPIRY = 120
MEMCACHE_SERVERS = ['127.0.0.1:11211']
URL = 'http://m.knmi.nl/index.php?i=Actueel&s=tabel_10min_data'
| erikr/weerapi | weerapi/config.py | Python | mit | 157 |
import random
import sys
lane_num = 2
lane = [[], []]
max_car_num = 10000
road_len = 1000
h = 6
p_b = 0.94
p_0 = 0.5
p_d = 0.1
v_max = [6, int(sys.argv[1])]
gap = 7
p_car = 1
p_crash = 0
time_period = 200
class Car:
car_cnt = 0
def __init__(self, v = 1, lane = 1):
self.size = 1
if random... | rve/pracmcm | ca/varying_v_max.py | Python | mit | 10,184 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Jérémie DECOCK (http://www.jdhp.org)
import numpy as np
from pyarm import fig
class MuscleModel:
"Muscle model."
# CONSTANTS ###############################################################
name = 'Fake'
##################################################... | jeremiedecock/pyarm | pyarm/model/muscle/fake_muscle_model.py | Python | mit | 1,107 |
def mangled_node_tree_name(b_material):
return "PH_" + b_material.name
| TzuChieh/Photon-v2 | BlenderAddon/PhotonBlend/bmodule/common/__init__.py | Python | mit | 73 |
#!/usr/bin/env python
import subprocess
import praw
import datetime
import pyperclip
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
from base64 import b64decode
from ConfigParser import ConfigParser
impor... | foobarbazblarg/stayclean | stayclean-2020-july/serve-challenge-with-flask.py | Python | mit | 12,690 |
import bikeshares
import pandas as pd
import numpy as np
def convert_rider_gender(x):
if x == 0: return np.nan
if x == 1: return "M"
if x == 2: return "F"
raise Exception("Unrecognized gender variable: {0}".format(x))
def convert_rider_type(x):
if x == "Subscriber": return "member"
if x == "Cu... | BuzzFeedNews/bikeshares | bikeshares/programs/nyc.py | Python | mit | 1,861 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-17 03:03
from __future__ import unicode_literals
from django.db import migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('ojp', '0004_problem_num_of_correct_tries'),
]
operations = [
... | harshkothari410/ocportal | ojp/migrations/0005_auto_20161117_0303.py | Python | mit | 493 |
from buildbot.plugins import worker
infosun = {
"polyjit-ci": {
"host": "polyjit-ci",
"password": None,
"properties": {
"uchroot_image_path": "/data/polyjit/xenial-image/",
"uchroot_binary": "/data/polyjit/erlent/build/uchroot",
"can_build_llvm_debug": Fa... | PolyJIT/buildbot | polyjit/buildbot/slaves.py | Python | mit | 2,304 |
#!/usr/bin/env python3
#
# Somfy Universal RTS Interface controller communication software.
#
# This file is encompasses all of the functionality for the package
# Copyright (C) 2017 Ralph Lipe <ralph@lipe.ws>
#
# SPDX-License-Identifier: MIT
"""\
Send motor control commands for Somfy RTS devices through Somfy Unive... | RalphLipe/somfyrts | somfyrts/__main__.py | Python | mit | 2,515 |
# -----------------------------------------------------------------------------
# lexer.py
#
# A simple calculator with variables -- all in one file.
# -----------------------------------------------------------------------------
reserved = {
'class':'CLASS',
'block':'BLOCK',
'event':'EVENT',
'transiti... | fae92/TSML | lexer_parser/lexer.py | Python | cc0-1.0 | 1,403 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000370.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000370 | BIOMD0000000370/model.py | Python | cc0-1.0 | 427 |
import collections
class Vertex(object):
def __init__(self, v):
self.v = v
self.d = -1
self.neighbors = set()
def add_neighbor(self, v):
self.neighbors.add(v)
def __repr__(self):
return str(self.v) + " " + str(self.d) + " "
def is_bipartite(vertex):
if not ... | misscindy/Interview | Graph/19_06_Bipartite.py | Python | cc0-1.0 | 1,033 |
"""
Base logic for pywow structures
"""
from structures import Structure, Skeleton
from .fields import *
from .main import *
from .generated import GeneratedStructure
class StructureNotFound(Exception):
pass
class StructureLoader():
wowfiles = None
@classmethod
def setup(cls):
if cls.wowfiles is None:
cls... | jleclanche/pywow | wdbc/structures/__init__.py | Python | cc0-1.0 | 1,799 |
import math
#this simple program calculates your lucky number using you birthmonth and birthdate
#this function does the calculation
def calculation(birthmonth, birthdate):
return (birthmonth*5-5+birthdate)/6+2
def output(name,birthmonth, birthdate,result):
return """Hi {}, Your birthmonth is {}, your birthdate... | diana2199-cmis/diana2199-cmis-cs2 | simpleprogram.py | Python | cc0-1.0 | 784 |
import pytest
from conftest import assert_complete, create_dummy_filedirs
@pytest.mark.bashcomp(temp_cwd=True)
class TestKpdf:
def test_1(self, bash):
files, dirs = create_dummy_filedirs(
".eps .EPS .pdf .PDF .ps .PS .txt".split(),
"foo".split(),
)
completion = as... | scop/bash-completion | test/t/test_kpdf.py | Python | gpl-2.0 | 502 |
#!/usr/bin/env python
"""Handle records from /proc/self/oom_adj data files"""
import regentest as RG
import ProcHandlers as PH
PFC = PH.ProcFieldConstants
# ---
def re_self_oom_adj(inprecs):
"""Iterate through parsed records and re-generate data file"""
__template = "{oom:d}"
for __hilit in inprecs:... | cnamejj/PyProc | regentest/self_oom_adj.py | Python | gpl-2.0 | 560 |
import wx
import functions
infoItems=[ ("active time", functions.FormatTime),
("active workers", None),
("active tasks", None),
("tasks done", None),
("pending urls", None),
("unique urls found", None),
("bytes read", functions.FormatByte),
("processing speed", functions.FormatByteSpeed),
("c... | bauhaus93/webcrawler | ui_infopanel.py | Python | gpl-2.0 | 1,369 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set et ai sta sts=2 sw=2 ts=2 tw=0:
from __future__ import print_function, unicode_literals, absolute_import
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import unittest
from libsalt import execute as ex
import ... | jrd/pylibsalt | tests/test_execute.py | Python | gpl-2.0 | 929 |
# -*- coding: utf-8 -*-
actions = {
"up": _(u"Go up in the current buffer"),
"down": _(u"Go down in the current buffer"),
"left": _(u"Go to the previous buffer"),
"right": _(u"Go to the next buffer"),
"next_account": _(u"Focus the next session"),
"previous_account": _(u"Focus the previous session"),
"show_hide": _(u"Sh... | codeofdusk/ProjectMagenta | src/keystrokeEditor/constants.py | Python | gpl-2.0 | 2,205 |
"""
Router.py uses bot_packages in this file to setup command and sensor value routing to the correct bot_role.
"""
settings= {
"bot_name":"rp4.solalla.ardyh",
"bot_roles":"bot",
"bot_packages":[],
"subscriptions":[],
}
| wilblack/lilybot | rpi_client/bot_roles/local_settings_generic.py | Python | gpl-2.0 | 242 |
# coding=utf-8
try:
# python3 grammar
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError, URLError
except ImportError:
# python2 grammar
from urlparse import urlparse
from urllib import urlencode
from urllib2 import... | ShanghaitechGeekPie/WifiLoginer | eznetloginer/Src/EZNetLoginer-new.py | Python | gpl-2.0 | 5,566 |
import logging
from yatcobot.plugins.notifiers import NotifierABC
logger = logging.getLogger(__name__)
class NotificationService:
def __init__(self):
self.active_notifiers = NotifierABC.get_enabled()
def send_notification(self, title, message):
"""Sends a message to all enabled notifiers""... | buluba89/Yatcobot | yatcobot/notifier.py | Python | gpl-2.0 | 577 |
"""
WSGI config for smarterer project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | agronick/WebServiceExample | smarterer/smarterer/wsgi.py | Python | gpl-2.0 | 395 |
#!/usr/bin/env python
# -*- coding:gbk -*-
import sys
import re
import os
import string
import datetime
import platform
import shutil
import getopt
import pandas as pd
sys.path.append('.')
from internal.handle_realtm import *
from internal.common_inf import *
from internal.realtime_obj import *
from internal.output_ge... | yudingding6197/fin_script | debug/recover/s7_try_recover.py | Python | gpl-2.0 | 12,051 |
# coding=utf-8
import json
import codecs
import os
import transaction
from nextgisweb import DBSession
from nextgisweb.vector_layer import VectorLayer
from nextgisweb_compulink.compulink_admin.model import BASE_PATH
def update_actual_lyr_names(args):
db_session = DBSession()
transaction.manager.begin()
... | nextgis/nextgisweb_compulink | nextgisweb_compulink/db_migrations/update_actual_lyr_names.py | Python | gpl-2.0 | 1,646 |
# python imports
import copy
import math
import random
# rasmus imports
from rasmus import util
class SeqDict (dict):
"""
A dictionary for molecular sequences. Also keeps track of their order,
useful for reading and writing sequences from fasta's. See fasta.FastaDict
for subclass that implements F... | mdrasmus/spimap | python/spidir/deps/compbio/seqlib.py | Python | gpl-2.0 | 15,659 |
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import... | anilcs13m/Projects | QuoraAnswersClr/quora_answerclassifier.py | Python | gpl-2.0 | 15,687 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.