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 |
|---|---|---|---|---|---|
from mock import patch
from pip.vcs.git import Git
from tests.test_pip import (reset_env, run_pip,
_create_test_package,)
from tests.git_submodule_helpers import (
_change_test_package_submodule,
_pull_in_submodule_changes_to_module,
_create_test_package_with_submodule,
)
d... | domenkozar/pip | tests/test_vcs_git.py | Python | mit | 3,904 |
""" submit failure or test session information to a pastebin service. """
import tempfile
import pytest
def pytest_addoption(parser):
group = parser.getgroup("terminal reporting")
group._addoption(
"--pastebin",
metavar="mode",
action="store",
dest="pastebin",
default=... | tomviner/pytest | src/_pytest/pastebin.py | Python | mit | 3,386 |
"""
Makes the necesary files to convert from plain html of
Python 1.5 and 1.5.x Documentation to
Microsoft HTML Help format version 1.1
Doesn't change the html's docs.
by hernan.foffani@iname.com
no copyright and no responsabilities.
modified by Dale Nagata for Python 1.5.2
Renamed fr... | TathagataChakraborti/resource-conflicts | PLANROB-2015/seq-sat-lama/Python-2.5.2/Doc/tools/prechm.py | Python | mit | 17,381 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
# testing environment
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "blastplus.test_settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| michal-stuglik/django-blastplus | manage.py | Python | mit | 283 |
"""
Django settings for rha project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# impo... | klebercode/rhape | rha/settings.py | Python | mit | 2,677 |
import datetime
import mock
from django.test import TestCase
from django.utils import timezone
from core.tests.mommy_utils import make_recipe, make_user
from cla_eventlog.tests.test_forms import BaseCaseLogFormTestCaseMixin, EventSpecificLogFormTestCaseMixin
from cla_eventlog.models import Log
from legalaid.models imp... | ministryofjustice/cla_backend | cla_backend/apps/call_centre/tests/test_forms.py | Python | mit | 24,898 |
# -*- coding: utf-8 -*-
#
# netengine documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 8 15:35:40 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.
#
#... | ninuxorg/netengine | docs/source/conf.py | Python | mit | 8,226 |
#!/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.
# Download and build the data if it does not exist.
from parlai.core.build_data import DownloadableFile
import parlai.co... | facebookresearch/ParlAI | parlai/tasks/dialog_babi/build.py | Python | mit | 1,182 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('measurement', '0006_auto_20141028_1228'),
]
operations = [
migrations.AddField(
model_name='measurement',
... | sigurdsa/angelika-api | measurement/migrations/0007_measurement_unit.py | Python | mit | 580 |
from __future__ import absolute_import
from base64 import b64encode
from ..packages.six import b
ACCEPT_ENCODING = 'gzip,deflate'
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
basic_auth=None, proxy_basic_auth=None, disable_cache=None):
"""
Shortcuts for generatin... | la0rg/Genum | GenumCore/vendor/urllib3/util/request.py | Python | mit | 2,180 |
# Generated by Django 2.1.9 on 2019-07-18 16:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("foirequest", "0039_foirequest_team"),
]
operations = [
migrations.AddField(
model_name="foiatta... | fin/froide | froide/foirequest/migrations/0040_auto_20190718_1815.py | Python | mit | 826 |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from ascetic import exceptions
from ascetic.mappers import Load, Mapper, OneToOne, Result
from ascetic.utils import to_tuple
from ascetic.utils import cached_property
from ascetic.contrib.gfk import GenericForeignKey
# TODO: Support for native support inherit... | emacsway/ascetic | ascetic/contrib/polymorphic.py | Python | mit | 7,432 |
import hashlib
import re
from collections import Counter
from datetime import timedelta
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator, MaxVal... | hoelsner/product-database | app/productdb/models.py | Python | mit | 40,316 |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
IscsiPortInfoPathStatus = Enum(
'active',
'lastActive',
'notUsed',
'standBy',
)
| xuru/pyvisdk | pyvisdk/enums/iscsi_port_info_path_status.py | Python | mit | 259 |
# conding: utf-8
from django import forms
from .models import Contact
class ContactForm(forms.ModelForm):
class Meta:
model = Contact
fields = ['name', 'email', 'telephone', 'subject', 'description']
def clean(self):
cleaned_data = super(ContactForm, self).clean()
email = c... | delete/estofadora | estofadora/core/forms.py | Python | mit | 1,354 |
# 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-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configuration_operations.py | Python | mit | 6,172 |
from OpenGLCffi.GLES3 import params
@params(api='gles3', prms=['mode', 'id'])
def glDrawTransformFeedbackEXT(mode, id):
pass
@params(api='gles3', prms=['mode', 'id', 'instancecount'])
def glDrawTransformFeedbackInstancedEXT(mode, id, instancecount):
pass
| cydenix/OpenGLCffi | OpenGLCffi/GLES3/EXT/EXT/draw_transform_feedback.py | Python | mit | 261 |
#!/usr/bin/env python3
print(sum( (int(i) for i in str(2**1000)) ))
| davidxmoody/kata | project-euler/completed/euler16.py | Python | mit | 69 |
class Property(object):
"""This class represents a property in a class.
It is autodiscovered and provide a convenient Python-interface to use a
BinaryLog; you can just access and change the properties on an object.
"""
def __init__(self, name):
self._name = name
def __get__(self, obj,... | pombredanne/timyd | timyd/logged_properties/properties.py | Python | mit | 2,011 |
# -*- coding: utf-8 -*-
import traceback
from datetime import timedelta
from django.core import mail
from django.core.mail import EmailMultiAlternatives, mail_admins
from django.core.management.base import BaseCommand
from django.template.loader import render_to_string
from django.utils.translation import ugettext_laz... | pugpe/pugpe | apps/cert/management/commands/send_certificates.py | Python | mit | 2,215 |
from django.conf.urls import patterns, url
from django.conf import settings
import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
)
| esenti/ld-poznan | ldpoznan/core/urls.py | Python | mit | 160 |
import os
import sys
import time
from stve.log import LOG as L
from stve.script import StveTestCase
class TestCase(StveTestCase):
def __init__(self, *args, **kwargs):
super(TestCase, self).__init__(*args, **kwargs)
@classmethod
def setUpClass(cls):
L.info("*** Start TestCase : %s *** "... | TE-ToshiakiTanaka/stvex | test/data/testcase/library_android_04.py | Python | mit | 692 |
"""Config file for the emojis that Chiaki will use.
RENAME THIS FILE TO emojis.py OTHERWISE IT WON'T WORK.
By default it uses the unicode emojis. However, you can specify
server emojis in one of the two possible ways:
1. The raw string of the emoji. This is the format <:name:id>. You can find this
by placing a ba... | Ikusaba-san/Chiaki-Nanami | emojistemplate.py | Python | mit | 2,702 |
#!/usr/bin/env python
from re import sub
from sys import argv,exit
from os import system,getenv,path
from time import clock,time
import json
which = int(argv[1])
submit_id = int(argv[2])
sname = argv[0]
argv=[]
import ROOT as root
from PandaCore.Tools.Misc import *
from PandaCore.Tools.Load import *
import PandaCore... | sidnarayanan/RedPanda | T3/inputs/pf_tmpl.py | Python | mit | 6,716 |
import os
import numpy as np
import cv2
import json
start_index = 0
image_path = 'images/trial_3_autoencoder/'
test_path = 'test/trial_3_autoencoder/'
json_file = 'annotations/all_patient.json'
image_rows = 376
image_cols = 312
image_rows_map = 46
image_cols_map = 38
with open(json_file) as jf:
dict = json.load(... | lyuboshen/Pose-Estimation-on-Depth-Images-of-Clinical-Patients-V2.0 | src/load_data.py | Python | mit | 9,257 |
from django.db import models
from django.core.urlresolvers import reverse
from model_utils.models import TimeStampedModel
from model_utils import FieldTracker
from webfaction.models import OwnedModel
from .tasks import create_domain, delete_domain, delete_subdomain
class Domain(TimeStampedModel, OwnedModel):
nam... | gfavre/beyondthehost | beyondthehost/domains/models.py | Python | mit | 2,148 |
from django.conf.urls import url
from . import views
urlpatterns = [
# url(r'^news/([\w-]+)$', views.ListView.as_view(), name='list'),
url(r'^news/$', views.ListView.as_view(), name='list_all'),
url(r'^news/(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
]
| Zex0n/django-simple-cms | news/urls.py | Python | mit | 286 |
# 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 ... | vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_server_failure.py | Python | mit | 6,474 |
# !/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
ERP+
"""
__author__ = 'CVtek dev'
__credits__ = []
__version__ = "1.0"
__maintainer__ = "CVTek dev"
__status__ = "Development"
__model_name__ = 'sr_crianca.SRCrianca'
import auth, base_models
from orm import *
from form import *
class SRCrianca(Model, View):
def... | IdeaSolutionsOnline/ERP4R | core/objs/sr_crianca.py | Python | mit | 3,036 |
import os
import re
import shutil
destination = 'C:/Software/Pimix/'
apps = [
'fileutil',
'jobutil'
]
include_patterns = [
r'\.exe',
r'\.exe\.config',
r'\.dll',
r'\.pdb'
]
exclude_patterns = [
'FSharp',
'vshost'
]
os.makedirs(destination, exist_ok=True)
for app in apps:
for e... | Kimi-Arthur/Pimix | deploy.py | Python | mit | 805 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2015 Björn Larsson
#
# 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 r... | fuzzycode/RoboPi | main.py | Python | mit | 2,261 |
''' This script is prepared by Tyler Pubben and is licensed under the MIT license framework.
It is free to use and distribute however please reference http://www.tjscientific.com or my
GIT repository at https://github.com/tpubben/SequoiaStacking/'''
import numpy as np
import cv2
import os
def align_images(in... | tpubben/SequoiaStacking | parrotStacking.py | Python | mit | 3,776 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
_str_field = 789
_int_field = '123'
_float_field = '123.45'
_bool_field = 'x'
_int_field_default_none = None
_tuple_int_field = ('12', '23')
_list_str_field = [78, 89]
def data_input():
source = {
'str_field': _str_field,
'int_field': _int_fie... | lecly/pymongo-driver | tests/data/for_purifier.py | Python | mit | 2,478 |
"""
File: __cffi_jsonBuilder.py
=========================
Copyright (c) Tien Nguyen Anh
Modified History
----------------
2017-Jan-05 Created tien.nguyenanh94@gmail.com
"""
import cffi
import os
#LIDT declare
LIDT_ROOT = os.getenv('LIDT_ROOT')
LIDT_LIBS = os.path.sep.join((LIDT_ROOT, 'obj', 'libs'))
JSON_BUILDER_F... | thuhangnguyen8894/SmartPlug | src/app/processor/cffi_interfaces/__cffi_jsonBuilder.py | Python | mit | 1,272 |
from .. import PanBase
from ..utils import error
from ..utils import listify
from ..utils import load_module
from ..utils import images
from ..focuser.focuser import AbstractFocuser
from astropy.io import fits
import re
import shutil
import subprocess
import yaml
import os
class AbstractCamera(PanBase):
""" ... | joshwalawender/POCS | pocs/camera/camera.py | Python | mit | 14,295 |
from django.conf.urls import patterns, include
urlpatterns = patterns('',
(r'^django-httpbin', include('django_httpbin.httpbin.endpoints')),
)
| csparpa/django-httpbin | django_httpbin/urls.py | Python | mit | 148 |
from omgeo.processor import _Processor
import re
class _PreProcessor(_Processor):
"""Takes, processes, and returns a geocoding.places.PlaceQuery object."""
def process(self, pq):
raise NotImplementedError(
'PreProcessor subclasses must implement process().')
class ReplaceRangeWithNumber(_P... | lliss/python-omgeo | omgeo/preprocessors.py | Python | mit | 11,304 |
import os
from pathlib import Path
from cryptography import x509
from cryptography.x509 import NameOID
import pytest
from mitmproxy import certs
from ..conftest import skip_windows
# class TestDNTree:
# def test_simple(self):
# d = certs.DNTree()
# d.add("foo.com", "foo")
# d.add("bar.co... | mhils/mitmproxy | test/mitmproxy/test_certs.py | Python | mit | 9,062 |
import piglow
from time import sleep
import psutil
piglow.auto_update = True
while True:
cpu = psutil.cpu_percent()
#piglow.all(0)
if cpu < 5:
piglow.all(0)
if cpu > 10:
piglow.white(20)
if cpu > 20:
piglow.blue(20)
if cpu > 40:
piglow.green(20)
if cpu > 60:
piglow.yellow(20)
if cpu > 80:
piglow.... | developius/piometer | cpu.py | Python | mit | 391 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/btm_parameter_reference_blob3281.py | Python | mit | 9,978 |
from setuptools import setup, find_packages
with open('README.md', encoding = "utf-8") as f:
readme = f.read()
setup(
name='datatoaster',
version='0.1.0',
description='A Python library that can convert raw data to chart data',
long_description=readme,
author='Harry Yu',
author_email='harry... | abc612008/datatoaster | setup.py | Python | mit | 474 |
#!/usr/bin/python3
import sys, os, subprocess, re, csv
outfile = open('output.csv', 'w')
wr = csv.writer(outfile)
with open('alexa_top1mil', 'r') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
#define columns
server = row[0]
servername = row[1]
try:
... | jimmyly73/DHE-prime-grabber | find_primes.py | Python | mit | 1,120 |
DFITCSECRspInfoField = {
"requestID": "int",
"sessionID": "int",
"accountID": "string",
"errorID": "int",
"localOrderID": "int",
"spdOrderID": "int",
"errorMsg": "string",
}
DFITCSECRspNoticeField = {
"noticeMsg": "string",
}
DFITCSECReqUserLoginField = {
"requestID": "int",
"a... | bigdig/vnpy | vnpy/api/sec/generator/DFITC_struct.py | Python | mit | 49,441 |
from django.conf.urls import patterns, url
from cart import views
urlpatterns = patterns('',
url(r'^$', views.view_cart, name='view'),
url(r'^add/$', views.add_to_cart, name='add'),
url(r'^remove/$', views.remove_from_cart, name='remove'),
... | juntatalor/qexx | cart/urls.py | Python | mit | 768 |
class Parent(object):
def altered(self):
print("PARENT altered()")
class Child(Parent):
def altered(self):
print("CHILD, BEFORE PARENT altered()")
super(Child, self).altered()
print("CHILD, AFTER PARENT altered()")
dad = Parent()
son = Child()
dad.altered()
son.altered()... | zedshaw/learn-python3-thw-code | ex44c.py | Python | mit | 321 |
import numpy as np
#go by brute force again
coeff_sum = 1000
triplet = []
for a in range(1,1000):
for b in range(a+1,1000):
c = np.sqrt(a*a + b*b)
if a + b + c == 1000:
triplet.append(a)
triplet.append(b)
triplet.append(c)
product = a * b * c
... | v-ek/euler-sols | p1_to_p100/p9_py.py | Python | mit | 353 |
from django.forms import ModelForm
from .models import Depoimento
class DepoimentoForm(ModelForm):
class Meta:
model = Depoimento
| ProfessionalIT/customers | bambinocampones/src/bambinocampones/website/forms.py | Python | mit | 144 |
import sys
import logging
import time
import requests
from biokbase.AbstractHandle.Client import AbstractHandle
def getStderrLogger(name, level=logging.INFO):
logger = logging.getLogger(name)
logger.setLevel(level)
# send messages to sys.stderr
streamHandler = logging.StreamHandler(sys.__stderr... | realmarcin/transform | lib/biokbase/Transform/script_utils.py | Python | mit | 3,187 |
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib import auth
admin.autodiscover()
import templog.urls
import control.urls
from thermoctrl import views
urlpatterns = [
# Examples:
# url(r'^$', 'thermoctrl.views.home', name='home'),
# url(r'^blog/', include('bl... | DrChat/thermoctrl | thermoctrl/urls.py | Python | mit | 645 |
import datetime
import logging
from mailsnake import MailSnake
from mailsync.models.customfield import CustomField
class MailChimp(object):
def __init__(self, apikey):
self.api_key = apikey
self.provider = MailSnake(self.api_key)
def test_connection(self):
try:
self.provider.ping()
except Exception,... | rebelact/mailsync-app | mailsync/api/mailchimp.py | Python | mit | 2,198 |
# party/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.db import models
import wevote_functions.admin
from wevote_settings.models import fetch_next_we_vote_id_party_integer, fetch_site_unique_id_prefix
from exception.models import handle_record_not_found_exception
logger = wevote_... | wevote/WeVoteServer | party/models.py | Python | mit | 4,748 |
"""
This inline script utilizes harparser.HAR from https://github.com/JustusW/harparser
to generate a HAR log object.
"""
try:
from harparser import HAR
from pytz import UTC
except ImportError as e:
import sys
print >> sys.stderr, "\r\nMissing dependencies: please run `pip install mitmproxy[exam... | devasia1000/anti_adblock | examples/har_extractor.py | Python | mit | 10,062 |
import sys
import subprocess
seeds = [1,2,3,4,5,6,7,8,9,10]
seeds = [1,2,3,4]
for seed in seeds:
boostem='python EM.py --input=../data/wdbc.arff --learner=dt --tboost=20 --labelFrac=0.2 --dtM=100 --seed='+str(seed)
print boostem
subprocess.call(boostem, shell=True)
fullBoost='python EM.py --input=../d... | zwelchWI/BoostEM | source/runTests.py | Python | mit | 1,237 |
'''
Author: Hans Erik Heggem
Email: hans.erik.heggem@gmail.com
Project: Master's Thesis - Autonomous Inspection Of Wind Blades
Repository: Master's Thesis - CV (Computer Vision)
'''
import os, glob
from imageTools import GetImage
from src.DroneVision.DroneVision_src.imgProcessing.frameTools.frameTools import GetSha... | hansehe/Wind-Blade-Inspection | src/DroneVision/DroneVision_src/hardware/ImageLink.py | Python | mit | 4,028 |
#!/usr/bin/env python
# Written by Michael Janssen (jamuraa at base0 dot net)
# originally heavily borrowed code from btlaunchmany.py by Bram Cohen
# and btdownloadcurses.py written by Henry 'Pi' James
# now not so much.
# fmttime and fmtsize stolen from btdownloadcurses.
# see LICENSE.txt for license information
fr... | OS2World/APP-INTERNET-torpak_2 | btlaunchmany.py | Python | mit | 9,812 |
import asyncio
import functools
import pycares
import socket
from typing import (
Any,
List,
Optional,
Set
)
from . import error
__version__ = '3.0.0'
__all__ = ('DNSResolver', 'error')
READ = 1
WRITE = 2
query_type_map = {'A' : pycares.QUERY_TYPE_A,
'AAAA' : pycares.QUER... | saghul/aiodns | aiodns/__init__.py | Python | mit | 5,081 |
import numpy as np
import scimath as sm
import matplotlib.pyplot as plt
import json
import yaml
import sys
import os
# Make sure that caffe is on the python path:
configStream = open("FluffyHaiiro.yaml", "r")
config = yaml.load(configStream)
caffe_root = config.get(':caffe_root_path')
sys.path.insert(0, caffe_root +... | Pirolf/Cabot | categorize.py | Python | mit | 2,623 |
#!/usr/bin/python -i
import sys
from mio import lexer
from mio import parser
from mio import runtime
from mio.main import parse_args
opts, args = parse_args(sys.argv)
runtime.init(args, opts)
eval = runtime.state.eval
def parse(s):
return parser.parse(lexer.tokenize(s))
| prologic/mio | test_parser.py | Python | mit | 282 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0019_remove_thumbnail_user'),
]
operations = [
migrations.AddField(
model_name='product',
... | Maelstroms38/ecommerce | src/products/migrations/0020_product_embed_code.py | Python | mit | 433 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Minimal Flask application example for development.
SPHINX-START
Run the Elastic... | tiborsimko/invenio-search | examples/app.py | Python | mit | 3,051 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("pinboard", "0013_auto_20151026_1546"),
]
operations = [
migrations.AlterModelOptions(
name="bookmarktag",
... | philgyford/django-ditto | ditto/pinboard/migrations/0014_auto_20151028_1556.py | Python | mit | 689 |
from typing import Any, Generator, List, Optional
from backend.common.consts.suggestion_state import SuggestionState
from backend.common.models.account import Account
from backend.common.models.suggestion import Suggestion
from backend.common.queries.database_query import DatabaseQuery
from backend.common.tasklets imp... | the-blue-alliance/the-blue-alliance | src/backend/common/queries/suggestion_query.py | Python | mit | 1,368 |
"""
The different agnocomplete classes to be discovered
"""
from copy import copy
from six import with_metaclass
from abc import abstractmethod, ABCMeta
import logging
from django.db.models import Q
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_text as text
from django... | novafloss/django-agnocomplete | agnocomplete/core.py | Python | mit | 20,047 |
"""KitnIRC - A Python IRC Bot Framework."""
import logging
from kitnirc import client
from kitnirc import events
from kitnirc import modular
from kitnirc import user
__version__ = "0.3.1"
# Prevents output of "no handler found" if no other log handlers are added
_log = logging.getLogger("kitnirc")
_log.addHandler(l... | ayust/kitnirc | kitnirc/__init__.py | Python | mit | 444 |
import os
from pytest import fixture
from doubles import expect, allow
import staticpy.site
from staticpy.utils import load_settings
def get_settings():
path = os.path.realpath(__file__)
parts = path.split(os.sep)[:-2]
parts.append('template')
path = os.path.join(*parts)
# '/' is a temporary ha... | toddsifleet/staticpy | test/site_test.py | Python | mit | 1,243 |
# blockchain.py
# Demonstration of a blockchain; 3 of 3 components
import time
from . import block
from . import block_params
class BlockChain():
def __init__(self):
self.blockchain_store = self.fetch_blockchain()
def latest_block(self):
return self.blockchain_store[-1]
def generate_ne... | bluewitch/Code-Blue-Python | blockchain.py | Python | mit | 1,222 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# CAVEAT UTILITOR
#
# This file was automatically generated by Grako.
#
# https://pypi.python.org/pypi/grako/
#
# Any changes you make to it will be overwritten the next time
# the file is generated.
from __future__ import print_function, division, absolute_import, un... | vmuriart/sqldef | src/parsers/sql1992_grammar.py | Python | mit | 124,558 |
import urllib.request
import os
'''if set smallFileMode to True, the program will use simpleDownload method, which may be faster for many small files but do not support break point resume.'''
smallFileMode=False
def showProgress(blockNum, blockSize, totalSize):
'''Called by urllib.request.urlretrieve
return the... | George-Gate/CERN-Video-Downloader | PerformDownload.py | Python | mit | 9,240 |
from microservice.core.decorator import microservice
@microservice
def hello_world(*args, **kwargs):
return "Hello, world!"
@microservice
def hello_other_world(*args, **kwargs):
return "Hello, other world!"
| MartinHowarth/microservice | microservice/examples/hello_world.py | Python | mit | 219 |
import numpy as np
import scipy.integrate as integ
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
import derivs
import gasproperties
import opacity
import loadinitial
import modelparameters
from multiprocessing import Poo... | egentry/stellarstructure | integrate.py | Python | mit | 6,257 |
import numpy as np
import torch
import hyperchamber as hc
import inspect
from torch.autograd import Variable
from hypergan.trainers.alternating_trainer import AlternatingTrainer
class AccumulateGradientTrainer(AlternatingTrainer):
""" G gradients accumulate over many D steps """
def _create(self):
sel... | 255BITS/HyperGAN | hypergan/trainers/accumulate_gradient_trainer.py | Python | mit | 3,338 |
from django.contrib import admin
from django.contrib.contenttypes import generic
class LinkedStackedInline(admin.StackedInline):
template = 'admin/edit_inline/stacked_linked.html'
class LinkedTabularInline(admin.TabularInline):
template = 'admin/edit_inline/tabular_linked.html'
class GenericLinkedStackedInli... | bhrutledge/debugged-django | debugged/admin/__init__.py | Python | mit | 529 |
# -*- coding: utf-8 -*-
import logging
import logging.handlers
import radio
import datetime
import sys
import os
class RadioLogger():
"""Radio logger"""
def __init__(self, LOG_FILE, VERBOSE):
"""init the logger"""
# set up formatting for console and the two log files
confor = loggin... | hephaestus9/Radio | radio/logger.py | Python | mit | 2,105 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Triangle Project Code.
# triangle(a, b, c) analyzes the lengths of the sides of a triangle
# (represented by a, b and c) and returns the type of triangle.
#
# It returns:
# 'equilateral' if all sides are equal
# 'isosceles' if exactly 2 sides are equal
# 'sca... | topliceanu/learn | python/python_koans/python2/koans/triangle.py | Python | mit | 983 |
from os import path, listdir, remove
import zipfile
from pprint import pprint
import xmltodict
files_folder = path.join(path.dirname(path.abspath(__file__)), '..', 'files')
input_folder = path.join(files_folder, 'input')
temp_folder = path.join(files_folder, 'temp')
replay_file = path.join(files_folder, 'temp', 'repl... | pkats15/hdt_analyzer | test/file_manager.py | Python | mit | 1,250 |
import sys, getopt
import sqlite3
import csv
import os
from create_cms_db import create_cms_db
#TODO: In blog, mention had to save this as CSV because only Excel provided
region_crosswalk_file = 'data/ZipHsaHrr11.csv'
inpatient_file = 'data/Medicare_Provider_Charge_Inpatient_DRG100_FY2011.csv'
outpatient_file... | jseppi/load-cms-data | load_cms_data.py | Python | mit | 7,893 |
import os
from support import store_fixture
import groundstation.store
class TestGitStore(store_fixture.StoreTestCase):
storeClass = groundstation.store.git_store.GitStore
def test_creates_required_dirs(self):
for d in groundstation.store.git_store.GitStore.required_dirs:
path = os.path.... | richo/groundstation | test/test_all_stores.py | Python | mit | 438 |
"""Functionality for manipulating multiple grism exposures simultaneously
"""
import os
import time
import glob
from collections import OrderedDict
import multiprocessing as mp
import scipy.ndimage as nd
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table
import astropy.io.fits as pyfi... | albertfxwang/grizli | grizli/multifit.py | Python | mit | 180,455 |
#David Hickox
#May 2 17
#Chap 5 test EC
#sorts a list of movies and actors
#variables
# movie, Stores the movie data
# actors, stotes the actor data
print("Welcome to the (enter name here bumbblefack) Program\n")
movie = []
actors = []
for i in range(5):
movie.append((input("Movie "+str(i+1)+"? ")).title())
... | dwhickox/NCHS-Programming-1-Python-Programs | Chap 5/MoviesProj.py | Python | mit | 954 |
# -*- coding: utf-8 -*-
"""
Largest product in a grid
https://projecteuler.net/problem=11
"""
GRID = """
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56... | kulapard/projecteuler.net | python/problem_11.py | Python | mit | 2,670 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | finaldie/final_httpd_mock | .ycm_extra_conf.py | Python | mit | 6,141 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'LMPDAStatus'
db.create_table(u'django_pjm_lmpdastatus', (... | chrisspen/django-pjm | django_pjm/migrations/0003_auto__add_lmpdastatus.py | Python | mit | 3,576 |
import json
import logging
import webapp2
from engine.search_events_interface import EventSearch
class APIHandler(webapp2.RequestHandler):
def get(self):
res = EventSearch()
city = self.request.get("city").encode('ascii', 'ignore')
city.strip()
category = self.request.get("catego... | denbedilov/ATTENDER | server/attender-mobile/api/search_endpoint.py | Python | mit | 1,199 |
from provglish import transform, prov
from provglish.lexicalisation import urn_from_uri as lex
from provglish.lexicalisation import plural_p
from provglish.prov import PROV
from provglish.nl.tools import SETTINGS, realise_sentence
import rdflib
from rdflib.plugins import sparql
from rdflib import RDF
import urllib2
... | mnestis/provglish | provglish/nl/templates/generation_template.py | Python | mit | 3,100 |
#!/usr/bin/env python3
""" Two shoppers adding items to a shared notepad """
import threading
import time
garlic_count = 0
pencil = threading.Lock() # create mutex obj
def shopper():
global garlic_count
for i in range(5):
print(threading.current_thread().getName(), 'is thinking.')
... | AtmaMani/pyChakras | python_parallel_concurrency/part1_ex_files/CH03/03_04/end/mutual_exclusion.py | Python | mit | 674 |
# The MIT License (MIT)
#
# Copyright (c) 2014-2016 Philippe Proulx <pproulx@efficios.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 ... | eepp/barectf | barectf/cli.py | Python | mit | 5,869 |
from .benchmark import *
| keurfonluu/StochOPy | stochopy/factory/__init__.py | Python | mit | 25 |
from configuration import *
import argparse
def print_configuration_vars():
"This prints configuration variables"
print "This prints configuration variables:"
print "-------------------------------------"
print "var_foo value is: " + var_foo
print "var_var value is: " + var_var
print "var_home value ... | vgonisanz/piperoScripts | python2/usage/usage-withconf-sample.py | Python | mit | 803 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-02-10 21:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comercial', '0011_metafaturamento'),
]
operations = [
migrations.AlterFiel... | anselmobd/fo2 | src/comercial/migrations/0012_metafaturamento_faturamento_integer.py | Python | mit | 464 |
#coding=utf8
"""
在同一个进程开启多个相同的spider
Ref: http://stackoverflow.com/questions/22825492/how-to-stop-the-reactor-after-the-run-of-multiple-spiders-in-the-same-process-on
"""
import sys
from twisted.internet import reactor
from scrapy.crawler import Crawler
from scrapy import log, signals
from scrapy.utils.project impo... | hitalex/weiboscraper | weiboscraper/multispider.py | Python | mit | 2,069 |
def add(s, i, x):
n = len(s)
while i < n:
s[i] += x
i += (i&(-i))
def get(s, i):
ret = 0
while i != 0:
ret += s[i]
i -= (i&(-i))
return ret
def find(s, k):
n = len(s)
beg = 0
end = n
tt = get(s, n-1)
while beg < end:
mid = (beg + end) // ... | FiveEye/ProblemSet | LeetCode/lc992.py | Python | mit | 1,820 |
##
## Copyright (c) 2014 Jan Eike von Seggern
##
from functools import wraps
from math import ceil
from time import time
from flask import render_template, session, redirect, url_for, flash, escape, abort, send_file, request, jsonify, send_from_directory
from werkzeug import check_password_hash
from .application imp... | eikevons/yorik-photos | photos/views.py | Python | mit | 8,028 |
from flask import Flask, request
import cluster
import json
app = Flask(__name__)
@app.route('/cluster/', methods=['GET', 'POST'])
def similarities():
if request.method == 'POST':
data = json.loads(request.data)
docs = data['docs']
# docs = request.form.getlist('docs')
pr... | vincentschen/tab_clustering | server/server.py | Python | mit | 645 |
from collections import namedtuple
import click
import os
import pygit2
import requests
import sys
GitObj = namedtuple("GitObj", "fname prefix hash")
def hash_gen(index):
for entry in index:
fullhex = entry.hex
fname = entry.path
prefix, h = fullhex[0:2], fullhex[2:]
yield GitObj... | ryansb/gitsniffer | gitsniffer/cli.py | Python | mit | 2,420 |
from sqlalchemy import Table, orm
from tsa.models.meta import Model, metadata, create_session
# DBSession = create_session()
class Endpoint(Model):
__table__ = Table('endpoints', metadata, autoload=True)
def trail(self, session):
# trail includes the original url at the far right of the trail
... | chbrown/tsa | tsa/models/__init__.py | Python | mit | 1,957 |
import arcas
import pandas
def test_setup():
api = arcas.Springer()
assert api.standard == 'http://api.springer.com/metadata/pam?q='
def test_keys():
api = arcas.Springer()
assert api.keys() == ['url', 'key', 'unique_key', 'title', 'author', 'abstract',
'doi', 'date', 'journa... | ArcasProject/Arcas | tests/test_springer.py | Python | mit | 3,670 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path imp... | EnEff-BIM/EnEffBIM-Framework | SimModel_Python_API/simmodel_swig/Release/SimModel_PyCallBack.py | Python | mit | 9,889 |
"""
Since the NOAAPort feed of HRRR data does not have radiation, we should
download this manually from NCEP
Run at 40 AFTER for the previous hour
"""
import subprocess
import sys
import datetime
import tempfile
import os
import requests
import pygrib
from pyiem.util import exponential_backoff, logger, utc
LOG = ... | akrherz/iem | scripts/dl/download_hrrr.py | Python | mit | 3,606 |
__author__ = 'wbtang'
import log_base
cmd_ini = log_base.file_parser_ini
class_name = 'CommandLineParser'
parser_name = 'Parser'
parser = []
debuger = []
accessors = []
members = []
default_value = []
def compress(data, num_tabs):
tab = ''
for i in range(num_tabs):
tab += '\t'
all = ''
for l... | iSuneast/p2p_vod | p2p_vod.linux_win/py/make_cmd_parser.py | Python | mit | 4,103 |
# Under MIT licence, see LICENCE.txt
from typing import Optional
from Util.ai_command import MoveTo
__author__ = "Maxime Gagnon-Legault"
import math
import numpy as np
from Util import Pose
from Util.position import Position
from Util.geometry import wrap_to_pi
from ai.GameDomainObjects import Player
RAYON_AVOID ... | RoboCupULaval/StrategyIA | ai/STA/Action/GoBehind.py | Python | mit | 3,560 |