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 __future__ import division
from past.utils import old_div
from proteus import Domain
from proteus import Context
from proteus.mprans import NCLS
from proteus import Norms
from proteus import Profiling
import numpy as np
import math
ct=Context.Options([
# General parameters #
("problem",0,"0: 1D advectio... | erdc/proteus | proteus/tests/LS_with_edgeBased_EV/NCLS/ncls.py | Python | mit | 3,708 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from wtforms import Field
from indico.util.i18n import _
from in... | mic4ael/indico | indico/modules/rb/event/fields.py | Python | mit | 1,847 |
from abc import abstractmethod
import os
import hashlib
from enum import *
from TorrentPython.Bencode import *
class MetaInfo(object):
@staticmethod
def parse_torrent(path):
if not os.path.exists(path):
return None
with open(path, 'rb') as f:
source = f.read()
... | reignofmiracle/RM_Torrent | TorrentPython/TorrentPython/MetaInfo.py | Python | mit | 5,799 |
import requests
import logging
from requests.exceptions import RequestException
from lxml import etree
from scholarly_citation_finder.lib.process import ProcessException
from .CiteseerParser import CiteseerParser
logger = logging.getLogger(__name__)
class CiteseerExtractor:
'''
CiteSeerExtractor
'''
... | citationfinder/scholarly_citation_finder | scholarly_citation_finder/tools/extractor/citeseer/CiteseerExtractor.py | Python | mit | 2,741 |
# -*- 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 'Registrant'
db.create_table(u'cruiser_registrant', (
... | code-md/code.md | cruiser/migrations/0001_initial.py | Python | mit | 2,036 |
# 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/quota/azure-mgmt-quota/azure/mgmt/quota/models/_azure_quota_extension_api_enums.py | Python | mit | 1,886 |
import os, sys
try:
from setuptools import setup, Command
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, Command
long_description = """
The `py.test`` testing tool makes it easy to write small tests, yet
scales to support complex functiona... | jeppeter/pytest | setup.py | Python | mit | 4,290 |
# -*- coding: utf-8 -*-
#
# conduit documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 17 15:39:20 2013.
#
# 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... | sleibman/python-conduit | doc/conf.py | Python | mit | 8,107 |
# Shmup - Part 17
# explosions
# by KidsCanCode 2015
# A space shmup in multiple parts
# For educational purposes only
# Art from Kenney.nl
# Frozen Jam by tgfcoder <https://twitter.com/tgfcoder> licensed under CC-BY-3
import pygame
import random
from os import path
sound_dir = path.join(path.dirname(__file__), 'sn... | kidscancode/gamedev | shmup/shmup-17.py | Python | mit | 11,848 |
"""
Post Repos to a Solr engine.
"""
import sys
from optparse import make_option
import unicodedata
import urllib
import httplib2
import json
from django.core.management.base import BaseCommand, CommandError
from portal.models import Repository as DjRepository, \
Contact as DjContact, Collection, OtherName
f... | mikesname/ehri-collections | ehriportal/portal/management/commands/import_icaatom.py | Python | mit | 7,307 |
#!/usr/bin/python
import cv
cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE)
#SET CAMERA INDEX BELOW
camera_index = -1
capture = cv.CreateFileCapture('/home/ilya/src_open_cv/vsplesk.mp4')
isRunning = True
image = cv.QueryFrame(capture)
def repeat():
global capture #declare as globals since we are assigning to them no... | juhnowski/opencv_hello_world | test_video.py | Python | mit | 670 |
#!/usr/bin/env python3
# ~*~ coding: utf-8 ~*~
# Update at least the phone numbers program (in section Dictionaries) so it
# doesn't crash if a user doesn't enter any data at the menu.
def print_menu():
print('1. Print Phone Numbers')
print('2. Add a Phone Number')
print('3. Remove a Phone Number')
prin... | JoseALermaIII/python-tutorials | pythontutorials/books/wikibook/Chapter 18/C18-Exercise1.py | Python | mit | 1,506 |
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from rest_framework.decorators import detail_route
from bojv4.conf import LANGUAGE
from .abstract_models import NormalSubmission as Submission
from .forms import SubmissionForm
from .serializers import SubmissionSerializer
from ... | BUPT-OJ-V4/BOJ-V4 | submission/views.py | Python | mit | 6,703 |
import numpy as np
from codim1.core.basis_funcs import basis_from_nodes, basis_from_degree,\
get_equispaced_nodes, gll_basis, \
apply_coeffs, basis_from_func
from codim1.fast_lib import CoeffBasis, ConstantBasis
from codim1.core.mesh_gen import cir... | tbenthompson/codim1 | test/test_basis_funcs.py | Python | mit | 4,701 |
from __future__ import absolute_import
import mxnet as mx
import numpy as np
import argparse
caffe_flag = True
try:
import caffe
from caffe.proto import caffe_pb2
except ImportError:
caffe_flag = False
from .caffe_parse import caffe_pb2
def protoBlobFileToND(proto_file):
data = ''
file = open... | zhreshold/mxnet-ssd | tools/caffe_converter/mean_image.py | Python | mit | 1,535 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('umibukela', '0050_auto_20181119_1140'),
]
operations = [
migrations.AlterField(
model_name='programmeresources',... | Code4SA/umibukela | umibukela/migrations/0051_auto_20181119_1201.py | Python | mit | 692 |
from distutils.core import setup
setup(
name='Camera',
version='0.1',
py_modules=['camera'],
license='The MIT License',
long_description=open('README.rst').read(),
install_requires=['pyyaml', 'numpy', 'matplotlib', 'scipy']
)
| smidm/camera.py | setup.py | Python | mit | 251 |
import sys
from rat import rat
def decrypt(fcyphertext,fsample):
c = open(fcyphertext,'r')
s = open(fsample, 'r')
cyphertext = c.read()
sample = s.read()
cyphertext_freq = dict()
sample_freq = dict()
alphabet = "qwertyuiopasdfghjklmnbvcxz"
for a in alphabet:
... | chamoysvoice/rat13 | decrypt.py | Python | mit | 2,129 |
# coding: utf-8
import urllib
import urllib2
import numpy as np
from PIL import Image
from cStringIO import StringIO
from sklearn.externals import joblib
def verify(url, model, save=False):
"""
:param url: 验证码地址
:param model: 处理该验证码的模型
:param save: 是否保存临时文件到cache
:return:
"""
if save:
... | skyduy/zfverify | Verify-Sklearn/predict.py | Python | mit | 1,469 |
#!/usr/bin/env python
import gc
import json
import zmq
from cereal import car, log
from common.numpy_fast import clip
from common.realtime import sec_since_boot, set_realtime_priority, Ratekeeper
from common.profiler import Profiler
from common.params import Params
import selfdrive.messaging as messaging
from selfdrive... | TheMutley/openpilot | selfdrive/controls/controlsd.py | Python | mit | 17,974 |
import unittest
from cpolynomial import Polynomial
from cff import GF2int
class cTestGFPoly(unittest.TestCase):
"""Tests that the Polynomial class works when given GF2int objects
instead of regular integers
"""
def test_add(self):
one = Polynomial(map(GF2int, [8,3,5,1]))
two = Poly... | lrq3000/pyFileFixity | pyFileFixity/lib/brownanrs/cpolynomialtest.py | Python | mit | 7,908 |
"""
Django settings for avalonline project.
Generated by 'django-admin startproject' using Django 1.8.13.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build ... | fako/avalonline | avalonline/settings.py | Python | mit | 2,668 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from ftplib import FTP
import socket
import os,sys
def re_clean(ftp,f):
'''
删除文件或文件夹 若删除后母文件夹为空 则删除母文件夹 递归执行
'''
try:
ftp.delete(f)
except:
pass
try:
ftp.rmd(f)
except:
pass
dir = os.path.split(f)[0]
if dir... | linuxcaffe/taskextras.org | tools/ftp.py | Python | mit | 1,589 |
# coding=UTF-8
# General modules.
import os, os.path
import logging
import sys
from threading import Timer
import string
import random
# Tornado modules.
import tornado.ioloop
import tornado.web
import tornado.websocket
import tornado.auth
import tornado.options
import tornado.escape
from tornado import gen
# Redis ... | nislag/chat-bot-tornado | app.py | Python | mit | 10,934 |
from __future__ import absolute_import
__author__ = 'katharine'
"""
This file is special in that it actually contains definitions of
blobdb blob formats rather than pebble protocol messages.
"""
from copy import deepcopy
from enum import IntEnum
from .base import PebblePacket
from .base.types import *
from .timeline... | pebble/libpebble2 | libpebble2/protocol/appglance.py | Python | mit | 2,183 |
"""
This module provides functions that return API objects in
a clearly defined, consistent manner. Schmea representing
data types mirror the column order used by the sqlite
database. An sql object can be unpacked by using star
expansion as an argument, such as thread(*sql_thread_obj)
Each response has a base layout a... | desvox/bbj | src/schema.py | Python | mit | 4,469 |
import json
import logging
import os
import flask
import jinja2
import werkzeug
import yaml
import bhamon_website
import bhamon_website.render
main_logger = logging.getLogger("Website")
request_logger = logging.getLogger("Request")
def configure(application, title):
application.config["WEBSITE_TITLE"] = title
a... | BenjaminHamon/MyWebsite | website/bhamon_website/website.py | Python | mit | 4,516 |
# Local settings for mothra project.
LOCAL_SETTINGS = True
from settings import *
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': os.path.join(PROJECT_DIR, 'mothra.db'), # Or path to database file ... | xflows/textflows | mothra/__local_settings.py | Python | mit | 2,573 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file environ.py
@author Allen Woods
@date 2016-07-29
@version 16-7-29 下午2:51 ???
SUMO simulation environment
"""
import os
import sys
import time
import socket
from subprocess import Popen, PIPE
import pandas as pd
import numpy as np
from time impor... | allenwoods/parasys | SumoEnv/simulation.py | Python | mit | 11,039 |
def make_board_method1(size, initial_value="."):
"""
This is a short way to create the grid using a 'list comprehension'. This creates a list
0*n or [0 for i in range(n)] and duplicates this list within an outer list -
newList*n or [[0 for i in range(n)] for j in range(n)]
:param size: Number of ro... | markfoleyie/Teaching201718 | Python/list_2d.py | Python | mit | 2,187 |
import febio
# create a MeshDef object, mesh, reading in simpleblock.inp in abaqus format
mesh = febio.MeshDef('simpleblock.inp','abq')
#add a shell element to the mesh
mesh.addElement(etype='quad4',corners=[0.,1.,1.,1.,1.,1.,1.,0.,1.,0.,0.,1.],name='plane')
#add element data for the shell
mesh.addElementData(elset=... | siboles/pyFEBio | febio/verification/sliding.py | Python | mit | 2,046 |
import requests
import time
import trip_advisor_api as TripAPI
import enchant
import os
ACCESS_TOKEN = os.environ['GROUPME_TOKEN']
group_id = os.environ['GROUPME_GROUP_ID']
bot_name = "Foo-Bot"
bot_id = os.environ['GROUPME_BOT_ID']
keyword = "@foo-bot" #keyword to summon the bot
name = "" #this will be modified by mai... | CharlieIO/Foo-Bot | main.py | Python | mit | 8,127 |
import urllib
import hashlib
from django import template
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.utils.html import format_html
from avatar import AVATAR_DEFAULT_URL, AVATAR_GRAVATAR_BACKUP
from avatar import AVATAR_GRAVATAR_DEFAULT
register = templat... | amarandon/smeuhsocial | apps/avatar/templatetags/avatar_tags.py | Python | mit | 2,208 |
from sqlalchemy_jsonapi.errors import (
BadRequestError, NotAnAttributeError, NotSortableError)
def test_200_with_no_querystring(bunch_of_posts, client):
response = client.get('/api/posts').validate(200)
assert response.json_data['data'][0]['type'] == 'posts'
assert response.json_data['data'][0]['id']... | bladams/sqlalchemy-jsonapi | sqlalchemy_jsonapi/tests/test_collection_get.py | Python | mit | 4,809 |
import pytest
from spacy.tokens import Doc
@pytest.fixture
def words():
# fmt: off
return [
"\n", "It", "was", "a", "bright", "cold", "day", "in", "April", ",",
"and", "the", "clocks", "were", "striking", "thirteen", ".", "\n",
"Winston", "Smith", ",", "his", "chin", "nuzzled", "into",... | spacy-io/spaCy | spacy/tests/parser/test_parse_navigate.py | Python | mit | 6,161 |
import csv
from rest_framework.decorators import detail_route, list_route
from django.shortcuts import get_object_or_404
from rest_framework.response import Response
from rest_framework import status
from rest_framework import serializers as serializers_library
from django.db import transaction
from django.http import... | fernandolobato/balarco | works/views.py | Python | mit | 20,641 |
from .builder import builder
__version__='0.1.5'
| web-i/ripplet | ripple/__init__.py | Python | mit | 51 |
# 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 dataclasses import dataclass
from enum import Enum, auto
import math
import numpy as np
from typing import Tuple, List, Optional, Dict
i... | pytorch/fairseq | examples/wav2vec/unsupervised/models/wav2vec_u.py | Python | mit | 20,954 |
# coding: utf-8
from flask import current_app
from flask_wtf import FlaskForm
from wtforms import HiddenField, StringField, TextAreaField, SelectField
from wtforms.validators import InputRequired
from wtforms import ValidationError
from ..models import Software, Idc, Server
class AddSoftwareForm(FlaskForm):
name ... | spark8103/ops17 | app/cmdb/forms.py | Python | mit | 4,108 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lopenr.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| heyavery/lopenr | manage.py | Python | mit | 249 |
from datetime import datetime as DT
import pytest
from poultry import consumers
from poultry.tweet import Tweet
from poultry.merge import merge, _merger, _conductor, _tagger
from .test_consumers import consume_iterable, to_list
@pytest.fixture
def a():
return 'a', 'cc', 'd'
@pytest.fixture
def b():
retur... | dimazest/poultry | tests/test_merge.py | Python | mit | 8,381 |
#!/usr/bin/env python
"""
.. module:: keywords
:synopsis: keywords chooser and editor dialogs.
"""
import os
import shutil
import uuid
from PyQt4 import QtCore, QtGui
import logger
class KeywordChooserMVC(QtGui.QListView):
"""
Encapsulates a list view specialized for selecting keywords. This is
wher... | HazenBabcock/APyEC | apyec/keywords.py | Python | mit | 5,085 |
previous = 1
current = 2
sum = 0
while (current < 4000000):
if (current % 2 ==0):
sum += current
nextNum = previous + current;
previous = current;
current = nextNum;
print sum
# My solution uses a while loop, variables for the current and previous fibonacci sequence numbers and a sum variable.
# The w... | Chane-O/CloudComputing | Problem2.py | Python | mit | 779 |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the top-level project fold... | hguochen/mediapop | mediapop/mediapop/settings/base.py | Python | mit | 7,501 |
#!/usr/bin/env python
'''
Copyright (c) 2016 anti-XSS developers
'''
class Page(object):
'''
A class to store the page
'''
url = ''
html = ''
def __init__(self, url='', html=''):
self.url = url
self.html = html
pass
def get_html(self):
return self.html
| lewangbtcc/anti-XSS | lib/var/page.py | Python | mit | 319 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-13 23:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('picture', '0007_auto_20161013_2250'),
]
operations = [
migrations.RenameField(
... | ZzCalvinzZ/picturepay | picture/migrations/0008_auto_20161013_2311.py | Python | mit | 431 |
# 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/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_configuration.py | Python | mit | 3,353 |
#!/usr/bin/env python
from time import sleep
# importing SDK modules
from Veridu.SDK.API import API
from Veridu.SDK.Session import Session
# importing client configuration
from settings import VeriduSettings
# Unique username assigned by your system
# more info: https://veridu.com/wiki/User_ID
username = "unique-us... | veridu/samples | python/challenge-widget/index.py | Python | mit | 2,662 |
from fastapi import FastAPI, Request, status
from fastapi.encoders import jsonable_encoder
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
from pydantic import BaseModel
app = FastAPI()
@app.exception_handler(RequestValidationError)
async def validation_exception_hand... | tiangolo/fastapi | docs_src/handling_errors/tutorial005.py | Python | mit | 667 |
"""Loss module contains definition of loss functions"""
import numpy as np
import math
class Softmax:
def f(scores, label, margin=0):
nomin = math.exp(scores[label.argmax()])
denom = np.sum(np.exp(scores))
return -math.log(nomin / denom)
def fprime(scores, label):
return scor... | matthieudelaro/pyNet | src/Loss.py | Python | mit | 373 |
# Copyright (c) 2003-2016 CORE Security Technologies
#
# This software is provided under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Description: Performs various techniques to dump hashes from the
# remote machine without exec... | tholum/PiBunny | system.d/library/tools_installer/tools_to_install/impacket/impacket/examples/secretsdump.py | Python | mit | 97,126 |
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from rest_framework import serializers
from postapi.models import Box, DeliveredPost, Post, Subscription
class UserSerializer(serializers.HyperlinkedModelSerializer):
'''Translates between the User model and multiple ser... | ods94065/opost | postapi/serializers.py | Python | mit | 4,374 |
from django.conf.urls import include, url
from registerApp.views import *
import allauth
from django.contrib.auth.decorators import login_required
urlpatterns = [
url(r'^$', customRegister.as_view()),
url(r'^login/$', customLogin.as_view()),
url(r'^logout/$', customLogout.as_view()),
url(r'^accou... | siddver007/project_django_allauth_slate_razorpay | registerApp/urls.py | Python | mit | 496 |
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
from nonconformist.base import ClassifierAdapter
from nonconformist.icp import IcpClassifier
from nonconformist.nc import ClassifierNc
data = load_iris()
x, y = data.data, data.target
fo... | donlnz/nonconformist | examples/confidence_credibility.py | Python | mit | 873 |
# -*- coding: utf-8 -*-
__title__ = 'envassume'
__version__ = '1.0.7'
__author__ = 'Warren Moore'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2017 Warren Moore'
| wamonite/envassume | envassume/__init__.py | Python | mit | 169 |
"""real_estate_agency URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home... | Dybov/real_estate_agency | real_estate_agency/real_estate_agency/urls.py | Python | mit | 2,350 |
import pytest
import matplotlib
matplotlib.use('AGG') # use a non-interactive backend
from matplotlib import pyplot as plt
from lifetimes import plotting
from lifetimes import BetaGeoFitter, ParetoNBDFitter, ModifiedBetaGeoFitter
from lifetimes.datasets import load_cdnow_summary, load_transaction_data
from lifetimes ... | aprotopopov/lifetimes | tests/test_plotting.py | Python | mit | 5,568 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import hashlib
import tempfile
import unittest
import pytest # type: ignore
from _pytest.monkeypatch import MonkeyPatch # type: ignore
from monty.json import MontyDecoder
from pymatgen.core import SETTINGS
from pymatgen.c... | vorwerkc/pymatgen | pymatgen/io/vasp/tests/test_sets.py | Python | mit | 68,902 |
[x, k] = list(map(int, raw_input().split()))
print(eval(raw_input()) == k)
| alexander-matsievsky/HackerRank | All_Domains/Python/Built_Ins/input.py | Python | mit | 75 |
###############################################################################
# UsageReportTools.py
# Jeremy Clay
# July 14, 2016
#
# Contains tools needed to generate a monthly usage report of Mt Moran.
# This file will need to be included in the CoreHoursByMonthReport.py file.
# The reportlab library for python wi... | WyoARCC/arcc_metrics | CoreHours/UsageReportTools.py | Python | mit | 6,826 |
# -*- coding: utf-8 -*-
from urwid import Divider
def parse_tag_from_node(node):
div_char = node.attr.div_char or u' '
top = int(node.attr.top or 0)
bottom = int(node.attr.bottom or 0)
return Divider(div_char=div_char, top=top, bottom=bottom)
| soasme/riotpy | riot/tags/div.py | Python | mit | 261 |
"""View functions for coverage_manager app"""
import logging
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from git_manager.helpers.github_helper import get_github_helper
from help... | MOOCworkbench/MOOCworkbench | coverage_manager/views.py | Python | mit | 3,884 |
"""Per-test stdout/stderr capturing mechanism."""
import contextlib
import functools
import io
import os
import sys
from io import UnsupportedOperation
from tempfile import TemporaryFile
from typing import Any
from typing import AnyStr
from typing import Generator
from typing import Generic
from typing import Iterator
... | The-Compiler/pytest | src/_pytest/capture.py | Python | mit | 32,330 |
import os
import math
import numpy
import pyopencl as cl
import pyopencl.array
import time
from PIL import Image
if __name__ == '__main__':
print('load program from cl source file')
f = open('gray.cl', 'r', encoding='utf-8')
kernels = ''.join(f.readlines())
f.close()
print('prepare data ... ')
... | PyOCL/pyopencl-examples | 4-1-ext/gray.py | Python | mit | 4,357 |
from __future__ import print_function
import pandas as pd
#import vcf
import sys, os, re
import func
import collections
import logging
class Variants:
"""Class describing a vcf file. Consists of pandas data frame, and metadata found in the vcf header.
Start, end coordinates are zero-based, half-open """
... | asalomatov/variants | variants/variants.py | Python | mit | 19,481 |
"""Do a comparison with what's on CRH CAP"""
import datetime
from io import StringIO
import requests
import pandas as pd
from pandas.io.sql import read_sql
from pyiem.util import get_dbconn
# Akami has this cached, so we shall cache bust it, please
NOUNCE = "?%s" % (datetime.datetime.now().strftime("%Y%m%d%H%M%S"))
U... | akrherz/iem | cgi-bin/compare_crh.py | Python | mit | 3,550 |
from ..override_audit import reload
reload("src", ["core", "events", "contexts", "browse", "pkg_popup", "settings_proxy"])
reload("src.commands")
from . import core
from .core import *
from .events import *
from .contexts import *
from .commands import *
__all__ = [
# core
"core",
# browse
"browse",... | OdatNurd/OverrideAudit | src/__init__.py | Python | mit | 1,169 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from rest_framework.serializers import ModelSerializer
from models import TodoItem
__author__ = "wangyixiang"
class TodoItemSerializer(ModelSerializer):
class Meta:
model = TodoItem
| wangyixiang/sstest | todo-django/mydjango/todo_webapi/serializers.py | Python | mit | 244 |
#ImportModules
import ShareYourSystem as SYS
import collections
#Define and set child setters in a child dict
MySetter=SYS.SetterClass(
)['array*set'](
[['A','B'],['1','2'],['a','b']],
[
#for the A, B all set
SYS.SetterClass(),
#for 1 and 2 each set
[
{
'MyInt':0
},
{
'MyStr':"he... | Ledoux/ShareYourSystem | Pythonlogy/ShareYourSystem/Standards/Itemizers/Setter/draft/09_ExampleDoc copy.py | Python | mit | 436 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class MemberTestCase(Integratio... | twilio/twilio-python | tests/integration/ip_messaging/v2/service/channel/test_member.py | Python | mit | 11,702 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-04-21 16:58
from __future__ import unicode_literals
from django.db import migrations, models
import hashid_field.field
class Migration(migrations.Migration):
dependencies = [
('library', '0002_auto_20170221_1833'),
]
operations = [
... | nshafer/django-hashid-field | sandbox/library/migrations/0003_auto_20170421_1658.py | Python | mit | 777 |
#!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@ author: magic
"""
import scrapy
from btianmao.items import BtianmaoItem
class TMaoSpider(scrapy.Spider):
name = "tm_goods"
allowed_domain = ['http://www.tianmao.com']
start_urls = (
"https://list.tmall.com/search_product.htm?spm=a220m.1000858.10007... | csunny/blog_project | source/libs/blog_scrapy/btianmao/btianmao/spiders/tm.py | Python | mit | 1,837 |
from multiprocessing import Process, Queue, Pipe
def f(q):
q.put([42, None, 'hello'])
def f2(conn):
conn.send([42, None, 'hello'])
conn.close()
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=(q,))
p.start()
print(q.get())
p.join()
parent_conn, chile_conn = P... | minfun/leetcode | notes/queue_pipe.py | Python | mit | 433 |
from ethereum import abi
import time
import os
import json
from ethereum.utils import encode_hex, str_to_bytes
FILL = 1
VERIFY = 2
TIME = 3
fixture_path = os.path.join(os.path.dirname(__file__), '../..', 'fixtures')
def fill_abi_test(params): return run_abi_test(params, FILL)
def check_abi_test(params): return ru... | karlfloersch/pyethereum | ethereum/tools/testutils.py | Python | mit | 2,703 |
def remove(self,currentNode):
if currentNode.isLeaf(): #leaf
if currentNode == currentNode.parent.leftChild:
currentNode.parent.leftChild = None
else:
currentNode.parent.rightChild = None
elif currentNode.hasBothChildren(): #interior
succ = currentNode.findSuccessor()
succ.spliceOut... | robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_6_35.py | Python | mit | 1,651 |
from django.shortcuts import render
from django.template.loader import render_to_string
from django.forms import formset_factory
from . import forms, utils
# Create your views here.
def index(request):
rules = None
if request.method == 'POST':
ifaces = forms.InterfacesForm(request.POST)
rul... | Kromey/piroute | iptables/views.py | Python | mit | 882 |
#!/usr/bin/env python3
import rospy
import struct
from pymodbus.client.sync import ModbusSerialClient as modbus
from sensor_msgs.msg import Temperature
from std_msgs.msg import Float32
from geometry_msgs.msg import PoseWithCovarianceStamped
def publish():
sensor = modbus(method='rtu', port='/dev/ucfsub/depth', baudra... | RoboticsClubatUCF/RoboSub-BBB | ucf_sub/src/sub_sensors/src/MOBUSDepth.py | Python | mit | 1,652 |
# encoding: utf-8
from enum import Enum
class LockState(Enum):
INVALID = (False, True, False, True, True)
LOCKED = (True, False, False, False, False)
UNLOCKED = (False, True, False, False, False)
OWNER = (True, False, True, False, False)
ORPHANED = (True, True, False, True, False)
OUTDATED = (... | michalbachowski/pylock | pylock/states.py | Python | mit | 661 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of restful-distributed-lock-manager released under the MIT license.
# See the LICENSE file for more information.
from rdlm.request_handler import RequestHandler
class HelloHandler(RequestHandler):
"""Class which handles the / URL"""
def get... | thefab/restful-distributed-lock-manager | rdlm/hello_handler.py | Python | mit | 466 |
from typing import Dict, List, Optional, Tuple, Union, Sequence
import numpy as np
import tensorflow as tf
from typing_extensions import Literal
from odin.networks import Networks, TrainStep
from odin.backend import TensorType
from odin.utils import as_tuple
from scipy import sparse
from tensorflow.python.data.ops.da... | imito/odin | odin/bay/vi/_base.py | Python | mit | 14,586 |
#ex 38 lpthw
ten_things = "Apples Oranges Crows Telephone Light Sugar"
print "Wait there are not ten things in that list, let's fix that."
stuff = ten_things.split(' ')
more_stuff = ["Day", "Night", "Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"]
while len(stuff) != 10:
next_one = more_stuff.pop()
print "Addi... | drchc15/lpthw | ex38.py | Python | mit | 619 |
"""
IC Inventory
Inventory Screen Setup
by Taylor Schweizer
"""
#Import Statements
from tkinter import *
from tkinter.ttk import *
from main.utilities.multilistbox import MultiListbox
from main.octopart.octo_utils import *
#Inventory Screen Class
class InventoryScreen(Frame):
"""
Inventory Screen class co... | tjschweizer/IC-Inventory | main/screens/inventory_screen.py | Python | mit | 1,604 |
from .base import *
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'zblog', # Or path to database file if using sqlite3.
# The following settings are not used wi... | zhengze/zblog | zblogsite/settings/dev.py | Python | mit | 774 |
"""
Module for reading Gaussian cube files, which have become one of the standard file formats for volumetric data
in quantum chemistry and solid state physics software packages (VASP being an exception).
Some basic info about cube files (abridged info from http://paulbourke.net/dataformats/cube/ by Paul Bourke)
The ... | davidwaroquiers/pymatgen | pymatgen/io/cube.py | Python | mit | 4,796 |
from django.http import JsonResponse
from ...base.processa import ListaArquivos
import os
from django.conf import settings
lista_arquivos = ListaArquivos
def lista_arvore(request):
caminho = request.GET.get('caminho', None)
if(caminho == '/'):
caminho = settings.MEDIA_URL
meuDir = caminho
dire... | Dturati/projetoUFMT | estagio/estagio/base/lista_arvore/lista_arvore.py | Python | mit | 1,288 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-07-02 15:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('main', '0002_detailedservice_brutto_price'),
('dgcr... | DenysGurin/solnce | dgcrm/migrations/0015_auto_20170702_1522.py | Python | mit | 1,896 |
import properties
#POSTags = ['ADJA', 'ADJD', 'ADV', 'APPO', 'APPR', 'APPRART', 'APZR', 'ART', 'CARD', 'ITJ', 'KOKOM', 'KON', 'KOUI', 'KOUS', 'NE', 'NN', 'PDAT', 'PDS', 'PIAT', 'PIDAT', 'PIS', 'PPER', 'PPOSAT', 'PPOSS', 'PRELAT', 'PRELS', 'PRF', 'PROP', 'PTKA', 'PTKANT', 'PTKNEG', 'PTKVZ', 'PTKZU', 'PWAT', 'PWAV', 'P... | sureshbvn/nlpProject | SVM_B/features_test.py | Python | mit | 2,574 |
from __future__ import print_function
def add_native_methods(clazz):
def getClass____(a0):
raise NotImplementedError()
def hashCode____(a0):
raise NotImplementedError()
def clone____(a0):
raise NotImplementedError()
def notify____(a0):
raise NotImplementedError()
... | laffra/pava | pava/implementation/natives/java/lang/Object.py | Python | mit | 877 |
import os
import sys
import subprocess
import time
from threading import Thread
from wsgiref import simple_server
def application(environ, start_response):
"""
"""
start_response('200 OK', [])
return [b'xxx']
def start_serve():
httpd = simple_server.WSGIServer(('', 8000), simple_server.WSGI... | huangbop/bosk | management/commands/runserver.py | Python | mit | 931 |
"""Perform hardware operations."""
import asyncio
import os
import random
import statistics
import time
from mpf.core.config_loader import YamlMultifileConfigLoader
from mpf.commands import MpfCommandLineParser
from mpf.core.machine import MachineController
SUBCOMMAND = True
class Command(MpfCommandLineParser):
... | missionpinball/mpf | mpf/commands/hardware.py | Python | mit | 9,398 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
import pypandoc
description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
description = 'Basic implementation of Nelder-Mead Simplex algorithm.'
setup(
name='Simplex',
version='... | kubkon/simplex | setup.py | Python | mit | 697 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | RyanHope/AutobahnPython | examples/asyncio/wamp/rpc/options/frontend.py | Python | mit | 2,450 |
#@result Submitted a few seconds ago • Score: 10.00 Status: Accepted Test Case #0: 0.01s Test Case #1: 0s
# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(raw_input())
print hash(tuple(map(int, raw_input().split())))
| FeiZhan/Algo-Collection | answers/hackerrank/Tuples.py | Python | mit | 250 |
#!/usr/bin/env python3
import json
import logging
import urllib.parse
import urllib3
from flask import current_app
logger = logging.getLogger('coverurl')
class CoverURL:
SEARCH_URL = "https://ws.audioscrobbler.com/2.0/?"
def __init__(self, api_key):
self.params = {
'format': 'json',
... | magne4000/festival | festivallib/coverurl.py | Python | mit | 2,082 |
from __future__ import print_function
from acq4.devices.Device import Device, DeviceTask, TaskGui
from acq4.util import Qt
from six.moves import range
class Screen(Device):
"""
Device used for screen output.
Currently, this is only used to blank the screen temporarily to avoid
contaminating sen... | acq4/acq4 | acq4/devices/Screen.py | Python | mit | 4,187 |
class IMDB:
heroes = [
{'id': 11, 'name': 'Mr. Nice'},
{'id': 12, 'name': 'Narco'},
{'id': 13, 'name': 'Bombasto'},
{'id': 14, 'name': 'Celeritas'},
{'id': 15, 'name': 'Magneta'},
{'id': 16, 'name': 'Rubb... | sameer-j/ng2-flask | in_memory_db.py | Python | mit | 1,549 |
import json
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.humanize.templatetags import humanize
from django.core.mail import EmailMultiAlternatives
from django.http import JsonResponse
from django.http.resp... | FireCARES/firecares | firecares/firecares_core/ext/registration/views.py | Python | mit | 7,327 |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Ecs20130110AuthorizeSecurityGroupRequest(RestApi):
def __init__(self,domain='ecs.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.IpProtocol = None
self.NicType = None
self.Policy = None
self.PortRange = None
... | francisar/rds_manager | aliyun/api/rest/Ecs20130110AuthorizeSecurityGroupRequest.py | Python | mit | 514 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Shirecoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
i... | shirecoin/shirecoin | share/qt/clean_mac_info_plist.py | Python | mit | 898 |
"""
Contains functions and classes needed for processing the Network Status Page
"""
from __future__ import division
from datetime import datetime
import json
import re
import urllib
from flask import copy_current_request_context, url_for
from flask_socketio import emit
import forecastio
import gevent
import paramik... | rohankapoorcom/Network-Status-Page | status/functions.py | Python | mit | 16,930 |