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 |
|---|---|---|---|---|---|
"""A basic implementation of a Neural Network
by following the tutorial by Andrew Trask
http://iamtrask.github.io/2015/07/12/basic-python-network/
"""
import numpy as np
# sigmoid function
def nonlin(x, deriv=False):
if deriv==True:
return x * (1-x)
return 1 / (1 + np.exp(-x))
# input dataset
x = np.... | alexandercrosson/ml | neural_network/basic.py | Python | mit | 1,043 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-26 12:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('iiits', '0025_auto_20160425_1937'),
]
operations = [
... | IIITS/iiits.ac.in | iiits/migrations/0026_auto_20160426_1232.py | Python | mit | 1,265 |
#!/usr/bin/env python
# based on cb-exit used in CrunchBang Linux <http://crunchbanglinux.org/>
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
import time
class i3_exit:
def disable_buttons(self):
self.cancel.set_sensitive(False)
self.logout.set_sensitive(False)
sel... | RationalAsh/configs | i3-exit.py | Python | mit | 4,584 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2016 Alex Forencich
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 righ... | Diti24/python-ivi | ivi/tektronix/tektronixMDO3012.py | Python | mit | 1,724 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import graphs
def main(argv):
k, Gs = files.read_graphs(argv[0])
sinks = []
for G in Gs:
n, m = G[:2]
edges = G[2]
nodes = [n for n in xrange(1, n + 1)]
sinks.append(gr... | cowboysmall/rosalind | src/heights/rosalind_gs.py | Python | mit | 489 |
# -*- coding: utf-8 -*-
"""
@file
@brief Link to data from `Gutenberg <http://www.gutenberg.org/>`_,
provides an automated way to get the data from this website.
Some data may be replicated here to unit test notebooks.
"""
import os
import urllib.request
from urllib.error import URLError
def gutenberg_name(name="cond... | sdpython/ensae_teaching_cs | src/ensae_teaching_cs/data/gutenberg.py | Python | mit | 1,949 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('backend', '0005_organization_registered'),
]
operations = [
migrations.RemoveField(
model_name='organization',
... | euhackathon/commission-today-api | backend/backend/migrations/0006_auto_20141203_0021.py | Python | mit | 1,218 |
from django.db import models
from linda_app.models import DatasourceDescription
# A single test over a data source
class EndpointTest(models.Model):
execution_time = models.DateTimeField(auto_now_add=True) # test timestamp
datasource = models.ForeignKey(DatasourceDescription) # tested datasource
up = mo... | LinDA-tools/LindaWorkbench | linda/endpoint_monitor/models.py | Python | mit | 631 |
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.ofproto import ether
from ryu.lib.packet import packet
from ryu.lib.packet import ether... | ray6/sdn | actualSDN.py | Python | mit | 14,660 |
class OWL:
def __init__(self):
pass | Jawoll/automatchthreads | modules/scrapers/owl.py | Python | mit | 47 |
#-------------------------------------------------------------------------------------
from bin.dazer_methods import Dazer
from bin.lib.ssp_functions.ssp_synthesis_tools import ssp_fitter
#-------------------------------------------------------------------------------------
#!/usr/bin/python
import sys
import numpy ... | Delosari/dazer | bin/lib/ssp_functions/ssp_Hector_Fit3D_mix.py | Python | mit | 45,180 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, getopt
from datetime import datetime
import math
from gann import *
def print_usage():
print """
classic Gann square: gann.py -o <output file name> -s <square size>
Gann square based on date: gann.py -o <output file name> -a <base date... | Galarius/gann-square | gann.py | Python | mit | 3,346 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# JewelCraft jewelry design toolkit for Blender.
# Copyright (C) 2015-2019 Mikhail Rachinskiy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | mrachinskiy/blender-addon-jewelcraft | ops_utils/scene_ops.py | Python | mit | 1,477 |
from datetime import datetime, timedelta
from django.db import models
from django.db.models import Max, Min
from tinymce.models import HTMLField
class Company(models.Model):
name = models.CharField(max_length=75, blank=True, null=True)
symbol = models.CharField(max_length=10, blank=True, null=True)
descr... | rodxavier/open-pse-initiative | django_project/companies/models.py | Python | mit | 2,705 |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from django.template.defaultfilters import slugify
from mptt.models import MPTTModel, TreeForeignKey
class ForumCategory(MPTTModel):
parent = TreeForeignKey(
'self', blank=True, null=True, related_n... | hellsgate1001/thatforum_django | thatforum/models.py | Python | mit | 3,446 |
from app.schema_validation.definitions import https_url, uuid
create_service_callback_api_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "POST service callback/inbound api schema",
"type": "object",
"title": "Create service callback/inbound api",
"properties": {
... | alphagov/notifications-api | app/service/service_callback_api_schema.py | Python | mit | 915 |
# encoding: UTF-8
from eventEngine import *
from ctpGateway import CtpGateway
########################################################################
class MainEngine(object):
"""主引擎"""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor""... | golden1232004/vnpy | vn.trader/vtEngine.py | Python | mit | 2,720 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 <>
#
# Distributed under terms of the MIT license.
# Third-party modules
import pytest
# Projects modules
from fnapy.fnapy_manager import FnapyManager
def test_manager_raises_TypeError_with_invalid_connection():
"""FnapyManage... | alexandriagroup/fnapy | tests/offline/test_manager.py | Python | mit | 549 |
import math
import string
lookup_map = {}
def memcache_read(n):
global lookup_map
if lookup_map.has_key(n):
return lookup_map[n]
else:
return None
def memcache_write(n, value):
global lookup_map
lookup_map[n] = value
def get_chain_length(n):
# check cache
cache = memcache_read(n)
if cache !... | birdchan/project_euler | problems/014/run.py | Python | mit | 979 |
#!/usr/bin/python
# Copyright (C) 2014-2016 Miquel Sabaté Solà <mikisabate@gmail.com>
# This file is licensed under the MIT license.
# See the LICENSE file.
def insertsort(lst):
for i in range(1, len(lst)):
value = lst[i]
j = i
while j > 0 and value < lst[j - 1]:
lst[j] = lst[j ... | mssola/programs | algorithms/sorting/insertsort/insertsort.py | Python | mit | 454 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-25 01:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pdfapp', '0010_auto_20170225_0034'),
]
operations = [
migrations.AddField(
... | NumberZeroSoftware/PDFINVEST | pdfapp/migrations/0011_document_html_text_string.py | Python | mit | 468 |
#!/usr/bin/env python
"""
@author : 'Muhammad Arslan <rslnrkmt2552@gmail.com>'
"""
import re
import zlib
import cv2
from scapy.all import *
pics = "pictues"
faces_dir = "faces"
pcap_file = "bhp.pcap"
def get_http_headers(http_payload):
try:
headers_raw = http_payload[:http_payload.index("\r\n\r\n")+2... | volf52/black_hat_python | pic_carver.py | Python | mit | 2,905 |
import json
import logging
import boto3
import hashlib
import jsonpatch
from dart.context.locator import injectable
from dart.model.trigger import TriggerType, TriggerState
from dart.message.call import TriggerCall
from dart.trigger.base import TriggerProcessor, execute_trigger
from dart.model.exception import DartVa... | RetailMeNotSandbox/dart | src/python/dart/trigger/scheduled.py | Python | mit | 11,491 |
import os
from locust import HttpUser, TaskSet, task, between
from locust.clients import HttpSession
class MultipleHostsUser(HttpUser):
abstract = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.api_client = HttpSession(base_url=os.environ["API_HOST"])
clas... | mbeacom/locust | examples/multiple_hosts.py | Python | mit | 788 |
#!/usr/bin/env python2.7
import cgi
import json
import os
import re
import SimpleHTTPServer
import SocketServer
import subprocess
import sys
import threading
VERSION = 'v0.14.6'
hostname = ''
try:
command = "bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || wget -q -O - icanhazip.com'"
hostname = s... | alexquick/dokku | contrib/dokku-installer.py | Python | mit | 13,390 |
# Copyright (C) 2016 Deloitte Argentina.
# This file is part of CodexGigas - https://github.com/codexgigassys/
# See the file 'LICENSE' for copying permission.
from PlugIns.PlugIn import PlugIn
class CypherPlug(PlugIn):
def __init__(self, sample=None):
PlugIn.__init__(self, sample)
def getPath(self)... | codexgigassys/codex-backend | src/PlugIns/PE/CypherPlug.py | Python | mit | 513 |
# vi: ts=8 sts=4 sw=4 et
#
# uri.py: various URI related utilties
#
# This file is part of Draco2. Draco2 is free software and is made available
# under the MIT license. Consult the file "LICENSE" that is distributed
# together with this file for the exact licensing terms.
#
# Draco2 is copyright (c) 1999-2007 by the D... | geertj/draco2 | draco2/util/uri.py | Python | mit | 5,926 |
from datetime import datetime
import rfGengou
from . import PluginBase
__all__ = ['Gengo']
class Gengo(PluginBase):
def execute(self, args):
if len(args) == 0:
target = datetime.now()
elif len(args) == 1:
target = datetime.strptime(args[0], '%Y/%m/%d')
else:
... | mikoim/funstuff | codecheck/codecheck-3608/app/plugins/gengo.py | Python | mit | 676 |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
// Copyright (c) 2014 Dyffy, Inc.
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
i... | joeykrug/sidecoin | contrib/pyminer/pyminer.py | Python | mit | 6,470 |
#!/usr/bin/env python
###############################################################################
# Copyright (C) 1994 - 2013, Performance Dynamics Company #
# #
# This software is licensed as described in the file COPY... | evelynmitchell/pdq | examples/Linux Magazine/spamcan1.py | Python | mit | 1,994 |
#coding=utf-8
import pymongo
def delete_repeat_data():
client = pymongo.MongoClient('localhost', 27017)
db = client.admin
collection = db.taplist
for url in collection.distinct('game_id'): # 使用distinct方法,获取每一个独特的元素列表
num = collection.count({"game_id": url}) # 统计每一个元素的数量
print num, "==... | andyrenpanlong/Taptap | tabUnique.py | Python | mit | 987 |
import argparse
from osgb import osgb_to_lonlat
from osgb.convert import eastnorth_to_osgb
from utils.database import insert_into_db, empty_table, execute_sql
# Loads data from here: https://data.gov.uk/dataset/naptan
def read_stations(filename):
with open(filename, 'r') as input_file:
for line in inpu... | DanteLore/national-rail | loadstations.py | Python | mit | 1,412 |
"""
Tests for install.py for SUSE based Linux distributions
"""
import os
import shutil
from unittest import mock
import pytest
from install import Cmd, CmdError, RemoteFileNotFoundError
pytestmark = pytest.mark.skipif(
not pytest.helpers.helper_is_suse(),
reason="Tests for openSUSE/SUSE"
)
def test_rpm_do... | junaruga/rpm-py-installer | tests/test_install_suse.py | Python | mit | 1,463 |
# 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/v2020_06_01/operations/_dscp_configuration_operations.py | Python | mit | 23,827 |
import rdflib
from rdflib.term import URIRef, Variable
from PyOpenWorm.dataObject import DataObject, InverseProperty
from PyOpenWorm.context import Context
from PyOpenWorm.context_store import ContextStore
from .DataTestTemplate import _DataTest
try:
from unittest.mock import MagicMock, Mock
except ImportError:
... | gsarma/PyOpenWorm | tests/ContextTest.py | Python | mit | 12,077 |
# -*- coding: utf-8 -*-
#
# Wokkel documentation build configuration file, created by
# sphinx-quickstart on Mon May 7 11:15:38 2012.
#
# 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 ... | ralphm/wokkel | doc/conf.py | Python | mit | 7,874 |
'''
A drop-in replacement for optparse ( "import optparse_gui as optparse" )
Provides an identical interface to optparse(.OptionParser),
But displays an automatically generated wx dialog in order to enter the
options/args, instead of parsing command line arguments
'''
import sys, os, os.path, fnmatch, types, time
imp... | HorvathLab/NGS | attic/readCounts/src/optparse_gui/__init__.py | Python | mit | 12,249 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-13 16:33
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_n... | nagracks/dj-hackernews-clone | hn_clone/posts/migrations/0002_auto_20170413_1633.py | Python | mit | 441 |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import os
from figure3 import select, ket, exp
from matrix import ops
from measures import local_entropies_from_rhos, local_exp_vals_from_rhos
from mpl_toolkits.axes_grid1 import ImageGrid
from matplotlib import rc
rc("text", usetex=True)
fon... | lhillber/qops | figure2.py | Python | mit | 5,048 |
"""
This file should only work on Python 3.6 and newer.
Its purpose is to test a correct installation of Python 3.
"""
from random import randint
print("Generating one thousand random numbers...")
for i in range(1000):
random_number = randint(0, 100000)
print(f"Number {i} was: {random_number}")
| PhantomAppDevelopment/python-getting-started | step-1/myscript.py | Python | mit | 308 |
"""
TAGME implementation
@author: Faegheh Hasibi (faegheh.hasibi@idi.ntnu.no)
"""
import argparse
import math
from nordlys.config import OUTPUT_DIR
from nordlys.tagme import config
from nordlys.tagme import test_coll
from nordlys.tagme.query import Query
from nordlys.tagme.mention import Mention
from nordlys.tagme.lu... | hasibi/TAGME-Reproducibility | nordlys/tagme/tagme.py | Python | mit | 11,198 |
from django.shortcuts import render
from enfermeriaapp.models import Cola_Consulta, Cola_Enfermeria
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.utils import timezone
import time
from django.contrib import messages
from django.contrib.auth.decorators import login_requir... | anderson7ru/bienestarues | enfermeriaapp/views.py | Python | mit | 4,242 |
class InvalidAPIUsage(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
self.payload = payload
def to_dict(self):
... | devcenter-square/states-cities | app/mod_endpoints/exceptions.py | Python | mit | 413 |
import os, sys, multiprocessing, subprocess
from build_util import *
if __name__ == "__main__":
cfg = cfg_from_argv(sys.argv)
bi = build_info(cfg.compiler, cfg.archs, cfg.cfg)
print("Starting build project: " + build_cfg.project_name + " ...")
additional_options = "-DCFG_PROJECT_NAME:STRING=\"%s\"" % build_cfg.pr... | Napoleon314/Venus3D | generate_projects.py | Python | mit | 1,373 |
# -*- coding: utf-8 -*-
import logging
import types
import dateutil.parser
import feedparser
import pytz
import http
from html_sanitizer import HTMLSanitizer
def getFeed(url):
current_feed = []
content = http.get(url)
feed = feedparser.parse(content) # even if content is None feedparser returns object... | macborowy/dajsiepoznac-feed | DajSiePoznacFeed-Server/crawler/src/scrapper/feed.py | Python | mit | 4,500 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""Wrapper for netCDF readers."""
from __future__ import unicode_literals, division, print_function
import os.path
import warnings
import numpy as np
from collections import OrderedDict
from monty.dev import r... | setten/pymatgen | pymatgen/io/abinit/netcdf.py | Python | mit | 17,296 |
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
s=str(x)
l=list(s)
l.reverse()
sq=''
s1=sq.join(l)
if s==s1:
return True
else:
return False
| thydeyx/LeetCode-Python | Palindrome Number.py | Python | mit | 302 |
__author__ = 'http://www.python-course.eu/python3_inheritance.php'
class Person:
def __init__(self, first, last):
self.firstname = first
self.lastname = last
def Name(self):
return self.firstname + " " + self.lastname
class Employee(Person):
def __init__(self, first, last, staf... | MarketShareData/Internal | code/test1/inheritanceTest.py | Python | mit | 600 |
from build import evaluate_callables
class WhenEvaluatingADictWithNoCallables:
def when_i_evaluate_the_dict(self):
self.result = evaluate_callables({"abc": 123, "def": 456, "xyz": 789})
def it_should_return_the_same_dict(self):
assert self.result == {"abc": 123, "def": 456, "xyz": 789}
clas... | benjamin-hodgson/build | test/evaluate_callables_tests.py | Python | mit | 2,020 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2018_01_01/models/frontend_ip_configuration_py3.py | Python | mit | 4,846 |
# -*- coding: utf8 -*-
from decode import decode | memorycoin/asm2mmc | asm2mmc/__init__.py | Python | mit | 49 |
import sys, re
if sys.version_info < (3, 0):
import testcase
import modules.cssfuncs as funcs
else:
from . import testcase
from ..modules import cssfuncs as funcs
class TestFunctions(testcase.TestCase):
title = "CSS Functions"
def test_functions(self):
self.set_text( self.input() )
self.text_equals( self.... | kizza/CSS-Less-ish | tests/testfuncs.py | Python | mit | 1,589 |
"""Special exceptions for the ``command_interface`` app."""
class CommandError(Exception):
pass
| bitmazk/django-command-interface | command_interface/exceptions.py | Python | mit | 102 |
from django.apps import AppConfig
class MailinglistsConfig(AppConfig):
name = 'apps.mailinglists'
verbose_name = 'Mailinglists'
| dotKom/onlineweb4 | apps/mailinglists/appconfig.py | Python | mit | 138 |
import os
import pandas as pd
import seaborn as sns
dataDir = '..\\Test_Data\\'
pilotMarkerDataFile = 'Pilot.csv'
df = pd.read_csv( dataDir + '\\' + pilotMarkerDataFile,sep='\t', engine='python')
repr(df.head())
# TODO times per position
# plotting a heatmap http://stanford.edu/~mwaskom/software/seaborn/examples... | xfleckx/BeMoBI_Tools | analytics/BeMoBI_PyAnalytics/BeMoBI_PyAnalytics.py | Python | mit | 682 |
from django.http import Http404
from rest_framework import generics, permissions
from rest_framework.reverse import reverse
from rest_framework.response import Response
from rest_framework.views import APIView
from core.utils import filter_files_by_n_slashes
from .serializers import (FileBrowserPathListSerializer, Fi... | FNNDSC/ChRIS_ultron_backEnd | chris_backend/filebrowser/views.py | Python | mit | 5,178 |
# parsing the dump to get all the keys for the current players
import json
dic={}
with open('currentPlayerDump.json','r') as f:
data=json.load(f)
print data["resultSets"][0]["headers"]
print len(data["resultSets"][0]["rowSet"])
for obj in data["resultSets"][0]["rowSet"]:
if obj[0] not in dic:
dic[obj[0]]=obj[1... | bam2332g/proj1part3 | rahulCode_redo/project1Part3/nba/parseCurrentPlayers.py | Python | mit | 422 |
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
super().finalize_options()
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
... | pyvec/pyvodb | setup.py | Python | mit | 1,702 |
from contextlib import contextmanager
from fnmatch import fnmatch
import stat
from pyrsistent import pset
import attr
from filesystems import Path, exceptions
def _realpath(fs, path, seen=pset()):
"""
.. warning::
The ``os.path`` module's realpath does not error or warn about
loops, but we ... | Julian/Filesystems | filesystems/common.py | Python | mit | 7,276 |
# -*- coding: UTF-8 -*-
"""
Домашнее задание по уроку 2-2
«Работа с разными форматами данных»
Выполнил Мартысюк Илья PY-3
"""
import re
import glob
import chardet
from os.path import join
from xml.etree.cElementTree import XMLParser, parse
def open_data_file(path):
with open(path, 'rb') as encoding_detect_file:
... | martysyuk/PY-3-Learning | homeworks/lesson2-2.py | Python | mit | 1,637 |
from sqlalchemy import inspection, event, Column, Integer, ForeignKey
from sqlalchemy.orm import session, query
from sqlalchemy.sql import expression
from sqlalchemy.ext.declarative import declared_attr
import sqlalchemy
__all__ = [
'Base',
'TenantSession',
'TenantConflict',
'UnboundTenantError'
]
SQL... | mwhite/MultiAlchemy | multialchemy/base.py | Python | mit | 5,831 |
# -*- coding: utf-8 -*-
import unittest
from cwr.parser.encoder.dictionary import PublisherForWriterDictionaryEncoder
from cwr.interested_party import PublisherForWriterRecord
"""
Publisher for Writer record to dictionary encoding tests.
The following cases are tested:
"""
__author__ = 'Bernardo Martínez Garrido'
... | weso/CWR-DataApi | tests/parser/dictionary/encoder/record/test_publisher_for_writer.py | Python | mit | 1,487 |
# !/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
ERP+
"""
__author__ = 'António Anacleto'
__credits__ = []
__version__ = "1.0"
__maintainer__ = "António Anacleto"
__status__ = "Development"
__model_name__ = 'balancete.Balancete'
import auth, base_models
from orm import *
from form import *
try:
from my_ano_fis... | IdeaSolutionsOnline/ERP4R | core/objs/balancete.py | Python | mit | 7,841 |
import sublime, sublime_plugin
import os
import subprocess
import threading
class OpenGitbashHere(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
file_path = view.file_name()
dirname = os.path.dirname(file_path)
th = BashTerminalThread(dirname)
th.start(... | zeffii/sublimetext_productivity | Packages/User/open_gitbash_here.py | Python | mit | 719 |
import _plotly_utils.basevalidators
class PatternValidator(_plotly_utils.basevalidators.FlaglistValidator):
def __init__(self, plotly_name="pattern", parent_name="volume.surface", **kwargs):
super(PatternValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/volume/surface/_pattern.py | Python | mit | 582 |
import sys, os
import tweepy
# File with colon-separaten consumer/access token and secret
consumer_file='twitter.consumer'
access_file='twitter.access'
def __load_auth(file):
if os.path.exists(file):
with open(file) as f:
tokens = f.readline().replace('\n','').replace('\r','').split(':')
... | marc0uk/twit | twit.py | Python | mit | 1,468 |
# Python 3 program for soundscape generation. (C) P.B.L. Meijer 2015
# Direct port of the hificode.c C program
# Last update: October 6, 2015; released under the Creative
# Commons Attribution 4.0 International License (CC BY 4.0),
# see http://www.seeingwithsound.com/im2sound.htm for details
#
# Beware that this progr... | joshainglis/python-soundscape | soundscape.py | Python | mit | 14,885 |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.utils import six
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
... | 1tush/reviewboard | reviewboard/webapi/resources/review_group_user.py | Python | mit | 5,564 |
# set command to set global variables
from lib.utils import *
def _help():
usage = '''
Usage: set [options] (var) [value]
[options]:
-h Print this help.
-del (var) Delete variable
(var) if defined.
where (var) is a valid
global variable
if [value] is not given,
current v... | nayas360/pyterm | bin/set.py | Python | mit | 1,471 |
'''
- Leetcode problem: 210
- Difficulty: Medium
- Brief problem description:
There are a total of n courses you have to take, labeled from 0 to n-1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
Given the total number of cour... | bzhou26/leetcode_sol | p210_Course_Schedule_II.py | Python | mit | 2,295 |
import logging
logging.basicConfig(filename='test-logfile.log', level=logging.DEBUG)
top = 50
for i in range(top):
print(i)
logging.info('Loop completed, reached %s' % top)
| peterhogan/python | logtest.py | Python | mit | 177 |
import os
import pytest
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
SITE_DIR = os.path.join(BASE_DIR, "site")
@pytest.fixture
def site_dir():
return SITE_DIR
@pytest.fixture
def output_exist():
return lambda path: os.path.exists(os.path.join(SITE_DIR, "deploy", path))
@pytest.fixture(autouse=Tr... | whtsky/Catsup | tests/conftest.py | Python | mit | 419 |
# -*- coding: utf-8 -*-
from ..request import Request
from ..query import Entity
from ..query import Entry
import json
class UserEntity(Entity):
"""UserEntity object used for upload user entities.
Detail information about user entities you can see at our site
https://docs.api.ai/docs/userentities"""
... | ChonchoFronto/sarah | lambda/apiai/requests/user_entities/user_entities_request.py | Python | mit | 2,842 |
from simplequeue.lib.configuration import config
__all__ = ['config']
| geonetix/simplemq | simplequeue/__init__.py | Python | mit | 71 |
from __future__ import unicode_literals
import arrow
from django.db.models import DateTimeField, SubfieldBase
from .form_fields import ArrowField as ArrowFormField
class ArrowField(DateTimeField):
__metaclass__ = SubfieldBase
def to_python(self, value):
if isinstance(value, arrow.Arrow):
... | gizmag/django-arrow-field | arrow_field/model_fields.py | Python | mit | 1,161 |
#!/usr/bin/env python
#
#
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/Utilities24/prepare_dpf4.py,v 1.14.4.1 2011/12/01 17:16:33 rhuey Exp $
#
import string
import os.path
from MolKit import Read
from AutoDockTools.DockingParameters import DockingParameters, DockingParameter4FileMaker, genetic_algori... | Reimilia/pdb_sth | mapping/prepare_dpf4.py | Python | mit | 7,081 |
from similarity.webpage import WebPage
| Nozdi/webpage-similarity | similarity/__init__.py | Python | mit | 39 |
from aioredis.util import wait_convert, wait_ok, _NOTSET, _ScanIter
class GenericCommandsMixin:
"""Generic commands mixin.
For commands details see: http://redis.io/commands/#generic
"""
def delete(self, key, *keys):
"""Delete a key."""
fut = self.execute(b'DEL', key, *keys)
... | ymap/aioredis | aioredis/commands/generic.py | Python | mit | 11,140 |
from .engine import BloggingEngine
from .processor import PostProcessor
from .sqlastorage import SQLAStorage
from .storage import Storage
"""
Flask-Blogging is a Flask extension to add blog support to your
web application. This extension uses Markdown to store and then
render the webpage.
Author: Gouthaman Balaraman... | wdm0006/Flask-Blogging | flask_blogging/__init__.py | Python | mit | 403 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from dashboard.views import QuestionApi
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'zuobiao.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
u... | phyng/zuobiao | zuobiao/zuobiao/urls.py | Python | mit | 402 |
# -*- coding: utf-8 -*-
import os
import sys
import inspect
cmd_folder = os.path.realpath(
os.path.abspath(
os.path.split(
inspect.getfile(
inspect.currentframe()
)
)[0]
)
)
if cmd_folder not in sys.path:
sys.path.insert... | tscholak/smbkmeans | tfidf_smbkmeans.py | Python | mit | 5,558 |
import requests
from urllib.parse import parse_qs, urlparse
from lxml.html import fromstring
_HEADERS = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/41.0.2272.76 Chrome/41.0.2272.76 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application... | cit563emef2dasdme/jklasjdf12nfasfdkl | scrape_google_scholar_from_bing.py | Python | mit | 1,084 |
"""
Copyright (c) 2016 Gabriel Esteban
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute... | galaxyfeeder/CodeSubmission | main/admin.py | Python | mit | 1,131 |
from __future__ import unicode_literals
from django.db import models
from modpacks.models.modpack import Modpack
class Server(models.Model):
""" Minecraft Server details for display on the server page """
name = models.CharField(verbose_name='Server Name',
max_length=200)
desc = models.TextFi... | Jonpro03/Minecrunch_Web | src/servers/models.py | Python | mit | 921 |
from lexer import lang
from ..tree import Node
class Integer(Node):
datatype = lang.SEMANTIC_INT_TYPE
"""docstring for Integer."""
def __init__(self, symbol, token):
super().__init__(symbol, token)
def generate_code(self, **cond):
array, line = Node.assignated_array()
Node.ar... | andaviaco/tronido | src/syntax/types/integer.py | Python | mit | 370 |
"""Ingest Stage IV Hourly Files.
1. Copies to hourly stage IV netCDF files
2. Copies hourly stage IV netCDF to hourly IEMRE
"""
import os
import datetime
import sys
import numpy as np
from scipy.interpolate import NearestNDInterpolator
import pygrib
from pyiem import iemre
from pyiem.util import utc, ncopen, ... | akrherz/iem | scripts/iemre/precip_ingest.py | Python | mit | 3,827 |
"""Clock for keeping track of the wall time.
"""
__all__ = ['ClockError', 'Clock', 'log']
import datetime
import logging
import time
from typing import Optional # noqa: F401. Used for mypy.
class ClockError(Exception):
"""Invalid clock operation."""
pass
class Clock:
"""Clock for keeping track ... | jmbr/diffusion-maps | diffusion_maps/clock.py | Python | mit | 1,831 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from csacompendium.utils.abstractmodels import (
AuthUserDetail,
CreateUpdateTime,
)
from csacompendium.utils.createslug import create_slug
from csacompendium.utils.modelmanagers import (
model_instance_filter,
model_foreign_key_qs,
mo... | nkoech/csacompendium | csacompendium/csa_practice/models.py | Python | mit | 9,828 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
import views
urlpatterns = patterns('',
url(r'^add_model_abox', 'tadaa.views.add_model_abox'),
url(r'^add_model', 'tadaa.views.add_model'),
url(r'^list_models', 'tadaa.views.list_models', name='list_models'),
url(r'^ab... | ahmad88me/tada | tadacode/tadaa/urls.py | Python | mit | 1,340 |
# Copyright (c) 2012 Roberto Alsina y otros.
# 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, pub... | servalproject/nikola | nikola/plugins/compile_rest/youtube.py | Python | mit | 2,306 |
from django.db import models
from django.utils import timezone
class TimeStampedModel(models.Model):
created_at = models.DateTimeField(default=timezone.now)
updated_at = models.DateTimeField(default=timezone.now)
class Meta:
abstract = True | HoangNguyenHuy/SocialNetwork | src/SocialNetwork_API/models/timestamped.py | Python | mit | 262 |
import os
import sys
import pandas as pd
import numpy as np
from numpy.random import poisson, uniform
from numpy import mean
import time
import math
po = True
teamsheetpath = sys.path[0] + '/teamcsvs/'
compstat = {'TDF': 'TDA', 'TDA': 'TDF', #Dictionary to use to compare team stats with opponent stats
'F... | JoeJimFlood/NFLPrediction2014 | matchup.py | Python | mit | 10,272 |
#!/usr/bin/env python
from cogent.app.util import CommandLineApplication,\
CommandLineAppResult, ResultPath
from cogent.app.parameters import Parameter,ValuedParameter,Parameters
__author__ = "Shandy Wikman"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__contributors__ = ["Shandy Wikman"]
__license__... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/cogent/app/ilm.py | Python | mit | 3,567 |
#!/usr/bin/env python
""" Assignment 1, Exercise 3, INF1340, Fall, 2015. Troubleshooting Car Issues.
This module contains one function diagnose_car(). It is an expert system to
interactive diagnose car issues.
"""
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__... | SLiana/inf1340_2015_asst1 | exercise3.py | Python | mit | 2,130 |
"""
Disjoint set.
Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure
"""
class Node:
def __init__(self, data: int) -> None:
self.data = data
self.rank: int
self.parent: Node
def make_set(x: Node) -> None:
"""
Make x as a set.
"""
... | TheAlgorithms/Python | data_structures/disjoint_set/disjoint_set.py | Python | mit | 1,913 |
#pylint: disable=C0301, C0103, W0212, W0401
"""
.. module:: pilot
:platform: Unix
:synopsis: RADICAL-Pilot is a distributed Pilot-Job framework.
.. moduleauthor:: Ole Weidner <ole.weidner@rutgers.edu>
"""
__copyright__ = "Copyright 2013-2014, http://radical.rutgers.edu"
__license__ = "MIT"
# --------------... | JensTimmerman/radical.pilot | src/radical/pilot/__init__.py | Python | mit | 1,882 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# based on ideas in https://github.com/lethienhoa/Very-Deep-Convolutional-Networks-for-Natural-Language-Processing/blob/master/train.py
import tensorflow as tf
from vdcnn import VDCNN
import numpy as np
import os
import time
import datetime
import cPickle as pkl
import t... | hyperlex/vdcnn | train.py | Python | mit | 3,788 |
"""Use stochastic Lanczos quadrature to approximate spectral function sums of
any operator which has an efficient representation of action on a vector.
"""
import functools
from math import sqrt, log2, exp, inf, nan
import random
import warnings
import numpy as np
import scipy.linalg as scla
from scipy.ndimage.filters... | jcmgray/quijy | quimb/linalg/approx_spectral.py | Python | mit | 30,236 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACCOUNT_SID"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
number = client.lookups.phone_numbers("+15108675309... | teoreteetik/api-snippets | lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.6.x.py | Python | mit | 406 |
# -*- coding: mbcs -*-
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from optimization import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
i... | JorgeDeLosSantos/metal-forming-itc | forming_2D.py | Python | mit | 37,581 |