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 django.contrib import admin
from .models import Lesson, Series
class LessonAdmin(admin.ModelAdmin):
pass
class SeriesAdmin(admin.ModelAdmin):
pass
admin.site.register(Lesson, LessonAdmin)
admin.site.register(Series, SeriesAdmin) | python-krasnodar/python-krasnodar.ru | src/lessons/admin.py | Python | mit | 248 |
# -*- coding: utf-8 -*-
#
# exercise 5: more variables and printing
#
# string formating
name = 'Zed A. Shaw'
ages = 35 # not a lie
height = 74 # inched
weight = 180 # lbs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
print "Let's talk about %s." % name
print "He's %d inched tall." % height
print "He's %d pounds hea... | zstang/learning-python-the-hard-way | ex5.py | Python | mit | 635 |
#!/env/python3
import sys
import argparse
import os
import csv
import tabix
import gzip
import io
from collections import Counter
def chromosom_sizes(hg19_size_file):
''' Return chromosom size range ex: size["chr13"] = 234324 '''
results = {}
with open(hg19_size_file) as file:
reader = csv.reader(file, d... | gustaveroussy/98drivers | scripts/kart_racer.py | Python | mit | 1,836 |
class Campus(object):
def __init__(self,dados=None):
if dados is not None:
self.id = dados ['id']
self.nome = dados ['nome']
def getId(self):
return self.id
def setNome(self,nome):
self.nome = nome
def getNome(self):
return self.nome
| AEDA-Solutions/matweb | backend/Database/Models/Campus.py | Python | mit | 267 |
SAMPLES_YAML = {
'a': """\
- a1-a: [pk]
- [A1]
- [A2]
- [B1]
- [C1]
- [C2]
- [D1]
- [E1]
- [P1]
""",
'b': """\
- a1-a: [pk]
- [B1]
- [C1]
- [C2]
- [D1]
- [E1]
- a1-b: [pk]
... | katakumpo/nicedjango | tests/samples_compact_yaml.py | Python | mit | 6,357 |
# Notice:
# If you are running this in production environment, generate
# these for your app at https://dev.twitter.com/apps/new
TWITTER = {
'AUTH': {
'consumer_key': 'XXXX',
'consumer_secret': 'XXXX',
'token': 'XXXX',
'token_secret': 'XXXX',
}
}
# We're pulling data from grap... | balanced/status.balancedpayments.com | situation/settings.py | Python | mit | 2,611 |
# time series prediction of stock data
# using recurrent neural network with LSTM layer
from pybrain.datasets import SequentialDataSet
from itertools import cycle
from pybrain.tools.shortcuts import buildNetwork
from pybrain.structure.modules import LSTMLayer
from pybrain.supervised import RPropMinusTrainer
from pybrai... | samshara/Stock-Market-Analysis-and-Prediction | smap_nepse/prediction/recurrent.py | Python | mit | 3,734 |
# Italian / Italiano - Translations - Python 3 Only!
from seleniumbase import BaseCase
from seleniumbase import MasterQA
class CasoDiProva(BaseCase):
def __init__(self, *args, **kwargs):
super(CasoDiProva, self).__init__(*args, **kwargs)
self._language = "Italian"
def apri(self, *args, **kwa... | mdmintz/SeleniumBase | seleniumbase/translate/italian.py | Python | mit | 21,139 |
import os
import inspect
import logging
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
TRACEBACK_INSPECTOR = inspect.currentframe
DEBUG = logging.DEBUG
INFO = logging.INFO
ERROR = logging.ERROR
WARNING = logging.WARN
CRITICAL = logging.CRITICAL
def debugCaller(traceback=None):
""" Function ... | alok1974/compage | src/compage/logger.py | Python | mit | 5,536 |
# coding: utf-8
import pygame
import sys
from pygame.locals import *
from gui import *
from conexao import *
from jogador import *
from Queue import Queue
from threading import Thread
"""
Cliente
Tp de Redes - Truco
UFSJ
Carlos Magno
Lucas Geraldo
Requisitos:
*python 2.7
*pygame
Modulo Principal.
"""
class Princi... | Exterminus/Redes | Cliente/Cliente_Interface/cliente_gui.py | Python | mit | 18,741 |
import os
import dj_database_url
import re
from django.conf import settings
from cabot.celeryconfig import *
from cabot.cabot_config import *
settings_dir = os.path.dirname(__file__)
PROJECT_ROOT = os.path.abspath(settings_dir)
TEMPLATE_DEBUG = DEBUG = os.environ.get("DEBUG", False)
ADMINS = (
('Admin', os.envir... | lolotux/cabot-docker | cabot/settings.py | Python | mit | 7,851 |
from m2core.m2core import M2Core, logger
from m2core import bases
from m2core import data_schemes
from m2core import db
from m2core import utils
from m2core import common
| mdutkin/m2core | m2core/__init__.py | Python | mit | 171 |
class UndirectedGraphNode:
def __init__(self, x):
self.label = x
self.neighbors = []
#using DFS
class Solution:
# @param node, a undirected graph node
# @return a undirected graph node
def cloneGraph(self, node):
seen={}
visited=[]
seen[None] = None
hea... | bourneagain/pythonBytes | cloneGraph_BFS.py | Python | mit | 1,080 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
# with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf... | brooksc/bugherd | setup.py | Python | mit | 4,028 |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:52398")
pwd = raw_input("Enter wallet passphrase: ")
access.walletpassphrase(pwd, 60)
| harambe-dev/harambecoin | contrib/wallettools/walletunlock.py | Python | mit | 159 |
"""Get a `re.Pattern` instance (as given by re.compile()) with control over defaults of it's methods.
Useful to reduce if/else boilerplate when handling the output of search functions (match, search, etc.)
See [regex_search_hack.md](https://gist.github.com/thorwhalen/6c913e9be35873cea6efaf6b962fde07) for more explanato... | thorwhalen/ut | pstr/regex_with_defaults.py | Python | mit | 3,075 |
#coding=utf-8
#author='Shichao-Dong'
import requests
def client_getProductTypes():
url="http://172.31.3.73:8888/client/v1/clientAuth.action"
headers={"Connection": "keep-alive",
# "Referer": "http://172.31.3.73:6020/layout_new/login.jsp?url=http://172.31.3.73:6020/layout_new/login.html",
#"Ac... | NJ-zero/Android | Request/Client/client_getProductTypes.py | Python | mit | 2,677 |
from resumable import split, rebuild
import requests
def get(s):
return s
@rebuild
def example(_):
print('this is a good start')
value = split(requests.get, 'first')('http://ms.mause.me')
print(value.text)
value = split(lambda: 'hello', 'second')()
print('hello', value)
split(print... | Mause/resumable | main.py | Python | mit | 673 |
# -*- coding: utf-8 -*-
from itertools import product
import requests
import shutil
def api_list(apiargs):
"""Google Street View Image API results.
Constructs a list of `Google Street View Image API queries <https://developers.google.com/maps/documentation/streetview/>`_
from a dictionary.
Args:
ap... | rrwen/google_streetview | google_streetview/helpers.py | Python | mit | 2,418 |
from polyphony import testbench
from polyphony import pipelined
def pipe10(xs):
for i in pipelined(range(len(xs) - 1), ii=-1):
v = xs[i] + xs[i + 1]
v >>= 1
xs[i] = v
@testbench
def test():
data = [0, 16, 32, -16, -64]
pipe10(data)
assert 8 == data[0]
assert 24 == data[1]... | ktok07b6/polyphony | tests/pipeline/for10.py | Python | mit | 406 |
# -*- coding: utf-8 -*-
__author__ = 'hmizumoto'
from flask import Blueprint, request, render_template, abort
from app.utils import jwt_decode
from app.views.auth import check_login, authorized_user, login
from app.models import DOMAIN
from app import app
from app.decoretor import login_required
from bson import Object... | motomizuki/Qlone | app/views/view.py | Python | mit | 6,101 |
import re
import time
from astropy import units as u
from astropy.coordinates import SkyCoord
from panoptes.utils.time import current_time
from panoptes.utils import error as error
from panoptes.pocs.mount.serial import AbstractSerialMount
class Mount(AbstractSerialMount):
"""
Mount class for iOptron mo... | panoptes/POCS | src/panoptes/pocs/mount/ioptron/ieq30pro.py | Python | mit | 12,613 |
class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
pascal = []
if numRows >= 1:
pascal.append([1])
for i in range(1, numRows):
pascal.append([pascal[-1][0]])
for j in rang... | FeiZhan/Algo-Collection | answers/other/in sap/Pascal's Triangle.py | Python | mit | 470 |
from django import template
from django.contrib.contenttypes.models import ContentType
from django.template.loader import render_to_string
from ..models import TaggedItem, Tag
register = template.Library()
@register.assignment_tag
def get_tagged_items_for(object):
'''retrieve tagged items which relative with the... | giginet/django-generic-tagging | generic_tagging/templatetags/tagging.py | Python | mit | 1,210 |
"""WSGI application."""
import os
from sys import argv
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from tweetTrack.app import app
application = DispatcherMiddleware(app)
if __name__ == '__main__':
if len(argv) < 2 or argv[1] == 'Dev':
os.environ['FLASK_CONFIG'] ... | lnhubbell/tweetTrack | tweetTrack/wsgi.py | Python | mit | 651 |
import unittest
import ast
import sys
import logging
from datetime import datetime
import ast
# Include src in the Python search path.
sys.path.insert(0, '../src')
from ast_extensions import TypeDecASTModule
from check import (check_expr, check_mod, expr_template, call_function)
from parse_file import parse_type_decs... | jruberg/Pyty | test/unit_tests_core.py | Python | mit | 5,812 |
'''Brainfuck interpreter'''
VERSION = '0.1.2.1103'
def __static_vars():
'''Decorate, add static attr'''
def decorate(func):
'''The decorate'''
setattr(func, 'stdin_buffer', [])
return func
return decorate
@__static_vars()
def __getchar() -> int:
'''Return one char from stdin''... | Bestoa/py-brainfuck | nbfi/__init__.py | Python | mit | 2,726 |
"""Useful utilities for handling CWL inputs and outputs.
This is shared functionality abstracted across multiple approaches, currently
mostly handling CWL records. This needs some generalization to apply across
non-variant calling workflows.
"""
import collections
import pprint
import toolz as tz
def _get_all_cwlkey... | brainstorm/bcbio-nextgen | bcbio/cwl/cwlutils.py | Python | mit | 3,196 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import re, os
PACKAGE_PATH = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(PACKAGE_PATH, 'pythonvideoannotator','__init__.py'), 'r') as fd:
content = fd.read()
version = re.search(
r'^__versio... | UmSenhorQualquer/pythonVideoAnnotator | base/pythonvideoannotator/setup.py | Python | mit | 2,475 |
"""Suite WorldWideWeb suite, as defined in Spyglass spec.:
Level 1, version 1
Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetools
import MacOS
_code = 'WWW!'
class Worl... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py | Python | mit | 16,104 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-13 09:33
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('questionnaires', '0001_initial'),
]
operations = [
migrations.RenameModel(
... | warrenatmindset/DjangoFlowApp | questionnaires/migrations/0002_auto_20171113_0933.py | Python | mit | 440 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('chef_buddy', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='ingredientflavorcompound',
... | chef-buddy/chef-buddy-django | chef_buddy/migrations/0002_ingredientflavorcompound_score.py | Python | mit | 444 |
from office365.runtime.client_object_collection import ClientObjectCollection
from office365.sharepoint.content_type import ContentType
class ContentTypeCollection(ClientObjectCollection):
"""Content Type resource collection"""
def __init__(self, context, resource_path=None):
super(ContentTypeCollecti... | vgrem/SharePointOnline-REST-Python-Client | office365/sharepoint/content_type_collection.py | Python | mit | 376 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'http://rcarneva.github.io'
RELATIVE_URLS = Fa... | rcarneva/rcarneva.github.io | publishconf.py | Python | mit | 533 |
import numpy as np
from scipy.stats import skew, kurtosis, shapiro, pearsonr, ansari, mood, levene, fligner, bartlett, mannwhitneyu
from scipy.spatial.distance import braycurtis, canberra, chebyshev, cityblock, correlation, cosine, euclidean, hamming, jaccard, kulsinski, matching, russellrao, sqeuclidean
from sklearn.p... | diogo149/CauseEffectPairsPaper | configs/max_aggregate_only.py | Python | mit | 7,294 |
import os
import logging
from urllib.parse import urlencode, unquote
from flask import request, current_app
from flask_api import FlaskAPI
from flask_api.exceptions import APIException, NotFound
from . import services
from . import stores
from . import routes
log = logging.getLogger('api')
class TemplateNotFound(N... | joshfriend/memegen | memegen/app.py | Python | mit | 2,841 |
import scipy.sparse as ss
import warnings
warnings.simplefilter('ignore', ss.SparseEfficiencyWarning)
from sparray import FlatSparray
class Operations(object):
params = [['FlatSparray', 'csr_matrix']]
param_names = ['arr_type']
def setup(self, arr_type):
mat = ss.rand(3000, 4000, density=0.1, format='csr'... | perimosocordiae/sparray | bench/benchmarks/ops.py | Python | mit | 1,302 |
# -*- coding: utf-8 -*-
""" Methods for estimating structural breaks in time series regressions
TODO: extract and move Chow test from "commission test" over to here
"""
from __future__ import division
from collections import namedtuple
import logging
import numpy as np
import pandas as pd
from scipy.optimize import ... | c11/yatsm | yatsm/structural_break/_cusum.py | Python | mit | 6,887 |
from __future__ import unicode_literals, print_function
import os
import sys
import subprocess
import json
from ape import feaquencer
from ape import tasks
from .exceptions import ContainerError, ContainerNotFound, ProductNotFound
class Config(object):
APE_ROOT = os.environ['APE_ROOT_DIR']
SOURCE_HEADER = '#... | henzk/ape | ape/container_mode/tasks.py | Python | mit | 12,347 |
#!/usr/bin/env python2.7
'''
RSD: The reciprocal smallest distance algorithm.
Wall, D.P., Fraser, H.B. and Hirsh, A.E. (2003) Detecting putative orthologs, Bioinformatics, 19, 1710-1711.
Original author: Dennis P. Wall, Department of Biological Sciences, Stanford University.
Contributors: I-Hsien Wu, Computational B... | todddeluca/reciprocal_smallest_distance | rsd/rsd.py | Python | mit | 32,578 |
#!/bin/python
import os
import roomai.common
import copy
#
#0, 1, 2, 3, ..., 7, 8, 9, 10, 11, 12, 13, 14
#^ ^ ^ ^ ^
#| | | | |
#3, 10, J, Q, K, A, 2, r, R
#
class DouDiZhuActionElement:
str_to_rank = {'3':0, '4':1, '5':2... | DMRookie/RoomAI | roomai/doudizhu/DouDiZhuPokerAction.py | Python | mit | 7,614 |
from collections import ChainMap
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import render, redirect, resolve_url
from django.contrib import messages
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.tokens import default_token_gene... | nm6061/toolshare | app/views/account.py | Python | mit | 9,912 |
# -*- coding: utf-8 -*-
from openpyxl import load_workbook
from libs.xlsxInterface import getLevelTypes, travesalLevels
import models
from prettyprint import pp
from functools import partial
from django.db import transaction
def generateLevels(levelDict, levelTypes, cellAndValues):
currentDict = levelDict
pare... | qinggeng/ceShiGuanLiXiTong | site/ceShiGuanLiSite/apps/testManage/utils.py | Python | mit | 3,685 |
#!/usr/bin/env python3
import time
import random
import socket
from flask import Flask, render_template, redirect, url_for, request, jsonify
import config
log = None
# classes
class Agent():
def __init__(self, ip, cw=True, node=None, state='initial'):
self.ip = ip
self.cw = cw
self.state... | secgroup/MTFGatheRing | code/web.py | Python | mit | 7,006 |
import json
import logging
from math import ceil
import os
import click
import cligj
from .helpers import resolve_inout
from . import options
import rasterio
from rasterio.errors import CRSError
from rasterio.transform import Affine
from rasterio.coords import disjoint_bounds
logger = logging.getLogger('rio')
# C... | ryfeus/lambda-packs | Rasterio_osgeo_shapely_PIL_pyproj_numpy/source/rasterio/rio/rasterize.py | Python | mit | 10,025 |
# My computer was failing to recognize wifi networks after being woken up from sleep so this uses the network manager command
# line tool to force my computer to recognize the network I type in to the terminal.
import subprocess
network_name = raw_input("What is the name of your network? ")
subprocess.check_call(['nmc... | caryben/Ubuntu-bug-fixes | hidden_network_workaround.py | Python | mit | 357 |
#Evaluate semantic space against MEN dataset
import sys
import utils
from scipy import stats
import numpy as np
from math import sqrt
#Note: this is scipy's spearman, without tie adjustment
def spearman(x,y):
return stats.spearmanr(x, y)[0]
def readMEN(annotation_file):
pairs=[]
humans=[]
f=open(annotation_f... | minimalparts/Tutorials | FruitFly/MEN.py | Python | mit | 989 |
import unittest
from katas.beta.plus_1_array import up_array
class UpArrayTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(up_array([2, 3, 9]), [2, 4, 0])
def test_equals_2(self):
self.assertEqual(up_array([4, 3, 2, 5]), [4, 3, 2, 6])
def test_none(self):
sel... | the-zebulan/CodeWars | tests/beta_tests/test_plus_1_array.py | Python | mit | 422 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software with... | inirudebwoy/AutobahnPython | autobahn/twisted/websocket.py | Python | mit | 23,106 |
from flake8_quotes import QuoteChecker
import os
import subprocess
from unittest import TestCase
class TestChecks(TestCase):
def test_get_noqa_lines(self):
checker = QuoteChecker(None, filename=get_absolute_path('data/no_qa.py'))
self.assertEqual(checker.get_noqa_lines(checker.get_file_contents())... | zheller/flake8-quotes | test/test_checks.py | Python | mit | 10,373 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import xml.etree.ElementTree as ET
from pprint import pprint
filename = 'GeoLogger.gpx'
def main():
tree = ET.parse(filename)
root = tree.getroot()
pprint(root.tag)
pprint(root.attrib)
pprint(root.findtext('.'))
if __name__ == "__main__":
main()... | TheShellLand/pies | v3/Libraries/xml/xml-parse.py | Python | mit | 321 |
"""Converts image data to TFRecords file format with Example protos.
The image data set is expected to reside in JPEG files located in the
following directory structure.
data_dir/run/video1/00001.jpeg
data_dir/run/video1/00002.jpeg
data_dir/run/video1/00003.jpeg
...
data_dir/run/video2/00001.jpeg
data_dir... | frankgu/tensorflow_video_rnn | data_preparation/convert_to_records.py | Python | mit | 16,235 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM15/IEC61970/Wires/RegulatingControl.py | Python | mit | 7,227 |
"""
Authors: Jeremy Haugen, UCLA, Anthony Nguyen, UCLA
Created: June 2015
Copyright notice in LICENSE file
This file is used to take the raw files generated by
the SAM, which are in CSV format and processes it into
json format. Then it will contact the sMAP server and
upload the json data into sMAP
"""
import uuid_... | resolutedreamer/NESLDashboard | src/sam/sam_out/smap_out_parser_json.py | Python | mit | 2,605 |
from subprocess import PIPE, Popen
from sqlalchemy import create_engine
def run(p):
try:
p["log"].info(p["action"]['query'])
proc = Popen(p["action"]['query'], shell=True,
stdin=PIPE, stdout=PIPE, stderr=PIPE)
result = proc.communicate()
message = ''
for... | unkyulee/elastic-cms | src/task/modules/CMD.py | Python | mit | 530 |
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class PysamInstaller(ClusterSetup):
def run(self, nodes, master, user, user_shell, volumes):
for node in nodes:
log.info("Installing PySam 0.8.4 on %s" % (node.alias))
node.ssh.execute('mkdir -p /opt/software/pysam')
... | meissnert/StarCluster-Plugins | Pysam_0_8_4.py | Python | mit | 905 |
"""
Author: Eric J. Ma
Affiliation: Massachusetts Institute of Technology
"""
from random import choice
from generate_id import generate_id
class Sequence(object):
"""
The Sequence object is the lowest level object in the pathogen simulator.
It provides a container for storing seed sequences for the pathogens pre... | ericmjl/reassortment-simulation-and-reconstruction | sequence.py | Python | mit | 1,435 |
# Copyright 2009-2014 Ram Rachum.
# This program is distributed under the MIT license.
'''
This module defines scripts for selecting stuff.
See their documentation for more information.
'''
from __future__ import with_statement
import bisect
import re
import _ast
import os.path, sys
sys.path += [
os.path.dirna... | cool-RR/cute-wing-stuff | scripts/selecting_stuff.py | Python | mit | 6,144 |
from .routes_test_fixture import app # noqa
def test_stats_wiki_campaign(client):
# test active campaign
assert client.get("/stats/enwiki/1")._status_code == 200
# test archived campaign
assert client.get("/stats/enwiki/7")._status_code == 200
def test_stats(client):
assert client.get("/stats/"... | wiki-ai/wikilabels | tests/test_stats_routes.py | Python | mit | 342 |
from pyramid.security import (
_get_authentication_policy
)
def my_get_authentication_policy(request):
# CRITICAL
# _get_authentication_policy(request)
# this method will return the instanciate singleton object that handle
# policy in pyramid app
# the policy object store keys from conf for ge... | NaturalSolutions/NsPortal | Back/ns_portal/utils/utils.py | Python | mit | 380 |
#!/usr/bin/env python
# coding=utf-8
import requests
import time
import json
"""
ansible 运行结果回调
"""
class CallbackModule(object):
def v2_runner_item_on_ok(self, *args, **kwargs):
# time.sleep(10)
# print args
for i in dir(args[0]):
if not i.startswith('__'):
... | tao12345666333/Talk-Is-Cheap | ansible/plugins/callback/test.py | Python | mit | 3,110 |
import json
import os
from errata_tool import ErrataConnector, Erratum
from errata_tool.products import ProductList
import requests
import pytest
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
FIXTURES_DIR = os.path.join(TESTS_DIR, 'fixtures')
class MockResponse(object):
status_code = 200
encoding = ... | mmuzila/errata-tool | errata_tool/tests/conftest.py | Python | mit | 2,567 |
# -*- coding: utf-8 -*-
"""Test events classes.
This file is part of PyVISA.
:copyright: 2019-2020 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
import logging
import pytest
from pyvisa import constants, errors
from pyvisa.events import Event
from . import BaseT... | pyvisa/pyvisa | pyvisa/testsuite/test_event.py | Python | mit | 1,508 |
"""Findall regex operations in python.
findall(string[, pos[, endpos]])
Returns a list:
not like search and match which returns objects
Otherwise, it returns an empty list.
"""
import re
# look for every word in a string
pattern = re.compile(r"\w+")
result = pattern.findall("hey bro")
print result
patt = re.compile... | andela-ggikera/regex | findall.py | Python | mit | 700 |
from OpenGLCffi.GL import params
@params(api='gl', prms=['index', 'type', 'normalized', 'value'])
def glVertexAttribP1ui(index, type, normalized, value):
pass
@params(api='gl', prms=['index', 'type', 'normalized', 'value'])
def glVertexAttribP1uiv(index, type, normalized, value):
pass
@params(api='gl', prms=['ind... | cydenix/OpenGLCffi | OpenGLCffi/GL/EXT/ARB/vertex_type_2_10_10_10_rev.py | Python | mit | 3,794 |
public_key = b"\x30\x81\x9f\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x03\x81\x8d\x00\x30\x81\x89\x02\x81\x81\x00\xaf\x15\xe8" + \
b"\x75\x00\x06\xe4\xc5\xd5\xda\x2c\xc5\x63\x6a\xef\xa3\x06\x81\x99\x19\x8f\x2a\xb5\xd3\x2e\x50\x76\x94\xe1\xc1\x5a\xa2\x84\xd7\xad" + \
b"\x91\x2... | voetsjoeba/pyjks | tests/expected/unicode_passwords.py | Python | mit | 5,713 |
####
#Importing modules can serve 3 purposes if done right
#1-Allows you to add features to bare bones python
#2-Only importing what you need lets your imports serve as documentation for
# someone else reading your code later.
#3-By forcing you to import things, python helps you keep your programs small
####
#import ... | isaac-friedman/lphw | ex13.py | Python | mit | 777 |
from __future__ import print_function
from helpers import flatten, merge, add, search
import sys
import os
import yaml
import boto3
import termcolor
def str_presenter(dumper, data):
if len(data.splitlines()) == 1 and data[-1] == '\n':
return dumper.represent_scalar(
'tag:yaml.org,2002:str', dat... | AndrewChubatiuk/ssm-diff | states/states.py | Python | mit | 4,515 |
import random
from ..simulator import Simulator
class RandomMover(Simulator):
ACTIONS = ('up', 'down', 'left', 'right')
def start(self):
self.init_game()
while True:
self._check_pygame_events()
for drone in self.drones:
drone.do_move(random.choice(sel... | dev-coop/plithos | src/plithos/simulations/random_mover.py | Python | mit | 388 |
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
"""
Tests for RecordView module and view
Note: this module tests for rendering specifically for RecordView values, using
view description sitedata files, and as such duplicates some tests covered by
module test_en... | gklyne/annalist | src/annalist_root/annalist/tests/test_recordview.py | Python | mit | 56,603 |
'''
Created on 17-Feb-2015
@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.common.DomainObject import DomainObject
class Pagination(DomainObject):
'''
classdocs
'''
def __init__(self,obj):
'''
Constructor
'''
# Handler dictionary
handler = dict()
han... | OptimalPayments/Python_SDK | src/PythonNetBanxSDK/CardPayments/Pagination.py | Python | mit | 1,081 |
from pikka_bird_collector.parsers.table import Table as Parser
from .base_port_command import BasePortCommand, Base
class Mysql(BasePortCommand):
"""
Collector for MySQL (https://www.mysql.com/).
The collector is enabled whenever non-empty settings are passed.
Multiple instances r... | tiredpixel/pikka-bird-collector-py | pikka_bird_collector/collectors/mysql.py | Python | mit | 5,160 |
from django.db.models import signals
from django.utils.functional import curry
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from django.contrib.admin.models import LogEntry
from django.contrib.sessions.models import Session
from django_extlog.models import ExtLog
cla... | AxiaCore/django-extlog | django_extlog/middleware.py | Python | mit | 2,967 |
import io
import os
import requests
import shutil
import sys
import zipfile
from waxe_image import __version__
API_RELEASES_URL = 'https://api.github.com/repos/waxe/waxe-image/releases'
NG_BUILD_FOLDER = 'website'
def main(argv=sys.argv):
if len(argv) > 2:
print('Too many arguments')
sys.exit(1... | waxe/waxe-image | waxe_image/scripts/get_ng_build.py | Python | mit | 1,483 |
from django.conf import settings
from django.test.client import Client
from .base import BaseRenderer
from django_perseus.exceptions import RendererException
import logging
import mimetypes
import os
logger = logging.getLogger('perseus')
class DefaultRenderer(BaseRenderer):
def render_path(self, path=None, v... | lockwooddev/django-perseus | django_perseus/renderers/default.py | Python | mit | 2,589 |
#!/usr/bin/env python
# LIST NODES PY
# Extract just the nodes from the JSON file for human inspection
import argparse, json
parser = argparse.ArgumentParser()
parser.add_argument('plan', type=str, help='Plan data file')
args = parser.parse_args()
try:
with open(args.plan) as fp:
J = json.load(fp)
excep... | ECP-CANDLE/Supervisor | workflows/cp-leaveout/scripts/list-nodes.py | Python | mit | 450 |
"""
Task
You are the manager of a supermarket.
You have a list of N items together with their prices that consumers bought on a particular day.
Your task is to print each item_name and net_price in order of its first occurrence.
item_name = Name of the item.
net_price = Quantity of the item sold multiplied by the pri... | spradeepv/dive-into-python | hackerrank/domain/python/collections/ordered-dict.py | Python | mit | 1,458 |
# -*- coding: utf-8 -*-
"""Python library module for LSM6DS33 accelerometer and gyroscope.
This module for the Raspberry Pi computer helps interface the LSM6DS33
accelerometer and gyro.The library makes it easy to read
the raw accelerometer and gyro data through I²C interface and it also provides
methods for getting a... | SvetoslavKuzmanov/altimu10v5 | altimu10v5/lsm6ds33.py | Python | mit | 6,967 |
from glob import glob
import numpy
import pickle
import os
# Run iterations of "count" to count the number of terms in each folder of zipped up pubmed articles
home = os.environ["HOME"]
scripts = "%s/SCRIPT/repofish/analysis/methods" %(home)
base = "%s/data/pubmed" %os.environ["LAB"]
outfolder = "%s/repos" %(base)
ar... | vsoch/repofish | analysis/methods/1.run_find_repos.py | Python | mit | 1,341 |
#!/usr/bin/env python
import os.path
<<<<<<< HEAD
import re
import sys
=======
import sys
import gspread
>>>>>>> # This is a combination of 2 commits.
=======
<<<<<<< HEAD
import re
import sys
=======
import sys
import gspread
>>>>>>> # This is a combination of 2 commits.
>>>>>>> Update README.md
try:
from set... | ShivaShinde/gspread | setup.py | Python | mit | 1,845 |
import pygame
pygame.init()
#-- SCREEN CHARACTERISTICS ------------------------->>>
background_color = (255,255,255)
(width, height) = (300, 200)
class Particle:
def __init__(self, (x, y), radius):
self.x = x
self.y = y
self.radius = radius
self.color = (255, 0, 0)
self.t... | withtwoemms/pygame-explorations | render_particle.py | Python | mit | 926 |
import unittest
from scrapy.utils.sitemap import Sitemap, sitemap_urls_from_robots
class SitemapTest(unittest.TestCase):
def test_sitemap(self):
s = Sitemap("""<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://www.example.com/</loc>... | Mitali-Sodhi/CodeLingo | Dataset/python/test_utils_sitemap.py | Python | mit | 5,404 |
#!/usr/bin/python3
# Example using a character LCD connected to a Raspberry Pi or BeagleBone Black.
import time
import datetime
import Adafruit_CharLCD as LCD
def file_get_contents(filename):
with open(filename) as f:
return f.read()
# Raspberry Pi pin configuration:
lcd_rs = 24 # Note this might ... | mhkyg/OrangePIStuff | lcd/lcd_update.py | Python | mit | 1,190 |
import os
from celery import Celery
from django.apps import apps, AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local') # pragma: no cover
app = Cele... | cuongnb14/swagger-ui | swagger_ui/taskapp/celery.py | Python | mit | 911 |
def runProgram(programLines,swapLine):
result = [False,0]
accumulator = 0
executionIndex = 0
setOfRunInstructions = []
while (executionIndex not in setOfRunInstructions) and (executionIndex < len(programLines)):
#print("Execution index: " + str(executionIndex)+ " accumulator: " + str(accum... | caw13/adventofcode | python/2020/day_eight_part2.py | Python | mit | 1,872 |
import unittest
import os
import sys
import responses
current_dir = (os.path.abspath(os.path.dirname(__file__)))
sys.path.insert(0, os.path.join(current_dir, '..', '..'))
from processes.get_tmdb import Main, RequestAPI, StandardiseResponse, GatherException
class TestMain(unittest.TestCase):
"""Testing GetAPI"""... | kinoreel/kino-gather | processes/tests/test_get_tmdb.py | Python | mit | 24,240 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import time
from marshmallow import fields
from marshmallow.decorators import post_dump
from indico.core... | indico/indico | indico/web/http_api/responses.py | Python | mit | 1,367 |
'''
Created on Jun 20, 2016
@author: ionut
'''
import logging
logging.basicConfig(level=logging.DEBUG,
format='[%(asctime)s] - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
loggi... | iticus/spotlipy | settings_default.py | Python | mit | 1,141 |
import math
from param import *
class Sample:
def __init__(self):
self.time = 0
self.home1_x = 0.0
self.home1_y = 0.0
self.home1_theta = 0.0
self.home2_x = 0.0
self.home2_y = 0.0
self.home2_theta = 0.0
self.away1_x = 0.0
self.away1_y = 0.0
... | lukehsiao/RobotSoccer | MotionControl/scripts/kalman_filter/Sample.py | Python | mit | 2,688 |
import _plotly_utils.basevalidators
class AlignValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="align", parent_name="scatterternary.hoverlabel", **kwargs
):
super(AlignValidator, self).__init__(
plotly_name=plotly_name,
paren... | plotly/python-api | packages/python/plotly/plotly/validators/scatterternary/hoverlabel/_align.py | Python | mit | 591 |
import numpy as np
import cv2
import math
# Calculates rotation matrix to euler angles
# The result is the same as MATLAB except the order
# of the euler angles ( x and z are swapped ).
def rot_vec_to_euler(r):
# Rotate around x axis by 180 degrees to have [0, 0, 0] when facing forward
R = np.dot(np.array([[1... | JustusSchwan/MasterThesis | trash/utility_positional.py | Python | mit | 4,965 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'requirements.txt')) as fp:
requires = fp.readlines()
setup(
name='cebulany manager',
version='0.0.4',
classifiers=[],
author='Firemark',
author_email='marpiec... | hackerspace-silesia/cebulany-manager | setup.py | Python | mit | 495 |
# -*- coding: utf-8 -*-
#
# hash-ring-ctypes documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 2 18:10:26 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fi... | mattdennewitz/hash-ring-ctypes | docs/conf.py | Python | mit | 8,253 |
from typing import List
from test_framework import generic_test
def expression_synthesis(digits: List[int], target: int) -> bool:
# TODO - you fill in here.
return True
if __name__ == '__main__':
exit(
generic_test.generic_test_main('insert_operators_in_string.py',
... | shobhitmishra/CodingProblems | epi_judge_python/insert_operators_in_string.py | Python | mit | 426 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | jcoady9/beets | test/test_autotag.py | Python | mit | 34,286 |
"""1449. Form Largest Integer With Digits That Add up to Target
https://leetcode.com/problems/form-largest-integer-with-digits-that-add-up-to-target/
"""
from functools import lru_cache
from typing import List
class Solution:
def largest_number(self, cost: List[int], target: int) -> str:
def compare(a: st... | isudox/leetcode-solution | python-algorithm/leetcode/problem_1449.py | Python | mit | 2,700 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import os
from xml.etree import ElementTree as et
from lib.core.data import conf
from lib.core.data import logger
from lib.core.data import paths
from lib.core.datatype impo... | V11/volcano | server/sqlmap/lib/parse/payloads.py | Python | mit | 3,204 |
import codecs
import logging
import random
def import_url(path,lo,hi):
with codecs.open(path,encoding='utf-8') as f:
string = f.read()
arr = string.split('\n')
if not lo:
lo=0
if not hi:
hi=len(arr)
arr=arr[lo:hi]
url_arr = []
want = range(lo,hi)
# returns url an... | xmeng17/Malicious-URL-Detection | host/http_proxy/helper.py | Python | mit | 1,790 |
"""Templatetags for the ``document_library`` app."""
from django import template
from ..models import Document
register = template.Library()
@register.assignment_tag
def get_files_for_document(document):
"""
Returns the available files for all languages.
In case the file is already present in another ... | bitmazk/django-document-library | document_library/templatetags/document_library_tags.py | Python | mit | 1,256 |
# -*- coding: utf-8 -*-
from Instanssi.common.auth import user_access_required
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.contrib import auth
from django.urls import reverse
from Instanssi.users.forms import OpenIDLoginForm, DjangoLoginForm, ProfileForm
from Instanssi.... | Instanssi/Instanssi.org | Instanssi/users/views.py | Python | mit | 2,915 |