code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.4, generator: @autorest/python@5.12.4) # Changes may cause incorrect behavior and will be lost if the code is regenerated. # ------------------------------...
Azure/azure-sdk-for-python
sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/_container_registry.py
Python
mit
4,280
# 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/network/azure-mgmt-network/azure/mgmt/network/v2021_05_01/operations/_peer_express_route_circuit_connections_operations.py
Python
mit
9,496
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # pylint: ...
Azure/azure-sdk-for-python
sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_upload_helper.py
Python
mit
4,443
# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py
Python
mit
49,142
from decimal import Decimal map_ones = { 0: "", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five", 6: "Six", 7: "Seven", 8: "Eight", 9: "Nine", } map_tens = { 10: "Ten", 11: "Eleven", 12: "Twelve", 13: "Thirteen", 14: "Fourteen", 15: "Fifteen", 16...
pirsquare/chequeconvert-python
chequeconvert/base.py
Python
mit
6,111
import numpy as np import torch import os import sys import functools import torch.nn as nn from torch.autograd import Variable from torch.nn import init import torch.nn.functional as F import torchvision.models as M class GANLoss(nn.Module): def __init__(self, target_real_label=1.0, target_fake_label=0.0, ...
orashi/PaintsPytorch
models/base_model.py
Python
mit
9,627
# coding: utf-8 """ Routines for printing a report. """ from __future__ import print_function, division, absolute_import import sys from collections import namedtuple from contextlib import contextmanager import textwrap from .adapters import BACK, FRONT, PREFIX, SUFFIX, ANYWHERE from .modifiers import QualityTrimmer,...
Chris7/cutadapt
cutadapt/report.py
Python
mit
10,176
# Copyright (c) 2015-2016 Cisco Systems # # 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, publ...
rjfellman/molecule
test/unit/verifier/test_trailing.py
Python
mit
2,152
#!python3 # -*- coding:utf-8 -*- import os import sys import time import ctypes import shutil import subprocess IsPy3 = sys.version_info[0] >= 3 if IsPy3: import winreg else: import codecs import _winreg as winreg BuildType = 'Release' IsRebuild = True Build = 'Rebuild' Update = False C...
xylsxyls/xueyelingshuang
src/storageMysql/scripts/rebuild_storage.py
Python
mit
13,961
""" kNN digit classifier, converting images to binary before training and classification. Should (or should allow for) reduction in kNN object size. """ import cv2 from utils import classifier as cs from utils import knn from utils import mnist class KnnBinary(knn.KnnDigitClassifier): def train(self, i...
uozuAho/mnist-ocr
src/knn_binary.py
Python
mit
1,150
""" Support for Z-Wave. For more details about this component, please refer to the documentation at https://home-assistant.io/components/zwave/ """ import logging import os.path import time from pprint import pprint from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, ATTR_LOCATION, CONF_CUST...
Julian/home-assistant
homeassistant/components/zwave.py
Python
mit
16,822
from django.conf import settings from django.db import models from django.utils import timezone from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType import jsonfield from .signals import event_logged class Log(models.Model): user = models....
rosscdh/pinax-eventlog
pinax/eventlog/models.py
Python
mit
1,510
from setuptools import setup, find_packages with open('README.md') as fp: long_description = fp.read() setup( name='typeform', version='1.1.0', description='Python Client wrapper for Typeform API', long_description=long_description, long_description_content_type='text/markdown', keywords=[...
underdogio/typeform
setup.py
Python
mit
1,168
from epic.utils.helper_functions import lru_cache from numpy import log from scipy.stats import poisson @lru_cache() def compute_window_score(i, poisson_parameter): # type: (int, float) -> float # No enrichment; poisson param also average if i < poisson_parameter: return 0 p_value = poisson....
endrebak/epic
epic/statistics/compute_window_score.py
Python
mit
501
#!/usr/bin/python """ Visualizing H fractal with tkinter. ======= License ======= Copyright (c) 2017 Thomas Lehmann 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 ...
Nachtfeuer/concept-py
examples/hfractal.py
Python
mit
4,958
#!/usr/bin/python import serial ser = serial.Serial('COM9', 9600) ser.write(b'5~') ser.close()
GeoffSpielman/Hackathin_Examples
Python_To_Arduino_Communication/Python_To_Arduino_Communication.py
Python
mit
96
#!/usr/bin/python # by: Mohammad Riftadi <riftadi@jawdat.com> # Testing Database instance for CPE Manager from pymongo import MongoClient import hashlib client = MongoClient('mongodb://localhost:27017/') dbh = client.jawdat_internal #drop if collections exists dbh.drop_collection("resetpass") #drop if collections e...
riftadi/smallcorptools
sct_initdb.py
Python
mit
11,668
import os import traceback from mantidqt.utils.asynchronous import AsyncTask from addie.processing.mantid.master_table.master_table_exporter import TableFileExporter as MantidTableExporter # Mantid Total Scattering integration # (https://github.com/marshallmcdonnell/mantid_total_scattering) try: import total_scat...
neutrons/FastGR
addie/processing/mantid/launch_reduction.py
Python
mit
3,590
from amqpstorm.management import ManagementApi from amqpstorm.message import Message from amqpstorm.tests import HTTP_URL from amqpstorm.tests import PASSWORD from amqpstorm.tests import USERNAME from amqpstorm.tests.functional.utility import TestFunctionalFramework from amqpstorm.tests.functional.utility import setup ...
eandersson/amqpstorm
amqpstorm/tests/functional/management/test_basic.py
Python
mit
2,514
from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals from __future__ import division import numpy as np from scipy.constants import mu_0, pi, epsilon_0 import numpy as np from SimPEG import Utils def E_field_from_SheetCurruent(XYZ, srcLoc, sig, t, E0=1., ...
geoscixyz/em_examples
em_examples/TDEMPlanewave.py
Python
mit
1,761
"""backtest.py, backunttest.py and coveragetest.py are all taken from coverage.py version 3.7.1"""
public/testmon
test/coveragepy/__init__.py
Python
mit
98
#!/usr/bin/python # -*- coding: utf-8 -*- """Tanium SOUL package builder.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import codecs import datetime import imp import io import logging import os i...
tanium/tanium_soul_py
build_soul.py
Python
mit
24,066
__author__ = 'mslabicki' import pygmo as pg # from pyltes.powerOptimizationProblemsDef import maximalThroughputProblemRR from pyltes.powerOptimizationProblemsDef import local_maximalThroughputProblemRR from pyltes.powerOptimizationProblemsDef import maximalMedianThrProblemRR from pyltes.powerOptimizationProblem...
iitis/PyLTEs
pyltes/powerConfigurator.py
Python
mit
5,818
# -*- 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): # Adding field 'Invoice.date_of_issue' db.add_column('books_invoice', 'date_of_issue', ...
carquois/blobon
blobon/books/migrations/0030_auto__add_field_invoice_date_of_issue.py
Python
mit
12,495
""" Revision ID: 0356_add_webautn_auth_type Revises: 0355_add_webauthn_table Create Date: 2021-05-13 12:42:45.190269 """ from alembic import op revision = '0356_add_webautn_auth_type' down_revision = '0355_add_webauthn_table' def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.e...
alphagov/notifications-api
migrations/versions/0356_add_webautn_auth_type.py
Python
mit
1,380
from human_bot import HumanBot class AdaptivePlayBot(HumanBot): def __init(self): pass
crainiarc/poker-ai-planner
agents/adaptive_play_bot.py
Python
mit
99
# pylint: disable=preferred-module # FIXME: remove once migrated per GH-725 import unittest from ansiblelint.rules import RulesCollection from ansiblelint.rules.MetaChangeFromDefaultRule import MetaChangeFromDefaultRule from ansiblelint.testing import RunFromText DEFAULT_GALAXY_INFO = ''' galaxy_info: author: your...
willthames/ansible-lint
test/TestMetaChangeFromDefault.py
Python
mit
1,169
import glob import numpy as np import pandas as pd from numpy import nan import os os.chdir("/gpfs/commons/home/biederstedte-934/evan_projects/RRBS_anno_clean") repeats = pd.read_csv("repeats_hg19.csv") annofiles = glob.glob("RRBS_NormalBCD19pCD27pcell23_44_CTCTCTAC.G*") def between_range(row): subset = repeats....
evanbiederstedt/RRBSfun
scripts/repeat_finder_scripts/repeat_finder_RRBS_NormalBCD19pCD27pcell23_44_CTCTCTAC.G.py
Python
mit
706
# -*- coding: utf-8 -*- from libqtile.manager import Key, Click, Drag, Screen, Group from libqtile.command import lazy from libqtile import layout, bar, widget, hook from libqtile import xcbq xcbq.keysyms["XF86AudioRaiseVolume"] = 0x1008ff13 xcbq.keysyms["XF86AudioLowerVolume"] = 0x1008ff11 xcbq.keysyms["XF86AudioMute...
andrelaszlo/qtile
examples/config/tailhook-config.py
Python
mit
6,113
import os import glob from setuptools import setup from setuptools.command.install import install def post_install(install_path): """ Post install script for pyCUDA applications to warm the cubin cache """ import pycuda.autoinit from pycuda.compiler import SourceModule CACHE_DIR = os.path.join(...
Captricity/sciguppy
setup.py
Python
mit
1,576
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'GUIs\CoMPlEx_hwConfig_Dialog.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: ...
elandini/CoMPlEx
GUIs/CoMPlEx_hwConfig_Dialog.py
Python
mit
17,425
from abc import ABC, abstractmethod class Selector(ABC): """docstring""" def __init__(self): pass @abstractmethod def make(self, population, selectSize, tSize): pass
akkenoth/TSPGen
Operators/Selection/Selector.py
Python
mit
201
from rest_framework.permissions import BasePermission class IsOwnerOrReadOnly(BasePermission): def has_object_permission(self, request, view, obj): return obj.user == request.user
videetssinghai/Blog-Rest-Api
posts/api/permissions.py
Python
mit
196
#!/usr/bin/env python import json import time import sys import os from collections import OrderedDict as dict content = u"""\n type cmdConf struct { name string argDesc string group string readonly bool } """ def json_to_js(json_path, js_path): """Convert `commands.json` to `commands.js...
holys-archive/ledisdb
generate.py
Python
mit
2,737
def getSpeciesValue(species): """ Return the initial amount of a species. If species.isSetInitialAmount() == True, return the initial amount. Otherwise, return the initial concentration. ***** args ***** species: a libsbml.Species object """ if species.isSetInitialAmount...
MichaelPHStumpf/Peitho
peitho/errors_and_parsers/abc_sysbio/abcsysbio/generateTemplate.py
Python
mit
13,980
from distutils.core import setup import py2exe import os import sys sys.argv.append('py2exe') # The filename of the script you use to start your program. target_file = 'main.py' # The root directory containing your assets, libraries, etc. assets_dir = '.\\' # Filetypes not to be included in the above. excluded_file...
lantra/vugamedev
src/setup.py
Python
mit
1,710
# Import time (for delay) library (for SmartHome api) and GPIO (for raspberry pi gpio) from library import SmartHomeApi import RPi.GPIO as GPIO import time from datetime import datetime # 7 -> LED # Create the client with pre-existing credentials api = SmartHomeApi("http://localhost:5000/api/0.1", id=10, api_key="ap...
How2Compute/SmartHome
cli/demo2.py
Python
mit
1,643
# File: etl.py # Purpose: To do the `Transform` step of an Extract-Transform-Load. # Programmer: Amal Shehu # Course: Exercism # Date: Thursday 22 September 2016, 03:40 PM def transform(words): new_words = dict() for point, letters in words.items(): for letter in letters: ...
amalshehu/exercism-python
etl/etl.py
Python
mit
382
from importlib import import_module from django.apps import AppConfig as BaseAppConfig class AppConfig(BaseAppConfig): name = "portal" def ready(self): import_module("portal.receivers")
acarl123/acuity
portal/apps.py
Python
mit
207
class Solution(object): def maxEnvelopes(self, envelopes): """ :type envelopes: List[List[int]] :rtype: int """
xingjian-f/Leetcode-solution
354. Russian Doll Envelopes.py
Python
mit
123
import wordtools import random from forms.form import Form class MarkovForm(Form): def __init__(self): self.data={} self.data[""]={} self.limiter=0 def validate(self,tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned)>=2: return cleaned else: return None def...
mlesicko/automaticpoetry
forms/markov.py
Python
mit
1,023
from sqlalchemy import Column, Integer, String, Sequence, ForeignKey, Enum, Float from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from . import Base from .utils import ModelMixin class Source(Base, ModelMixin): __tablename__ = 'source' __repr_props__ = ['id', ...
richlewis42/qsardb
qsardb/models/models.py
Python
mit
3,946
from investor_lifespan_model.investor import Investor from investor_lifespan_model.market import Market from investor_lifespan_model.insurer import Insurer from investor_lifespan_model.lifespan_model import LifespanModel from investor_lifespan_model.mortality_data import π, G, tf
moehle/investor_lifespan_model
investor_lifespan_model/__init__.py
Python
mit
282
# -*- coding: utf-8 -*- import pytest from tests.models.test_etl_record import etl_records # noqa from tests.models.test_abstract_records import dynamodb_connection # noqa from mycroft.backend.worker.etl_status_helper import ETLStatusHelper import mock RECORDS = [ {'status': 'error', 'date': '2014-09-01', 'star...
Yelp/mycroft
mycroft/tests/backend/test_etl_helper.py
Python
mit
2,789
# -*- coding: utf8 -*- # Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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...
tzpBingo/github-trending
codespace/python/tencentcloud/tcm/v20210413/tcm_client.py
Python
mit
3,255
""" WSGI config for veterinario 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.6/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "veterinario.settings") from djang...
taopypy/taopypy-django-tests
veterinario/veterinario/wsgi.py
Python
mit
397
from MuellerBrown import getPotentialAndForces from PlotUtils import PlotUtils import numpy as np import matplotlib.pyplot as plt import MuellerBrown as mbpot m=1.0 def getKineticEnergy(velocity): return 0.5*m*(velocity[0]**2+velocity[1]**2) dt = 0.01 num_steps = 1000 #initial_position = np.array( [ 0.0 , ...
valsson/MD-MC-Codes-2016
MuellerBrown-MD/MD-MuellerBrown.py
Python
mit
1,665
#-*- coding: utf-8 -*- import os import pandas as pd import config import pandas import re import math from modules.valuations.valuation import Valuation # 현 EPS 과거 5년 PER 평균을 곱한 값 class PER(Valuation): def __init__(self, valuation): data = valuation.get_data() json = valuation.get_json() Valuation.__i...
jongha/stock-ai
modules/valuations/per.py
Python
mit
540
class HighScores(object): def __init__(self, scores): self.scores = scores def latest(self): return self.scores[-1] def personal_best(self): return max(self.scores) def personal_top_three(self): return sorted(self.scores, reverse=True)[:3]
N-Parsons/exercism-python
exercises/high-scores/example.py
Python
mit
291
# -*- coding: utf-8 -*- # # GitComponentVersion documentation build configuration file, created by # sphinx-quickstart on Tue Apr 11 10:51:23 2017. # # 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...
kjjuno/GitComponentVersion
docs/source/conf.py
Python
mit
4,802
# -*- coding: utf-8 -*- # Copyright (c) 2018 TinEye. All rights reserved worldwide. from .matchengine_request import MatchEngineRequest class MobileEngineRequest(MatchEngineRequest): """ Class to send requests to a MobileEngine API. Adding an image using data: >>> from tineyeservices import Mob...
TinEye/tineyeservices_python
tineyeservices/mobileengine_request.py
Python
mit
1,115
#!/home/elsa/Ureka/variants/common/bin/python #Code to generate an image with perlin noise as background. #Used in UO scientific computing course Spring 2016 #Perlin code and noise package is from Casey Duncan #https://github.com/caseman/noise/examples/2dtexture.py #Remaining code by Elsa M. Johnson from noise impor...
ElsaMJohnson/pythonprograms
galaxyperlin.py
Python
mit
4,116
from .workout import Workout from .duration import Time from .duration import Distance
claha/suunto
suunto/__init__.py
Python
mit
86
from sqlalchemy import and_ from DBtransfer import * from zlib import * #retrun compressed def generateFromDB(DBSession, InternData, tmp_name) : run_list=[] user_data = DBSession.query(InternData).filter(InternData.timestamp == tmp_name) for data in user_data : if not data.run in run_list : run_list.append(da...
mwalzer/Ligandomat
ligandomat/run_list_handling.py
Python
mit
2,262
from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout,Submit from .models import Details, Feedback from crispy_forms.bootstrap import TabHolder, Tab from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions class AddmeForm(forms.ModelForm): cla...
Thuruv/pilgrim
blood/forms.py
Python
mit
537
#!/usr/bin/env python3 """ make_confidence_report_bundle_examples.py Usage: make_confidence_report_bundle_examples.py model.joblib a.npy make_confidence_report_bundle_examples.py model.joblib a.npy b.npy c.npy where model.joblib is a file created by cleverhans.serial.save containing a picklable cleverhans.mode...
openai/cleverhans
scripts/make_confidence_report_bundle_examples.py
Python
mit
4,354
bookprefix = { 'Genesis' : '1', 'genesis' : '1', 'Gen' : '1', 'gen' : '1', 'Exodus' : '2', 'exodus' : '2', 'Exo' : '2', 'exo' : '2', 'Ex' : '2', 'ex' : '2', 'Leviticus' : '3', 'leviticus' : '3', 'Lev' : '3', 'lev' : '3', 'Numbers' : '4', 'numbers' : '4', ...
AugustG98/NWT-Bot
NWT-Bot/books.py
Python
mit
5,132
import os import six from aleph.util import checksum class Archive(object): def _get_file_path(self, meta): ch = meta.content_hash if ch is None: raise ValueError("No content hash available.") path = os.path.join(ch[:2], ch[2:4], ch[4:6], ch) file_name = 'data' ...
smmbllsm/aleph
aleph/archive/archive.py
Python
mit
1,182
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-05-16 06:49 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('voximplant', '0008_auto_20160514_0800'), ] operations = [ migrations.RemoveF...
telminov/django-voximplant
voximplant/migrations/0009_auto_20160516_0649.py
Python
mit
813
# -*- coding: utf-8 -*- """ Created on Mon Aug 15 20:55:19 2016 @author: ajaver """ import json import os from collections import OrderedDict import zipfile import numpy as np import pandas as pd import tables from tierpsy.helper.misc import print_flush from tierpsy.analysis.feat_create.obtainFeaturesHelper import ...
ljschumacher/tierpsy-tracker
tierpsy/analysis/wcon_export/exportWCON.py
Python
mit
9,522
# 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/network/azure-mgmt-network/azure/mgmt/network/v2018_06_01/aio/operations/_route_filter_rules_operations.py
Python
mit
28,535
''' ΪÁËÈÃÄãµÄ´úÂ뾡¿ÉÄÜ¿ì, µ«Í¬Ê±±£Ö¤¼æÈݵͰ汾µÄ Python ,Äã¿ÉÒÔʹÓÃÒ»¸öС¼¼ÇÉÔÚ cStringIO ²»¿ÉÓÃʱÆôÓà StringIO Ä£¿é, Èç ÏÂÀý Ëùʾ. ''' try: import cStringIO StringIO = cStringIO except ImportError: import StringIO print StringIO
iamweilee/pylearn
cstringio-example-2.py
Python
mit
249
from __future__ import absolute_import from django.conf.urls import url from oauth2_provider import views from .views import CoffeestatsApplicationRegistration, \ CoffeestatsApplicationDetail, \ CoffeestatsApplicationApproval, \ CoffeestatsApplicationRejection, \ CoffeestatsApplicationFullList urlpat...
coffeestats/coffeestats-django
coffeestats/caffeine_oauth2/urls.py
Python
mit
1,723
#!/usr/bin/env python # -*- coding: utf-8 -*- #import modułów konektora msg_stream_connector from ComssServiceDevelopment.connectors.tcp.msg_stream_connector import InputMessageConnector, OutputMessageConnector #import modułów klasy bazowej Service oraz kontrolera usługi from ComssServiceDevelopment.service import Ser...
michaellas/streaming-vid-to-gifs
src/mark_frame_service/service.py
Python
mit
3,218
from flask import request from structlog import get_logger from ghinbox import app from ghinbox.tasks import create_issue logger = get_logger() @app.route('/hooks/postmark', methods=['POST']) def postmark_incomming_hook(): # TODO #2 HTTP Basic Auth inbound = request.json if not inbound: retur...
sibson/ghinbox
ghinbox/webhooks.py
Python
mit
543
from zope import schema from sparc.entity import IEntity from sparc.organization import ICompany from sparc.organization import IOrganizableEntity class IAddress(IEntity): """A generic address""" address = schema.Text( title = u'Address', description = u'The entity address', ...
davisd50/sparc.organization
sparc/organization/contacts/interfaces.py
Python
mit
1,650
import os from cpenv import api, paths from cpenv.cli import core from cpenv.module import parse_module_path class Create(core.CLI): '''Create a new Module.''' def setup_parser(self, parser): parser.add_argument( 'where', help='Path to new module', ) def run(self...
cpenv/cpenv
cpenv/cli/create.py
Python
mit
1,854
# -*- coding: utf-8 -*- """ Created on Sat Feb 22 12:07:53 2014 @author: Gouthaman Balaraman """ import requests import pandas as pd from bs4 import BeautifulSoup import re import numpy as np import os ##################################################### # A bunch of constants used throught the script. # ########...
gouthambs/OpenData
src/longbeach_crime_stats.py
Python
mit
10,310
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from appconf import AppConf trans_app_label = _('Core') class OppsCoreConf(AppConf): DEFAULT_URLS = ('127.0.0.1', 'localhost',) SHORT = 'googl' SHORT_URL = 'googl.short.GooglUrlShort' CHANNEL_CONF = {} VIEWS_LIMIT =...
laborautonomo/opps
opps/core/__init__.py
Python
mit
4,511
from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponseBadRequest, HttpResponse from bootcamp.tasks.models import Task from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from bootcamp.tasks.forms import TaskForm from django.contrib.auth.decorators impo...
davismathew/netbot-django
bootcamp/traceroute/views.py
Python
mit
10,645
# Find the Lowest Common Ancestor (LCA) in a Binary Search Tree # A Binary Search Tree node class Node: # Constructor to initialise node def __init__(self, data): self.data = data self.left = None self.right = None class BST: def __init__(self): self.root = None def ...
anubhavshrimal/Data_Structures_Algorithms_In_Python
Tree/BinarySearchTree/Lowest_Common_Ancestor.py
Python
mit
1,935
import random from decimal import Decimal, ROUND_HALF_UP from django.test import TestCase from django.core.validators import ValidationError from .models import * def setup(): """ Create dummy data """ Status.objects.create( name="Hero", overdraft="0" ) Status.objects.create( ...
Babaritech/babar3
back/babar_server/tests.py
Python
mit
3,743
""" Initialize the module. Author: Panagiotis Tsilifis Date: 5/22/2014 """ from _forward_model_dmnless import *
PredictiveScienceLab/inverse-bgo
demos/catalysis/__init__.py
Python
mit
124
"""TestCases for multi-threaded access to a DB. """ import os import sys import time import errno from random import random DASH = '-' try: WindowsError except NameError: class WindowsError(Exception): pass import unittest from test_all import db, dbutils, test_support, verbose, ha...
babyliynfg/cross
tools/project-creator/Python2.6.6/Lib/bsddb/test/test_thread.py
Python
mit
16,484
import os import sys import asyncio from pathlib import Path import pendulum sys.path.append(str(Path(__file__).absolute().parent.parent.parent)) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") from django.core.wsgi import get_wsgi_application # noqa application = get_wsgi_application() from a...
ksamuel/smit
vessels/crawler/wamp_client.py
Python
mit
4,286
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' 冒泡排序(bubble sort):每个回合都从第一个元素开始和它后面的元素比较, 如果比它后面的元素更大的话就交换,一直重复,直到这个元素到了它能到达的位置。 每次遍历都将剩下的元素中最大的那个放到了序列的“最后”(除去了前面已经排好的那些元素)。 注意检测是否已经完成了排序,如果已完成就可以退出了。时间复杂度O(n2) ''' def short_bubble_sort(a_list): exchange = True pass_num = len(a_list) - 1 while pass_num...
Lucky0604/algorithms
sort/bubble-sort.py
Python
mit
1,125
import urllib from cyclone.web import asynchronous from twisted.python import log from sockjs.cyclone import proto from sockjs.cyclone.transports import pollingbase class JSONPTransport(pollingbase.PollingTransportBase): name = 'jsonp' @asynchronous def get(self, session_id): ...
flaviogrossi/sockjs-cyclone
sockjs/cyclone/transports/jsonp.py
Python
mit
3,786
import py, os, cffi, re import _cffi_backend def getlines(): try: f = open(os.path.join(os.path.dirname(cffi.__file__), '..', 'c', 'commontypes.c')) except IOError: py.test.skip("cannot find ../c/commontypes.c") lines = [line for line in f.readlines() if line....
johncsnyder/SwiftKitten
cffi/testing/cffi1/test_commontypes.py
Python
mit
918
"""Main entry point """ from pyramid.config import Configurator def main(global_config, **settings): config = Configurator(settings=settings) config.include("cornice") config.scan("pyramidSparkBot.views") return config.make_wsgi_app()
jbogarin/ciscosparkapi
examples/pyramidSparkBot/pyramidSparkBot/__init__.py
Python
mit
254
import requests headers = { 'foo': 'bar', } response = requests.get('http://example.com/', headers=headers)
NickCarneiro/curlconverter
fixtures/python/get_with_single_header.py
Python
mit
114
# -*- coding: utf-8 -*- from __future__ import unicode_literals from wtforms import validators from jinja2 import Markup from studio.core.engines import db from riitc.models import NaviModel, ChannelModel from .base import BaseView from .forms import CKTextAreaField class Navi(BaseView): column_labels = {'name...
qisanstudio/qsapp-riitc
src/riitc/panel/channel.py
Python
mit
2,269
import logging log = logging.getLogger(__name__) def has_bin(arg): """ Helper function checks whether args contains binary data :param args: list | tuple | bytearray | dict :return: (bool) """ if type(arg) is list or type(arg) is tuple: return reduce(lambda has_binary, item: has_binar...
shuoli84/gevent_socketio2
socketio/__init__.py
Python
mit
583
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 2/6/15 ###Function: Redraw figure 4A in Shifting Demographic Landscape (Bansal2010) ###Import data: ###Command Line: python ############################################## ### notes ### ### pack...
eclee25/flu-SDI-exploratory-age
scripts/WIPS2015/WIPS_Bansal2010_hierarchy.py
Python
mit
1,282
from microbit_stub import * while True: if button_a.is_pressed(): for i in range(5): if display.get_pixel(i, 0): display.set_pixel(i, 0, 0) sleep(10) else: display.set_pixel(i, 0, 9) sleep(200) break ...
casnortheast/microbit_stub
bitcounter-range.py
Python
mit
601
import sys, os, subprocess, tempfile, shlex, glob result = None d = None def format_msg(message, headline): msg = "Line {0}:\n {1}\n{2}:\n{3}"\ .format(PARAMS["lineno"], PARAMS["source"], headline, message) return msg try: #print("RUN", PARAMS["source"]) d = tempfile.mkdtemp(dir="/dev/shm") ...
sjdv1982/seamless
docs/archive/slash/cell-command-standard.py
Python
mit
6,435
# -*- coding:utf-8 -*- import copy from zope.interface import implementer from .interfaces import ( IExecutor, ISchemaValidation, IDataValidation, ICreate, IDelete, IEdit ) from alchemyjsonschema.dictify import ( normalize, validate_all, ErrorFound ) from jsonschema import FormatChec...
podhmo/komet
komet/executors.py
Python
mit
3,149
import sys import time import os.path from collections import Counter from vial import vfunc, vim, dref from vial.utils import redraw, focus_window from vial.widgets import make_scratch collector = None def get_collector(): global collector if not collector: collector = ResultCollector() return...
baverman/vial-pytest
vial-plugin/vial_pytest/plugin.py
Python
mit
3,367
import csv import unittest from datetime import datetime, timedelta from hackertracker import event from hackertracker.database import Model, Session from sqlalchemy import create_engine class TestEvents(unittest.TestCase): def setUp(self): engine = create_engine('sqlite:///:memory:', echo=True) M...
sionide21/HackerTracker
tests/event_tests.py
Python
mit
4,529
import pandas as pd from pandas.io import gbq def test_sepsis3_one_row_per_stay_id(dataset, project_id): """Verifies one stay_id per row of sepsis-3""" query = f""" SELECT COUNT(*) AS n FROM ( SELECT stay_id FROM {dataset}.sepsis3 GROUP BY 1 HAVING COUNT(*) > 1 ) s """ ...
MIT-LCP/mimic-code
mimic-iv/tests/test_sepsis.py
Python
mit
481
# -*- coding: utf-8 -*- """signal handlers registered by the imager_profile app""" from __future__ import unicode_literals from django.conf import settings from django.db.models.signals import post_save from django.db.models.signals import pre_delete from django.dispatch import receiver from imager_profile.models impor...
flegald/django-imager
imagersite/imager_profile/handler.py
Python
mit
1,201
from django import forms from . import models from apps.utils import forms as utils, constants from django.forms import models as models_form from apps.personas import models as persona_models class VacanteForm(utils.BaseFormAllFields): title = 'Vacante' fecha = forms.DateField(input_formats=constants.INPUT_F...
0sw4l/villas-de-san-pablo
apps/empleabilidad/forms.py
Python
mit
1,944
from collidable import * from math_3d import * class PixelCollidable( Collidable ) : def __init__(self) : self.spm = None self.r = None
sphereflow/space_combat
src/pixel_collidable.py
Python
mit
152
#!/usr/bin/env python class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ i, j = 0, len(height)-1 l, r = height[i], height[j] maxArea = (j - i) * min(l, r) while j > i: if l < r: while hei...
eroicaleo/LearningPython
interview/leet/011_Container_With_Most_Water.py
Python
mit
845
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
oakeyc/azure-cli-shell
azclishell/az_completer.py
Python
mit
14,854
# I have to modify droidbox scripts to let it work with droidbot # This is a compatible version which generate a report with the same format of original DroidBox __author__ = 'yuanchun' ################################################################################ # (c) 2011, The Honeynet Project # Author: Patrik La...
nastya/droidbot
droidbox_scripts/droidbox_compatible.py
Python
mit
24,119
import os.path import logging _logger = logging.getLogger(__name__) from operator import itemgetter from tornado.web import Application, RequestHandler, StaticFileHandler from tornado.ioloop import IOLoop config = { 'DEBUG': True, 'PORT' : 5000 } HANDLERS = [] ROOT_DIR = os.path.abspath(os.path.join(os.pa...
jzitelli/yawvrb.js
test/tornado_server.py
Python
mit
1,909
""" The Jaccard similarity coefficient is a commonly used indicator of the similarity between two sets. Let U be a set and A and B be subsets of U, then the Jaccard index/similarity is defined to be the ratio of the number of elements of their intersection and the number of elements of their union. Inspired from Wikip...
TheAlgorithms/Python
maths/jaccard_similarity.py
Python
mit
2,365
# __author__ = MelissaChan # -*- coding: utf-8 -*- # 16-4-16 下午10:53 import MySQLdb def connect(id,name,gender,region,status,date,inter): try: conn = MySQLdb.connect(host='localhost',user='root',passwd=' ',port=3306) cur = conn.cursor() # cur.execute('create database if not exists PythonD...
MelissaChan/Crawler_Facebook
Crawler/facebook_mysql.py
Python
mit
1,040
from sys import platform import unittest import checksieve class TestVariables(unittest.TestCase): def test_set(self): sieve = ''' require "variables"; set "honorific" "Mr"; ''' self.assertFalse(checksieve.parse_string(sieve, False)) def test_mod_length(self): ...
dburkart/check-sieve
test/5229/variables_test.py
Python
mit
1,796
from spacyThrift import SpacyThrift from spacyThrift.ttypes import Token from spacy.en import English from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.server import TServer import logging class Handler: def __init__(self, nlp): ...
pasupulaphani/spacy-nlp-docker
thrift/spacyThrift/service.py
Python
mit
1,083