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 sklearn.preprocessing import normalize import numpy as np class HMM(): ''' Hmm class expecting transition matrix only... ''' def __init__(self,A): ''' :param A: transition matrix, A_ij is p(Z_t=j|Z_t-1=i) ''' assert all(np.sum(A, axis = 1))==1 # transpose to g...
jcornford/pyecog
pyecog/ndf/hmm_pyecog.py
Python
mit
4,391
from model_mommy.recipe import Recipe, seq, foreign_key from cla_common.money_interval.models import MoneyInterval from diagnosis.tests.mommy_recipes import diagnosis_yes from ..models import ( Category, EligibilityCheck, Property, Savings, Case, PersonalDetails, ContactResearchMethod, ...
ministryofjustice/cla_backend
cla_backend/apps/legalaid/tests/mommy_recipes.py
Python
mit
3,481
"""\ Copyright (c) 2009 Paul J. Davis <paul.joseph.davis@gmail.com> This file is part of hypercouch which is released uner the MIT license. """ import time import unittest import couchdb COUCHURI = "http://127.0.0.1:5984/" TESTDB = "hyper_tests" class AttrTest(unittest.TestCase): def setUp(self): self.srv...
benoitc/hypercouch
tests/attr_test.py
Python
mit
2,262
# Copyright (C) 2010-2013 Claudio Guarnieri. # Copyright (C) 2014-2016 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # See the file 'docs/LICENSE' for copying permission. from lib.cuckoo.common.abstracts import Signature class CreatesExe(Signature): name = "creates_exe" ...
mburakergenc/Malware-Detection-using-Machine-Learning
cuckoo/modules/signatures/creates_exe.py
Python
mit
997
default_app_config = 'quran_tafseer.apps.QuranTafseerConfig'
EmadMokhtar/tafseer_api
quran_tafseer/__init__.py
Python
mit
61
#!/usr/bin/env python from __future__ import print_function import httplib2 import os, re, sys, time from apiclient import discovery from oauth2client import client from oauth2client import tools from oauth2client.file import Storage try: import argparse p = argparse.ArgumentParser(parents=[tools.argparser]) ...
koki-h/motion_for_mukoyama
scripts/post2googledrive.py
Python
mit
3,272
import _plotly_utils.basevalidators class ColorscaleValidator(_plotly_utils.basevalidators.ColorscaleValidator): def __init__( self, plotly_name="colorscale", parent_name="scattergeo.marker", **kwargs ): super(ColorscaleValidator, self).__init__( plotly_name=plotly_name, ...
plotly/plotly.py
packages/python/plotly/plotly/validators/scattergeo/marker/_colorscale.py
Python
mit
515
__author__ = 'sathley' from .error import ValidationError, UserAuthError, AppacitiveError from .file import AppacitiveFile from .push import AppacitivePushNotification from .appacitive_email import AppacitiveEmail from .response import AppacitiveCollection, PagingInfo from .entity import AppacitiveEntity from .objec...
appacitive/pyappacitive
pyappacitive/__init__.py
Python
mit
805
# 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-frontdoor/azure/mgmt/frontdoor/aio/operations/_frontend_endpoints_operations.py
Python
mit
23,414
import logging import os import re import shutil import subprocess import time from teuthology import misc from teuthology.util.flock import FileLock from teuthology.config import config from teuthology.contextutil import MaxWhileTries, safe_while from teuthology.exceptions import BootstrapError, BranchNotFoundError, ...
SUSE/teuthology
teuthology/repo_utils.py
Python
mit
15,687
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('pfss', '0023_auto_20150515_1059'), ] operations = [ migrations.AddField( model_name='specialability', ...
qu0zl/pfss
pfss/migrations/0024_auto_20150515_1129.py
Python
mit
646
# -*- coding: utf-8 -*- import locale import logging from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.mail import EmailMessage from django.template.loader import render_to_string from django.utils import timezone from django.utils.translation import ugettext...
dotKom/onlineweb4
apps/payment/mommy.py
Python
mit
11,223
# main_program.py # runs the parser and produces sentences that politicians might say # J. Hassler Thurston # RocHack Hackathon December 7, 2013 import os from scraper import * from get_words import * from parser2 import * # TODO: use os.path.set() instead of just referencing local (Mac OS X) filename speeches_to_g...
jthurst3/newspeeches
main_program.py
Python
mit
1,612
import os import json cfg = {} cfg_file = os.path.join(os.path.dirname(__file__) + '/conf', "cfg.json") def set_config_file(fp): global cfg_file cfg_file = fp def load_config(): global cfg with open(cfg_file) as fp: content = fp.read() cfg = json.loads(content) return cfg def dum...
c4pt0r/purelog
utils.py
Python
mit
569
# 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/resources/azure-mgmt-msi/azure/mgmt/msi/aio/__init__.py
Python
mit
586
from kivy.tests.common import GraphicUnitTest from kivy.lang import Builder from kivy.base import EventLoop from kivy.weakproxy import WeakProxy from kivy.uix.dropdown import DropDown from kivy.input.motionevent import MotionEvent KV = ''' # +/- copied from ActionBar example + edited for the test FloatLayout: Ac...
jegger/kivy
kivy/tests/test_uix_actionbar.py
Python
mit
11,580
#!/usr/bin/env python3 # Copyright (c) 2021 The Dash Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test being able to connect to the same devnet""" from test_framework.mininode import P2PInterface from test_fr...
thelazier/dash
test/functional/p2p_connect_to_devnet.py
Python
mit
1,020
import os from datetime import datetime, timezone, timedelta from pyshorteners import Shortener class EQData(): def __init__(self, input): self.input = input self.properties = self.input['properties'] self.geometry = self.input['geometry'] self.coordinates = self.geometry['coordin...
leoorpillaiii/earthquakePH-bot
eqdata.py
Python
mit
1,812
""" A workflow to process the URL scan & join results. """ from __future__ import absolute_import import argparse import datetime import logging import json import apache_beam as beam from apache_beam.utils.options import PipelineOptions from apache_beam.utils.options import SetupOptions from apache_beam.utils.op...
HTTPArchive/hosts
dataflow.py
Python
mit
6,464
# -*- coding: utf-8 -*- from django.conf.urls.defaults import patterns, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('twitter_oauth.oauth.views', # Top Page url(r'^oauth/$', 'index', name='index'), # Twitter OAuth ...
ketulive/twitter_oauth
twitter_oauth/urls.py
Python
mit
638
#------------------------------------------------------------------------------- # Name: Airborne Troops- Countdown to D-Day *.PAK # Purpose: Extract Archive # # Author: Eric Van Hoven # # Created: 30/08/2017 # Copyright: (c) Eric Van Hoven 2017 # Licence: <MIT License> #------------...
TheDeverEric/noesis-importers
Eric Van Hoven/fmt_airbornedday_pak.py
Python
mit
1,523
from base.handler import Handler class DesktopHandler(Handler): """Is a Handler specialization for a Desktop platform""" def __init__(self, service): super(DesktopHandler, self).__init__() self.__service = service def start_async(self, c, program_index=None, option_index=None)...
SimoneLucia/EmbASP-Python
platforms/desktop/desktop_handler.py
Python
mit
1,129
import numpy as np from warnings import warn from subprocess import Popen, PIPE, STDOUT from tempfile import mktemp import os class Radio(object): def __init__(self): self.frequency = 446000000 self.bandwidth = 1000000 self.samplerate = 1000000 def _interleave(self, complex_iq): ...
polygon/spectrum_painter
spectrum_painter/radios.py
Python
mit
3,230
#!/usr/bin/env python3 # -*- compile-command: "/usr/local/bin/python3 sim.py" -*- #--------------------------------------------------------------------------- # encoding/decoding for machine learning # import sys, os, datetime, re, json, bz2, math import basicbot_lib as bblib DBG_MAX_UNITS = int(os.environ.get('DBG_...
asah/meatshields-python-botkit
board_move_state.py
Python
mit
13,619
from django.core.files.base import ContentFile from django.core.management.base import BaseCommand import requests import kronos from nba_py.player import PlayerList, PlayerGeneralSplits from players.models import Player from teams.models import Team from seasons.models import Season, PlayerSeason @kronos.register(...
pawelad/nba-rank
src/players/management/commands/update_players.py
Python
mit
4,552
#!/usr/bin/env python """ Main entry point to application when running client from shell """ from __future__ import print_function import os import sys import signal from lib.service_bus.client import Client def main(): """main entry point to application""" sbs_namespace = "" access_key = "" if "HCR_...
jenyayel/hooks-client-rpi
hooks_listener/__main__.py
Python
mit
1,141
#!python2 from routes import app import auth, mushrooms if __name__ == "__main__": # Parse command line arguments from argparse import ArgumentParser parser = ArgumentParser( description='Web server for mushroom gathering data collection', epilog='Easy config setup advice: copy and modify e...
kazagistar/fungitrack
server.py
Python
mit
1,107
from proteus.default_n import * from proteus import (StepControl, TimeIntegration, NonlinearSolvers, LinearSolvers, LinearAlgebraTools) from proteus.mprans import Kappa import kappa_p as physics from proteus import Context ct = Context....
erdc-cm/air-water-vv
2d/benchmarks/wavesloshing/kappa_n.py
Python
mit
1,853
from text import TextTemplate from generic import GenericTemplate from button import ButtonTemplate from quick_replies import add_quick_reply from attachment import AttachmentTemplate __all__ = [ 'TextTemplate', 'GenericTemplate', 'ButtonTemplate', 'add_quick_reply', 'AttachmentTemplate' ]
mayukh18/BlindChat
templates/__init__.py
Python
mit
311
''' Reference Methods, Structures and Documentation adapted from. https://msdn.microsoft.com/en-us/library/windows/desktop \ /ms705945%28v=vs.85%29.aspx ''' from ctypes import * from ctypes.wintypes import * from sys import exit def customresize(array, new_size): return (array._type_*new_size).from_address(addre...
johnbolia/plyer
plyer/platforms/win/libs/wifi_defs.py
Python
mit
15,497
# -*- coding: utf8 -*- # # # # Downscale PCMDI AR5 data to a pre-processed climatology # extent, resolution, reference system # # Author: Michael Lindgren (malindgren@alaska.edu) # # # import rasterio, os, copy import numpy as np import pandas as pd import geopandas as gpd import xarray as xr from downscale import ut...
ua-snap/downscale
downscale/ds.py
Python
mit
16,630
from cardinal.decorators import command class TestCommandRaisesExceptionPlugin: def __init__(self): self.command_calls = [] @command('command') def command(self, *args): self.command_calls.append(args) raise Exception() def setup(): return TestCommandRaisesExceptionPlugin()
JohnMaguire/Cardinal
cardinal/fixtures/fake_plugins/command_raises_exception/plugin.py
Python
mit
320
""" fizzbuzz.py Author: Dimitri Credit: Mr. Dennison Assignment: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. We will use a v...
HHStudent/fizzbuzz
fizzbuzz.py
Python
mit
1,184
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2021 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. import posixpath from flask import jsonify, request, session from flask_plug...
ThiefMaster/indico-plugins
ursh/indico_ursh/controllers.py
Python
mit
4,034
import decimal import gc import itertools import multiprocessing import weakref import sqlalchemy as sa from sqlalchemy import ForeignKey from sqlalchemy import inspect from sqlalchemy import Integer from sqlalchemy import MetaData from sqlalchemy import select from sqlalchemy import String from sqlalchemy import test...
sqlalchemy/sqlalchemy
test/aaa_profiling/test_memusage.py
Python
mit
45,650
# coding: utf-8 from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os import sys import urllib2 import warnings # Third-party import matplotlib.pyplot as plt import numpy as np from scipy.stats import truncnorm, scoreatpercentile # Neutron star d...
adrn/tilt-shift
scripts/companion.py
Python
mit
5,554
# stripped away features RBH 2018 # negamax, no alphabeta, no TT import numpy as np class Cell: # each cell is one of these: empty, x, o n,e,x,o,chars = 9,0,1,2,'.xo' def opponent(c): return 3-c # each cell is 0,1,2 # so number positions == 3**9 # can represent position as 9-digit base_3 number ttt_st...
ryanbhayward/games-puzzles-algorithms
simple/ttt/test/ttt.py
Python
mit
5,278
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="scattergl.marker.line", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=pa...
plotly/plotly.py
packages/python/plotly/plotly/validators/scattergl/marker/line/_color.py
Python
mit
593
""" WSGI config for djangoblog 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.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SE...
Raulios/django-blog
djangoblog/wsgi.py
Python
mit
397
#!/usr/bin/env python3 try: # for Python 2.x import StringIO except: # for Python 3.x import io import csv import pandas as pd import numpy as np import matplotlib.pyplot as plt import re # define data csv_input = """timestamp,title,reqid 2016-07-23 11:05:08,SVP,2356556-AS 2016-12-12 01:23:33,VP,556...
robmarano/nyu-python
course-2/session-7/pandas/df_basics.py
Python
mit
2,677
""" https://leetcode.com/problems/binary-gap/ https://leetcode.com/submissions/detail/182434177/ https://leetcode.com/submissions/detail/182434882/ """ class Solution: def binaryGap(self, N): """ :type N: int :rtype: int """ ans = 0 distance = 0 cur = N ...
vivaxy/algorithms
python/problems/binary_gap.py
Python
mit
927
#!/usr/bin/python3 ''' Created on Dec 3, 2016 @author: keithcoleman This is a simple prime number generator that finds prime numbers within a user defined range. A great script to use with the RSA scripts ''' def primeNumberFinder(p=1): while(True): if primeFilter(p): yield p p+=1 ...
kcolemanbd/Mathematics
PrimeNumberGenerator.py
Python
mit
919
# 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/_express_route_circuit_peerings_operations.py
Python
mit
22,136
""" Door controller for a chicken coop This is hooked to a power screwdriver and battery system through the gpio port. The screwdriver is connected to a vertical sliding door through a string and pulley arrangement. Turning the motor one way raises the door, the other way lowers it. However, if all the ...
wiredfool/coop-door
door/door.py
Python
mit
12,170
#Demeter Interpreter #./bytecode/lexer/scanner.py #std import #custom import import bytecode.lexer.tokens as tokens class Scanner: """ Class that scans a text to return tokens """ SPACE = " " CMT_MARK = "#" def __init__(self,src,fname): self.src = src #source file ...
Aine1000/Demeter
bytecode/lexer/scanner.py
Python
mit
1,852
# -*- coding: utf-8 -*- from __future__ import print_function, division from plumbum import cli from plumbum.lib import six class TestValidator: def test_named(self): class Try(object): @cli.positional(x=abs, y=str) def main(selfy, x, y): pass assert Try.mai...
AndydeCleyre/plumbum
tests/test_validate.py
Python
mit
2,783
DEBUG = True # Turns on debugging features in Flask
mapposters/server
config/development.py
Python
mit
51
import os import matplotlib.pyplot as plt from astropy.table import Table, vstack from matplotlib.colors import LogNorm from matplotlib.ticker import MaxNLocator from scipy.spatial import Delaunay import AnniesLasso as tc RESULTS_PATH = "/data/gaia-eso/arc/rave/results/" RESULTS_PATH = "../../" ms_results = Table...
AnnieJumpCannon/RAVE
article/figures/plot_joint_model_metrics.py
Python
mit
4,798
from collections import defaultdict import csv from pathlib import Path import os from rdflib import Graph, URIRef, Literal, BNode, RDF, RDFS, OWL from sqlalchemy import create_engine, inspect, Table, Column from sqlalchemy.orm.session import sessionmaker from pyontutils import utils from pyontutils.config import auth ...
tgbugs/pyontutils
nifstd/nifstd_tools/extracting_pmids_from_neurolex.py
Python
mit
8,206
#!/usr/bin/env python3 """ When doing gene finding with tools like Augustus it's common to take a file of curated genes/transcripts and split these into a set for training and another for evaluation. This script accepts an input GFF3 file and then generates two files, one of genes to use as training and another as ev...
jorvis/biocode
gff/select_training_and_evaluation_transcripts.py
Python
mit
4,854
# -*- coding: utf-8 -*- from pgradd.RINGParser.Reader import Read from rdkit import Chem import unittest class TestRINGParser(unittest.TestCase): def test_molquery(self): testmol = Chem.MolFromSmiles('CCC') s = """ fragment a{ C labeled c1 C labeled c2 single bond ...
VlachosGroup/VlachosGroupAdditivity
pgradd/tests/test_RINGparser_RDkitwrapper_test.py
Python
mit
12,902
# type: ignore from unittest import mock from django.core.exceptions import ValidationError from django.forms import Textarea from django.http import HttpRequest from django.test import TestCase from appmail.forms import ( EmailTestForm, JSONWidget, MultiEmailField, MultiEmailTemplateField, ) from app...
yunojuno/django-appmail
tests/test_forms.py
Python
mit
4,173
from collections import defaultdict import random def getLcs(string1, string2): f, p = {}, {} #Initialize for i in range(len(string1) + 1): f[(i, 0)], p[(i, 0)] = 0, -1 for j in range(len(string2) + 1): f[(0, j)], p[(0, j)] = 0, -1 #dp maxF = [0, (0, 0)] for i in range(1, le...
Poligun/NihongoWeb
nihongo/algorithm.py
Python
mit
2,157
import datetime import graphene from django.db.models import Q, Prefetch from openstates.data.models import ( Jurisdiction, Organization, Person, Membership, LegislativeSession, RunPlan, ) from utils.geo import coords_to_divisions from .common import ( OCDBaseNode, IdentifierNode, Na...
openstates/openstates.org
graphapi/core.py
Python
mit
14,832
import socket import pytest from Pyro5.compatibility import Pyro4 def test_compat_config(): import Pyro4 conf = Pyro4.config.asDict() assert conf["NS_PORT"] == 9090 Pyro4.config.NS_PORT = 12345 conf = Pyro4.config.asDict() assert conf["NS_PORT"] == 12345 Pyro4.config.NS_PORT = 9090 def t...
irmen/Pyro5
tests/test_pyro4compat.py
Python
mit
1,569
import _plotly_utils.basevalidators class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__( self, plotly_name="sizesrc", parent_name="histogram2d.hoverlabel.font", **kwargs ): super(SizesrcValidator, self).__init__( plotly_name=plotly_name, pare...
plotly/plotly.py
packages/python/plotly/plotly/validators/histogram2d/hoverlabel/font/_sizesrc.py
Python
mit
427
from starcluster.clustersetup import ClusterSetup from starcluster.logger import log class SamblasterInstaller(ClusterSetup): def run(self, nodes, master, user, user_shell, volumes): for node in nodes: log.info("Installing samblaster 0.1.20 on %s" % (node.alias)) node.ssh.execute('mkdir -p /opt/software/sambl...
meissnert/StarCluster-Plugins
samblaster_0_1_20.py
Python
mit
1,150
import random def build_level (hallway): flag_a = False flag_b = True for i in range(66): hallway.append(random.randint(0,9)) if hallway[i] == 8: if flag_a == True: hallway[i] = 0 flag_a = False else: flag_a = True ...
cpt-ado/laberinto
nivel.py
Python
mit
600
import click from contextlib import closing import os import requests def auth_header(data): return {'Authorization': 'Token {}'.format(data.auth_token)} def download_with_progressbar(data, url, filename=None, label=None): with closing(requests.get(url, stream=True)) as rq: if filename is None: ...
axsemantics/axsemantics-cli
axsemantics_cli/common/transfer.py
Python
mit
1,718
# Time: O(n) # Space: O(p), p is the number of paths class Solution(object): def pathSum(self, nums): """ :type nums: List[int] :rtype: int """ class Node(object): def __init__(self, num): self.level = num/100 - 1 self.i = (num%10...
yiwen-luo/LeetCode
Python/path-sum-iv.py
Python
mit
1,061
# -*- coding: utf-8 -*- NEXT_CARDS_TO_REVIEW_STUBS = [ { "cards": [ { "id": 15726, "deck": 370, "fact": 8112, "ease_factor": None, "interval": None, "due_at": None, "last_ease_factor"...
aehlke/manabi
manabi/apps/flashcards/test_stubs.py
Python
mit
3,873
from operator import itemgetter from math import sqrt def kdtree(points, axis): if not points: return None median = len(points) // 2 points.sort(key=itemgetter(axis)) axis = (axis + 1) % 2 return [points[median], kdtree(points[0:median], axis), kdtree(points[media...
o-kei/design-computing-aij
ch4_1/nearest_kdtree2.py
Python
mit
1,306
#!python3 from tkinter import * from tkinter.messagebox import * from tkinter.ttk import * import sympy simptypes = { "Simplify": sympy.simplify, "Expand": sympy.expand, "Factor": sympy.factor, "Cancel": sympy.cancel, "Apart": sympy.apart, } class SimpSelect(Frame): def __init__(self, *args, *...
BookOwl/pymath
widgets/simpWidget.py
Python
mit
1,823
import urllib, shutil, csv from time import time import os parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) os.sys.path.insert(0,parentdir) import summary.summary def findRoutines(fileName): for ln in fileName: url = ln.split(";")[3] routineName = url.split("/")[-1] ...
LighthouseHPC/lighthouse
src/LAPACK341/computational_inverse/inverse_find_341.py
Python
mit
2,107
# coding:utf-8 import cv2 def Hist(im1, im2): hist1 = cv2.calcHist([im1], [0], None, [256], [0,256]) hist2 = cv2.calcHist([im2], [0], None, [256], [0,256]) # ヒストグラムの類似度を計算 d = cv2.compareHist(hist1, hist2, 0) print d if d > 0.6: return 1 return 0
palloc/face_t
backend-api/image_api/authapp/hist.py
Python
mit
319
""" Django settings for AndroidWEB project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)...
amragaey/AndroidWEB
AndroidWEB/settings.py
Python
mit
2,533
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
Sorsly/subtle
google-cloud-sdk/lib/googlecloudsdk/api_lib/spanner/database_sessions.py
Python
mit
2,404
#!/usr/bin/python3 __author__ = 'Przemek Decewicz' import gzip import sys import pkg_resources from argparse import ArgumentParser, RawDescriptionHelpFormatter from Bio import SeqIO from compare_predictions_to_phages import genbank_seqio from glob import glob from os import makedirs, path from PhiSpyModules import log...
linsalrob/PhiSpy
scripts/make_training_sets.py
Python
mit
24,540
import os import random import string class CalcItJobCreateError(IOError): """ Exception cast if there is an error to create a job""" pass def substitute_file(from_file, to_file, substitutions): """ Substitute contents in from_file with substitutions and output to to_file using string.Template cl...
cstein/calcit
calcit/util.py
Python
mit
3,045
import jsog import unittest class TestJSOG(unittest.TestCase): def test_encode_reference(self): inner = { "foo": "bar" } outer = { "inner1": inner, "inner2": inner } encoded = jsog.encode(outer) inner1 = encoded['inner1'] inner2 = encoded['inner2'] # one has @id, one has @ref self.assertNotEqual('@id...
jsog/jsog-python
test_jsog.py
Python
mit
1,554
# Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module implements input and output processing from Nwchem. 2015/09/21 - Xin Chen (chenxin13@mails.tsinghua.edu.cn): NwOutput will read new kinds of data: 1. normal hessian matrix. ["hessian"] ...
vorwerkc/pymatgen
pymatgen/io/nwchem.py
Python
mit
35,126
"""Identify program versions used for analysis, reporting in structured table. Catalogs the full list of programs used in analysis, enabling reproduction of results and tracking of provenance in output files. """ import os import contextlib import subprocess import sys import yaml import toolz as tz from bcbio import...
mjafin/bcbio-nextgen
bcbio/provenance/programs.py
Python
mit
11,554
import time from math import ceil, log10 def get_numbers(): """ Returns list of numbers in data file """ filename = "problem13-data.txt" text_file = open(filename, "r") lines = text_file.readlines() text_file.close() L = [int(lines[i]) for i in range(len(lines))] return L def test(): L = get_numbers() pri...
hubenjm/Project-Euler
problem13.py
Python
mit
565
# -*- coding: utf-8 -*- """ Part of the **Pyception** package. :Version: 1 :Authors: - Florian Indot :Contact: florian.indot@gmail.com :Date: 28.06.2017 :Revision: 3 :Copyright: MIT License """ import os import sys import matplotlib.pyplot as plt import lib as pct from lib import SETTINGS, Level, Repository from ....
3mpr/TobiiLogger
lib/analytics/Subject.py
Python
mit
4,318
""" Module containing defintions for all sites to test. Should be subclasses of 'browser_base'. """ import os import imp sites = {} for fle in os.listdir(__path__[0]): name, ext = os.path.splitext(fle) if ext == '.py' and not name == "__init__": sites[name] = imp.load_source(name, os.path.jo...
winfried/WTF
sites/__init__.py
Python
mit
342
from __future__ import (absolute_import, division, print_function, unicode_literals) from future.builtins import * from blockext import * import sphero __version__ = '0.2.1' class Sphero: def __init__(self): self.robot = sphero.Sphero() self.robot.connect() self.n...
blockext/sphero
__init__.py
Python
mit
1,738
# Copyright (c) 2015 Tanium Inc # # Generated from console.wsdl version 0.0.1 # # from .base import BaseType class ClientStatus(BaseType): _soap_tag = 'client_status' def __init__(self): BaseType.__init__( self, simple_properties={'host_name': str, ...
tanium/pytan
lib/taniumpy/object_types/client_status.py
Python
mit
1,389
from localisation_core import * import sys from pymongo import MongoClient if len(sys.argv) > 1 and sys.argv[1].lower() not in ['testbb'] : exit('argument is incorrect') client = MongoClient() db = client.twitterdb nonloc_values = [] if len(sys.argv) == 1: nonloc_values = getUnloc() print("Data loaded. Numbe...
alek-beloff/teamproject
localisation_main.py
Python
mit
1,787
"""Configure tests.""" import logging import sys import httpretty import pytest import requests.packages.urllib3 @pytest.fixture(autouse=True, scope='session') def config_httpretty(): """Configure httpretty global variables.""" httpretty.HTTPretty.allow_net_connect = False @pytest.fixture(autouse=True, sc...
Robpol86/appveyor-artifacts
tests/conftest.py
Python
mit
559
import os import argparse import csv import random from .utils import CompletePath # Get arguments def get_args(): parser = argparse.ArgumentParser(description="Use the phyluce_align_get_informative_sites output to extract UCE alignments with a certain number of informative sites (or random ones)", formatter_class=...
AntonelliLab/seqcap_processor
secapr/extract_alignments_from_phyluce_get_inf_sites_output.py
Python
mit
2,572
from __future__ import print_function import logging try: from PyQt4.QtGui import QPushButton except ImportError: from PyQt5.QtWidgets import QPushButton from pyqtgraph.dockarea import DockArea, Dock logger = logging.getLogger(__name__) class ProviderPB(QPushButton): """ Widget to enalbe/disable ...
andalexo/pyqttoolbox
pytaap/providers.py
Python
mit
4,194
import commands import os import eyed3 # Changing string to unicode def str_uni(string): unicode = unicode(string, 'utf-8') return unicode # Currently not in use , hence commented # def addslashes(s): # s = s.replace(' ', '\ ').replace("'", "\'").replace('"', '\"') # return s # I used a class here # T...
yashmehrotra/mp3-manager
trial.py
Python
mit
2,588
""" Utilities for generating perfect hash functions for integer keys. This module implements the first fit decreasing method, described in Gettys01_. It is **not** guaranteed to generate a *minimal* perfect hash, though by no means is it impossible. See for example: >>> phash = hash_parameters('+-<>[].,', to_int=ord)...
eddieantonio/perfection
perfection/__init__.py
Python
mit
649
import uuid from sketch_components.utils import combine_styles, update_existing, \ small_camel_case class Box(object): def __init__(self): self.top = None self.right = None self.bottom = None self.left = None def __repr__(self): box = {'top': self.top, 'right': se...
ibhubs/sketch-components
sketch_components/engines/react/base/components/commons.py
Python
mit
2,482
# # This file is part of Gruvi. Gruvi is free software available under the # terms of the MIT license. See the file "LICENSE" that was provided # together with this source file for the licensing terms. # # Copyright (c) 2012-2017 the Gruvi authors. See the file "AUTHORS" for a # complete list. """ The :mod:`gruvi.http...
swegener/gruvi
lib/gruvi/http.py
Python
mit
46,281
# from pyon import loads, dumps from etree import Node, Leaf htmlTags = ["html", "meta", "header", "body", "table", "td", "tr", "p", "h1", "h2", "h3", "h4", "li", "it"] moduleDict = globals() for tag in htmlTags: def func(*args, _thisTag=tag, **kwargs): if args: return Leaf(_thisTag, a...
intellimath/pyon
examples/etree/html.py
Python
mit
948
# The MIT License (MIT) # # Copyright (c) 2015 University of East Anglia, Norwich, UK # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the r...
yuyu2172/image-labelling-tool
flask_app.py
Python
mit
6,680
from flask import Flask from flask.ext.bootstrap import Bootstrap from flask.ext.mail import Mail from flask.ext.sqlalchemy import SQLAlchemy from config import config bootstrap = Bootstrap() mail = Mail() db = SQLAlchemy() def create_app(config_name): app = Flask(__name__) app.config.from_object(config[conf...
benosment/cookbook
app/__init__.py
Python
mit
799
from django.conf.urls import patterns, include, url from tracking.views import * urlpatterns = patterns( '', url(r'^logout/$',LogoutView.as_view(), name="logout"), url(r'^home/$', IndexView.as_view(), name="index"), url(r'^add/organization/$', OrganizationView.as_view(), name="add-organization"), ...
Heteroskedastic/Dr-referral-tracker
tracking/urls.py
Python
mit
2,078
# -*- mode: python; coding: utf-8 -*- # Copyright 2013-2014 Peter Williams <peter@newton.cx> and collaborators. # Licensed under the MIT License. """pwkit.tinifile - Dealing with typed ini-format files full of measurements. Functions: read Generate :class:`pwkit.Holder` instances of measurements from an ini-format...
pkgw/pwkit
pwkit/tinifile.py
Python
mit
4,312
# Generated by Django 3.0.8 on 2020-07-12 05:05 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("places", "0009_auto_20200712_0155"), ] operations = [ migrations.AlterModelOptions( name="restaurant", options={"ordering": ["name"]}, ...
huangsam/chowist
places/migrations/0010_auto_20200712_0505.py
Python
mit
336
from . import Block class BlockView(Block): validation = '^\d{4}$|CAVOK' name = 'view' patterns = { 'distance': ['\d{4}$', ('^CAVOK$', '_cavok')], } def _cavok(self, c): return 'Ceiling And Visibility OKay' # No cloud below 5000ft, no Cn Tc, visability >= 10km, nosig
tspycher/python-aviationdata
aviationdata/blocks/blockview.py
Python
mit
306
from __future__ import absolute_import from django.core.serializers.json import DjangoJSONEncoder import json, sys def to_json(data, **kw): if sys.version_info.major < 3: kw['encoding'] = 'utf-8' return json.dumps(data, cls=DjangoJSONEncoder, ensure_ascii=False, separators=(',',':'), **kw)
futurice/django-jsonmodel
djangojsonmodel/contrib/representation/json.py
Python
mit
308
from conans.model import Generator from conans.paths import BUILD_INFO_PREMAKE class PremakeDeps(object): def __init__(self, deps_cpp_info): self.include_paths = ",\n".join('"%s"' % p.replace("\\", "/") for p in deps_cpp_info.include_paths) self.lib_paths =...
memsharded/conan
conans/client/generators/premake.py
Python
mit
3,149
from django.conf.urls.defaults import patterns from url_images import DjangoImageHandler resizer = DjangoImageHandler() urlpatterns = patterns('', (r'^.*$', resizer), )
AndrewIngram/python-url-images
url_images/urls.py
Python
mit
175
# Copyright (C) 2006-2011, University of Maryland # # 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,...
reflectometry/direfl
direfl/gui/app_panel.py
Python
mit
10,749
# coding=utf-8 import urllib.request, urllib.parse, urllib.error import urllib.request, urllib.error, urllib.parse import urllib.parse import re import time import datetime import sys import random import json import codecs import requests import logging import os from PIL import Image from io import BytesIO from bson ...
KeithYue/weibo-keywords-crawler
weibo_crawler.py
Python
mit
8,723
from schemas import (material) from os import (environ) MONGO_URI = environ.get('MONGOLAB_URI') PUBLIC_METHODS = ['GET'] PUBLIC_ITEM_METHODS = ['GET'] RESOURCE_METHODS = ['GET'] ITEM_METHODS = ['GET'] DOMAIN = { 'materials': material }
olivettigroup/synthesis-api
synthesisapi/settings.py
Python
mit
242
# -*- coding: utf8 -*- import textwrap # https://docs.python.org/3.6/library/textwrap.html def wrap(string, max_width): return textwrap.fill(string, max_width) if __name__ == '__main__': string, max_width = input(), int(input()) result = wrap(string, max_width) print(result)
ejspeiro/HackerRank
all_domains/python/strings/text_wrap.py
Python
mit
296
""" @brief test tree node (time=3s) """ import sys import os import unittest import warnings from pyquickhelper.loghelper import fLOG from pyquickhelper.pycode import get_temp_folder from pymyinstall.installhelper.install_venv_helper import create_virtual_env, run_venv_script class TestInstallWithDeps(unittest....
sdpython/pymyinstall
_unittests/ut_packaged/test_LONG_install_with_deps.py
Python
mit
1,872