code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# cython: auto_cpdef=True, infer_types=True, language_level=3, py2_import=True
#
# Parser
#
# This should be done automatically
import cython
cython.declare(Nodes=object, ExprNodes=object, EncodedString=object)
import os
import re
import sys
from Cython.Compiler.Scanning import PyrexScanner, FileSourceDescriptor
i... | hpfem/cython | Cython/Compiler/Parsing.py | Python | apache-2.0 | 99,707 |
def isPrime(num):
if(num==1):
return False
for x in range(2, num//2+1):
if(num%x==0):
return False
return True
count=2
number=3
while(count<10001):
number+=2
if(isPrime(number)):
print(str(count)+" "+str(number))
count+=1
print(number)
| scottnm/ProjectEuler | python/Problem7-firstNprimes.py | Python | apache-2.0 | 314 |
"""
read informs dataset
"""
# !/usr/bin/env python
# coding=utf-8
# Read data and read tree fuctions for INFORMS data
# user att ['DUID','PID','DUPERSID','DOBMM','DOBYY','SEX','RACEX','RACEAX','RACEBX','RACEWX','RACETHNX','HISPANX','HISPCAT','EDUCYEAR','Year','marry','income','poverty']
# condition att ['DUID','DUPE... | qiyuangong/Mondrian | utils/read_informs_data.py | Python | mit | 2,303 |
#!/usr/bin/python
import sys, subprocess, time, socket
sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCDPlate")
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
from PiLCDDisplay import PiLCDDisplay
HOLD_TIME = 3.0 #Time (seconds) to hold select button for shut down
REFRESH_TIME = ... | denmojo/PiLCD | PiLCD.py | Python | gpl-3.0 | 2,328 |
#!/usr/bin/env python
"""
@package ion.agents.data.handlers.slocum_data_handler
@file ion/agents/data/handlers/slocum_data_handler
@author Christopher Mueller
@brief
"""
from pyon.public import log
from pyon.util.containers import get_safe
from ion.services.dm.utility.granule.record_dictionary import RecordDictionary... | ooici/coi-services | ion/agents/data/handlers/slocum_data_handler.py | Python | bsd-2-clause | 8,434 |
"""
---------------------------------------------------------------------
.. sectionauthor:: Juan Arias de Reyna <arias@us.es>
This module implements zeta-related functions using the Riemann-Siegel
expansion: zeta_offline(s,k=0)
* coef(J, eps): Need in the computation of Rzeta(s,k)
* Rzeta_simul(s, der=0) computes R... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/mpmath/functions/rszeta.py | Python | mit | 46,233 |
f_int = 6
f_float = 7.0
f_bool = False
f_str = "hi"
f_list = [1, True, "bye"]
other_d = {}
_private_i = 123
print("f_int: {}".format(f_int))
print("f_float: {}".format(f_float))
print("f_bool: {}".format(f_bool))
print("f_str: {}".format(f_str))
print("f_list: {}".format(f_list))
| guildai/guild | guild/tests/samples/projects/flags/main_globals.py | Python | apache-2.0 | 284 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Acehaidrey/incubator-airflow | airflow/providers/google/cloud/example_dags/example_automl_nl_text_sentiment.py | Python | apache-2.0 | 3,589 |
#!/usr/bin/env python
import rospy
from camera_manager import Camera
import tf
from ieee2016_msgs.srv import RequestMap
import numpy as np
class PointIntersector():
'''
Given a point in the camera frame and Shia's current position estimate where that point is along the wall.
(We are assuming that the bl... | ufieeehw/IEEE2016 | ros/ieee2016_vision/scripts/point_intersector.py | Python | mit | 3,584 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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, either version 3 of the License, or
(at your option) any later version.
This prog... | repotvsupertuga/repo | plugin.video.zen/resources/lib/sources/bcinema_mv_tv.py | Python | gpl-2.0 | 3,582 |
""" log machine-parseable test session result information in a plain
text file.
"""
import os
import py
from _pytest.store import StoreKey
resultlog_key = StoreKey["ResultLog"]()
def pytest_addoption(parser):
group = parser.getgroup("terminal reporting", "resultlog plugin options")
group.addoption(
... | alfredodeza/pytest | src/_pytest/resultlog.py | Python | mit | 3,302 |
import unittest
from mock import patch
from geopy.point import Point
from geopy.exc import GeocoderNotFound
from geopy.geocoders import get_geocoder_for_service, GoogleV3
from geopy.geocoders.base import Geocoder, DEFAULT_TIMEOUT
import geopy.geocoders.base
class GetGeocoderTestCase(unittest.TestCase):
def test... | mthh/geopy | test/geocoders/base.py | Python | mit | 3,152 |
from pip.req import parse_requirements as pip_parse_requirements
from pip.req import InstallRequirement
def is_pypi_requirement(requirement):
return requirement.req and not requirement.link
def parse_requirements(path_to_requirements):
""" Parse requirements
:param path_to_requirements: path/to/require... | 5monkeys/reqlice | reqlice/requirement.py | Python | mit | 926 |
""" This module provides the backend Flask server that serves an experiment. """
from datetime import datetime, timedelta
from functools import update_wrapper
import gevent
from json import dumps
from json import loads
from operator import attrgetter
import os
import re
import sys
import user_agents
from flask import... | jcpeterson/Dallinger | dallinger/experiment_server/experiment_server.py | Python | mit | 60,002 |
import json
import logging
from functools import wraps
logger = logging.getLogger(__name__)
class PandaError(Exception):
pass
def error_check(func):
@wraps(func)
def check(*args, **kwargs):
try:
res = func(*args, **kwargs)
if "error" in res:
logger.error(re... | pandastream/panda_client_python | panda/models.py | Python | mit | 5,728 |
import urllib.request
url = 'http://www.ifce.edu.br'
# Obter o conteúdo da página
pagina = urllib.request.urlopen(url)
texto1 = pagina.read().decode('utf-8')
# Outra forma de fazer a mesma coisa ..
import requests
page = requests.get(url)
texto2 = page.content.decode('utf-8')
# Verificamos que todas as linhas são i... | santiagosilas/propython | raspagem/random/exemplo01.py | Python | mit | 377 |
from django.conf.urls.defaults import patterns, url
from django.views.generic import DetailView, ListView
from polls.models import Poll
urlpatterns = patterns('',
(r'^$',
ListView.as_view(
queryset=Poll.objects.order_by('-pub_date')[:5],
context_object_name='latest_poll_list',
... | jokey2k/ShockGsite | polls/urls.py | Python | bsd-3-clause | 711 |
## Import numpy
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
def wvf_interpolate(times, voltages, knot_frequency):
"""
calculate b-spline interpolation derivatives for voltage data
according to interpolation mode
returns times, voltages and derivatives suitable for p... | camacazio/pdq-project | PDQ_configuration/PDQ_control_files/spline_dch_creation_coefficients.py | Python | gpl-3.0 | 3,064 |
"""
==============================================================================
Program: SpellingCorrector.py
Author: Kyle Reese Almryde
Date: Thu 03/28/2013 @ 12:03:42 PM
Description: This program tries to correct the spelling of a word using a
supplied dictionary and a criteria.
============... | KrbAlmryde/Utilities | Russian/SpellingCorrector.py | Python | mit | 3,049 |
from __future__ import absolute_import
from celery import shared_task
from roomsensor.models import Roomsensor
import time
@shared_task
def read(sensorname):
sensor = Roomsensor.objects.get(name=sensorname)
sensor.read()
@shared_task
def read_and_save_to_mongodb(sensorname):
sensor = Roomsensor.objects.... | volzotan/django-howl | howl/roomsensor/tasks.py | Python | mit | 794 |
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.decorators import action
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from rdmo.core.exports import XMLResponse
from rdmo.core.permis... | rdmorganiser/rdmo | rdmo/conditions/viewsets.py | Python | apache-2.0 | 2,141 |
import json
import time
from time import gmtime, strftime
import datetime
import sys
from dateutil import parser
import calendar
from TrendAnalyser import TrendAnalyser
start_time = time.time()
TA = TrendAnalyser(load_api=False, load_db=True)
end_time = time.time()
print "Time Taken:", end_time - start_time
| chewett/TrendAnalyser | tests/test_init_no_api_db.py | Python | mit | 312 |
"""
WSGI config for vitelco project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | kyrelos/vitelco-mobile-money-wallet | wsgi.py | Python | gpl-3.0 | 1,428 |
#! /usr/bin/env python
"""
Usage:
cm-image -h | --help
cm-image version
cm-image [--kind=KIND] info
cm-image [--kind=KIND] [--gui] build OS
cm-image [--kind=KIND] register OS
Arguments:
OS the OS you can find with cm-image list
GUI yes or no
Options:
--gui ... | rajpushkar83/cloudmesh | cloudmesh/image/cm_image.py | Python | apache-2.0 | 3,204 |
import csv
from StringIO import StringIO
from math import ceil
from collections import Mapping, Sequence
def __expand_container(cont, i, j, empty_sym=''):
""" Expand, if possible, the list of list cont of size (h, k) to a list
of lists of size (i, j). If the expansion is successful, newly
created ... | lucasoldaini/dict2csv | dict2csv.py | Python | mit | 3,606 |
def main ( m , n ) :
from matrix import mat , show
M = mat( m , n , 0 )
print( show( M ) , end = "" )
if __name__ == "__main__" :
import sys
main( *map( int , sys.argv[1:] ) )
| aureooms/mupi | zeros.py | Python | agpl-3.0 | 189 |
"""
This command exports a course from CMS to a git repository.
It takes as arguments the course id to export (i.e MITx/999/2020 ) and
the repository to commit too. It takes username as an option for identifying
the commit, as well as a directory path to place the git repository.
By default it will use settings.GIT_R... | XiaodunServerGroup/xiaodun-platform | cms/djangoapps/contentstore/management/commands/git_export.py | Python | agpl-3.0 | 2,288 |
# Uses python3
import sys
def agafa_valoroptim(pesadmes, llistavalors, llistapesos):
valortotal = 0.
# return valortotal
# def main():
# dadesinicials = list(map(int, sys.stdin.read().split()))
# nombre, pesadmes = dadesinicials[0:2]
# values = dadesinicials[2:(2 * n + 2):2]
# weights = d... | papapep/python | UC_SanDiego/1_AlgorithmicToolbox/Week3/fractional_knapsack.py | Python | gpl-3.0 | 727 |
from bitmovin.resources.models import AbstractModel
from bitmovin.resources import AbstractNameDescriptionResource
from bitmovin.errors import InvalidTypeError
from bitmovin.utils import Serializable
from .encoding_output import EncodingOutput
class Sprite(AbstractNameDescriptionResource, AbstractModel, Serializable)... | bitmovin/bitmovin-python | bitmovin/resources/models/encodings/sprite.py | Python | unlicense | 2,500 |
class Stack:
def __init__(self, pos, mem, wordsize):
""" Initialize stack
"""
self.base = pos
self.pos = pos
self.mem = mem
self.size = None
self.wordsize = wordsize
def getPos(self):
""" Get current position of stack
"""
return s... | jroivas/cpus | primitives/stack.py | Python | bsd-3-clause | 3,249 |
from django.db import transaction
from django.core.management.base import NoArgsCommand
from devilry.apps.core.models import Candidate
class Command(NoArgsCommand):
help = "Sync the cached fields in Candidate with the actual data from User."
def handle_noargs(self, **options):
verbosity = int(option... | vegarang/devilry-django | devilry/apps/superadmin/management/commands/devilry_sync_candidates.py | Python | bsd-3-clause | 750 |
import unittest
import sys
if sys.version_info[0] < 3:
mock_o = '__builtin__.open'
import mock
else:
mock_o = 'builtins.open'
import unittest.mock as mock
from obdlib.obd.pids import Pids
class TestPids(unittest.TestCase):
def setUp(self):
self.pids = Pids()
def test_set_mode(self):... | QualiApps/obdlib | tests/test_pids.py | Python | mit | 1,090 |
from SHISO import * | logpai/logparser | logparser/SHISO/__init__.py | Python | mit | 19 |
# Copyright 2009 Facebook
#
# 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 agreed to in writing, sof... | shubhamdhama/zulip | zerver/tornado/autoreload.py | Python | apache-2.0 | 8,826 |
"""Test runner for all Ansible tests."""
from __future__ import annotations
import os
import sys
import typing as t
# This import should occur as early as possible.
# It must occur before subprocess has been imported anywhere in the current process.
from .init import (
CURRENT_RLIMIT_NOFILE,
)
from .util import ... | mattclay/ansible | test/lib/ansible_test/_internal/__init__.py | Python | gpl-3.0 | 2,387 |
#!/usr/bin/env python
import sys
import subprocess
version = { }
header = """/* This file is automatically generated by {0}!
* Do not edit manually, any manual change will be overwritten.
*/
"""
if len(sys.argv)<3:
print("Usage:")
print(" {0} <infile> <outfile>".format(sys.argv[0]))
sys.exit(1)
#Ge... | itsnotmyfault1/kimcopter2 | crazyflie-firmware/scripts/versionTemplate.py | Python | gpl-2.0 | 1,098 |
"""
Capture log messages during test execution, appending them to the
error reports of failed tests.
This plugin implements :func:`startTestRun`, :func:`startTest`,
:func:`stopTest`, :func:`setTestOutcome`, and :func:`outcomeDetail` to
set up a logging configuration that captures log messages during test
execution, an... | leth/nose2 | nose2/plugins/logcapture.py | Python | bsd-2-clause | 5,817 |
import sys
import numpy as np
from copy import copy, deepcopy
import multiprocessing as mp
from numpy.random import shuffle, random, normal
from math import log, sqrt, exp, pi
import itertools as it
from scipy.stats import gaussian_kde, pearsonr
from scipy.stats import ttest_1samp
from itertools import product
try:
... | Gibbsdavidl/miergolf | src/corEdges.py | Python | bsd-3-clause | 3,914 |
"""
Tests whether the serializers work properly
"""
import os
import numpy as np
from noxer.serializers import FolderDatasetReader
class TestSerializers:
def setUp(self):
pass
def tearDown(self):
pass
def test_folder_dataset(self):
folder = os.path.join('test_data', 'folder_dat... | iaroslav-ai/noxer | noxer/tests/test_serializers.py | Python | mit | 1,124 |
from setuptools import setup, find_packages
setup(
name='spotify_connect_scrobbler',
version='0.1',
license='MIT',
packages=find_packages(),
install_requires=['click', 'python-dateutil', 'requests'],
entry_points={
'console_scripts': [
'scrobbler=spotify_connect_scrobbler.scrobb... | jeschkies/spotify-connect-scrobbler | setup.py | Python | mit | 407 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | taxpon/sverchok | utils/sv_draw_svg_node.py | Python | gpl-3.0 | 11,478 |
#/****************************************************************************
# Copyright 2008, Colorado School of Mines and others.
# 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
#
# htt... | askogvold/jtk | src/demo/jython/edu/mines/jtk/dsp/SteerablePyramidDemo.py | Python | apache-2.0 | 6,124 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Lithomop3d by Charles A. Williams
# Copyright (c) 2003-2005 Rensselaer Polytechnic Institute
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated... | geodynamics/lithomop | lithomop3d/lithomop3d/Lithomop3d_run.py | Python | mit | 20,127 |
#!/usr/bin/env python3
import unittest
from datetime import date
from pycaching.errors import ValueError
from pycaching import Trackable
from pycaching import Geocaching
from pycaching import Point
class TestProperties(unittest.TestCase):
def setUp(self):
self.gc = Geocaching()
self.t = Trackabl... | kumy/pycaching | test/test_trackable.py | Python | lgpl-3.0 | 1,338 |
from tests.support import platform_name
from webdriver.transport import Response
from tests.support.asserts import assert_error, assert_success
from tests.support.inline import inline
def navigate_to(session, url):
return session.transport.send(
"POST", "session/{session_id}/url".format(**vars(session)),... | nnethercote/servo | tests/wpt/web-platform-tests/webdriver/tests/navigate_to/navigate.py | Python | mpl-2.0 | 1,392 |
__author__ = 'Erik'
import random
import pygame
import os
from pygame import *
#Class for handling the game music, plays a random song from a list
class GameMusic:
#Was originally longer, but due to shortage of space I had to remove a few songs.
songList = [os.path.join('sounds', "msboy.mp3"),os.path.join('sou... | Ramqvist/SpaceMania | view/MusicHandler.py | Python | apache-2.0 | 1,117 |
# -*- coding: utf-8 -*-
from openerp.osv import osv, fields
class users(osv.osv):
_name = 'res.users'
_inherit = 'res.users'
_columns = {
'account_x_ids': fields.many2many('account.account', 'account_security_account_users','user_id',
'account_id', 'Rest... | elwan/Odoo | account_security/res_users.py | Python | gpl-2.0 | 498 |
#!/usr/bin/env python3
# Copyright (c) 2018-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""upgradewallet RPC functional test
Test upgradewallet RPC. Download node binaries:
test/get_previous_r... | Sjors/bitcoin | test/functional/wallet_upgradewallet.py | Python | mit | 16,487 |
def dummy_config():
return {
'uuid': 'TEST-UUID',
'main': {
'server': 'https://test.forge.io/api/'
}
} | grammarly/browser-extensions | generate/generate/tests/__init__.py | Python | bsd-3-clause | 113 |
#!/usr/bin/python
from smbus import SMBus
import RPi.GPIO as GPIO
import time
#for data input
import sys
from select import select
#i2c CAP1188 address
address = 0x29
CAP1188_SENINPUTSTATUS = 0x3
CAP1188_SENLEDSTATUS = 0x4
CAP1188_SENSNOISE = 0xA
CAP1188_NOISETHR = 0x38
CAP1188_MTBLK = 0x2A
CAP1188_PRODID = 0xFD
CAP... | r0bin-fr/pirok2 | capac.py | Python | gpl-3.0 | 2,732 |
# parsers.py - Python implementation of parsers.c
#
# Copyright 2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
from node import bin, nullid, nullrev
import util
import s... | dkrisman/Traipse | mercurial/parsers.py | Python | gpl-2.0 | 2,344 |
from toee import *
from utilities import *
from ed import *
from batch import *
###################################################################
### (18:55 20/04/06) A script written by Glen Wheeler (Ugignadl) for manipulating ToEE files.
### Requested by Cerulean the Blue from Co8.
##
### (13:05 22/04/06)... | GrognardsFromHell/TemplePlus | tpdatasrc/co8infra/scr/Co8.py | Python | mit | 22,189 |
# Copyright 2013 Google Inc. All Rights Reserved.
"""Generate usage text for displaying to the user.
"""
import argparse
import re
import StringIO
import sys
import textwrap
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.core.util import console_io
LINE_WIDTH = 80
HELP_INDENT = 25
MARKDOWN_BOL... | ychen820/microblog | y/google-cloud-sdk/lib/googlecloudsdk/calliope/usage_text.py | Python | bsd-3-clause | 16,991 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-21 15:44
from __future__ import unicode_literals
from django.db import migrations
import djgeojson.fields
class Migration(migrations.Migration):
dependencies = [
('survey', '0044_auto_20160618_1412'),
]
operations = [
migrat... | simonspa/django-datacollect | datacollect/survey/migrations/0045_record_coords.py | Python | gpl-3.0 | 498 |
# -*- coding: utf-8 -*-
"""
Projekt IIS - ordinacia praktickeho lekara
Usage:
main.py db init
main.py db drop
main.py generate random users <number_of_users>
main.py generate random drugs <number_of_drugs>
main.py generate random visits <max_visits>
main.py generate random predepsal <number>
... | Joozty/FIT-VUT | 5. Semester/IIS - Information Systems/app/main.py | Python | gpl-3.0 | 2,988 |
__author__ = 'michael'
import itertools
import unittest.mock
import pytest
from games import gset
@pytest.fixture(scope="module")
def fset():
testlist = [1, 2, 'Hallo', 2, gset.FiniteSet([2, 3, "Hallo"]), 'Hallo', None]
finiteset = gset.FiniteSet(testlist)
return (testlist, finiteset)
@pytest.fixture(s... | sonnerm/games | games/test_gset.py | Python | agpl-3.0 | 4,793 |
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from . import models
class LocationAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'content_type', 'parent', 'active', )
list_display_links = ('id', 'name', )
search_fields = ('name', 'name_ascii', 'body', )
... | emacsway/django-geo | geo/admin.py | Python | bsd-3-clause | 686 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Project: Create a Proxy Class
#
# In this assignment, create a proxy class (one is started for you
# below). You should be able to initialize the proxy object with any
# object. Any attributes called on the proxy object should be forwarded
# to the target object. As e... | ChristianAA/python_koans_solutions | python2/koans/about_proxy_object_project.py | Python | mit | 4,995 |
import os
def enumFeeds():
for fn in os.listdir('/etc/opkg'):
if fn.endswith('-feed.conf'):
try:
for feed in open(os.path.join('/etc/opkg', fn)):
yield feed.split()[1]
except IndexError:
pass
except IOError:
pass
def enumPlugins(filter_start=''):
for feed in enumFeeds():
package = None... | pli3/enigma2-git | lib/python/Components/opkg.py | Python | gpl-2.0 | 1,423 |
#/usr/bin/env python
# -#- coding: utf-8 -#-
#
# refdata/product/core/classes.py - reference data product core classes module
#
# This file is part of OndALear collection of open source components
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held l... | ajaniv/softwarebook | cpython/refdata/product/ir/classes.py | Python | gpl-2.0 | 3,284 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
float_or_none,
parse_iso8601,
update_url_query,
int_or_none,
determine_protocol,
unescapeHTML,
)
class SendtoNewsIE(InfoExtractor):
_VALID_URL = r'https?://embed\.sendtonews\.com/player2/... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/sendtonews.py | Python | gpl-3.0 | 3,101 |
# Copyright 2014 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 agr... | gablg1/PerfKitBenchmarker | tests/packages/ycsb_test.py | Python | apache-2.0 | 6,012 |
import time
import threading
import pytest
from eth_client_utils import BaseClient
class AsyncError(Exception):
pass
class ExampleClient(BaseClient):
_request_in_progress = False
def _make_request(self, *args, **kwargs):
"""
Implementation that isn't friendly to async requests.
... | pipermerriam/ethereum-client-utils | tests/base-client/test_base_client.py | Python | mit | 1,779 |
from django.shortcuts import render, get_object_or_404, redirect
from institutional.models import HomePage
from mezzanine.conf import settings
def homepage(request, template="index.html"):
"""
Direciona para a pagina inicial
"""
page = get_object_or_404(HomePage, slug=settings.HOME_PAGE_SITE)
if p... | roberzguerra/scout_mez | institutional/views.py | Python | gpl-2.0 | 425 |
#!/usr/bin/python
"""
Defines the XPainter class, a simple wrapper over the <QtGui.QPainter> class
that supports python's notion of enter/exit contexts to begin and end painting
on a device. This is more reliable than using Qt's scoping as the object
may linger in memory longer than in the C++ version.
:usag... | bitesofcode/projexui | projexui/xpainter.py | Python | lgpl-3.0 | 1,330 |
import sys
import json
from numbers import Number
import time
import requests
import six
from . import version
__BASE_URL = "https://api.outbound.io/v2"
__HEADERS = None
ERROR_INIT = 1
ERROR_USER_ID = 2
ERROR_EVENT_NAME = 3
ERROR_CONNECTION = 4
ERROR_UNKNOWN = 5
ERROR_TOKEN = 6
ERROR_CAMPAIGN_IDS = 7
ERROR_PREVIOUS... | outboundio/lib-python | outbound/__init__.py | Python | mit | 18,506 |
import json
import helpers
import requests
from models import Setting
def shodan(indicator):
try:
settings = Setting.query.filter_by(_id=1).first()
apikey = settings.shodankey
url = "https://api.shodan.io/shodan/host/"
ip = indicator
tempdict = {}
r = requests.get(u... | defpoint/threat_note | threat_note/libs/shodan.py | Python | apache-2.0 | 1,241 |
import binascii
import os
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
class Token(models.Model):
key = models.CharField(_("Key"), max_length=40, primary_key=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=m... | invliD/lana-dashboard | lana_dashboard/lana_api/models.py | Python | agpl-3.0 | 835 |
# 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 agreed to in writing, software
# d... | openstack/oslo.service | oslo_service/tests/test_fixture.py | Python | apache-2.0 | 1,458 |
#!/usr/bin/env python3
from bottle import get, post, request, run
import subprocess
@get('/')
def status():
return '''
<form action="/" method="post">
Process: <input name="process" type="text">
<input value="Search" type="submit">
</form>
'''
@post('/')
def do_status():
process = request.forms.get('pro... | aig787/Personal | Examples/CVE-2014-6271/status.py | Python | isc | 613 |
# -*- coding: utf-8 -*-
import glob
import os.path
import instlatte
from instlatte.lib import Sentient
from lascaux import config
from lascaux.system.util import parse_config
from lascaux.system.logger import logger
from lascaux.plugin import Plugin
logger = logger(__name__)
class PluginSubsystem(instlatte.Subsy... | hyphyphyph/lascaux | lascaux/subsystems/plugin/plugin.py | Python | mit | 3,724 |
# Copyright 2016 The TensorFlow Authors. 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 applica... | nanditav/15712-TensorFlow | tensorflow/contrib/metrics/python/ops/metric_ops_test.py | Python | apache-2.0 | 163,728 |
"""
First make sure you have a Python3 program for your answer in ./answer/
Then run:
python3 zipout.py
This will create a file `output.zip`.
To customize the files used by default, run:
python3 zipout.py -h
"""
import sys, os, optparse, logging, tempfile, subprocess, shutil
import iocollect
class ZipOut... | anoopsarkar/nlp-class-hw | ensegment/zipout.py | Python | apache-2.0 | 7,507 |
import os
import re
import sys
import unittest
from coalib import coala
from coalib.misc.ContextManagers import prepare_file
from coalib.tests.test_bears.LineCountTestBear import (
LineCountTestBear)
from coalib.tests.TestUtilities import execute_coala, bear_test_module
class coalaTest(unittest.TestCase):
d... | sudheesh001/coala | coalib/tests/coalaTest.py | Python | agpl-3.0 | 1,871 |
from django import template
from vault.models import UploadedFile
from news.models import Story
from django.template.defaultfilters import date, time
from datetime import datetime, timedelta
register = template.Library()
@register.simple_tag
def file_list(request, count=10):
files = UploadedFile.objects.for_user... | sigurdga/nidarholm | navigation/templatetags/interactivity.py | Python | agpl-3.0 | 1,488 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
from testtools import TestCase
from tokenizer import Tokenizer, parse_args, process_args
class TestTokenizer(TestCase):
def setUp(self):
super(TestTokenizer, self).setUp()
self.languages = "eng hin urd ben guj mal pan tel tam kan ... | irshadbhat/indic-tokenizer | polyglot_tokenizer/tests/test_tokenizer.py | Python | mit | 1,574 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wordapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| OtagoPolytechnic/LanguageCards | admin/manage.py | Python | mit | 250 |
import os
from note.infrastructure import config
from note.utils.cached_property import cached_property
from note.utils.os.fs import exist_in_or_above
from note.utils.pattern import Singleton
class PathHelper(metaclass=Singleton):
"""
提供工作空间中程序文件的绝对路径
"""
def __init__(self):
self._root_dir =... | urnote/urnote | note/module/pathhelper.py | Python | gpl-3.0 | 1,735 |
# encoding: utf-8
"""
@author: gallupliu
@contact: gallup-liu@hotmail.com
@version: 1.0
@license: Apache Licence
@file: v2_reader.py
@time: 2017/12/31 17:58
"""
import numpy as np
from data.models import *
from data.reader import TSVArchiveReader
class V2Reader(TSVArchiveReader):
def __init__(self, archive_pat... | gallupliu/QA | data/insuranceqa/reader/v2_reader.py | Python | apache-2.0 | 3,036 |
# -*- coding: UTF-8 -*-
# Copyright 2015-2017 Luc Saffre
# License: BSD (see file COPYING for details)
"""A :ref:`care` site with languages "en fr de".
.. autosummary::
:toctree:
lib
user_types
settings
"""
| khchine5/book | lino_book/projects/anna/__init__.py | Python | bsd-2-clause | 223 |
import random
from .tiles import base
INITIAL_TILES = [
base.ASSASSIN, base.BOWMAN, base.CHAMPION, base.DRAGOON, base.FOOTMAN,
base.GENERAL, base.KNIGHT, base.LONGBOWMAN, base.MARSHALL, base.PIKEMAN,
base.PIKEMAN, base.PRIEST, base.RANGER, base.SEER, base.WIZARD,
]
class Game(object):
def __init__(... | rorytrent/the-duke | duke/game.py | Python | gpl-3.0 | 499 |
from django.db import models
from .constants import *
class Polity(models.Model):
"""
contains information on political entities
"""
name = models.CharField(max_length=255)
polity_type = models.CharField(choices=POLITY_TYPES,
default='City',
... | asterix135/whoshouldivotefor | explorer/models.py | Python | mit | 4,638 |
import dsz
import dsz.cmd
import dsz.version
import dsz.script
import ops
import ops.cmd
import ops.db
import ops.project
import ops.system.registry
from datetime import timedelta, datetime
import time
INSTALL_DATE_TAG = 'OS_INSTALL_DATE_TAG'
OS_LANGUAGE_TAG = 'OS_LANGUAGE_TAG'
SYSTEMVERSION_TAG = 'OS_VERSION_TAG'
MAX... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Ops/PyScripts/lib/ops/system/systemversion.py | Python | unlicense | 1,313 |
from arza.types import root, api, space, plist, datatype
from arza.runtime import error
class W_MirrorType(datatype.W_BaseDatatype):
def __init__(self, name, interfaces):
datatype.W_BaseDatatype.__init__(self, name, interfaces)
def _type_(self, process):
return process.std.types.Datatype
... | gloryofrobots/obin | arza/types/mirror.py | Python | gpl-2.0 | 2,472 |
from sqlalchemy import Column, String, Integer, Float, ForeignKey, PrimaryKeyConstraint
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, validates, backref
import time, json
DecBase = declarative_base()
class Server(DecBase):
__tablename__ = 'ezdonate_servers'
id = ... | EasyDonate/EasyDonate | EasyDonate/ORM.py | Python | gpl-3.0 | 7,304 |
#The MIT License (MIT)
#
#Copyright (C) 2014 OpenBet Limited
#
#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,... | ianmiell/shutit-library | casperjs/casperjs.py | Python | mit | 1,626 |
import os
import shutil
import tempfile
import git
from dvc import logger
from dvc.exceptions import DvcException
class TempRepoException(DvcException):
"""Raise when temporary package repository has not properly created"""
def __init__(self, temp_repo, msg, cause=None):
m = "temp repository '{}' e... | dataversioncontrol/dvc | dvc/temp_git_repo.py | Python | apache-2.0 | 4,707 |
import imp
from kivy.uix.floatlayout import FloatLayout
import traceback
from core.failedscreen import FailedScreen
class InfoScreen(FloatLayout):
def __init__(self, **kwargs):
super(InfoScreen, self).__init__(**kwargs)
# Get our list of available plugins
plugins = kwargs["plugins"]
... | 9and3r/RPi-InfoScreen-Kivy | core/infoscreen.py | Python | gpl-3.0 | 3,546 |
import random
import numpy as np
class ReplayBuffer(object):
def __init__(self, max_size):
self.max_size = max_size
self.cur_size = 0
self.buffer = {}
self.init_length = 0
def __len__(self):
return self.cur_size
def seed_buffer(self, episodes):
self.init_... | n3011/deeprl | dataset/replay_v2.py | Python | mit | 4,664 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 agreed to in wr... | jferreir/mbed | workspace_tools/export/ds5_5.py | Python | apache-2.0 | 1,997 |
#!/usr/bin/env python3
# Copyright (c) 2017-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test debug logging."""
import os
from test_framework.test_framework import SyscoinTestFramework
from ... | syscoin/syscoin | test/functional/feature_logging.py | Python | mit | 2,940 |
from __future__ import absolute_import
from rest_framework.response import Response
from six.moves import range
from sentry.app import tsdb
from sentry.api.base import DocSection, StatsMixin
from sentry.api.bases.team import TeamEndpoint
from sentry.models import Project
from sentry.utils.apidocs import scenario, att... | alexm92/sentry | src/sentry/api/endpoints/team_stats.py | Python | bsd-3-clause | 2,574 |
# PyVision License
#
# Copyright (c) 2006-2008 David S. Bolme
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, thi... | tigerking/pyvision | src/pyvision/face/FaceRecognizer.py | Python | bsd-3-clause | 3,652 |
#
# Copyright 2012 Red Hat, Inc.
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | kvaps/vdsm | vdsm/gluster/__init__.py | Python | gpl-2.0 | 1,886 |
from datetime import datetime
from project.application.entities import db
class Material(db.Model):
"""
Need to add Table Structure
"""
__tablename__ = "materials"
id = db.Column(db.Integer, primary_key=True)
document = db.Column(db.Text, nullable=True)
information = db.Column(db.Text, n... | Warprobot/diplom | project/application/entities/materials/model.py | Python | cc0-1.0 | 540 |
import cocos
import pyglet
from pyglet import input
import game
import constants
control = None
def init():
global control
#control = GamepadController()
control = PlayerController()
return control
def get_state():
return control.state
class Controller(cocos.layer.Layer):
"""Base class ... | BadlybadGames/RPGame-3.0 | src/interface/controls.py | Python | mit | 5,979 |
import base64
import logging
import os
import random
import uuid
from base64 import b64encode
from datetime import datetime, timedelta, timezone
from io import BytesIO
from tempfile import NamedTemporaryFile
from uuid import uuid4
import pytz
from django.conf import settings
from django.core.files import File
from dja... | hobarrera/django-afip | django_afip/models.py | Python | isc | 44,887 |
import re
import tokenizer
from feature_extractor_counts import FeatureExtractorCounts
class FeatureExtractorProperty(FeatureExtractorCounts):
def __init__(self, min_df=2, max_per=1.0, binarize=False, transform=None, replace_num='#',
source=None, subdir=None, pseudotype=None, splits_file=None, ... | dallascard/guac | core/feature_extractors/feature_extractor_property.py | Python | apache-2.0 | 1,393 |
from __future__ import absolute_import, unicode_literals
import os
import unittest
import django
from django.conf import settings
from django.test import TestCase
from wagtail.wagtailcore.models import Site
from .utils import get_test_image_file, Image
@unittest.skipIf(django.VERSION < (1, 8), 'Multiple engines o... | serzans/wagtail | wagtail/wagtailimages/tests/test_jinja2.py | Python | bsd-3-clause | 2,475 |
from collections import Iterable
def is_iterable(arg):
"""
Checks if the provided argument is an iterable and not a string.
"""
return not isinstance(arg, str) and isinstance(arg, Iterable)
| iluxonchik/the-chronic | thechronic/utils.py | Python | mit | 207 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.