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 |
|---|---|---|---|---|---|
class amicable():
def d(self, n):
if n == 1:
return 0
else:
sum_of_factors = 0
for i in range(1, int(n**0.5)+1):
if n % i == 0:
sum_of_factors += i
if n/i != n:
sum_... | higee/project_euler | 21-30/21.py | Python | mit | 860 |
# -*- coding: utf-8 -*-
"""
Django settings for ember_demo project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.... | agconti/Ember-Demo | ember_demo/config/settings.py | Python | mit | 14,218 |
import sys, struct, array
import SocketServer
# import StringIO as StringIO
# import pygame
p = 0x08d682598db70a889ff1bc7e3e00d602e9fe9e812162d4e3d06954b2ff554a4a21d5f0aab3eae5c49ac1aec7117709cba1b88b79ae9805d28ddb99be07ba05ea219654afe0c8dddac7e73165f3dcd851a3c8a3b6515766321420aff177eaaa7b3da39682d7e773aa863a729706d52... | nickbjohnson4224/greyhat-crypto-ctf-2014 | challenges/musicbox/musicbox.py | Python | mit | 4,204 |
#!/usr/bin/env python
"""
This module contains the :class:`.DataType` class and its subclasses. These
types define how data should be converted during the creation of a
:class:`.Table`.
A :class:`TypeTester` class is also included which be used to infer data
types from column data.
"""
from copy import copy
from ag... | JoeGermuska/agate | agate/data_types/__init__.py | Python | mit | 3,646 |
from django.test import TestCase
from seedsdb.models import (
Plant, Tag, Harvest, Activity
)
class TestPlant(TestCase):
def tearDown(self):
Plant.objects.all().delete()
def make_test_plant(self, aliases=None):
if aliases:
aliases = "|".join(aliases)
else:
... | timjarman/seeds | seeds/seedsdb/tests/unit/test_models.py | Python | mit | 4,829 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-"""
# Temperature conversion constants
KELVIN_OFFSET = 273.15
FAHRENHEIT_OFFSET = 32.0
FAHRENHEIT_DEGREE_SCALE = 1.8
# Wind speed conversion constants
MILES_PER_HOUR_FOR_ONE_METER_PER_SEC = 2.23694
KM_PER_HOUR_FOR_ONE_METER_PER_SEC = 3.6
KNOTS_FOR_ONE_METER_PER_SEC = 1.943... | csparpa/pyowm | pyowm/utils/measurables.py | Python | mit | 7,259 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-18 10:05
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.contrib.taggit
import modelcluster.fields
import wagtail.contrib.routable_page.models
import wag... | hellowebbooks/hellowebbooks-website | blog/migrations/0001_initial.py | Python | mit | 5,381 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Coding\Python\PythonPackageLinks\dataquick\plugins\visualizations\ui\psd.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_PSD(ob... | vincentchevrier/dataquick | dataquick/plugins/visualizations/ui/psd.py | Python | mit | 1,775 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
# TODO: put package requirements... | nbargnesi/proxme | setup.py | Python | mit | 1,716 |
from dataworkflow.data import get_data
import pandas as pd
def test_data():
data = get_data()
assert all(data.columns == ['Survived', 'Pclass', 'Sex', 'Age', 'SibSp', 'Parch', 'Fare',
'Embarked', 'FamilyTot', 'FamStatus', 'age_group'])
assert all([len(data[col]) == 891
for col in ... | jco44/UdacityDataAnalysis | dataworkflow/tests/test_data.py | Python | mit | 551 |
# Fluent Python Book
# List comprehensions are faster than for-loops
import time
from random import choices
symbols = list('abcdefghijklmn')
print(symbols)
symbols_big = choices(symbols, k=2000000)
# print(symbols_big)
start = time.time()
ord_list1 = []
for sym in symbols_big:
ord_list1.append(ord(sym))
# print... | suresh/notebooks | fluentpy/list_comprehension.py | Python | mit | 968 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core Developers
// Copyright (c) 2015 Solarminx
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework import SolariTestFramework
from solarirpc.authproxy import... | CoinAge-DAO/solari | qa/rpc-tests/getblocktemplate_proposals.py | Python | mit | 6,404 |
# Created by PyCharm Pro Edition
# User: Kaushik Talukdar
# Date: 30-03-17
# Time: 11:35 PM
# tuple can't be modified but the variable holding a tuple can be assigned new values
# basically changing the tuple
cars = ["bmw", "rollsroyce", "audi", "ferrari"]
... | KT26/PythonCourse | 3. Working with lists/17.py | Python | mit | 397 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from flexget.utils import json
class TestUserAPI(object):
config = 'tasks: {}'
def test_change_password(self, execute_task, api_client):
weak_password = {'pa... | qvazzler/Flexget | tests/test_user.py | Python | mit | 955 |
#-*- coding: UTF-8 -*-
from django.db.models import F
from celery.task import *
from datetime import timedelta, datetime
from app.models import CustomUser
from django.utils.translation import activate,deactivate
"""
Note: the api of twitter retards 1 minute (more or less) the update of the update_date
"""
@task
def fo... | eduherraiz/foowill | tasks.py | Python | mit | 3,869 |
from flask_restful import Resource, Api
from flask_restful_swagger import swagger
from flauthority import app
from flauthority import api, app, celery, auth
from ModelClasses import AnsibleCommandModel, AnsiblePlaybookModel, AnsibleExtraArgsModel
import celery_runner
class TaskStatus(Resource):
@swagger.op... | trondhindenes/Flauthority | flauthority/api_task_status.py | Python | mit | 1,886 |
"""
WSGI config for roastdog 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/dev/howto/deployment/wsgi/
"""
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
import os
os.envir... | chrisvans/roastdoge | config/wsgi.py | Python | mit | 422 |
# 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.
# -----------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/monitor/azure-monitor-query/azure/monitor/query/aio/__init__.py | Python | mit | 492 |
import sublime, sublime_plugin, tempfile, os, re;
global g_current_file;
global g_last_view;
g_current_file = None;
g_last_view = None;
# Two methods that could be used here:
# get language name
# check if .sublime-build exists for language name
# if it doesn't, somehow get the file extension
# check for .subli... | Pugsworth/ScratchPad | ScratchPad.py | Python | mit | 3,907 |
"""
Demonstrate how to use major and minor tickers.
The two relevant userland classes are Locators and Formatters.
Locators determine where the ticks are and formatters control the
formatting of ticks.
Minor ticks are off by default (NullLocator and NullFormatter). You
can turn minor ticks on w/o labels by setting t... | bundgus/python-playground | matplotlib-playground/examples/pylab_examples/major_minor_demo1.py | Python | mit | 1,698 |
from unittest import TestCase
import trafaret as t
from trafaret_validator import TrafaretValidator
class ValidatorForTest(TrafaretValidator):
t_value = t.Int()
value = 5
class ValidatorForTest2(ValidatorForTest):
test = t.String()
class TestMetaclass(TestCase):
def test_metaclass(self):
... | Lex0ne/trafaret_validator | tests/test_metaclass.py | Python | mit | 1,906 |
# collections.abc new as of 3.3, and collections is deprecated. collections
# will be unavailable in 3.9
try:
import collections.abc as collections
except ImportError:
import collections
import datetime
import logging
try:
import json
except ImportError:
import simplejson as json
import re
def get_l... | thefactory/marathon-python | marathon/util.py | Python | mit | 2,499 |
from decimal import Decimal
from django.core.management.base import BaseCommand
from openpyxl import load_workbook
from contracts.models import PriceName, PriceCoast
from directory.models import Researches
class Command(BaseCommand):
def add_arguments(self, parser):
"""
:param path - файл с карт... | moodpulse/l2 | users/management/commands/price_import.py | Python | mit | 1,880 |
class O(object): pass
class A(O): pass
class B(O): pass
class C(O): pass
class D(O): pass
class E(O): pass
class K1(A,B,C): pass
class K2(D,B,E): pass
class K3(D,A): pass
class Z(K1,K2,K3): pass
print K1.__mro__
print K2.__mro__
print K3.__mro__
print Z.__mro__
| ArcherSys/ArcherSys | skulpt/test/run/t242.py | Python | mit | 262 |
class FakeFetcher(object):
"""
Used i.e. in Harvest tracker when we need credentials but don't fetcher
"""
def __init__(self, *args, **kwargs):
pass
def fetch_user_tickets(self, *args, **kwargs):
pass
def fetch_all_tickets(self, *args, **kwargs):
pass
def fetch_b... | stxnext/intranet-open | src/intranet3/intranet3/asyncfetchers/fake.py | Python | mit | 416 |
import os
import json
import pandas
import numpy
from IPython.display import HTML
from datetime import datetime
import pandas_highcharts.core
title_name = 'Tasks'
file_name = 'tasks.csv'
css_dt_name = '//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css'
js_dt_name = '//cdn.datatables.net/1.10.12/js/jquery.data... | llby/tasks-for-notebook | tasks_for_notebook/tasks_for_notebook.py | Python | mit | 3,217 |
class UnknownAccess(Exception):
"""
Access doesn't exist for this user.
"""
pass
| novafloss/django-formidable | formidable/exceptions.py | Python | mit | 99 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# system
import os
import sys
dir = os.path.split(os.path.split(os.path.split(os.path.realpath(__file__))[0])[0])[0]
sys.path.append(os.path.join(dir, 'scripts'))
# testing
import mock
import unittest
from mock import patch
# program
import setup.load as Config
import setup.... | luiscape/hdxscraper-violation-documentation-center-syria | tests/unit/test_setup.py | Python | mit | 1,648 |
#!/usr/bin/env python
# Copyright (C) 2006-2010, University of Maryland
#
# 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... | reflectometry/direfl | setup_py2exe.py | Python | mit | 12,830 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import hexlify,... | cevap/ion | test/functional/test_framework/util.py | Python | mit | 22,607 |
import sys
from aimes.emgr.utils import *
__author__ = "Matteo Turilli"
__copyright__ = "Copyright 2015, The AIMES Project"
__license__ = "MIT"
# -----------------------------------------------------------------------------
def write_skeleton_conf(cfg, scale, cores, uniformity, fout):
'''Write a skeleton configu... | radical-cybertools/aimes.emgr | src/aimes/emgr/workloads/skeleton.py | Python | mit | 1,336 |
from yos.rt import BaseTasklet
from yos.ipc import Catalog
class CatalogExample(BaseTasklet):
def on_startup(self):
Catalog.store('test1', 'test2', catname='test3')
Catalog.get('test1', self.on_read, catname='test3')
def on_read(self, val):
if val == 'test2':
print... | piotrmaslanka/systemy | examples/catalogExample.py | Python | mit | 382 |
import numpy as np
class Stock:
"""
Class to represent the data and ratios of a stock.
"""
def __init__(self, eps, dps, roe=0):
'''
eps: earnings per share.
dps: dividends per share.
roe: fractional return on equity, default to 0.
'''
self.eps = n... | conceptric/pyinvest | pyinvest/stock.py | Python | mit | 1,365 |
#-*- coding: utf-8 -*-
import argparse
import numpy as np
parser = argparse.ArgumentParser(description='Configuration file')
arg_lists = []
def add_argument_group(name):
arg = parser.add_argument_group(name)
arg_lists.append(arg)
return arg
def str2bool(v):
return v.lower() in ('true', '1')
# Network
net... | MichelDeudon/neural-combinatorial-optimization-rl-tensorflow | Self_Net_TSP/config.py | Python | mit | 3,341 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
with open('README.rst') as file:
long_description = file.read()
except IOError:
long_description = 'Python lib for sniffets.com'
setup(
name='sniffets',
packages=['sniffets'],
version='0.1.8... | behconsci/sniffets-python | setup.py | Python | mit | 749 |
from distutils.core import setup
setup (
name = 'quaternion_class'
author = 'Matthew Nichols'
author_email = 'mattnichols@gmail.com'
packages = ['quaternion']
package_dir = {'quaternion':src}
) | mlnichols/quaternion_class | setup.py | Python | mit | 214 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
from csvkit import sql
from csvkit import table
from csvkit import CSVKitWriter
from csvkit.cli import CSVKitUtility
class CSVSQL(CSVKitUtility):
description = 'Generate SQL statements for one or more CSV files, create execute those statements dir... | gepuro/csvkit | csvkit/utilities/csvsql.py | Python | mit | 7,388 |
from django.db import models
from django.core.exceptions import ValidationError
from django.db.models.fields.related import ForeignObject
try:
from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor
except ImportError:
from django.db.models.fields.related import ReverseSingleRelatedOb... | jamesaud/se1-group4 | address/models.py | Python | mit | 9,864 |
# -*- coding: utf-8 -*-
import re
# from flask_restful import inputs
# objectid = inputs.regex('^[0-9a-z]{24}$')
def objectid(value):
message = 'ciao'
if not value:
return None
pattern = re.compile('^[0-9a-z]{24}$')
if not pattern.match(value):
raise ValueError(message)
retu... | iceihehe/easy-note | app/validators.py | Python | mit | 329 |
# SharePlum
# This library simplfies the code necessary
# to automate interactions with a SharePoint
# server using python
from .office365 import Office365 # noqa: F401
from .site import Site # noqa: F401
from .version import __version__ # noqa: F401
__all__ = ["site", "office365"]
__title__ = "SharePlum SharePoin... | jasonrollins/shareplum | shareplum/__init__.py | Python | mit | 360 |
import copy
import os
import re
import subprocess
from conans.client import tools
from conans.client.build.visual_environment import (VisualStudioBuildEnvironment,
vs_build_type_flags, vs_std_cpp)
from conans.client.tools.oss import cpu_count
from conans.client.tools... | memsharded/conan | conans/client/build/msbuild.py | Python | mit | 12,275 |
"""core 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-based... | vrcmarcos/django-http-model | core/urls.py | Python | mit | 876 |
import logging
import numpy as np
import os
import subprocess
import tempfile
from . import scene
from . import rman
ZERO = scene.npvector((0, 0, 0))
_film = rman.Identifier(
'Film', positional=['string'],
named={
'xresolution': 'integer',
'yresolution': 'integer',
'cropwindow': 'fl... | eterevsky/animations | pyrene/pbrt.py | Python | mit | 4,687 |
#!/usr/bin/env python
"""
Generates an AXI Stream demux wrapper with the specified number of ports
"""
import argparse
from jinja2 import Template
def main():
parser = argparse.ArgumentParser(description=__doc__.strip())
parser.add_argument('-p', '--ports', type=int, default=4, help="number of ports")
p... | alexforencich/xfcp | lib/eth/lib/axis/rtl/axis_demux_wrap.py | Python | mit | 5,899 |
import os
import runpy
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General c... | pyhmsa/pyhmsa | doc/source/conf.py | Python | mit | 10,278 |
#! /usr/python
'''
///////////////////////////////////////////////////////////
// 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... | RobertIan/ethoStim | individualtesting/trial.py | Python | mit | 7,935 |
# coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: support@saltedge.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class CategoriesRequest... | ltowarek/budget-supervisor | third_party/saltedge/swagger_client/models/categories_request_body.py | Python | mit | 3,130 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-13 10:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0003_auto_20170913_1007'),
]
operations = [
migrations.AlterFiel... | hqpr/findyour3d | findyour3d/company/migrations/0004_auto_20170913_1043.py | Python | mit | 533 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
if __name__ == "__main__":
settings_name = "settings.local" if os.name == 'nt' else "settings.remote"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_name)
from django.core.management import execute_from_command_line
execute_... | alexeiramone/django-default-template | manage.py | Python | mit | 348 |
# -*- coding: utf-8 -*-
__version__ = "1.2.3"
| ivanyu/idx2numpy | idx2numpy/version.py | Python | mit | 47 |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import re
import unittest2
import warnings
import httpretty as hp
from coinbase.client import Client
from coinbase.client import OAuthClient... | jorilallo/coinbase-python | tests/test_model.py | Python | mit | 39,379 |
from engine.constants import BOARD_INDEX, C_PERM_INDEX, WK_SQ_INDEX, BK_SQ_INDEX, EN_PAS_INDEX, NORTH, SOUTH, \
RANK2, RANK7, WKC_INDEX, WQC_INDEX, BKC_INDEX, BQC_INDEX, CASTLE_VOIDED, CASTLED, A1, A8, E1, E8, C1, C8, G1, \
G8, H1, H8, WHITE, BLACK, HALF_MOVE_INDEX, FULL_MOVE_INDEX, TURN_INDEX, B8, B1, D1, D8, ... | ElliotVilhelm/IZII | engine/move.py | Python | mit | 5,236 |
""" 1. Parse log file of a webserver
2. Print the filename and number of bytes delivered for 200 responses
"""
import re
import sys
from os import path
import operator
import itertools
log_file_path = "server.log"
log_data = []
pattern = re.compile(r'\[(?P<time>.+)\](\s+\")(?P<requestType>\w+)(\s+)(?P<fileName>.... | mudragada/util-scripts | PyProblems/LogFileProcessing/logFileParser.py | Python | mit | 1,318 |
import datetime
from flask.ext.bcrypt import generate_password_hash
from flask.ext.login import UserMixin
from peewee import *
DATABASE = SqliteDatabase(':memory:')
class User(Model):
email = CharField(unique=True)
password = CharField(max_length=100)
join_date = DateTimeField(default=dateti... | CaseyNord/Treehouse | Build a Social Network with Flask/form_view/models.py | Python | mit | 710 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import setuptools
from setuptools import setup, find_packages
if setuptools.__version__ < '0.7':
raise RuntimeError("setuptools must be newer than 0.7")
version = "0.1.3"
setup(
name="pinger",
version=version,
author="Pedro Palhares (pedrospdc)",
aut... | pedrospdc/pinger | setup.py | Python | mit | 939 |
#Copyright Mir Immad - RealTimeCam
import cv2
import numpy as np
class VideoCamera(object):
def __init__(self):
self.video = cv2.VideoCapture(0)
def __del__(self):
self.video.release()
def get_frame(self):
success, image = self.video.read()
ret, jpeg = cv2.imencode('.jpg', image)
return jpeg.tostrin... | mirimmad/LiveCam | _camera.py | Python | mit | 325 |
"""
Implements counterwallet asset-related support as a counterblock plugin
DEPENDENCIES: This module requires the assets module to be loaded before it.
Python 2.x, as counterblock is still python 2.x
"""
import os
import sys
import time
import datetime
import logging
import decimal
import urllib.request
import urlli... | CounterpartyXCP/counterblock | counterblock/lib/modules/dex/__init__.py | Python | mit | 32,660 |
def Woody():
# complete
print "Reach for the sky but don't burn your wings!"# this will make it much easier in future problems to see that something is actually happening | forgeousgeorge/new_dir | code.py | Python | mit | 179 |
import subprocess
import re
import os
from app import util
BLAME_NAME_REX = re.compile(r'\(([\w\s]+)\d{4}')
def git_path(path):
"""Returns the top-level git path."""
dir_ = path
if os.path.isfile(path):
dir_ = os.path.split(path)[0]
proc = subprocess.Popen(
['git', 'rev-parse', '--sh... | harveyr/thunderbox | app/lintblame/git.py | Python | mit | 2,301 |
# -*- coding: utf-8 -*-
from django.urls import reverse_lazy
from django.shortcuts import redirect
from itertools import chain
from datetime import datetime
from decimal import Decimal
from djangosige.apps.base.custom_views import CustomDetailView, CustomCreateView, CustomListView
from djangosige.apps.estoque.forms... | thiagopena/djangoSIGE | djangosige/apps/estoque/views/movimento.py | Python | mit | 12,100 |
import serial
port = "COM5"
baud = 19200
try:
ser = serial.Serial(port, baud, timeout=1)
ser.isOpen() # try to open port, if possible print message and proceed with 'while True:'
print ("port is opened!")
except IOError: # if port is already opened, close it and open it again and print message
... | YaguangZhang/EarsMeasurementCampaignCode | Trials/lib/Trial6_pySerial_Mod.py | Python | mit | 857 |
import spacy
nlp = spacy.load('en')
text = open('customer_feedback_627.txt').read()
doc = nlp(text)
for entity in doc.ents:
print(entity.text, entity.label_)
# Determine semantic similarities
doc1 = nlp(u'the fries were gross')
doc2 = nlp(u'worst fries ever')
doc1.similarity(doc2)
# Hook in your own deep learni... | iwxfer/wikitten | library/nlp/semantic_simi.py | Python | mit | 376 |
import csv
import json
import random
import os
import re
import itertools
import shutil
currentDatabase = ''
def showDatabases():
return (next(os.walk('./db'))[1])
def createDatabase(databaseName):
newDatabaseDirectory = (r'./db/') + databaseName
if not os.path.exists(newDatabaseDirectory):
#Create directory
... | cor14095/probases1 | Back-end/csvHandler.py | Python | mit | 41,975 |
import os, sys, re
import optparse
import shutil
import pandas
import numpy
import gc
import subprocess
#####################################
#This is a script to combine the output reports from
#Skyline, in preparation for MSstats! Let's get started.
#
#VERSION 0.70A
version="0.70A"
#DATE: 10/11/2016
date="10/11/201... | wohllab/milkyway_proteomics | galaxy_milkyway_files/tools/wohl-proteomics/wohl_skyline/msstats_plots_wrapper.py | Python | mit | 7,436 |
# Python3
import base64
def weirdEncoding(encoding, message):
return base64.b64decode(message, encoding).decode()
| RevansChen/online-judge | Codefights/arcade/python-arcade/level-13/92.Weird-Encoding/Python/solution1.py | Python | mit | 120 |
from qdec_partial import get_ip_name
from qdec_partial import QDEC | hakehuang/pycpld | ips/ip/qdec/__init__.py | Python | mit | 66 |
import sys
## Make sure pyqtgraph is importable
p = os.path.dirname(os.path.abspath(__file__))
p = os.path.join(p, '..', '..')
sys.path.insert(0, p)
from pyqtgraph.Qt import QtCore, QtGui
from DockArea import *
from Dock import *
app = QtGui.QApplication([])
win = QtGui.QMainWindow()
area = DockArea()
win.setCentra... | robertsj/poropy | pyqtgraph/dockarea/__main__.py | Python | mit | 1,587 |
from scrapy import Spider
from scrapy.http import Request
from firmware.items import FirmwareImage
from firmware.loader import FirmwareLoader
class FoscamSpider(Spider):
name = "foscam"
allowed_domains = ["foscam.com"]
start_urls = [
"http://www.foscam.com/download-center/firmware-downloads.html"]... | firmadyne/scraper | firmware/spiders/foscam.py | Python | mit | 1,854 |
from django.utils import simplejson
from dajaxice.decorators import dajaxice_register
from django.utils.translation import ugettext as _
from django.template.loader import render_to_string
from dajax.core import Dajax
from django.db import transaction
from darkoob.book.models import Book, Review
@dajaxice_register(m... | s1na/darkoob | darkoob/book/ajax.py | Python | mit | 2,980 |
from osmcache.cli import base
if __name__ == '__main__':
base()
| kirchenreich/osm-api-cache | osmcache.py | Python | mit | 69 |
"""
Run hugs pipeline.
"""
from __future__ import division, print_function
import os, shutil
from time import time
import mpi4py.MPI as MPI
import schwimmbad
from hugs.pipeline import next_gen_search, find_lsbgs
from hugs.utils import PatchMeta
import hugs
def ingest_data(args):
"""
Write data to database w... | johnnygreco/hugs | scripts/runner.py | Python | mit | 6,693 |
import numpy as np
import networkx
from zephyr.Problem import SeisFDFDProblem
# Plotting configuration
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.ticker as ticker
import matplotlib
matplotlib.rcParams.update({'font.size': 20})
# System / modelling configuration
cellSize = 1 ... | bsmithyman/zephyr | LiveDataDemoBigJobs.py | Python | mit | 3,762 |
import os.path as osp
import os
USE_GPU = False
AWS_REGION_NAME = 'us-east-2'
if USE_GPU:
DOCKER_IMAGE = 'dementrock/rllab3-shared-gpu'
else:
# DOCKER_IMAGE = 'dwicke/jump:docker'
DOCKER_IMAGE = 'dwicke/parameterized:latest'
DOCKER_LOG_DIR = '/tmp/expt'
AWS_S3_PATH = 's3://pytorchrl/pytorchrl/experimen... | nosyndicate/pytorchrl | pytorchrl/config_personal.py | Python | mit | 1,995 |
"""
load score-level asroutput files into a pandas df
"""
import re
import pandas as pd
def mr_csvs():
"""
load data/mr.p and generate two csv files.
:return:
"""
x = pickle.load(open('data/mr.p', "rb"))
revs, W, W2, word_idx_map, vocab = x[0], x[1], x[2], x[3], x[4]
print("mr.p has been l... | leocnj/dl_response_rater | archv/pd_load.py | Python | mit | 2,418 |
#!/usr/bin/env python3
"""
Wikipedia lookup plugin for Botty.
Example invocations:
#general | Me: what is fire
#general | Botty: wikipedia says, "Fire is the rapid oxidation of a material in the exothermic chemical process of combustion, releasing heat, light, and various reaction products. Slower oxid... | DanielHopper/botty-bot-bot-bot | src/plugins/wiki.py | Python | mit | 2,233 |
import logging
import rethinkdb as r
log = logging.getLogger(__name__)
class Database():
def __init__(self, bot):
self.bot = bot
self.db_name = self.bot.config.rname
self.db = None
r.set_loop_type("asyncio")
self.ready = False
def get_db(self):
"""
Re... | jaydenkieran/Turbo | turbo/database.py | Python | mit | 2,402 |
import pygame
import sys
from game import constants, gamestate
from game.ai.easy import EasyAI
from game.media import media
from game.scene import Scene
# List of menu options (text, action_method, condition) where condition is None or a callable.
# If it is a callable that returns False, the option is not s... | dbreen/connectfo | game/scenes/menu.py | Python | mit | 3,374 |
"""
Qizx Python API bindings
:copyright: (c) 2015 by Michael Paddon
:license: MIT, see LICENSE for more details.
"""
from .qizx import (
Client, QizxError, QizxBadRequestError, QizxServerError,
QizxNotFoundError, QizxAccessControlError, QizxXMLDataError,
QizxCompilationError, QizxEvaluationError, QizxTimeo... | qizxdb/qizx-python | qizx/__init__.py | Python | mit | 534 |
# -*- coding: utf-8 -*-
# flake8: noqa
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
('id', models.Au... | nsdont/gogs_ci_demo | superlists/lists/migrations/0001_initial.py | Python | mit | 506 |
import unittest
"""
Given an unordered array of integers, find the length of longest increasing subsequence.
Input: 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
Output: 6 (0, 2, 6, 9, 11, 15)
"""
"""
A great explanation of the approach appears here:
http://www.geeksforgeeks.org/longest-monotonically-increasing... | prathamtandon/g4gproblems | Arrays/longest_increasing_subsequence_nlogn.py | Python | mit | 1,625 |
# -*- coding: latin-1 -*-
#retriever
"""Retriever script for direct download of vertnet-mammals data"""
from builtins import str
from retriever.lib.models import Table
from retriever.lib.templates import Script
import os
from pkg_resources import parse_version
try:
from retriever.lib.defaults import VERSION
except... | goelakash/retriever | scripts/vertnet_mammals.py | Python | mit | 10,514 |
from delta_variance import DeltaVariance, DeltaVariance_Distance
| keflavich/TurbuStat | turbustat/statistics/delta_variance/__init__.py | Python | mit | 66 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-powerbiembedded/azure/mgmt/powerbiembedded/models/check_name_request.py | Python | mit | 1,018 |
#!/usr/bin/python
blank_datafile = '/home/kyleb/Dropbox/UCSF/cas9/FCS/150916-3.1/kyleb/150916-rfp-cas9/96 Well - Flat bottom_002/Specimen_001_F1_F01_046.fcs'
script_output_dir = 'script_output'
sample_directory = '/home/kyleb/Dropbox/UCSF/cas9/FCS/150916-3.1/kyleb/150916-rfp-cas9/96 Well - Flat bottom_002'
rows_in_pl... | Kortemme-Lab/klab | klab/fcm/fcm.py | Python | mit | 18,877 |
#!/usr/bin/env python3
import time
from matrix_client.client import MatrixClient
from matrix_client.api import MatrixRequestError
from requests.exceptions import ConnectionError, Timeout
import argparse
import random
from configparser import ConfigParser
import re
import traceback
import urllib.parse
import logging
imp... | Spferical/matrix-chatbot | main.py | Python | mit | 17,094 |
import os
import urllib
from glob import glob
import dask.bag as db
import numpy as np
import zarr
from dask.diagnostics import ProgressBar
from netCDF4 import Dataset
def download(url):
opener = urllib.URLopener()
filename = os.path.basename(url)
path = os.path.join('data', filename)
opener.retrieve... | osbd/osbd-2016 | slides/crist/get_data.py | Python | mit | 1,419 |
# -*- coding: utf-8 -*-
#
# Optcoretech documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 1 14:23:01 2014.
#
# 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.
#
#... | nishantsingla/optcoretech | docs/conf.py | Python | mit | 7,786 |
import random
class ImageQueryParser:
def __init__(self):
pass
def parse(self, query_string):
tab = query_string.split(" ")
last = tab[-1].lower()
is_random = False
index = 0
if last.startswith("-"):
if last == "-r":
is_random = True... | mamaddeveloper/teleadmin | tools/imageQueryParser.py | Python | mit | 1,079 |
import math
def area(a, b, c):
A1 = ((4*math.pi)*a**2)
A2 = ((4*math.pi)*b**2)
A3 = ((4*math.pi)*c**2)
Avg = (A1+A2+A3)/3
return Avg
def output(a, b ,c , d, e):
return """
Hello there, {}!
equation: ((4*math.pi)*{}**2)((4*math.pi)*{}**2)((4*math.pi)*{}**2)
Calculating average area of three spheres...
the answer... | boss2608-cmis/boss2608-cmis-cs2 | simple.py | Python | cc0-1.0 | 624 |
from turtle import *
shape("turtle")
forward(100)
left(120)
forward(100)
left(120)
forward(100)
left(120)
done()
| arve0/example_lessons | src/python/lessons/Turtle Power/Club Leader Resources/DrawingShapes-triangle.py | Python | cc0-1.0 | 128 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000360',
version=20140916,
description='BIOMD0000000360 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000360',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000360 | setup.py | Python | cc0-1.0 | 377 |
f = open('test_content.txt', 'r')
print(f.read())
f.close()
# using context manager
with open('test_content.txt', 'r') as f:
print(f.read())
| yrunts/python-for-qa | 3-python-intermediate/examples/file.py | Python | cc0-1.0 | 148 |
# file ui_drop_plate_classes.py
import os
from thlib.side.Qt import QtWidgets as QtGui
from thlib.side.Qt import QtGui as Qt4Gui
from thlib.side.Qt import QtCore
from thlib.environment import env_mode, env_inst, env_write_config, env_read_config
import thlib.global_functions as gf
import thlib.ui.checkin_out.ui_drop_... | listyque/TACTIC-Handler | thlib/ui_classes/ui_drop_plate_classes.py | Python | epl-1.0 | 18,599 |
# Python script to perform consistency analysis on metabolic models
# Copyright (C) 2015 Miguel Ponce de Leon
# Contact: miguelponcedeleon@gmail.com
# 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 Foundat... | migp11/consistency-analysis | modules/utils.py | Python | gpl-2.0 | 9,286 |
#
# This file is part of DF.
#
# DF 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 version 3 of the License, or (at your option) any
# later version.
#
# Latassan is distributed in the hope that it ... | jimbotonic/df_nlp | step3/graphs2b.py | Python | gpl-2.0 | 1,385 |
# -*- coding: utf-8 -*-
# @Author: YangZhou
# @Date: 2017-06-16 20:09:09
# @Last Modified by: YangZhou
# @Last Modified time: 2017-06-27 16:02:34
from aces.tools import mkdir, mv, cd, cp, mkcd, shell_exec,\
exists, write, passthru, toString, pwd, debug, ls, parseyaml
import aces.config as config
from aces.bina... | vanceeasleaf/aces | aces/runners/phonopy.py | Python | gpl-2.0 | 19,132 |
from sys import argv
|
| mrniranjan/python-scripts | reboot/math27.py | Python | gpl-2.0 | 24 |
# coding=utf-8
__author__ = 'stasstels'
import cv2
import sys
image = sys.argv[1]
targets = sys.argv[2]
# Load an color image in grayscale
img = cv2.imread(image, cv2.IMREAD_COLOR)
with open(targets, "r") as f:
for line in f:
print line
(_, x, y) = line.split()
cv2.circle(img, (int(x), int(y))... | OsipovStas/ayc-2013 | ayc/show.py | Python | gpl-2.0 | 455 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# Developped with python 2.7.3
import os
import sys
import tools
import json
print("The frame :")
name = raw_input("-> name of the framework ?")
kmin = float(raw_input("-> Minimum boundary ?"))
kmax = float(raw_input("-> Maximum boundary ?"))
precision = float(raw_input("-> ... | tchaly-bethmaure/Emotes | script/script_tools/framework_file_generator.py | Python | gpl-2.0 | 1,143 |
class Controller(object):
def __init__(self, model):
self._model = model
self._view = None
def register_view(self, view):
self._view = view
def on_quit(self, *args):
raise NotImplementedError
def on_keybinding_activated(self, core, time):
raise... | benpicco/mate-deskbar-applet | deskbar/interfaces/Controller.py | Python | gpl-2.0 | 1,455 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.