code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright (c) 2012, JT Olds <hello@jtolds.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | jtolds/pants-lang | src/ast/parse.py | Python | mit | 26,451 |
import unittest
import datetime
import httpretty as HP
import json
from urllib.parse import parse_qsl
from malaysiaflights.aa import AirAsia as AA
class AARequestTests(unittest.TestCase):
def url_helper(self, from_, to, date):
host = 'https://argon.airasia.com'
path = '/api/7.0/search'
... | azam-a/malaysiaflights | malaysiaflights/tests/test_aa.py | Python | mit | 3,889 |
from jinja2 import TemplateNotFound
from partial import scanner, templating
from partial.scanner import ClassNotFound
def partial(partialName, context=None):
if context is None: context = {}
request = scanner.LOCAL.request
(megamodule, name) = partialName.split(".")
try:
partialClass = scanne... | RentennaDev/partial | partial/render.py | Python | mit | 641 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | Vaan5/piecewisecrf | piecewisecrf/slim/variables_test.py | Python | mit | 16,163 |
import unittest
import os
import sys
# Add app path to module path
sys.path.append(os.path.dirname(os.path.realpath(__file__).rsplit('/', 2)[0]))
from app import create_app
from app.users.models import Users
app = create_app('config')
class TestUsers(unittest.TestCase):
def setUp(self):
self.app = app... | Leo-G/T | app/users/test_users.py | Python | mit | 4,864 |
"""
WSGI config for moz_connect 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | Mozpacers/Moz-Connect | moz_connect/wsgi.py | Python | mit | 399 |
#!/usr/bin/python
import serial
import time
import random
import sys
s = None
num_leds = 93
ticks = 96
sleep_time = 0.0
def flush_input():
s.flushInput()
def wait_for_ack():
while s.inWaiting() <= 0:
pass... | jhogsett/linkit | python/gaydar4.py | Python | mit | 3,902 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import six
import six.moves.urllib as urllib
import tabulator
from .resource_file import (
InlineResourceFile,
LocalResourceFile,
RemoteResourceFi... | sirex/datapackage-py | datapackage/resource.py | Python | mit | 11,528 |
"""FANTA URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | swmerko/fantacalcio-asta-helper | FANTA/urls.py | Python | mit | 886 |
import shopify
from test.test_helper import TestCase
class TenderTransactionTest(TestCase):
def setUp(self):
super(TenderTransactionTest, self).setUp()
self.fake("tender_transactions", method="GET", body=self.load_fixture("tender_transactions"))
def test_should_load_all_tender_transactions(se... | Shopify/shopify_python_api | test/tender_transaction_test.py | Python | mit | 526 |
# https://oj.leetcode.com/problems/count-and-say/
# 10:56 - 11:11
class Solution:
# @return a string
def countAndSay(self, n):
result = "1"
# n == 1, result == '1', not when n == 0
for i in xrange(1, n):
last, count, nextResult = result[0], 1, ""
for j in xrange(1, len(result)):
cu... | yaoxuanw007/forfun | leetcode/python/countAndSay.py | Python | mit | 720 |
"""
Given an array of numbers nums, in which exactly two elements appear only once
and all the other elements appear exactly twice. Find the two elements that
appear only once.
For example:
Given nums = [1, 2, 1, 3, 2, 5], return [3, 5].
Note:
The order of the result is not important. So in the above exampl... | ufjfeng/leetcode-jf-soln | python/260_single_number_iii.py | Python | mit | 1,582 |
#!/usr/bin/env python
from gensim import matutils
from gensim.models import doc2vec
from gensim.models.word2vec import LineSentence
from gensim.models.word2vec import Word2Vec
from pymongo import MongoClient
from tqdm import tqdm
from sklearn.preprocessing import OneHotEncoder
from scipy import sparse
from models im... | yotamfr/prot2vec | src/python/prot2vec.py | Python | mit | 23,941 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, merge, publish... | rwl/PyCIM | CIM14/IEC61970/Dynamics/MetaBlockInput.py | Python | mit | 6,593 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0012_article_organisations'),
]
operations = [
migrations.AlterField(
model_name='article',
... | I-sektionen/i-portalen | wsgi/iportalen_django/articles/migrations/0013_auto_20151021_0155.py | Python | mit | 598 |
'''
synbiochem (c) University of Manchester 2016
synbiochem is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
# pylint: disable=invalid-name
import math
import random
import sys
import numpy
def cent_limit_theorem(tests, lng... | neilswainston/development-py | synbiochemdev/datascience/ch6.py | Python | mit | 1,896 |
def devisors(n):
r = 0
i = 1
while i <= n:
if n % i == 0:
r += 1
i += 1
return r
def is_prime(n):
x = devisors(n)
if x == 2:
return True
else:
return False
print is_prime(3)
| amiraliakbari/sharif-mabani-python | by-session/ta-921/j3/number1.py | Python | mit | 267 |
from django.views.generic import ListView
from blog.models.article import Article
class ArticleListView(ListView):
model = Article
template_name = 'blog/articlelist.html'
queryset = Article.objects.order_by('-created') | hamtamtots/website | matt_site/blog/views/articlelistview.py | Python | mit | 240 |
from django.shortcuts import render, HttpResponse
import os
# Create your views here.
def status(request, task_id):
from celery.result import AsyncResult
task = AsyncResult(task_id);
task.traceback_html = tracebackToHtml(task.traceback)
return render(request, 'task/html/task_status.html',
... | andyneff/voxel-globe | voxel_globe/task/views.py | Python | mit | 1,192 |
# -*- coding: utf-8 -*-
"""
paci
Usage:
paci install [--no-config] [--no-cleanup] [--reuse] [--overwrite] [--debug] <package>...
paci update [--no-config] [--no-cleanup] [--reuse] [--overwrite] [--debug] <package>...
paci search <package>
paci refresh
paci list [--installed]
paci remove
paci configure [-... | tradebyte/paci | paci/cli.py | Python | mit | 2,016 |
no_inputs = int(raw_input())
for i in range (0, no_inputs):
n, k, t, f = map(int, raw_input().split())
answer = n + k*((f-n)/(k-1))
print answer | prabodhprakash/problemsolving | spoj/EBOXES.py | Python | mit | 148 |
import datetime
from django.conf import settings
from elasticsearch import Elasticsearch
instance = Elasticsearch([settings.ELASTICSEARCH_DSN])
index_prefix = 'recarguide_'
def indices():
items = ['car']
return ['{}{}'.format(index_prefix, index) for index in items]
def mappings():
items = {
'... | resurtm/recarguide | backend/cars/search/elastic.py | Python | mit | 2,295 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-19 13:23
from __future__ import unicode_literals
from django.db import migrations, models
SECTOR_MAPPING = {
'Agriculture': 'Agriculture',
'Energy': 'Energy',
'Water (global)': 'WaterGlobal',
'Water (regional)': 'WaterRegional',
'Bio... | bruecksen/isimip | isi_mip/climatemodels/migrations/0057_sector_class_name.py | Python | mit | 2,105 |
# Python - 3.6.0
test.assert_equals(generateShape(3), '+++\n+++\n+++')
test.assert_equals(generateShape(8), '++++++++\n++++++++\n++++++++\n++++++++\n++++++++\n++++++++\n++++++++\n++++++++')
| RevansChen/online-judge | Codewars/7kyu/build-a-square/Python/test.py | Python | mit | 191 |
#!/usr/bin/env python3
# CLI interface in Python 3
import xml.etree.ElementTree as ET
def loadMap():
pathToFile=input("File name: ")
pathToFile="testbench.xml"
try:
xmlFile=ET.parse(pathToFile)
except ET.ParseError as e:
print("Error parsing XML:",str(e))
return 0
except FileNotFoundError:
print("Fil... | MieszkoGulinski/dungeons-of-xml | dungeons_cli.py | Python | mit | 414 |
from collections import OrderedDict
class DefaultOrderedDict(OrderedDict):
def __missing__(self, key):
self[key] = type(self)()
return self[key]
d=DefaultOrderedDict()
d['a']['c']['d']=1234
d['as'][4][2]='sdf'
d[3][4][2]=322
print [(i, j, k, d[i][j][k]) for i in d for j in d[i] for k in d[i][j]]
it... | praveendareddy21/my-repo | ordict.py | Python | mit | 1,021 |
# 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/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_operations.py | Python | mit | 10,950 |
from __future__ import division
import twitter_auth #calling the Twitter auth module
def get_details(twitter_handle):
# Get the User object for twitter...
user = twitter_auth.api.get_user(twitter_handle)
#Calculating the followers vs following ratio
ff_ratio = round(int(user.followers_count) / int(user.friends_co... | ajotwani/alfred-show-me-the-klout | development/get_twitter_details.py | Python | mit | 452 |
from grab.spider.base import Spider # noqa
from grab.spider.task import Task # noqa
from grab.spider.error import * # noqa pylint: disable=wildcard-import
| lorien/grab | grab/spider/__init__.py | Python | mit | 158 |
import discord
from discord.ext import commands
from utils import p_check
class SModCommands:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
@p_check()
async def spurge(self, ctx):
params = ctx.message.content.split()
member = None
amoun... | initzx/ignore-pls | cogs/private/smod_cmds.py | Python | mit | 2,353 |
import re
from typing import Any
from typing import Dict
from typing import Optional
from typing import TYPE_CHECKING
from typing import Union
from sqlalchemy import cast
from sqlalchemy import JSON
from sqlalchemy import schema
from sqlalchemy import sql
from .impl import DefaultImpl
from .. import util
if TYPE_CHE... | sqlalchemy/alembic | alembic/ddl/sqlite.py | Python | mit | 6,734 |
# Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
from ._input import UDPInputSession as UDPInputSession
from ._input import PromiscuousUDPInputSession as PromiscuousUDPInputSession
from ._input import SelectiveUDPInput... | UAVCAN/pyuavcan | pyuavcan/transport/udp/_session/__init__.py | Python | mit | 729 |
from itertools import chain
import subprocess
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--fix', dest='fixtures', default='')
def db_action(self, action):
... | doctorzeb8/django-era | era/management/commands/flush.py | Python | mit | 858 |
"""Replacements for clipboard commands that prefer to operate on full lines of code.
Replaces: Copy, Cut, Paste, and Duplicate Lines
Note: For selections within a single line, commands work as normal, operating
only on the selection and not on the full line.
"""
import sublime, sublime_plugin
class ExpandedRe... | AlanLynn/sublime-copy-cut-paste-lines | main.py | Python | mit | 11,915 |
from setuptools import setup
setup(
name='blotre',
version='0.1.1',
author="Matt Bierner",
author_email="mattbierner@users.noreply.github.com",
license="MIT",
description="Thin Python Blot're client.",
url="https://github.com/mattbierner/blotre-py",
py_modules=['blotre'],
install_re... | mattbierner/blotre-py | setup.py | Python | mit | 407 |
'''This module contains a script and functions for obtaining a list
of URLs from d20pfsrd.com, an unofficial System Reference Document
(SRD) for the Pathfinder RPG.
This list is meant to act as an index of creatures sorted by
Challenge Rating (CR).
'''
from lxml.html import parse
__all__ = ['create_index_file', ... | lot9s/pathfinder-rpg-utils | data-mining/bestiary/indexer.py | Python | mit | 2,230 |
#!/usr/bin/env python
import datetime
start = datetime.datetime.strptime("2012-11-16", "%Y-%m-%d")
end = datetime.datetime.strptime("2013-10-25", "%Y-%m-%d")
table_name = 'sql_table_name_here';
dates = []
while start < end:
s = start.strftime('%Y-%m-%d')
start += datetime.timedelta(days=1)
e = start.str... | dangoldin/python-tools | backup.py | Python | mit | 1,007 |
def train_decision_tree(x, y):
feature, value = get_best_split(x, y)
x_left, y_left = x[x[feature] < value], y[x[feature] < value]
if len(y_left.unique()) > 1:
left_node = train_decision_tree(x_left, y_left)
else:
left_node = None
x_right, y_right = x[x[feature] >= value], y[x[feat... | PyDataMadrid2016/Conference-Info | talks_materials/20160409_1015_Understanding_Random_Forests/latex/src/07_train_cart.py | Python | mit | 519 |
#!/usr/bin/env python
# Takes antismash output files in the current directory
# and grabs the cluster types summary file, generating
# a single txt file with all the cluster ID, types, and ranges.
# USAGE
# $ python compileclustertypes.py -o output_filename
# Returns tab-delimited txt file in the current directory.
i... | RRShieldsCutler/clusterpluck | clusterpluck/tools/compileclustertypes.py | Python | mit | 1,143 |
from functional_tests import FunctionalTest, ROOT, USERS
import time
from selenium.webdriver.support.ui import WebDriverWait
#element = WebDriverWait(driver, 10).until(lambda driver : driver.find_element_by_id("createFolderCreateBtn"))
class TestRegisterPage (FunctionalTest):
def setUp(self):
self.ur... | NewGlobalStrategy/NetDecisionMaking | fts/test_0aregister.py | Python | mit | 2,323 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ExtensionFaultTypeInfo(vim, *args, **kwargs):
'''This data object type describes faul... | xuru/pyvisdk | pyvisdk/do/extension_fault_type_info.py | Python | mit | 1,025 |
# 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 ... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_form_recognizer_client.py | Python | mit | 5,812 |
from keras.layers import Input
from keras.models import Model
from keras.layers import Activation
from keras.layers import MaxPool2D
from keras.layers import Flatten
from keras.layers import Conv2D
from keras.layers import Dense
from .utils import get_initial_weights
from .layers import BilinearInterpolation
def STN... | oarriaga/spatial_transformer_networks | src/models/STN.py | Python | mit | 1,242 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# TODO(ikeda): The function "get_rotations_cart" is not appropriate for this
# module.
from __future__ import absolute_import, division, print_function
import numpy as np
from ph_analysis.fc.fc_analyzer_base import FCAnalyzerBase
from .mappings_modifier import Mapping... | yuzie007/ph_analysis | ph_analysis/analysis/fc_distribution_analyzer.py | Python | mit | 4,776 |
# 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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py | Python | mit | 4,936 |
"""This module handles all API calls"""
from builtins import str
from requests import HTTPError
from requests import Session
from urllib.parse import (urlencode,
urljoin,
urlunsplit,
urlsplit)
from gobble.config import settings
from gobble.l... | openspending/gobble | gobble/api.py | Python | mit | 3,231 |
#!/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/TEX/TEXFLAGS.py | Python | mit | 3,365 |
import subprocess
import os
INPUT_FILE = "/tmp/input"
ERROR_LOG = "/tmp/error.log"
RESULTS_FILE = "/tmp/results"
def get_command_from_first_line(line):
if line.startswith("#!"):
return line[2:]
return line
def get_program_output_from_buffer_contents(buffer_contents):
write_buffer_contents_to_file... | JarrodCTaylor/vim-shell-executor | autoload/vim_shell_executor.py | Python | mit | 1,433 |
# -*- coding: utf-8 -*-
"""UWEC Language Tools student corpus module
Provides functions for processing student corpus data.
"""
# Python 3 forward compatability imports.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_liter... | SkySchermer/uweclang | uweclang/plain/clean.py | Python | mit | 7,350 |
#!/usr/bin/env python
# coding: UTF-8
from __future__ import division
from util.hosvd import HOSVD, unfold, reconstruct, frobenius_norm
from util.mobility import trans, init_data, init_data2, trans2
import numpy as np
import math
import pylab
# 第一步:构建转移概率tensor
# tensor = trans(count(init_db()))
# tensor = trans(count... | pengyuan/markov2tensor | recommendation/no_markov_recommend.py | Python | mit | 6,979 |
# -*- coding: utf-8 -*-
#
# mclaudia/personal_page_fei documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 3 16:16:37 2015.
#
# 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
# autoge... | mclaudia/personal_page_fei | source/conf.py | Python | mit | 9,548 |
#!/usr/bin/env python
from __future__ import division, absolute_import, print_function
from future.builtins import super
from iris_sdk.models.account_users import AccountUsers
from iris_sdk.models.available_npa_nxx import AvailableNpaNxx
from iris_sdk.models.available_numbers import AvailableNumbers
from iris_sdk.mod... | bandwidthcom/python-bandwidth-iris | iris_sdk/models/account.py | Python | mit | 4,216 |
import unittest
from vodem.api import enter_pin
class TestEnterPin(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.valid_response = {
}
@unittest.skip('skip')
def test_call(self):
resp = enter_pin()
self.assertEqual(self.valid_response, resp)
| alzeih/python-vodem-vodafone-K4607-Z | test/unit/api/test_enter_pin.py | Python | mit | 306 |
"""
WSGI config for offenewahlen_nrw17 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django im... | OKFNat/offenewahlen-nrw17 | src/offenewahlen_api/wsgi.py | Python | mit | 701 |
from . import header
def curve(**args):
'''Add a curve to the list plotted by legend().
A curve is a dictionary that is set by the plot command and can
be used with the legend command to make it easier to make legends. This
allows you to add an extra curve to those listed by legend() without
... | nlchap0/nlcpython | pywip/curve.py | Python | mit | 816 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import tensorflow as tf
from tensorflow.python.estimator.inputs.numpy_io import numpy_input_fn
from tensorflow.python.estimator.inputs.pandas_io import pandas_input_fn
from polyaxon_lib.libs import getters
def create_input_dat... | polyaxon/polyaxon-api | polyaxon_lib/processing/input_data.py | Python | mit | 4,360 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 15 11:39:04 2016
@author: rahulmehra
"""
# Import the modules
import pandas as pd
from sklearn.preprocessing import LabelEncoder
import numpy as np
# Define a function to autoclean the pandas dataframe
def autoclean(x):
for column in x.columns:
# Replace ... | ccbrandenburg/financialanalyticsproject | iembdfa/DataCleaning.py | Python | mit | 1,698 |
from core import ungzip
from core import ungzip_html
| mutarock/python-utils | compress/__init__.py | Python | mit | 53 |
# -*- coding: utf-8 -*-
import pytest
from yarr_client.app import configurate_app
@pytest.fixture
def app():
app, _, _ = configurate_app()
return app
| bluecap-se/yarr.client | tests/conftest.py | Python | mit | 161 |
import threading
import socket
from urllib3.contrib import socks
from urllib3.exceptions import ConnectTimeoutError, NewConnectionError
from dummyserver.server import DEFAULT_CERTS
from dummyserver.testcase import IPV4SocketDummyServerTestCase
from nose.plugins.skip import SkipTest
try:
import ssl
from urll... | Lukasa/urllib3 | test/contrib/test_socks.py | Python | mit | 21,538 |
import os
from sqlalchemy import and_
from photomanager.lib.pmconst import TODO_INX_NAME
from photomanager.utils.imageutils import ImageInfo
from photomanager.db.helper import exif_to_model
from photomanager.db.models import ImageMeta
from photomanager.lib.helper import get_file_md5
from photomanager.db.config import C... | wrenchzc/photomanager | photomanager/db/imagehandler.py | Python | mit | 2,547 |
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# 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 lim... | karesansui/karesansui | karesansui/gadget/guesttag.py | Python | mit | 2,641 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2017-2018 Roxanne Gibson
#
# 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 witho... | RainbowDinoaur/roxbot | roxbot/scripts/JSONtoDB.py | Python | mit | 6,104 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 19 14:46:48 2017
@author: User
"""
#%% MODULE IMPORT
def aad_process(file_url):
from IPython.core.display import display, HTML; display(HTML("<style>.container { width:95% !important; }</style>"))
from time import gmtime, strftime
import datetime
import nu... | gtuinsaat/TRKYH_Veritabani_programi-master | Kodlar/S-r-m 1/aad_kyh_process_function.py | Python | mit | 26,051 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Encuesta.altitud'
db.alter_column(u'encuesta_encuesta', 'altitud', self.gf('django.db.mod... | CARocha/estudiocafe | encuesta/migrations/0003_auto__chg_field_encuesta_altitud.py | Python | mit | 14,972 |
from bedrock import *
@annot('void -> List(int)')
def test():
kept = Cons(0, Cons(1, Nil()))
a = Cons(1, Cons(2, Cons(3, Nil())))
b = match(a, ("Cons(_, Cons(two, Cons(_, Nil())))", identity),
("_", lambda: 4))
assert b == 2, "List pattern match"
return kept
def main():
kept =... | pshc/archipelago | tests/list_match.py | Python | mit | 357 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
from .. import engine
import os
def shell(database='default'):
"""Runs the command-line client for the specified database.
"""
target = engine[database]
dialect = engine[database].dialect.name
if dialect =... | concordusapps/alchemist | alchemist/db/operations/shell.py | Python | mit | 1,145 |
"""
CollectionRetrievers
--------------------
Wrapper of retrievers with a customed api oriented to interact properly with
spatial descriptor models.
This module contains the main class to mamage all retrievers without entering
in low-level programming.
As the FeaturesRetriever there are a requisit to have all the ret... | tgquintela/pySpatialTools | pySpatialTools/Retrieve/collectionretrievers.py | Python | mit | 13,968 |
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
file_log_handler = logging.FileHandler('combinator-cli.log')
logger.addHandler(file_log_handler)
stderr_log_handler = logging.StreamHandler()
logger.addHandler(stderr_log_handler)
format_string = '%(asctime)s - %(name)s - %(levelname... | jasonamyers/pynash-click | complex/complex/logger.py | Python | mit | 467 |
import getpass
import os
import socket
from crits.settings import crits_config
from django.core.management.base import BaseCommand, CommandError
from crits.core.user import CRITsUser
from crits.core.handlers import login_user
from crits.vocabulary.acls import GeneralACL
class Command(BaseCommand):
"""
Scrip... | Magicked/crits | crits/core/management/commands/runscript.py | Python | mit | 5,573 |
from .settings import *
CLJS_LOADER['FIGWHEEL'] = False
CLJS_LOADER['CLJS_BUILD'] = Keyword('min')
| jstaffans/django-cljs-loader | examples/simple/app/settings-prod.py | Python | mit | 100 |
# Improve the appointment book program of Exercise P10.22. Give the user the
# option to add new appointments. The user must specify the type of the appointment,
# the description, and the date.
# IMPORTS
from P10_22 import Appointment
class AppointmentBook():
def __init__(self):
self._appointments = []... | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter10-Inheritance/P10_23.py | Python | mit | 1,032 |
'''
This the main code for running the chain.
It is quite straightforward: it runs chain_pairwise_pc and chain_merge_pcs (with a few additional logs...)
'''
import chain_pairwise_pc
import chain_merge_pcs
import time
from params import *
import sys
import os
import os.path
import shutil
import numpy as np
import resou... | sdrdis/iarpa_contest_submission | chain.py | Python | mit | 1,327 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import codepot
class Migration(migrations.Migration):
dependencies = [
('codepot', '0018_merge'),
]
operations = [
migrations.CreateModel(
name='ResetPassword',
fields=[
('id',... | codepotpl/codepot-backend | codepot/migrations/0019_resetpassword.py | Python | mit | 648 |
from base import GAETestCase
from config.template_middleware import TemplateResponse
from routes.courses import new
from tekton.gae.middleware.redirect import RedirectResponse
from student.student_model import Course
__author__ = 'samara'
class NewTeste(GAETestCase):
def test_sucesso(self):
resposta = ne... | SamaraCardoso27/eMakeup | backend/test/course_test.py | Python | mit | 950 |
#!/usr/bin/env python
# encoding: utf-8
from flask.ext.restful import Resource, fields, marshal_with, marshal
from .base import BaseArgs, LengthField, ChannelKey
from database.channel.channel_model import get_channel_status, get_channel, update_channel, delete_channel
class ChannelQueryArgs(BaseArgs):
def rules(... | hellolintong/LinDouFm | resource/channel.py | Python | mit | 1,825 |
from ArduinoSerial import sendData, beginTransmission
import serial
import time
import atexit
ser = serial.Serial("/dev/ttyACM0",115200)
ser.flushInput()
#The next five lines allow the motors to stop once the ctrl+c command is given to abort the program.
def exit_handler():
sendData(ser,1,0)
sendData(ser,2,0)
atex... | IllinoisRoboticsInSpace/Arduino_Control | RemoteControl/Move.py | Python | mit | 675 |
from src.exceptions import BBJException, BBJParameterError, BBJUserError
from src import db, schema, formatting
from functools import wraps
from uuid import uuid1
from sys import argv
import traceback
import cherrypy
import sqlite3
import json
dbname = "data.sqlite"
# any values here may be overrided in the config.js... | desvox/bbj | server.py | Python | mit | 27,166 |
import ltask,json
from ltask import pset
class Task(ltask.Task):
#def __init__(self,params):
#super(ltask.Task,self).__init__(self,params)
def transform_params(self,p): #called in ltask.Task processed_params
return p
def out_dir(self):
return './examples/out/'
def kill(self)... | redsh/Tasks-In-A-Bottle | examples/dummy.py | Python | mit | 641 |
import sys, os
import vecrec
## General
project = u'vecrec'
copyright = u'2015, Kale Kundert'
version = vecrec.__version__
release = vecrec.__version__
master_doc = 'index'
source_suffix = '.rst'
templates_path = ['templates']
exclude_patterns = ['build']
default_role = 'any'
pygments_style = 'sphinx'
## Extensions... | kxgames/vecrec | docs/conf.py | Python | mit | 857 |
#
# @lc app=leetcode id=103 lang=python3
#
# [103] Binary Tree Zigzag Level Order Traversal
#
from typing import List
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# @lc code=start
class Solution:
def zigzagL... | heyf/cloaked-octo-adventure | leetcode/0103_binary-tree-zigzag-level-order-traversal.py | Python | mit | 1,261 |
import numpy as np
from week3 import lnn, tools
import os
def f(x):
if 0 <= x < 0.25:
return float(0)
elif 0.25 <= x < 0.5:
return 16.0 * (x - 0.25)
elif 0.5 <= x < 0.75:
return -16.0 * (x - 0.75)
elif 0.75 < x <= 1:
return float(0)
else:
raise ValueError('v... | cyruscyliu/diffentropy | week3/w3_lnn.py | Python | mit | 2,275 |
# source: http://stackoverflow.com/questions/2758159/how-to-embed-a-python-interpreter-in-a-pyqt-widget
import sys
import os
import re
import traceback
import platform
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtWidgets
from electrum import util
from electrum.i18n import _
if platform.sys... | cryptapus/electrum | electrum/gui/qt/console.py | Python | mit | 11,672 |
import pytest
import transcode.conf
import transcode.render
def my_callback(source, *args, **kws):
pass
CFG_GOOD = {
'TEXT': {'transcoder': my_callback},
}
CFG_BAD = {
'MARK': {'transcoder': 42}
}
class TestConf:
def test_default_config(self):
for fmt, expected in (
(transcode... | OpenTherapeutics/transcode | tests/test_config.py | Python | mit | 1,153 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name="ctypeslib2",
version="2.3.2",
description="ctypeslib2 - FFI toolkit, relies on clang",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
author="Loic Jaquemet",
a... | trolldbois/ctypeslib | setup.py | Python | mit | 1,432 |
#
# A sample service to be 'compiled' into an exe-file with py2exe.
#
# See also
# setup.py - the distutils' setup script
# setup.cfg - the distutils' config file for this
# README.txt - detailed usage notes
#
# A minimal service, doing nothing else than
# - write 'start' and 'stop' entries into th... | pupboss/xndian | deploy/site-packages/py2exe/samples/advanced/MyService.py | Python | mit | 2,011 |
from Gaudi.Configuration import *
from Configurables import GaudiSequencer
from Configurables import DaVinci
simulation=False
from Configurables import EventNodeKiller
eventNodeKiller = EventNodeKiller('DAQkiller')
eventNodeKiller.Nodes = ['DAQ','pRec']
#MySequencer.Members+=[eventNodeKiller]
from Configurables impo... | Williams224/davinci-scripts | kstetappipieta/DNTupleMaker.py | Python | mit | 3,046 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cardsgame', '0002_card_mana_cost'),
]
operations = [
migrations.AddField(
model_name='card',
name='m... | mrjmad/gnu_linux_mag_drf | hall_of_cards/cardsgame/migrations/0003_card_modified.py | Python | mit | 465 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2015 Roberto Alsina and others.
# 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 t... | masayuko/nikola | nikola/plugins/template/jinja.py | Python | mit | 4,861 |
import pytest
from unittest.mock import patch
from borg_summon import config_parser
from .util import mock_globbing, mock_multiple_opens
def test_merge():
d1 = {
'a': 'a',
'b': {
'c': 'c',
'd': [1, 2, 3],
'e': [1, 2, 3],
},
... | grensjo/borg-summon | test/test_config_parser.py | Python | mit | 1,894 |
#!/usr/bin/python
# coding: UTF-8
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from autopy import key, mouse
import urllib
class MyRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
query = urllib.splitquery(self.path)
action = query[0]
queryParams = {}
if ... | hanxi/mobiletouch_pyhttp | http_server.py | Python | mit | 2,763 |
#!/usr/bin/env python
# encoding: utf-8
import os
import tempfile
import unittest
class TestSlug(unittest.TestCase):
"""tests features related to creating slugs"""
def setUp(self):
self.tempd_path = tempfile.mkdtemp()
def tearDown(self):
import shutil
shutil.rmtree(self.tempd_p... | dandesousa/lapis | tests/test_slugs.py | Python | cc0-1.0 | 2,165 |
#!/usr/bin/python
'''This package will take an input query and generate list of blast hits.
The input query must be a refseq protein gi number.
The default cutoff is a Blast score of 100
This script can be invoked as::
python blast_search.py 6319393
where 6319393 is the gi_number being queried.
The output... | davebridges/biomolecule-scripts | biopython/blast_search.py | Python | cc0-1.0 | 2,368 |
# -*- coding: utf-8 -*-
__version__ = '$Id: 7e07cc8b51fa2cdfb23c34c8652adf4a94003dc8 $'
import family
# The Wikimedia i18n family
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'i18n'
self.langs = {
'i18n': 'translatewiki.net',
... | races1986/SafeLanguage | CEM/families/i18n_family.py | Python | epl-1.0 | 6,800 |
"""
Plots the Histogram
"""
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib.cm as cm
import PVReadWeights as rw
import PVConversions as conv
from pylab import save
import math
import random
if len(sys.argv) < 3:
print "usage: hamming filename ... | dpaiton/OpenPV | pv-core/analysis/python/plot_hamming.py | Python | epl-1.0 | 3,742 |
"""
This module signs newly installed client puppet certificates if the
puppet master server is running on the same machine as the cobbler
server.
Based on:
http://www.ithiriel.com/content/2010/03/29/writing-install-triggers-cobbler
"""
from builtins import str
import re
import cobbler.utils as utils
def register():... | jmaas/cobbler | cobbler/modules/installation/post_puppet.py | Python | gpl-2.0 | 1,712 |
############################################################################
# CoderBot, a didactical programmable robot.
# Copyright (C) 2014, 2015 Roberto Previtera <info@coderbot.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | lostcaggy/coderbot | config.py | Python | gpl-2.0 | 1,410 |
#!/usr/bin/python2
import os
import sys
import time
import datetime
import argparse
import hashlib
default_module_folder = '/cygdrive/c/Users/{}/Documents/Paradox Interactive/Crusader Kings II/mod/modules'.format(os.environ.get('USER', 'ziji'))
shrinkwrap_sentinel_file = 'no_shrinkwrap.txt'
k = bytearray(br'"The enem... | EMFTeam/HIP-tools | installer/shrinkwrap.py | Python | gpl-2.0 | 5,564 |
#!/usr/bin/python
# Open Global Server Load Balancer (ogslb)
# Copyright (C) 2010 Mitchell Broome
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your... | mbroome/ogslb | bin/backend-test.py | Python | gpl-2.0 | 2,025 |
from functions.science import rms, mae, average, nan, inf
from collections import OrderedDict
from rawdata.table import table
from numpy import array, log10
import cma
from time import time, strftime
__all__ = ['fmin', 'optimbox', 'box', 'array', 'log10', 'rms', 'mae', 'average', 'nan', 'inf']
def box(x, y, xmin=-inf... | raphaelvalentin/Utils | optimize/optlib2.py | Python | gpl-2.0 | 8,671 |