code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
"""
WSGI config for firstproject 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "firstproject.settings")
from dja... | ilee/projects | django/firstproject/firstproject/wsgi.py | Python | mit | 399 |
def f1():
while True:
x = [] | Microsoft/pxt | tests/pyconverter-test/cases/empty_array_declaration.py | Python | mit | 40 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
from . import agent
# Import them to register agents.
from .rule_based import basic
__author__ = 'fyabc'
def get_agent_by_name(name):
return agent.Agent.AgentClasses[name]
__all__ = [
'get_agent_by_name',
]
| fyabc/MiniGames | HearthStone2/MyHearthStone/ai/standard.py | Python | mit | 265 |
# -*- coding: utf-8 -*-
#
# Fuel documentation build configuration file, created by
# sphinx-quickstart2 on Wed Oct 8 17:59:44 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.
#
# All... | mducoffe/fuel | docs/conf.py | Python | mit | 9,405 |
import oi
import os
import sys
import logging
from logging.handlers import SysLogHandler
import time
import service
try:
import config
except ImportError:
import example1.config as config
def stop_function():
ctl = oi.CtlProgram('ctl program', config.ctl_url)
ctl.call('stop')
ctl.client.close()
c... | janjaapbos/nanotest | example1/example1/example1svc.py | Python | mit | 3,143 |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from forms import GenerateForm, SubmitForm
from django.http import HttpResponse, Http404, HttpResponseBadRequest
from django.utils.translation import ugettext as _, ugettext_lazy
from django.db import transaction
from main.mod... | oadam/proprio | bank_import/views.py | Python | mit | 9,434 |
#!/usr/bin/env python
import unittest
import numpy as np
import scipy.sparse as sp
import smurff
def matrix_with_explicit_zeros():
matrix_rows = np.array([0, 0, 1, 1, 2, 2])
matrix_cols = np.array([0, 1, 0, 1, 0, 1])
matrix_vals = np.array([0, 1, 0, 1, 0, 1], dtype=np.float64)
matrix = sp.coo_matri... | ExaScience/smurff | python/test/test_scarce.py | Python | mit | 1,034 |
from followthemoney import model
from ingestors.ingestor import Ingestor
class DirectoryIngestor(Ingestor):
"""Traverse the entries in a directory."""
MIME_TYPE = "inode/directory"
SKIP_ENTRIES = [".git", ".hg", "__MACOSX", ".gitignore"]
def ingest(self, file_path, entity):
"""Ingestor imp... | alephdata/ingestors | ingestors/directory.py | Python | mit | 1,551 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-03-11 19:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('boards', '0055_auto_20170311_0321'),
]
operations = [
migrations.AddField(
... | diegojromerolopez/djanban | src/djanban/apps/boards/migrations/0056_auto_20170311_2036.py | Python | mit | 866 |
import ctypes
import graph_partitioning.partitioners.utils as putils
from graph_partitioning.partitioners.patoh.parameters import PATOHParameters
'''
Usage:
# Load the library
libPath = 'path/to/libpatoh.dylib' # .so for linux
lib = LibPatoh(libraryPath = libPath)
lib.load()
# Check library is Loaded
if lib.libIsLo... | sbarakat/graph-partitioning | graph_partitioning/partitioners/patoh/patoh.py | Python | mit | 5,305 |
# -*- coding: utf-8 -*-
'''
File encryption for stash
Uses AES in CBC mode.
usage: crypt.py [-h] [-k KEY] [-d] infile [outfile]
positional arguments:
infile File to encrypt/decrypt.
outfile Output file.
optional arguments:
-h, --help show this help message and exit
-k KEY, --ke... | ywangd/stash | bin/crypt.py | Python | mit | 2,462 |
import numpy as np
#python ../../../../Modeling/modelData.py ../../../Costa_Rica.p bon2 ../bon2.fun
print 'a' | nvoss12838/gpsFIT | plotFit.py | Python | mit | 111 |
from .context_processor import context_processor
| paulfurley/django-google-analytics | __init__.py | Python | mit | 49 |
# Functions and Variables
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print "You have %d cheeses!" % cheese_count
print "You have %d boxes of crackers!" % boxes_of_crackers
print "Man that's enough for a party!"
print "Get a blanket.\n"
print "We can just give the function numbers direct... | myisabella/LearnPythonTheHardWay | ex19.py | Python | mit | 712 |
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/index')
def index():
#jsonObj = request.json_get('txt') non funziona perchè lo script serverSide può essere eseguito una volta soltanto
return render_template('index.html')
@app.route('/process', methods = ['GET', '... | wibox/Posting-JSON-data-to-Flask-server | __init__.py | Python | mit | 541 |
# Name: Pre-Logic Script Code
# Created: April, 27, 2015
# Author: Sven Koberwitz
# Purpose: Find the number of occurrences of a value in a Field using Field Calculator.
## Pre-Logic Script Code
import arcpy
uniqueList = {}
## Set the name of the feature class here
fc = "feature_class"
rows = arcpy.SearchCursor(fc)... | skobz/Python | Find_Duplicates.py | Python | mit | 651 |
# Copyright 2016, 2017, 2018, 2019, 2020 Joachim Wolff
# PhD Thesis
#
# Copyright 2015, 2016 Joachim Wolff
# Master Thesis
# Tutor: Fabrizio Costa
# Winter semester 2015/2016
#
# Chair of Bioinformatics
# Department of Computer Science
# Faculty of Engineering
# Albert-Ludwigs-University Freiburg im Breisgau
__author_... | joachimwolff/minHashNearestNeighbors | sparse_neighbors_search/neighbors/wtaHashClassifier.py | Python | mit | 15,173 |
import sys, time
from django.conf import settings
from django.db import connection, transaction, backend
from django.core import management, mail
from django.dispatch import dispatcher
from django.test import signals
from django.template import Template
# The prefix to put on the default database name when creating
# ... | jonaustin/advisoryscan | django/django/test/utils.py | Python | mit | 6,373 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfullargspec
except Im... | cliffano/swaggy-jenkins | clients/python-legacy/generated/openapi_client/models/pipelinelatest_run.py | Python | mit | 14,032 |
import json
import csv
meta = json.load(file("country_meta.json"))
pop = csv.reader(file("country_pop.csv"))
tempdata = {}
for country in meta:
fields = country['fields']
tempdata[fields['name'].title()] = {
"id": fields['iso_3166_1_numeric'],
"name": fields['name'].title(),
"three": f... | llimllib/bostonmarathon | maps/makejson.py | Python | mit | 963 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HMM2_then2_IsolatedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HMM2_then2_IsolatedLHS.
"""
# Flag this instanc... | levilucio/SyVOLT | UMLRT2Kiltera_MM/Properties/from_thesis/HMM2_then2_IsolatedLHS.py | Python | mit | 2,493 |
from flask import render_template, redirect, request, url_for, flash
from . import auth
from ..models import User
from .forms import LoginForm, RegistrationForm
from flask_login import login_user, logout_user, login_required, current_user
from .. import db
from ..email import send_email
@auth.route('/login', methods=... | bobbyxuy/flask_web | app/auth/views.py | Python | mit | 1,344 |
# -*- coding: utf-8 -*-
__author__ = "Konstantin Klementiev", "Roman Chernikov"
__date__ = "07 Jan 2016"
PI = 3.1415926535897932384626433832795
PI2 = 6.283185307179586476925286766559
SQRT2PI = PI2**0.5 # =2.5066282746310002
SQ3 = 1.7320508075688772935274463415059
SQ2 = 2**0.5 # =1.4142135623730951
SQPI = PI**0.5 # ... | kklmn/xrt | xrt/backends/raycing/physconsts.py | Python | mit | 1,189 |
#!/usr/bin/env python
import sys
from subprocess import call
from time import sleep
# test_parser.py <file>
if len(sys.argv) != 2:
print('usage: node.py <file>')
sys.exit(2)
with open(sys.argv[1]) as f:
lines = f.readlines()
for line in lines:
entry = line.split(', ')
entry[-1] = entry[-1][:-1]
... | skatsaounis/dht-chord-simulator | examples/test_units/test_parser.py | Python | mit | 981 |
import nmap
from prettytable import PrettyTable
# scan network - dispaly all opened ports in given range
nm = nmap.PortScanner()
nm.scan('156.17.40.1-255', '22-443')
tab = PrettyTable(["IP address", "Protocol", "Port", "Product name",
"Version", "Extra info"])
for host in nm.all_hosts():
for... | piotrgiedziun/university | secure_system_networks/lab2/scripts/scan_all.py | Python | mit | 835 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group.py | Python | mit | 1,777 |
from environment.robots.robot2d_base import Robot2dCircular
from environment.robots.robot_utils import *
class HumanSimple(Robot2dCircular):
def __init__(self, size=0.3, max_vel=2.0, max_acc=5.0, uncertainty=0.0):
super(HumanSimple, self).__init__(size)
self.max_v = max_vel
self.max_acc =... | yuhangc/planning_algorithms | environment/robots/humans.py | Python | mit | 1,684 |
"""
Predicting potential dopants
"""
import warnings
import numpy as np
from pymatgen.analysis.structure_prediction.substitution_probability import (
SubstitutionPredictor,
)
from pymatgen.core.periodic_table import Element, Species
def get_dopants_from_substitution_probabilities(structure, num_dopants=5, thre... | vorwerkc/pymatgen | pymatgen/analysis/structure_prediction/dopant_predictor.py | Python | mit | 7,420 |
from django.contrib import admin
from django.contrib.admin import ModelAdmin
from paywall.models import PaymentEntry
@admin.register(PaymentEntry)
class PaymentEntryAdmin(ModelAdmin):
pass
| cypreess/django-getpaid | example/paywall/admin.py | Python | mit | 195 |
import subprocess
import os
from datepoints import GithubDatePoints
from pixelsets import LettersPixelSet
class Github(object):
def __init__(self, string, cwd, dictionary):
self.__string = string
self.__dictionary = dictionary
self.__cwd = os.path.abspath(cwd)
self.commands = []
... | ufocoder/py-GithubArt | github_art/github.py | Python | mit | 1,567 |
# coding: utf-8
from django.db.models import Q
from django.views import generic
# from django.views.generic.dates import (YearArchiveView, MonthArchiveView,
# DayArchiveView)
from esperancanordeste.context_processors import EnterpriseExtraContext
from esperancanordeste.catalog.... | klebercode/esperancanordeste | esperancanordeste/catalog/views.py | Python | mit | 2,030 |
import TCP
import Steering
import Motor
import time
"""
add
print "right speed: " + str(right_speed)
print "left speed: " + str(left_speed)
under
def receive_message(self, type, message):
if (type == "Gyro" and self.stop == False):
and comment out
self.motors.set_right_speed(right_speed)
self.motors.set_left_... | task123/AutoTT | scriptsForTesting/steeringTest.py | Python | mit | 823 |
import six
from rest_framework.test import APITestCase
from dynamic_rest.prefetch import FastPrefetch, FastQuery
from tests.models import Group, Location, Profile, User, Cat
from tests.setup import create_fixture
class TestFastQuery(APITestCase):
def setUp(self):
self.fixture = create_fixture()
de... | AltSchool/dynamic-rest | tests/test_prefetch2.py | Python | mit | 5,776 |
#----------------------------------------------------------------------
# Copyright (c) 2011-2015 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | plantigrade/geni-tools | src/gcf/omnilib/frameworks/framework_base.py | Python | mit | 14,946 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.worlds import World
class CrowdDataWorld(World):
def prep_save_data(self, workers):
"""
... | facebookresearch/ParlAI | parlai/crowdsourcing/utils/worlds.py | Python | mit | 3,648 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-06 18:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0011_auto_20170306_1758'),
]
operations = [
migrations.AlterFi... | R-Wolf/CFD_A_library | catalogue/migrations/0012_auto_20170306_1811.py | Python | mit | 457 |
#!/usr/bin/env python3
from classes.myqueue import MyQueue
import time # time.sleep(0.02)
import random # random.randint(1, 100)
import socket # socket.gethostname()
import sys
import argparse
CONF_DB = {
'server': 'localhost',
'user': 'root',
'pass': 'x',
'db': 'myqueue'
}
def worker_create(q, amount... | garmann/playground | python/python_mysql_queue/app.py | Python | mit | 2,098 |
"""
Телефонен указател
Задачата е да се напишат функции, които работят като телефонен указател.
Телефонният указател трябва да се съхранява във файл.
Телефоните се представят като речник с две полете:
- `name` - име на човек
- `phone` - телефоне номер
Например:
{
'name': 'Ivan',
'phone': '... | YAtOff/python0-reloaded | projects/hard/phonebook/phonebook.py | Python | mit | 5,283 |
from setuptools import setup
setup(name='poly',
version='0.1',
description='A Python Polynomial Library',
author='Michele Lacchia',
author_email='michelelacchia@gmail.com',
license='MIT',
url='http://poly.readthedocs.org/',
download_url='http://github.com/rubik/poly/downloads... | rubik/poly | setup.py | Python | mit | 867 |
class AlarmState:
"""Helper class for alarm state functionality."""
@staticmethod
def get_initial_alarm_state(maxZones, maxPartitions):
"""Builds the proper alarm state collection."""
_alarmState = {'partition': {}, 'zone': {}}
for i in range(1, maxPartitions + 1):
_al... | jnimmo/pyenvisalink | pyenvisalink/alarm_state.py | Python | mit | 1,289 |
#-*- coding: utf-8 -*-
"""
Copyright (c) 2012 University of Oxford
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, modify... | fcrepo4-archive/RDFDatabank | rdfdatabank/config/users.py | Python | mit | 1,238 |
import unittest
import mock
from ...management.resource_servers import ResourceServers
class TestResourceServers(unittest.TestCase):
def test_init_with_optionals(self):
t = ResourceServers(domain='domain', token='jwttoken', telemetry=False, timeout=(10, 2))
self.assertEqual(t.client.options.timeo... | auth0/auth0-python | auth0/v3/test/management/test_resource_servers.py | Python | mit | 3,056 |
from numpy import *
from numpy.linalg import norm, svd, inv
__all__ = ['rotate_around_x', 'rotate_around_y', 'rotate_around_z',
'spin_x', 'spin_y', 'spin_z',
'equivalence_transform', 'translate', 'translate_to',
'x_axis_transform', 'y_axis_transform', 'z_axis_transform']
c... | Jonestj1/mbuild | mbuild/coordinate_transform.py | Python | mit | 18,613 |
import csv
import math
import numpy as np
from PIL import Image
width = 854
height = 480
fov_multiplier = 1.73 # For 60 degrees, set to 1.73. For 90 degrees, set to 1.
minwh2 = 0.5 * min(width, height)
class Star:
def __init__(self, ra, dec, parallax, g_flux, bp_flux, rp_flux):
self.ra = ra
self... | j3camero/galaxyatlas | data-release-2/render-lmc-frames.py | Python | mit | 5,728 |
from characteristic import Attribute, attributes
from rply.token import BaseBox
from rpython.tool.pairtype import extendabletype
class Node(BaseBox):
# Allows using __extend__ to extend the type
__metaclass__ = extendabletype
@attributes(
[
Attribute(name="operator"),
Attribute(name="lef... | Magnetic/cycy | cycy/parser/ast.py | Python | mit | 7,047 |
from __future__ import absolute_import
import requests
from .helper import utils
class Totalvoice(object):
def __init__(self, cliente):
self.cliente = cliente
def enviar(self, *args):
raise NotImplementedError
def get_by_id(self, id):
raise NotImplementedError
def... | totalvoice/totalvoice-python | totalvoice/cliente/api/totalvoice.py | Python | mit | 1,052 |
import unittest
PAGE_SIZE = 16
class BtreeList(object):
def __init__(self):
self._root = Page(True)
def __iadd__(self, item):
right = self._root.add_item(item)
if right is not self._root:
left = self._root
self._root = Page(False)
self._root.add_pa... | Alex-Diez/python-tdd-katas | b_tree_list_kata/day_10.py | Python | mit | 3,899 |
class Solution(object):
def getHint(self, secret, guess):
"""
:type secret: str
:type guess: str
:rtype: str
"""
# this is actually slower than method 1, which does not use mapping function to create dictionary.
secretTable = {x:0 for x in xrange(10)}
... | comicxmz001/LeetCode | Python/299_Bulls_and_Cows_method2.py | Python | mit | 940 |
"""add canonical domain column to account
Revision ID: 1efbbd8d6721
Revises: 1e0b325c185e
Create Date: 2013-05-10 01:10:14.676068
"""
# revision identifiers, used by Alembic.
revision = '1efbbd8d6721'
down_revision = '1e0b325c185e'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
... | glennyonemitsu/MarkupHiveServer | alembic/versions/20130510011014-add_canonical_domain.py | Python | mit | 482 |
__author__ = 'vialette'
# coding=utf-8
"""Uniform imeout generator: integer uniform distribution
.. moduleauthor:: Stéphane Vialette <vialette@gmail.com>
"""
from .timeoutgenerator import TimeoutGenerator
import numpy
class Exponential(TimeoutGenerator):
def __init__(self, scale = 100):
super(self.__... | vialette/ultrastorage | ultrastorage/timeoutgenerator/exponential.py | Python | mit | 487 |
import subprocess
import sys
from distutils.core import setup, Command
class TestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, 'test_facebook.py'])
raise... | narrowcast/facebook-ads-api | setup.py | Python | mit | 720 |
# coding=utf-8
#
# Copyright 2010 Brave Labs sp. z o.o.
# All rights reserved.
#
# This source code and all resulting intermediate files are CONFIDENTIAL and
# PROPRIETY TRADE SECRETS of Brave Labs sp. z o.o.
# Use is subject to license terms. See NOTICE file of this project for details.
import inspect
from ... | wooyek/glosuj-w-lomiankach | src/flask_multi_view/actions.py | Python | mit | 7,581 |
from pyfurstream.core import APIConnection, api, configure
from pyfurstream.users import User
from pyfurstream.streams import Stream
import time
__version__ = "1.0.0"
def get_user_summaries(users):
'''
Returns the list of user objects for the given list of usernames
Note: The list of objects ... | Dreae/PyFurStream | pyfurstream/__init__.py | Python | mit | 1,719 |
#!/usr/bin/env python
import functools
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sb
import time
import kmc2
from collections import namedtuple
from scipy import stats
from sklearn import cluster
from sklearn.decomposition import TruncatedSVD
from numba import jit
from datasets import load_... | dblalock/dig | tests/exper_bits.py | Python | mit | 34,782 |
BUDDY_PORT = 5000
DBPATH = '.'
REPONAME = ".buddyrepo"
| anupcshan/buddyfs | settings.py | Python | mit | 55 |
#!/usr/bin/env python3
import requests
import xmltodict
import upload
import model
RSS_ENDPOINT = "http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml"
def get_rss():
response = requests.get(RSS_ENDPOINT)
return xmltodict.parse(response.text)["rss"]
def main():
data = get_rss()
for item in data[... | RazvanRotari/iaP | services/uploaders/nytimes.py | Python | mit | 1,016 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import apps
from django.forms import widgets
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from cmsplugin_cascade.fields ... | jtiki/djangocms-cascade | cmsplugin_cascade/link/plugin_base.py | Python | mit | 2,939 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-31 14:17
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('exoral', '0004_merge_20170327_0002'),
('exoral', '0003_auto_20170322_1453'),
]
oper... | fachschaft-medizin-rostock/django-fsmedhro | exoral/migrations/0005_merge_20170331_1617.py | Python | mit | 337 |
n = int(input())
s = input()
letterlist = ['x', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
letter = {}
for l in letterlist:
letter[l] = 0
for i in range(n):
if s[i:i+1] in letterlist:
letter[s[i:i+1]] += 1
if letter['x'] > 0 and letter['0'] > 0:
letter['0'] -=... | dluschan/olymp | lomonosov/num16.py | Python | mit | 550 |
#!/usr/bin/python
import sys
from random import shuffle, seed
from itertools import product
class Card:
FACES = {11: 'Jack', 12: 'Queen', 13: 'King', 14: 'Ace'}
SUITS = {'Hearts': 1, 'Diamonds': 2, 'Spades': 3, 'Clubs': 4}
COLORS = {'Hearts': 0, 'Diamonds': 0, 'Spades': 1, 'Clubs': 1}
def __init__(s... | JFeaux/pedro | src/cards.py | Python | mit | 6,808 |
import string
# The lexer knows two classes of symbols:
# - any number of meta-symbols, which match a single meta-character each.
# this argument is a dictionary mapping meta-characters to symbol classes.
#
# - exactly one terminal symbol, which matches a run of any characters
# but ends as soon as a meta-... | cburschka/modod | src/modod/lexer.py | Python | mit | 2,843 |
import sys
from optparse import OptionParser
import ROOT
from ROOT import *
ROOT.gROOT.SetBatch(ROOT.kTRUE)
from Plotting_Header import *
import numpy as np
parser = OptionParser()
parser.add_option("-d", "--dir", action="store", dest="pwd", default="/home/storage/andrzejnovak/80Trees/", help="directory where files ar... | anovak10/plots | DDTmethod/ROCPlot.py | Python | mit | 3,421 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import typepy
from tabledata import TableData
from pytablereader import DataError
from ..formatter import TableFormatter
class CsvTableFormatter(TableFormatter):
def to_table_data(self):
if typepy.is_empty_sequence(self._loader.hea... | thombashi/pytablereader | pytablereader/csv/formatter.py | Python | mit | 1,206 |
import os
import pandas as pd
from .config import BASE_URL
dirname = os.path.dirname(os.path.abspath(__file__))
df = pd.read_pickle(os.path.join(dirname, 'data.p'))
def get_geo(code, year):
row = df[df['insee_code'] == code]
return row.to_dict('records')[0]
def url_resolver(code, year, region_code, depart... | miroli/frenchy | frenchy/utils.py | Python | mit | 651 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# grab cache file to user path
# used for game factory, grab cached files
# winxos 2014-02-22
import os,sys
import fnmatch
import getpass #get user name
import shutil #copy
from time import sleep
rootdir = os.path.join('C:/Users',getpass.getuser(),'AppData\Local\Microsof... | winxos/python | cache_grab.py | Python | mit | 1,468 |
# /mojp-dbs-pipelines/tests/bagnowka/test_download.py
from datapackage_pipelines_mojp.bagnowka.processors.download import BagnowkaDownloadProcessor
from tests.common import assert_conforms_to_schema, get_mock_settings
import os
import json
import logging
class MockBagnowkaDownloadProcessor(BagnowkaDownloadProcessor)... | Beit-Hatfutsot/mojp-dbs-pipelines | tests/bagnowka/test_download.py | Python | mit | 3,159 |
import re
def get_attributes(parent, selector, attribute):
"""Get a list of attribute values for child elements of parent matching the given CSS selector"""
return [child.get(attribute) for child in parent.cssselect(selector)]
def get_attribute(parent, selector, attribute, index=0):
"""Get the attribute value f... | JayTeeGeezy/pypunters | pypunters/html_utils.py | Python | mit | 5,608 |
""" Module to call fastqc in pipeline"""
import os
import subprocess
import argparse
import logging
__author__ = "YiDing Fang"
__maintainer__ = "YiDing Fang"
__email__ = "yif017@eng.ucsd.edu"
__status__ = "prototype"
def form_fastqc_cmd_list(fastqc_fp, fastq_fp, outdir):
"""Generate argument list to be given as... | ucsd-ccbb/jupyter-genomics | src/microbiome/exec_fastqc.py | Python | mit | 3,451 |
# Generated by Django 2.2.24 on 2021-10-21 02:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("cases", "0015_case_is_quarantied"),
]
operations = [
migrations.AddIndex(
model_name="case",
index=models.Index(
... | watchdogpolska/feder | feder/cases/migrations/0016_auto_20211021_0245.py | Python | mit | 423 |
#!/usr/bin/python
# coding=utf-8
"""
Cube finding program.
"""
from __future__ import division # so 1/2 returns 0.5 instead of 0
from rotation import *
import cv2
import cube
import geom
import imag
import numpy as np
from gates import QuantumOperation
# entangle = [QuantumOperation(Rotation(x=0.25).as_pauli_opera... | Strilanc/Qubery | src/CubeFinder.py | Python | mit | 11,417 |
# 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-web/azure/mgmt/web/operations/domains_operations.py | Python | mit | 52,494 |
# from bigcommerce.connection import Connection, OAuthConnection, HttpException, ClientRequestException, \
# EmptyResponseWarning, RedirectionException, ServerException
import bigcommerce.resources
import bigcommerce.api
| hockeybuggy/bigcommerce-api-python | bigcommerce/__init__.py | Python | mit | 225 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-09-19 18:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vmleases', '0001_initial'),
]
operations = [
migrations.AddField(
... | greendavegreen/vmsareus | vmsareus/vmleases/migrations/0002_vm_branch_name.py | Python | mit | 453 |
import re
import csv
import pymongo
import itertools
from bioservices import WikiPathways
import app
from util import save_file_metadata, split_id, is_numeric, is_boolean
log = app.get_logger('ingest')
def ingest(filepath):
_id, _ = split_id(filepath)
client = pymongo.MongoClient()
meta = client.file... | ucsd-ccbb/Oncolist | src/restLayer/app/ingest.py | Python | mit | 2,103 |
try:
import click
except ImportError:
print("Please install click for this example")
print(" pip install click")
exit()
from rich.traceback import install
install(suppress=[click])
@click.command()
@click.option("--count", default=1, help="Number of greetings.")
def hello(count):
"""Simple pr... | willmcgugan/rich | examples/suppress.py | Python | mit | 489 |
""" Cardiac Arrhythmia Database
The original dataset and further information can be found here:
https://archive.ics.uci.edu/ml/datasets/Arrhythmia
Brief description
-----------------
This data contains 452 observations on 279 variables (206 linear valued
+ 73 nominal) on ECG readings. The data was collected to... | I2Cvb/data_balancing | src/data_conversion/datasets/arrhythmia.py | Python | mit | 6,789 |
from django.contrib import admin
from core.models import Language
# Register your models here.
class LanguageAdmin(admin.ModelAdmin):
model = Language
fieldsets = [
('', {'fields': ['name', 'locale']})
]
list_display = ['name', 'locale']
search_fields = ['name', 'locale']
ordering = ('name',)
admin.site.regis... | ekaradon/demihi | core/admin.py | Python | mit | 348 |
from __future__ import absolute_import
import os
import chardet
import codecs
from ...controllers import webargs
from ...http.headers import content_types
def static(file_root='static/'):
'''
static = app.subapp(path='/static')(webify.apps.standard.static(file_root='static/'))
'''
@webargs.RemainingU... | jperla/webify | webify/apps/standard/__init__.py | Python | mit | 1,108 |
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.model_selection import train_test_split
from bartpy.sklearnmodel import SklearnModel
def run(size=100,
alpha=0.95,
beta=2.0,
n_trees=50):
import warnings
warnings.simplefilter("error", UserWarni... | JakeColtman/bartpy | examples/score/core/sin.py | Python | mit | 1,238 |
#!/usr/bin/env python
from math import pi
from tf.transformations import euler_from_quaternion
def get_euler_orientation(orientation):
quaternion = (
orientation.x,
orientation.y,
orientation.z,
orientation.w
)
return euler_from_quaternion(quaternion)
def get_angle_betwe... | bit0001/trajectory_tracking | src/util/angle.py | Python | mit | 435 |
__author__ = 'Xach'
| Anachronos/teslabot | teslabot/plugins/xdcc/__init__.py | Python | mit | 20 |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 25 12:10:45 2015
@author: pre
"""
import random
import mapapi.MapClasses as MapHierarchy
class BooleanPulse(MapHierarchy.MapComponent):
"""Representation of AixLib.Fluid.Movers.Pump
"""
def init_me(self):
self.target_location = "Modelica.Blocks.Sou... | EnEff-BIM/EnEffBIM-Framework | MapAPI/mapapi/molibs/MSL/Blocks/Sources/BooleanPulse.py | Python | mit | 694 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/synapse/azure-synapse-managedprivateendpoints/azure/synapse/managedprivateendpoints/v2020_12_01/_vnet_client.py | Python | mit | 3,611 |
'''
Produce minimum, maximum and the difference of number list
Status: Accepted
'''
###############################################################################
def read_line_of_integers():
"""Read one line of numbers or detect EOF"""
try:
text = input()
return [int(i) for i in text.split... | ivanlyon/exercises | kattis/k_statistics.py | Python | mit | 970 |
"""Workaround for formatting issue
Source: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Python.04.html
"""
import decimal
import json
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
if o % 1 > 0:
... | jcolekaplan/WNCYC | src/main/api/decEncoder.py | Python | mit | 441 |
import math
import datetime
#from subgen.subtitle import Subtitle
#def time_parse(s):
#hour, minute, second_decimal = [t for t in s.split(':')]
#second, microsec = second_decimal.split('.')
#microsec = microsec.ljust(6, '0')
#return [int(hour), int(minute), int(second), int(microsec)]
def subtitle_par... | hank5925/automatic-subtitle-transcriptor | subgen/subtitle_parsing.py | Python | mit | 1,283 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import math
from copy import deepcopy
from compas.geometry import scale_vector
from compas.geometry import normalize_vector
from compas.geometry import subtract_vectors
from compas.geometry import cross_vecto... | compas-dev/compas | src/compas/geometry/transformations/matrices.py | Python | mit | 41,266 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import scope, core, workspace
from caffe2.proto import caffe2_pb2
import unittest
import threading
import time
SUCCESS_COUNT = 0
def thread_runner(... | ryfeus/lambda-packs | pytorch/source/caffe2/python/scope_test.py | Python | mit | 5,113 |
#----------------------------------------------------------------------
# Copyright (c) 2011-2015 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | ahelsing/geni-ch | plugins/csrm/CredentialStore.py | Python | mit | 11,171 |
from __future__ import print_function
import json
import matplotlib.pyplot as plt
import numpy as np
with open("../data/results/scores.json", 'r') as f:
scores = json.load(f)
with open("../data/results/distances.json", 'r') as f:
distances = json.load(f)
with open("../data/results/times.json", 'r') as f:
t... | yarbroughw/JMDE | JMDE/scripts/graph.py | Python | mit | 4,491 |
from conans import ConanFile, tools, CMake
import os
class SceltaConan(ConanFile):
name = "scelta"
version = "0.1"
url = "https://github.com/SuperV1234/scelta.git"
build_policy = "missing"
settings = "os", "compiler", "build_type", "arch"
def source(self):
self.run("git clone https://g... | SuperV1234/scelta | conanfile.py | Python | mit | 777 |
# Copyright (C) 2002-2007 Python Software Foundation
# Author: Ben Gertzfield
# Contact: email-sig@python.org
"""Base64 content transfer encoding per RFCs 2045-2047.
This module handles the content transfer encoding method defined in RFC 2045
to encode arbitrary 8-bit data using the three 8-bit bytes in four 7-bit
ch... | PythonCharmers/python-future | src/future/backports/email/base64mime.py | Python | mit | 3,761 |
from .version import PACKAGE_VERSION
from .util import format_satoshis, print_msg, print_error, set_verbosity
from .wallet import Synchronizer, Wallet
from .storage import WalletStorage
from .network import Network, pick_random_server
from .interface import Connection, Interface
from .simple_config import SimpleConfig,... | fyookball/electrum | lib/__init__.py | Python | mit | 644 |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
outfile):
from genomicode import mplgraph
from genomicode import filelib
... | jefftc/changlab | Betsy/Betsy/modules/plot_prediction.py | Python | mit | 2,613 |
from card import Card
from util import *
from layout import *
import pygame
class CardHeap(list):
# A pile of cards
def __init__(self):
list.__init__(self)
#-- Actions
def add(self, card):
self.append(card)
card.position = self
def remove(self, card):
... | frrmack/CallofCthulhu | cardheap.py | Python | mit | 6,455 |
try:
from . import Portfolio
from . import Data_API
from .Quant_Indicators import *
except:
import Portfolio
import Data_API
from Quant_Indicators import *
class Trade_Algo:
def __init__(self,command=None):
self.command = command
if not self.safety_check():
... | geome-mitbbs/QTS_Research | Trade_Algo.py | Python | mit | 7,950 |
# -*- coding: utf-8 -*-
"""Installer script for Pywikibot 3.0 framework."""
#
# (C) Pywikibot team, 2009-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, print_function, unicode_literals
import itertools
import os
import sys
try:
# Work around a traceback on Pytho... | npdoty/pywikibot | setup.py | Python | mit | 8,699 |
import tornado.web
import json
import traceback
import os
class BaseHandler(tornado.web.RequestHandler):
def initialize(self):
self.error_message = None
self.MB = 1024*1024
self.GB = 1024*self.MB
def find_argument(self, arg_name, default=None):
method_type = self.request.method... | santosfamilyfoundation/TrafficCloud | app/handlers/baseHandler.py | Python | mit | 2,285 |
# -*- coding: utf-8 -*-
"""Unit and functional test suite for tg2express."""
from os import getcwd, path
from paste.deploy import loadapp
from webtest import TestApp
from gearbox.commands.setup_app import SetupAppCommand
from tg import config
from tg.util import Bunch
from tg2express import model
__all__ = ['setup... | archsh/tg2ext.express | example/tg2express/tests/__init__.py | Python | mit | 2,131 |
from pathlib import Path
import re
from setuptools import setup
setup_dir = Path(__file__).resolve().parent
version = re.search(
r'__version__ = "(.*)"',
Path(setup_dir, 'tldr.py').open().read()
)
if version is None:
raise SystemExit("Could not determine version to use")
version = version.group(1)
with op... | tldr-pages/tldr-python-client | setup.py | Python | mit | 1,805 |